67 Commits

Author SHA1 Message Date
34d5318534 reintroduces envipytags 2025-11-11 12:47:24 +01:00
34d3b75c6f searchterm default 2025-11-11 12:32:44 +01:00
b9ac713cb2 minor 2025-11-11 11:41:48 +01:00
05bee9b718 mrg 2025-11-11 10:54:36 +01:00
0d9947e6ce chore: add tailwindcss autosort 2025-11-10 18:36:00 +13:00
e3b381ab41 chore: ignore code-workspace 2025-11-10 18:34:09 +13:00
97626337aa chore: add prettier formatting to html 2025-11-10 18:30:07 +13:00
2aded2ddd7 Merge remote-tracking branch 'origin/develop' into feature/frontend_update 2025-11-10 17:52:00 +13:00
f5133c1980 fix: remove obsolete page id 2025-11-06 10:36:04 +13:00
7fbc49afd3 chore: update citations 2025-11-05 17:50:56 +13:00
a087a518f6 chore: remove incorrect license header 2025-11-05 17:39:21 +13:00
881e0e6798 chore: fix typo 2025-11-05 17:38:52 +13:00
2eab66e9ee refactor: added meta.site_id for matomo 2025-11-05 17:37:44 +13:00
ab927b11a2 refactor: remove dependency-groups 2025-11-05 17:36:43 +13:00
fde60c3ad3 refactor: remove optional stubs 2025-11-05 17:35:45 +13:00
61a43da822 refactor: set enviformer to main 2025-11-05 17:34:31 +13:00
211ebfd19b refactor: remove enviformer loading in settings 2025-11-05 17:33:41 +13:00
06a6c23d05 fix: add tailwindcss/cli 2025-11-05 17:30:15 +13:00
3536a14e47 Merge remote-tracking branch 'origin/develop' into feature/frontend_update 2025-11-05 17:25:27 +13:00
7eb4029ac9 refactor: add public_mode for static pages to remove nav elements 2025-11-04 19:34:04 +13:00
7b38fc2e37 fix: remove jobs clash 2025-11-04 19:33:31 +13:00
4834348454 Merge remote-tracking branch 'origin/develop' into feature/frontend_update 2025-10-30 14:02:57 +13:00
0a52b12f02 fix: handle line-clamp issue with news 2025-10-29 19:59:45 +13:00
14571d23a6 docs: add pnpm note 2025-10-29 18:23:28 +13:00
ea8475f0e2 docs: update README regarding dev command 2025-10-29 18:07:56 +13:00
442d139217 chore: remove obsolete doc 2025-10-29 18:06:21 +13:00
1ba511a31d chore: minimize fallback data 2025-10-29 18:02:30 +13:00
5d89341955 chore: delete obsolete runserver command 2025-10-29 18:01:21 +13:00
5f390ac2d2 fix: reenable modal showing 2025-10-29 17:52:10 +13:00
46d21e60d2 chore: add example input to search 2025-10-29 16:36:01 +13:00
13be240226 feat: working search redirect 2025-10-29 16:30:00 +13:00
167a72f5a3 fix: remove obsolete menu list 2025-10-29 16:01:13 +13:00
1736319bd7 style: update navbar and add browse back 2025-10-29 15:58:17 +13:00
e87aae6bf7 style: add legal footers on login 2025-10-29 12:16:42 +13:00
253523c81f feat: add mock legal (impressum page) 2025-10-29 12:16:24 +13:00
15809a4ccf style: update login pages 2025-10-29 12:01:35 +13:00
b7e1dac66a feat: add mockup for static pages 2025-10-29 11:13:31 +13:00
849ebbe7f8 style: update hero 2025-10-29 11:13:07 +13:00
c5dcb36452 fix: dev command working 2025-10-29 10:59:22 +13:00
16a991220a Slim down Navbar 2025-10-22 12:10:46 +13:00
05c8e130b1 Add documentation link 2025-10-22 12:08:31 +13:00
4fd7856043 Remove fields from navbar 2025-10-22 12:07:55 +13:00
f5efaf1b3f Change to icon help button 2025-10-22 12:07:42 +13:00
4a2ef3a237 Add search icon mockup 2025-10-22 11:37:23 +13:00
d097013853 Add discourse API for better data retrieval 2025-10-22 11:37:13 +13:00
63cc7cf460 Change partners location 2025-10-22 11:36:25 +13:00
9ca94eeb42 Add initial design suggestion index page 2025-10-21 17:09:40 +13:00
de1dc75a12 Add styled footer 2025-10-20 22:30:11 +13:00
43a034427d Add optimized logo components 2025-10-20 22:25:30 +13:00
d98b60fc57 Add better image 2025-10-17 23:25:55 +13:00
86c3f9b808 Improve search look 2025-10-17 22:45:16 +13:00
4408a09e82 Add basic index redesign 2025-10-17 22:33:06 +13:00
f5889b270a New Layout for parallel styling
Signed-off-by: Tobias O <tobias.olenyi@envipath.com>
2025-10-17 20:25:50 +13:00
f76861a83f chore: migrate build commands to poe
Signed-off-by: Tobias O <tobias.olenyi@envipath.com>
2025-10-13 21:24:51 +13:00
110fbe12c1 chore: update gitignore for pnpm
Signed-off-by: Tobias O <tobias.olenyi@envipath.com>
2025-10-13 21:09:06 +13:00
d8dc9598ff chore: add makefile integration and documentation
Signed-off-by: Tobias O <tobias.olenyi@envipath.com>
2025-10-13 21:07:20 +13:00
b7e4abae1c chore: add pnpm install to make
Signed-off-by: Tobias O <tobias.olenyi@envipath.com>
2025-10-13 21:07:04 +13:00
2fa0be52ef Update commands to automatically run pnpm for relevant commands
Signed-off-by: Tobias O <tobias.olenyi@tum.de>
2025-10-13 21:07:04 +13:00
be5ff369e0 Setup TailwindCSS and DaisyUI
This commit introduces pnpm for build time dependency. While it does add
npm, it keeps it at a minimum and buildtime only to eventually allow for
automatic CI builds.

This is discussed in #133

Signed-off-by: Tobias O <tobias.olenyi@tum.de>
2025-10-13 21:07:04 +13:00
ee776e7d14 refactor: ALLOWED_HOSTS throws exception if not present
ALLOWED_HOSTS is now manfatory again. Also cleaned defunct SQLite
backend and autoformated fille to line lenght 100.

Signed-off-by: Tobias O <tobias.olenyi@envipath.com>
2025-10-13 21:06:42 +13:00
f27bc56379 chore: Setup pre-commit to automatically run ruff on commit.
Signed-off-by: Tobias O <tobias.olenyi@envipath.com>
2025-10-13 21:06:14 +13:00
547eac3411 chore: add basic ruff configuration with line lenght 100
Signed-off-by: Tobias O <tobias.olenyi@envipath.com>
2025-10-13 21:05:49 +13:00
9e66169d23 fix: fix docker compose command typo
Signed-off-by: Tobias O <tobias.olenyi@envipath.com>
2025-10-13 21:05:28 +13:00
9a43942f12 docs: remove alternative install instructions for lower maintenance.
Signed-off-by: Tobias O <tobias.olenyi@envipath.com>
2025-10-13 21:05:28 +13:00
1bad6e4b03 docs: add makefile and docker-compose for initial setup
Since sqlite is not a suitable backend due to array field switch to an
easy to setup postgres backend relying on docker. From cloning to run is
now just two commands.

Signed-off-by: Tobias O <tobias.olenyi@envipath.com>
2025-10-13 21:05:07 +13:00
ad38704ffe refactor: create local version of settings w/o postgres
This version allows installation using sqlite for local dev setup.

Signed-off-by: Tobias O <tobias.olenyi@envipath.com>
2025-10-13 21:04:31 +13:00
0775ad30d4 docs: add note on RDkit install painpoint
Signed-off-by: Tobias O <tobias.olenyi@envipath.com>
2025-10-13 21:03:13 +13:00
136 changed files with 8090 additions and 12944 deletions

View File

@ -105,7 +105,7 @@ jobs:
until pg_isready -h postgres -U postgres; do sleep 2; done until pg_isready -h postgres -U postgres; do sleep 2; done
# until redis-cli -h redis ping; do sleep 2; done # until redis-cli -h redis ping; do sleep 2; done
- name: Run Django Migrations - name: Run Django migrations
run: | run: |
source .venv/bin/activate source .venv/bin/activate
python manage.py migrate --noinput python manage.py migrate --noinput

View File

@ -87,7 +87,6 @@ TEMPLATES = [
"django.template.context_processors.request", "django.template.context_processors.request",
"django.contrib.auth.context_processors.auth", "django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages", "django.contrib.messages.context_processors.messages",
"epdb.context_processors.package_context",
], ],
}, },
}, },

View File

@ -21,7 +21,6 @@ from .models import (
ExternalDatabase, ExternalDatabase,
ExternalIdentifier, ExternalIdentifier,
JobLog, JobLog,
License,
) )
@ -63,10 +62,6 @@ class EnviFormerAdmin(EPAdmin):
pass pass
class LicenseAdmin(admin.ModelAdmin):
list_display = ["cc_string", "link", "image_link"]
class CompoundAdmin(EPAdmin): class CompoundAdmin(EPAdmin):
pass pass
@ -123,7 +118,6 @@ admin.site.register(JobLog, JobLogAdmin)
admin.site.register(Package, PackageAdmin) admin.site.register(Package, PackageAdmin)
admin.site.register(MLRelativeReasoning, MLRelativeReasoningAdmin) admin.site.register(MLRelativeReasoning, MLRelativeReasoningAdmin)
admin.site.register(EnviFormer, EnviFormerAdmin) admin.site.register(EnviFormer, EnviFormerAdmin)
admin.site.register(License, LicenseAdmin)
admin.site.register(Compound, CompoundAdmin) admin.site.register(Compound, CompoundAdmin)
admin.site.register(CompoundStructure, CompoundStructureAdmin) admin.site.register(CompoundStructure, CompoundStructureAdmin)
admin.site.register(SimpleAmbitRule, SimpleAmbitRuleAdmin) admin.site.register(SimpleAmbitRule, SimpleAmbitRuleAdmin)

View File

@ -1,32 +0,0 @@
"""
Context processors for enviPy application.
Context processors automatically make variables available to all templates.
"""
from .logic import PackageManager
from .models import Package
def package_context(request):
"""
Provides package data for the search modal which is included globally
in framework_modern.html.
Returns:
dict: Context dictionary with reviewed and unreviewed packages
"""
current_user = request.user
reviewed_package_qs = PackageManager.get_reviewed_packages()
unreviewed_package_qs = Package.objects.none()
# Only get user-specific packages if user is authenticated
if current_user.is_authenticated:
unreviewed_package_qs = PackageManager.get_all_readable_packages(current_user)
return {
"reviewed_packages": reviewed_package_qs,
"unreviewed_packages": unreviewed_package_qs,
}

View File

@ -12,16 +12,10 @@ from epdb.models import (
Permission, Permission,
User, User,
ExternalDatabase, ExternalDatabase,
License,
) )
class Command(BaseCommand): class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(
"-ol", "--only-licenses", action="store_true", help="Only create licenses."
)
def create_users(self): def create_users(self):
# Anonymous User # Anonymous User
if not User.objects.filter(email="anon@envipath.com").exists(): if not User.objects.filter(email="anon@envipath.com").exists():
@ -89,17 +83,6 @@ class Command(BaseCommand):
return anon, admin, g, user0 return anon, admin, g, user0
def create_licenses(self):
"""Create the six default licenses supported by enviPath"""
cc_strings = ["by", "by-nc", "by-nc-nd", "by-nc-sa", "by-nd", "by-sa"]
for cc_string in cc_strings:
if not License.objects.filter(cc_string=cc_string).exists():
new_license = License()
new_license.cc_string = cc_string
new_license.link = f"https://creativecommons.org/licenses/{cc_string}/4.0/"
new_license.image_link = f"https://licensebuttons.net/l/{cc_string}/4.0/88x31.png"
new_license.save()
def import_package(self, data, owner): def import_package(self, data, owner):
return PackageManager.import_legacy_package( return PackageManager.import_legacy_package(
data, owner, keep_ids=True, add_import_timestamp=False, trust_reviewed=True data, owner, keep_ids=True, add_import_timestamp=False, trust_reviewed=True
@ -174,10 +157,6 @@ class Command(BaseCommand):
@transaction.atomic @transaction.atomic
def handle(self, *args, **options): def handle(self, *args, **options):
# Create licenses
self.create_licenses()
if options.get("only_licenses", False):
return
# Create users # Create users
anon, admin, g, user0 = self.create_users() anon, admin, g, user0 = self.create_users()

View File

@ -1,18 +0,0 @@
# Generated by Django 5.2.7 on 2025-11-11 14:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("epdb", "0009_joblog"),
]
operations = [
migrations.AddField(
model_name="license",
name="cc_string",
field=models.TextField(default="by-nc-sa", verbose_name="CC string"),
preserve_default=False,
),
]

View File

@ -1,59 +0,0 @@
# Generated by Django 5.2.7 on 2025-11-11 14:13
import re
from django.contrib.postgres.aggregates import ArrayAgg
from django.db import migrations
from django.db.models import Min
def set_cc(apps, schema_editor):
License = apps.get_model("epdb", "License")
# For all existing licenses extract cc_string from link
for license in License.objects.all():
pattern = r"/licenses/([^/]+)/4\.0"
match = re.search(pattern, license.link)
if match:
license.cc_string = match.group(1)
license.save()
else:
raise ValueError(f"Could not find license for {license.link}")
# Ensure we have all licenses
cc_strings = ["by", "by-nc", "by-nc-nd", "by-nc-sa", "by-nd", "by-sa"]
for cc_string in cc_strings:
if not License.objects.filter(cc_string=cc_string).exists():
new_license = License()
new_license.cc_string = cc_string
new_license.link = f"https://creativecommons.org/licenses/{cc_string}/4.0/"
new_license.image_link = f"https://licensebuttons.net/l/{cc_string}/4.0/88x31.png"
new_license.save()
# As we might have existing Licenses representing the same License,
# get min pk and all pks as a list
license_lookup_qs = License.objects.values("cc_string").annotate(
lowest_pk=Min("id"), all_pks=ArrayAgg("id", order_by=("id",))
)
license_lookup = {
row["cc_string"]: (row["lowest_pk"], row["all_pks"]) for row in license_lookup_qs
}
Packages = apps.get_model("epdb", "Package")
for k, v in license_lookup.items():
# Set min pk to all packages pointing to any of the duplicates
Packages.objects.filter(pk__in=v[1]).update(license_id=v[0])
# remove the min pk from "other" pks as we use them for deletion
v[1].remove(v[0])
# Delete redundant License objects
License.objects.filter(pk__in=v[1]).delete()
class Migration(migrations.Migration):
dependencies = [
("epdb", "0010_license_cc_string"),
]
operations = [migrations.RunPython(set_cc)]

View File

@ -655,7 +655,6 @@ class ScenarioMixin(models.Model):
class License(models.Model): class License(models.Model):
cc_string = models.TextField(blank=False, null=False, verbose_name="CC string")
link = models.URLField(blank=False, null=False, verbose_name="link") link = models.URLField(blank=False, null=False, verbose_name="link")
image_link = models.URLField(blank=False, null=False, verbose_name="Image link") image_link = models.URLField(blank=False, null=False, verbose_name="Image link")

View File

@ -1,15 +1,15 @@
import csv import csv
import io import io
import logging import logging
from datetime import datetime
from typing import Any, Callable, List, Optional from typing import Any, Callable, List, Optional
from uuid import uuid4 from uuid import uuid4
from celery import shared_task from celery import shared_task
from celery.utils.functional import LRUCache from celery.utils.functional import LRUCache
from django.utils import timezone
from epdb.logic import SPathway from epdb.logic import SPathway
from epdb.models import Edge, EPModel, JobLog, Node, Package, Pathway, Rule, Setting, User from epdb.models import EPModel, JobLog, Node, Package, Pathway, Rule, Setting, User, Edge
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
ML_CACHE = LRUCache(3) # Cache the three most recent ML models to reduce load times. ML_CACHE = LRUCache(3) # Cache the three most recent ML models to reduce load times.
@ -29,7 +29,7 @@ def dispatch_eager(user: "User", job: Callable, *args, **kwargs):
log.task_id = uuid4() log.task_id = uuid4()
log.job_name = job.__name__ log.job_name = job.__name__
log.status = "SUCCESS" log.status = "SUCCESS"
log.done_at = timezone.now() log.done_at = datetime.now()
log.task_result = str(x) if x else None log.task_result = str(x) if x else None
log.save() log.save()

View File

@ -48,7 +48,6 @@ urlpatterns = [
re_path(r"^user$", v.users, name="users"), re_path(r"^user$", v.users, name="users"),
re_path(r"^group$", v.groups, name="groups"), re_path(r"^group$", v.groups, name="groups"),
re_path(r"^search$", v.search, name="search"), re_path(r"^search$", v.search, name="search"),
re_path(r"^predict$", v.predict_pathway, name="predict_pathway"),
# User Detail # User Detail
re_path(rf"^user/(?P<user_uuid>{UUID})", v.user, name="user"), re_path(rf"^user/(?P<user_uuid>{UUID})", v.user, name="user"),
# Group Detail # Group Detail
@ -142,11 +141,6 @@ urlpatterns = [
v.package_pathway, v.package_pathway,
name="package pathway detail", name="package pathway detail",
), ),
re_path(
rf"^package/(?P<package_uuid>{UUID})/predict$",
v.package_predict_pathway,
name="package predict pathway",
),
# Pathway Nodes # Pathway Nodes
re_path( re_path(
rf"^package/(?P<package_uuid>{UUID})/pathway/(?P<pathway_uuid>{UUID})/node$", rf"^package/(?P<package_uuid>{UUID})/pathway/(?P<pathway_uuid>{UUID})/node$",

View File

@ -362,34 +362,6 @@ def index(request):
return render(request, "index/index.html", context) return render(request, "index/index.html", context)
def predict_pathway(request):
"""Top-level predict pathway view using user's default package."""
if request.method != "GET":
return HttpResponseNotAllowed(["GET"])
context = get_base_context(request)
context["title"] = "enviPath - Predict Pathway"
context["meta"]["current_package"] = context["meta"]["user"].default_package
return render(request, "predict_pathway.html", context)
@package_permission_required()
def package_predict_pathway(request, package_uuid):
"""Package-specific predict pathway view."""
if request.method != "GET":
return HttpResponseNotAllowed(["GET"])
current_user = _anonymous_or_real(request)
current_package = PackageManager.get_package_by_id(current_user, package_uuid)
context = get_base_context(request)
context["title"] = f"enviPath - {current_package.name} - Predict Pathway"
context["meta"]["current_package"] = current_package
return render(request, "predict_pathway.html", context)
def packages(request): def packages(request):
current_user = _anonymous_or_real(request) current_user = _anonymous_or_real(request)
@ -710,6 +682,7 @@ def search(request):
if request.method == "GET": if request.method == "GET":
package_urls = request.GET.getlist("packages") package_urls = request.GET.getlist("packages")
searchterm = request.GET.get("search", "").strip() searchterm = request.GET.get("search", "").strip()
mode = request.GET.get("mode") mode = request.GET.get("mode")
# add HTTP_ACCEPT check to differentiate between index and ajax call # add HTTP_ACCEPT check to differentiate between index and ajax call
@ -810,7 +783,6 @@ def package_models(request, package_uuid):
elif request.method == "POST": elif request.method == "POST":
log_post_params(request) log_post_params(request)
name = request.POST.get("model-name") name = request.POST.get("model-name")
description = request.POST.get("model-description") description = request.POST.get("model-description")
@ -971,12 +943,6 @@ def package_model(request, package_uuid, model_uuid):
] ]
dispatch(current_user, evaluate_model, current_model.pk, multigen, eval_package_ids) dispatch(current_user, evaluate_model, current_model.pk, multigen, eval_package_ids)
return redirect(current_model.url)
elif hidden == "retrain":
from .tasks import dispatch, retrain
dispatch(current_user, retrain, current_model.pk)
return redirect(current_model.url) return redirect(current_model.url)
else: else:
return HttpResponseBadRequest() return HttpResponseBadRequest()
@ -1106,7 +1072,9 @@ def package(request, package_uuid):
write = request.POST.get("write") == "on" write = request.POST.get("write") == "on"
owner = request.POST.get("owner") == "on" owner = request.POST.get("owner") == "on"
cc_string = request.POST.get("license") license = request.POST.get("license")
license_link = request.POST.get("license-link")
license_image_link = request.POST.get("license-image-link")
if new_package_name: if new_package_name:
current_package.name = new_package_name current_package.name = new_package_name
@ -1134,15 +1102,24 @@ def package(request, package_uuid):
PackageManager.update_permissions(current_user, current_package, grantee, max_perm) PackageManager.update_permissions(current_user, current_package, grantee, max_perm)
return redirect(current_package.url) return redirect(current_package.url)
elif license is not None:
if license == "no-license":
if current_package.license is not None:
current_package.license.delete()
elif cc_string is not None:
cc_string = cc_string.strip()
if cc_string == "no-license": # Reset the package's license
current_package.license = None current_package.license = None
current_package.save() current_package.save()
return redirect(current_package.url) return redirect(current_package.url)
else: # Get the license and assign it to the package else:
current_package.license = License.objects.get(cc_string=cc_string) if current_package.license is not None:
current_package.license.delete()
license = License()
license.link = license_link
license.image_link = license_image_link
license.save()
current_package.license = license
current_package.save() current_package.save()
return redirect(current_package.url) return redirect(current_package.url)
@ -1197,7 +1174,7 @@ def package_compounds(request, package_uuid):
elif request.method == "POST": elif request.method == "POST":
compound_name = request.POST.get("compound-name") compound_name = request.POST.get("compound-name")
compound_smiles = request.POST.get("compound-smiles") compound_smiles = request.POST.get("compound-smiles").strip()
compound_description = request.POST.get("compound-description") compound_description = request.POST.get("compound-description")
c = Compound.create(current_package, compound_smiles, compound_name, compound_description) c = Compound.create(current_package, compound_smiles, compound_name, compound_description)
@ -1324,7 +1301,7 @@ def package_compound_structures(request, package_uuid, compound_uuid):
elif request.method == "POST": elif request.method == "POST":
structure_name = request.POST.get("structure-name") structure_name = request.POST.get("structure-name")
structure_smiles = request.POST.get("structure-smiles") structure_smiles = request.POST.get("structure-smiles").strip()
structure_description = request.POST.get("structure-description") structure_description = request.POST.get("structure-description")
try: try:
@ -1506,11 +1483,11 @@ def package_rules(request, package_uuid):
# Obtain parameters as required by rule type # Obtain parameters as required by rule type
if rule_type == "SimpleAmbitRule": if rule_type == "SimpleAmbitRule":
params["smirks"] = request.POST.get("rule-smirks") params["smirks"] = request.POST.get("rule-smirks").strip()
params["reactant_filter_smarts"] = request.POST.get("rule-reactant-smarts") params["reactant_filter_smarts"] = request.POST.get("rule-reactant-smarts")
params["product_filter_smarts"] = request.POST.get("rule-product-smarts") params["product_filter_smarts"] = request.POST.get("rule-product-smarts")
elif rule_type == "SimpleRDKitRule": elif rule_type == "SimpleRDKitRule":
params["reaction_smarts"] = request.POST.get("rule-reaction-smarts") params["reaction_smarts"] = request.POST.get("rule-reaction-smarts").strip()
elif rule_type == "ParallelRule": elif rule_type == "ParallelRule":
pass pass
elif rule_type == "SequentialRule": elif rule_type == "SequentialRule":
@ -1707,7 +1684,8 @@ def package_reactions(request, package_uuid):
elif request.method == "POST": elif request.method == "POST":
reaction_name = request.POST.get("reaction-name") reaction_name = request.POST.get("reaction-name")
reaction_description = request.POST.get("reaction-description") reaction_description = request.POST.get("reaction-description")
reactions_smirks = request.POST.get("reaction-smirks")
reactions_smirks = request.POST.get("reaction-smirks").strip()
educts = reactions_smirks.split(">>")[0].split(".") educts = reactions_smirks.split(">>")[0].split(".")
products = reactions_smirks.split(">>")[1].split(".") products = reactions_smirks.split(">>")[1].split(".")
@ -2281,7 +2259,6 @@ def package_pathway_edges(request, package_uuid, pathway_uuid):
elif request.method == "POST": elif request.method == "POST":
log_post_params(request) log_post_params(request)
edge_name = request.POST.get("edge-name") edge_name = request.POST.get("edge-name")
edge_description = request.POST.get("edge-description") edge_description = request.POST.get("edge-description")

View File

@ -30,7 +30,6 @@
/* Import DaisyUI plugin */ /* Import DaisyUI plugin */
@plugin "daisyui" { @plugin "daisyui" {
logs: true; logs: true;
exclude: rootscrollgutter;
} }
@import "./daisyui-theme.css"; @import "./daisyui-theme.css";

View File

@ -1,7 +1,6 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#new_compound_modal"> <a role="button" data-toggle="modal" data-target="#new_compound_modal">
<span class="glyphicon glyphicon-plus"></span> New Compound</a <span class="glyphicon glyphicon-plus"></span> New Compound</a>
> </li>
</li>
{% endif %} {% endif %}

View File

@ -1,11 +1,6 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a <a role="button" data-toggle="modal" data-target="#new_compound_structure_modal">
role="button" <span class="glyphicon glyphicon-plus"></span> New Compound Structure</a>
data-toggle="modal" </li>
data-target="#new_compound_structure_modal"
>
<span class="glyphicon glyphicon-plus"></span> New Compound Structure</a
>
</li>
{% endif %} {% endif %}

View File

@ -1,7 +1,6 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#new_edge_modal"> <a role="button" data-toggle="modal" data-target="#new_edge_modal">
<span class="glyphicon glyphicon-plus"></span> New Edge</a <span class="glyphicon glyphicon-plus"></span> New Edge</a>
> </li>
</li>
{% endif %} {% endif %}

View File

@ -1,5 +1,4 @@
<li> <li>
<a role="button" data-toggle="modal" data-target="#new_group_modal"> <a role="button" data-toggle="modal" data-target="#new_group_modal">
<span class="glyphicon glyphicon-plus"></span> New Group</a <span class="glyphicon glyphicon-plus"></span> New Group</a>
>
</li> </li>

View File

@ -1,7 +1,6 @@
{% if meta.can_edit and meta.enabled_features.MODEL_BUILDING %} {% if meta.can_edit and meta.enabled_features.MODEL_BUILDING %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#new_model_modal"> <a role="button" data-toggle="modal" data-target="#new_model_modal">
<span class="glyphicon glyphicon-plus"></span> New Model</a <span class="glyphicon glyphicon-plus"></span> New Model</a>
> </li>
</li>
{% endif %} {% endif %}

View File

@ -1,7 +1,6 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#new_node_modal"> <a role="button" data-toggle="modal" data-target="#new_node_modal">
<span class="glyphicon glyphicon-plus"></span> New Node</a <span class="glyphicon glyphicon-plus"></span> New Node</a>
> </li>
</li>
{% endif %} {% endif %}

View File

@ -1,20 +1,12 @@
<li> <li>
<a role="button" data-toggle="modal" data-target="#new_package_modal"> <a role="button" data-toggle="modal" data-target="#new_package_modal">
<span class="glyphicon glyphicon-plus"></span> New Package</a <span class="glyphicon glyphicon-plus"></span> New Package</a>
>
</li> </li>
<li> <li>
<a role="button" data-toggle="modal" data-target="#import_package_modal"> <a role="button" data-toggle="modal" data-target="#import_package_modal">
<span class="glyphicon glyphicon-import"></span> Import Package from JSON</a <span class="glyphicon glyphicon-import"></span> Import Package from JSON</a>
>
</li> </li>
<li> <li>
<a <a role="button" data-toggle="modal" data-target="#import_legacy_package_modal">
role="button" <span class="glyphicon glyphicon-import"></span> Import Package from legacy JSON</a>
data-toggle="modal"
data-target="#import_legacy_package_modal"
>
<span class="glyphicon glyphicon-import"></span> Import Package from legacy
JSON</a
>
</li> </li>

View File

@ -1,9 +1,6 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a <a role="button" data-toggle="modal" data-target="#predict_modal">
href="{% if meta.current_package %}{{ meta.current_package.url }}/predict{% else %}{{ meta.server_url }}/predict{% endif %}" <span class="glyphicon glyphicon-plus"></span> New Pathway</a>
> </li>
<span class="glyphicon glyphicon-plus"></span> New Pathway</a
>
</li>
{% endif %} {% endif %}

View File

@ -1,7 +1,6 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#new_reaction_modal"> <a role="button" data-toggle="modal" data-target="#new_reaction_modal">
<span class="glyphicon glyphicon-plus"></span> New Reaction</a <span class="glyphicon glyphicon-plus"></span> New Reaction</a>
> </li>
</li>
{% endif %} {% endif %}

View File

@ -1,7 +1,6 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#new_rule_modal"> <a role="button" data-toggle="modal" data-target="#new_rule_modal">
<span class="glyphicon glyphicon-plus"></span> New Rule</a <span class="glyphicon glyphicon-plus"></span> New Rule</a>
> </li>
</li>
{% endif %} {% endif %}

View File

@ -1,7 +1,6 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#new_scenario_modal"> <a role="button" data-toggle="modal" data-target="#new_scenario_modal">
<span class="glyphicon glyphicon-plus"></span> New Scenario</a <span class="glyphicon glyphicon-plus"></span> New Scenario</a>
> </li>
</li>
{% endif %} {% endif %}

View File

@ -1,7 +1,6 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#new_setting_modal"> <a role="button" data-toggle="modal" data-target="#new_setting_modal">
<span class="glyphicon glyphicon-plus"></span>New Setting</a <span class="glyphicon glyphicon-plus"></span>New Setting</a>
> </li>
</li>
{% endif %} {% endif %}

View File

@ -1,43 +1,32 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#edit_compound_modal"> <a role="button" data-toggle="modal" data-target="#edit_compound_modal">
<i class="glyphicon glyphicon-edit"></i> Edit Compound</a <i class="glyphicon glyphicon-edit"></i> Edit Compound</a>
> </li>
</li> <li>
<li> <a role="button" data-toggle="modal" data-target="#set_aliases_modal">
<a role="button" data-toggle="modal" data-target="#set_aliases_modal"> <i class="glyphicon glyphicon-plus"></i> Set Aliases</a>
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a </li>
> <li>
</li> <a role="button" data-toggle="modal" data-target="#add_structure_modal">
<li> <i class="glyphicon glyphicon-plus"></i> Add Structure</a>
<a role="button" data-toggle="modal" data-target="#add_structure_modal"> </li>
<i class="glyphicon glyphicon-plus"></i> Add Structure</a <li>
> <a role="button" data-toggle="modal" data-target="#set_scenario_modal">
</li> <i class="glyphicon glyphicon-plus"></i> Set Scenarios</a>
<li> </li>
<a role="button" data-toggle="modal" data-target="#set_scenario_modal"> <li>
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a <a role="button" data-toggle="modal" data-target="#generic_set_external_reference_modal">
> <i class="glyphicon glyphicon-plus"></i> Set External Reference</a>
</li> </li>
<li>
<a
role="button"
data-toggle="modal"
data-target="#generic_set_external_reference_modal"
>
<i class="glyphicon glyphicon-plus"></i> Set External Reference</a
>
</li>
{% endif %} {% endif %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#generic_copy_object_modal"> <a role="button" data-toggle="modal" data-target="#generic_copy_object_modal">
<i class="glyphicon glyphicon-duplicate"></i> Copy</a <i class="glyphicon glyphicon-duplicate"></i> Copy</a>
> </li>
</li>
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a class="button" data-toggle="modal" data-target="#generic_delete_modal"> <a class="button" data-toggle="modal" data-target="#generic_delete_modal">
<i class="glyphicon glyphicon-trash"></i> Delete Compound</a <i class="glyphicon glyphicon-trash"></i> Delete Compound</a>
> </li>
</li>
{% endif %} {% endif %}

View File

@ -1,35 +1,22 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a <a role="button" data-toggle="modal" data-target="#edit_compound_structure_modal">
role="button" <i class="glyphicon glyphicon-edit"></i> Edit Compound Structure</a>
data-toggle="modal" </li>
data-target="#edit_compound_structure_modal" <li>
> <a role="button" data-toggle="modal" data-target="#set_aliases_modal">
<i class="glyphicon glyphicon-edit"></i> Edit Compound Structure</a <i class="glyphicon glyphicon-plus"></i> Set Aliases</a>
> </li>
</li> <li>
<li> <a role="button" data-toggle="modal" data-target="#set_scenario_modal">
<a role="button" data-toggle="modal" data-target="#set_aliases_modal"> <i class="glyphicon glyphicon-plus"></i> Set Scenarios</a>
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a </li>
> <li>
</li> <a role="button" data-toggle="modal" data-target="#generic_set_external_reference_modal">
<li> <i class="glyphicon glyphicon-plus"></i> Set External Reference</a>
<a role="button" data-toggle="modal" data-target="#set_scenario_modal"> </li>
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a <li>
> <a class="button" data-toggle="modal" data-target="#generic_delete_modal">
</li> <i class="glyphicon glyphicon-trash"></i> Delete Compound Structure</a>
<li> </li>
<a
role="button"
data-toggle="modal"
data-target="#generic_set_external_reference_modal"
>
<i class="glyphicon glyphicon-plus"></i> Set External Reference</a
>
</li>
<li>
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
<i class="glyphicon glyphicon-trash"></i> Delete Compound Structure</a
>
</li>
{% endif %} {% endif %}

View File

@ -1,17 +1,14 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#set_aliases_modal"> <a role="button" data-toggle="modal" data-target="#set_aliases_modal">
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a <i class="glyphicon glyphicon-plus"></i> Set Aliases</a>
> </li>
</li> <li>
<li> <a role="button" data-toggle="modal" data-target="#set_scenario_modal">
<a role="button" data-toggle="modal" data-target="#set_scenario_modal"> <i class="glyphicon glyphicon-plus"></i> Set Scenarios</a>
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a </li>
> <li>
</li> <a class="button" data-toggle="modal" data-target="#generic_delete_modal">
<li> <i class="glyphicon glyphicon-trash"></i> Delete Edge</a>
<a class="button" data-toggle="modal" data-target="#generic_delete_modal"> </li>
<i class="glyphicon glyphicon-trash"></i> Delete Edge</a
>
</li>
{% endif %} {% endif %}

View File

@ -1,12 +1,10 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#edit_group_member_modal"> <a role="button" data-toggle="modal" data-target="#edit_group_member_modal">
<i class="glyphicon glyphicon-trash"></i> Add/Remove Member</a <i class="glyphicon glyphicon-trash"></i> Add/Remove Member</a>
> </li>
</li> <li>
<li> <a role="button" data-toggle="modal" data-target="#generic_delete_modal">
<a role="button" data-toggle="modal" data-target="#generic_delete_modal"> <i class="glyphicon glyphicon-trash"></i> Delete Group</a>
<i class="glyphicon glyphicon-trash"></i> Delete Group</a </li>
>
</li>
{% endif %} {% endif %}

View File

@ -1,22 +1,18 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#edit_model_modal"> <a role="button" data-toggle="modal" data-target="#edit_model_modal">
<i class="glyphicon glyphicon-edit"></i> Edit Model</a <i class="glyphicon glyphicon-edit"></i> Edit Model</a>
> </li>
</li> <li>
<li> <a role="button" data-toggle="modal" data-target="#evaluate_model_modal">
<a role="button" data-toggle="modal" data-target="#evaluate_model_modal"> <i class="glyphicon glyphicon-ok"></i> Evaluate Model</a>
<i class="glyphicon glyphicon-ok"></i> Evaluate Model</a </li>
> <li>
</li> <a role="button" data-toggle="modal" data-target="#retrain_model_modal">
<li> <i class="glyphicon glyphicon-repeat"></i> Retrain Model</a>
<a role="button" data-toggle="modal" data-target="#retrain_model_modal"> </li>
<i class="glyphicon glyphicon-repeat"></i> Retrain Model</a <li>
> <a class="button" data-toggle="modal" data-target="#generic_delete_modal">
</li> <i class="glyphicon glyphicon-trash"></i> Delete Model</a>
<li> </li>
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
<i class="glyphicon glyphicon-trash"></i> Delete Model</a
>
</li>
{% endif %} {% endif %}

View File

@ -1,22 +1,18 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#edit_node_modal"> <a role="button" data-toggle="modal" data-target="#edit_node_modal">
<i class="glyphicon glyphicon-edit"></i> Edit Node</a <i class="glyphicon glyphicon-edit"></i> Edit Node</a>
> </li>
</li> <li>
<li> <a role="button" data-toggle="modal" data-target="#set_aliases_modal">
<a role="button" data-toggle="modal" data-target="#set_aliases_modal"> <i class="glyphicon glyphicon-plus"></i> Set Aliases</a>
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a </li>
> <li>
</li> <a role="button" data-toggle="modal" data-target="#set_scenario_modal">
<li> <i class="glyphicon glyphicon-plus"></i> Set Scenarios</a>
<a role="button" data-toggle="modal" data-target="#set_scenario_modal"> </li>
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a <li>
> <a class="button" data-toggle="modal" data-target="#generic_delete_modal">
</li> <i class="glyphicon glyphicon-trash"></i> Delete Node</a>
<li> </li>
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
<i class="glyphicon glyphicon-trash"></i> Delete Node</a
>
</li>
{% endif %} {% endif %}

View File

@ -1,36 +1,26 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#edit_package_modal"> <a role="button" data-toggle="modal" data-target="#edit_package_modal">
<i class="glyphicon glyphicon-edit"></i> Edit Package</a <i class="glyphicon glyphicon-edit"></i> Edit Package</a>
> </li>
</li> <li>
<li> <a role="button" data-toggle="modal" data-target="#edit_package_permissions_modal">
<a <i class="glyphicon glyphicon-user"></i> Edit Permissions</a>
role="button" </li>
data-toggle="modal" <li>
data-target="#edit_package_permissions_modal" <a role="button" data-toggle="modal" data-target="#publish_package_modal">
> <i class="glyphicon glyphicon-bullhorn"></i> Publish Package</a>
<i class="glyphicon glyphicon-user"></i> Edit Permissions</a </li>
> <li>
</li> <a role="button" data-toggle="modal" data-target="#export_package_modal">
<li> <i class="glyphicon glyphicon-bullhorn"></i> Export Package as JSON</a>
<a role="button" data-toggle="modal" data-target="#publish_package_modal"> </li>
<i class="glyphicon glyphicon-bullhorn"></i> Publish Package</a <li>
> <a role="button" data-toggle="modal" data-target="#set_license_modal">
</li> <i class="glyphicon glyphicon-duplicate"></i> License</a>
<li> </li>
<a role="button" data-toggle="modal" data-target="#export_package_modal"> <li>
<i class="glyphicon glyphicon-bullhorn"></i> Export Package as JSON</a <a class="button" data-toggle="modal" data-target="#generic_delete_modal">
> <i class="glyphicon glyphicon-trash"></i> Delete Package</a>
</li> </li>
<li>
<a role="button" data-toggle="modal" data-target="#set_license_modal">
<i class="glyphicon glyphicon-duplicate"></i> License</a
>
</li>
<li>
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
<i class="glyphicon glyphicon-trash"></i> Delete Package</a
>
</li>
{% endif %} {% endif %}

View File

@ -1,92 +1,59 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a class="button" data-toggle="modal" data-target="#add_pathway_node_modal"> <a class="button" data-toggle="modal" data-target="#add_pathway_node_modal">
<i class="glyphicon glyphicon-plus"></i> Add Compound</a <i class="glyphicon glyphicon-plus"></i> Add Compound</a>
> </li>
</li> <li>
<li> <a class="button" data-toggle="modal" data-target="#add_pathway_edge_modal">
<a class="button" data-toggle="modal" data-target="#add_pathway_edge_modal"> <i class="glyphicon glyphicon-plus"></i> Add Reaction</a>
<i class="glyphicon glyphicon-plus"></i> Add Reaction</a </li>
> <li role="separator" class="divider"></li>
</li>
<li role="separator" class="divider"></li>
{% endif %} {% endif %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#generic_copy_object_modal"> <a role="button" data-toggle="modal" data-target="#generic_copy_object_modal">
<i class="glyphicon glyphicon-duplicate"></i> Copy</a <i class="glyphicon glyphicon-duplicate"></i> Copy</a>
> </li>
</li> <li>
<li> <a class="button" data-toggle="modal" data-target="#download_pathway_csv_modal">
<a <i class="glyphicon glyphicon-floppy-save"></i> Download Pathway as CSV</a>
class="button" </li>
data-toggle="modal" <li>
data-target="#download_pathway_csv_modal" <a class="button" data-toggle="modal" data-target="#download_pathway_image_modal">
> <i class="glyphicon glyphicon-floppy-save"></i> Download Pathway as Image</a>
<i class="glyphicon glyphicon-floppy-save"></i> Download Pathway as CSV</a </li>
>
</li>
<li>
<a
class="button"
data-toggle="modal"
data-target="#download_pathway_image_modal"
>
<i class="glyphicon glyphicon-floppy-save"></i> Download Pathway as Image</a
>
</li>
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a <a class="button" data-toggle="modal" data-target="#identify_missing_rules_modal">
class="button" <i class="glyphicon glyphicon-question-sign"></i> Identify Missing Rules</a>
data-toggle="modal" </li>
data-target="#identify_missing_rules_modal" <li role="separator" class="divider"></li>
> <li>
<i class="glyphicon glyphicon-question-sign"></i> Identify Missing <a class="button" data-toggle="modal" data-target="#edit_pathway_modal">
Rules</a <i class="glyphicon glyphicon-edit"></i> Edit Pathway</a>
> </li>
</li> <li>
<li role="separator" class="divider"></li> <a role="button" data-toggle="modal" data-target="#set_scenario_modal">
<li> <i class="glyphicon glyphicon-plus"></i> Set Scenarios</a>
<a class="button" data-toggle="modal" data-target="#edit_pathway_modal"> </li>
<i class="glyphicon glyphicon-edit"></i> Edit Pathway</a <li>
> <a role="button" data-toggle="modal" data-target="#set_aliases_modal">
</li> <i class="glyphicon glyphicon-plus"></i> Set Aliases</a>
<li> </li>
<a role="button" data-toggle="modal" data-target="#set_scenario_modal"> {# <li>#}
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a {# <a class="button" data-toggle="modal" data-target="#add_pathway_edge_modal">#}
> {# <i class="glyphicon glyphicon-plus"></i> Calculate Compound Properties</a>#}
</li> {# </li>#}
<li> <li role="separator" class="divider"></li>
<a role="button" data-toggle="modal" data-target="#set_aliases_modal"> <li>
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a <a class="button" data-toggle="modal" data-target="#delete_pathway_node_modal">
> <i class="glyphicon glyphicon-trash"></i> Delete Compound</a>
</li> </li>
{# <li>#} <li>
{# <a class="button" data-toggle="modal" data-target="#add_pathway_edge_modal">#} <a class="button" data-toggle="modal" data-target="#delete_pathway_edge_modal">
{# <i class="glyphicon glyphicon-plus"></i> Calculate Compound Properties</a>#} <i class="glyphicon glyphicon-trash"></i> Delete Reaction</a>
{# </li>#} </li>
<li role="separator" class="divider"></li> <li>
<li> <a class="button" data-toggle="modal" data-target="#generic_delete_modal">
<a <i class="glyphicon glyphicon-trash"></i> Delete Pathway</a>
class="button" </li>
data-toggle="modal"
data-target="#delete_pathway_node_modal"
>
<i class="glyphicon glyphicon-trash"></i> Delete Compound</a
>
</li>
<li>
<a
class="button"
data-toggle="modal"
data-target="#delete_pathway_edge_modal"
>
<i class="glyphicon glyphicon-trash"></i> Delete Reaction</a
>
</li>
<li>
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
<i class="glyphicon glyphicon-trash"></i> Delete Pathway</a
>
</li>
{% endif %} {% endif %}

View File

@ -1,38 +1,28 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#edit_reaction_modal"> <a role="button" data-toggle="modal" data-target="#edit_reaction_modal">
<i class="glyphicon glyphicon-edit"></i> Edit Reaction</a <i class="glyphicon glyphicon-edit"></i> Edit Reaction</a>
> </li>
</li> <li>
<li> <a role="button" data-toggle="modal" data-target="#set_aliases_modal">
<a role="button" data-toggle="modal" data-target="#set_aliases_modal"> <i class="glyphicon glyphicon-plus"></i> Set Aliases</a>
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a </li>
> <li>
</li> <a role="button" data-toggle="modal" data-target="#set_scenario_modal">
<li> <i class="glyphicon glyphicon-plus"></i> Set Scenarios</a>
<a role="button" data-toggle="modal" data-target="#set_scenario_modal"> </li>
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a <li>
> <a role="button" data-toggle="modal" data-target="#generic_set_external_reference_modal">
</li> <i class="glyphicon glyphicon-plus"></i> Set External Reference</a>
<li> </li>
<a
role="button"
data-toggle="modal"
data-target="#generic_set_external_reference_modal"
>
<i class="glyphicon glyphicon-plus"></i> Set External Reference</a
>
</li>
{% endif %} {% endif %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#generic_copy_object_modal"> <a role="button" data-toggle="modal" data-target="#generic_copy_object_modal">
<i class="glyphicon glyphicon-duplicate"></i> Copy</a <i class="glyphicon glyphicon-duplicate"></i> Copy</a>
> </li>
</li>
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a class="button" data-toggle="modal" data-target="#generic_delete_modal"> <a class="button" data-toggle="modal" data-target="#generic_delete_modal">
<i class="glyphicon glyphicon-trash"></i> Delete Reaction</a <i class="glyphicon glyphicon-trash"></i> Delete Reaction</a>
> </li>
</li>
{% endif %} {% endif %}

View File

@ -1,29 +1,24 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#edit_rule_modal"> <a role="button" data-toggle="modal" data-target="#edit_rule_modal">
<i class="glyphicon glyphicon-edit"></i> Edit Rule</a <i class="glyphicon glyphicon-edit"></i> Edit Rule</a>
> </li>
</li> <li>
<li> <a role="button" data-toggle="modal" data-target="#set_aliases_modal">
<a role="button" data-toggle="modal" data-target="#set_aliases_modal"> <i class="glyphicon glyphicon-plus"></i> Set Aliases</a>
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a </li>
> <li>
</li> <a role="button" data-toggle="modal" data-target="#set_scenario_modal">
<li> <i class="glyphicon glyphicon-plus"></i> Set Scenarios</a>
<a role="button" data-toggle="modal" data-target="#set_scenario_modal"> </li>
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a
>
</li>
{% endif %} {% endif %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#generic_copy_object_modal"> <a role="button" data-toggle="modal" data-target="#generic_copy_object_modal">
<i class="glyphicon glyphicon-duplicate"></i> Copy</a <i class="glyphicon glyphicon-duplicate"></i> Copy</a>
> </li>
</li>
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a class="button" data-toggle="modal" data-target="#generic_delete_modal"> <a class="button" data-toggle="modal" data-target="#generic_delete_modal">
<i class="glyphicon glyphicon-trash"></i> Delete Rule</a <i class="glyphicon glyphicon-trash"></i> Delete Rule</a>
> </li>
</li>
{% endif %} {% endif %}

View File

@ -1,25 +1,14 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a <a class="button" data-toggle="modal" data-target="#add_additional_information_modal">
class="button" <i class="glyphicon glyphicon-trash"></i> Add Additional Information</a>
data-toggle="modal" </li>
data-target="#add_additional_information_modal" <li>
> <a class="button" data-toggle="modal" data-target="#update_scenario_additional_information_modal">
<i class="glyphicon glyphicon-trash"></i> Add Additional Information</a <i class="glyphicon glyphicon-trash"></i> Set Additional Information</a>
> </li>
</li> <li>
<li> <a class="button" data-toggle="modal" data-target="#generic_delete_modal">
<a <i class="glyphicon glyphicon-trash"></i> Delete Scenario</a>
class="button" </li>
data-toggle="modal"
data-target="#update_scenario_additional_information_modal"
>
<i class="glyphicon glyphicon-trash"></i> Set Additional Information</a
>
</li>
<li>
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
<i class="glyphicon glyphicon-trash"></i> Delete Scenario</a
>
</li>
{% endif %} {% endif %}

View File

@ -1,30 +1,22 @@
{% if meta.can_edit %} {% if meta.can_edit %}
<li> <li>
<a role="button" data-toggle="modal" data-target="#edit_user_modal"> <a role="button" data-toggle="modal" data-target="#edit_user_modal">
<i class="glyphicon glyphicon-edit"></i> Update</a <i class="glyphicon glyphicon-edit"></i> Update</a>
> </li>
</li> <li>
<li> <a role="button" data-toggle="modal" data-target="#edit_password_modal">
<a role="button" data-toggle="modal" data-target="#edit_password_modal"> <i class="glyphicon glyphicon-lock"></i> Update Password</a>
<i class="glyphicon glyphicon-lock"></i> Update Password</a </li>
> <li>
</li> <a role="button" data-toggle="modal" data-target="#new_prediction_setting_modal">
<li> <i class="glyphicon glyphicon-plus"></i> New Prediction Setting</a>
<a </li>
role="button" {# <li>#}
data-toggle="modal" {# <a role="button" data-toggle="modal" data-target="#manage_api_token_modal">#}
data-target="#new_prediction_setting_modal" {# <i class="glyphicon glyphicon-console"></i> Manage API Token</a>#}
> {# </li>#}
<i class="glyphicon glyphicon-plus"></i> New Prediction Setting</a <li>
> <a role="button" data-toggle="modal" data-target="#generic_delete_modal">
</li> <i class="glyphicon glyphicon-trash"></i> Delete Account</a>
{# <li>#} </li>
{# <a role="button" data-toggle="modal" data-target="#manage_api_token_modal">#}
{# <i class="glyphicon glyphicon-console"></i> Manage API Token</a>#}
{# </li>#}
<li>
<a role="button" data-toggle="modal" data-target="#generic_delete_modal">
<i class="glyphicon glyphicon-trash"></i> Delete Account</a
>
</li>
{% endif %} {% endif %}

View File

@ -1,17 +1,12 @@
{% extends "framework.html" %} {% extends "framework.html" %}
{% load static %} {% load static %}
{% block content %} {% block content %}
<div id="searchContent">
<div id=searchContent>
<form id="admin-form" action="{{ SERVER_BASE }}/admin" method="post"> <form id="admin-form" action="{{ SERVER_BASE }}/admin" method="post">
<div class="form-group"> <div class="form-group">
<label for="textarea">Query</label> <label for="textarea">Query</label>
<textarea <textarea id="textarea" class="form-control" rows="10" placeholder="Paste query here" required>
id="textarea"
class="form-control"
rows="10"
placeholder="Paste query here"
required
>
PREFIX pps: <http://localhost:8080/vocabulary#> PREFIX pps: <http://localhost:8080/vocabulary#>
SELECT ?name (count(?objId) as ?xcnt) SELECT ?name (count(?objId) as ?xcnt)
WHERE { WHERE {
@ -20,29 +15,32 @@ WHERE {
?packageId pps:reviewStatus 'reviewed' . ?packageId pps:reviewStatus 'reviewed' .
?packageId pps:pathway ?objId . ?packageId pps:pathway ?objId .
} GROUP BY ?name } GROUP BY ?name
</textarea </textarea>
> </div>
</div> <button id="submit" type="button" class="btn btn-primary">Submit</button>
<button id="submit" type="button" class="btn btn-primary">Submit</button>
</form> </form>
<p></p> <p></p>
</div> </div>
<div id="results"></div> <div id="results">
<div id="loading"></div> </div>
<script> <div id="loading"></div>
$(function () { </div>
$("#submit").on("click", function () { <script>
$(function() {
$('#submit').on('click', function() {
makeLoadingGif("#loading", "{% static '/images/wait.gif' %}"); makeLoadingGif("#loading", "{% static '/images/wait.gif' %}");
data = { data = {
query: $("#textarea").val(), "query": $("#textarea").val()
}; }
$.post("{{ SERVER_BASE }}/expire", data, function (result) { $.post("{{ SERVER_BASE }}/expire", data, function(result) {
$("#loading").empty(); $("#loading").empty();
queryResultToTable("results", result); queryResultToTable("results", result);
}); })
});
}); });
</script> })
</script>
{% endblock content %} {% endblock content %}

View File

@ -1,80 +1,70 @@
{% extends "framework.html" %} {% extends "framework.html" %}
{% load static %} {% load static %}
{% load envipytags %}
{% block content %} {% block content %}
<div class="panel-group" id="reviewListAccordion">
<div class="panel panel-default">
<div
class="panel-heading"
id="headingPanel"
style="font-size:2rem;height: 46px"
>
Jobs
</div>
<div class="panel-body">
<p>Job Logs Desc</p>
</div>
<div <div class="panel-group" id="reviewListAccordion">
class="panel panel-default panel-heading list-group-item" <div class="panel panel-default">
style="background-color:silver" <div class="panel-heading" id="headingPanel" style="font-size:2rem;height: 46px">
> Jobs
<h4 class="panel-title"> </div>
<a <div class="panel-body">
id="job-accordion-link" <p>
data-toggle="collapse" Job Logs Desc
data-parent="#job-accordion" </p>
href="#jobs"
> </div>
Jobs
</a> <div class="panel panel-default panel-heading list-group-item" style="background-color:silver">
</h4> <h4 class="panel-title">
</div> <a id="job-accordion-link" data-toggle="collapse" data-parent="#job-accordion" href="#jobs">
<div id="jobs" class="panel-collapse in collapse"> Jobs
<div class="panel-body list-group-item" id="job-content"> </a>
<table class="table-bordered table-hover table"> </h4>
<tr style="background-color: rgba(0, 0, 0, 0.08);"> </div>
<th scope="col">ID</th> <div id="jobs"
<th scope="col">Name</th> class="panel-collapse collapse in">
<th scope="col">Status</th> <div class="panel-body list-group-item" id="job-content">
<th scope="col">Queued</th> <table class="table table-bordered table-hover">
<th scope="col">Done</th> <tr style="background-color: rgba(0, 0, 0, 0.08);">
<th scope="col">Result</th> <th scope="col">ID</th>
</tr> <th scope="col">Name</th>
<tbody> <th scope="col">Status</th>
{% for job in jobs %} <th scope="col">Queued</th>
<tr> <th scope="col">Done</th>
<td>{{ job.task_id }}</td> <th scope="col">Result</th>
<td>{{ job.job_name }}</td> </tr>
<td>{{ job.status }}</td> <tbody>
<td>{{ job.created }}</td> {% for job in jobs %}
<td>{{ job.done_at }}</td> <tr>
{% if job.task_result and job.task_result|is_url == True %} <td>{{ job.task_id }}</td>
<td><a href="{{ job.task_result }}">Result</a></td> <td>{{ job.job_name }}</td>
{% elif job.task_result %} <td>{{ job.status }}</td>
<td>{{ job.task_result|slice:"40" }}...</td> <td>{{ job.created }}</td>
{% else %} <td>{{ job.done_at }}</td>
<td>Empty</td> {% if job.task_result and job.task_result|is_url == True %}
{% endif %} <td><a href="{{ job.task_result }}">Result</a></td>
</tr> {% elif job.task_result %}
{% endfor %} <td>{{ job.task_result|slice:"40" }}...</td>
</tbody> {% else %}
</table> <td>Empty</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<!-- Unreviewable objects such as User / Group / Setting -->
<ul class='list-group'>
{% for obj in objects %}
{% if object_type == 'user' %}
<a class="list-group-item" href="{{ obj.url }}">{{ obj.username }}</a>
{% else %}
<a class="list-group-item" href="{{ obj.url }}">{{ obj.name }}</a>
{% endif %}
{% endfor %}
</ul>
</div> </div>
</div>
<!-- Unreviewable objects such as User / Group / Setting -->
<ul class="list-group">
{% for obj in objects %}
{% if object_type == 'user' %}
<a class="list-group-item" href="{{ obj.url }}"
>{{ obj.username }}</a
>
{% else %}
<a class="list-group-item" href="{{ obj.url }}">{{ obj.name }}</a>
{% endif %}
{% endfor %}
</ul>
</div> </div>
</div>
{% endblock content %} {% endblock content %}

View File

@ -2,427 +2,269 @@
{% load static %} {% load static %}
{% block content %} {% block content %}
{% if object_type != 'package' %} {% if object_type != 'package' %}
<div> <div>
<div id="load-all-error" style="display: none;"> <div id="load-all-error" style="display: none;">
<div class="alert alert-danger" role="alert"> <div class="alert alert-danger" role="alert">
<span <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
class="glyphicon glyphicon-exclamation-sign" <span class="sr-only">Error:</span>
aria-hidden="true" Getting objects failed!
></span> </div>
<span class="sr-only">Error:</span>
Getting objects failed!
</div>
</div>
<input
type="text"
id="object-search"
class="form-control"
placeholder="Search by name"
style="display: none;"
/>
<p></p>
</div>
{% endif %}
{% block action_modals %}
{% if object_type == 'package' %}
{% include "modals/collections/new_package_modal.html" %}
{% include "modals/collections/import_package_modal.html" %}
{% include "modals/collections/import_legacy_package_modal.html" %}
{% elif object_type == 'compound' %}
{% include "modals/collections/new_compound_modal.html" %}
{% elif object_type == 'rule' %}
{% include "modals/collections/new_rule_modal.html" %}
{% elif object_type == 'reaction' %}
{% include "modals/collections/new_reaction_modal.html" %}
{% elif object_type == 'pathway' %}
{# {% include "modals/collections/new_pathway_modal.html" %} #}
{% elif object_type == 'node' %}
{% include "modals/collections/new_node_modal.html" %}
{% elif object_type == 'edge' %}
{% include "modals/collections/new_edge_modal.html" %}
{% elif object_type == 'scenario' %}
{% include "modals/collections/new_scenario_modal.html" %}
{% elif object_type == 'model' %}
{% include "modals/collections/new_model_modal.html" %}
{% elif object_type == 'setting' %}
{#{% include "modals/collections/new_setting_modal.html" %}#}
{% elif object_type == 'user' %}
<div></div>
{% elif object_type == 'group' %}
{% include "modals/collections/new_group_modal.html" %}
{% endif %}
{% endblock action_modals %}
<div class="panel-group" id="reviewListAccordion">
<div class="panel panel-default">
<div
class="panel-heading"
id="headingPanel"
style="font-size:2rem;height: 46px"
>
{% if object_type == 'package' %}
Packages
{% elif object_type == 'compound' %}
Compounds
{% elif object_type == 'structure' %}
Compound structures
{% elif object_type == 'rule' %}
Rules
{% elif object_type == 'reaction' %}
Reactions
{% elif object_type == 'pathway' %}
Pathways
{% elif object_type == 'node' %}
Nodes
{% elif object_type == 'edge' %}
Edges
{% elif object_type == 'scenario' %}
Scenarios
{% elif object_type == 'model' %}
Model
{% elif object_type == 'setting' %}
Settings
{% elif object_type == 'user' %}
Users
{% elif object_type == 'group' %}
Groups
{% endif %}
<div
id="actionsButton"
style="float: right;font-weight: normal;font-size: medium;position: relative; top: 50%; transform: translateY(-50%);z-index:100;display: none;"
class="dropdown"
>
<a
href="#"
class="dropdown-toggle"
data-toggle="dropdown"
role="button"
aria-haspopup="true"
aria-expanded="false"
><span class="glyphicon glyphicon-wrench"></span> Actions
<span class="caret"></span><span style="padding-right:1em"></span
></a>
<ul id="actionsList" class="dropdown-menu">
{% block actions %}
{% if object_type == 'package' %}
{% include "actions/collections/package.html" %}
{% elif object_type == 'compound' %}
{% include "actions/collections/compound.html" %}
{% elif object_type == 'structure' %}
{% include "actions/collections/compound_structure.html" %}
{% elif object_type == 'rule' %}
{% include "actions/collections/rule.html" %}
{% elif object_type == 'reaction' %}
{% include "actions/collections/reaction.html" %}
{% elif object_type == 'setting' %}
{% include "actions/collections/setting.html" %}
{% elif object_type == 'scenario' %}
{% include "actions/collections/scenario.html" %}
{% elif object_type == 'model' %}
{% include "actions/collections/model.html" %}
{% elif object_type == 'pathway' %}
{% include "actions/collections/pathway.html" %}
{% elif object_type == 'node' %}
{% include "actions/collections/node.html" %}
{% elif object_type == 'edge' %}
{% include "actions/collections/edge.html" %}
{% elif object_type == 'group' %}
{% include "actions/collections/group.html" %}
{% endif %}
{% endblock %}
</ul>
</div>
</div>
<div class="panel-body">
<!-- Set Text above links -->
{% if object_type == 'package' %}
<p>
A package contains pathways, rules, etc. and can reflect specific
experimental conditions.
<a
target="_blank"
href="https://wiki.envipath.org/index.php/packages"
role="button"
>Learn more &gt;&gt;</a
>
</p>
{% elif object_type == 'compound' %}
<p>
A compound stores the structure of a molecule and can include
meta-information.
<a
target="_blank"
href="https://wiki.envipath.org/index.php/compounds"
role="button"
>Learn more &gt;&gt;</a
>
</p>
{% elif object_type == 'structure' %}
<p>
The structures stored in this compound
<a
target="_blank"
href="https://wiki.envipath.org/index.php/compounds"
role="button"
>Learn more &gt;&gt;</a
>
</p>
{% elif object_type == 'rule' %}
<p>
A rule describes a biotransformation reaction template that is
defined as SMIRKS.
<a
target="_blank"
href="https://wiki.envipath.org/index.php/Rules"
role="button"
>Learn more &gt;&gt;</a
>
</p>
{% elif object_type == 'reaction' %}
<p>
A reaction is a specific biotransformation from educt compounds to
product compounds.
<a
target="_blank"
href="https://wiki.envipath.org/index.php/reactions"
role="button"
>Learn more &gt;&gt;</a
>
</p>
{% elif object_type == 'pathway' %}
<p>
A pathway displays the (predicted) biodegradation of a compound as
graph.
<a
target="_blank"
href="https://wiki.envipath.org/index.php/pathways"
role="button"
>Learn more &gt;&gt;</a
>
</p>
{% elif object_type == 'node' %}
<p>
Nodes represent the (predicted) compounds in a graph.
<a
target="_blank"
href="https://wiki.envipath.org/index.php/nodes"
role="button"
>Learn more &gt;&gt;</a
>
</p>
{% elif object_type == 'edge' %}
<p>
Edges represent the links between Nodes in a graph
<a
target="_blank"
href="https://wiki.envipath.org/index.php/edges"
role="button"
>Learn more &gt;&gt;</a
>
</p>
{% elif object_type == 'scenario' %}
<p>
A scenario contains meta-information that can be attached to other
data (compounds, rules, ..).
<a
target="_blank"
href="https://wiki.envipath.org/index.php/scenarios"
role="button"
>Learn more &gt;&gt;</a
>
</p>
{% elif object_type == 'model' %}
<p>
A model applies machine learning to limit the combinatorial
explosion.
<a
target="_blank"
href="https://wiki.envipath.org/index.php/relative_reasoning"
role="button"
>Learn more &gt;&gt;</a
>
</p>
{% elif object_type == 'setting' %}
<p>
A setting includes configuration parameters for pathway predictions.
<a
target="_blank"
href="https://wiki.envipath.org/index.php/settings"
role="button"
>Learn more &gt;&gt;</a
>
</p>
{% elif object_type == 'user' %}
<p>
Register now to create own packages and to submit and manage your
data.
<a
target="_blank"
href="https://wiki.envipath.org/index.php/users"
role="button"
>Learn more &gt;&gt;</a
>
</p>
{% elif object_type == 'group' %}
<p>
Users can team up in groups to share packages.
<a
target="_blank"
href="https://wiki.envipath.org/index.php/groups"
role="button"
>Learn more &gt;&gt;</a
>
</p>
{% endif %}
<!-- If theres nothing to show extend the text above -->
{% if reviewed_objects and unreviewed_objects %}
{% if reviewed_objects|length == 0 and unreviewed_objects|length == 0 %}
<p>
Nothing found. There are two possible reasons: <br /><br />1.
There is no content yet.<br />2. You have no reading
permissions.<br /><br />Please be sure you have at least reading
permissions.
</p>
{% endif %}
{% endif %}
</div>
{% if reviewed_objects %}
{% if reviewed_objects|length > 0 %}
<div
class="panel panel-default panel-heading list-group-item"
style="background-color:silver"
>
<h4 class="panel-title">
<a
id="ReviewedLink"
data-toggle="collapse"
data-parent="#reviewListAccordion"
href="#Reviewed"
>Reviewed</a
>
</h4>
</div>
<div id="Reviewed" class="panel-collapse in collapse">
<div class="panel-body list-group-item" id="ReviewedContent">
{% if object_type == 'package' %}
{% for obj in reviewed_objects %}
<a class="list-group-item" href="{{ obj.url }}"
>{{ obj.name|safe }}
<span
class="glyphicon glyphicon-star"
aria-hidden="true"
style="float:right"
data-toggle="tooltip"
data-placement="top"
title=""
data-original-title="Reviewed"
>
</span>
</a>
{% endfor %}
{% else %}
{% for obj in reviewed_objects|slice:":50" %}
<a class="list-group-item" href="{{ obj.url }}"
>{{ obj.name|safe }}{# <i>({{ obj.package.name }})</i> #}
<span
class="glyphicon glyphicon-star"
aria-hidden="true"
style="float:right"
data-toggle="tooltip"
data-placement="top"
title=""
data-original-title="Reviewed"
>
</span>
</a>
{% endfor %}
{% endif %}
</div> </div>
</div>
<input type="text" id="object-search" class="form-control" placeholder="Search by name"
style="display: none;">
<p></p>
</div>
{% endif %}
{% block action_modals %}
{% if object_type == 'package' %}
{% include "modals/collections/new_package_modal.html" %}
{% include "modals/collections/import_package_modal.html" %}
{% include "modals/collections/import_legacy_package_modal.html" %}
{% elif object_type == 'compound' %}
{% include "modals/collections/new_compound_modal.html" %}
{% elif object_type == 'rule' %}
{% include "modals/collections/new_rule_modal.html" %}
{% elif object_type == 'reaction' %}
{% include "modals/collections/new_reaction_modal.html" %}
{% elif object_type == 'pathway' %}
{# {% include "modals/collections/new_pathway_modal.html" %} #}
{% elif object_type == 'node' %}
{% include "modals/collections/new_node_modal.html" %}
{% elif object_type == 'edge' %}
{% include "modals/collections/new_edge_modal.html" %}
{% elif object_type == 'scenario' %}
{% include "modals/collections/new_scenario_modal.html" %}
{% elif object_type == 'model' %}
{% include "modals/collections/new_model_modal.html" %}
{% elif object_type == 'setting' %}
{#{% include "modals/collections/new_setting_modal.html" %}#}
{% elif object_type == 'user' %}
<div></div>
{% elif object_type == 'group' %}
{% include "modals/collections/new_group_modal.html" %}
{% endif %} {% endif %}
{% endif %} {% endblock action_modals %}
{% if unreviewed_objects %}
<div <div class="panel-group" id="reviewListAccordion">
class="panel panel-default panel-heading list-group-item" <div class="panel panel-default">
style="background-color:silver" <div class="panel-heading" id="headingPanel" style="font-size:2rem;height: 46px">
>
<h4 class="panel-title">
<a
id="UnreviewedLink"
data-toggle="collapse"
data-parent="#unReviewListAccordion"
href="#Unreviewed"
>Unreviewed</a
>
</h4>
</div>
<div
id="Unreviewed"
class="panel-collapse {% if reviewed_objects|length == 0 or object_type == 'package' %}in{% endif %} collapse"
>
<div class="panel-body list-group-item" id="UnreviewedContent">
{% if object_type == 'package' %} {% if object_type == 'package' %}
{% for obj in unreviewed_objects %} Packages
<a class="list-group-item" href="{{ obj.url }}" {% elif object_type == 'compound' %}
>{{ obj.name|safe }}</a Compounds
> {% elif object_type == 'structure' %}
{% endfor %} Compound structures
{% else %} {% elif object_type == 'rule' %}
{% for obj in unreviewed_objects|slice:":50" %} Rules
<a class="list-group-item" href="{{ obj.url }}" {% elif object_type == 'reaction' %}
>{{ obj.name|safe }}</a Reactions
> {% elif object_type == 'pathway' %}
{% endfor %} Pathways
{% elif object_type == 'node' %}
Nodes
{% elif object_type == 'edge' %}
Edges
{% elif object_type == 'scenario' %}
Scenarios
{% elif object_type == 'model' %}
Model
{% elif object_type == 'setting' %}
Settings
{% elif object_type == 'user' %}
Users
{% elif object_type == 'group' %}
Groups
{% endif %} {% endif %}
</div> <div id="actionsButton"
style="float: right;font-weight: normal;font-size: medium;position: relative; top: 50%; transform: translateY(-50%);z-index:100;display: none;"
class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
aria-haspopup="true" aria-expanded="false"><span
class="glyphicon glyphicon-wrench"></span> Actions <span class="caret"></span><span
style="padding-right:1em"></span></a>
<ul id="actionsList" class="dropdown-menu">
{% block actions %}
{% if object_type == 'package' %}
{% include "actions/collections/package.html" %}
{% elif object_type == 'compound' %}
{% include "actions/collections/compound.html" %}
{% elif object_type == 'structure' %}
{% include "actions/collections/compound_structure.html" %}
{% elif object_type == 'rule' %}
{% include "actions/collections/rule.html" %}
{% elif object_type == 'reaction' %}
{% include "actions/collections/reaction.html" %}
{% elif object_type == 'setting' %}
{% include "actions/collections/setting.html" %}
{% elif object_type == 'scenario' %}
{% include "actions/collections/scenario.html" %}
{% elif object_type == 'model' %}
{% include "actions/collections/model.html" %}
{% elif object_type == 'pathway' %}
{% include "actions/collections/pathway.html" %}
{% elif object_type == 'node' %}
{% include "actions/collections/node.html" %}
{% elif object_type == 'edge' %}
{% include "actions/collections/edge.html" %}
{% elif object_type == 'group' %}
{% include "actions/collections/group.html" %}
{% endif %}
{% endblock %}
</ul>
</div>
</div> </div>
{% endif %} <div class="panel-body">
{% if objects %} <!-- Set Text above links -->
<!-- Unreviewable objects such as User / Group / Setting --> {% if object_type == 'package' %}
<ul class="list-group"> <p>A package contains pathways, rules, etc. and can reflect specific experimental
{% for obj in objects %} conditions. <a target="_blank" href="https://wiki.envipath.org/index.php/packages" role="button">Learn
{% if object_type == 'user' %} more &gt;&gt;</a></p>
<a class="list-group-item" href="{{ obj.url }}" {% elif object_type == 'compound' %}
>{{ obj.username|safe }}</a <p>A compound stores the structure of a molecule and can include meta-information.
> <a target="_blank" href="https://wiki.envipath.org/index.php/compounds" role="button">Learn more
{% else %} &gt;&gt;</a></p>
<a class="list-group-item" href="{{ obj.url }}" {% elif object_type == 'structure' %}
>{{ obj.name|safe }}</a <p>The structures stored in this compound
> <a target="_blank" href="https://wiki.envipath.org/index.php/compounds" role="button">Learn more
&gt;&gt;</a></p>
{% elif object_type == 'rule' %}
<p>A rule describes a biotransformation reaction template that is defined as SMIRKS.
<a target="_blank" href="https://wiki.envipath.org/index.php/Rules" role="button">Learn more
&gt;&gt;</a></p>
{% elif object_type == 'reaction' %}
<p>A reaction is a specific biotransformation from educt compounds to product compounds.
<a target="_blank" href="https://wiki.envipath.org/index.php/reactions" role="button">Learn more
&gt;&gt;</a></p>
{% elif object_type == 'pathway' %}
<p>A pathway displays the (predicted) biodegradation of a compound as graph.
<a target="_blank" href="https://wiki.envipath.org/index.php/pathways" role="button">Learn more
&gt;&gt;</a></p>
{% elif object_type == 'node' %}
<p>Nodes represent the (predicted) compounds in a graph.
<a target="_blank" href="https://wiki.envipath.org/index.php/nodes" role="button">Learn more
&gt;&gt;</a></p>
{% elif object_type == 'edge' %}
<p>Edges represent the links between Nodes in a graph
<a target="_blank" href="https://wiki.envipath.org/index.php/edges" role="button">Learn more
&gt;&gt;</a></p>
{% elif object_type == 'scenario' %}
<p>A scenario contains meta-information that can be attached to other data (compounds, rules, ..).
<a target="_blank" href="https://wiki.envipath.org/index.php/scenarios" role="button">Learn more
&gt;&gt;</a></p>
{% elif object_type == 'model' %}
<p>A model applies machine learning to limit the combinatorial explosion.
<a target="_blank" href="https://wiki.envipath.org/index.php/relative_reasoning" role="button">Learn
more
&gt;&gt;</a></p>
{% elif object_type == 'setting' %}
<p>A setting includes configuration parameters for pathway predictions.
<a target="_blank" href="https://wiki.envipath.org/index.php/settings" role="button">Learn more
&gt;&gt;</a></p>
{% elif object_type == 'user' %}
<p>Register now to create own packages and to submit and manage your data.
<a target="_blank" href="https://wiki.envipath.org/index.php/users" role="button">Learn more
&gt;&gt;</a></p>
{% elif object_type == 'group' %}
<p>Users can team up in groups to share packages.
<a target="_blank" href="https://wiki.envipath.org/index.php/groups" role="button">Learn more
&gt;&gt;</a></p>
{% endif %} {% endif %}
{% endfor %}
<!-- If theres nothing to show extend the text above -->
{% if reviewed_objects and unreviewed_objects %}
{% if reviewed_objects|length == 0 and unreviewed_objects|length == 0 %}
<p>Nothing found. There are two possible reasons: <br><br>1. There is no content yet.<br>2. You have no
reading permissions.<br><br>Please be sure you have at least reading permissions.</p>
{% endif %}
{% endif %}
</div>
{% if reviewed_objects %}
{% if reviewed_objects|length > 0 %}
<div class="panel panel-default panel-heading list-group-item" style="background-color:silver">
<h4 class="panel-title">
<a id="ReviewedLink" data-toggle="collapse" data-parent="#reviewListAccordion"
href="#Reviewed">Reviewed</a>
</h4>
</div>
<div id="Reviewed" class="panel-collapse collapse in">
<div class="panel-body list-group-item" id="ReviewedContent">
{% if object_type == 'package' %}
{% for obj in reviewed_objects %}
<a class="list-group-item" href="{{ obj.url }}">{{ obj.name|safe }}
<span class="glyphicon glyphicon-star" aria-hidden="true"
style="float:right" data-toggle="tooltip"
data-placement="top" title="" data-original-title="Reviewed">
</span>
</a>
{% endfor %}
{% else %}
{% for obj in reviewed_objects|slice:":50" %}
<a class="list-group-item" href="{{ obj.url }}">{{ obj.name|safe }}{# <i>({{ obj.package.name }})</i> #}
<span class="glyphicon glyphicon-star" aria-hidden="true"
style="float:right" data-toggle="tooltip"
data-placement="top" title="" data-original-title="Reviewed">
</span>
</a>
{% endfor %}
{% endif %}
</div>
</div>
{% endif %}
{% endif %}
{% if unreviewed_objects %}
<div class="panel panel-default panel-heading list-group-item" style="background-color:silver"><h4
class="panel-title"><a id="UnreviewedLink" data-toggle="collapse" data-parent="#unReviewListAccordion"
href="#Unreviewed">Unreviewed</a></h4></div>
<div id="Unreviewed" class="panel-collapse collapse {% if reviewed_objects|length == 0 or object_type == 'package' %}in{% endif %}">
<div class="panel-body list-group-item" id="UnreviewedContent">
{% if object_type == 'package' %}
{% for obj in unreviewed_objects %}
<a class="list-group-item" href="{{ obj.url }}">{{ obj.name|safe }}</a>
{% endfor %}
{% else %}
{% for obj in unreviewed_objects|slice:":50" %}
<a class="list-group-item" href="{{ obj.url }}">{{ obj.name|safe }}</a>
{% endfor %}
{% endif %}
</div>
</div>
{% endif %}
{% if objects %}
<!-- Unreviewable objects such as User / Group / Setting -->
<ul class='list-group'>
{% for obj in objects %}
{% if object_type == 'user' %}
<a class="list-group-item" href="{{ obj.url }}">{{ obj.username|safe }}</a>
{% else %}
<a class="list-group-item" href="{{ obj.url }}">{{ obj.name|safe }}</a>
{% endif %}
{% endfor %}
</ul> </ul>
{% endif %} {% endif %}
</div> </div>
<style> <style>
.spinner-widget { .spinner-widget {
position: fixed; /* stays in place on scroll */ position: fixed; /* stays in place on scroll */
bottom: 20px; /* distance from bottom */ bottom: 20px; /* distance from bottom */
right: 20px; /* distance from right */ right: 20px; /* distance from right */
z-index: 9999; /* above most elements */ z-index: 9999; /* above most elements */
width: 60px; /* adjust to gif size */ width: 60px; /* adjust to gif size */
height: 60px; height: 60px;
} }
.spinner-widget img { .spinner-widget img {
width: 100%; width: 100%;
height: auto; height: auto;
} }
</style> </style>
<div id="load-all-loading" class="spinner-widget" style="display: none"> <div id="load-all-loading" class="spinner-widget" style="display: none">
<img <img id="loading-gif" src="{% static '/images/wait.gif' %}" alt="Loading...">
id="loading-gif"
src="{% static '/images/wait.gif' %}"
alt="Loading..."
/>
</div> </div>
</div>
{# prettier-ignore-start #} </div>
<script> <script>
$(function () { $(function () {
@ -474,5 +316,4 @@
}); });
</script> </script>
{# prettier-ignore-end #}
{% endblock content %} {% endblock content %}

View File

@ -1,75 +1,55 @@
{% extends "framework.html" %} {% extends "framework.html" %}
{% block content %} {% block content %}
<div>
<form action="" method="post">
{% csrf_token %}
<input
type="text"
class="form-control"
id="smiles"
name="smiles"
placeholder="SMILES"
value="{{ smiles }}"
/>
<input
type="text"
class="form-control"
id="smiles"
name="smirks"
placeholder="SMIRKS"
value="{{ smirks }}"
/>
<button type="submit" class="btn btn-primary">Test</button>
</form>
</div>
{% if result %}
{{ smiles }}
<p></p>
<img
width="400"
src="{% url 'depict' %}?smiles={{ smiles|urlencode }}"
/><br />
<p></p>
{% if rule %}
{{ smirks }}
<p></p>
{{ rule.reactants_smarts }}
<p></p>
{{ rule.products_smarts }}
<p></p>
<div>{{ rule.as_svg|safe }}</div>
{% endif %}
<h2>Diff</h2>
{% if diff %}
{% for d in diff %}
{{ d }}
{% endfor %}
{% else %}
{{ "No diff" }}
{% endif %}
<div> <div>
<div class="col-md-6"> <form action="" method="post">
<h2>Ambit</h2> {% csrf_token %}
{% for p in ambit_res %} <input type="text" class="form-control" id="smiles" name="smiles" placeholder="SMILES"
{{ p }}<br /> value="{{ smiles }}"/>
<img <input type="text" class="form-control" id="smiles" name="smirks" placeholder="SMIRKS"
width="400" value="{{ smirks }}"/>
src="{% url 'depict' %}?smiles={{ p|urlencode }}" <button type="submit" class="btn btn-primary">Test</button>
/><br /> </form>
{% endfor %}
</div>
<div class="col-md-6">
<h2>RDKit</h2>
{% for p in rdkit_res %}
{{ p }}<br />
<img
width="400"
src="{% url 'depict' %}?smiles={{ p|urlencode }}"
/><br />
{% endfor %}
</div>
</div> </div>
{% endif %} {% if result %}
{{ smiles }}<p></p>
<img width='400' src='{% url 'depict' %}?smiles={{ smiles|urlencode }}'><br>
<p></p>
{% if rule %}
{{ smirks }}
<p></p>
{{ rule.reactants_smarts }}
<p></p>
{{ rule.products_smarts }}
<p></p>
<div>
{{ rule.as_svg|safe }}
</div>
{% endif %}
<h2>Diff</h2>
{% if diff %}
{% for d in diff %}
{{ d }}
{% endfor %}
{% else %}
{{ "No diff" }}
{% endif %}
<div>
<div class="col-md-6">
<h2>Ambit</h2>
{% for p in ambit_res %}
{{ p }}<br>
<img width='400' src='{% url 'depict' %}?smiles={{ p|urlencode }}'><br>
{% endfor %}
</div>
<div class="col-md-6">
<h2>RDKit</h2>
{% for p in rdkit_res %}
{{ p }}<br>
<img width='400' src='{% url 'depict' %}?smiles={{ p|urlencode }}'><br>
{% endfor %}
</div>
</div>
{% endif %}
{% endblock content %} {% endblock content %}

View File

@ -1,18 +1,15 @@
{% extends "framework.html" %} {% extends "framework.html" %}
{% load static %} {% load static %}
{% block content %} {% block content %}
<div class="alert alert-error" role="alert">
<div class="alert alert-error" role="alert">
<h4 class="alert-heading">Bad Request!</h4> <h4 class="alert-heading">Bad Request!</h4>
<p>Lorem</p> <p>Lorem</p>
<hr /> <hr>
<p class="mb-0"> <p class="mb-0">
You can find out more about permissions in our You can find out more about permissions in our <a target="_blank"
<a href="https://wiki.envipath.org/index.php/packages"
target="_blank" role="button">Wiki &gt;&gt;</a></p>
href="https://wiki.envipath.org/index.php/packages" </div>
role="button"
>Wiki &gt;&gt;</a
>
</p>
</div>
{% endblock content %} {% endblock content %}

View File

@ -1,18 +1,15 @@
{% extends "framework.html" %} {% extends "framework.html" %}
{% load static %} {% load static %}
{% block content %} {% block content %}
<div class="alert alert-error" role="alert">
<div class="alert alert-error" role="alert">
<h4 class="alert-heading">Access Denied!</h4> <h4 class="alert-heading">Access Denied!</h4>
<p>Access to X denied.</p> <p>Access to X denied. </p>
<hr /> <hr>
<p class="mb-0"> <p class="mb-0">
You can find out more about permissions in our You can find out more about permissions in our <a target="_blank"
<a href="https://wiki.envipath.org/index.php/packages"
target="_blank" role="button">Wiki &gt;&gt;</a></p>
href="https://wiki.envipath.org/index.php/packages" </div>
role="button"
>Wiki &gt;&gt;</a
>
</p>
</div>
{% endblock content %} {% endblock content %}

View File

@ -1,18 +1,15 @@
{% extends "framework.html" %} {% extends "framework.html" %}
{% load static %} {% load static %}
{% block content %} {% block content %}
<div class="alert alert-error" role="alert">
<div class="alert alert-error" role="alert">
<h4 class="alert-heading">Not Found!</h4> <h4 class="alert-heading">Not Found!</h4>
<p>Does not exist</p> <p>Does not exist</p>
<hr /> <hr>
<p class="mb-0"> <p class="mb-0">
You can find out more about permissions in our You can find out more about permissions in our <a target="_blank"
<a href="https://wiki.envipath.org/index.php/packages"
target="_blank" role="button">Wiki &gt;&gt;</a></p>
href="https://wiki.envipath.org/index.php/packages" </div>
role="button"
>Wiki &gt;&gt;</a
>
</p>
</div>
{% endblock content %} {% endblock content %}

View File

@ -1,9 +1,13 @@
{% extends "framework.html" %} {% extends "framework.html" %}
{% load static %} {% load static %}
{% block content %} {% block content %}
<div class="alert alert-danger" role="alert">
<h4 class="alert-heading">{{ error_message }}</h4> <div class="alert alert-danger" role="alert">
<hr /> <h4 class="alert-heading">{{ error_message }}</h4>
<p class="mb-0">{{ error_detail }}</p> <hr>
</div> <p class="mb-0">
{{ error_detail }}
</p>
</div>
{% endblock content %} {% endblock content %}

View File

@ -1,11 +1,12 @@
{% extends "framework.html" %} {% extends "framework.html" %}
{% load static %} {% load static %}
{% block content %} {% block content %}
<div class="alert alert-danger" role="alert">
<h4 class="alert-heading">Your account has not been activated yet!</h4> <div class="alert alert-danger" role="alert">
<p> <h4 class="alert-heading">Your account has not been activated yet!</h4>
Your account has not been activated yet. If you have questions <p>Your account has not been activated yet. If you have questions <a href="mailto:admin@envipath.org">contact
<a href="mailto:admin@envipath.org">contact us.</a> us.</a>
</p> </p>
</div> </div>
{% endblock content %} {% endblock content %}

View File

@ -1,15 +1,11 @@
<!doctype html> <!DOCTYPE html>
<html data-theme="envipath"> <html data-theme="envipath">
{% load static %} {% load static %}
<head> <head>
<title>{{ title }}</title> <title>{{ title }}</title>
<meta name="csrf-token" content="{{ csrf_token }}" /> <meta name="csrf-token" content="{{ csrf_token }}">
{# Favicon #} {# Favicon #}
<link <link rel="shortcut icon" type="image/png" href="{% static 'images/favicon.ico' %}"/>
rel="shortcut icon"
type="image/png"
href="{% static 'images/favicon.ico' %}"
/>
{# Tailwind CSS disabled for legacy Bootstrap framework #} {# Tailwind CSS disabled for legacy Bootstrap framework #}
{# Pages using this framework will be migrated to framework_modern.html incrementally #} {# Pages using this framework will be migrated to framework_modern.html incrementally #}
@ -17,45 +13,36 @@
{# Legacy Bootstrap 3.3.7 - scoped to .legacy-bootstrap #} {# Legacy Bootstrap 3.3.7 - scoped to .legacy-bootstrap #}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<link <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.js"></script> <script src="https://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.js"></script>
<link <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" <link rel="stylesheet"
rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.7.3/css/bootstrap-select.min.css">
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.7.3/css/bootstrap-select.min.css"
/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.7.3/js/bootstrap-select.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.7.3/js/bootstrap-select.min.js"></script>
<script src="https://community.envipath.org/javascripts/embed-topics.js"></script> <script src="https://community.envipath.org/javascripts/embed-topics.js"></script>
<!-- CDN END --> <!-- CDN END -->
{# Bootstrap compatibility styles #} {# Bootstrap compatibility styles #}
<style> <style>
/* Ensure proper viewport behavior */ /* Ensure proper viewport behavior */
html, html, body {
body { height: 100%; /* ensure body fills viewport */
height: 100%; /* ensure body fills viewport */ overflow-x: hidden; /* prevent horizontal scroll */
overflow-x: hidden; /* prevent horizontal scroll */ }
}
</style> </style>
<script> <script>
const csrftoken = document.querySelector("[name=csrf-token]").content; const csrftoken = document.querySelector('[name=csrf-token]').content;
// Setup CSRF header for all jQuery AJAX requests // Setup CSRF header for all jQuery AJAX requests
$.ajaxSetup({ $.ajaxSetup({
beforeSend: function (xhr, settings) { beforeSend: function(xhr, settings) {
if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type)) { if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type)) {
xhr.setRequestHeader("X-CSRFToken", csrftoken); xhr.setRequestHeader("X-CSRFToken", csrftoken);
} }
}, }
}); });
</script> </script>
<!-- {# C3 CSS #}--> <!-- {# C3 CSS #}-->
@ -63,44 +50,40 @@
<!-- {# EP CSS #}--> <!-- {# EP CSS #}-->
<!-- <link id="css-pps_white_general" href="{% static 'css/epp.css' %}" rel="stylesheet" type="text/css"/>--> <!-- <link id="css-pps_white_general" href="{% static 'css/epp.css' %}" rel="stylesheet" type="text/css"/>-->
{# General EP JS #} {# General EP JS #}
<script src="{% static 'js/pps.js' %}"></script> <script src="{% static 'js/pps.js' %}"></script>
{# Modal Steps for Stepwise Modal Wizards #} {# Modal Steps for Stepwise Modal Wizards #}
<script src="{% static 'js/jquery-bootstrap-modal-steps.js' %}"></script> <script src="{% static 'js/jquery-bootstrap-modal-steps.js' %}"></script>
{% if not debug %} {% if not debug %}
<!-- Matomo --> <!-- Matomo -->
<script> <script>
var _paq = (window._paq = window._paq || []); var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */ /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["trackPageView"]); _paq.push(['trackPageView']);
_paq.push(["enableLinkTracking"]); _paq.push(['enableLinkTracking']);
(function () { (function () {
var u = "//matomo.envipath.com/"; var u = "//matomo.envipath.com/";
_paq.push(["setTrackerUrl", u + "matomo.php"]); _paq.push(['setTrackerUrl', u + 'matomo.php']);
_paq.push(["setSiteId", "{{ meta.site_id }}"]); _paq.push(['setSiteId', '{{ meta.site_id }}']);
var d = document, var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g = d.createElement("script"), g.async = true;
s = d.getElementsByTagName("script")[0]; g.src = u + 'matomo.js';
g.async = true; s.parentNode.insertBefore(g, s);
g.src = u + "matomo.js"; })();
s.parentNode.insertBefore(g, s); </script>
})(); <!-- End Matomo Code -->
</script>
<!-- End Matomo Code -->
{% endif %} {% endif %}
</head>
<body> </head>
<!-- Legacy Bootstrap navbar - isolated from Tailwind --> <body>
<div class="legacy-bootstrap"> <!-- Legacy Bootstrap navbar - isolated from Tailwind -->
<nav <div class="legacy-bootstrap">
class="navbar navbar-default navbar-inverse" <nav class="navbar navbar-default navbar-inverse" style="border-radius:0px;" role="navigation">
style="border-radius:0px;" <div class="container-fluid">
role="navigation" <!-- Brand and toggle get grouped for better mobile display -->
> <div class="navbar-header navbar-header-framework">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header navbar-header-framework">
<!-- <button type="button" class="navbar-toggle navbar-toggle-framework" data-toggle="collapse"--> <!-- <button type="button" class="navbar-toggle navbar-toggle-framework" data-toggle="collapse"-->
<!-- data-target="#navbarCollapse">--> <!-- data-target="#navbarCollapse">-->
<!-- <span class="sr-only">Toggle navigation</span>--> <!-- <span class="sr-only">Toggle navigation</span>-->
@ -108,310 +91,204 @@
<!-- <span class="icon-bar"></span>--> <!-- <span class="icon-bar"></span>-->
<!-- <span class="icon-bar"></span>--> <!-- <span class="icon-bar"></span>-->
<!-- </button>--> <!-- </button>-->
<a <a id="pictureLink" href="{{ meta.server_url }}" class="navbar-brand">
id="pictureLink" <img id="image-logo-short-white.svg" src='{% static "/images/logo-short-white.svg" %}' width="100"
href="{{ meta.server_url }}" alt="enviPath">
class="navbar-brand"
>
<img
id="image-logo-short-white.svg"
src="{% static "/images/logo-short-white.svg" %}"
width="100"
alt="enviPath"
/>
</a> </a>
</div> </div>
<!-- Collect the nav links, forms, and other content for toggling --> <!-- Collect the nav links, forms, and other content for toggling -->
<div <div class="collapse navbar-collapse collapse-framework navbar-collapse-framework" id="navbarCollapse">
class="navbar-collapse collapse-framework navbar-collapse-framework collapse"
id="navbarCollapse"
>
<ul class="nav navbar-nav navbar-nav-framework"> <ul class="nav navbar-nav navbar-nav-framework">
<li>
<a href="{{ meta.server_url }}/predict"> Predict Pathway </a>
</li>
{# <li class="dropdown">#}
{# <a data-toggle="dropdown" class="dropdown-toggle" href="#">Predict Pathway<b class="caret"></b></a>#}
{# <ul role="menu" class="dropdown-menu">#}
{# <li>#}
{# <a class="button" data-toggle="modal" data-target="#predict_modal">#}
{# <i class=" glyphicon glyphicon-tag"></i> Predict Pathway#}
{# </a>#}
{# </li>#}
{# <li>#}
{# <a class="button" data-toggle="modal" data-target="#batch_predict_modal">#}
{# <i class=" glyphicon glyphicon-tags"></i> Batch Prediction#}
{# </a>#}
{# </li>#}
{# </ul>#}
{# </li>#}
<li>
<a href="{{ meta.server_url }}/package" id="packageLink"
>Package</a
>
</li>
<li>
<a href="{{ meta.server_url }}/model" id="modelLink"
>Modelling</a
>
</li>
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#"
>Browse Data<b class="caret"></b
></a>
<ul role="menu" class="dropdown-menu">
<li>
<a href="{{ meta.server_url }}/pathway" id="pathwayLink"
>Pathway</a
>
</li>
<li>
<a href="{{ meta.server_url }}/rule" id="ruleLink">Rule</a>
</li>
<li>
<a href="{{ meta.server_url }}/compound" id="compoundLink"
>Compound</a
>
</li>
<li>
<a href="{{ meta.server_url }}/reaction" id="reactionLink"
>Reaction</a
>
</li>
<li>
<a
href="{{ meta.server_url }}/model"
id="relative-reasoningLink"
>Model</a
>
</li>
<li>
<a href="{{ meta.server_url }}/scenario" id="scenarioLink"
>Scenario</a
>
</li>
{# <li><a href="{{ meta.server_url }}/setting" id="settingLink">Setting</a></li>#}
{# <li><a href="{{ meta.server_url }}/user" id="userLink">User</a></li>#}
{# <li><a href="{{ meta.server_url }}/group" id="groupLink">Group</a></li>#}
</ul>
</li>
</ul>
<ul
class="nav navbar-nav navbar-right navbar-nav-framework navbar-right-framework"
>
<li>
<a href="https://community.envipath.org/" id="communityLink"
>Community</a
>
</li>
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#"
>Info <b class="caret"></b
></a>
<ul role="menu" class="dropdown-menu">
<!--<li><a href="{{ meta.server_url }}/funding" id="fundingLink">Funding</a></li>-->
<li>
<a
href="https://community.envipath.org/t/envipath-license/109"
id="licenceLink"
>Licences</a
>
</li>
<li class="divider"></li>
<li>
<a
target="_blank"
href="https://wiki.envipath.org/"
id="wikiLink"
>Documentation Wiki</a
>
</li>
<li>
<a
href="#"
id="citeButton"
data-toggle="modal"
data-target="#citemodal"
>How to cite enviPath</a
>
</li>
<li class="divider"></li>
<li><a>Version: {{ meta.version }}</a></li>
</ul>
</li>
{% if meta.user.username == 'anonymous' %}
<li> <li>
<a <a href="#" data-toggle="modal" data-target="#predict_modal">
href="{% url 'login' %}" Predict Pathway
id="loginButton" </a>
style="margin-right:10px"
>Login</a
>
</li> </li>
{% else %} {# <li class="dropdown">#}
{# <a data-toggle="dropdown" class="dropdown-toggle" href="#">Predict Pathway<b class="caret"></b></a>#}
{# <ul role="menu" class="dropdown-menu">#}
{# <li>#}
{# <a class="button" data-toggle="modal" data-target="#predict_modal">#}
{# <i class=" glyphicon glyphicon-tag"></i> Predict Pathway#}
{# </a>#}
{# </li>#}
{# <li>#}
{# <a class="button" data-toggle="modal" data-target="#batch_predict_modal">#}
{# <i class=" glyphicon glyphicon-tags"></i> Batch Prediction#}
{# </a>#}
{# </li>#}
{# </ul>#}
{# </li>#}
<li><a href="{{ meta.server_url }}/package" id="packageLink">Package</a></li>
<li><a href="{{ meta.server_url }}/search" id="searchLink">Search</a></li>
<li><a href="{{ meta.server_url }}/model" id="modelLink">Modelling</a></li>
<li class="dropdown"> <li class="dropdown">
<a <a data-toggle="dropdown" class="dropdown-toggle" href="#">Browse Data<b class="caret"></b></a>
data-toggle="dropdown" <ul role="menu" class="dropdown-menu">
id="loggedInButton" <li><a href="{{ meta.server_url }}/pathway" id="pathwayLink">Pathway</a></li>
class="dropdown-toggle" <li><a href="{{ meta.server_url }}/rule" id="ruleLink">Rule</a></li>
id="logedInButton" <li><a href="{{ meta.server_url }}/compound" id="compoundLink">Compound</a></li>
href="#" <li><a href="{{ meta.server_url }}/reaction" id="reactionLink">Reaction</a></li>
> <li><a href="{{ meta.server_url }}/model" id="relative-reasoningLink">Model</a></li>
<div id="username"> <li><a href="{{ meta.server_url }}/scenario" id="scenarioLink">Scenario</a></li>
{{ user.username }}<b class="caret"></b> {# <li><a href="{{ meta.server_url }}/setting" id="settingLink">Setting</a></li>#}
</div> {# <li><a href="{{ meta.server_url }}/user" id="userLink">User</a></li>#}
</a> {# <li><a href="{{ meta.server_url }}/group" id="groupLink">Group</a></li>#}
<ul role="menu" class="dropdown-menu"> </ul>
<li>
<a href="{{ meta.user.url }}" id="accountbutton"
>My Account</a
>
</li>
<li class="divider"></li>
<form
class="navbar-form navbar-left navbar-left-framework"
role="logout"
action="{% url 'logout' %}"
method="post"
>
{% csrf_token %}
<div class="form-group">
<input type="hidden" name="logout" value="true" />
</div>
<button type="submit" class="btn btn-default">
Logout
</button>
</form>
</ul>
</li> </li>
{% endif %}
</ul>
</div>
</div>
</nav>
</div>
<!-- End legacy Bootstrap navbar -->
<div id="docContent" class="content container"> </ul>
{% if breadcrumbs %}
<div id="bread"> <ul class="nav navbar-nav navbar-right navbar-nav-framework navbar-right-framework">
<ol class="breadcrumb"> <li><a href="https://community.envipath.org/" id="communityLink">Community</a></li>
{% for elem in breadcrumbs %} <li class="dropdown">
{% for name, url in elem.items %} <a data-toggle="dropdown" class="dropdown-toggle" href="#">Info <b class="caret"></b></a>
{% if forloop.parentloop.last %} <ul role="menu" class="dropdown-menu">
<li class="active">{{ name }}</li> <!--<li><a href="{{ meta.server_url }}/funding" id="fundingLink">Funding</a></li>-->
<li><a href="https://community.envipath.org/t/envipath-license/109" id="licenceLink">Licences</a></li>
<li class="divider"></li>
<li><a target="_blank" href="https://wiki.envipath.org/" id="wikiLink">Documentation Wiki</a>
</li>
<li><a href="#" id="citeButton" data-toggle="modal" data-target="#citemodal">How to cite
enviPath</a></li>
<li class="divider"></li>
<li><a>Version: {{ meta.version }}</a></li>
</ul>
</li>
{% if meta.user.username == 'anonymous' %}
<li>
<a href="{% url 'login' %}" id="loginButton" style="margin-right:10px">Login</a>
</li>
{% else %} {% else %}
<li> <li class="dropdown">
<a href="{{ url }}">{{ name }}</a> <a data-toggle="dropdown" id="loggedInButton" class="dropdown-toggle" id="logedInButton"
</li> href="#">
<div id="username">
{{ user.username }}<b class="caret"></b>
</div>
</a>
<ul role="menu" class="dropdown-menu">
<li>
<a href="{{ meta.user.url }}" id="accountbutton">My Account</a>
</li>
<li class="divider"></li>
<form class="navbar-form navbar-left navbar-left-framework" role="logout"
action="{% url 'logout' %}" method="post">
{% csrf_token %}
<div class="form-group">
<input type="hidden" name="logout" value="true">
</div>
<button type="submit" class="btn btn-default">Logout</button>
</form>
</ul>
</li>
{% endif %} {% endif %}
{% endfor %} </ul>
{% endfor %}
</ol>
</div> </div>
{% endif %} </div>
{% if message %} </nav>
<div id="message">{{ message }}</div> </div>
{% endif %} <!-- End legacy Bootstrap navbar -->
{% block content %}
{% endblock content %} <div id="docContent" class="content container">
{% if meta.url_contains_package and meta.current_package.license %} {% if breadcrumbs %}
<div id="bread">
<ol class="breadcrumb">
{% for elem in breadcrumbs %}
{% for name, url in elem.items %}
{% if forloop.parentloop.last %}
<li class="active">{{ name }}</li>
{% else %}
<li>
<a href="{{ url }}">{{ name }}</a>
</li>
{% endif %}
{% endfor %}
{% endfor %}
</ol>
</div>
{% endif %}
{% if message %}
<div id="message">
{{ message }}
</div>
{% endif %}
{% block content %}
{% endblock content %}
{% if meta.url_contains_package and meta.current_package.license %}
<p></p> <p></p>
<div class="panel-group" id="license_accordion"> <div class="panel-group" id="license_accordion">
<div <div class="panel panel-default list-group-item" style="background-color:#f5f5f5">
class="panel panel-default list-group-item" <div class="panel-title">
style="background-color:#f5f5f5" <a data-toggle="collapse" data-parent="#licence_accordion" href="#license">License</a>
> </div>
<div class="panel-title">
<a
data-toggle="collapse"
data-parent="#licence_accordion"
href="#license"
>License</a
>
</div> </div>
</div> <div id="license" class="panel-collapse collapse in">
<div id="license" class="panel-collapse in collapse"> <div class="panel-body list-group-item">
<div class="panel-body list-group-item"> <a target="_blank" href="{{ meta.current_package.license.link }}">
<a target="_blank" href="{{ meta.current_package.license.link }}"> <img src="{{ meta.current_package.license.image_link }}">
<img src="{{ meta.current_package.license.image_link }}" /> </a>
</a> </div>
</div> </div>
</div>
</div> </div>
{% endif %} {% endif %}
</div> </div>
<!-- FOOTER - Legacy Bootstrap --> <!-- FOOTER - Legacy Bootstrap -->
<div class="legacy-bootstrap"> <div class="legacy-bootstrap">
<div class="container text-center"> <div class="container text-center">
<hr /> <hr/>
<div class="row"> <div class="row">
<div class="col-lg-12">
<ul class="nav nav-pills nav-justified">
<li>
<a href="http://ml.auckland.ac.nz" target="_blank">
<img
id="image-uoalogo"
height="60"
src="{% static "/images/UoA-Logo-Primary-RGB-Small.png" %}"
alt="The Univserity of Auckland"
/>
</a>
</li>
<li>
<a href="https://eawag.ch" target="_blank">
<img
id="image-ealogo"
height="60"
src="{% static "/images/ealogo.gif" %}"
alt="Eawag"
/>
</a>
</li>
<li>
<a href="https://www.uzh.ch/" target="_blank">
<img
id="image-ufzlogo"
height="60"
src="{% static "/images/uzh-logo.svg" %}"
alt="University of Zurich"
/>
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<ul class="nav nav-pills nav-justified"> <ul class="nav nav-pills nav-justified">
<li>
<a href="http://ml.auckland.ac.nz" target="_blank">
<img id="image-uoalogo" height="60" src='{% static "/images/UoA-Logo-Primary-RGB-Small.png" %}'
alt="The Univserity of Auckland"/>
</a>
</li>
<li>
<a href="https://eawag.ch" target="_blank">
<img id="image-ealogo" height="60" src='{% static "/images/ealogo.gif" %}' alt="Eawag"/>
</a>
</li>
<li>
<a href="https://www.uzh.ch/" target="_blank">
<img id="image-ufzlogo" height="60" src='{% static "/images/uzh-logo.svg" %}'
alt="University of Zurich"/>
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<ul class="nav nav-pills nav-justified">
<!-- <li><a href="https://envipath.com/imprint/" target="_blank">Impressum/Imprint</a></li>--> <!-- <li><a href="https://envipath.com/imprint/" target="_blank">Impressum/Imprint</a></li>-->
<li> <li><a href="mailto:admin@envipath.org" target="_blank">Contact</a></li>
<a href="mailto:admin@envipath.org" target="_blank">Contact</a>
</li>
<!-- <li><a href="http://envipath.com" target="_blank"> enviPath UG (haftungsbeschr&auml;nkt) &amp; Co. KG &copy;--> <!-- <li><a href="http://envipath.com" target="_blank"> enviPath UG (haftungsbeschr&auml;nkt) &amp; Co. KG &copy;-->
<!-- {{ YEAR }}</a></li>--> <!-- {{ YEAR }}</a></li>-->
</ul> </ul>
</div>
</div>
</div> </div>
<!-- End legacy Bootstrap footer --> </div>
</div>
<!-- End legacy Bootstrap footer -->
<script> <script>
$(function () { $(function () {
// Hide actionsbutton if theres no action defined // Hide actionsbutton if theres no action defined
if ($("#actionsButton ul").children().length > 0) { if ($('#actionsButton ul').children().length > 0) {
$("#actionsButton").show(); $('#actionsButton').show();
} }
}); });
</script> </script>
{% block modals %} {% block modals %}
{% include "modals/cite_modal.html" %} {% include "modals/cite_modal.html" %}
{% include "modals/predict_modal.html" %} {% include "modals/signup_modal.html" %}
{% include "modals/batch_predict_modal.html" %} {% include "modals/predict_modal.html" %}
{% endblock %} {% include "modals/batch_predict_modal.html" %}
</body> {% endblock %}
</body>
</html> </html>

View File

@ -1,49 +1,38 @@
<!doctype html> <!DOCTYPE html>
<html data-theme="envipath" lang="en"> <html data-theme="envipath" lang="en">
{% load static %} {% load static %}
<head> <head>
<title>{{ title }}</title> <title>{{ title }}</title>
<meta charset="UTF-8" /> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="csrf-token" content="{{ csrf_token }}" /> <meta name="csrf-token" content="{{ csrf_token }}">
{# Favicon #} {# Favicon #}
<link <link rel="shortcut icon" type="image/png" href="{% static 'images/favicon.ico' %}"/>
rel="shortcut icon"
type="image/png"
href="{% static 'images/favicon.ico' %}"
/>
{# Tailwind CSS + DaisyUI Output #} {# Tailwind CSS + DaisyUI Output #}
<link <link href="{% static 'css/output.css' %}" rel="stylesheet" type="text/css"/>
href="{% static 'css/output.css' %}"
rel="stylesheet"
type="text/css"
/>
{# jQuery - Keep for compatibility with existing JS #} {# jQuery - Keep for compatibility with existing JS #}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
{# Font Awesome #} {# Font Awesome #}
<link <link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css"
rel="stylesheet"
/>
{# Discourse embed for community #} {# Discourse embed for community #}
<script src="https://community.envipath.org/javascripts/embed-topics.js"></script> <script src="https://community.envipath.org/javascripts/embed-topics.js"></script>
<script> <script>
const csrftoken = document.querySelector("[name=csrf-token]").content; const csrftoken = document.querySelector('[name=csrf-token]').content;
// Setup CSRF header for all jQuery AJAX requests // Setup CSRF header for all jQuery AJAX requests
$.ajaxSetup({ $.ajaxSetup({
beforeSend: function (xhr, settings) { beforeSend: function(xhr, settings) {
if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type)) { if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type)) {
xhr.setRequestHeader("X-CSRFToken", csrftoken); xhr.setRequestHeader("X-CSRFToken", csrftoken);
} }
}, }
}); });
</script> </script>
{# General EP JS #} {# General EP JS #}
@ -52,172 +41,136 @@
<script src="{% static 'js/jquery-bootstrap-modal-steps.js' %}"></script> <script src="{% static 'js/jquery-bootstrap-modal-steps.js' %}"></script>
{% if not debug %} {% if not debug %}
<!-- Matomo --> <!-- Matomo -->
<script> <script>
var _paq = (window._paq = window._paq || []); var _paq = window._paq = window._paq || [];
_paq.push(["trackPageView"]); _paq.push(['trackPageView']);
_paq.push(["enableLinkTracking"]); _paq.push(['enableLinkTracking']);
(function () { (function () {
var u = "//matomo.envipath.com/"; var u = "//matomo.envipath.com/";
_paq.push(["setTrackerUrl", u + "matomo.php"]); _paq.push(['setTrackerUrl', u + 'matomo.php']);
_paq.push(["setSiteId", "{{ meta.site_id }}"]); _paq.push(['setSiteId', '{{ meta.site_id }}']);
var d = document, var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g = d.createElement("script"), g.async = true;
s = d.getElementsByTagName("script")[0]; g.src = u + 'matomo.js';
g.async = true; s.parentNode.insertBefore(g, s);
g.src = u + "matomo.js"; })();
s.parentNode.insertBefore(g, s); </script>
})(); <!-- End Matomo Code -->
</script>
<!-- End Matomo Code -->
{% endif %} {% endif %}
</head> </head>
<body class="bg-base-300 min-h-screen"> <body class="min-h-screen bg-base-300">
{% include "includes/navbar.html" %} {% include "includes/navbar.html" %}
{# Main Content Area #} {# Main Content Area #}
<main class="w-full"> <main class="w-full">
{% block main_content %} {% block main_content %}
{# Breadcrumbs - outside main content, optional #} {# Breadcrumbs - outside main content, optional #}
{% if breadcrumbs %} {% if breadcrumbs %}
<div id="bread" class="mx-auto max-w-7xl px-4 py-4"> <div id="bread" class="max-w-7xl mx-auto px-4 py-4">
<div class="breadcrumbs text-sm"> <div class="text-sm breadcrumbs">
<ul> <ul>
{% for elem in breadcrumbs %} {% for elem in breadcrumbs %}
{% for name, url in elem.items %} {% for name, url in elem.items %}
{% if forloop.parentloop.last %} {% if forloop.parentloop.last %}
<li>{{ name }}</li> <li>{{ name }}</li>
{% else %} {% else %}
<li><a href="{{ url }}">{{ name }}</a></li> <li><a href="{{ url }}">{{ name }}</a></li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
</ul> </ul>
</div>
</div>
{% endif %}
{# Main content container - paper effect on medium+ screens #}
<div id="docContent" class="w-full xl:w-xl md:mx-auto md:my-8 bg-base-100 md:shadow-2xl md:rounded-lg border-2">
{# Messages - inside paper #}
{% if message %}
<div id="message" class="alert alert-info m-4">
{{ message }}
</div>
{% endif %}
{# Page content - no enforced styles #}
{% block content %}
{% endblock content %}
{# License - inside paper if present #}
{% if meta.url_contains_package and meta.current_package.license %}
<div class="collapse collapse-arrow bg-base-200 m-8">
<input type="checkbox" checked />
<div class="collapse-title text-xl font-medium">
License
</div>
<div class="collapse-content">
<a target="_blank" href="{{ meta.current_package.license.link }}">
<img src="{{ meta.current_package.license.image_link }}" alt="License">
</a>
</div>
</div>
{% endif %}
</div> </div>
</div> {% endblock main_content %}
{% endif %}
{# Main content container - paper effect on medium+ screens #}
<div
id="docContent"
class="bg-base-100 mx-auto md:my-8 md:max-w-6xl md:rounded-lg md:shadow-xl"
>
{# Messages - inside paper #}
{% if message %}
<div id="message" class="alert alert-info m-4">{{ message }}</div>
{% endif %}
{# Page content - no enforced styles #}
{% block content %}
{% endblock content %}
{# License - inside paper if present #}
{% if meta.url_contains_package and meta.current_package.license %}
<div class="collapse-arrow bg-base-200 collapse p-8">
<input type="checkbox" checked />
<div class="collapse-title text-xl font-medium">License</div>
<div class="collapse-content">
<a
target="_blank"
href="{{ meta.current_package.license.link }}"
>
<img
src="{{ meta.current_package.license.image_link }}"
alt="License"
/>
</a>
</div>
</div>
{% endif %}
</div>
{% endblock main_content %}
</main> </main>
{% include "includes/footer.html" %} {% include "includes/footer.html" %}
{# Floating Help Tab #} {# Floating Help Tab #}
{% if not public_mode %} {% if not public_mode %}
<div class="fixed top-1/2 right-0 z-50 -translate-y-1/2"> <div class="fixed right-0 top-1/2 -translate-y-1/2 z-50">
<a <a href="https://community.envipath.org/" target="_blank"
href="https://community.envipath.org/" class="flex items-center justify-center btn btn-secondary hover:btn-secondary-focus text-secondary-content text-sm shadow-lg transition-all duration-300 hover:scale-105 hover:-translate-x-1"
target="_blank" title="Get Help from the Community">
class="btn btn-secondary hover:btn-secondary-focus text-secondary-content flex items-center justify-center text-sm shadow-lg transition-all duration-300 hover:-translate-x-1 hover:scale-105" <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-message-circle-question-mark-icon lucide-message-circle-question-mark"><path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/>
title="Get Help from the Community" <path d="M12 17h.01"/>
> </svg>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-message-circle-question-mark-icon lucide-message-circle-question-mark"
>
<path
d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"
/>
<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" />
<path d="M12 17h.01" />
</svg>
</a> </a>
</div> </div>
{% endif %} {% endif %}
{# Modals - TODO: Convert these to DaisyUI modals #}
{% block modals %} {% block modals %}
{% include "modals/search_modal.html" %} {# Note: These modals still use Bootstrap markup and will need conversion #}
{% include "modals/cite_modal.html" %}
{% include "modals/signup_modal.html" %}
{% include "modals/predict_modal.html" %}
{% include "modals/batch_predict_modal.html" %}
{% endblock %} {% endblock %}
<script> <script>
$(function () { $(function () {
// Hide actionsbutton if there's no action defined // Hide actionsbutton if there's no action defined
if ($("#actionsButton ul").children().length > 0) { if ($('#actionsButton ul').children().length > 0) {
$("#actionsButton").show(); $('#actionsButton').show();
} }
});
// Open search modal function
function openSearchModal() {
const searchModal = document.getElementById("search_modal");
if (searchModal) {
searchModal.showModal();
}
}
// Click handler for search badge
const searchTrigger = document.getElementById("search-trigger");
if (searchTrigger) {
searchTrigger.addEventListener("click", function (event) {
event.preventDefault();
openSearchModal();
}); });
}
// Global keyboard shortcut for search (Cmd+K on Mac, Ctrl+K on Windows/Linux) // Global keyboard shortcut for search (Cmd+K on Mac, Ctrl+K on Windows/Linux)
document.addEventListener("keydown", function (event) { document.addEventListener('keydown', function(event) {
// Check if user is typing in an input field // Check if user is typing in an input field
const activeElement = document.activeElement; const activeElement = document.activeElement;
const isInputField = const isInputField = activeElement && (
activeElement && activeElement.tagName === 'INPUT' ||
(activeElement.tagName === "INPUT" || activeElement.tagName === 'TEXTAREA' ||
activeElement.tagName === "TEXTAREA" || activeElement.contentEditable === 'true'
activeElement.contentEditable === "true"); );
if (isInputField) { if (isInputField) {
return; // Don't trigger shortcut when typing in input fields return; // Don't trigger shortcut when typing in input fields
} }
// Check for Cmd+K (Mac) or Ctrl+K (Windows/Linux) // Check for Cmd+K (Mac) or Ctrl+K (Windows/Linux)
const isMac = /Mac/.test(navigator.platform); const isMac = /Mac/.test(navigator.platform);
const isCorrectModifier = isMac ? event.metaKey : event.ctrlKey; const isCorrectModifier = isMac ? event.metaKey : event.ctrlKey;
if (isCorrectModifier && event.key === "k") { if (isCorrectModifier && event.key === 'k') {
event.preventDefault(); event.preventDefault();
openSearchModal(); window.location.href = '/search';
} }
}); });
</script> </script>
</body> </body>
</html> </html>

View File

@ -1,22 +1,19 @@
{% load static %} {% load static %}
<div class="bg-base-300 text-base-content mx-auto mt-10 lg:max-w-5xl"> <div class="lg:max-w-5xl mt-10 mx-auto bg-base-300 text-base-content">
<footer class="footer sm:footer-horizontal p-10">
{% if not public_mode %} <footer class="footer sm:footer-horizontal p-10">
<nav> {% if not public_mode %}
<h6 class="footer-title">Services</h6> <nav>
<a class="link link-hover" href="/predict">Predict</a> <h6 class="footer-title">Services</h6>
<a class="link link-hover" href="/package">Packages</a> <a class="link link-hover" href="/">Predict</a>
{% if user.is_authenticated %} <a class="link link-hover" href="/search">Search</a>
<a class="link link-hover" href="/model">Your Collections</a> <a class="link link-hover" href="/package">Browse</a>
{% if user.is_authenticated %}
<a class="link link-hover" href="/model">Your Collections</a>
{% endif %}
<a href="https://wiki.envipath.org/" target="_blank" class="link link-hover">Documentation</a>
</nav>
{% endif %} {% endif %}
<a
href="https://wiki.envipath.org/"
target="_blank"
class="link link-hover"
>Documentation</a
>
</nav>
{% endif %}
<nav> <nav>
<h6 class="footer-title">Company</h6> <h6 class="footer-title">Company</h6>
<a class="link link-hover" href="/about">About us</a> <a class="link link-hover" href="/about">About us</a>
@ -32,61 +29,39 @@
<a class="link link-hover" href="/cite">Cite enviPath</a> <a class="link link-hover" href="/cite">Cite enviPath</a>
</nav> </nav>
</footer> </footer>
<footer class="footer border-t-2 border-neutral-300 px-10 py-4"> <footer class="footer border-neutral-300 border-t-2 px-10 py-4">
<div class="flex w-full flex-row items-start justify-between"> <div class="flex flex-row justify-between w-full items-start">
<aside class="grid-flow-col items-center"> <aside class="grid-flow-col items-center">
<svg <svg class="fill-neutral-content flex-shrink-0 h-14 m-2" viewbox="0 0 65 65" >
class="fill-neutral-content m-2 h-14 flex-shrink-0" <use
viewbox="0 0 65 65" href="{% static "/images/logo-square.svg" %}#ep-logo-square"
> >
<use </use>
href="{% static "/images/logo-square.svg" %}#ep-logo-square" </svg>
></use>
</svg>
enviPath Ltd. enviPath Ltd.
<br /> <br />
Biodegredation prediction since 2015. Biodegredation prediction since 2015.
</aside> </p>
<aside class="text-base-200 mt-2 text-sm">
<span class="text-xs tracking-tight">Version</span>
<span class="text-base font-bold">{{ meta.version }}</span>
</aside> </aside>
<aside class="text-sm text-base-200 mt-2"><span class="text-xs tracking-tight">Version</span> <span class="text-base font-bold">{{ meta.version }}</span></aside>
</div> </div>
<nav class="md:place-self-center md:justify-self-end"> <nav class="md:place-self-center md:justify-self-end">
<div class="grid grid-flow-col gap-4"> <div class="grid grid-flow-col gap-4">
<a href="https://www.youtube.com/@envipath7231" target="_blank"> <a href="https://www.youtube.com/@envipath7231" target="_blank">
<svg <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 fill-current">
role="img" <title>YouTube</title>
viewBox="0 0 24 24" <path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"/>
xmlns="http://www.w3.org/2000/svg" </svg>
class="h-6 w-6 fill-current"
>
<title>YouTube</title>
<path
d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"
/>
</svg>
</a> </a>
<a href="https://community.envipath.org/" target="_blank"> <a href="https://community.envipath.org/" target="_blank">
<svg <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 fill-current">
role="img" <title>Discourse</title>
viewBox="0 0 24 24" <path d="M12.103 0C18.666 0 24 5.485 24 11.997c0 6.51-5.33 11.99-11.9 11.99L0 24V11.79C0 5.28 5.532 0 12.103 0zm.116 4.563c-2.593-.003-4.996 1.352-6.337 3.57-1.33 2.208-1.387 4.957-.148 7.22L4.4 19.61l4.794-1.074c2.745 1.225 5.965.676 8.136-1.39 2.17-2.054 2.86-5.228 1.737-7.997-1.135-2.778-3.84-4.59-6.84-4.585h-.008z"/>
xmlns="http://www.w3.org/2000/svg" </svg>
class="h-6 w-6 fill-current"
>
<title>Discourse</title>
<path
d="M12.103 0C18.666 0 24 5.485 24 11.997c0 6.51-5.33 11.99-11.9 11.99L0 24V11.79C0 5.28 5.532 0 12.103 0zm.116 4.563c-2.593-.003-4.996 1.352-6.337 3.57-1.33 2.208-1.387 4.957-.148 7.22L4.4 19.61l4.794-1.074c2.745 1.225 5.965.676 8.136-1.39 2.17-2.054 2.86-5.228 1.737-7.997-1.135-2.778-3.84-4.59-6.84-4.585h-.008z"
/>
</svg>
</a> </a>
<a href="https://www.linkedin.com/company/envipath/" target="_blank"> <a href="https://www.linkedin.com/company/envipath/" target="_blank">
<img <img src="{% static "/images/linkedin.png" %}" alt="LinkedIn" class="w-6 h-6">
src="{% static "/images/linkedin.png" %}"
alt="LinkedIn"
class="h-6 w-6"
/>
</a> </a>
</div> </div>
</nav> </nav>

View File

@ -1,150 +1,71 @@
{% load static %} {% load static %}
{# Modern DaisyUI Navbar #} {# Modern DaisyUI Navbar #}
<div class="navbar x-50 bg-neutral-50 text-neutral-950 shadow-lg"> <div class="navbar bg-neutral-50 text-neutral-950 shadow-lg x-50">
<div class="navbar-start"> <div class="navbar-start">
<a href="{{ meta.server_url }}" class="btn btn-ghost text-xl normal-case"> <a href="{{ meta.server_url }}" class="btn btn-ghost normal-case text-xl">
<svg class="fill-base-content h-8" viewBox="0 0 104 26" role="img"> <svg class="h-8 fill-base-content" viewBox="0 0 104 26" role="img">
<use href="{% static "/images/logo-name.svg" %}#ep-logo-name" /> <use href='{% static "/images/logo-name.svg" %}#ep-logo-name' />
</svg> </svg>
</a> </a>
</div>
{% if not public_mode %}
<div class="navbar-center hidden lg:flex">
<a
href="{{ meta.server_url }}/predict"
role="button"
class="btn btn-ghost"
id="predictLink"
>Predict</a
>
<!-- <li><a href="{{ meta.server_url }}/package" id="packageLink">Package</a></li> -->
<!--<li><a href="{{ meta.server_url }}/browse" id="browseLink">Browse</a></li>-->
<div class="dropdown dropdown-center">
<div tabindex="0" role="button" class="btn btn-ghost">Browse</div>
<ul
tabindex="-1"
class="dropdown-content menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"
>
<li>
<a href="{{ meta.server_url }}/package" id="packageLink">Package</a>
</li>
<li>
<a href="{{ meta.server_url }}/pathway" id="pathwayLink">Pathway</a>
</li>
<li><a href="{{ meta.server_url }}/rule" id="ruleLink">Rule</a></li>
<li>
<a href="{{ meta.server_url }}/compound" id="compoundLink"
>Compound</a
>
</li>
<li>
<a href="{{ meta.server_url }}/reaction" id="reactionLink"
>Reaction</a
>
</li>
<li>
<a href="{{ meta.server_url }}/model" id="relative-reasoningLink"
>Model</a
>
</li>
<li>
<a href="{{ meta.server_url }}/scenario" id="scenarioLink"
>Scenario</a
>
</li>
</ul>
</div>
</div> </div>
{% endif %}
<div class="navbar-end">
{% if not public_mode %} {% if not public_mode %}
<a id="search-trigger" role="button" class="cursor-pointer"> <div class="navbar-center hidden lg:flex">
<div <a href="#" role="button" class="btn btn-ghost" id="predictLink">Predict</a>
class="badge badge-dash bg-base-200 text-base-content/50 m-1 flex items-center space-x-1 p-2" <!-- <li><a href="{{ meta.server_url }}/package" id="packageLink">Package</a></li> -->
> <!--<li><a href="{{ meta.server_url }}/browse" id="browseLink">Browse</a></li>-->
<svg <div class="dropdown dropdown-center">
xmlns="http://www.w3.org/2000/svg" <div tabindex="0" role="button" class="btn btn-ghost">Browse</div>
width="16" <ul tabindex="-1" class="dropdown-content menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
height="16" <li><a href="{{ meta.server_url }}/pathway" id="pathwayLink">Pathway</a></li>
viewBox="0 0 24 24" <li><a href="{{ meta.server_url }}/rule" id="ruleLink">Rule</a></li>
fill="none" <li><a href="{{ meta.server_url }}/compound" id="compoundLink">Compound</a></li>
stroke="currentColor" <li><a href="{{ meta.server_url }}/reaction" id="reactionLink">Reaction</a></li>
stroke-width="2" <li><a href="{{ meta.server_url }}/model" id="relative-reasoningLink">Model</a></li>
stroke-linecap="round" <li><a href="{{ meta.server_url }}/scenario" id="scenarioLink">Scenario</a></li>
stroke-linejoin="round" </ul>
class="lucide lucide-search-icon lucide-search"
>
<path d="m21 21-4.34-4.34" />
<circle cx="11" cy="11" r="8" />
</svg>
<span id="search-shortcut">⌘K</span>
</div> </div>
</a> </div>
{% endif %} {% endif %}
{% if meta.user.username == 'anonymous' or public_mode %}
<a href="{% url 'login' %}" id="loginButton" class="p-2">Login</a> <div class="navbar-end">
{% else %} {% if not public_mode %}
<div class="dropdown dropdown-end"> <a href="/search" role="button" >
<div <div class="flex items-center badge badge-dash space-x-1 bg-base-200 text-base-content/50 p-2 m-1">
tabindex="0" <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-search-icon lucide-search"><path d="m21 21-4.34-4.34"/><circle cx="11" cy="11" r="8"/></svg>
role="button" <span id="search-shortcut">⌘K</span>
class="btn btn-ghost btn-circle m-1" </div>
id="loggedInButton" </a>
> {% endif %}
<svg {% if meta.user.username == 'anonymous' or public_mode %}
xmlns="http://www.w3.org/2000/svg" <a href="{% url 'login' %}" id="loginButton" class="p-2">Login</a>
width="24" {% else %}
height="24" <div class="dropdown dropdown-end">
viewBox="0 0 24 24" <div tabindex="0" role="button" class="btn btn-ghost m-1 btn-circle" id="loggedInButton">
fill="none" <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-user-icon lucide-circle-user"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="10" r="3"/><path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662"/></svg>
stroke="currentColor" </div>
stroke-width="2" <ul tabindex="-1" class="dropdown-content menu bg-base-100 rounded-box z-50 w-52 p-2 shadow-sm">
stroke-linecap="round" <li><a href="{{ meta.user.url }}" id="accountbutton">Settings</a></li>
stroke-linejoin="round" <li>
class="lucide lucide-circle-user-icon lucide-circle-user" <form id="logoutForm" action="{% url 'logout' %}" method="post" style="display: none;">
> {% csrf_token %}
<circle cx="12" cy="12" r="10" /> <input type="hidden" name="logout" value="true">
<circle cx="12" cy="10" r="3" /> </form>
<path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> <a href="#" id="logoutButton" onclick="event.preventDefault(); document.getElementById('logoutForm').submit();">Logout</a>
</svg> </li>
</div> </ul>
<ul </div>
tabindex="-1" {% endif %}
class="dropdown-content menu bg-base-100 rounded-box z-50 w-52 p-2 shadow-sm" </div>
>
<li><a href="{{ meta.user.url }}" id="accountbutton">Settings</a></li>
<li>
<form
id="logoutForm"
action="{% url 'logout' %}"
method="post"
style="display: none;"
>
{% csrf_token %}
<input type="hidden" name="logout" value="true" />
</form>
<a
href="#"
id="logoutButton"
onclick="event.preventDefault(); document.getElementById('logoutForm').submit();"
>Logout</a
>
</li>
</ul>
</div>
{% endif %}
</div>
</div> </div>
<script> <script>
// OS-aware search shortcut display // OS-aware search shortcut display
(function () { (function() {
const isMac = /Mac/.test(navigator.platform); const isMac = /Mac/.test(navigator.platform);
const shortcutElement = document.getElementById("search-shortcut"); const shortcutElement = document.getElementById('search-shortcut');
if (shortcutElement) { if (shortcutElement) {
shortcutElement.textContent = isMac ? "⌘K" : "Ctrl+K"; shortcutElement.textContent = isMac ? '⌘K' : 'Ctrl+K';
} }
})(); })();
</script> </script>

View File

@ -1,283 +1,190 @@
{% extends "framework_modern.html" %} {% extends "framework_modern.html" %}
{% load static %} {% load static %}
{% block main_content %} {% block main_content %}
<!-- Hero Section with Logo and Search -->
<section class="hero relative mx-auto h-fit w-full max-w-5xl shadow-none">
<div
class="hero from-primary-800 to-primary-600 min-h-[calc(100vh*0.4)] bg-gradient-to-br"
style="background-image: url('{% static "/images/hero.png" %}'); background-size: cover; background-position: center;"
>
<div class="hero-overlay"></div>
<!-- Predict Pathway text over the image -->
<div class="absolute bottom-40 left-1/8 z-10 -translate-x-8">
<h2 class="text-base-100 text-left text-3xl text-shadow-lg">
Predict Your Pathway
</h2>
</div>
</div>
</section>
<div class="bg-base-200 mx-auto max-w-5xl shadow-md"> <!-- Hero Section with Logo and Search -->
<!-- Predict Pathway Section --> <section class="hero h-fit max-w-5xl w-full shadow-none mx-auto relative">
<div
class="relative z-20 mx-auto -mt-32 mb-10 w-full flex-col lg:flex-row-reverse"
>
<div
class="card bg-base-100 mx-auto w-3/4 shrink-0 shadow-xl transition-all duration-300 ease-in-out"
>
<div class="card-body">
<div class="my-4 ml-8 flex h-fit flex-row items-center justify-start">
<div class="flex items-center gap-1">
<label class="swap btn btn-ghost btn-sm p-1" title="Input Mode">
<input type="checkbox" />
<span class="swap-on flex items-center gap-1">
<div
class="bg-neutral/50 text-neutral-content flex items-center justify-center rounded-full p-1"
>
<svg
aria-label="smiles mode"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
class="size-5"
>
<g
stroke-linejoin="round"
stroke-linecap="round"
stroke-width="2"
fill="currentColor"
stroke="none"
>
<path
fill-rule="evenodd"
d="M8 2.75A.75.75 0 0 1 8.75 2h7.5a.75.75 0 0 1 0 1.5h-3.215l-4.483 13h2.698a.75.75 0 0 1 0 1.5h-7.5a.75.75 0 0 1 0-1.5h3.215l4.483-13H8.75A.75.75 0 0 1 8 2.75Z"
clip-rule="evenodd"
/>
</g>
</svg>
</div>
<span class="ext-xs">SMILES</span>
</span>
<span class="swap-off flex items-center gap-1">
<div
class="bg-neutral/50 text-neutral-content flex items-center justify-center rounded-full p-1"
>
<svg
aria-label="draw mode"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
stroke="none"
class="size-5"
>
<path
d="m2.695 14.762-1.262 3.155a.5.5 0 0 0 .65.65l3.155-1.262a4 4 0 0 0 1.343-.886L17.5 5.501a2.121 2.121 0 0 0-3-3L3.58 13.419a4 4 0 0 0-.885 1.343Z"
/>
</svg>
</div>
<span class="text-base/50 text-xs">Draw</span>
</span>
</label>
</div>
</div>
<fieldset <div class="hero min-h-[calc(100vh*0.4)] bg-gradient-to-br from-primary-800 to-primary-600"
class="fieldset overflow-hidden transition-all duration-300 ease-in-out" style="background-image: url('{% static "/images/hero.png" %}'); background-size: cover; background-position: center;"
>
<form
id="index-form"
action="{{ meta.current_package.url }}/pathway"
method="POST"
> >
{% csrf_token %} <div class="hero-overlay"></div>
<div <!-- Predict Pathway text over the image -->
id="text-input-container" <div class="absolute bottom-40 left-1/8 -translate-x-8 z-10">
class="scale-100 transform opacity-100 transition-all duration-300 ease-in-out" <h2 class="text-3xl text-base-100 text-shadow-lg text-left">Predict Your Pathway</h2>
> </div>
<div class="join mx-auto w-full"> </div>
<input </section>
type="text"
id="index-form-text-input" <div class="shadow-md max-w-5xl mx-auto bg-base-200">
placeholder="canonical SMILES string"
class="input input-md join-item grow" <!-- Predict Pathway Section -->
/> <div class="flex-col lg:flex-row-reverse w-full mx-auto -mt-32 relative z-20 mb-10 ">
<button class="btn btn-neutral join-item">Predict!</button> <div class="card bg-base-100 shrink-0 shadow-xl w-3/4 mx-auto transition-all duration-300 ease-in-out">
</div> <div class="card-body">
<div class="label relative mt-1 w-full"> <!-- Input Mode Toggle - Fixed position outside fieldset -->
<div class="flex gap-2"> <div class="flex flex-row justify-start items-center h-fit ml-8 my-4">
<a <div class="flex items-center gap-2">
href="#" <!-- <span class="text-sm text-neutral-500">Input Mode:</span> -->
class="example-link hover:text-primary cursor-pointer" <label class="toggle text-base-content toggle-md">
data-smiles="CN1C=NC2=C1C(=O)N(C(=O)N2C)C" <input type="checkbox" />
title="load example" <svg aria-label="smiles mode" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" class="size-5">
>Caffeine</a <g
> stroke-linejoin="round"
<a stroke-linecap="round"
href="#" stroke-width="2"
class="example-link hover:text-primary cursor-pointer" fill="currentColor"
data-smiles="CC(C)CC1=CC=C(C=C1)C(C)C(=O)O" stroke="none"
title="load example" >
>Ibuprofen</a <path fill-rule="evenodd" d="M8 2.75A.75.75 0 0 1 8.75 2h7.5a.75.75 0 0 1 0 1.5h-3.215l-4.483 13h2.698a.75.75 0 0 1 0 1.5h-7.5a.75.75 0 0 1 0-1.5h3.215l4.483-13H8.75A.75.75 0 0 1 8 2.75Z" clip-rule="evenodd" />
> </g>
</div> </svg>
<a class="absolute top-0 left-[calc(100%-5.4rem)]" href="#" <svg
>Advanced</a aria-label="draw mode"
> xmlns="http://www.w3.org/2000/svg"
</div> viewBox="0 0 20 20"
</div> fill="currentColor"
<div stroke="none"
id="ketcher-container" class="size-5"
class="hidden w-full scale-95 transform opacity-0 transition-all duration-300 ease-in-out" >
> <path d="m2.695 14.762-1.262 3.155a.5.5 0 0 0 .65.65l3.155-1.262a4 4 0 0 0 1.343-.886L17.5 5.501a2.121 2.121 0 0 0-3-3L3.58 13.419a4 4 0 0 0-.885 1.343Z" />
<iframe
id="index-ketcher" </svg>
src="{% static '/js/ketcher2/ketcher.html' %}" </label>
width="100%" </div>
height="400" </div>
class="rounded-lg"
></iframe> <fieldset class="fieldset transition-all duration-300 ease-in-out overflow-hidden">
<button <form id="index-form" action="{{ meta.current_package.url }}/pathway" method="POST">
class="btn btn-lg bg-primary-950 text-primary-50 join-item mt-2 w-full" {% csrf_token %}
> <div id="text-input-container" class="transition-all duration-300 ease-in-out opacity-100 transform scale-100">
Predict! <div class="join w-full mx-auto">
</button> <input type="text" id="index-form-text-input" placeholder="canonical SMILES string" class="input grow input-md join-item" />
<div class="mt-1 flex w-full justify-end"> <button class="btn btn-neutral join-item">Predict!</button>
<a class="label justify-end" href="/predict">Advanced</a> </div>
</div> <div class="label relative w-full mt-1" >
</div> <div class="flex gap-2">
<input <a href="#" class="example-link cursor-pointer hover:text-primary"
type="hidden" data-smiles="CN1C=NC2=C1C(=O)N(C(=O)N2C)C"
id="index-form-smiles" title="load example">Caffeine</a>
name="smiles" <a href="#" class="example-link cursor-pointer hover:text-primary"
value="smiles" data-smiles="CC(C)CC1=CC=C(C=C1)C(C)C(=O)O"
/> title="load example">Ibuprofen</a>
<input </div>
type="hidden" <a class="absolute top-0 left-[calc(100%-5.4rem)]" href="#">Advanced</a>
id="index-form-predict" </div>
name="predict" </div>
value="predict" <div id="ketcher-container" class="hidden w-full transition-all duration-300 ease-in-out opacity-0 transform scale-95">
/> <iframe id="index-ketcher" src="{% static '/js/ketcher2/ketcher.html' %}"
<input type="hidden" id="current-action" value="predict" /> width="100%" height="400" class="rounded-lg"></iframe>
</form> <button class="btn btn-lg bg-primary-950 text-primary-50 join-item w-full mt-2">Predict!</button>
</fieldset> <a class="label mx-auto w-full mt-1" href="#">Advanced</a>
</div>
<input type="hidden" id="index-form-smiles" name="smiles" value="smiles">
<input type="hidden" id="index-form-predict" name="predict" value="predict">
<input type="hidden" id="current-action" value="predict">
</form>
</fieldset>
</div>
</div> </div>
</div>
</div> </div>
<!-- Community News Section --> <!-- Community News Section -->
<section class="bg-base-200 z-10 mx-8 py-16"> <section class="py-16 bg-base-200 z-10 mx-8">
<div class="mx-auto max-w-7xl px-4"> <div class="max-w-7xl mx-auto px-4">
<h2 class="h2 mb-8 text-left font-bold">Community Updates</h2> <h2 class="h2 font-bold text-left mb-8">Community Updates</h2>
<div id="community-news-container" class="flex justify-center gap-4"> <div id="community-news-container" class="flex gap-4 justify-center">
<!-- News cards will be populated here --> <!-- News cards will be populated here -->
<div id="loading" class="flex w-full justify-center"> <div id="loading" class="flex justify-center w-full">
<span class="loading loading-spinner loading-lg"></span> <span class="loading loading-spinner loading-lg"></span>
</div> </div>
</div>
<div class="text-right mt-6">
<a href="https://community.envipath.org/c/announcements/10" target="_blank" class="btn btn-ghost btn-sm">
Read More Announcements
</a>
</div>
<!-- Discourse API integration -->
<script src="{% static 'js/discourse-api.js' %}"></script>
</div> </div>
<div class="mt-6 text-right">
<a
href="https://community.envipath.org/c/announcements/10"
target="_blank"
class="btn btn-ghost btn-sm"
>
Read More Announcements
</a>
</div>
<!-- Discourse API integration -->
<script src="{% static 'js/discourse-api.js' %}"></script>
</div>
</section> </section>
<!-- Mission Statement Section --> <!-- Mission Statement Section -->
<section class="from-base-200 to-base-100 bg-gradient-to-b py-16"> <section class="py-16 from-base-200 to-base-100 bg-gradient-to-b">
<div class="mx-auto px-8 md:px-12"> <div class="mx-auto px-8 md:px-12">
<div class="flex flex-row gap-4"> <div class="flex flex-row gap-4">
<div class="w-1/3"> <div class="w-1/3">
<img <img src="{% static "/images/ep-rule-artwork.png" %}" alt="rule-based iterative tree greneration" class="w-full h-full object-contain" />
src="{% static "/images/ep-rule-artwork.png" %}" </div>
alt="rule-based iterative tree greneration" <div class="space-y-4 text-left w-2/3 mr-8">
class="h-full w-full object-contain" <h2 class="h2 font-bold mb-8">About enviPath</h2>
/> <p class="">
</div> enviPath is a database and prediction system for the microbial
<div class="mr-8 w-2/3 space-y-4 text-left"> biotransformation of organic environmental contaminants. The
<h2 class="h2 mb-8 font-bold">About enviPath</h2> database provides the possibility to store and view experimentally
<p class=""> observed biotransformation pathways.
enviPath is a database and prediction system for the microbial </p>
biotransformation of organic environmental contaminants. The <p class="">
database provides the possibility to store and view experimentally The pathway prediction system provides different relative reasoning models
observed biotransformation pathways. to predict likely biotransformation pathways and products. Explore our tools
</p> and contribute to advancing environmental biotransformation research.
<p class=""> </p>
The pathway prediction system provides different relative <div class="flex flex-row gap-4 float-right">
reasoning models to predict likely biotransformation pathways and <a href="/about" class="btn btn-ghost-neutral">Read More</a>
products. Explore our tools and contribute to advancing <a href="/about" class="btn btn-neutral">Publications</a>
environmental biotransformation research. </div>
</p> </div>
<div class="float-right flex flex-row gap-4">
<a href="/about" class="btn btn-ghost-neutral">Read More</a>
<a href="/about" class="btn btn-neutral">Publications</a>
</div> </div>
</div>
</div> </div>
</div>
</section> </section>
<!-- Partners Section --> <!-- Partners Section -->
<section class="bg-base-100 py-14 sm:py-12"> <section class="py-14 sm:py-12 bg-base-100">
<div class="mx-auto px-6 lg:px-8"> <div class="mx-auto px-6 lg:px-8">
<div class="divider"> <div class="divider"><h2 class="text-center text-lg/8 font-semibold">Backed by Science</h2></div>
<h2 class="text-center text-lg/8 font-semibold">Backed by Science</h2> <div class="mx-auto mt-10 grid max-w-lg grid-cols-4 items-center gap-x-8 gap-y-10 sm:max-w-xl sm:grid-cols-6 sm:gap-x-10 lg:mx-0 lg:max-w-none lg:grid-cols-3">
<img src="{% static "/images/uoa-logo-small.png" %}" alt="The University of Auckland" class=" max-h-20 w-full object-contain lg:col-span-1" />
<img src="{% static "/images/logo-eawag.svg" %}" alt="Eawag" class=" max-h-12 w-full object-contain lg:col-span-1" />
<img src="{% static "/images/uzh-logo.svg" %}" alt="University of Zurich" class="2 max-h-16 w-full object-contain lg:col-span-1" />
</div>
</div> </div>
<div
class="mx-auto mt-10 grid max-w-lg grid-cols-4 items-center gap-x-8 gap-y-10 sm:max-w-xl sm:grid-cols-6 sm:gap-x-10 lg:mx-0 lg:max-w-none lg:grid-cols-3"
>
<img
src="{% static "/images/uoa-logo-small.png" %}"
alt="The University of Auckland"
class="max-h-20 w-full object-contain lg:col-span-1"
/>
<img
src="{% static "/images/logo-eawag.svg" %}"
alt="Eawag"
class="max-h-12 w-full object-contain lg:col-span-1"
/>
<img
src="{% static "/images/uzh-logo.svg" %}"
alt="University of Zurich"
class="2 max-h-16 w-full object-contain lg:col-span-1"
/>
</div>
</div>
</section> </section>
</div>
<script language="javascript">
var currentPackage = "{{ meta.current_package.url }}";
// Discourse API integration is now handled by discourse-api.js
// Function to render Discourse topics into cards
function renderDiscourseTopics(topics) {
const container = document.getElementById("community-news-container");
if (!container) return;
// Clear container </div>
container.innerHTML = "";
// Create cards for each topic <script language="javascript">
topics.forEach((topic) => { var currentPackage = "{{ meta.current_package.url }}";
const card = createDiscourseCard(topic);
container.insertAdjacentHTML("beforeend", card);
});
}
// Function to create HTML card for a topic // Discourse API integration is now handled by discourse-api.js
function createDiscourseCard(topic) {
const date = new Date(topic.created_at).toLocaleDateString();
return ` // Function to render Discourse topics into cards
function renderDiscourseTopics(topics) {
const container = document.getElementById('community-news-container');
if (!container) return;
// Clear container
container.innerHTML = '';
// Create cards for each topic
topics.forEach(topic => {
const card = createDiscourseCard(topic);
container.insertAdjacentHTML('beforeend', card);
});
}
// Function to create HTML card for a topic
function createDiscourseCard(topic) {
const date = new Date(topic.created_at).toLocaleDateString();
return `
<div class="card bg-white shadow-xs hover:shadow-lg transition-shadow duration-300 h-64 w-75 flex-shrink-0"> <div class="card bg-white shadow-xs hover:shadow-lg transition-shadow duration-300 h-64 w-75 flex-shrink-0">
<div class="card-body flex flex-col h-full"> <div class="card-body flex flex-col h-full">
<h3 class="card-title leading-tight font-normal tracking-tight h-12 mb-2 line-clamp-2 text-ellipsis wrap-break-word overflow-hidden"> <h3 class="card-title leading-tight font-normal tracking-tight h-12 mb-2 line-clamp-2 text-ellipsis wrap-break-word overflow-hidden">
@ -308,146 +215,146 @@
</div> </div>
</div> </div>
`; `;
}
// Make render function globally available
window.renderDiscourseTopics = renderDiscourseTopics;
// Toggle functionality with smooth animations
function toggleInputMode() {
const toggle = $('input[type="checkbox"]');
const textContainer = $("#text-input-container");
const ketcherContainer = $("#ketcher-container");
const formCard = $(".card");
const fieldset = $(".fieldset");
if (toggle.is(":checked")) {
// Draw mode - show Ketcher, hide text input
textContainer.addClass("opacity-0 transform scale-95");
textContainer.removeClass("opacity-100 transform scale-100");
// Adjust fieldset padding for Ketcher mode - reduce padding and make more compact
fieldset.removeClass("p-8");
fieldset.addClass("p-4");
// Wait for fade out to complete, then hide and show new content
setTimeout(() => {
textContainer.addClass("hidden");
ketcherContainer.removeClass("hidden opacity-0 transform scale-95");
ketcherContainer.addClass("opacity-100 transform scale-100");
// Force re-evaluation of iframe size
const iframe = document.getElementById("index-ketcher");
if (iframe) {
iframe.style.height = "400px";
}
}, 300);
} else {
// SMILES mode - show text input, hide Ketcher
ketcherContainer.addClass("opacity-0 transform scale-95");
ketcherContainer.removeClass("opacity-100 transform scale-100");
// Restore fieldset padding for text input mode
fieldset.removeClass("p-4");
fieldset.addClass("p-8");
// Wait for fade out to complete, then hide and show new content
setTimeout(() => {
ketcherContainer.addClass("hidden");
textContainer.removeClass("hidden opacity-0 transform scale-95");
textContainer.addClass("opacity-100 transform scale-100");
}, 300);
// Transfer SMILES from Ketcher to text input if available
if (window.indexKetcher && window.indexKetcher.getSmiles) {
const smiles = window.indexKetcher.getSmiles();
if (smiles && smiles.trim() !== "") {
$("#index-form-text-input").val(smiles);
}
} }
}
}
// Ketcher integration // Make render function globally available
function indexKetcherToTextInput() { window.renderDiscourseTopics = renderDiscourseTopics;
$("#index-form-smiles").val(this.ketcher.getSmiles());
}
$(function () { // Toggle functionality with smooth animations
// Initialize fieldset with proper padding function toggleInputMode() {
$(".fieldset").addClass("p-8"); const toggle = $('input[type="checkbox"]');
const textContainer = $('#text-input-container');
const ketcherContainer = $('#ketcher-container');
const formCard = $('.card');
const fieldset = $('.fieldset');
// Toggle event listener if (toggle.is(':checked')) {
$('input[type="checkbox"]').on("change", toggleInputMode); // Draw mode - show Ketcher, hide text input
textContainer.addClass('opacity-0 transform scale-95');
textContainer.removeClass('opacity-100 transform scale-100');
// Ketcher iframe load handler // Adjust fieldset padding for Ketcher mode - reduce padding and make more compact
$("#index-ketcher").on("load", function () { fieldset.removeClass('p-8');
const checkKetcherReady = () => { fieldset.addClass('p-4');
const win = this.contentWindow;
if (win.ketcher && "editor" in win.ketcher) { // Wait for fade out to complete, then hide and show new content
window.indexKetcher = win.ketcher; setTimeout(() => {
win.ketcher.editor.event.change.handlers.push({ textContainer.addClass('hidden');
once: false, ketcherContainer.removeClass('hidden opacity-0 transform scale-95');
priority: 0, ketcherContainer.addClass('opacity-100 transform scale-100');
f: indexKetcherToTextInput,
ketcher: win.ketcher, // Force re-evaluation of iframe size
const iframe = document.getElementById('index-ketcher');
if (iframe) {
iframe.style.height = '400px';
}
}, 300);
} else {
// SMILES mode - show text input, hide Ketcher
ketcherContainer.addClass('opacity-0 transform scale-95');
ketcherContainer.removeClass('opacity-100 transform scale-100');
// Restore fieldset padding for text input mode
fieldset.removeClass('p-4');
fieldset.addClass('p-8');
// Wait for fade out to complete, then hide and show new content
setTimeout(() => {
ketcherContainer.addClass('hidden');
textContainer.removeClass('hidden opacity-0 transform scale-95');
textContainer.addClass('opacity-100 transform scale-100');
}, 300);
// Transfer SMILES from Ketcher to text input if available
if (window.indexKetcher && window.indexKetcher.getSmiles) {
const smiles = window.indexKetcher.getSmiles();
if (smiles && smiles.trim() !== '') {
$('#index-form-text-input').val(smiles);
}
}
}
}
// Ketcher integration
function indexKetcherToTextInput() {
$('#index-form-smiles').val(this.ketcher.getSmiles());
}
$(function () {
// Initialize fieldset with proper padding
$('.fieldset').addClass('p-8');
// Toggle event listener
$('input[type="checkbox"]').on('change', toggleInputMode);
// Ketcher iframe load handler
$('#index-ketcher').on('load', function() {
const checkKetcherReady = () => {
const win = this.contentWindow;
if (win.ketcher && 'editor' in win.ketcher) {
window.indexKetcher = win.ketcher;
win.ketcher.editor.event.change.handlers.push({
once: false,
priority: 0,
f: indexKetcherToTextInput,
ketcher: win.ketcher
});
} else {
setTimeout(checkKetcherReady, 100);
}
};
checkKetcherReady();
}); });
} else {
setTimeout(checkKetcherReady, 100);
}
};
checkKetcherReady();
});
// Handle example link clicks // Handle example link clicks
$(".example-link").on("click", function (e) { $('.example-link').on('click', function(e) {
e.preventDefault(); e.preventDefault();
const smiles = $(this).data("smiles"); const smiles = $(this).data('smiles');
const title = $(this).attr("title"); const title = $(this).attr('title');
// Check if we're in Ketcher mode or text input mode // Check if we're in Ketcher mode or text input mode
if ($('input[type="checkbox"]').is(":checked")) { if ($('input[type="checkbox"]').is(':checked')) {
// In Ketcher mode - set the SMILES in Ketcher // In Ketcher mode - set the SMILES in Ketcher
if (window.indexKetcher && window.indexKetcher.setMolecule) { if (window.indexKetcher && window.indexKetcher.setMolecule) {
window.indexKetcher.setMolecule(smiles); window.indexKetcher.setMolecule(smiles);
} }
} else { } else {
// In text input mode - set the SMILES in the text input // In text input mode - set the SMILES in the text input
$("#index-form-text-input").val(smiles); $('#index-form-text-input').val(smiles);
} }
// Show a brief feedback // Show a brief feedback
const originalText = $(this).text(); const originalText = $(this).text();
$(this).text(`loaded!`); $(this).text(`loaded!`);
setTimeout(() => { setTimeout(() => {
$(this).text(originalText); $(this).text(originalText);
}, 1000); }, 1000);
}); });
// Handle form submission on Enter // Handle form submission on Enter
$("#index-form").on("submit", function (e) { $('#index-form').on("submit", function (e) {
e.preventDefault(); e.preventDefault();
var textSmiles = ""; var textSmiles = '';
// Check if we're in Ketcher mode and extract SMILES // Check if we're in Ketcher mode and extract SMILES
if ($('input[type="checkbox"]').is(":checked") && window.indexKetcher) { if ($('input[type="checkbox"]').is(':checked') && window.indexKetcher) {
textSmiles = window.indexKetcher.getSmiles().trim(); textSmiles = window.indexKetcher.getSmiles().trim();
} else { } else {
textSmiles = $("#index-form-text-input").val().trim(); textSmiles = $('#index-form-text-input').val().trim();
} }
if (textSmiles === "") { if (textSmiles === '') {
return; return;
} }
$("#index-form-smiles").val(textSmiles); $('#index-form-smiles').val(textSmiles);
$("#index-form").attr("action", currentPackage + "/pathway"); $("#index-form").attr("action", currentPackage + "/pathway");
$("#index-form").attr("method", "POST"); $("#index-form").attr("method", 'POST');
this.submit(); this.submit();
}); });
// Discourse topics are now loaded automatically by discourse-api.js // Discourse topics are now loaded automatically by discourse-api.js
}); });
</script> </script>
{% endblock main_content %} {% endblock main_content %}

View File

@ -1,71 +1,44 @@
{% extends "framework.html" %} {% extends "framework.html" %}
{% block content %} {% block content %}
<div class="panel-group" id="migration-detail"> <div class="panel-group" id="migration-detail">
<div class="panel panel-default"> <div class="panel panel-default">
<div <div class="panel-heading" id="headingPanel" style="font-size:2rem;height: 46px">
class="panel-heading" Migration Status BT Rules
id="headingPanel" </div>
style="font-size:2rem;height: 46px" <div class="panel-body">
> <p>Rules with Error: {{ error }}/{{ total }} </p>
Migration Status BT Rules <p>Rules without Error: {{ success }}/{{ total }}</p>
</div> </div>
<div class="panel-body">
<p>Rules with Error: {{ error }}/{{ total }}</p>
<p>Rules without Error: {{ success }}/{{ total }}</p>
</div>
{% for obj in results %} {% for obj in results %}
<div <div class="panel panel-default panel-heading list-group-item" style="background-color:silver">
class="panel panel-default panel-heading list-group-item" {% if obj.status %}
style="background-color:silver" <span class="glyphicon glyphicon-ok" aria-hidden="true"
> style="float:right" data-toggle="tooltip"
{% if obj.status %} data-placement="top" title="" data-original-title="Reviewed">
<span
class="glyphicon glyphicon-ok"
aria-hidden="true"
style="float:right"
data-toggle="tooltip"
data-placement="top"
title=""
data-original-title="Reviewed"
>
</span> </span>
{% else %} {% else %}
<span <span class="glyphicon glyphicon-remove" aria-hidden="true"
class="glyphicon glyphicon-remove" style="float:right" data-toggle="tooltip"
aria-hidden="true" data-placement="top" title="" data-original-title="Reviewed">
style="float:right"
data-toggle="tooltip"
data-placement="top"
title=""
data-original-title="Reviewed"
>
</span> </span>
{% endif %} {% endif %}
<h4 class="panel-title"> <h4 class="panel-title">
<a <a id="{{ obj.id }}-link" data-toggle="collapse" data-parent="#migration-detail"
id="{{ obj.id }}-link" href="#{{ obj.id }}">{{ obj.name|safe }}</a>
data-toggle="collapse" </h4>
data-parent="#migration-detail"
href="#{{ obj.id }}"
>{{ obj.name|safe }}</a
>
</h4>
</div> </div>
<div <div id="{{ obj.id }}" class="panel-collapse collapse {% if not obj.status %}in{% endif %}">
id="{{ obj.id }}" <div class="panel-body list-group-item">
class="panel-collapse {% if not obj.status %}in{% endif %} collapse" <a class="list-group-item" href="{{ obj.detail_url }}">{{ obj.name|safe }} Migration Detail Page</a>
> </div>
<div class="panel-body list-group-item">
<a class="list-group-item" href="{{ obj.detail_url }}"
>{{ obj.name|safe }} Migration Detail Page</a
>
</div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
<script></script> <script>
</script>
{% endblock content %} {% endblock content %}

View File

@ -1,77 +1,45 @@
{% extends "framework.html" %} {% extends "framework.html" %}
{% block content %} {% block content %}
<div class="panel-group" id="migration-detail"> <div class="panel-group" id="migration-detail">
<div class="panel panel-default"> <div class="panel panel-default">
<div <div class="panel-heading" id="headingPanel" style="font-size:2rem;height: 46px">
class="panel-heading" Migration Status for {{ bt_rule_name }}
id="headingPanel" </div>
style="font-size:2rem;height: 46px" <div class="panel-body">
> <p>A package contains pathways, rules, etc. and can reflect specific experimental
Migration Status for {{ bt_rule_name }} conditions. <a target="_blank" href="https://wiki.envipath.org/index.php/packages" role="button">Learn
</div> more &gt;&gt;</a></p>
<div class="panel-body"> </div>
<p>
A package contains pathways, rules, etc. and can reflect specific
experimental conditions.
<a
target="_blank"
href="https://wiki.envipath.org/index.php/packages"
role="button"
>Learn more &gt;&gt;</a
>
</p>
</div>
{% for obj in results %} {% for obj in results %}
<div <div class="panel panel-default panel-heading list-group-item" style="background-color:silver">
class="panel panel-default panel-heading list-group-item" {% if obj.status %}
style="background-color:silver" <span class="glyphicon glyphicon-ok" aria-hidden="true"
> style="float:right" data-toggle="tooltip"
{% if obj.status %} data-placement="top" title="" data-original-title="Reviewed">
<span </span>
class="glyphicon glyphicon-ok" {% else %}
aria-hidden="true" <span class="glyphicon glyphicon-remove" aria-hidden="true"
style="float:right" style="float:right" data-toggle="tooltip"
data-toggle="tooltip" data-placement="top" title="" data-original-title="Reviewed">
data-placement="top" </span>
title="" {% endif %}
data-original-title="Reviewed" <h4 class="panel-title">
> <a id="{{ obj.id }}-link" data-toggle="collapse" data-parent="#migration-detail"
</span> href="#{{ obj.id }}">{{ obj.name|safe }}</a>
{% else %} </h4>
<span </div>
class="glyphicon glyphicon-remove" <div id="{{ obj.id }}" class="panel-collapse collapse {% if not obj.status %}in{% endif %}">
aria-hidden="true" <div class="panel-body list-group-item">
style="float:right" <pre>{{ obj.detail }}</pre>
data-toggle="tooltip" </div>
data-placement="top" </div>
title="" {% endfor %}
data-original-title="Reviewed"
>
</span>
{% endif %}
<h4 class="panel-title">
<a
id="{{ obj.id }}-link"
data-toggle="collapse"
data-parent="#migration-detail"
href="#{{ obj.id }}"
>{{ obj.name|safe }}</a
>
</h4>
</div> </div>
<div
id="{{ obj.id }}"
class="panel-collapse {% if not obj.status %}in{% endif %} collapse"
>
<div class="panel-body list-group-item">
<pre>{{ obj.detail }}</pre>
</div>
</div>
{% endfor %}
</div> </div>
</div>
<script></script> <script>
</script>
{% endblock content %} {% endblock content %}

View File

@ -1,48 +1,31 @@
<div <div class="modal fade bs-modal-lg" id="citemodal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
class="modal fade bs-modal-lg" aria-hidden="true">
id="citemodal" <div class="modal-dialog modal-lg">
tabindex="-1" <div class="modal-content">
role="dialog" <div class="modal-header">
aria-labelledby="myLargeModalLabel" <h3>How to cite enviPath</h3>
aria-hidden="true" </div>
> <div class="modal-body">
<div class="modal-dialog modal-lg"> <ol class="list-group list-group-numbered">
<div class="modal-content"> <li class="list-group-item">
<div class="modal-header"> Hafner, J., Lorsbach, T., Schmidt, S. <em>et al.</em>
<h3>How to cite enviPath</h3> <cite>Advancements in biotransformation pathway prediction: enhancements, datasets, and novel
</div> functionalities in enviPath.</cite>
<div class="modal-body"> <a href="https://doi.org/10.1186/s13321-024-00881-6" target="_blank">J Cheminform 16, 93
<ol class="list-group list-group-numbered"> (2024)</a>
<li class="list-group-item"> </li>
Hafner, J., Lorsbach, T., Schmidt, S. <em>et al.</em> <li class="list-group-item">
<cite Wicker, J., Lorsbach, T., Gütlein, M., Schmid, E., Latino, D., Kramer, S., Fenner, K.
>Advancements in biotransformation pathway prediction: <cite>enviPath - The environmental contaminant biotransformation pathway resource</cite>
enhancements, datasets, and novel functionalities in <a href="https://doi.org/10.1093/nar/gkv1229" target="_blank">
enviPath.</cite Nucleic Acids Research, Volume 44, Issue D1, 4 January 2016, Pages D502-D508
> </a>
<a href="https://doi.org/10.1186/s13321-024-00881-6" target="_blank" </li>
>J Cheminform 16, 93 (2024)</a </ol>
> </div>
</li> <div class="modal-footer">
<li class="list-group-item"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
Wicker, J., Lorsbach, T., Gütlein, M., Schmid, E., Latino, D., </div>
Kramer, S., Fenner, K. </div>
<cite
>enviPath - The environmental contaminant biotransformation
pathway resource</cite
>
<a href="https://doi.org/10.1093/nar/gkv1229" target="_blank">
Nucleic Acids Research, Volume 44, Issue D1, 4 January 2016, Pages
D502-D508
</a>
</li>
</ol>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">
Close
</button>
</div>
</div> </div>
</div>
</div> </div>

View File

@ -1,70 +1,42 @@
<div <div class="modal fade" tabindex="-1" id="import_legacy_package_modal" role="dialog"
class="modal fade" aria-labelledby="import_legacy_package_modal" aria-hidden="true">
tabindex="-1" <div class="modal-dialog">
id="import_legacy_package_modal" <div class="modal-content">
role="dialog" <div class="modal-header">
aria-labelledby="import_legacy_package_modal" <button type="button" class="close" data-dismiss="modal">
aria-hidden="true" <span aria-hidden="true">&times;</span>
> <span class="sr-only">Close</span>
<div class="modal-dialog"> </button>
<div class="modal-content"> <h4 class="modal-title">Import Package from legacy System</h4>
<div class="modal-header"> </div>
<button type="button" class="close" data-dismiss="modal"> <div class="modal-body">
<span aria-hidden="true">&times;</span> <p>Create a Package based on the JSON Export of the legacy system.</p>
<span class="sr-only">Close</span> <form id="import-legacy-package-modal-form" accept-charset="UTF-8" data-remote="true" method="post"
</button> enctype="multipart/form-data">
<h4 class="modal-title">Import Package from legacy System</h4> {% csrf_token %}
</div> <p>
<div class="modal-body"> <label class="btn btn-primary" for="legacyJsonFile">
<p>Create a Package based on the JSON Export of the legacy system.</p> <input id="legacyJsonFile" name="file" type="file" style="display:none;"
<form onchange="$('#upload-legacy-file-info').html(this.files[0].name)">
id="import-legacy-package-modal-form" Choose JSON File
accept-charset="UTF-8" </label>
data-remote="true" <span class="label label-info" id="upload-legacy-file-info"></span>
method="post" <input type="hidden" value="import-legacy-package-json" name="hidden" readonly="">
enctype="multipart/form-data" </p>
> </form>
{% csrf_token %} </div>
<p> <div class="modal-footer">
<label class="btn btn-primary" for="legacyJsonFile"> <a id="import-legacy-package-modal-form-submit" class="btn btn-primary" href="#">Submit</a>
<input <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
id="legacyJsonFile" </div>
name="file" </div>
type="file"
style="display:none;"
onchange="$('#upload-legacy-file-info').html(this.files[0].name)"
/>
Choose JSON File
</label>
<span class="label label-info" id="upload-legacy-file-info"></span>
<input
type="hidden"
value="import-legacy-package-json"
name="hidden"
readonly=""
/>
</p>
</form>
</div>
<div class="modal-footer">
<a
id="import-legacy-package-modal-form-submit"
class="btn btn-primary"
href="#"
>Submit</a
>
<button type="button" class="btn btn-default" data-dismiss="modal">
Cancel
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function () {
$("#import-legacy-package-modal-form-submit").on("click", function (e) { $('#import-legacy-package-modal-form-submit').on('click', function (e) {
e.preventDefault(); e.preventDefault();
$("#import-legacy-package-modal-form").submit(); $('#import-legacy-package-modal-form').submit();
});
}); });
});
</script> </script>

View File

@ -1,70 +1,42 @@
<div <div class="modal fade" tabindex="-1" id="import_package_modal" role="dialog"
class="modal fade" aria-labelledby="import_package_modal" aria-hidden="true">
tabindex="-1" <div class="modal-dialog">
id="import_package_modal" <div class="modal-content">
role="dialog" <div class="modal-header">
aria-labelledby="import_package_modal" <button type="button" class="close" data-dismiss="modal">
aria-hidden="true" <span aria-hidden="true">&times;</span>
> <span class="sr-only">Close</span>
<div class="modal-dialog"> </button>
<div class="modal-content"> <h4 class="modal-title">Import Package</h4>
<div class="modal-header"> </div>
<button type="button" class="close" data-dismiss="modal"> <div class="modal-body">
<span aria-hidden="true">&times;</span> <p>Create a Package based on a JSON Export.</p>
<span class="sr-only">Close</span> <form id="import-package-modal-form" accept-charset="UTF-8" data-remote="true" method="post"
</button> enctype="multipart/form-data">
<h4 class="modal-title">Import Package</h4> {% csrf_token %}
</div> <p>
<div class="modal-body"> <label class="btn btn-primary" for="jsonFile">
<p>Create a Package based on a JSON Export.</p> <input id="jsonFile" name="file" type="file" style="display:none;"
<form onchange="$('#upload-file-info').html(this.files[0].name)">
id="import-package-modal-form" Choose JSON File
accept-charset="UTF-8" </label>
data-remote="true" <span class="label label-info" id="upload-file-info"></span>
method="post" <input type="hidden" value="import-package-json" name="hidden" readonly="">
enctype="multipart/form-data" </p>
> </form>
{% csrf_token %} </div>
<p> <div class="modal-footer">
<label class="btn btn-primary" for="jsonFile"> <a id="import-package-modal-form-submit" class="btn btn-primary" href="#">Submit</a>
<input <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
id="jsonFile" </div>
name="file" </div>
type="file"
style="display:none;"
onchange="$('#upload-file-info').html(this.files[0].name)"
/>
Choose JSON File
</label>
<span class="label label-info" id="upload-file-info"></span>
<input
type="hidden"
value="import-package-json"
name="hidden"
readonly=""
/>
</p>
</form>
</div>
<div class="modal-footer">
<a
id="import-package-modal-form-submit"
class="btn btn-primary"
href="#"
>Submit</a
>
<button type="button" class="btn btn-default" data-dismiss="modal">
Cancel
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function () {
$("#import-package-modal-form-submit").on("click", function (e) { $('#import-package-modal-form-submit').on('click', function (e) {
e.preventDefault(); e.preventDefault();
$("#import-package-modal-form").submit(); $('#import-package-modal-form').submit();
});
}); });
});
</script> </script>

View File

@ -1,119 +1,78 @@
{% load static %} {% load static %}
<div <div class="modal fade bs-modal-lg" id="new_compound_modal" tabindex="-1" aria-labelledby="new_compound_modal" aria-modal="true"
class="modal fade bs-modal-lg" role="dialog">
id="new_compound_modal" <div class="modal-dialog modal-lg">
tabindex="-1" <div class="modal-content">
aria-labelledby="new_compound_modal" <div class="modal-header">
aria-modal="true" <button type="button" class="close" data-dismiss="modal" aria-label="Close">
role="dialog" <span aria-hidden="true">×</span>
> </button>
<div class="modal-dialog modal-lg"> <h4 class="modal-title">Create a new Compound</h4>
<div class="modal-content"> </div>
<div class="modal-header"> <div class="modal-body">
<button <form id="new_compound_modal_form" accept-charset="UTF-8" action="{% url 'package compound list' meta.current_package.uuid %}" data-remote="true" method="post">
type="button" {% csrf_token %}
class="close" <label for="compound-name">Name</label>
data-dismiss="modal" <input id="compound-name" class="form-control" name="compound-name" placeholder="Name"/>
aria-label="Close" <label for="compound-description">Description</label>
> <input id="compound-description" class="form-control" name="compound-description" placeholder="Description"/>
<span aria-hidden="true">×</span> <label for="compound-smiles">SMILES</label>
</button> <input type="text" class="form-control" name="compound-smiles" placeholder="SMILES" id="compound-smiles">
<h4 class="modal-title">Create a new Compound</h4> <p></p>
</div> <div>
<div class="modal-body"> <iframe id="new_compound_ketcher" src="{% static '/js/ketcher2/ketcher.html' %}" width="100%"
<form height="510"></iframe>
id="new_compound_modal_form" </div>
accept-charset="UTF-8" <p></p>
action="{% url 'package compound list' meta.current_package.uuid %}" </form>
data-remote="true" </div>
method="post" <div class="modal-footer">
> <button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close
{% csrf_token %} </button>
<label for="compound-name">Name</label> <button type="button" class="btn btn-primary" id="new_compound_modal_form_submit">Submit</button>
<input </div>
id="compound-name" </div>
class="form-control"
name="compound-name"
placeholder="Name"
/>
<label for="compound-description">Description</label>
<input
id="compound-description"
class="form-control"
name="compound-description"
placeholder="Description"
/>
<label for="compound-smiles">SMILES</label>
<input
type="text"
class="form-control"
name="compound-smiles"
placeholder="SMILES"
id="compound-smiles"
/>
<p></p>
<div>
<iframe
id="new_compound_ketcher"
src="{% static '/js/ketcher2/ketcher.html' %}"
width="100%"
height="510"
></iframe>
</div>
<p></p>
</form>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary pull-left"
data-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
id="new_compound_modal_form_submit"
>
Submit
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
function newCompoundModalketcherToNewCompoundModalTextInput() {
$("#compound-smiles").val(this.ketcher.getSmiles());
}
$(function () { function newCompoundModalketcherToNewCompoundModalTextInput() {
$("#new_compound_ketcher").on("load", function () { $('#compound-smiles').val(this.ketcher.getSmiles());
const checkKetcherReady = () => { }
win = this.contentWindow;
if (win.ketcher && "editor" in win.ketcher) {
win.ketcher.editor.event.change.handlers.push({
once: false,
priority: 0,
f: newCompoundModalketcherToNewCompoundModalTextInput,
ketcher: win.ketcher,
});
} else {
setTimeout(checkKetcherReady, 100);
}
};
checkKetcherReady(); $(function() {
$('#new_compound_ketcher').on('load', function() {
const checkKetcherReady = () => {
win = this.contentWindow
if (win.ketcher && 'editor' in win.ketcher) {
win.ketcher.editor.event.change.handlers.push({
once: false,
priority: 0,
f: newCompoundModalketcherToNewCompoundModalTextInput,
ketcher: win.ketcher
});
} else {
setTimeout(checkKetcherReady, 100);
}
};
checkKetcherReady();
})
$(function() {
$('#new_compound_modal_form_submit').on('click', function(e) {
e.preventDefault();
$(this).prop("disabled",true);
// submit form
$('#new_compound_modal_form').submit();
});
}); });
$(function () { });
$("#new_compound_modal_form_submit").on("click", function (e) {
e.preventDefault();
$(this).prop("disabled", true);
// submit form
$("#new_compound_modal_form").submit();
});
});
});
</script> </script>

View File

@ -1,70 +1,45 @@
<div <div class="modal fade" tabindex="-1" id="new_group_modal" role="dialog" aria-labelledby="new_group_modal"
class="modal fade" aria-hidden="true">
tabindex="-1" <div class="modal-dialog">
id="new_group_modal" <div class="modal-content">
role="dialog" <div class="modal-header">
aria-labelledby="new_group_modal" <button type="button" class="close" data-dismiss="modal">
aria-hidden="true" <span aria-hidden="true">&times;</span>
> <span class="sr-only">Close</span>
<div class="modal-dialog"> </button>
<div class="modal-content"> <h4 class="modal-title">New Group</h4>
<div class="modal-header"> </div>
<button type="button" class="close" data-dismiss="modal"> <div class="modal-body">
<span aria-hidden="true">&times;</span> <p>Create new Group. You can assign users to the group once
<span class="sr-only">Close</span> it is created. Description can be changed after creation.</p>
</button> <form id="new_group_modal_form" accept-charset="UTF-8" action="{{ SERVER_BASE }}/group"
<h4 class="modal-title">New Group</h4> data-remote="true"
</div> method="post">
<div class="modal-body"> {% csrf_token %}
<p> <p>
Create new Group. You can assign users to the group once it is <label for="name">Name</label>
created. Description can be changed after creation. <input id="name" type="text" name="group-name" class="form-control" placeholder="Name"/>
</p> </p>
<form <p>
id="new_group_modal_form" <label for="description">Description</label>
accept-charset="UTF-8" <input id="description" type="text" class="form-control" placeholder="Description..."
action="{{ SERVER_BASE }}/group" name="group-description"/>
data-remote="true" </p>
method="post" </form>
> </div>
{% csrf_token %} <div class="modal-footer">
<p> <a id="new_group_modal_form_submit" class="btn btn-primary" href="#">Submit</a>
<label for="name">Name</label> <button type="button" class="btn btn-default" data-dismiss="modal">
<input Cancel
id="name" </button>
type="text" </div>
name="group-name" </div>
class="form-control"
placeholder="Name"
/>
</p>
<p>
<label for="description">Description</label>
<input
id="description"
type="text"
class="form-control"
placeholder="Description..."
name="group-description"
/>
</p>
</form>
</div>
<div class="modal-footer">
<a id="new_group_modal_form_submit" class="btn btn-primary" href="#"
>Submit</a
>
<button type="button" class="btn btn-default" data-dismiss="modal">
Cancel
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#new_group_modal_form_submit").on("click", function () { $('#new_group_modal_form_submit').on('click', function() {
$("#new_group_modal_form").submit(); $('#new_group_modal_form').submit();
}); });
}); });
</script> </script>

View File

@ -1,270 +1,188 @@
<div
class="modal fade"
tabindex="-1"
id="new_model_modal"
role="dialog"
aria-labelledby="new_model_modal"
aria-hidden="true"
>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title">New Model</h4>
</div>
<div class="modal-body">
<form
id="new_model_form"
accept-charset="UTF-8"
action="{{ meta.current_package.url }}/model"
data-remote="true"
method="post"
>
{% csrf_token %}
<div class="jumbotron">
Create a new Model to limit the number of degradation products in
the prediction. You just need to set a name and the packages you
want the object to be based on. There are multiple types of models
available. For additional information have a look at our
<a
target="_blank"
href="https://wiki.envipath.org/index.php/relative-reasoning"
role="button"
>wiki &gt;&gt;</a
>
</div>
<!-- Name -->
<label for="model-name">Name</label>
<input
id="model-name"
name="model-name"
class="form-control"
placeholder="Name"
/>
<!-- Description --> <div class="modal fade" tabindex="-1" id="new_model_modal" role="dialog" aria-labelledby="new_model_modal"
<label for="model-description">Description</label> aria-hidden="true">
<input <div class="modal-dialog modal-lg">
id="model-description" <div class="modal-content">
name="model-description" <div class="modal-header">
class="form-control" <button type="button" class="close" data-dismiss="modal">
placeholder="Description" <span aria-hidden="true">&times;</span>
/> <span class="sr-only">Close</span>
</button>
<h4 class="modal-title">New Model</h4>
</div>
<div class="modal-body">
<form id="new_model_form" accept-charset="UTF-8" action="{{ meta.current_package.url }}/model"
data-remote="true" method="post">
{% csrf_token %}
<div class="jumbotron">Create a new Model to
limit the number of degradation products in the
prediction. You just need to set a name and the packages
you want the object to be based on. There are multiple types of models available.
For additional information have a look at our
<a target="_blank" href="https://wiki.envipath.org/index.php/relative-reasoning" role="button">wiki
&gt;&gt;</a>
</div>
<!-- Name -->
<label for="model-name">Name</label>
<input id="model-name" name="model-name" class="form-control" placeholder="Name"/>
<!-- Model Type --> <!-- Description -->
<label for="model-type">Model Type</label> <label for="model-description">Description</label>
<select <input id="model-description" name="model-description" class="form-control"
id="model-type" placeholder="Description"/>
name="model-type"
class="form-control"
data-width="100%"
>
<option disabled selected>Select Model Type</option>
{% for k, v in model_types.items %}
<option value="{{ v }}">{{ k }}</option>
{% endfor %}
</select>
<!-- Rule Packages --> <!-- Model Type -->
<div id="rule-packages" class="ep-model-param mlrr rbrr"> <label for="model-type">Model Type</label>
<label for="model-rule-packages">Rule Packages</label> <select id="model-type" name="model-type" class="form-control" data-width='100%'>
<select <option disabled selected>Select Model Type</option>
id="model-rule-packages" {% for k, v in model_types.items %}
name="model-rule-packages" <option value="{{ v }}">{{ k }}</option>
data-actions-box="true" {% endfor %}
class="form-control" </select>
multiple
data-width="100%"
>
<option disabled>Reviewed Packages</option>
{% for obj in meta.readable_packages %}
{% if obj.reviewed %}
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
{% endif %}
{% endfor %}
<option disabled>Unreviewed Packages</option> <!-- Rule Packages -->
{% for obj in meta.readable_packages %} <div id="rule-packages" class="ep-model-param mlrr rbrr">
{% if not obj.reviewed %} <label for="model-rule-packages">Rule Packages</label>
<option value="{{ obj.url }}">{{ obj.name|safe }}</option> <select id="model-rule-packages" name="model-rule-packages" data-actions-box='true'
{% endif %} class="form-control" multiple data-width='100%'>
{% endfor %} <option disabled>Reviewed Packages</option>
</select> {% for obj in meta.readable_packages %}
</div> {% if obj.reviewed %}
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
{% endif %}
{% endfor %}
<!-- Data Packages --> <option disabled>Unreviewed Packages</option>
<div id="data-packages" class="ep-model-param mlrr rbrr enviformer"> {% for obj in meta.readable_packages %}
<label for="model-data-packages">Data Packages</label> {% if not obj.reviewed %}
<select <option value="{{ obj.url }}">{{ obj.name|safe }}</option>
id="model-data-packages" {% endif %}
name="model-data-packages" {% endfor %}
data-actions-box="true" </select>
class="form-control" </div>
multiple
data-width="100%"
>
<option disabled>Reviewed Packages</option>
{% for obj in meta.readable_packages %}
{% if obj.reviewed %}
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
{% endif %}
{% endfor %}
<option disabled>Unreviewed Packages</option> <!-- Data Packages -->
{% for obj in meta.readable_packages %} <div id="data-packages" class="ep-model-param mlrr rbrr enviformer">
{% if not obj.reviewed %} <label for="model-data-packages">Data Packages</label>
<option value="{{ obj.url }}">{{ obj.name|safe }}</option> <select id="model-data-packages" name="model-data-packages" data-actions-box='true'
{% endif %} class="form-control" multiple data-width='100%'>
{% endfor %} <option disabled>Reviewed Packages</option>
</select> {% for obj in meta.readable_packages %}
</div> {% if obj.reviewed %}
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
{% endif %}
{% endfor %}
<!-- Fingerprinter --> <option disabled>Unreviewed Packages</option>
<div id="fingerprinter" class="ep-model-param mlrr"> {% for obj in meta.readable_packages %}
<label for="model-fingerprinter">Fingerprinter</label> {% if not obj.reviewed %}
<select <option value="{{ obj.url }}">{{ obj.name|safe }}</option>
id="model-fingerprinter" {% endif %}
name="model-fingerprinter" {% endfor %}
data-actions-box="true" </select>
class="form-control" </div>
multiple
data-width="100%"
>
<option value="MACCS" selected>MACCS Fingerprinter</option>
{% if meta.enabled_features.PLUGINS and additional_descriptors %}
<option disabled selected>
Select Additional Fingerprinter / Descriptor
</option>
{% for k, v in additional_descriptors.items %}
<option value="{{ v }}">{{ k }}</option>
{% endfor %}
{% endif %}
</select>
</div>
<!-- Threshold --> <!-- Fingerprinter -->
<div id="threshold" class="ep-model-param mlrr enviformer"> <div id="fingerprinter" class="ep-model-param mlrr">
<label for="model-threshold">Threshold</label> <label for="model-fingerprinter">Fingerprinter</label>
<input <select id="model-fingerprinter" name="model-fingerprinter" data-actions-box='true'
type="number" class="form-control" multiple data-width='100%'>
min="0" <option value="MACCS" selected>MACCS Fingerprinter</option>
max="1" {% if meta.enabled_features.PLUGINS and additional_descriptors %}
step="0.05" <option disabled selected>Select Additional Fingerprinter / Descriptor</option>
value="0.5" {% for k, v in additional_descriptors.items %}
id="model-threshold" <option value="{{ v }}">{{ k }}</option>
name="model-threshold" {% endfor %}
class="form-control" {% endif %}
/> </select>
</div> </div>
<div id="appdomain" class="ep-model-param mlrr"> <!-- Threshold -->
{% if meta.enabled_features.APPLICABILITY_DOMAIN %} <div id="threshold" class="ep-model-param mlrr enviformer">
<!-- Build AD? --> <label for="model-threshold">Threshold</label>
<div class="checkbox"> <input type="number" min="0" max="1" step="0.05" value="0.5" id="model-threshold"
<label> name="model-threshold" class="form-control">
<input </div>
type="checkbox"
id="build-app-domain" <div id="appdomain" class="ep-model-param mlrr">
name="build-app-domain" {% if meta.enabled_features.APPLICABILITY_DOMAIN %}
/>Also build an Applicability Domain? <!-- Build AD? -->
</label> <div class="checkbox">
</div> <label>
<div id="ad-params" style="display:none"> <input type="checkbox" id="build-app-domain" name="build-app-domain">Also build an
<!-- Num Neighbors --> Applicability Domain?
<label for="num-neighbors">Number of Neighbors</label> </label>
<input </div>
id="num-neighbors" <div id="ad-params" style="display:none">
name="num-neighbors" <!-- Num Neighbors -->
type="number" <label for="num-neighbors">Number of Neighbors</label>
class="form-control" <input id="num-neighbors" name="num-neighbors" type="number" class="form-control"
value="5" value="5"
step="1" step="1" min="0" max="10">
min="0" <!-- Local Compatibility -->
max="10" <label for="local-compatibility-threshold">Local Compatibility Threshold</label>
/> <input id="local-compatibility-threshold" name="local-compatibility-threshold"
<!-- Local Compatibility --> type="number"
<label for="local-compatibility-threshold" class="form-control" value="0.5" step="0.01" min="0" max="1">
>Local Compatibility Threshold</label <!-- Reliability -->
> <label for="reliability-threshold">Reliability Threshold</label>
<input <input id="reliability-threshold" name="reliability-threshold" type="number"
id="local-compatibility-threshold" class="form-control" value="0.5" step="0.01" min="0" max="1">
name="local-compatibility-threshold" </div>
type="number" {% endif %}
class="form-control" </div>
value="0.5" </form>
step="0.01" </div>
min="0" <div class="modal-footer">
max="1" <a id="new_model_modal_form_submit" class="btn btn-primary" href="#">Submit</a>
/> <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<!-- Reliability --> </div>
<label for="reliability-threshold">Reliability Threshold</label> </div>
<input
id="reliability-threshold"
name="reliability-threshold"
type="number"
class="form-control"
value="0.5"
step="0.01"
min="0"
max="1"
/>
</div>
{% endif %}
</div>
</form>
</div>
<div class="modal-footer">
<a id="new_model_modal_form_submit" class="btn btn-primary" href="#"
>Submit</a
>
<button type="button" class="btn btn-default" data-dismiss="modal">
Cancel
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function () {
// Built in Model Types // Built in Model Types
var nativeModelTypes = ["mlrr", "rbrr", "enviformer"]; var nativeModelTypes = [
"mlrr",
"rbrr",
"enviformer",
]
// Initially hide all "specific" forms
$(".ep-model-param").each(function () {
$(this).hide();
});
$('#model-type').selectpicker();
$("#model-fingerprinter").selectpicker();
$("#model-rule-packages").selectpicker();
$("#model-data-packages").selectpicker();
$("#build-app-domain").change(function () {
if ($(this).is(":checked")) {
$('#ad-params').show();
} else {
$('#ad-params').hide();
}
});
// On change hide all and show only selected
$("#model-type").change(function () {
$('.ep-model-param').hide();
var modelType = $('#model-type').val();
if (nativeModelTypes.indexOf(modelType) !== -1) {
$('.' + modelType).show();
} else {
// do nothing
}
});
$('#new_model_modal_form_submit').on('click', function (e) {
e.preventDefault();
$('#new_model_form').submit();
});
// Initially hide all "specific" forms
$(".ep-model-param").each(function () {
$(this).hide();
}); });
$("#model-type").selectpicker();
$("#model-fingerprinter").selectpicker();
$("#model-rule-packages").selectpicker();
$("#model-data-packages").selectpicker();
$("#build-app-domain").change(function () {
if ($(this).is(":checked")) {
$("#ad-params").show();
} else {
$("#ad-params").hide();
}
});
// On change hide all and show only selected
$("#model-type").change(function () {
$(".ep-model-param").hide();
var modelType = $("#model-type").val();
if (nativeModelTypes.indexOf(modelType) !== -1) {
$("." + modelType).show();
} else {
// do nothing
}
});
$("#new_model_modal_form_submit").on("click", function (e) {
e.preventDefault();
$("#new_model_form").submit();
});
});
</script> </script>

View File

@ -1,68 +1,62 @@
<div <div class="modal fade"
class="modal fade" tabindex="-1"
tabindex="-1" id="new_package_modal"
id="new_package_modal" role="dialog"
role="dialog" aria-labelledby="new_package_modal"
aria-labelledby="new_package_modal" aria-hidden="true">
aria-hidden="true" <div class="modal-dialog">
> <div class="modal-content">
<div class="modal-dialog"> <div class="modal-header">
<div class="modal-content"> <button type="button"
<div class="modal-header"> class="close"
<button type="button" class="close" data-dismiss="modal"> data-dismiss="modal">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span> <span class="sr-only">Close</span>
</button> </button>
<h4 class="modal-title">New Package</h4> <h4 class="modal-title">New Package</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>Create new package. Description can be changed later.</p> <p>Create new package. Description can be changed later.</p>
<form <form id="new_package_modal_form"
id="new_package_modal_form" accept-charset="UTF-8"
accept-charset="UTF-8" action=""
action="" data-remote="true"
data-remote="true" method="post">
method="post" {% csrf_token %}
> <p>
{% csrf_token %} <label for="name">Name</label>
<p> <input id="name" class="form-control"
<label for="name">Name</label> name="package-name"
<input placeholder="Name"/>
id="name" </p>
class="form-control" <p>
name="package-name" <label for="description">Description</label>
placeholder="Name" <input id="description"
/> type="text"
</p> rows="3"
<p> class="form-control"
<label for="description">Description</label> placeholder="Description..."
<input name="package-description"/>
id="description" </p>
type="text" </form>
rows="3" </div>
class="form-control" <div class="modal-footer">
placeholder="Description..." <a id="new_package_modal_form_submit"
name="package-description" class="btn btn-primary"
/> href="#">Submit</a>
</p> <button type="button"
</form> class="btn btn-default"
</div> data-dismiss="modal">Cancel
<div class="modal-footer"> </button>
<a id="new_package_modal_form_submit" class="btn btn-primary" href="#" </div>
>Submit</a </div>
>
<button type="button" class="btn btn-default" data-dismiss="modal">
Cancel
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#new_package_modal_form_submit").on("click", function (e) { $('#new_package_modal_form_submit').on('click', function (e) {
e.preventDefault(); e.preventDefault();
$("#new_package_modal_form").submit(); $('#new_package_modal_form').submit();
}); });
}); });
</script> </script>

View File

@ -1,376 +1,302 @@
{% load static %} {% load static %}
<div <div class="modal fade" tabindex="-1" id="new_pathway_modal" role="dialog" aria-labelledby="new_pathway_modal"
class="modal fade" aria-hidden="true" style="overflow-y: auto;">
tabindex="-1" <!-- FIXME: make width dynamic-->
id="new_pathway_modal" <div class="modal-dialog" id="new_pathway_modal_dialog" style="width:900px">
role="dialog" <div class="modal-content">
aria-labelledby="new_pathway_modal" <div class="modal-header">
aria-hidden="true" <button type="button" class="close" data-dismiss="modal">
style="overflow-y: auto;" <span aria-hidden="true">&times;</span> <span class="sr-only">Close</span>
> </button>
<!-- FIXME: make width dynamic--> <h4 class="js-title-step"></h4>
<div class="modal-dialog" id="new_pathway_modal_dialog" style="width:900px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="js-title-step"></h4>
</div>
<div class="modal-body hide" data-step="1" data-title="New Pathway">
<div class="jumbotron">
Create a new pathway by entering the root compound and a name. Then
select if you want to use the prediction engine to generate a
predicted pathway or create an empty pathway that you fill in by
yourself. If you choose to predict a pathway, you can modify the
settings for the prediction, or use the default settings and just
click Submit.
</div>
<div class="modal-body">
{% if current_user.name == 'anonymous' %}
<div class="alert alert-warning">
You are currently logged in as Anonymous. Please note: Pathways
entered or predicted as anonymous user will be deleted after 30
days. Please log in to save your results.
</div> </div>
{% endif %} <div class="modal-body hide" data-step="1" data-title="New Pathway">
</div> <div class="jumbotron">Create a new pathway by entering
<div class="row"> the root compound and a name. Then select if you want to
<div class="col-md-6"> use the prediction engine to generate a predicted pathway or
<label for="name">Name</label> create an empty pathway that you fill in by yourself. If
<input you choose to predict a pathway, you can modify the
id="name" settings for the prediction, or use the default settings
class="form-control" and just click Submit.
name="name" </div>
placeholder="Name" <div class="modal-body">
/> {% if current_user.name == 'anonymous' %}
<label for="description">Description</label> <div class="alert alert-warning">
<input You are currently logged in as Anonymous. Please note:
id="description" Pathways entered or predicted as anonymous user will be deleted after 30 days.
class="form-control" Please log in to save your results.
name="description" </div>
placeholder="no description" {% endif %}
/> </div>
</div> <div class="row">
<div class="col-md-6">
<label for="name">Name</label>
<input id="name" class="form-control" name="name" placeholder="Name"/>
<label for="description">Description</label>
<input id="description" class="form-control" name="description" placeholder="no description"/>
</div>
<div class="col-md-6"> <div class="col-md-6">
<label for="predict">Predict pathway or build yourself?</label> <label for="predict">Predict pathway or build yourself?</label>
<div class="radio" id="predict"> <div class="radio" id="predict">
<p> <p>
<label> <label>
<input <input type="radio" name="predict" id="radioPredict" value="predict" checked/>Predict pathway
type="radio" </label>
name="predict" </p>
id="radioPredict" <p>
value="predict" <label>
checked <input type="radio" name="predict" id="radioIncremental"value="incremental"/>Incremental prediction
/>Predict pathway </label>
</label> </p>
</p> <p>
<p> <label>
<label> <input type="radio" name="predict" id="radioBuild" value="build"/>Build pathway
<input </label>
type="radio" </p>
name="predict" </div>
id="radioIncremental" </div>
value="incremental" </div>
/>Incremental prediction <label for="smilesinput">SMILES</label>
</label> <table style="width: 100%">
</p> <colgroup>
<p> <col span="1" style="width: 90%;">
<label> <col span="1" style="width: 10%;">
<input </colgroup>
type="radio" <tr>
name="predict" <td>
id="radioBuild" <input id="smilesinput" class="form-control" name="smilesinput" placeholder="C1CCCCC1"
value="build" autocapitalize="none"/>
/>Build pathway </td>
</label> <td>
</p> <button type="button" class="btn btn-default" id="render-button">
Render
</button>
</td>
</tr>
</table>
<p id="ketcher_container"></p>
<div>
<iframe id="ifKetcher" src="{% static '/js/ketcher/ketcher.html' %}" width="850"
height="510"></iframe>
</div>
</div> </div>
</div> <div class="modal-body hide" data-step="2" data-title="New Pathway - Advanced Settings">
</div> <div class="jumbotron">Choose if you want to use an existing
<label for="smilesinput">SMILES</label> setting, or create a new one for this pathway
<table style="width: 100%"> prediction. Then click Submit to use the specified setting,
<colgroup> or click next to set the parameters.
<col span="1" style="width: 90%;" /> </div>
<col span="1" style="width: 10%;" /> <div id="settings">
</colgroup> <div class="radio" id="settingRadio">
<tr> <p>
<td> <label>
<input <input type="radio" name="existing" id="radioDefault" value="exisiting" checked/>
id="smilesinput" Use Default
class="form-control" </label>
name="smilesinput" </p>
placeholder="C1CCCCC1" <p>
autocapitalize="none" <label>
/> <input type="radio" name="existing" id="radioExists" value="exisiting"/>
</td> Select Existing
<td> </label>
<button type="button" class="btn btn-default" id="render-button"> </p>
Render <p>
</button> <label>
</td> <input type="radio" name="existing" id="radioNew" value="temporary"/>
</tr> Create New
</table> </label>
<p id="ketcher_container"></p> </p>
<div> </div>
<iframe
id="ifKetcher"
src="{% static '/js/ketcher/ketcher.html' %}"
width="850"
height="510"
></iframe>
</div>
</div>
<div
class="modal-body hide"
data-step="2"
data-title="New Pathway - Advanced Settings"
>
<div class="jumbotron">
Choose if you want to use an existing setting, or create a new one for
this pathway prediction. Then click Submit to use the specified
setting, or click next to set the parameters.
</div>
<div id="settings">
<div class="radio" id="settingRadio">
<p>
<label>
<input
type="radio"
name="existing"
id="radioDefault"
value="exisiting"
checked
/>
Use Default
</label>
</p>
<p>
<label>
<input
type="radio"
name="existing"
id="radioExists"
value="exisiting"
/>
Select Existing
</label>
</p>
<p>
<label>
<input
type="radio"
name="existing"
id="radioNew"
value="temporary"
/>
Create New
</label>
</p>
</div>
<select id="settingSelect" name="settingSelect" class="form-control"> <select id="settingSelect" name="settingSelect" class="form-control">
{% for setting in available_settings %} {% for setting in available_settings %}
<option value="{{ setting.id }}">{{ setting.name|safe }}</option> <option value="{{ setting.id }}">{{ setting.name|safe }}</option>
{% endfor %} {% endfor %}
</select> </select>
<p></p> <p></p>
</div>
</div>
{% with step_offset=1 %}
{% include "templates/modals/collections/new_setting_modal_body.html" %}
{% endwith %}
<div class="modal-footer">
<button type="button" class="btn btn-default js-btn-step pull-left" data-orientation="cancel"
onclick="reset()" data-dismiss="modal"></button>
<button type="button" class="btn btn-default js-btn-step" data-orientation="previous"
id="backbutton"></button>
<button type="button" class="btn btn-default js-btn-step" data-orientation="next"
id="nextbutton"></button>
<a id="modal-form-submit" class="btn btn-primary" href="#">Submit</a>
</div>
</div> </div>
</div>
{% with step_offset=1 %}
{% include "templates/modals/collections/new_setting_modal_body.html" %}
{% endwith %}
<div class="modal-footer">
<button
type="button"
class="btn btn-default js-btn-step pull-left"
data-orientation="cancel"
onclick="reset()"
data-dismiss="modal"
></button>
<button
type="button"
class="btn btn-default js-btn-step"
data-orientation="previous"
id="backbutton"
></button>
<button
type="button"
class="btn btn-default js-btn-step"
data-orientation="next"
id="nextbutton"
></button>
<a id="modal-form-submit" class="btn btn-primary" href="#">Submit</a>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
s = new Setting( s = new Setting(
"settingName", 'settingName',
"package_multi_select", 'package_multi_select',
"modelSelect", 'modelSelect',
"cutoff", 'cutoff',
"evalType", 'evalType',
"availableTS", 'availableTS',
"forms", 'forms',
"truncatorTable", 'truncatorTable',
"summaryTable", 'summaryTable',
); );
$(function () { $(function() {
// hide all forms // hide all forms
$("#forms").children().hide(); $('#forms').children().hide()
$("#render-button").on("click", function () { $("#render-button").on("click", function() {
syncKetcherAndTextInput("text", "ifKetcher", "smilesinput"); syncKetcherAndTextInput('text', "ifKetcher", "smilesinput");
}); });
// If theres a change in the in '#smilesinput' sync the value to ketcher // If theres a change in the in '#smilesinput' sync the value to ketcher
$("#smilesinput").on("input", function () { $('#smilesinput').on('input', function() {
syncKetcherAndTextInput("text", "ifKetcher", "smilesinput"); syncKetcherAndTextInput('text', 'ifKetcher', 'smilesinput');
}); });
// If theres an update in ketcher sync it to textinput // If theres an update in ketcher sync it to textinput
setInterval(function () { setInterval(function() {
syncKetcherAndTextInput("ketcher", "ifKetcher", "smilesinput"); syncKetcherAndTextInput('ketcher', 'ifKetcher', 'smilesinput');
}, 250); }, 250);
$("#smilesinput").on("blur", function () { $("#smilesinput").on("blur", function() {
syncKetcherAndTextInput("text", "ifKetcher", "smilesinput"); syncKetcherAndTextInput('text', 'ifKetcher', 'smilesinput');
}); });
$("#smilesinput").on("keypress", function (event) { $("#smilesinput").on("keypress", function(event) {
if (event.keyCode == 13) { if (event.keyCode == 13) {
syncKetcherAndTextInput("text", "ifKetcher", "smilesinput"); syncKetcherAndTextInput('text', 'ifKetcher', 'smilesinput');
} }
}); });
// Show forms depending on the selected TS // Show forms depending on the selected TS
$("#availableTS").on("change", function (e) { $('#availableTS').on('change', function(e) {
e.preventDefault(); e.preventDefault();
var type = $(this).val(); var type = $(this).val();
// hide current content // hide current content
$("#forms").children().hide(); $('#forms').children().hide()
if (type === "") { if(type === '') {
return; return;
} }
$("#" + type + "_form").show(); $('#' + type + '_form').show()
}); });
$("#modelSelect").on("change", function () { $("#modelSelect").on("change", function() {
setCutoff = function (thresh) { setCutoff = function (thresh) {
$("#cutoff").val(thresh); $("#cutoff").val(thresh);
}; }
var modelUri = $("#modelSelect :selected").val(); var modelUri = $("#modelSelect :selected").val();
fillPRCurve(modelUri, setCutoff); fillPRCurve(modelUri, setCutoff);
}); });
// Add a TS to the setting // Add a TS to the setting
$("#add-ts-button").on("click", function (e) { $('#add-ts-button').on('click', function(e) {
e.preventDefault(); e.preventDefault();
s.addTruncator(); s.addTruncator();
}); });
$("input[type=radio][name=predict]").change(function () { $('input[type=radio][name=predict]').change(function() {
if (this.id == "radioBuild") { if (this.id == 'radioBuild') {
$("#nextbutton").prop("disabled", true); $("#nextbutton").prop("disabled", true);
} else {
$("#nextbutton").prop("disabled", false);
}
});
$("input[type=radio][name=existing]").change(function () {
if (this.id == "radioDefault" || this.id == "radioExists") {
if (this.id == "radioDefault") {
$("#settingSelect").prop("disabled", true);
} else { } else {
$("#settingSelect").prop("disabled", false); $("#nextbutton").prop("disabled", false);
} }
$("#nextbutton").prop("disabled", true);
} else {
// build...
$("#settingSelect").prop("disabled", true);
$("#nextbutton").prop("disabled", false);
}
}); });
var pwStep1 = function () { $('input[type=radio][name=existing]').change(function() {
console.log("pw step 1"); if (this.id == 'radioDefault' || this.id == 'radioExists') {
// Make "Next" to "Advanced" if(this.id == 'radioDefault') {
$("#nextbutton").val("Advanced"); $("#settingSelect").prop("disabled", true);
}; } else {
$("#settingSelect").prop("disabled", false);
}
$("#nextbutton").prop("disabled", true);
} else {
// build...
$("#settingSelect").prop("disabled", true);
$("#nextbutton").prop("disabled", false);
}
});
var pwStep2 = function () { var pwStep1 = function() {
console.log("pw step 2"); console.log("pw step 1");
// Make "Advanced" to "Next" // Make "Next" to "Advanced"
$("#nextbutton").val("Next"); $('#nextbutton').val("Advanced");
// As "Use default is preselected" disable "Next" button
$("#nextbutton").prop("disabled", true);
// Disable setting dropdown as long as the correspndonding radio isnt checked
$("#settingSelect").prop("disabled", true);
// Show submit button
$("#modal-form-submit").show();
};
var settingStep1 = function () {
// First step sets name and packages
s.extractName();
s.extractSelectedPackages();
};
var settingStep2 = function () {
// Seconds step gathers relative reasoning params
s.extractRelativeReasoning();
s.extractCutoff();
s.extractEvaluationType();
};
var settingStep3 = function () {
s.updateTable();
s.updateSummaryTable();
// hide duplicate submit...
$("#nextbutton").hide();
};
var postPathway = function () {
console.log("Complete!");
console.log(s.tsParams);
console.log("Getting SMILES");
};
function dummy() {
console.log("dummy");
} }
$("#new_pathway_modal").modalSteps({ var pwStep2 = function() {
btnCancelHtml: "Cancel", console.log("pw step 2");
btnPreviousHtml: "Back", // Make "Advanced" to "Next"
btnNextHtml: "Next", $('#nextbutton').val("Next");
btnLastStepHtml: "Submit", // As "Use default is preselected" disable "Next" button
$("#nextbutton").prop("disabled",true);
// Disable setting dropdown as long as the correspndonding radio isnt checked
$("#settingSelect").prop("disabled",true);
// Show submit button
$("#modal-form-submit").show();
}
var settingStep1 = function (){
// First step sets name and packages
s.extractName();
s.extractSelectedPackages();
}
var settingStep2 = function (){
// Seconds step gathers relative reasoning params
s.extractRelativeReasoning();
s.extractCutoff();
s.extractEvaluationType();
}
var settingStep3 = function() {
s.updateTable();
s.updateSummaryTable();
// hide duplicate submit...
$("#nextbutton").hide();
}
var postPathway = function(){
console.log("Complete!");
console.log(s.tsParams);
console.log("Getting SMILES");
}
function dummy() {
console.log("dummy");
}
$('#new_pathway_modal').modalSteps({
btnCancelHtml: 'Cancel',
btnPreviousHtml: 'Back',
btnNextHtml: 'Next',
btnLastStepHtml: 'Submit',
disableNextButton: false, disableNextButton: false,
completeCallback: postPathway, completeCallback: postPathway,
callbacks: { callbacks: {
1: pwStep1, '1': pwStep1,
2: pwStep2, '2' : pwStep2,
3: dummy, '3' : dummy,
4: settingStep1, '4' : settingStep1,
5: settingStep2, '5' : settingStep2,
6: settingStep3, '6' : settingStep3,
}, }
}); });
$("#modal-form-submit").on("click", function () { $('#modal-form-submit').on('click', function() {
e.preventDefault(); e.preventDefault();
postPathway(); postPathway();
}); });
}); });
</script> </script>

View File

@ -1,185 +1,109 @@
{% load static %} {% load static %}
<div id="new_prediction_setting_modal" class="modal" tabindex="-1"> <div id="new_prediction_setting_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Create a Prediction Setting</h5> <h5 class="modal-title">Create a Prediction Setting</h5>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> <p>To create a Prediction Setting fill the form below and click "Create"</p>
<span aria-hidden="true">&times;</span> <form id="new-prediction-setting-modal-form" accept-charset="UTF-8" action="" data-remote="true"
</button> method="post">
</div> {% csrf_token %}
<div class="modal-body">
<p>
To create a Prediction Setting fill the form below and click "Create"
</p>
<form
id="new-prediction-setting-modal-form"
accept-charset="UTF-8"
action=""
data-remote="true"
method="post"
>
{% csrf_token %}
<label for="prediction-setting-name">Name</label> <label for="prediction-setting-name">Name</label>
<input <input id="prediction-setting-name" name="prediction-setting-name" class="form-control" placeholder="Name"/>
id="prediction-setting-name" <label for="prediction-setting-description">Description</label>
name="prediction-setting-name" <input id="prediction-setting-description" name="prediction-setting-description" class="form-control"
class="form-control" placeholder="Description"/>
placeholder="Name"
/>
<label for="prediction-setting-description">Description</label>
<input
id="prediction-setting-description"
name="prediction-setting-description"
class="form-control"
placeholder="Description"
/>
<label for="prediction-setting-max-nodes">Max #Nodes</label> <label for="prediction-setting-max-nodes">Max #Nodes</label>
<input <input id="prediction-setting-max-nodes" type="number" class="form-control" name="prediction-setting-max-nodes" value="30" min="1" max="50" step="1">
id="prediction-setting-max-nodes" <label for="prediction-setting-max-depth">Max Depth</label>
type="number" <input id="prediction-setting-max-depth" type="number" class="form-control" name="prediction-setting-max-depth" value="5" min="1" max="8" step="1">
class="form-control"
name="prediction-setting-max-nodes"
value="30"
min="1"
max="50"
step="1"
/>
<label for="prediction-setting-max-depth">Max Depth</label>
<input
id="prediction-setting-max-depth"
type="number"
class="form-control"
name="prediction-setting-max-depth"
value="5"
min="1"
max="8"
step="1"
/>
<label for="tp-generation-method">TP Generation Method</label> <label for="tp-generation-method">TP Generation Method</label>
<select <select id="tp-generation-method" name="tp-generation-method" class="form-control" data-width='100%'>
id="tp-generation-method" <option disabled selected>Select how TPs are generated</option>
name="tp-generation-method" <option value="rule-based-prediction-setting">Rule Based</option>
class="form-control" <option value="model-based-prediction-setting">Model Based</option>
data-width="100%" </select>
> <div id="rule-based-prediction-setting-specific-form">
<option disabled selected>Select how TPs are generated</option> <!-- Rule Packages -->
<option value="rule-based-prediction-setting">Rule Based</option> <label>Rule Packages</label><br>
<option value="model-based-prediction-setting">Model Based</option> <select id="rule-based-prediction-setting-packages" name="rule-based-prediction-setting-packages"
</select> data-actions-box='true' class="form-control" multiple data-width='100%'>
<div id="rule-based-prediction-setting-specific-form"> <option disabled>Reviewed Packages</option>
<!-- Rule Packages --> {% for obj in meta.readable_packages %}
<label>Rule Packages</label><br /> {% if obj.reviewed %}
<select <option value="{{ obj.url }}">{{ obj.name|safe }}</option>
id="rule-based-prediction-setting-packages" {% endif %}
name="rule-based-prediction-setting-packages" {% endfor %}
data-actions-box="true"
class="form-control"
multiple
data-width="100%"
>
<option disabled>Reviewed Packages</option>
{% for obj in meta.readable_packages %}
{% if obj.reviewed %}
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
{% endif %}
{% endfor %}
<option disabled>Unreviewed Packages</option> <option disabled>Unreviewed Packages</option>
{% for obj in meta.readable_packages %} {% for obj in meta.readable_packages %}
{% if not obj.reviewed %} {% if not obj.reviewed %}
<option value="{{ obj.url }}">{{ obj.name|safe }}</option> <option value="{{ obj.url }}">{{ obj.name|safe }}</option>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
<div id="model-based-prediction-setting-specific-form"> <div id="model-based-prediction-setting-specific-form">
<label>Select Model</label><br /> <label>Select Model</label><br>
<select <select id="model-based-prediction-setting-model" name="model-based-prediction-setting-model" class="form-control" data-width='100%'>
id="model-based-prediction-setting-model" <option disabled selected>Select the model</option>
name="model-based-prediction-setting-model" {% for m in models %}
class="form-control" <option value="{{ m.url }}">{{ m.name|safe }}</option>
data-width="100%" {% endfor %}
> </select>
<option disabled selected>Select the model</option> <label for="model-based-prediction-setting-threshold">Threshold</label>
{% for m in models %} <input id="model-based-prediction-setting-threshold" name="model-based-prediction-setting-threshold" class="form-control" placeholder="0.25" type="number"/>
<option value="{{ m.url }}">{{ m.name|safe }}</option> </div>
{% endfor %}
</select>
<label for="model-based-prediction-setting-threshold"
>Threshold</label
>
<input
id="model-based-prediction-setting-threshold"
name="model-based-prediction-setting-threshold"
class="form-control"
placeholder="0.25"
type="number"
/>
</div>
<input <input class="form-check-input" type="checkbox" value="on" id="prediction-setting-new-default" name="prediction-setting-new-default">
class="form-check-input" <label class="form-check-label" for="prediction-setting-new-default">Set this setting as new default</label>
type="checkbox"
value="on" </form>
id="prediction-setting-new-default" </div>
name="prediction-setting-new-default" <div class="modal-footer">
/> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<label class="form-check-label" for="prediction-setting-new-default" <button type="button" class="btn btn-primary" id="new-prediction-setting-modal-submit">Create</button>
>Set this setting as new default</label </div>
> </div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="new-prediction-setting-modal-submit"
>
Create
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
// Initially hide all "specific" forms
$("div[id$='-specific-form']").each(function () {
$(this).hide();
});
$("#rule-based-prediction-setting-packages").selectpicker(); // Initially hide all "specific" forms
$("div[id$='-specific-form']").each( function() {
$(this).hide();
});
// On change hide all and show only selected $("#rule-based-prediction-setting-packages").selectpicker();
$("#tp-generation-method").change(function () {
$("div[id$='-specific-form']").each(function () {
$(this).hide();
});
val = $("option:selected", this).val();
$("#" + val + "-specific-form").show();
});
$("#new-prediction-setting-modal-submit").click(function (e) { // On change hide all and show only selected
e.preventDefault(); $("#tp-generation-method").change(function() {
// $('#new-prediction-setting-modal-form').submit(); $("div[id$='-specific-form']").each( function() {
$(this).hide();
});
val = $('option:selected', this).val();
$("#" + val + "-specific-form").show();
});
const formData = $("#new-prediction-setting-modal-form").serialize(); $('#new-prediction-setting-modal-submit').click(function(e){
$.post("/setting", formData, function (response) { e.preventDefault();
location.reload(); // $('#new-prediction-setting-modal-form').submit();
});
}); const formData = $('#new-prediction-setting-modal-form').serialize();
}); $.post('/setting', formData, function(response) {
location.reload();
});
});
})
</script> </script>

View File

@ -1,91 +1,50 @@
{% load static %} {% load static %}
<div <div class="modal fade bs-modal-lg" id="new_reaction_modal" tabindex="-1" aria-labelledby="new_reaction_modal" aria-modal="true"
class="modal fade bs-modal-lg" role="dialog">
id="new_reaction_modal" <div class="modal-dialog modal-lg">
tabindex="-1" <div class="modal-content">
aria-labelledby="new_reaction_modal" <div class="modal-header">
aria-modal="true" <button type="button" class="close" data-dismiss="modal" aria-label="Close">
role="dialog" <span aria-hidden="true">×</span>
> </button>
<div class="modal-dialog modal-lg"> <h4 class="modal-title">Create a new Reaction</h4>
<div class="modal-content"> </div>
<div class="modal-header"> <div class="modal-body">
<button <form id="new_reaction_modal_form" accept-charset="UTF-8" action="{% url 'package reaction list' meta.current_package.uuid %}" data-remote="true" method="post">
type="button" {% csrf_token %}
class="close" <label for="reaction-name">Name</label>
data-dismiss="modal" <input id="reaction-name" class="form-control" name="reaction-name" placeholder="Name"/>
aria-label="Close" <label for="reaction-description">Description</label>
> <input id="reaction-description" class="form-control" name="reaction-description" placeholder="Description"/>
<span aria-hidden="true">×</span> <p></p>
</button> <div>
<h4 class="modal-title">Create a new Reaction</h4> <iframe id="new_reaction_ketcher" src="{% static '/js/ketcher2/ketcher.html' %}" width="100%"
</div> height="510"></iframe>
<div class="modal-body"> </div>
<form <input type="hidden" name="reaction-smirks" id="reaction-smirks">
id="new_reaction_modal_form" <p></p>
accept-charset="UTF-8" </form>
action="{% url 'package reaction list' meta.current_package.uuid %}" </div>
data-remote="true" <div class="modal-footer">
method="post" <button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close
> </button>
{% csrf_token %} <button type="button" class="btn btn-primary" id="new_reaction_modal_form_submit">Submit</button>
<label for="reaction-name">Name</label> </div>
<input </div>
id="reaction-name"
class="form-control"
name="reaction-name"
placeholder="Name"
/>
<label for="reaction-description">Description</label>
<input
id="reaction-description"
class="form-control"
name="reaction-description"
placeholder="Description"
/>
<p></p>
<div>
<iframe
id="new_reaction_ketcher"
src="{% static '/js/ketcher2/ketcher.html' %}"
width="100%"
height="510"
></iframe>
</div>
<input type="hidden" name="reaction-smirks" id="reaction-smirks" />
<p></p>
</form>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary pull-left"
data-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
id="new_reaction_modal_form_submit"
>
Submit
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#new_reaction_modal_form_submit").on("click", function (e) { $('#new_reaction_modal_form_submit').on('click', function(e) {
e.preventDefault(); e.preventDefault();
$(this).prop("disabled", true); $(this).prop("disabled",true);
k = getKetcher("new_reaction_ketcher"); k = getKetcher('new_reaction_ketcher');
$("#reaction-smirks").val(k.getSmiles()); $('#reaction-smirks').val(k.getSmiles());
// submit form // submit form
$("#new_reaction_modal_form").submit(); $('#new_reaction_modal_form').submit();
}); });
}); });
</script> </script>

View File

@ -1,120 +1,72 @@
{% load static %} {% load static %}
<div <div class="modal fade bs-modal-lg" id="new_rule_modal" tabindex="-1" aria-labelledby="new_rule_modal" aria-modal="true"
class="modal fade bs-modal-lg" role="dialog">
id="new_rule_modal" <div class="modal-dialog modal-lg">
tabindex="-1" <div class="modal-content">
aria-labelledby="new_rule_modal" <div class="modal-header">
aria-modal="true" <button type="button" class="close" data-dismiss="modal" aria-label="Close">
role="dialog" <span aria-hidden="true">×</span>
> </button>
<div class="modal-dialog modal-lg"> <h4 class="modal-title">Create a new Rule</h4>
<div class="modal-content"> </div>
<div class="modal-header"> <div class="modal-body">
<button <form id="new_rule_modal_form" accept-charset="UTF-8" action="{% url 'package rule list' meta.current_package.uuid %}" data-remote="true" method="post">
type="button" {% csrf_token %}
class="close" <label for="rule-name">Name</label>
data-dismiss="modal" <input id="rule-name" class="form-control" name="rule-name" placeholder="Name"/>
aria-label="Close" <label for="rule-description">Description</label>
> <input id="rule-description" class="form-control" name="rule-description" placeholder="Description"/>
<span aria-hidden="true">×</span> <label for="rule-smirks">SMIRKS</label>
</button> <input id="rule-smirks" class="form-control" name="rule-smirks" placeholder="SMIRKS"/>
<h4 class="modal-title">Create a new Rule</h4> <p></p>
</div> <div id="rule-smirks-viz"></div>
<div class="modal-body"> <input type="hidden" name="rule-type" id="rule-type" value="SimpleAmbitRule">
<form <p></p>
id="new_rule_modal_form" </form>
accept-charset="UTF-8" </div>
action="{% url 'package rule list' meta.current_package.uuid %}" <div class="modal-footer">
data-remote="true" <button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close
method="post" </button>
> <button type="button" class="btn btn-primary" id="new_rule_modal_form_submit">Submit</button>
{% csrf_token %} </div>
<label for="rule-name">Name</label> </div>
<input
id="rule-name"
class="form-control"
name="rule-name"
placeholder="Name"
/>
<label for="rule-description">Description</label>
<input
id="rule-description"
class="form-control"
name="rule-description"
placeholder="Description"
/>
<label for="rule-smirks">SMIRKS</label>
<input
id="rule-smirks"
class="form-control"
name="rule-smirks"
placeholder="SMIRKS"
/>
<p></p>
<div id="rule-smirks-viz"></div>
<input
type="hidden"
name="rule-type"
id="rule-type"
value="SimpleAmbitRule"
/>
<p></p>
</form>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary pull-left"
data-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
id="new_rule_modal_form_submit"
>
Submit
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#rule-smirks").on("input", function (e) {
$("#rule-smirks-viz").empty();
smirks = $("#rule-smirks").val(); $('#rule-smirks').on('input', function(e) {
$('#rule-smirks-viz').empty()
const img = new Image(); smirks = $('#rule-smirks').val()
img.src =
"{% url 'depict' %}?is_query_smirks=true&smirks=" +
encodeURIComponent(smirks);
img.style.width = "100%";
img.style.height = "100%";
img.style.objectFit = "cover";
img.onload = function () { const img = new Image();
$("#rule-smirks-viz").append(img); img.src = "{% url 'depict' %}?is_query_smirks=true&smirks=" + encodeURIComponent(smirks);
}; img.style.width = '100%';
img.style.height = '100%';
img.style.objectFit = 'cover';
img.onerror = function () { img.onload = function () {
error_tpl = ` $('#rule-smirks-viz').append(img);
};
img.onerror = function () {
error_tpl = `
<div class="alert alert-error" role="alert"> <div class="alert alert-error" role="alert">
<h4 class="alert-heading">Could not render SMIRKS!</h4> <h4 class="alert-heading">Could not render SMIRKS!</h4>
<p>Could not render SMIRKS - Have you entered a valid SMIRKS?</a> <p>Could not render SMIRKS - Have you entered a valid SMIRKS?</a>
</p> </p>
</div>`; </div>`
$("#rule-smirks-viz").append(error_tpl); $('#rule-smirks-viz').append(error_tpl);
}; };
}); });
$("#new_rule_modal_form_submit").on("click", function (e) { $('#new_rule_modal_form_submit').on('click', function(e) {
e.preventDefault(); e.preventDefault();
$(this).prop("disabled", true); $(this).prop("disabled",true);
// submit form // submit form
$("#new_rule_modal_form").submit(); $('#new_rule_modal_form').submit();
}); });
}); });
</script> </script>

View File

@ -1,153 +1,102 @@
<div <div class="modal fade" tabindex="-1" id="new_scenario_modal" role="dialog" aria-labelledby="new_scenario_modal"
class="modal fade" aria-hidden="true">
tabindex="-1" <div class="modal-dialog modal-lg">
id="new_scenario_modal" <div class="modal-content">
role="dialog" <div class="modal-header">
aria-labelledby="new_scenario_modal" <button type="button" class="close" data-dismiss="modal">
aria-hidden="true" <span aria-hidden="true">&times;</span>
> <span class="sr-only">Close</span>
<div class="modal-dialog modal-lg"> </button>
<div class="modal-content"> <h4 class="modal-title">New Scenario</h4>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title">New Scenario</h4>
</div>
<div class="modal-body">
<form
id="new_scenario_form"
accept-charset="UTF-8"
action="{{ meta.current_package.url }}/scenario"
data-remote="true"
method="post"
>
{% csrf_token %}
<div class="jumbotron">
Please enter name, description, and date of scenario. Date should be
associated to the data, not the current date. For example, this
could reflect the publishing date of a study. You can leave all
fields but the name empty and fill them in later.
<a
target="_blank"
href="https://wiki.envipath.org/index.php/scenario"
role="button"
>wiki &gt;&gt;</a
>
</div>
<label for="scenario-name">Name</label>
<input
id="scenario-name"
name="scenario-name"
class="form-control"
placeholder="Name"
/>
<label for="scenario-description">Description</label>
<input
id="scenario-description"
name="scenario-description"
class="form-control"
placeholder="Description"
/>
<label id="dateField" for="dateYear">Date</label>
<table>
<tr>
<th>
<input
type="number"
id="dateYear"
name="scenario-date-year"
class="form-control"
placeholder="YYYY"
max="{% now "Y" %}"
/>
</th>
<th>
<input
type="number"
id="dateMonth"
name="scenario-date-month"
min="1"
max="12"
class="form-control"
placeholder="MM"
/>
</th>
<th>
<input
type="number"
id="dateDay"
name="scenario-date-day"
min="1"
max="31"
class="form-control"
placeholder="DD"
/>
</th>
</tr>
</table>
<label for="scenario-type">Scenario Type</label>
<select
id="scenario-type"
name="scenario-type"
class="form-control"
data-width="100%"
>
<option value="empty" selected>Empty Scenario</option>
{% for k, v in scenario_types.items %}
<option value="{{ v.name }}">{{ k }}</option>
{% endfor %}
</select>
{% for type in scenario_types.values %}
<div id="{{ type.name }}-specific-inputs">
{% for widget in type.widgets %}
{{ widget|safe }}
{% endfor %}
</div> </div>
{% endfor %} <div class="modal-body">
</form> <form id="new_scenario_form" accept-charset="UTF-8" action="{{ meta.current_package.url }}/scenario"
</div> data-remote="true" method="post">
<div class="modal-footer"> {% csrf_token %}
<a id="new_scenario_modal_form_submit" class="btn btn-primary" href="#" <div class="jumbotron">Please enter name, description, and date of scenario. Date should be
>Submit</a associated to the data, not the current date. For example, this could reflect the publishing
> date of a study. You can leave all fields but the name empty and fill them in later.
<button type="button" class="btn btn-default" data-dismiss="modal"> <a target="_blank" href="https://wiki.envipath.org/index.php/scenario" role="button">wiki
Cancel &gt;&gt;</a>
</button> </div>
</div> <label for="scenario-name">Name</label>
<input id="scenario-name" name="scenario-name" class="form-control" placeholder="Name"/>
<label for="scenario-description">Description</label>
<input id="scenario-description" name="scenario-description" class="form-control"
placeholder="Description"/>
<label id="dateField" for="dateYear">Date</label>
<table>
<tr>
<th>
<input type="number" id="dateYear" name="scenario-date-year" class="form-control"
placeholder="YYYY" max="{% now "Y" %}">
</th>
<th>
<input type="number" id="dateMonth" name="scenario-date-month" min="1" max="12"
class="form-control" placeholder="MM" >
</th>
<th>
<input type="number" id="dateDay" name="scenario-date-day" min="1" max="31" class="form-control"
placeholder="DD">
</th>
</tr>
</table>
<label for="scenario-type">Scenario Type</label>
<select id="scenario-type" name="scenario-type" class="form-control" data-width='100%'>
<option value="empty" selected>Empty Scenario</option>
{% for k, v in scenario_types.items %}
<option value="{{ v.name }}">{{ k }}</option>
{% endfor %}
</select>
{% for type in scenario_types.values %}
<div id="{{ type.name }}-specific-inputs">
{% for widget in type.widgets %}
{{ widget|safe }}
{% endfor %}
</div>
{% endfor %}
</form>
</div>
<div class="modal-footer">
<a id="new_scenario_modal_form_submit" class="btn btn-primary" href="#">Submit</a>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function () {
// Initially hide all "specific" forms // Initially hide all "specific" forms
$("div[id$='-specific-inputs']").each(function () { $("div[id$='-specific-inputs']").each(function () {
$(this).hide(); $(this).hide();
});
// On change hide all and show only selected
$("#scenario-type").change(function () {
$("div[id$='-specific-inputs']").each(function () {
$(this).hide();
});
val = $('option:selected', this).val();
$("#" + val + "-specific-inputs").show();
});
$('#new_scenario_modal_form_submit').on('click', function (e) {
e.preventDefault();
$('#new_scenario_form').submit();
});
var dateYear = document.getElementById("dateYear");
dateYear.addEventListener("change", () => {
console.log("Final value after editing:", dateYear.value);
if (dateYear.value.length < 4) {
dateYear.value = {% now "Y" %};
}
});
}); });
// On change hide all and show only selected
$("#scenario-type").change(function () {
$("div[id$='-specific-inputs']").each(function () {
$(this).hide();
});
val = $("option:selected", this).val();
$("#" + val + "-specific-inputs").show();
});
$("#new_scenario_modal_form_submit").on("click", function (e) {
e.preventDefault();
$("#new_scenario_form").submit();
});
var dateYear = document.getElementById("dateYear");
dateYear.addEventListener("change", () => {
console.log("Final value after editing:", dateYear.value);
if (dateYear.value.length < 4) {
dateYear.value = new Date().getFullYear();
}
});
});
</script> </script>

View File

@ -1,92 +1,61 @@
{% load static %} {% load static %}
<!-- Add Additional Information--> <!-- Add Additional Information-->
<div id="add_additional_information_modal" class="modal" tabindex="-1"> <div id="add_additional_information_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" <h3 class="modal-title">Add Additional Information</h3>
aria-label="Close" </div>
> <div class="modal-body">
<span aria-hidden="true">&times;</span> <select id="select-additional-information-type" data-actions-box='true' class="form-control" data-width='100%'>
</button> <option selected disabled>Select the type to add</option>
<h3 class="modal-title">Add Additional Information</h3> {% for add_inf in available_additional_information %}
</div> <option value="{{ add_inf.name }}">{{ add_inf.display_name }}</option>
<div class="modal-body"> {% endfor %}
<select </select>
id="select-additional-information-type" {% for add_inf in available_additional_information %}
data-actions-box="true" <div class="aiform {{ add_inf.name }}" style="display: none;">
class="form-control" <form id="add_{{ add_inf.name }}_add-additional-information-modal-form" accept-charset="UTF-8"
data-width="100%" action="" data-remote="true" method="post">
> {% csrf_token %}
<option selected disabled>Select the type to add</option> {{ add_inf.widget|safe }}
{% for add_inf in available_additional_information %} <input type="hidden" name="hidden" value="add-additional-information">
<option value="{{ add_inf.name }}"> </form>
{{ add_inf.display_name }} </div>
</option> {% endfor %}
{% endfor %} </div>
</select> <div class="modal-footer">
{% for add_inf in available_additional_information %} <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<div class="aiform {{ add_inf.name }}" style="display: none;"> <button type="button" class="btn btn-primary" id="add-additional-information-modal-submit">Add
<form </button>
id="add_{{ add_inf.name }}_add-additional-information-modal-form" </div>
accept-charset="UTF-8" </div>
action=""
data-remote="true"
method="post"
>
{% csrf_token %}
{{ add_inf.widget|safe }}
<input
type="hidden"
name="hidden"
value="add-additional-information"
/>
</form>
</div>
{% endfor %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="add-additional-information-modal-submit"
>
Add
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#select-additional-information-type").change(function (e) {
var selectedType = $( $('#select-additional-information-type').change(function(e){
"#select-additional-information-type :selected", var selectedType = $("#select-additional-information-type :selected").val();
).val(); $('.aiform').hide();
$(".aiform").hide(); $('.' + selectedType).show();
$("." + selectedType).show(); })
$('#add-additional-information-modal-submit').click(function(e){
e.preventDefault();
var selectedType = $("#select-additional-information-type :selected").val();
console.log(selectedType);
if (selectedType !== null && selectedType !== undefined && selectedType !== '') {
$('.' + selectedType + ' >form').submit();
}
}); });
$("#add-additional-information-modal-submit").click(function (e) { });
e.preventDefault();
var selectedType = $(
"#select-additional-information-type :selected",
).val();
console.log(selectedType);
if (
selectedType !== null &&
selectedType !== undefined &&
selectedType !== ""
) {
$("." + selectedType + " >form").submit();
}
});
});
</script> </script>

View File

@ -1,174 +1,127 @@
{% load static %} {% load static %}
<div <div class="modal fade bs-modal-lg" id="add_pathway_edge_modal" tabindex="-1" aria-labelledby="add_pathway_edge_modal"
class="modal fade bs-modal-lg" aria-modal="true"
id="add_pathway_edge_modal" role="dialog">
tabindex="-1" <div class="modal-dialog modal-lg">
aria-labelledby="add_pathway_edge_modal" <div class="modal-content">
aria-modal="true" <div class="modal-header">
role="dialog" <button type="button" class="close" data-dismiss="modal" aria-label="Close">
> <span aria-hidden="true">&times;</span>
<div class="modal-dialog modal-lg"> </button>
<div class="modal-content"> <h4 class="modal-title">Add a Reaction</h4>
<div class="modal-header">
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">Add a Reaction</h4>
</div>
<div class="modal-body">
<form
id="add_pathway_edge_modal_form"
accept-charset="UTF-8"
action="{% url 'package pathway edge list' meta.current_package.uuid pathway.uuid %}"
data-remote="true"
method="post"
>
{% csrf_token %}
<label for="edge-name">Name</label>
<input
id="edge-name"
class="form-control"
name="edge-name"
placeholder="Name"
/>
<label for="edge-description">Description</label>
<input
id="edge-description"
class="form-control"
name="edge-description"
placeholder="Description"
/>
<p></p>
<div class="row">
<div class="col-xs-5">
<legend>Substrate(s)</legend>
</div> </div>
<div class="col-xs-2"></div> <div class="modal-body">
<div class="col-xs-5"> <form id="add_pathway_edge_modal_form" accept-charset="UTF-8"
<legend>Product(s)</legend> action="{% url 'package pathway edge list' meta.current_package.uuid pathway.uuid %}"
data-remote="true" method="post">
{% csrf_token %}
<label for="edge-name">Name</label>
<input id="edge-name" class="form-control" name="edge-name" placeholder="Name"/>
<label for="edge-description">Description</label>
<input id="edge-description" class="form-control" name="edge-description" placeholder="Description"/>
<p></p>
<div class="row">
<div class="col-xs-5">
<legend>Substrate(s)</legend>
</div>
<div class="col-xs-2">
</div>
<div class="col-xs-5">
<legend>Product(s)</legend>
</div>
</div>
<div class="row">
<div class="col-xs-5">
<select id="add_pathway_edge_substrates" name="edge-substrates"
data-actions-box='true' class="form-control" multiple data-width='100%'>
{% for n in pathway.nodes %}
<option data-smiles="{{ n.default_node_label.smiles }}" value="{{ n.url }}">{{ n.default_node_label.name|safe }}</option>
{% endfor %}
</select>
</div>
<div class="col-xs-2" style="display: flex; justify-content: center; align-items: center;">
<i class="glyphicon glyphicon-arrow-right"></i>
</div>
<div class="col-xs-5">
<select id="add_pathway_edge_products" name="edge-products"
data-actions-box='true' class="form-control" multiple data-width='100%'>
{% for n in pathway.nodes %}
<option data-smiles="{{ n.default_node_label.smiles }}" value="{{ n.url }}">{{ n.default_node_label.name|safe }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="row">
<p></p>
<div class="col-xs-12" id="reaction_image">
</div>
</div>
</form>
</div> </div>
</div> <div class="modal-footer">
<div class="row"> <button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close
<div class="col-xs-5"> </button>
<select <button type="button" class="btn btn-primary" id="add_pathway_edge_modal_form_submit">Submit</button>
id="add_pathway_edge_substrates"
name="edge-substrates"
data-actions-box="true"
class="form-control"
multiple
data-width="100%"
>
{% for n in pathway.nodes %}
<option
data-smiles="{{ n.default_node_label.smiles }}"
value="{{ n.url }}"
>
{{ n.default_node_label.name|safe }}
</option>
{% endfor %}
</select>
</div> </div>
<div </div>
class="col-xs-2"
style="display: flex; justify-content: center; align-items: center;"
>
<i class="glyphicon glyphicon-arrow-right"></i>
</div>
<div class="col-xs-5">
<select
id="add_pathway_edge_products"
name="edge-products"
data-actions-box="true"
class="form-control"
multiple
data-width="100%"
>
{% for n in pathway.nodes %}
<option
data-smiles="{{ n.default_node_label.smiles }}"
value="{{ n.url }}"
>
{{ n.default_node_label.name|safe }}
</option>
{% endfor %}
</select>
</div>
</div>
<div class="row">
<p></p>
<div class="col-xs-12" id="reaction_image"></div>
</div>
</form>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary pull-left"
data-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
id="add_pathway_edge_modal_form_submit"
>
Submit
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
function reactionImage() {
var substrates = [];
$("#add_pathway_edge_substrates option:selected").each(function () {
var smiles = $(this).data("smiles"); // read data-smiles attribute
substrates.push(smiles);
});
var products = []; function reactionImage() {
$("#add_pathway_edge_products option:selected").each(function () { var substrates = [];
var smiles = $(this).data("smiles"); // read data-smiles attribute $('#add_pathway_edge_substrates option:selected').each(function () {
products.push(smiles); var smiles = $(this).data('smiles'); // read data-smiles attribute
}); substrates.push(smiles);
});
if (substrates.length > 0 && products.length > 0) { var products = []
reaction = substrates.join(".") + ">>" + products.join("."); $('#add_pathway_edge_products option:selected').each(function () {
$("#reaction_image").empty(); var smiles = $(this).data('smiles'); // read data-smiles attribute
$("#reaction_image").append( products.push(smiles);
"<img width='100%' src='{% url 'depict' %}?smirks=" + });
encodeURIComponent(reaction) +
"'>", if (substrates.length > 0 && products.length > 0) {
); reaction = substrates.join('.') + ">>" + products.join('.');
$('#reaction_image').empty();
$('#reaction_image').append(
"<img width='100%' src='{% url 'depict' %}?smirks=" + encodeURIComponent(reaction) +"'>"
);
}
} }
}
$(function () {
$("#add_pathway_edge_substrates").selectpicker();
$("#add_pathway_edge_products").selectpicker();
$("#add_pathway_edge_substrates").on("change", function (e) {
reactionImage();
});
$("#add_pathway_edge_products").on("change", function (e) {
reactionImage();
});
$(function () { $(function () {
$("#add_pathway_edge_modal_form_submit").on("click", function (e) { $("#add_pathway_edge_substrates").selectpicker();
e.preventDefault(); $("#add_pathway_edge_products").selectpicker();
$(this).prop("disabled", true);
$("#add_pathway_edge_substrates").on('change', function (e) {
reactionImage();
})
$("#add_pathway_edge_products").on('change', function (e) {
reactionImage();
})
$(function () {
$('#add_pathway_edge_modal_form_submit').on('click', function (e) {
e.preventDefault();
$(this).prop("disabled", true);
// submit form
$('#add_pathway_edge_modal_form').submit();
});
});
// submit form
$("#add_pathway_edge_modal_form").submit();
});
}); });
});
</script> </script>

View File

@ -1,119 +1,78 @@
{% load static %} {% load static %}
<div <div class="modal fade bs-modal-lg" id="add_pathway_node_modal" tabindex="-1" aria-labelledby="add_pathway_node_modal" aria-modal="true"
class="modal fade bs-modal-lg" role="dialog">
id="add_pathway_node_modal" <div class="modal-dialog modal-lg">
tabindex="-1" <div class="modal-content">
aria-labelledby="add_pathway_node_modal" <div class="modal-header">
aria-modal="true" <button type="button" class="close" data-dismiss="modal" aria-label="Close">
role="dialog" <span aria-hidden="true">&times;</span>
> </button>
<div class="modal-dialog modal-lg"> <h4 class="modal-title">Add a Node</h4>
<div class="modal-content"> </div>
<div class="modal-header"> <div class="modal-body">
<button <form id="add_pathway_node_modal_form" accept-charset="UTF-8" action="{% url 'package pathway node list' meta.current_package.uuid pathway.uuid %}" data-remote="true" method="post">
type="button" {% csrf_token %}
class="close" <label for="node-name">Name</label>
data-dismiss="modal" <input id="node-name" class="form-control" name="node-name" placeholder="Name"/>
aria-label="Close" <label for="node-description">Description</label>
> <input id="node-description" class="form-control" name="node-description" placeholder="Description"/>
<span aria-hidden="true">&times;</span> <label for="node-smiles">SMILES</label>
</button> <input type="text" class="form-control" name="node-smiles" placeholder="SMILES" id="node-smiles">
<h4 class="modal-title">Add a Node</h4> <p></p>
</div> <div>
<div class="modal-body"> <iframe id="add_node_ketcher" src="{% static '/js/ketcher2/ketcher.html' %}" width="100%"
<form height="510"></iframe>
id="add_pathway_node_modal_form" </div>
accept-charset="UTF-8" <p></p>
action="{% url 'package pathway node list' meta.current_package.uuid pathway.uuid %}" </form>
data-remote="true" </div>
method="post" <div class="modal-footer">
> <button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close
{% csrf_token %} </button>
<label for="node-name">Name</label> <button type="button" class="btn btn-primary" id="add_pathway_node_modal_form_submit">Submit</button>
<input </div>
id="node-name" </div>
class="form-control"
name="node-name"
placeholder="Name"
/>
<label for="node-description">Description</label>
<input
id="node-description"
class="form-control"
name="node-description"
placeholder="Description"
/>
<label for="node-smiles">SMILES</label>
<input
type="text"
class="form-control"
name="node-smiles"
placeholder="SMILES"
id="node-smiles"
/>
<p></p>
<div>
<iframe
id="add_node_ketcher"
src="{% static '/js/ketcher2/ketcher.html' %}"
width="100%"
height="510"
></iframe>
</div>
<p></p>
</form>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary pull-left"
data-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
id="add_pathway_node_modal_form_submit"
>
Submit
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
function newStructureModalketcherToNewStructureModalTextInput() {
$("#node-smiles").val(this.ketcher.getSmiles());
}
$(function () { function newStructureModalketcherToNewStructureModalTextInput() {
$("#add_node_ketcher").on("load", function () { $('#node-smiles').val(this.ketcher.getSmiles());
const checkKetcherReady = () => { }
win = this.contentWindow;
if (win.ketcher && "editor" in win.ketcher) {
win.ketcher.editor.event.change.handlers.push({
once: false,
priority: 0,
f: newStructureModalketcherToNewStructureModalTextInput,
ketcher: win.ketcher,
});
} else {
setTimeout(checkKetcherReady, 100);
}
};
checkKetcherReady(); $(function() {
$('#add_node_ketcher').on('load', function() {
const checkKetcherReady = () => {
win = this.contentWindow
if (win.ketcher && 'editor' in win.ketcher) {
win.ketcher.editor.event.change.handlers.push({
once: false,
priority: 0,
f: newStructureModalketcherToNewStructureModalTextInput,
ketcher: win.ketcher
});
} else {
setTimeout(checkKetcherReady, 100);
}
};
checkKetcherReady();
})
$(function() {
$('#add_pathway_node_modal_form_submit').on('click', function(e) {
e.preventDefault();
$(this).prop("disabled",true);
// submit form
$('#add_pathway_node_modal_form').submit();
});
}); });
$(function () { });
$("#add_pathway_node_modal_form_submit").on("click", function (e) {
e.preventDefault();
$(this).prop("disabled", true);
// submit form
$("#add_pathway_node_modal_form").submit();
});
});
});
</script> </script>

View File

@ -1,119 +1,78 @@
{% load static %} {% load static %}
<div <div class="modal fade bs-modal-lg" id="add_structure_modal" tabindex="-1" aria-labelledby="add_structure_modal" aria-modal="true"
class="modal fade bs-modal-lg" role="dialog">
id="add_structure_modal" <div class="modal-dialog modal-lg">
tabindex="-1" <div class="modal-content">
aria-labelledby="add_structure_modal" <div class="modal-header">
aria-modal="true" <button type="button" class="close" data-dismiss="modal" aria-label="Close">
role="dialog" <span aria-hidden="true">×</span>
> </button>
<div class="modal-dialog modal-lg"> <h4 class="modal-title">Create a new Structure</h4>
<div class="modal-content"> </div>
<div class="modal-header"> <div class="modal-body">
<button <form id="add_structure_modal_form" accept-charset="UTF-8" action="{% url 'package compound structure list' meta.current_package.uuid compound.uuid %}" data-remote="true" method="post">
type="button" {% csrf_token %}
class="close" <label for="structure-name">Name</label>
data-dismiss="modal" <input id="structure-name" class="form-control" name="structure-name" placeholder="Name"/>
aria-label="Close" <label for="structure-description">Description</label>
> <input id="structure-description" class="form-control" name="structure-description" placeholder="Description"/>
<span aria-hidden="true">×</span> <label for="structure-smiles">SMILES</label>
</button> <input type="text" class="form-control" name="structure-smiles" placeholder="SMILES" id="structure-smiles">
<h4 class="modal-title">Create a new Structure</h4> <p></p>
</div> <div>
<div class="modal-body"> <iframe id="add_structure_ketcher" src="{% static '/js/ketcher2/ketcher.html' %}" width="100%"
<form height="510"></iframe>
id="add_structure_modal_form" </div>
accept-charset="UTF-8" <p></p>
action="{% url 'package compound structure list' meta.current_package.uuid compound.uuid %}" </form>
data-remote="true" </div>
method="post" <div class="modal-footer">
> <button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close
{% csrf_token %} </button>
<label for="structure-name">Name</label> <button type="button" class="btn btn-primary" id="add_structure_modal_form_submit">Submit</button>
<input </div>
id="structure-name" </div>
class="form-control"
name="structure-name"
placeholder="Name"
/>
<label for="structure-description">Description</label>
<input
id="structure-description"
class="form-control"
name="structure-description"
placeholder="Description"
/>
<label for="structure-smiles">SMILES</label>
<input
type="text"
class="form-control"
name="structure-smiles"
placeholder="SMILES"
id="structure-smiles"
/>
<p></p>
<div>
<iframe
id="add_structure_ketcher"
src="{% static '/js/ketcher2/ketcher.html' %}"
width="100%"
height="510"
></iframe>
</div>
<p></p>
</form>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary pull-left"
data-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
id="add_structure_modal_form_submit"
>
Submit
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
function newStructureModalketcherToNewStructureModalTextInput() {
$("#structure-smiles").val(this.ketcher.getSmiles());
}
$(function () { function newStructureModalketcherToNewStructureModalTextInput() {
$("#add_structure_ketcher").on("load", function () { $('#structure-smiles').val(this.ketcher.getSmiles());
const checkKetcherReady = () => { }
win = this.contentWindow;
if (win.ketcher && "editor" in win.ketcher) {
win.ketcher.editor.event.change.handlers.push({
once: false,
priority: 0,
f: newStructureModalketcherToNewStructureModalTextInput,
ketcher: win.ketcher,
});
} else {
setTimeout(checkKetcherReady, 100);
}
};
checkKetcherReady(); $(function() {
$('#add_structure_ketcher').on('load', function() {
const checkKetcherReady = () => {
win = this.contentWindow
if (win.ketcher && 'editor' in win.ketcher) {
win.ketcher.editor.event.change.handlers.push({
once: false,
priority: 0,
f: newStructureModalketcherToNewStructureModalTextInput,
ketcher: win.ketcher
});
} else {
setTimeout(checkKetcherReady, 100);
}
};
checkKetcherReady();
})
$(function() {
$('#add_structure_modal_form_submit').on('click', function(e) {
e.preventDefault();
$(this).prop("disabled",true);
// submit form
$('#add_structure_modal_form').submit();
});
}); });
$(function () { });
$("#add_structure_modal_form_submit").on("click", function (e) {
e.preventDefault();
$(this).prop("disabled", true);
// submit form
$("#add_structure_modal_form").submit();
});
});
});
</script> </script>

View File

@ -1,89 +1,66 @@
{% load static %} {% load static %}
<!-- Delete Edge --> <!-- Delete Edge -->
<div id="delete_pathway_edge_modal" class="modal" tabindex="-1"> <div id="delete_pathway_edge_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h3 class="modal-title">Delete Edge</h3> <h3 class="modal-title">Delete Edge</h3>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> Deletes the Edge. Nodes referenced by this edge will remain.
<span aria-hidden="true">&times;</span> <p></p>
</button> <form id="delete-pathway-edge-modal-form" accept-charset="UTF-8" action="" data-remote="true"
</div> method="post">
<div class="modal-body"> {% csrf_token %}
Deletes the Edge. Nodes referenced by this edge will remain. <select id="delete_pathway_edge_edges" name="edge-url"
<p></p> data-actions-box='true' class="form-control" data-width='100%'>
<form <option value="" disabled selected>Select Reaction to delete</option>
id="delete-pathway-edge-modal-form" {% for e in pathway.edges %}
accept-charset="UTF-8" <option value="{{ e.url }}">{{ e.edge_label.name|safe }}</option>
action="" {% endfor %}
data-remote="true" </select>
method="post" <input type="hidden" id="hidden" name="hidden" value="delete"/>
> </form>
{% csrf_token %} <p></p>
<select <div id="delete_pathway_edge_image"></div>
id="delete_pathway_edge_edges" </div>
name="edge-url" <div class="modal-footer">
data-actions-box="true" <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
class="form-control" <button type="button" class="btn btn-primary" id="delete-pathway-edge-modal-submit">Delete</button>
data-width="100%" </div>
> </div>
<option value="" disabled selected>
Select Reaction to delete
</option>
{% for e in pathway.edges %}
<option value="{{ e.url }}">{{ e.edge_label.name|safe }}</option>
{% endfor %}
</select>
<input type="hidden" id="hidden" name="hidden" value="delete" />
</form>
<p></p>
<div id="delete_pathway_edge_image"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="delete-pathway-edge-modal-submit"
>
Delete
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function () {
$("#delete_pathway_edge_edges").selectpicker(); $("#delete_pathway_edge_edges").selectpicker();
$("#delete_pathway_edge_edges").on("change", function (e) { $("#delete_pathway_edge_edges").on('change', function (e) {
edge_url = $("#delete_pathway_edge_edges option:selected").val(); edge_url = $('#delete_pathway_edge_edges option:selected').val()
if (edge_url !== "") { if (edge_url !== "") {
$("#delete_pathway_edge_image").empty(); $('#delete_pathway_edge_image').empty();
$("#delete_pathway_edge_image").append( $('#delete_pathway_edge_image').append(
"<img width='100%' src='" + edge_url + "?image=svg'>", "<img width='100%' src='" + edge_url + "?image=svg'>"
); );
} }
}); })
$("#delete-pathway-edge-modal-submit").click(function (e) { $('#delete-pathway-edge-modal-submit').click(function (e) {
e.preventDefault(); e.preventDefault();
edge_url = $("#delete_pathway_edge_edges option:selected").val(); edge_url = $('#delete_pathway_edge_edges option:selected').val()
if (edge_url === "") { if (edge_url === "") {
return; return;
} }
$("#delete-pathway-edge-modal-form").attr("action", edge_url); $('#delete-pathway-edge-modal-form').attr('action', edge_url)
$("#delete-pathway-edge-modal-form").submit(); $('#delete-pathway-edge-modal-form').submit();
}); });
});
})
</script> </script>

View File

@ -2,92 +2,65 @@
<!-- Delete Node --> <!-- Delete Node -->
<div id="delete_pathway_node_modal" class="modal" tabindex="-1"> <div id="delete_pathway_node_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h3 class="modal-title">Delete Node</h3> <h3 class="modal-title">Delete Node</h3>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> Deletes the Node. Edges having this Node as Substrate or Product will be removed as well.
<span aria-hidden="true">&times;</span> <p></p>
</button> <form id="delete-pathway-node-modal-form" accept-charset="UTF-8" action="" data-remote="true"
</div> method="post">
<div class="modal-body"> {% csrf_token %}
Deletes the Node. Edges having this Node as Substrate or Product will be <select id="delete_pathway_node_nodes" name="node-url"
removed as well. data-actions-box='true' class="form-control" data-width='100%'>
<p></p> <option value="" disabled selected>Select Compound to delete</option>
<form {% for n in pathway.nodes %}
id="delete-pathway-node-modal-form" <option value="{{ n.url }}">{{ n.default_node_label.name|safe }}</option>
accept-charset="UTF-8" {% endfor %}
action="" </select>
data-remote="true" <input type="hidden" id="hidden" name="hidden" value="delete"/>
method="post" </form>
> <p></p>
{% csrf_token %} <div id="delete_pathway_node_image"></div>
<select </div>
id="delete_pathway_node_nodes" <div class="modal-footer">
name="node-url" <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
data-actions-box="true" <button type="button" class="btn btn-primary" id="delete-pathway-node-modal-submit">Delete</button>
class="form-control" </div>
data-width="100%" </div>
>
<option value="" disabled selected>
Select Compound to delete
</option>
{% for n in pathway.nodes %}
<option value="{{ n.url }}">
{{ n.default_node_label.name|safe }}
</option>
{% endfor %}
</select>
<input type="hidden" id="hidden" name="hidden" value="delete" />
</form>
<p></p>
<div id="delete_pathway_node_image"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="delete-pathway-node-modal-submit"
>
Delete
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function () {
$("#delete_pathway_node_nodes").selectpicker(); $("#delete_pathway_node_nodes").selectpicker();
$("#delete_pathway_node_nodes").on("change", function (e) { $("#delete_pathway_node_nodes").on('change', function (e) {
node_url = $("#delete_pathway_node_nodes option:selected").val(); node_url = $('#delete_pathway_node_nodes option:selected').val()
if (node_url !== "") { if (node_url !== "") {
$("#delete_pathway_node_image").empty(); $('#delete_pathway_node_image').empty();
$("#delete_pathway_node_image").append( $('#delete_pathway_node_image').append(
"<img width='100%' src='" + node_url + "?image=svg'>", "<img width='100%' src='" + node_url + "?image=svg'>"
); );
} }
}); })
$("#delete-pathway-node-modal-submit").click(function (e) { $('#delete-pathway-node-modal-submit').click(function (e) {
e.preventDefault(); e.preventDefault();
node_url = $("#delete_pathway_node_nodes option:selected").val(); node_url = $('#delete_pathway_node_nodes option:selected').val()
if (node_url === "") { if (node_url === "") {
return; return;
} }
$("#delete-pathway-node-modal-form").attr("action", node_url); $('#delete-pathway-node-modal-form').attr('action', node_url)
$("#delete-pathway-node-modal-form").submit(); $('#delete-pathway-node-modal-form').submit();
}); });
});
})
</script> </script>

View File

@ -1,53 +1,36 @@
{% load static %} {% load static %}
<!-- Download Pathway --> <!-- Download Pathway -->
<div id="download_pathway_csv_modal" class="modal" tabindex="-1"> <div id="download_pathway_csv_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h3 class="modal-title">Download Pathway as CSV</h3> <h3 class="modal-title">Download Pathway as CSV</h3>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> By clicking on Download the Pathway will be converted into a CSV and directly downloaded.
<span aria-hidden="true">&times;</span> <form id="download-pathway-csv-modal-form" accept-charset="UTF-8" action="{{ pathway.url }}"
</button> data-remote="true" method="GET">
</div> <input type="hidden" name="download" value="true"/>
<div class="modal-body"> </form>
By clicking on Download the Pathway will be converted into a CSV and </div>
directly downloaded. <div class="modal-footer">
<form <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
id="download-pathway-csv-modal-form" <button type="button" class="btn btn-primary" id="download-pathway-csv-modal-submit">Download</button>
accept-charset="UTF-8" </div>
action="{{ pathway.url }}" </div>
data-remote="true"
method="GET"
>
<input type="hidden" name="download" value="true" />
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="download-pathway-csv-modal-submit"
>
Download
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function () {
$("#download-pathway-csv-modal-submit").click(function (e) {
e.preventDefault(); $('#download-pathway-csv-modal-submit').click(function (e) {
$("#download-pathway-csv-modal-form").submit(); e.preventDefault();
$("#download_pathway_csv_modal").modal("hide"); $('#download-pathway-csv-modal-form').submit();
}); $('#download_pathway_csv_modal').modal('hide');
}); });
})
</script> </script>

View File

@ -1,43 +1,32 @@
{% load static %} {% load static %}
<!-- Download Pathway --> <!-- Download Pathway -->
<div id="download_pathway_image_modal" class="modal" tabindex="-1"> <div id="download_pathway_image_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h3 class="modal-title">Download Pathway as Image</h3> <h3 class="modal-title">Download Pathway as Image</h3>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> By clicking on Download the Pathway will be saved as SVG.
<span aria-hidden="true">&times;</span> </div>
</button> <div class="modal-footer">
</div> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<div class="modal-body"> <button type="button" class="btn btn-primary" id="download-pathway-image-modal-submit">Download</button>
By clicking on Download the Pathway will be saved as SVG. </div>
</div> </div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="download-pathway-image-modal-submit"
>
Download
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function () {
$("#download-pathway-image-modal-submit").click(function (e) {
e.preventDefault(); $('#download-pathway-image-modal-submit').click(function (e) {
downloadSVG($("#pwsvg")[0], '{{ pathway.name.split|join:"_" }}.svg'); e.preventDefault();
$("#download_pathway_image_modal").modal("hide"); downloadSVG($('#pwsvg')[0], '{{ pathway.name.split|join:"_" }}.svg')
}); $('#download_pathway_image_modal').modal('hide');
}); });
})
</script> </script>

View File

@ -1,70 +1,47 @@
{% load static %} {% load static %}
<!-- Edit Compound --> <!-- Edit Compound -->
<div id="edit_compound_modal" class="modal" tabindex="-1"> <div id="edit_compound_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Edit Compound</h5> <h5 class="modal-title">Edit Compound</h5>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> <p>Edit Compound.</p>
<span aria-hidden="true">&times;</span> <form id="edit-compound-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
</button> {% csrf_token %}
</div> <p>
<div class="modal-body"> <label for="compound-name">Name</label>
<p>Edit Compound.</p> <input id="compound-name" class="form-control" name="compound-name" value="{{ compound.name|safe}}">
<form </p>
id="edit-compound-modal-form" <p>
accept-charset="UTF-8" <label for="compound-description">Description</label>
action="" <input id="compound-description" type="text" class="form-control"
data-remote="true" value="{{ compound.description|safe }}"
method="post" name="compound-description">
> </p>
{% csrf_token %} </form>
<p> </div>
<label for="compound-name">Name</label> <div class="modal-footer">
<input <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
id="compound-name" <button type="button" class="btn btn-primary" id="edit-compound-modal-submit">Update</button>
class="form-control" </div>
name="compound-name" </div>
value="{{ compound.name|safe }}"
/>
</p>
<p>
<label for="compound-description">Description</label>
<input
id="compound-description"
type="text"
class="form-control"
value="{{ compound.description|safe }}"
name="compound-description"
/>
</p>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="edit-compound-modal-submit"
>
Update
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#edit-compound-modal-submit").click(function (e) {
e.preventDefault(); $('#edit-compound-modal-submit').click(function(e){
$("#edit-compound-modal-form").submit(); e.preventDefault();
$('#edit-compound-modal-form').submit();
}); });
});
});
</script> </script>

View File

@ -1,70 +1,46 @@
{% load static %} {% load static %}
<!-- Edit Compound --> <!-- Edit Compound -->
<div id="edit_compound_structure_modal" class="modal" tabindex="-1"> <div id="edit_compound_structure_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Create a Compound</h5> <h5 class="modal-title">Create a Compound</h5>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> <p>Edit a Compound Structure.</p>
<span aria-hidden="true">&times;</span> <form id="edit-compound-structure-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
</button> {% csrf_token %}
</div> <p>
<div class="modal-body"> <label for="compound-structure-name">Name</label>
<p>Edit a Compound Structure.</p> <input id="compound-structure-name" class="form-control" name="compound-structure-name" value="{{ compound_structure.name|safe }}">
<form </p>
id="edit-compound-structure-modal-form" <p>
accept-charset="UTF-8" <label for="compound-structure-description">Description</label>
action="" <input id="compound-structure-description" type="text" class="form-control"
data-remote="true" value="{{ compound_structure.description|safe }}" name="compound-structure-description">
method="post" </p>
> </form>
{% csrf_token %} </div>
<p> <div class="modal-footer">
<label for="compound-structure-name">Name</label> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<input <button type="button" class="btn btn-primary" id="edit-compound-structure-modal-submit">Create</button>
id="compound-structure-name" </div>
class="form-control" </div>
name="compound-structure-name"
value="{{ compound_structure.name|safe }}"
/>
</p>
<p>
<label for="compound-structure-description">Description</label>
<input
id="compound-structure-description"
type="text"
class="form-control"
value="{{ compound_structure.description|safe }}"
name="compound-structure-description"
/>
</p>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="edit-compound-structure-modal-submit"
>
Create
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#edit-compound-structure-modal-submit").click(function (e) {
e.preventDefault(); $('#edit-compound-structure-modal-submit').click(function(e){
$("#edit-compound-structure-modal-form").submit(); e.preventDefault();
$('#edit-compound-structure-modal-form').submit();
}); });
});
});
</script> </script>

View File

@ -1,151 +1,121 @@
{% load static %} {% load static %}
<!-- Edit Package Permission --> <!-- Edit Package Permission -->
<div id="edit_group_member_modal" class="modal" tabindex="-1"> <div id="edit_group_member_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Add or Remove Group Member</h5> <h5 class="modal-title">Add or Remove Group Member</h5>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close"
data-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>
To add member (either User or entire Groups) to this group select the
entity you want to add below and click the check mark.
<br />
To remove member simply click the <code>X</code> next to the member.
</p>
<div class="row">
<div class="col-xs-8">
<legend>User or Group</legend>
</div>
<div class="col-xs-4">
<legend>Add/Remove</legend>
</div>
</div>
<div class="row">
<form
id="modal-form-group-member"
class="form-inline"
role="form"
accept-charset="UTF-8"
action=""
data-remote="true"
method="post"
>
{% csrf_token %}
<div class="col-xs-8">
<select
id="select_member"
name="member"
data-actions-box="true"
class="selPackages"
data-width="100%"
>
<option disabled selected>User</option>
{% for u in users %}
<option value="{{ u.url }}">{{ u.username }}</option>
{% endfor %}
<option disabled>Groups</option>
{% for g in groups %}
<option value="{{ g.url }}">{{ g.name|safe }}</option>
{% endfor %}
</select>
<input type="hidden" name="action" value="add" />
</div>
<div class="col-xs-2"></div>
<div class="col-xs-2">
<button type="submit" style="width:60%;" class="btn col-xs-2">
<span class="glyphicon glyphicon-ok"></span>
</button>
</div>
</form>
</div>
<p></p>
{% for u in group.user_member.all %}
<div class="row">
<form
id="modal-form-group-member_{{ u.uuid }}"
class="form-inline"
role="form"
accept-charset="UTF-8"
action=""
data-remote="true"
method="post"
>
{% csrf_token %}
<div class="col-xs-8">
{{ u.username }}
<input type="hidden" name="member" value="{{ u.url }}" />
<input type="hidden" name="action" value="remove" />
</div>
<div class="col-xs-2"></div>
<div class="col-xs-2">
<button type="submit" style="width:60%;" class="btn col-xs-2">
<span class="glyphicon glyphicon-trash"></span>
</button> </button>
</div> </div>
</form> <div class="modal-body">
</div> <p>
{% endfor %} To add member (either User or entire Groups) to this group select the entity you want to add below
<p></p> and click the check mark.
{% for g in group.group_member.all %} <br>
<div class="row"> To remove member simply click the <code>X</code> next to the member.
<form </p>
id="modal-form-group-member_{{ g.uuid }}"
class="form-inline" <div class="row">
role="form" <div class="col-xs-8">
accept-charset="UTF-8" <legend>User or Group</legend>
action="" </div>
data-remote="true" <div class="col-xs-4">
method="post" <legend>Add/Remove</legend>
> </div>
{% csrf_token %} </div>
<div class="col-xs-8">
{{ g.name|safe }} <div class="row">
<input type="hidden" name="member" value="{{ g.url }}" /> <form id="modal-form-group-member" class="form-inline" role="form" accept-charset="UTF-8" action=""
<input type="hidden" name="action" value="remove" /> data-remote="true" method="post">
</div> {% csrf_token %}
<div class="col-xs-2"></div> <div class="col-xs-8">
<div class="col-xs-2"> <select id="select_member" name="member" data-actions-box='true'
<button type="submit" style="width:60%;" class="btn col-xs-2"> class="selPackages" data-width='100%'>
<span class="glyphicon glyphicon-trash"></span> <option disabled selected>User</option>
</button> {% for u in users %}
</div> <option value="{{ u.url }}">{{ u.username }}</option>
</form> {% endfor %}
</div> <option disabled>Groups</option>
{% endfor %} {% for g in groups %}
</div> <option value="{{ g.url }}">{{ g.name|safe }}</option>
<div class="modal-footer"> {% endfor %}
<button type="button" class="btn btn-secondary" data-dismiss="modal"> </select>
Close <input type="hidden" name="action" value="add">
</button> </div>
<button <div class="col-xs-2">
type="button" </div>
class="btn btn-primary" <div class="col-xs-2">
id="edit-package-modal-submit" <button type="submit" style="width:60%;" class="btn col-xs-2">
> <span class="glyphicon glyphicon-ok"></span>
Update </button>
</button> </div>
</div> </form>
</div>
<p></p>
{% for u in group.user_member.all %}
<div class="row">
<form id="modal-form-group-member_{{ u.uuid }}" class="form-inline" role="form"
accept-charset="UTF-8" action="" data-remote="true" method="post">
{% csrf_token %}
<div class="col-xs-8">
{{ u.username }}
<input type="hidden" name="member" value="{{ u.url }}"/>
<input type="hidden" name="action" value="remove">
</div>
<div class="col-xs-2">
</div>
<div class="col-xs-2">
<button type="submit" style="width:60%;" class="btn col-xs-2">
<span class="glyphicon glyphicon-trash"></span>
</button>
</div>
</form>
</div>
{% endfor %}
<p></p>
{% for g in group.group_member.all %}
<div class="row">
<form id="modal-form-group-member_{{ g.uuid }}" class="form-inline" role="form"
accept-charset="UTF-8" action="" data-remote="true" method="post">
{% csrf_token %}
<div class="col-xs-8">
{{ g.name|safe }}
<input type="hidden" name="member" value="{{ g.url }}"/>
<input type="hidden" name="action" value="remove">
</div>
<div class="col-xs-2">
</div>
<div class="col-xs-2">
<button type="submit" style="width:60%;" class="btn col-xs-2">
<span class="glyphicon glyphicon-trash"></span>
</button>
</div>
</form>
</div>
{% endfor %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="edit-package-modal-submit">Update</button>
</div>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () {
$("#edit-package-modal-submit").click(function (e) {
e.preventDefault(); $(function() {
$("#edit-package-modal-form").submit();
$('#edit-package-modal-submit').click(function(e){
e.preventDefault();
$('#edit-package-modal-form').submit();
}); });
$("#select_member").selectpicker(); $("#select_member").selectpicker();
});
})
</script> </script>

View File

@ -1,71 +1,45 @@
{% load static %} {% load static %}
<!-- Edit Model --> <!-- Edit Model -->
<div id="edit_model_modal" class="modal" tabindex="-1"> <div id="edit_model_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" <h3 class="modal-title">Update Model</h3>
aria-label="Close" </div>
> <div class="modal-body">
<span aria-hidden="true">&times;</span> <p>Alter Name and Description of the Model.</p>
</button> <form id="edit-model-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
<h3 class="modal-title">Update Model</h3> {% csrf_token %}
</div> <p>
<div class="modal-body"> <label for="model-name">Name</label>
<p>Alter Name and Description of the Model.</p> <input id="model-name" type="text" class="form-control" name="model-name"
<form value="{{ model.name|safe }}">
id="edit-model-modal-form" </p>
accept-charset="UTF-8" <p>
action="" <label for="model-description">Description</label>
data-remote="true" <input id="model-description" type="text" class="form-control" name="model-description"
method="post" value="{{ model.description|safe }}">
> </p>
{% csrf_token %} </form>
<p> </div>
<label for="model-name">Name</label> <div class="modal-footer">
<input <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
id="model-name" <button type="button" class="btn btn-primary" id="edit-model-modal-submit">Update</button>
type="text" </div>
class="form-control" </div>
name="model-name"
value="{{ model.name|safe }}"
/>
</p>
<p>
<label for="model-description">Description</label>
<input
id="model-description"
type="text"
class="form-control"
name="model-description"
value="{{ model.description|safe }}"
/>
</p>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="edit-model-modal-submit"
>
Update
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function () {
$("#edit-model-modal-submit").click(function (e) {
e.preventDefault(); $('#edit-model-modal-submit').click(function (e) {
$("#edit-model-modal-form").submit(); e.preventDefault();
}); $('#edit-model-modal-form').submit();
}); });
})
</script> </script>

View File

@ -1,70 +1,47 @@
{% load static %} {% load static %}
<!-- Edit Node --> <!-- Edit Node -->
<div id="edit_node_modal" class="modal" tabindex="-1"> <div id="edit_node_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Edit Node</h5> <h5 class="modal-title">Edit Node</h5>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> <p>Edit Node.</p>
<span aria-hidden="true">&times;</span> <form id="edit-node-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
</button> {% csrf_token %}
</div> <p>
<div class="modal-body"> <label for="node-name">Name</label>
<p>Edit Node.</p> <input id="node-name" class="form-control" name="node-name" value="{{ node.name|safe}}">
<form </p>
id="edit-node-modal-form" <p>
accept-charset="UTF-8" <label for="node-description">Description</label>
action="" <input id="node-description" type="text" class="form-control"
data-remote="true" value="{{ node.description|safe }}"
method="post" name="node-description">
> </p>
{% csrf_token %} </form>
<p> </div>
<label for="node-name">Name</label> <div class="modal-footer">
<input <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
id="node-name" <button type="button" class="btn btn-primary" id="edit-node-modal-submit">Create</button>
class="form-control" </div>
name="node-name" </div>
value="{{ node.name|safe }}"
/>
</p>
<p>
<label for="node-description">Description</label>
<input
id="node-description"
type="text"
class="form-control"
value="{{ node.description|safe }}"
name="node-description"
/>
</p>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="edit-node-modal-submit"
>
Create
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#edit-node-modal-submit").click(function (e) {
e.preventDefault(); $('#edit-node-modal-submit').click(function(e){
$("#edit-node-modal-form").submit(); e.preventDefault();
$('#edit-node-modal-form').submit();
}); });
});
});
</script> </script>

View File

@ -1,70 +1,45 @@
{% load static %} {% load static %}
<!-- Edit Package --> <!-- Edit Package -->
<div id="edit_package_modal" class="modal" tabindex="-1"> <div id="edit_package_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Update Package</h5> <h5 class="modal-title">Update Package</h5>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> <p>Edit a Package.</p>
<span aria-hidden="true">&times;</span> <form id="edit-package-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
</button> {% csrf_token %}
</div> <p>
<div class="modal-body"> <label for="package-name">Name</label>
<p>Edit a Package.</p> <input id="package-name" class="form-control" name="package-name" value="{{ package.name|safe}}">
<form </p>
id="edit-package-modal-form" <p>
accept-charset="UTF-8" <label for="package-description">Description</label>
action="" <input id="package-description" type="text" class="form-control"
data-remote="true" value="{{ package.description|safe }}"
method="post" name="package-description">
> </p>
{% csrf_token %} </form>
<p> </div>
<label for="package-name">Name</label> <div class="modal-footer">
<input <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
id="package-name" <button type="button" class="btn btn-primary" id="edit-package-modal-submit">Update</button>
class="form-control" </div>
name="package-name" </div>
value="{{ package.name|safe }}"
/>
</p>
<p>
<label for="package-description">Description</label>
<input
id="package-description"
type="text"
class="form-control"
value="{{ package.description|safe }}"
name="package-description"
/>
</p>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="edit-package-modal-submit"
>
Update
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#edit-package-modal-submit").click(function (e) {
e.preventDefault(); $('#edit-package-modal-submit').click(function(e){
$("#edit-package-modal-form").submit(); e.preventDefault();
$('#edit-package-modal-form').submit();
}); });
});
})
</script> </script>

View File

@ -1,264 +1,183 @@
{% load static %} {% load static %}
<!-- Edit Package Permission --> <!-- Edit Package Permission -->
<div id="edit_package_permissions_modal" class="modal" tabindex="-1"> <div id="edit_package_permissions_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Grant or Revoke Permissions</h5> <h5 class="modal-title">Grant or Revoke Permissions</h5>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close"
data-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>
Modify permissions for this package. Note that if you give
<code>write</code> permissions to a user or group,
<code>read</code> permissions will be granted automatically.
<br />
To allow users to perform destructive actions, such as deleting the
package, <code>owner</code>
permissions must be granted.
</p>
<div class="row">
<div class="col-xs-4">
<legend>User or Group</legend>
</div>
<div class="col-xs-2">
<legend>Read</legend>
</div>
<div class="col-xs-2">
<legend>Write</legend>
</div>
<div class="col-xs-2">
<legend>Owner</legend>
</div>
</div>
<div class="row">
<form
id="modal-form-permissions"
class="form-inline"
role="form"
accept-charset="UTF-8"
action=""
data-remote="true"
method="post"
>
{% csrf_token %}
<div class="col-xs-4">
<select
id="select_grantee"
name="grantee"
data-actions-box="true"
class="selPackages"
data-width="100%"
>
<option disabled selected>User</option>
{% for u in users %}
<option value="{{ u.url }}">{{ u.username }}</option>
{% endfor %}
<option disabled>Groups</option>
{% for g in groups %}
<option value="{{ g.url }}">{{ g.name|safe }}</option>
{% endfor %}
</select>
</div>
<div class="col-xs-2">
<input type="checkbox" name="read" id="read_new" />
</div>
<div class="col-xs-2">
<input type="checkbox" name="write" id="write_new" />
</div>
<div class="col-xs-2">
<input type="checkbox" name="owner" id="owner_new" />
</div>
<div class="col-xs-2">
<button
type="submit"
style="width:60%;"
class="btn col-xs-2 modify-perm-button"
>
<span class="glyphicon glyphicon-plus"></span>
</button>
</div>
</form>
</div>
<p></p>
{% for up in user_permissions %}
<div class="row">
<form
id="modal-form-permissions_{{ up.user.uuid }}"
class="form-inline"
role="form"
accept-charset="UTF-8"
action=""
data-remote="true"
method="post"
>
{% csrf_token %}
<div class="col-xs-4">
{{ up.user.username }}
<input type="hidden" name="grantee" value="{{ up.user.url }}" />
</div>
<div class="col-xs-2">
<input
type="checkbox"
name="read"
id="read_{{ up.user.uuid }}"
{% if up.has_read %}checked{% endif %}
/>
</div>
<div class="col-xs-2">
<input
type="checkbox"
name="write"
id="write_{{ up.user.uuid }}"
{% if up.has_write %}checked{% endif %}
/>
</div>
<div class="col-xs-2">
<input
type="checkbox"
name="owner"
id="owner_{{ up.user.uuid }}"
{% if up.has_all %}checked{% endif %}
/>
</div>
<div class="col-xs-2">
<button
type="submit"
style="width:60%;"
class="btn col-xs-2 modify-perm-button"
>
<span class="glyphicon glyphicon-ok"></span>
</button> </button>
</div> </div>
</form> <div class="modal-body">
</div> <p>
{% endfor %} Modify permissions for this package. Note that if you give <code>write</code>
<p></p> permissions to a user or group, <code>read</code> permissions will be granted automatically.
{% for gp in group_permissions %} <br>
<div class="row"> To allow users to perform destructive actions, such as deleting the package, <code>owner</code>
<form permissions must be granted.
id="modal-form-permissions_{{ gp.user.uuid }}" </p>
class="form-inline"
role="form" <div class="row">
accept-charset="UTF-8" <div class="col-xs-4">
action="" <legend>User or Group</legend>
data-remote="true" </div>
method="post" <div class="col-xs-2">
> <legend>Read</legend>
{% csrf_token %} </div>
<div class="col-xs-4"> <div class="col-xs-2">
{{ gp.group.name|safe }} <legend>Write</legend>
<input </div>
type="hidden" <div class="col-xs-2">
name="grantee" <legend>Owner</legend>
value="{{ gp.group.url }}" </div>
/> </div>
</div>
<div class="col-xs-2"> <div class="row">
<input <form id="modal-form-permissions" class="form-inline" role="form" accept-charset="UTF-8" action=""
type="checkbox" data-remote="true" method="post">
name="read" {% csrf_token %}
id="read_{{ gp.group.uuid }}" <div class="col-xs-4">
{% if gp.has_read %}checked{% endif %} <select id="select_grantee" name="grantee" data-actions-box='true'
/> class="selPackages" data-width='100%'>
</div> <option disabled selected>User</option>
<div class="col-xs-2"> {% for u in users %}
<input <option value="{{ u.url }}">{{ u.username }}</option>
type="checkbox" {% endfor %}
name="write" <option disabled>Groups</option>
id="write_{{ gp.group.uuid }}" {% for g in groups %}
{% if gp.has_write %}checked{% endif %} <option value="{{ g.url }}">{{ g.name|safe }}</option>
/> {% endfor %}
</div> </select>
<div class="col-xs-2"> </div>
<input <div class="col-xs-2">
type="checkbox" <input type="checkbox" name="read" id="read_new"/>
name="owner" </div>
id="owner_{{ gp.group.uuid }}" <div class="col-xs-2">
{% if gp.has_all %}checked{% endif %} <input type="checkbox" name="write" id="write_new"/>
/> </div>
</div> <div class="col-xs-2">
<div class="col-xs-2"> <input type="checkbox" name="owner" id="owner_new"/>
<button </div>
type="submit" <div class="col-xs-2">
style="width:60%;" <button type="submit" style="width:60%;" class="btn col-xs-2 modify-perm-button">
class="btn col-xs-2 modify-perm-button" <span class="glyphicon glyphicon-plus"></span>
> </button>
<span class="glyphicon glyphicon-ok"></span> </div>
</button> </form>
</div> </div>
</form> <p></p>
</div> {% for up in user_permissions %}
{% endfor %} <div class="row">
</div> <form id="modal-form-permissions_{{ up.user.uuid }}" class="form-inline" role="form"
<div class="modal-footer"> accept-charset="UTF-8" action="" data-remote="true" method="post">
<button type="button" class="btn btn-secondary" data-dismiss="modal"> {% csrf_token %}
Close <div class="col-xs-4">
</button> {{ up.user.username }}
<button <input type="hidden" name="grantee" value="{{ up.user.url }}"/>
type="button" </div>
class="btn btn-primary" <div class="col-xs-2">
id="edit-package-modal-submit" <input type="checkbox" name="read" id="read_{{ up.user.uuid }}" {% if up.has_read %} checked {% endif %}/>
> </div>
Update <div class="col-xs-2">
</button> <input type="checkbox" name="write" id="write_{{ up.user.uuid }}" {% if up.has_write %} checked {% endif %}/>
</div> </div>
<div class="col-xs-2">
<input type="checkbox" name="owner" id="owner_{{ up.user.uuid }}" {% if up.has_all %} checked {% endif %}/>
</div>
<div class="col-xs-2">
<button type="submit" style="width:60%;" class="btn col-xs-2 modify-perm-button">
<span class="glyphicon glyphicon-ok"></span>
</button>
</div>
</form>
</div>
{% endfor %}
<p></p>
{% for gp in group_permissions %}
<div class="row">
<form id="modal-form-permissions_{{ gp.user.uuid }}" class="form-inline" role="form"
accept-charset="UTF-8" action="" data-remote="true" method="post">
{% csrf_token %}
<div class="col-xs-4">
{{ gp.group.name|safe }}
<input type="hidden" name="grantee" value="{{ gp.group.url }}"/>
</div>
<div class="col-xs-2">
<input type="checkbox" name="read" id="read_{{ gp.group.uuid }}" {% if gp.has_read %} checked {% endif %}/>
</div>
<div class="col-xs-2">
<input type="checkbox" name="write" id="write_{{ gp.group.uuid }}" {% if gp.has_write %} checked {% endif %}/>
</div>
<div class="col-xs-2">
<input type="checkbox" name="owner" id="owner_{{ gp.group.uuid }}" {% if gp.has_all %} checked {% endif %}/>
</div>
<div class="col-xs-2">
<button type="submit" style="width:60%;" class="btn col-xs-2 modify-perm-button">
<span class="glyphicon glyphicon-ok"></span>
</button>
</div>
</form>
</div>
{% endfor %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="edit-package-modal-submit">Update</button>
</div>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
function checkboxClick() {
function checkboxClick() {
// id looks like read_3cadef24-220e-4587-9fa5-0e9a17aca2da // id looks like read_3cadef24-220e-4587-9fa5-0e9a17aca2da
parts = this.id.split("_"); parts = this.id.split('_');
perm = parts[0]; perm = parts[0];
id = parts[1]; id = parts[1];
readbox = "#read_" + id; readbox = '#read_' + id;
writebox = "#write_" + id; writebox = '#write_' + id;
ownerbox = "#owner_" + id; ownerbox = '#owner_' + id;
if (perm == "read" && !$(readbox).prop("checked")) {
$(writebox).prop("checked", false);
$(ownerbox).prop("checked", false);
}
if (perm == "write") { if (perm == 'read' && !$(readbox).prop("checked")) {
if ($(writebox).prop("checked")) { $(writebox).prop("checked", false);
$(readbox).prop("checked", true);
}
if (!$(writebox).prop("checked")) {
$(ownerbox).prop("checked", false); $(ownerbox).prop("checked", false);
}
} }
if (perm == "owner") { if (perm == 'write') {
if ($(ownerbox).prop("checked")) { if ($(writebox).prop("checked")) {
$(readbox).prop("checked", true); $(readbox).prop("checked", true);
$(writebox).prop("checked", true); }
} if (!$(writebox).prop("checked")) {
$(ownerbox).prop("checked", false);
}
} }
}
$(function () { if (perm == 'owner') {
$("#edit-package-modal-submit").click(function (e) { if ($(ownerbox).prop("checked")) {
e.preventDefault(); $(readbox).prop("checked", true);
$("#edit-package-modal-form").submit(); $(writebox).prop("checked", true);
}
}
}
$(function() {
$('#edit-package-modal-submit').click(function(e){
e.preventDefault();
$('#edit-package-modal-form').submit();
}); });
$("#select_grantee").selectpicker(); $("#select_grantee").selectpicker();
// Add click functions to permission checkboxes // Add click functions to permission checkboxes
$('[id^="read_"]').on("click", checkboxClick); $('[id^="read_"]').on('click', checkboxClick);
$('[id^="write_"]').on("click", checkboxClick); $('[id^="write_"]').on('click', checkboxClick);
$('[id^="owner_"]').on("click", checkboxClick); $('[id^="owner_"]').on('click', checkboxClick);
});
})
</script> </script>

View File

@ -1,82 +1,46 @@
{% load static %} {% load static %}
<!-- Edit Package --> <!-- Edit Package -->
<div id="edit_password_modal" class="modal" tabindex="-1"> <div id="edit_password_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Update your Password</h5> <h5 class="modal-title">Update your Password</h5>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> <p>To change your password please fill out the following inputs</p>
<span aria-hidden="true">&times;</span> <form id="edit-password-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
</button> {% csrf_token %}
</div> <p>
<div class="modal-body"> <label for="old-password">Old Password</label>
<p>To change your password please fill out the following inputs</p> <input id="old-password" class="form-control" name="old-password" type="password" autocomplete="current-password">
<form </p>
id="edit-password-modal-form" <p>
accept-charset="UTF-8" <label for="new-password">New Password</label>
action="" <input id="new-password" class="form-control" name="new-password" type="password", autocomplete="new-password">
data-remote="true" </p>
method="post" <p>
> <label for="new-password-repeat">Repeat New Password</label>
{% csrf_token %} <input id="new-password-repeat" class="form-control" name="new-password-repeat" type="password" autocomplete="new-password">
<p> </p>
<label for="old-password">Old Password</label> </form>
<input </div>
id="old-password" <div class="modal-footer">
class="form-control" <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
name="old-password" <button type="button" class="btn btn-primary" id="edit-password-modal-submit">Update</button>
type="password" </div>
autocomplete="current-password" </div>
/>
</p>
<p>
<label for="new-password">New Password</label>
<input
id="new-password"
class="form-control"
name="new-password"
type="password"
,
autocomplete="new-password"
/>
</p>
<p>
<label for="new-password-repeat">Repeat New Password</label>
<input
id="new-password-repeat"
class="form-control"
name="new-password-repeat"
type="password"
autocomplete="new-password"
/>
</p>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="edit-password-modal-submit"
>
Update
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#edit-password-modal-submit").click(function (e) {
e.preventDefault(); $('#edit-password-modal-submit').click(function(e){
$("#edit-password-modal-form").submit(); e.preventDefault();
$('#edit-password-modal-form').submit();
}); });
});
})
</script> </script>

View File

@ -1,72 +1,44 @@
{% load static %} {% load static %}
<!-- Edit Pathway --> <!-- Edit Pathway -->
<div id="edit_pathway_modal" class="modal" tabindex="-1"> <div id="edit_pathway_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Edit Pathway</h5> <h5 class="modal-title">Edit Pathway</h5>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> <p>Edit Pathway.</p>
<span aria-hidden="true">&times;</span> <form id="edit-pathway-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
</button> {% csrf_token %}
</div> <p>
<div class="modal-body"> <label for="pathway-name">Name</label>
<p>Edit Pathway.</p> <input id="pathway-name" class="form-control" name="pathway-name" value="{{ pathway.name|safe }}">
<form </p>
id="edit-pathway-modal-form" <p>
accept-charset="UTF-8" <label for="pathway-description">Description</label>
action="" <textarea id="pathway-description" type="text" class="form-control" name="pathway-description"
data-remote="true" rows="10">{{ pathway.description|safe }}</textarea>
method="post" </p>
> </form>
{% csrf_token %} </div>
<p> <div class="modal-footer">
<label for="pathway-name">Name</label> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<input <button type="button" class="btn btn-primary" id="edit-pathway-modal-submit">Update</button>
id="pathway-name" </div>
class="form-control" </div>
name="pathway-name"
value="{{ pathway.name|safe }}"
/>
</p>
<p>
<label for="pathway-description">Description</label>
<textarea
id="pathway-description"
type="text"
class="form-control"
name="pathway-description"
rows="10"
>
{{ pathway.description|safe }}</textarea
>
</p>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="edit-pathway-modal-submit"
>
Update
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#edit-pathway-modal-submit").click(function (e) {
e.preventDefault(); $('#edit-pathway-modal-submit').click(function(e){
$("#edit-pathway-modal-form").submit(); e.preventDefault();
$('#edit-pathway-modal-form').submit();
}); });
});
})
</script> </script>

View File

@ -1,163 +1,106 @@
{% load static %} {% load static %}
<!-- Edit Package --> <!-- Edit Package -->
<div id="update_prediction_settings_modal" class="modal" tabindex="-1"> <div id="update_prediction_settings_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Update Prediction Setting</h5> <h5 class="modal-title">Update Prediction Setting</h5>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>
To update your prediction setting modify parameters in the form below
und click "Update"
</p>
<form
id="edit-prediction-setting-modal-form"
accept-charset="UTF-8"
action=""
data-remote="true"
method="post"
>
{% csrf_token %}
<div id="prediction-setting" class="panel-collapse in collapse">
<div class="panel-body list-group-item">
<table class="table-bordered table-hover table">
<tr style="background-color: rgba(0, 0, 0, 0.08);">
<th scope="col" width="20%">Parameter</th>
<th scope="col" width="80%">Value</th>
</tr>
<tbody>
{% if 'model' in user.prediction_settings %}
<tr>
<td width="20%">Model</td>
<td width="80%">
<table
width="100%"
class="table-bordered table-hover table"
>
<tbody>
<tr>
<td colspan="2">
<select
id="model"
name="model"
class="form-control"
data-width="100%"
>
{% for m in models %}
<option
value="{{ m.id }}"
{% if user.prediction_settings.model.url == m.url %}selected{% endif %}
>
{{ m.name|safe }}
</option>
{% endfor %}
</select>
</td>
</tr>
{% for k, v in user.prediction_settings.model_parameters.items %}
<tr>
<th width="20%">Model Parameter</th>
<th width="80%">Parameter Value</th>
</tr>
<tr>
<td width="20%">
{% if k == 'threshold' %}
Threshold
{% endif %}
</td>
<td width="80%">
{% if k == 'threshold' %}
<input
type="number"
class="form-control"
name="{{ k }}"
value="{{ v }}"
min="0"
max="1"
step="0.05"
/>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</td>
</tr>
{% endif %}
{% for k, v in user.prediction_settings.truncator.items %}
<tr>
<td>
<p>
{% if k == 'max_nodes' %}
Max Nodes
{% elif k == 'max_depth' %}
Max Depth
{% endif %}
</p>
</td>
<td>
<p>
{% if k == 'max_nodes' %}
<input
type="number"
class="form-control"
name="{{ k }}"
value="{{ v }}"
min="1"
max="50"
step="1"
/>
{% elif k == 'max_depth' %}
<input
type="number"
class="form-control"
name="{{ k }}"
value="{{ v }}"
min="1"
max="8"
step="1"
/>
{% endif %}
</p>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div> </div>
</div> <div class="modal-body">
</form> <p>To update your prediction setting modify parameters in the form below und click "Update"</p>
</div> <form id="edit-prediction-setting-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
<div class="modal-footer"> {% csrf_token %}
<button type="button" class="btn btn-secondary" data-dismiss="modal"> <div id="prediction-setting" class="panel-collapse collapse in">
Close <div class="panel-body list-group-item">
</button>
<button <table class="table table-bordered table-hover">
type="button" <tr style="background-color: rgba(0, 0, 0, 0.08);">
class="btn btn-primary" <th scope="col" width="20%">Parameter</th>
id="edit-prediction-setting-modal-submit" <th scope="col" width="80%">Value</th>
> </tr>
Update <tbody>
</button> {% if 'model' in user.prediction_settings %}
</div> <tr>
<td width="20%">Model</td>
<td width="80%">
<table width="100%" class="table table-bordered table-hover">
<tbody>
<tr>
<td colspan="2">
<select id="model" name="model" class="form-control" data-width='100%'>
{% for m in models %}
<option value="{{ m.id }}" {% if user.prediction_settings.model.url == m.url %}selected{% endif %}>{{ m.name|safe }}</option>
{% endfor %}
</select>
</td>
</tr>
{% for k, v in user.prediction_settings.model_parameters.items %}
<tr>
<th width="20%">Model Parameter</th>
<th width="80%">Parameter Value</th>
</tr>
<tr>
<td width="20%">
{% if k == 'threshold' %}
Threshold
{% endif %}
</td>
<td width="80%">
{% if k == 'threshold' %}
<input type="number" class="form-control" name="{{k}}" value="{{v}}"
min="0" max="1" step="0.05">
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</td>
</tr>
{% endif %}
{% for k, v in user.prediction_settings.truncator.items %}
<tr>
<td><p>
{% if k == 'max_nodes' %}
Max Nodes
{% elif k == 'max_depth' %}
Max Depth
{% endif %}
</p></td>
<td><p>
{% if k == 'max_nodes' %}
<input type="number" class="form-control" name="{{k}}" value="{{v}}" min="1"
max="50" step="1">
{% elif k == 'max_depth' %}
<input type="number" class="form-control" name="{{k}}" value="{{v}}" min="1"
max="8" step="1">
{% endif %}
</p></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="edit-prediction-setting-modal-submit">Update</button>
</div>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#edit-prediction-setting-modal-submit").click(function (e) {
e.preventDefault(); $('#edit-prediction-setting-modal-submit').click(function(e){
$("#edit-prediction-setting-modal-form").submit(); e.preventDefault();
}); $('#edit-prediction-setting-modal-form').submit();
}); });
})
</script> </script>

View File

@ -1,69 +1,45 @@
{% load static %} {% load static %}
<!-- Edit Reaction --> <!-- Edit Reaction -->
<div id="edit_reaction_modal" class="modal" tabindex="-1"> <div id="edit_reaction_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" <h3 class="modal-title">Update Reaction</h3>
aria-label="Close" </div>
> <div class="modal-body">
<span aria-hidden="true">&times;</span> <form id="edit-reaction-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
</button> {% csrf_token %}
<h3 class="modal-title">Update Reaction</h3> <p>
</div> <label for="reaction-name">Name</label>
<div class="modal-body"> <input id="reaction-name" class="form-control" name="reaction-name" value="{{ reaction.name|safe }}">
<form </p>
id="edit-reaction-modal-form" <p>
accept-charset="UTF-8" <label for="reaction-description">Description</label>
action="" <input id="reaction-description" type="text" class="form-control"
data-remote="true" value="{{ reaction.description|safe }}" name="reaction-description">
method="post" </p>
> </form>
{% csrf_token %} </div>
<p> <div class="modal-footer">
<label for="reaction-name">Name</label> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<input <button type="button" class="btn btn-primary" id="edit-reaction-modal-submit">Update</button>
id="reaction-name" </div>
class="form-control" </div>
name="reaction-name"
value="{{ reaction.name|safe }}"
/>
</p>
<p>
<label for="reaction-description">Description</label>
<input
id="reaction-description"
type="text"
class="form-control"
value="{{ reaction.description|safe }}"
name="reaction-description"
/>
</p>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="edit-reaction-modal-submit"
>
Update
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#edit-reaction-modal-submit").click(function (e) {
e.preventDefault(); $('#edit-reaction-modal-submit').click(function(e){
$("#edit-reaction-modal-form").submit(); e.preventDefault();
$('#edit-reaction-modal-form').submit();
}); });
});
});
</script> </script>

View File

@ -1,69 +1,45 @@
{% load static %} {% load static %}
<!-- Edit Rule --> <!-- Edit Rule -->
<div id="edit_rule_modal" class="modal" tabindex="-1"> <div id="edit_rule_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" <h3 class="modal-title">Update Rule</h3>
aria-label="Close" </div>
> <div class="modal-body">
<span aria-hidden="true">&times;</span> <form id="edit-rule-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
</button> {% csrf_token %}
<h3 class="modal-title">Update Rule</h3> <p>
</div> <label for="rule-name">Name</label>
<div class="modal-body"> <input id="rule-name" class="form-control" name="rule-name" value="{{ rule.name|safe }}">
<form </p>
id="edit-rule-modal-form" <p>
accept-charset="UTF-8" <label for="rule-description">Description</label>
action="" <input id="rule-description" type="text" class="form-control"
data-remote="true" value="{{ rule.description|safe }}" name="rule-description">
method="post" </p>
> </form>
{% csrf_token %} </div>
<p> <div class="modal-footer">
<label for="rule-name">Name</label> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<input <button type="button" class="btn btn-primary" id="edit-rule-modal-submit">Update</button>
id="rule-name" </div>
class="form-control" </div>
name="rule-name"
value="{{ rule.name|safe }}"
/>
</p>
<p>
<label for="rule-description">Description</label>
<input
id="rule-description"
type="text"
class="form-control"
value="{{ rule.description|safe }}"
name="rule-description"
/>
</p>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="edit-rule-modal-submit"
>
Update
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#edit-rule-modal-submit").click(function (e) {
e.preventDefault(); $('#edit-rule-modal-submit').click(function(e){
$("#edit-rule-modal-form").submit(); e.preventDefault();
$('#edit-rule-modal-form').submit();
}); });
});
});
</script> </script>

View File

@ -1,110 +1,62 @@
{% load static %} {% load static %}
<!-- Edit User --> <!-- Edit User -->
<div id="edit_user_modal" class="modal" tabindex="-1"> <div id="edit_user_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Update User Defaults</h5> <h5 class="modal-title">Update User Defaults</h5>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> <p>Edit User Defaults.</p>
<span aria-hidden="true">&times;</span> <form id="edit-user-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
</button> {% csrf_token %}
</div> <p>
<div class="modal-body"> <label for="default-package">Default Package</label>
<p>Edit User Defaults.</p> <select id="default-package" name="default-package" class="form-control" data-width='100%'>
<form <option disabled>Select a Package</option>
id="edit-user-modal-form" {% for p in meta.writeable_packages %}
accept-charset="UTF-8" <option value="{{ p.url }}" {% if p.id == meta.user.default_package.id %}selected{% endif %}>{{ p.name|safe }}</option>
action="" {% endfor %}
data-remote="true" </select>
method="post" </p>
> <p>
{% csrf_token %} <label for="default-group">Default Group</label>
<p> <select id="default-group" name="default-group" class="form-control" data-width='100%'>
<label for="default-package">Default Package</label> <option disabled>Select a Group</option>
<select {% for g in meta.available_groups %}
id="default-package" <option value="{{ g.url }}" {% if g.id == meta.user.default_group.id %}selected{% endif %}>{{ g.name|safe }}</option>
name="default-package" {% endfor %}
class="form-control" </select>
data-width="100%" </p>
> <p>
<option disabled>Select a Package</option> <label for="default-prediction-setting">Default Prediction Setting</label>
{% for p in meta.writeable_packages %} <select id="default-prediction-setting" name="default-prediction-setting" class="form-control" data-width='100%'>
<option <option disabled>Select a Setting</option>
value="{{ p.url }}" {% for s in meta.available_settings %}
{% if p.id == meta.user.default_package.id %}selected{% endif %} <option value="{{ s.url }}" {% if s.id == meta.user.default_setting.id %}selected{% endif %}>{{ s.name|safe }}</option>
> {% endfor %}
{{ p.name|safe }} </select>
</option> </p>
{% endfor %} </form>
</select> </div>
</p> <div class="modal-footer">
<p> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<label for="default-group">Default Group</label> <button type="button" class="btn btn-primary" id="edit-user-modal-submit">Update</button>
<select </div>
id="default-group" </div>
name="default-group"
class="form-control"
data-width="100%"
>
<option disabled>Select a Group</option>
{% for g in meta.available_groups %}
<option
value="{{ g.url }}"
{% if g.id == meta.user.default_group.id %}selected{% endif %}
>
{{ g.name|safe }}
</option>
{% endfor %}
</select>
</p>
<p>
<label for="default-prediction-setting"
>Default Prediction Setting</label
>
<select
id="default-prediction-setting"
name="default-prediction-setting"
class="form-control"
data-width="100%"
>
<option disabled>Select a Setting</option>
{% for s in meta.available_settings %}
<option
value="{{ s.url }}"
{% if s.id == meta.user.default_setting.id %}selected{% endif %}
>
{{ s.name|safe }}
</option>
{% endfor %}
</select>
</p>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="edit-user-modal-submit"
>
Update
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#edit-user-modal-submit").click(function (e) {
e.preventDefault(); $('#edit-user-modal-submit').click(function(e){
$("#edit-user-modal-form").submit(); e.preventDefault();
$('#edit-user-modal-form').submit();
}); });
});
})
</script> </script>

View File

@ -1,93 +1,73 @@
<div
class="modal fade"
tabindex="-1"
id="evaluate_model_modal"
role="dialog"
aria-labelledby="evaluate_model_modal"
aria-hidden="true"
>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title">Evaluate Model</h4>
</div>
<div class="modal-body">
<form
id="evaluate_model_form"
accept-charset="UTF-8"
action="{{ current_object.url }}"
data-remote="true"
method="post"
>
{% csrf_token %}
<div class="jumbotron">
For evaluation, you need to select the packages you want to use.
While the model is evaluating, you can use the model for
predictions.
</div>
<!-- Evaluation Packages -->
<label for="model-evaluation-packages">Evaluation Packages</label>
<select
id="model-evaluation-packages"
name="model-evaluation-packages"
data-actions-box="true"
class="form-control"
multiple
data-width="100%"
>
<option disabled>Reviewed Packages</option>
{% for obj in meta.readable_packages %}
{% if obj.reviewed %}
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
{% endif %}
{% endfor %}
<option disabled>Unreviewed Packages</option> <div class="modal fade" tabindex="-1" id="evaluate_model_modal" role="dialog" aria-labelledby="evaluate_model_modal"
{% for obj in meta.readable_packages %} aria-hidden="true">
{% if not obj.reviewed %} <div class="modal-dialog modal-lg">
<option value="{{ obj.url }}">{{ obj.name|safe }}</option> <div class="modal-content">
{% endif %} <div class="modal-header">
{% endfor %} <button type="button" class="close" data-dismiss="modal">
</select> <span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title">Evaluate Model</h4>
</div>
<div class="modal-body">
<form id="evaluate_model_form" accept-charset="UTF-8" action="{{ current_object.url }}"
data-remote="true" method="post">
{% csrf_token %}
<div class="jumbotron">
For evaluation, you need to select the packages you want to use.
While the model is evaluating, you can use the model for predictions.
</div>
<!-- Evaluation Packages -->
<label for="model-evaluation-packages">Evaluation Packages</label>
<select id="model-evaluation-packages" name="model-evaluation-packages" data-actions-box='true'
class="form-control" multiple data-width='100%'>
<option disabled>Reviewed Packages</option>
{% for obj in meta.readable_packages %}
{% if obj.reviewed %}
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
{% endif %}
{% endfor %}
<!-- Eval Type --> <option disabled>Unreviewed Packages</option>
<label for="model-evaluation-type">Evaluation Type</label> {% for obj in meta.readable_packages %}
<select {% if not obj.reviewed %}
id="model-evaluation-type" <option value="{{ obj.url }}">{{ obj.name|safe }}</option>
name="model-evaluation-type" {% endif %}
class="form-control" {% endfor %}
> </select>
<option disabled selected>Select evaluation type</option>
<option value="sg">Single Generation</option>
<option value="mg">Multiple Generations</option>
</select>
<input type="hidden" name="hidden" value="evaluate" /> <!-- Eval Type -->
</form> <label for="model-evaluation-type">Evaluation Type</label>
</div> <select id="model-evaluation-type" name="model-evaluation-type" class="form-control">
<div class="modal-footer"> <option disabled selected>Select evaluation type</option>
<a id="evaluate_model_form_submit" class="btn btn-primary" href="#" <option value="sg">Single Generation</option>
>Evaluate</a <option value="mg">Multiple Generations</option>
> </select>
<button type="button" class="btn btn-default" data-dismiss="modal">
Cancel <input type="hidden" name="hidden" value="evaluate">
</button> </form>
</div> </div>
<div class="modal-footer">
<a id="evaluate_model_form_submit" class="btn btn-primary" href="#">Evaluate</a>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () {
$("#model-evaluation-packages").selectpicker();
$("#evaluate_model_form_submit").on("click", function (e) { $(function () {
e.preventDefault();
$("#evaluate_model_form").submit(); $("#model-evaluation-packages").selectpicker();
$('#evaluate_model_form_submit').on('click', function (e) {
e.preventDefault();
$('#evaluate_model_form').submit();
});
}); });
});
</script> </script>

View File

@ -1,53 +1,36 @@
{% load static %} {% load static %}
<!-- Export Package --> <!-- Export Package -->
<div id="export_package_modal" class="modal" tabindex="-1"> <div id="export_package_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h3 class="modal-title">Export Package as JSON</h3> <h3 class="modal-title">Export Package as JSON</h3>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> By clicking on Export the Package will be serialized into a JSON and directly downloaded.
<span aria-hidden="true">&times;</span> <form id="export-package-modal-form" accept-charset="UTF-8" action="{{ package.url }}"
</button> data-remote="true" method="GET">
</div> <input type="hidden" name="export" value="true"/>
<div class="modal-body"> </form>
By clicking on Export the Package will be serialized into a JSON and </div>
directly downloaded. <div class="modal-footer">
<form <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
id="export-package-modal-form" <button type="button" class="btn btn-primary" id="export-package-modal-form-submit">Export</button>
accept-charset="UTF-8" </div>
action="{{ package.url }}" </div>
data-remote="true"
method="GET"
>
<input type="hidden" name="export" value="true" />
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="export-package-modal-form-submit"
>
Export
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function () {
$("#export-package-modal-form-submit").click(function (e) {
e.preventDefault(); $('#export-package-modal-form-submit').click(function (e) {
$("#export-package-modal-form").submit(); e.preventDefault();
$("#export_package_modal").modal("hide"); $('#export-package-modal-form').submit();
}); $('#export_package_modal').modal('hide');
}); });
})
</script> </script>

View File

@ -1,109 +1,75 @@
{% load static %} {% load static %}
<!-- Copy Object --> <!-- Copy Object -->
<div id="generic_copy_object_modal" class="modal" tabindex="-1"> <div id="generic_copy_object_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h3 class="modal-title">Copy {{ object_type|capfirst }}</h3> <h3 class="modal-title">Copy {{ object_type|capfirst }}</h3>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> <form id="generic-copy-object-modal-form" accept-charset="UTF-8" data-remote="true" method="post">
<span aria-hidden="true">&times;</span> {% csrf_token %}
</button> <label for="target-package">Select the Target Package you want to copy this {{ object_type }}
</div> into</label>
<div class="modal-body"> <select id="target-package" name="target-package" data-actions-box='true' class="form-control"
<form data-width='100%'>
id="generic-copy-object-modal-form" <option disabled selected>Select Target Package</option>
accept-charset="UTF-8" {% for p in meta.writeable_packages %}
data-remote="true" <option value="{{ p.url }}">{{ p.name|safe }}</option>`
method="post" {% endfor %}
> </select>
{% csrf_token %} <input type="hidden" name="hidden" value="copy">
<label for="target-package" </form>
>Select the Target Package you want to copy this {{ object_type }} <div id="copy-object-error-message" class="alert alert-danger" role="alert" style="display: none">
into</label </div>
> </div>
<select <div class="modal-footer">
id="target-package" <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
name="target-package" <button type="button" class="btn btn-primary" id="generic-copy-object-modal-form-submit">
data-actions-box="true" Copy
class="form-control" </button>
data-width="100%" </div>
> </div>
<option disabled selected>Select Target Package</option>
{% for p in meta.writeable_packages %}
<option value="{{ p.url }}">{{ p.name|safe }}</option>
`
{% endfor %}
</select>
<input type="hidden" name="hidden" value="copy" />
</form>
<div
id="copy-object-error-message"
class="alert alert-danger"
role="alert"
style="display: none"
></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="generic-copy-object-modal-form-submit"
>
Copy
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function () {
$("#generic-copy-object-modal-form-submit").click(function (e) {
e.preventDefault();
$("#copy-object-error-message").hide();
const packageUrl = $("#target-package").find(":selected").val(); $('#generic-copy-object-modal-form-submit').click(function (e) {
e.preventDefault();
$('#copy-object-error-message').hide()
if ( const packageUrl = $('#target-package').find(":selected").val();
packageUrl === "Select Target Package" ||
packageUrl === "" ||
packageUrl === null ||
packageUrl === undefined
) {
return;
}
const formData = {
hidden: "copy",
object_to_copy: "{{ current_object.url }}",
};
$.ajax({ if (packageUrl === 'Select Target Package' || packageUrl === '' || packageUrl === null || packageUrl === undefined) {
type: "post", return;
data: formData, }
url: packageUrl, const formData = {
success: function (data, textStatus) { hidden: 'copy',
window.location.href = data.success; object_to_copy: '{{ current_object.url }}',
}, }
error: function (jqXHR, textStatus, errorThrown) {
if (jqXHR.responseJSON.error.indexOf("to the same package") > -1) { $.ajax({
$("#copy-object-error-message").append( type: 'post',
"<p>The target Package is the same as the source Package. Please select another target!</p>", data: formData,
); url: packageUrl,
} else { success: function (data, textStatus) {
$("#copy-object-error-message").append( window.location.href = data.success;
"<p>" + jqXHR.responseJSON.error + "</p>", },
); error: function (jqXHR, textStatus, errorThrown) {
} if (jqXHR.responseJSON.error.indexOf('to the same package') > -1) {
$("#copy-object-error-message").show(); $('#copy-object-error-message').append('<p>The target Package is the same as the source Package. Please select another target!</p>');
}, } else {
}); $('#copy-object-error-message').append('<p>' + jqXHR.responseJSON.error + '</p>');
}); }
}); $('#copy-object-error-message').show();
}
});
});
})
</script> </script>

View File

@ -1,58 +1,42 @@
{% load static %} {% load static %}
<!-- Delete Object --> <!-- Delete Object -->
<div id="generic_delete_modal" class="modal" tabindex="-1"> <div id="generic_delete_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h3 class="modal-title">Delete {{ object_type|capfirst }}</h3> <h3 class="modal-title">Delete {{ object_type|capfirst }}</h3>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> {% if object_type == 'user' %}
<span aria-hidden="true">&times;</span> Clicking "Delete" will <strong>permanently</strong> delete the User and associated data.
</button> This action can't be undone!
</div> {% else %}
<div class="modal-body"> Deletes the {{ object_type|capfirst }}. Related objects that depend on this {{ object_type|capfirst }}
{% if object_type == 'user' %} will be deleted as well.
Clicking "Delete" will <strong>permanently</strong> delete the User {% endif %}
and associated data. This action can't be undone! <form id="generic-delete-modal-form" accept-charset="UTF-8" action="{{ current_object.url }}"
{% else %} data-remote="true" method="post">
Deletes the {{ object_type|capfirst }}. Related objects that depend on {% csrf_token %}
this {{ object_type|capfirst }} will be deleted as well. <input type="hidden" id="hidden" name="hidden" value="delete"/>
{% endif %} </form>
<form </div>
id="generic-delete-modal-form" <div class="modal-footer">
accept-charset="UTF-8" <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
action="{{ current_object.url }}" <button type="button" class="btn btn-primary" id="generic-delete-modal-form-submit">Delete</button>
data-remote="true" </div>
method="post" </div>
>
{% csrf_token %}
<input type="hidden" id="hidden" name="hidden" value="delete" />
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="generic-delete-modal-form-submit"
>
Delete
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function () {
$("#generic-delete-modal-form-submit").click(function (e) {
e.preventDefault(); $('#generic-delete-modal-form-submit').click(function (e) {
$("#generic-delete-modal-form").submit(); e.preventDefault();
}); $('#generic-delete-modal-form').submit();
}); });
})
</script> </script>

View File

@ -1,213 +1,170 @@
{% load static %} {% load static %}
<style> <style>
.alias-container { .alias-container {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-items: center; align-items: center;
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 4px; border-radius: 4px;
padding: 4px 6px; padding: 4px 6px;
cursor: text; cursor: text;
min-height: 38px; min-height: 38px;
background-color: #fff; background-color: #fff;
}
.alias {
display: inline-flex;
align-items: center;
background-color: #5bc0de;
color: white;
padding: 4px 8px;
margin: 3px 3px;
border-radius: 4px;
font-size: 13px;
line-height: 1.4;
}
.alias .remove {
margin-left: 6px;
cursor: pointer;
font-weight: bold;
line-height: 1;
}
.alias-input {
flex: 1;
min-width: 120px;
border: none;
outline: none;
margin: 3px 3px;
font-size: 14px;
}
.form-control.alias-container {
height: auto;
box-shadow: none;
}
</style>
<div
class="modal fade bs-modal-lg"
id="set_aliases_modal"
tabindex="-1"
aria-labelledby="set_aliases_modal"
aria-modal="true"
role="dialog"
>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">
Set Aliases for {{ current_object.name|safe }}
</h4>
</div>
<div class="modal-body">
<form
id="set_aliases_modal_form"
accept-charset="UTF-8"
action="{{ current_object.url }}"
data-remote="true"
method="post"
>
{% csrf_token %}
<label for="alias-input">Aliases:</label>
<div class="form-control alias-container" id="alias-box">
{% for alias in current_object.aliases %}
<span class="alias"
>{{ alias|escape }}<span class="remove">&times;</span></span
>
{% endfor %}
<input
type="text"
id="alias-input"
class="alias-input"
placeholder="Add Alias..."
/>
</div>
</form>
<div
id="add-alias-error-message"
class="alert alert-danger"
role="alert"
style="display: none"
></div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary pull-left"
data-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
id="set_aliases_modal_form_submit"
>
Submit
</button>
</div>
</div>
</div>
</div>
<script>
$(function () {
function addAlias(aliasText) {
aliasText = aliasText.trim();
if (aliasText === "") return;
// Avoid duplicate aliass
var exists = false;
$("#alias-box .alias").each(function () {
if (
$(this).text().replace("×", "").trim().toLowerCase() ===
aliasText.toLowerCase()
) {
exists = true;
return false;
}
});
if (!exists) {
var aliasHtml =
'<span class="alias">' +
$("<div>").text(aliasText).html() +
'<span class="remove">&times;</span></span>';
$(aliasHtml).insertBefore("#alias-input");
}
$("#alias-input").val("");
} }
// Add alias when Enter is pressed .alias {
$("#alias-input").on("keypress", function (e) { display: inline-flex;
if (e.which === 13) { align-items: center;
e.preventDefault(); background-color: #5bc0de;
addAlias($(this).val()); color: white;
} padding: 4px 8px;
margin: 3px 3px;
border-radius: 4px;
font-size: 13px;
line-height: 1.4;
}
.alias .remove {
margin-left: 6px;
cursor: pointer;
font-weight: bold;
line-height: 1;
}
.alias-input {
flex: 1;
min-width: 120px;
border: none;
outline: none;
margin: 3px 3px;
font-size: 14px;
}
.form-control.alias-container {
height: auto;
box-shadow: none;
}
</style>
<div class="modal fade bs-modal-lg" id="set_aliases_modal" tabindex="-1" aria-labelledby="set_aliases_modal"
aria-modal="true" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">Set Aliases for {{ current_object.name|safe }}</h4>
</div>
<div class="modal-body">
<form id="set_aliases_modal_form" accept-charset="UTF-8" action="{{ current_object.url }}"
data-remote="true" method="post">
{% csrf_token %}
<label for="alias-input">Aliases:</label>
<div class="form-control alias-container" id="alias-box">
{% for alias in current_object.aliases %}
<span class="alias">{{ alias|escape }}<span class="remove">&times;</span></span>
{% endfor %}
<input type="text" id="alias-input" class="alias-input" placeholder="Add Alias...">
</div>
</form>
<div id="add-alias-error-message" class="alert alert-danger" role="alert" style="display: none">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="set_aliases_modal_form_submit">Submit</button>
</div>
</div>
</div>
</div>
<script>
$(function () {
function addAlias(aliasText) {
aliasText = aliasText.trim();
if (aliasText === '') return;
// Avoid duplicate aliass
var exists = false;
$('#alias-box .alias').each(function () {
if ($(this).text().replace('×', '').trim().toLowerCase() === aliasText.toLowerCase()) {
exists = true;
return false;
}
});
if (!exists) {
var aliasHtml = '<span class="alias">' + $('<div>').text(aliasText).html() +
'<span class="remove">&times;</span></span>';
$(aliasHtml).insertBefore('#alias-input');
}
$('#alias-input').val('');
}
// Add alias when Enter is pressed
$('#alias-input').on('keypress', function (e) {
if (e.which === 13) {
e.preventDefault();
addAlias($(this).val());
}
});
// Add alias when input loses focus
$('#alias-input').on('blur', function () {
var val = $(this).val();
if (val.trim() !== '') {
addAlias(val);
}
});
// Remove alias when clicking ×
$('#alias-box').on('click', '.remove', function () {
$(this).closest('.alias').remove();
});
// Focus input when clicking the container
$('#alias-box').on('click', function () {
$('#alias-input').focus();
});
$('#set_aliases_modal_form_submit').on('click', function (e) {
e.preventDefault();
let aliases = [];
$('#alias-box .alias').each(function () {
aliases.push($(this).text().replace('×', '').trim())
});
if (aliases.length === 0) {
// Set empty string for deletion of all aliases
// If empty list is sent, its gets removed entirely from post data
aliases = ['']
}
formData = {
'aliases': aliases
}
$.ajax({
type: 'post',
data: formData,
url: '{{ current_object.url }}',
traditional: true,
success: function (data, textStatus) {
window.location.href = data.success;
},
error: function (jqXHR, textStatus, errorThrown) {
$('#add-alias-error-message').append('<p>Setting aliases failed!</p>');
$('#add-alias-error-message').show(); }
});
});
}); });
// Add alias when input loses focus
$("#alias-input").on("blur", function () {
var val = $(this).val();
if (val.trim() !== "") {
addAlias(val);
}
});
// Remove alias when clicking ×
$("#alias-box").on("click", ".remove", function () {
$(this).closest(".alias").remove();
});
// Focus input when clicking the container
$("#alias-box").on("click", function () {
$("#alias-input").focus();
});
$("#set_aliases_modal_form_submit").on("click", function (e) {
e.preventDefault();
let aliases = [];
$("#alias-box .alias").each(function () {
aliases.push($(this).text().replace("×", "").trim());
});
if (aliases.length === 0) {
// Set empty string for deletion of all aliases
// If empty list is sent, its gets removed entirely from post data
aliases = [""];
}
formData = {
aliases: aliases,
};
$.ajax({
type: "post",
data: formData,
url: "{{ current_object.url }}",
traditional: true,
success: function (data, textStatus) {
window.location.href = data.success;
},
error: function (jqXHR, textStatus, errorThrown) {
$("#add-alias-error-message").append(
"<p>Setting aliases failed!</p>",
);
$("#add-alias-error-message").show();
},
});
});
});
</script> </script>

View File

@ -1,97 +1,61 @@
{% load static %} {% load static %}
<!-- Delete Object --> <!-- Delete Object -->
<div id="generic_set_external_reference_modal" class="modal" tabindex="-1"> <div id="generic_set_external_reference_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h3 class="modal-title">Add External References</h3> <h3 class="modal-title">Add External References</h3>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> <form id="generic-set-external-reference-modal-form" accept-charset="UTF-8"
<span aria-hidden="true">&times;</span> action="{{ current_object.url }}"
</button> data-remote="true" method="post">
</div> {% csrf_token %}
<div class="modal-body"> <label for="database-select">Select the Database you want to attach an External Reference
<form for</label>
id="generic-set-external-reference-modal-form" <select id="database-select" name="selected-database" data-actions-box='true' class="form-control"
accept-charset="UTF-8" data-width='100%'>
action="{{ current_object.url }}" <option disabled selected>Select Database</option>
data-remote="true" {% for entity, databases in meta.external_databases.items %}
method="post" {% if entity == object_type %}
> {% for db in databases %}
{% csrf_token %} <option id="db-select-{{ db.database.pk }}" data-input-placeholder="{{ db.placeholder }}"
<label for="database-select" value="{{ db.database.id }}">{{ db.database.name|safe }}</option>`
>Select the Database you want to attach an External Reference {% endfor %}
for</label {% endif %}
> {% endfor %}
<select </select>
id="database-select" <p></p>
name="selected-database" <div id="input-div" style="display: none">
data-actions-box="true" <label for="identifier" >The reference</label>
class="form-control" <input type="text" id="identifier" name="identifier" class="form-control" placeholder="">
data-width="100%" </div>
> </form>
<option disabled selected>Select Database</option> </div>
{% for entity, databases in meta.external_databases.items %} <div class="modal-footer">
{% if entity == object_type %} <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
{% for db in databases %} <button type="button" class="btn btn-primary" id="generic-set-external-reference-modal-form-submit">Submit</button>
<option </div>
id="db-select-{{ db.database.pk }}" </div>
data-input-placeholder="{{ db.placeholder }}"
value="{{ db.database.id }}"
>
{{ db.database.name|safe }}
</option>
`
{% endfor %}
{% endif %}
{% endfor %}
</select>
<p></p>
<div id="input-div" style="display: none">
<label for="identifier">The reference</label>
<input
type="text"
id="identifier"
name="identifier"
class="form-control"
placeholder=""
/>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="generic-set-external-reference-modal-form-submit"
>
Submit
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function () {
$("#database-select").on("change", function () {
let selected = $(this).val();
$("#identifier").attr(
"placeholder",
$("#db-select-" + selected).data("input-placeholder"),
);
$("#input-div").show();
});
$("#generic-set-external-reference-modal-form-submit").click(function (e) { $("#database-select").on("change", function () {
e.preventDefault(); let selected = $(this).val();
$("#generic-set-external-reference-modal-form").submit(); $("#identifier").attr("placeholder", $('#db-select-' + selected).data('input-placeholder'));
}); $("#input-div").show();
}); });
$('#generic-set-external-reference-modal-form-submit').click(function (e) {
e.preventDefault();
$('#generic-set-external-reference-modal-form').submit();
});
})
</script> </script>

View File

@ -1,71 +1,37 @@
{% load static %} {% load static %}
<div <div class="modal fade bs-modal-lg" id="set_scenario_modal" tabindex="-1" aria-labelledby="set_scenario_modal"
class="modal fade bs-modal-lg" aria-modal="true" role="dialog">
id="set_scenario_modal" <div class="modal-dialog modal-lg">
tabindex="-1" <div class="modal-content">
aria-labelledby="set_scenario_modal" <div class="modal-header">
aria-modal="true" <button type="button" class="close" data-dismiss="modal" aria-label="Close">
role="dialog" <span aria-hidden="true">×</span>
> </button>
<div class="modal-dialog modal-lg"> <h4 class="modal-title">Set Scenarios for {{ current_object.name|safe }}</h4>
<div class="modal-content"> </div>
<div class="modal-header"> <div class="modal-body">
<button <div id="loading_scenario_div" class="text-center"></div>
type="button" <form id="set_scenario_modal_form" accept-charset="UTF-8" action="{{ current_object.url }}"
class="close" data-remote="true" method="post">
data-dismiss="modal" {% csrf_token %}
aria-label="Close" <label for="scenario-select">Scenarios</label>
> <select id="scenario-select" name="selected-scenarios" data-actions-box='true' class="form-control"
<span aria-hidden="true">×</span> multiple data-width='100%'>
</button> <option disabled>Select Scenarios</option>
<h4 class="modal-title"> <option value="" hidden></option>
Set Scenarios for {{ current_object.name|safe }} </select>
</h4> </form>
</div> </div>
<div class="modal-body"> <div class="modal-footer">
<div id="loading_scenario_div" class="text-center"></div> <button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close
<form </button>
id="set_scenario_modal_form" <button type="button" class="btn btn-primary" id="set_scenario_modal_form_submit">Submit</button>
accept-charset="UTF-8" </div>
action="{{ current_object.url }}" </div>
data-remote="true"
method="post"
>
{% csrf_token %}
<label for="scenario-select">Scenarios</label>
<select
id="scenario-select"
name="selected-scenarios"
data-actions-box="true"
class="form-control"
multiple
data-width="100%"
>
<option disabled>Select Scenarios</option>
<option value="" hidden></option>
</select>
</form>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary pull-left"
data-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
id="set_scenario_modal_form_submit"
>
Submit
</button>
</div>
</div> </div>
</div>
</div> </div>
{# prettier-ignore-start #}
<script> <script>
$(function () { $(function () {
@ -109,4 +75,3 @@
}); });
</script> </script>
{# prettier-ignore-end #}

View File

@ -1,75 +1,54 @@
{% load static %} {% load static %}
<!-- Identify Missing Rules --> <!-- Identify Missing Rules -->
<div id="identify_missing_rules_modal" class="modal" tabindex="-1"> <div id="identify_missing_rules_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h3 class="modal-title">Identify Missing Rules</h3> <h3 class="modal-title">Identify Missing Rules</h3>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> By clicking on Download we'll search the Pathway for Reactions that are not backed by
<span aria-hidden="true">&times;</span> a Rule or which can be assembled by chaining two rules.
</button> <form id="identify-missing-rules-modal-form" accept-charset="UTF-8" action="{{ pathway.url }}"
</div> data-remote="true" method="GET">
<div class="modal-body"> <label for="rule-package">Select the Rule Package</label>
By clicking on Download we'll search the Pathway for Reactions that are <select id="rule-package" name="rule-package" data-actions-box='true' class="form-control"
not backed by a Rule or which can be assembled by chaining two rules. data-width='100%'>
<form <option disabled>Reviewed Packages</option>
id="identify-missing-rules-modal-form" {% for obj in meta.readable_packages %}
accept-charset="UTF-8" {% if obj.reviewed %}
action="{{ pathway.url }}" <option value="{{ obj.url }}">{{ obj.name }}</option>
data-remote="true" {% endif %}
method="GET" {% endfor %}
>
<label for="rule-package">Select the Rule Package</label>
<select
id="rule-package"
name="rule-package"
data-actions-box="true"
class="form-control"
data-width="100%"
>
<option disabled>Reviewed Packages</option>
{% for obj in meta.readable_packages %}
{% if obj.reviewed %}
<option value="{{ obj.url }}">{{ obj.name }}</option>
{% endif %}
{% endfor %}
<option disabled>Unreviewed Packages</option> <option disabled>Unreviewed Packages</option>
{% for obj in meta.readable_packages %} {% for obj in meta.readable_packages %}
{% if not obj.reviewed %} {% if not obj.reviewed %}
<option value="{{ obj.url }}">{{ obj.name }}</option> <option value="{{ obj.url }}">{{ obj.name }}</option>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</select> </select>
<input type="hidden" name="identify-missing-rules" value="true" /> <input type="hidden" name="identify-missing-rules" value="true"/>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
Close <button type="button" class="btn btn-primary" id="identify-missing-rules-modal-submit">Download</button>
</button> </div>
<button </div>
type="button"
class="btn btn-primary"
id="identify-missing-rules-modal-submit"
>
Download
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function () {
$("#identify-missing-rules-modal-submit").click(function (e) {
e.preventDefault(); $('#identify-missing-rules-modal-submit').click(function (e) {
$("#identify-missing-rules-modal-form").submit(); e.preventDefault();
$("#identify_missing_rules_modal").modal("hide"); $('#identify-missing-rules-modal-form').submit();
}); $('#identify_missing_rules_modal').modal('hide');
}); });
})
</script> </script>

View File

@ -1,118 +1,92 @@
<div
class="modal fade" <div class="modal fade"
tabindex="-1" tabindex="-1"
id="manage_api_token_modal" id="manage_api_token_modal"
role="dialog" role="dialog"
aria-labelledby="manage_api_token_modal" aria-labelledby="manage_api_token_modal"
aria-hidden="true" aria-hidden="true">
> <div class="modal-dialog">
<div class="modal-dialog"> <div class="modal-content">
<div class="modal-content"> <div class="modal-header">
<div class="modal-header"> <button type="button"
<button type="button" class="close" data-dismiss="modal"> class="close"
<span aria-hidden="true">&times;</span> data-dismiss="modal">
<span class="sr-only">Close</span> <span aria-hidden="true">&times;</span>
</button> <span class="sr-only">Close</span>
<h3 class="modal-title">Manage API Token</h3> </button>
</div> <h3 class="modal-title">Manage API Token</h3>
<div class="modal-body"> </div>
<p> <div class="modal-body">
Requesting a Token will invalidate all potential existing tokens. The <p>Requesting a Token will invalidate all potential existing tokens. The new token will only be shown once, so ensure to store it in secure place</p>
new token will only be shown once, so ensure to store it in secure <form id="request_api_token_form"
place accept-charset="UTF-8"
</p> action=""
<form data-remote="true"
id="request_api_token_form" method="post">
accept-charset="UTF-8" {% csrf_token %}
action="" <p>
data-remote="true" <label for="token-name">Name</label>
method="post" <input type="text" id="token-name" class="form-control" name="name" placeholder="Generic Token for {{ meta.user.username }}"/>
> <label for="valid-for">Valid for (in days)</label>
{% csrf_token %} <input type="number" id="valid-for" class="form-control" name="valid-for" value="90"/>
<p> <input type="hidden" name="hidden" value="request-api-token">
<label for="token-name">Name</label> </p>
<input </form>
type="text" <div id="new-token">
id="token-name" <pre id="new-token-pre"></pre>
class="form-control" </div>
name="name" <div id="existing-tokens">
placeholder="Generic Token for {{ meta.user.username }}" {% for t in tokens %}
/> <form id="delete-token-{{ forloop.counter0 }}" accept-charset="UTF-8" action="{{ meta.user.url }}" data-remote="true" method="post">
<label for="valid-for">Valid for (in days)</label> {% csrf_token %}
<input <div class="input-group">
type="number" <input type="hidden" name="hidden" value="delete">
id="valid-for" <input type="hidden" name="token-id" value="{{ t.pk }}">
class="form-control" <input type="text" class="form-control" value="{{ t.name|safe }}" disabled>
name="valid-for" <span class="input-group-btn">
value="90" <button type="submit" class="btn btn-danger">Delete</button>
/> </span>
<input type="hidden" name="hidden" value="request-api-token" /> </div>
</p> </form>
</form> {% endfor %}
<div id="new-token"> </div>
<pre id="new-token-pre"></pre> </div>
<div class="modal-footer">
<a id="manage_api_token_form_submit"
class="btn btn-primary"
href="#">Submit</a>
<button type="button"
class="btn btn-default"
data-dismiss="modal">Cancel
</button>
</div>
</div> </div>
<div id="existing-tokens">
{% for t in tokens %}
<form
id="delete-token-{{ forloop.counter0 }}"
accept-charset="UTF-8"
action="{{ meta.user.url }}"
data-remote="true"
method="post"
>
{% csrf_token %}
<div class="input-group">
<input type="hidden" name="hidden" value="delete" />
<input type="hidden" name="token-id" value="{{ t.pk }}" />
<input
type="text"
class="form-control"
value="{{ t.name|safe }}"
disabled
/>
<span class="input-group-btn">
<button type="submit" class="btn btn-danger">Delete</button>
</span>
</div>
</form>
{% endfor %}
</div>
</div>
<div class="modal-footer">
<a id="manage_api_token_form_submit" class="btn btn-primary" href="#"
>Submit</a
>
<button type="button" class="btn btn-default" data-dismiss="modal">
Cancel
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#new-token").hide(); $('#new-token').hide()
$("#manage_api_token_form_submit").on("click", function (e) { $('#manage_api_token_form_submit').on('click', function (e) {
e.preventDefault(); e.preventDefault();
const formData = $("#request_api_token_form").serialize(); const formData = $('#request_api_token_form').serialize();
$.post("", formData, function (response) { $.post('', formData, function(response) {
$("#new-token-pre").text(response.raw_token); $('#new-token-pre').text(response.raw_token);
$("#new-token").show(); $('#new-token').show();
}); });
}); });
// Select all elements that start with 'delete-token-' // Select all elements that start with 'delete-token-'
$("[id^='delete-token-']").on("submit", function (e) { $("[id^='delete-token-']").on("submit", function(e) {
e.preventDefault(); e.preventDefault();
const formData = $(this).serialize(); const formData = $(this).serialize();
const form = $(this); const form = $(this);
$.post(this.action, formData, function (response) { $.post(this.action, formData, function(response) {
console.log(this); console.log(this);
form.remove(); form.remove();
}); });
}); });
});
});
</script> </script>

View File

@ -1,52 +1,35 @@
{% load static %} {% load static %}
<!-- Publish a Package --> <!-- Publish a Package -->
<div id="publish_package_modal" class="modal" tabindex="-1"> <div id="publish_package_modal" class="modal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">Publish Package</h5> <h5 class="modal-title">Publish Package</h5>
<button <button type="button" class="close" data-dismiss="modal" aria-label="Close">
type="button" <span aria-hidden="true">&times;</span>
class="close" </button>
data-dismiss="modal" </div>
aria-label="Close" <div class="modal-body">
> <p>Clicking on Publish will make this Package publicly available!</p>
<span aria-hidden="true">&times;</span> <form id="publish-package-modal-form" accept-charset="UTF-8" action="{{ current_package.url }}" data-remote="true" method="post">
</button> {% csrf_token %}
</div> <input type="hidden" name="hidden" value="publish-package">
<div class="modal-body"> </form>
<p>Clicking on Publish will make this Package publicly available!</p> </div>
<form <div class="modal-footer">
id="publish-package-modal-form" <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
accept-charset="UTF-8" <button type="button" class="btn btn-primary" id="publish-package-modal-form-submit">Publish</button>
action="{{ current_package.url }}" </div>
data-remote="true" </div>
method="post"
>
{% csrf_token %}
<input type="hidden" name="hidden" value="publish-package" />
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="publish-package-modal-form-submit"
>
Publish
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#publish-package-modal-form-submit").click(function (e) {
e.preventDefault(); $('#publish-package-modal-form-submit').click(function(e){
$("#publish-package-modal-form").submit(); e.preventDefault();
$('#publish-package-modal-form').submit();
}); });
});
})
</script> </script>

View File

@ -1,55 +1,43 @@
<div <div class="modal fade" tabindex="-1" id="retrain_model_modal" role="dialog" aria-labelledby="retrain_model_modal"
class="modal fade" aria-hidden="true">
tabindex="-1" <div class="modal-dialog modal-lg">
id="retrain_model_modal" <div class="modal-content">
role="dialog" <div class="modal-header">
aria-labelledby="retrain_model_modal" <button type="button" class="close" data-dismiss="modal">
aria-hidden="true" <span aria-hidden="true">&times;</span>
> <span class="sr-only">Close</span>
<div class="modal-dialog modal-lg"> </button>
<div class="modal-content"> <h4 class="modal-title">Retrain Model</h4>
<div class="modal-header"> </div>
<button type="button" class="close" data-dismiss="modal"> <div class="modal-body">
<span aria-hidden="true">&times;</span> <form id="retrain_model_form" accept-charset="UTF-8" action="{{ meta.current_package.url }}/model"
<span class="sr-only">Close</span> data-remote="true" method="post">
</button> <div class="jumbotron">
<h4 class="modal-title">Retrain Model</h4> To reflect changes in the rule or data packages, you can use the "Retrain" button,
</div> to let the model reflect the changes without creating a new model.
<div class="modal-body"> While the model is retraining, it will be unavailable for prediction.
<form </div>
id="retrain_model_form" {% csrf_token %}
accept-charset="UTF-8" <input type="hidden" name="action" value="retrain">
action="{{ meta.current_object.url }}" </form>
data-remote="true" </div>
method="post" <div class="modal-footer">
> <a id="retrain_model_form_submit" class="btn btn-primary" href="#">Retrain</a>
<div class="jumbotron"> <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
To reflect changes in the rule or data packages, you can use the </div>
"Retrain" button, to let the model reflect the changes without </div>
creating a new model. While the model is retraining, it will be
unavailable for prediction.
</div>
{% csrf_token %}
<input type="hidden" name="hidden" value="retrain" />
</form>
</div>
<div class="modal-footer">
<a id="retrain_model_form_submit" class="btn btn-primary" href="#"
>Retrain</a
>
<button type="button" class="btn btn-default" data-dismiss="modal">
Cancel
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () {
$("#retrain_model_form_submit").on("click", function (e) { $(function () {
e.preventDefault();
$("#retrain_model_form").submit(); $('#retrain_model_form_submit').on('click', function (e) {
e.preventDefault();
$('#retrain_model_form').submit();
});
}); });
});
</script> </script>

View File

@ -1,198 +1,153 @@
<div <div class="modal fade"
class="modal fade" tabindex="-1"
tabindex="-1" id="set_license_modal"
id="set_license_modal" role="dialog"
role="dialog" aria-labelledby="set_license_modal"
aria-labelledby="set_license_modal" aria-hidden="true">
aria-hidden="true" <div class="modal-dialog">
> <div class="modal-content">
<div class="modal-dialog"> <div class="modal-header">
<div class="modal-content"> <button type="button"
<div class="modal-header"> class="close"
<button type="button" class="close" data-dismiss="modal"> data-dismiss="modal">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span> <span class="sr-only">Close</span>
</button> </button>
<h3 class="modal-title">Set License</h3> <h3 class="modal-title">Set License</h3>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="row"> <div class="row">
<div class="col-md-9"> <div class="col-md-9">
<p> <p>
Set the license for all data in this package: Set the license for all data in this package:
<br /> <br> <br>
<br /> (For more information please visit our <a target="#"
(For more information please visit our href="https://wiki.envipath.org/index.php/License">wiki</a>.)
<a target="#" href="https://wiki.envipath.org/index.php/License" </p>
>wiki</a </div>
>.) <div class="col-md-3">
</p> <div id="ccfig"></div>
</div> </div>
<div class="col-md-3"> </div>
<div id="ccfig"></div> <form id="set_license_form" accept-charset="UTF-8" action="" data-remote="true" method="post">
</div> {% csrf_token %}
<div class="input-group">
<div class="radio">
<label><input type="radio" name="optlicense" onclick="cc()" id="ccradio">Creative commons license</label>
</div>
<div>
<div class="checkbox">
<label><input type="checkbox" value="" onclick="cc()" id="ccremix" disabled>Allow adaptations of your work to be shared</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="" onclick="cc()" id="ccnocom" disabled>Prohibit commercial use</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="" onclick="cc()" id="ccalike" disabled>Share only if others share alike</label>
</div>
</div>
<div class="radio">
<label><input type="radio" name="optlicense" onclick="cc()" id="noccradio">No creative commons license, contact package owner for license information</label>
</div>
</div>
<input type="hidden" id="license" name="license">
<input type="hidden" id="license-link" name="license-link">
<input type="hidden" id="license-image-link" name="license-image-link">
</form>
</div>
<div class="modal-footer">
<button id="set_license_form_submit" class="btn btn-primary">Submit</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</div> </div>
<form
id="set_license_form"
accept-charset="UTF-8"
action=""
data-remote="true"
method="post"
>
{% csrf_token %}
<div class="input-group">
<div class="radio">
<label
><input
type="radio"
name="optlicense"
onclick="cc()"
id="ccradio"
/>Creative commons license</label
>
</div>
<div>
<div class="checkbox">
<label
><input
type="checkbox"
value=""
onclick="cc()"
id="ccremix"
disabled
/>Allow adaptations of your work to be shared</label
>
</div>
<div class="checkbox">
<label
><input
type="checkbox"
value=""
onclick="cc()"
id="ccnocom"
disabled
/>Prohibit commercial use</label
>
</div>
<div class="checkbox">
<label
><input
type="checkbox"
value=""
onclick="cc()"
id="ccalike"
disabled
/>Share only if others share alike</label
>
</div>
</div>
<div class="radio">
<label
><input
type="radio"
name="optlicense"
onclick="cc()"
id="noccradio"
/>No creative commons license, contact package owner for license
information</label
>
</div>
</div>
<input type="hidden" id="license" name="license" />
</form>
</div>
<div class="modal-footer">
<button id="set_license_form_submit" class="btn btn-primary">
Submit
</button>
<button type="button" class="btn btn-default" data-dismiss="modal">
Cancel
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
function ccstring(ccremix, ccnocom, ccalike) {
function ccstring(ccremix, ccnocom, ccalike){
var ccstring = "by"; var ccstring = "by";
if (ccnocom) { if(ccnocom){
ccstring += "-nc"; ccstring +="-nc";
} }
if (!ccremix) { if(!ccremix){
ccstring += "-nd"; ccstring +="-nd";
} else { } else{
if (ccalike) { if(ccalike){
ccstring += "-sa"; ccstring +="-sa";
} }
} }
return ccstring; return ccstring;
} }
function cc() { function cc() {
var nocc = $("#noccradio").prop("checked"); var nocc = $('#noccradio').prop('checked')
var iscc = $("#ccradio").prop("checked"); var iscc = $('#ccradio').prop('checked');
if (nocc) { if(nocc) {
$("#ccradio").prop("checked", false); $('#ccradio').prop('checked', false);
$("#ccremix").prop("checked", false); $('#ccremix').prop('checked', false);
$("#ccnocom").prop("checked", false); $('#ccnocom').prop('checked', false);
$("#ccalike").prop("checked", false); $('#ccalike').prop('checked', false);
$("#ccremix").prop("disabled", true); $('#ccremix').prop('disabled', true);
$("#ccnocom").prop("disabled", true); $('#ccnocom').prop('disabled', true);
$("#ccalike").prop("disabled", true); $('#ccalike').prop('disabled', true);
} else if (iscc) { } else if (iscc) {
$("#ccremix").prop("disabled", false); $('#ccremix').prop('disabled', false);
$("#ccnocom").prop("disabled", false); $('#ccnocom').prop('disabled', false);
if ($("#ccremix").prop("checked")) { if ($('#ccremix').prop('checked')) {
$("#ccalike").prop("disabled", false); $('#ccalike').prop('disabled', false);
} else { } else {
$("#ccalike").prop("disabled", true); $('#ccalike').prop('disabled', true);
} }
} }
var remix = $("#ccremix").prop("checked"); var remix = $('#ccremix').prop('checked');
var nocom = $("#ccnocom").prop("checked"); var nocom = $('#ccnocom').prop('checked');
var alike = $("#ccalike").prop("checked"); var alike = $('#ccalike').prop('checked');
if (nocc) { if(nocc) {
$("#set_license_form_submit").prop("disabled", false); $('#set_license_form_submit').prop('disabled', false);
$("#ccfig").empty(); $('#ccfig').empty();
$("#license").val("no-license"); $('#license').val('no-license')
} else if (iscc) { } else if(iscc) {
$("#set_license_form_submit").prop("disabled", false); $('#set_license_form_submit').prop('disabled', false);
$("#ccfig").empty(); $('#ccfig').empty();
var ccstr = ccstring(remix, nocom, alike); var ccstr = ccstring(remix, nocom, alike)
var link = `https://creativecommons.org/licenses/${ccstr}/4.0/`; var link = `https://creativecommons.org/licenses/${ccstr}/4.0/`;
var imageLink = `https://licensebuttons.net/l/${ccstr}/4.0/88x31.png`; var imageLink = `https://licensebuttons.net/l/${ccstr}/4.0/88x31.png`;
var img_tpl = `<a href='${link}' target="_blank"> var img_tpl = `<a href='${link}' target="_blank">
<img src='${imageLink}'> <img src='${imageLink}'>
</a>`; </a>`;
$("#ccfig").append(img_tpl); $('#ccfig').append(img_tpl);
$("#license").val(ccstr); $('#license').val(ccstr);
$('#license-link').val(link);
$('#license-image-link').val(imageLink);
} else { } else {
$("#ccfig").empty(); $('#ccfig').empty();
$("#set_license_form_submit").prop("disabled", true); $('#set_license_form_submit').prop('disabled', true);
$("#license").val("no-license"); $('#license').val('no-license')
} }
}
$(function () { }
$(function() {
// Disable by default as nothing is selected // Disable by default as nothing is selected
cc(); cc();
$("#set_license_form_submit").prop("disabled", true); $('#set_license_form_submit').prop('disabled', true);
$("#set_license_form_submit").on("click", function (e) { $('#set_license_form_submit').on('click', function (e) {
e.preventDefault(); e.preventDefault();
$("#set_license_form").submit(); $('#set_license_form').submit();
}); });
}); });
</script> </script>

View File

@ -1,62 +1,39 @@
{% load static %} {% load static %}
<!-- Update Scenario Additional Information--> <!-- Update Scenario Additional Information-->
<div <div id="update_scenario_additional_information_modal" class="modal" tabindex="-1">
id="update_scenario_additional_information_modal" <div class="modal-dialog">
class="modal" <div class="modal-content">
tabindex="-1" <div class="modal-header">
> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<div class="modal-dialog"> <span aria-hidden="true">&times;</span>
<div class="modal-content"> </button>
<div class="modal-header"> <h3 class="modal-title">Update Additional Information</h3>
<button </div>
type="button" <div class="modal-body">
class="close" <form id="edit-scenario-additional-information-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
data-dismiss="modal" {% csrf_token %}
aria-label="Close" {% for widget in update_widgets %}
> {{ widget|safe }}
<span aria-hidden="true">&times;</span> {% endfor %}
</button> <input type="hidden" name="hidden" value="set-additional-information">
<h3 class="modal-title">Update Additional Information</h3> </form>
</div> </div>
<div class="modal-body"> <div class="modal-footer">
<form <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
id="edit-scenario-additional-information-modal-form" <button type="button" class="btn btn-primary" id="edit-scenario-additional-information-modal-submit">Update</button>
accept-charset="UTF-8" </div>
action="" </div>
data-remote="true"
method="post"
>
{% csrf_token %}
{% for widget in update_widgets %}
{{ widget|safe }}
{% endfor %}
<input
type="hidden"
name="hidden"
value="set-additional-information"
/>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
type="button"
class="btn btn-primary"
id="edit-scenario-additional-information-modal-submit"
>
Update
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
$(function () { $(function() {
$("#edit-scenario-additional-information-modal-submit").click(function (e) {
e.preventDefault(); $('#edit-scenario-additional-information-modal-submit').click(function(e){
$("#edit-scenario-additional-information-modal-form").submit(); e.preventDefault();
$('#edit-scenario-additional-information-modal-form').submit();
}); });
});
});
</script> </script>

View File

@ -1,178 +1,115 @@
{% load static %} {% load static %}
<div <div class="modal fade bs-modal-lg" id="predict_modal" tabindex="-1" aria-labelledby="predict_modal" aria-modal="true"
class="modal fade bs-modal-lg" role="dialog">
id="predict_modal" <div class="modal-dialog modal-lg">
tabindex="-1" <div class="modal-content">
aria-labelledby="predict_modal" <div class="modal-header">
aria-modal="true" <button type="button" class="close" data-dismiss="modal" aria-label="Close">
role="dialog" <span aria-hidden="true">×</span>
> </button>
<div class="modal-dialog modal-lg"> <h4 class="modal-title">Predict a Pathway</h4>
<div class="modal-content">
<div class="modal-header">
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">Predict a Pathway</h4>
</div>
<div class="modal-body">
<form
id="predict_modal_form"
accept-charset="UTF-8"
action="{{ meta.current_package.url }}/pathway"
data-remote="true"
method="post"
>
{% csrf_token %}
<div class="row">
<div class="col-md-6">
<label for="name">Name</label>
<input
id="name"
class="form-control"
name="name"
placeholder="Name"
/>
<label for="description">Description</label>
<input
id="description"
class="form-control"
name="description"
placeholder="Description"
/>
</div> </div>
<div class="col-md-6"> <div class="modal-body">
<label for="predict">Predict pathway or build yourself?</label> <form id="predict_modal_form" accept-charset="UTF-8" action="{{ meta.current_package.url }}/pathway" data-remote="true" method="post">
<div class="radio" id="predict"> {% csrf_token %}
<p> <div class="row">
<label> <div class="col-md-6">
<input <label for="name">Name</label>
type="radio" <input id="name" class="form-control" name="name" placeholder="Name"/>
name="predict" <label for="description">Description</label>
id="radioPredict" <input id="description" class="form-control" name="description" placeholder="Description"/>
value="predict" </div>
checked <div class="col-md-6">
/>Predict pathway <label for="predict">Predict pathway or build yourself?</label>
</label> <div class="radio" id="predict">
</p> <p>
<p> <label>
<label> <input type="radio" name="predict" id="radioPredict" value="predict" checked/>Predict
<input pathway
type="radio" </label>
name="predict" </p>
id="radioIncremental" <p>
value="incremental" <label>
/>Incremental prediction <input type="radio" name="predict" id="radioIncremental" value="incremental"/>Incremental
</label> prediction
</p> </label>
<p> </p>
<label> <p>
<input <label>
type="radio" <input type="radio" name="predict" id="radioBuild" value="build"/>Build pathway
name="predict" </label>
id="radioBuild" </p>
value="build" </div>
/>Build pathway </div>
</label> </div>
</p> <label for="predict-modal-smiles">SMILES</label>
</div> <input type="text" class="form-control" name="smiles" placeholder="SMILES" id="predict-modal-smiles">
</div> <p id="ketcher_container"></p>
</div> <div>
<label for="predict-modal-smiles">SMILES</label> <iframe id="predict-modal-ketcher" src="{% static '/js/ketcher2/ketcher.html' %}" width="100%"
<input height="510"></iframe>
type="text" </div>
class="form-control"
name="smiles"
placeholder="SMILES"
id="predict-modal-smiles"
/>
<p id="ketcher_container"></p>
<div>
<iframe
id="predict-modal-ketcher"
src="{% static '/js/ketcher2/ketcher.html' %}"
width="100%"
height="510"
></iframe>
</div>
<label for="prediction-setting">Default Prediction Setting</label> <label for="prediction-setting">Default Prediction Setting</label>
<select <select id="prediction-setting" name="prediction-setting" class="form-control"
id="prediction-setting" data-width='100%'>
name="prediction-setting" <option disabled>Select a Setting</option>
class="form-control" {% for s in meta.available_settings %}
data-width="100%" <option value="{{ s.url }}"{% if s.id == meta.user.default_setting.id %}selected{% endif %}>
> {{ s.name|safe }}{% if s.id == meta.user.default_setting.id %} <i>(User default)</i>{% endif %}
<option disabled>Select a Setting</option> </option>
{% for s in meta.available_settings %} {% endfor %}
<option </select>
value="{{ s.url }}"
{% if s.id == meta.user.default_setting.id %}selected{% endif %} </form>
> </div>
{{ s.name|safe }}{% if s.id == meta.user.default_setting.id %} <div class="modal-footer">
<i>(User default)</i> <button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close
{% endif %} </button>
</option> <button type="button" class="btn btn-primary" id="predictButton">Predict</button>
{% endfor %} </div>
</select> </div>
</form>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary pull-left"
data-dismiss="modal"
>
Close
</button>
<button type="button" class="btn btn-primary" id="predictButton">
Predict
</button>
</div>
</div> </div>
</div>
</div> </div>
<script> <script>
function predictModalketcherToPredictModalTextInput() {
$("#predict-modal-smiles").val(this.ketcher.getSmiles());
}
$(function () { function predictModalketcherToPredictModalTextInput() {
$("#predict-modal-ketcher").on("load", function () { $('#predict-modal-smiles').val(this.ketcher.getSmiles());
const checkKetcherReady = () => { }
win = this.contentWindow;
if (win.ketcher && "editor" in win.ketcher) {
win.ketcher.editor.event.change.handlers.push({
once: false,
priority: 0,
f: predictModalketcherToPredictModalTextInput,
ketcher: win.ketcher,
});
} else {
setTimeout(checkKetcherReady, 100);
}
};
checkKetcherReady(); $(function() {
$('#predict-modal-ketcher').on('load', function() {
const checkKetcherReady = () => {
win = this.contentWindow
if (win.ketcher && 'editor' in win.ketcher) {
win.ketcher.editor.event.change.handlers.push({
once: false,
priority: 0,
f: predictModalketcherToPredictModalTextInput,
ketcher: win.ketcher
});
} else {
setTimeout(checkKetcherReady, 100);
}
};
checkKetcherReady();
})
$('#predictButton').on('click', function(e) {
e.preventDefault();
$(this).prop("disabled", true);
// loading button
// validation
// existing pws...
// submit form
$('#predict_modal_form').submit();
}); });
});
$("#predictButton").on("click", function (e) {
e.preventDefault();
$(this).prop("disabled", true);
// loading button
// validation
// existing pws...
// submit form
$("#predict_modal_form").submit();
});
});
</script> </script>

View File

@ -1,686 +0,0 @@
{% load static %}
<dialog id="search_modal" class="modal @max-sm:modal-top justify-center">
<div class="modal-box h-full w-lvw p-1 sm:h-8/12 sm:w-[85vw] sm:max-w-5xl">
<!-- Search Input and Mode Selector -->
<div class="form-control mb-4 w-full shrink-0">
<div class="join m-0 w-full items-center p-3">
<label class="input join-item input-ghost grow">
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-search-icon lucide-search"
>
<path d="m21 21-4.34-4.34" />
<circle cx="11" cy="11" r="8" />
</svg>
<input
type="text"
autofocus
id="modal_searchbar"
placeholder="Benfuracarb"
class="grow"
aria-label="Search"
/>
</label>
<!-- Mode Dropdown -->
<div>
<button
type="button"
tabindex="0"
id="modal_mode_button"
popovertarget="search_dropdown_menu"
style="anchor-name:--1"
class="btn join-item btn-ghost"
>
Text
<svg
class="ml-1 h-4 w-4"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M19 9l-7 7-7-7"
/>
</svg>
</button>
<ul
tabindex="0"
class="dropdown dropdown-end menu bg-base-200 rounded-box w-64 p-2 shadow-lg"
popover
id="search_dropdown_menu"
style="position-anchor:--anchor-2"
>
<li class="menu-title">Text</li>
<li>
<a
id="modal_dropdown_text"
class="tooltip tooltip-left"
data-tip="Search on object names and descriptions"
>
Text
</a>
</li>
<li class="menu-title">SMILES</li>
<li>
<a
id="modal_dropdown_smiles_default"
class="tooltip tooltip-left"
data-tip="Ignores stereochemistry and charge"
>
Default
</a>
</li>
<li>
<a
id="modal_dropdown_smiles_canonical"
class="tooltip tooltip-left"
data-tip="Ignores stereochemistry, preserves charge"
>
Canonical
</a>
</li>
<li>
<a
id="modal_dropdown_smiles_exact"
class="tooltip tooltip-left"
data-tip="Exact match for stereochemistry and charge"
>
Exact
</a>
</li>
<li class="menu-title">InChI</li>
<li>
<a
id="modal_dropdown_inchikey"
class="tooltip tooltip-left"
data-tip="Search by InChIKey"
>
InChIKey
</a>
</li>
</ul>
</div>
<button
type="button"
id="modal_search_button"
class="btn btn-xs btn-ghost join-item"
>
<kbd class="kbd kbd-sm text-base-content/50 p-1">
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-corner-down-left-icon lucide-corner-down-left"
>
<path d="M20 4v7a4 4 0 0 1-4 4H4" />
<path d="m9 10-5 5 5 5" />
</svg>
</kbd>
</button>
</div>
</div>
<!-- Package Selector with Pills -->
<div class="form-control mb-4 shrink-0">
<!-- Pills Container -->
<div
id="modal_package_pills_container"
class="border-base-300 m-3 flex min-h-12 flex-wrap items-center gap-2 rounded-lg border-2 border-dashed p-3"
>
<!-- Pills will be added here dynamically -->
</div>
<!-- Package Dropdown Menu -->
<ul
class="dropdown dropdown-center menu bg-base-200 rounded-box max-h-96 w-80 overflow-y-auto p-2 shadow-lg"
popover
id="package_dropdown_menu"
style="position-anchor:--anchor-packages"
>
{% if unreviewed_packages %}
<li class="menu-title">Reviewed Packages</li>
{% for obj in reviewed_packages %}
<li>
<a
class="package-option flex items-center justify-between"
data-package-url="{{ obj.url }}"
data-package-name="{{ obj.name }}"
>
<span>{{ obj.name }}</span>
<svg
xmlns="http://www.w3.org/2000/svg"
class="package-checkmark hidden h-4 w-4"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M5 13l4 4L19 7"
/>
</svg>
</a>
</li>
{% endfor %}
<li class="menu-title">Unreviewed Packages</li>
{% for obj in unreviewed_packages %}
<li>
<a
class="package-option flex items-center justify-between"
data-package-url="{{ obj.url }}"
data-package-name="{{ obj.name }}"
>
<span>{{ obj.name }}</span>
<svg
xmlns="http://www.w3.org/2000/svg"
class="package-checkmark hidden h-4 w-4"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M5 13l4 4L19 7"
/>
</svg>
</a>
</li>
{% endfor %}
{% else %}
<li class="menu-title">Reviewed Packages</li>
{% for obj in reviewed_packages %}
<li>
<a
class="package-option flex items-center justify-between"
data-package-url="{{ obj.url }}"
data-package-name="{{ obj.name }}"
>
<span>{{ obj.name }}</span>
<svg
xmlns="http://www.w3.org/2000/svg"
class="package-checkmark hidden h-4 w-4"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M5 13l4 4L19 7"
/>
</svg>
</a>
</li>
{% endfor %}
{% endif %}
</ul>
</div>
<!-- Loading Indicator -->
<div id="search_loading" class="hidden shrink-0 justify-center py-8">
<span class="loading loading-spinner loading-lg text-primary"></span>
</div>
<!-- Results Container - scrollable -->
<div id="search_results" class="min-h-0 flex-1 overflow-y-auto p-2"></div>
</div>
<!-- Backdrop to close -->
<form method="dialog" class="modal-backdrop">
<button>close</button>
</form>
</dialog>
<script>
(function () {
// Package Selector Module - Data-driven multiselect package selection
const PackageSelector = {
// Single source of truth: array of selected packages
selectedPackages: [],
elements: {
pillsContainer: null,
packageDropdown: null,
packageOptions: null,
},
init() {
this.cacheElements();
this.loadInitialSelection();
this.attachEventListeners();
this.render();
},
cacheElements() {
this.elements.pillsContainer = document.getElementById(
"modal_package_pills_container",
);
this.elements.packageDropdown = document.getElementById(
"package_dropdown_menu",
);
this.elements.packageOptions =
document.querySelectorAll(".package-option");
},
loadInitialSelection() {
// Load pre-selected packages from server-rendered pills
const existingPills =
this.elements.pillsContainer.querySelectorAll(".badge");
existingPills.forEach((pill) => {
this.selectedPackages.push({
url: pill.dataset.packageUrl,
name: pill.dataset.packageName,
});
});
// If no pills found, select all reviewed packages by default
if (this.selectedPackages.length === 0) {
// Iterate through all menu items and collect reviewed packages
const menuItems =
this.elements.packageDropdown.querySelectorAll("li");
for (const item of menuItems) {
// Check if this is the "Unreviewed Packages" menu title
if (
item.classList.contains("menu-title") &&
item.textContent.trim() === "Unreviewed Packages"
) {
break; // Stop processing after this point
}
// Check for package options (only reviewed packages reach here)
const packageOption = item.querySelector(".package-option");
if (packageOption) {
this.selectedPackages.push({
url: packageOption.dataset.packageUrl,
name: packageOption.dataset.packageName,
});
}
}
}
},
attachEventListeners() {
// Toggle package selection on dropdown item click
this.elements.packageOptions.forEach((option) => {
option.addEventListener("click", (e) => {
e.preventDefault();
e.stopPropagation(); // Prevent dropdown from closing
const packageUrl = option.dataset.packageUrl;
const packageName = option.dataset.packageName;
this.togglePackageSelection(packageUrl, packageName);
});
});
// Remove package when X is clicked (using event delegation)
this.elements.pillsContainer.addEventListener("click", (e) => {
if (
e.target.classList.contains("package-remove-btn") ||
e.target.closest(".package-remove-btn")
) {
const pill = e.target.closest(".badge");
if (pill) {
const packageUrl = pill.dataset.packageUrl;
this.removePackage(packageUrl);
}
}
});
},
togglePackageSelection(packageUrl, packageName) {
const index = this.selectedPackages.findIndex(
(pkg) => pkg.url === packageUrl,
);
if (index !== -1) {
// Remove from selection
this.selectedPackages.splice(index, 1);
} else {
// Add to selection
this.selectedPackages.push({ url: packageUrl, name: packageName });
}
this.render();
},
removePackage(packageUrl) {
const index = this.selectedPackages.findIndex(
(pkg) => pkg.url === packageUrl,
);
if (index !== -1) {
this.selectedPackages.splice(index, 1);
this.render();
}
},
render() {
this.renderPills();
this.renderAddButton();
this.renderCheckmarks();
},
renderPills() {
// Clear existing pills and button (except placeholder)
const pills = this.elements.pillsContainer.querySelectorAll(".badge");
pills.forEach((pill) => pill.remove());
const existingButton = this.elements.pillsContainer.querySelector(
"#modal_package_add_button",
);
if (existingButton) {
existingButton.remove();
}
// Create pills from data
this.selectedPackages.forEach((pkg) => {
const pill = this.createPillElement(pkg.url, pkg.name);
this.elements.pillsContainer.appendChild(pill);
});
},
renderAddButton() {
// Only render button if there are packages available
if (this.elements.packageOptions.length === 0) {
return;
}
const button = document.createElement("button");
button.type = "button";
button.id = "modal_package_add_button";
button.setAttribute("popovertarget", "package_dropdown_menu");
button.style.cssText = "anchor-name:--anchor-packages";
button.className = "btn btn-sm btn-ghost gap-2 text-base-content/50";
button.innerHTML = `
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-plus-icon lucide-plus"><path d="M5 12h14"/><path d="M12 5v14"/></svg>
Add Package
`;
this.elements.pillsContainer.appendChild(button);
},
createPillElement(packageUrl, packageName) {
const pill = document.createElement("span");
pill.className = "badge badge-outline gap-2 max-w-xs";
pill.dataset.packageUrl = packageUrl;
pill.dataset.packageName = packageName;
pill.innerHTML = `
<span class="truncate" title="${packageName}">${packageName}</span>
<svg xmlns="http://www.w3.org/2000/svg"
class="h-4 w-4 cursor-pointer hover:text-error package-remove-btn flex-shrink-0 rotate-45"
viewBox="0 0 24 24"
fill="none" stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M5 12h14"/><path d="M12 5v14"/>
</svg>
`;
return pill;
},
renderCheckmarks() {
// Update all checkmarks based on selected packages
this.elements.packageOptions.forEach((option) => {
const packageUrl = option.dataset.packageUrl;
const isSelected = this.selectedPackages.some(
(pkg) => pkg.url === packageUrl,
);
const checkmark = option.querySelector(".package-checkmark");
if (checkmark) {
checkmark.classList.toggle("hidden", !isSelected);
}
});
},
getSelectedPackages() {
return this.selectedPackages.map((pkg) => pkg.url);
},
};
// Modal and Search Management
const modal = document.getElementById("search_modal");
const searchbar = document.getElementById("modal_searchbar");
const searchButton = document.getElementById("modal_search_button");
const modeButton = document.getElementById("modal_mode_button");
const resultsDiv = document.getElementById("search_results");
const loadingDiv = document.getElementById("search_loading");
// MutationObserver to detect when modal opens
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.attributeName === "open" && modal.open) {
PackageSelector.render();
// Delay focus to allow CSS transitions to complete (modal has 0.3s transition)
setTimeout(() => {
searchbar.focus();
}, 320);
}
});
});
observer.observe(modal, { attributes: true });
// Close modal when clicking outside (on the backdrop)
// According to DaisyUI docs: https://daisyui.com/components/modal/
// The backdrop form with method="dialog" should handle closing automatically when its button is clicked.
// We also handle clicks directly on the dialog element (backdrop area) or the backdrop form.
modal.addEventListener("click", function (event) {
const backdrop = modal.querySelector(".modal-backdrop");
const modalBox = modal.querySelector(".modal-box");
// Close if clicking directly on the dialog element (backdrop area)
// or on the backdrop form (but ensure we're not clicking on modal-box content)
if (
event.target === modal ||
(backdrop &&
(event.target === backdrop || backdrop.contains(event.target)) &&
!modalBox.contains(event.target))
) {
modal.close();
}
});
// Clear results when modal closes
modal.addEventListener("close", function () {
resultsDiv.innerHTML = "";
loadingDiv.classList.add("hidden");
searchbar.value = "";
});
// Mode dropdown handlers
const dropdownMenu = document.getElementById("search_dropdown_menu");
const modeButtons = [
{ id: "modal_dropdown_text", text: "Text" },
{ id: "modal_dropdown_smiles_default", text: "Default" },
{ id: "modal_dropdown_smiles_canonical", text: "Canonical" },
{ id: "modal_dropdown_smiles_exact", text: "Exact" },
{ id: "modal_dropdown_inchikey", text: "InChIKey" },
];
modeButtons.forEach(({ id, text }) => {
document.getElementById(id).addEventListener("click", function (e) {
e.preventDefault();
modeButton.innerHTML =
text +
` <svg class="w-4 h-4 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/>
</svg>`;
// Close dropdown using popover API
if (dropdownMenu && typeof dropdownMenu.hidePopover === "function") {
dropdownMenu.hidePopover();
}
});
});
// Initialize Package Selector
PackageSelector.init();
// Search Response Handler
function handleSearchResponse(data) {
resultsDiv.innerHTML = "";
function makeContent(objs) {
let links = "";
objs.forEach((obj) => {
links += `<a href="${obj.url}" class="block px-4 py-2 hover:bg-base-300 rounded-lg transition-colors">${obj.name}</a>`;
});
return links;
}
let allEmpty = true;
let content = "";
// Category order for better UX
const categoryOrder = [
"Compounds",
"Compound Structures",
"Rules",
"Reactions",
"Pathways",
];
categoryOrder.forEach((key) => {
if (!data[key] || data[key].length < 1) {
return;
}
allEmpty = false;
content += `
<div class="collapse collapse-arrow bg-base-200 mb-2">
<input type="checkbox" checked />
<div class="collapse-title font-medium">
${key} <span class="badge badge-neutral badge-sm ml-2">${data[key].length}</span>
</div>
<div class="collapse-content">
${makeContent(data[key])}
</div>
</div>
`;
});
if (allEmpty) {
resultsDiv.innerHTML = `
<div class="alert alert-warning">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
</svg>
<span>No results found</span>
</div>
`;
} else {
resultsDiv.innerHTML = `
<div class="mb-2">
<div class="text-sm font-semibold text-base-content/70 mb-2">Results</div>
${content}
</div>
`;
}
}
// Search Execution
function performSearch(e) {
e.preventDefault();
const query = searchbar.value.trim();
if (!query) {
console.log("Search phrase empty, won't do search");
return;
}
const selPacks = PackageSelector.getSelectedPackages();
if (selPacks.length < 1) {
console.log("No package selected, won't do search");
resultsDiv.innerHTML = `
<div class="alert alert-info">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<span>Please select at least one package</span>
</div>
`;
return;
}
const mode = modeButton.textContent.trim().toLowerCase();
const params = new URLSearchParams();
selPacks.forEach((pack) => params.append("packages", pack));
params.append("search", query);
params.append("mode", mode);
// Show loading
loadingDiv.classList.remove("hidden");
resultsDiv.innerHTML = "";
fetch(`{{ SERVER_BASE }}/search?${params.toString()}`, {
method: "GET",
headers: {
Accept: "application/json",
},
})
.then((response) => {
if (!response.ok) {
throw new Error("Search request failed");
}
return response.json();
})
.then((result) => {
loadingDiv.classList.add("hidden");
handleSearchResponse(result);
})
.catch((error) => {
loadingDiv.classList.add("hidden");
console.error("Search error:", error);
resultsDiv.innerHTML = `
<div class="alert alert-error">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<span>Search failed. Please try again.</span>
</div>
`;
});
}
// Event listeners for search
searchButton.addEventListener("click", performSearch);
searchbar.addEventListener("keydown", function (e) {
if (e.key === "Enter") {
performSearch(e);
}
});
})();
</script>

Some files were not shown because too many files have changed in this diff Show More