diff options
Diffstat (limited to 'src/hydrilla/proxy/web_ui/templates')
7 files changed, 109 insertions, 26 deletions
diff --git a/src/hydrilla/proxy/web_ui/templates/base.html.jinja b/src/hydrilla/proxy/web_ui/templates/base.html.jinja index bca5948..c7a0c15 100644 --- a/src/hydrilla/proxy/web_ui/templates/base.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/base.html.jinja @@ -45,6 +45,12 @@ in a proprietary work, I am not going to enforce this in court. color: #555; } + .error-note { + display: block; + border-left: 5px solid #a33; + background-color: #fcc; + } + .hide { display: none !important; } diff --git a/src/hydrilla/proxy/web_ui/templates/include/checkbox_tricks_style.css.jinja b/src/hydrilla/proxy/web_ui/templates/include/checkbox_tricks_style.css.jinja index b4c8edc..471725b 100644 --- a/src/hydrilla/proxy/web_ui/templates/include/checkbox_tricks_style.css.jinja +++ b/src/hydrilla/proxy/web_ui/templates/include/checkbox_tricks_style.css.jinja @@ -30,7 +30,7 @@ input.chbx-tricks-hide-show:not(:checked)+*+* { display: none !important; } -input.chbx-tricks-hide-show:checked+*+*, -input.chbx-tricks-show-hide:not(:checked)+*+* { +input.chbx-tricks-hide-show:checked+*, +input.chbx-tricks-show-hide:not(:checked)+* { display: none !important; } diff --git a/src/hydrilla/proxy/web_ui/templates/packages.html.jinja b/src/hydrilla/proxy/web_ui/templates/packages.html.jinja index 48ef80b..bcb8dea 100644 --- a/src/hydrilla/proxy/web_ui/templates/packages.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/packages.html.jinja @@ -30,11 +30,12 @@ in a proprietary work, I am not going to enforce this in court. <h3>{{ _('web_ui.packages.heading') }}</h3> <ul id="item_list"> {% for info in display_infos %} - <li - {% if info.info.repo == '<local>' %} - class="package-entry-local" - {% endif %} - > + {% if info.info.repo == '<local>' -%} + {%- set entry_classes = 'package-entry-local' -%} + {%- else -%} + {%- set entry_classes = '' -%} + {%- endif -%} + <li class="{{ entry_classes }}"> <a href="{{ url_for('.show_package', mapping_id=info.ref.id) }}"> <div> {{ info.info.long_name }} diff --git a/src/hydrilla/proxy/web_ui/templates/packages__load_from_disk.html.jinja b/src/hydrilla/proxy/web_ui/templates/packages__load_from_disk.html.jinja index 52280b2..33a99f4 100644 --- a/src/hydrilla/proxy/web_ui/templates/packages__load_from_disk.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/packages__load_from_disk.html.jinja @@ -20,7 +20,7 @@ file's licenses. Although I request that you do not make use this code in a proprietary work, I am not going to enforce this in court. #} {% extends "base.html.jinja" %} -{% block title %}Load package{% endblock %} +{% block title %} {{ _('web_ui.packages.load_from_disk.title') }} {% endblock %} {% block main %} <form method="POST" enctype="multipart/form-data"> <div> @@ -29,7 +29,8 @@ in a proprietary work, I am not going to enforce this in court. </label> </div> <div> - <input id="packages_zipfile" name="packages_zipfile" type="file" required=""> + <input id="packages_zipfile" name="packages_zipfile" type="file" + required=""> </div> <div> <button>Install packages</button> diff --git a/src/hydrilla/proxy/web_ui/templates/repos.html.jinja b/src/hydrilla/proxy/web_ui/templates/repos.html.jinja index 94b7e2b..05c948e 100644 --- a/src/hydrilla/proxy/web_ui/templates/repos.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/repos.html.jinja @@ -28,6 +28,11 @@ in a proprietary work, I am not going to enforce this in court. {% endblock %} {% block main %} <h3>{{ _('web_ui.repos.heading') }}</h3> + <div> + <a href="{{ url_for('.add_repo_get') }}" class="button"> + {{ _('web_ui.repos.add_repo_button') }} + </a> + </div> <ul id="item_list"> {% for info in display_infos %} <li @@ -51,7 +56,7 @@ in a proprietary work, I am not going to enforce this in court. </li> {% endfor %} <li> - <a href="{{ url_for('.show_repo', repo_id=1) }}"> + <a href="{{ url_for('.show_repo', repo_id=local_semirepo_info.ref.id) }}"> {{ _('web_ui.repos.local_packages_semirepo') }} <div class="small-print"> {{ diff --git a/src/hydrilla/proxy/web_ui/templates/repos__add.html.jinja b/src/hydrilla/proxy/web_ui/templates/repos__add.html.jinja new file mode 100644 index 0000000..cbe7105 --- /dev/null +++ b/src/hydrilla/proxy/web_ui/templates/repos__add.html.jinja @@ -0,0 +1,62 @@ +{# +Spdx-License-Identifier: GPL-3.0-or-later OR CC-BY-SA-4.0 + + +Proxy web UI repo creation page. + +This file is part of Hydrilla&Haketilo. + +Copyright (C) 2022 Wojtek Kosior + +Dual licensed under +* GNU General Public License v3.0 or later and +* Creative Commons Attribution Share Alike 4.0 International. + +You can choose to use either of these licenses or both. + + +I, Wojtek Kosior, thereby promise not to sue for violation of this +file's licenses. Although I request that you do not make use this code +in a proprietary work, I am not going to enforce this in court. +#} +{% extends "base.html.jinja" %} +{% block title %} {{ _('web_ui.repos.add.title') }} {% endblock %} +{% block main %} + <h3>{{ _('web_ui.repos.add.heading') }}</h3> + <form method="POST"> + <div> + <label for="name_field"> + {{ _('web_ui.repos.add.name_field_label') }} + </label> + </div> + {% if repo_name_invalid is defined -%} + <aside class="error-note"> + {{ _('web_ui.repos.add.repo_name_invalid') }} + </aside> + {%- endif %} + {% if repo_name_taken is defined -%} + <aside class="error-note"> + {{ _('web_ui.repos.add.repo_name_taken') }} + </aside> + {%- endif %} + <div> + <input id="name_field" name="name" required=""> + </div> + <div> + <label for="url_field"> + {{ _('web_ui.repos.add.url_field_label') }} + </label> + </div> + {% if repo_url_invalid is defined -%} + <aside class="error-note"> + {{ _('web_ui.repos.add.repo_url_invalid') }} + </aside> + {%- endif %} + <div> + <input id="url_field" name="url" required=""> + </div> + <div> + <button class="button">{{ _('web_ui.repos.add.submit_button') }}</button> + </div> + </form> +{% endblock %} diff --git a/src/hydrilla/proxy/web_ui/templates/repos__show_single.html.jinja b/src/hydrilla/proxy/web_ui/templates/repos__show_single.html.jinja index 9abb00d..96100ce 100644 --- a/src/hydrilla/proxy/web_ui/templates/repos__show_single.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/repos__show_single.html.jinja @@ -27,21 +27,19 @@ in a proprietary work, I am not going to enforce this in court. {% include 'include/checkbox_tricks_style.css.jinja' %} {% endblock %} {% block main %} + {% set repo_id = display_info.ref.id -%} <h3> - {% if display_info.ref.id != '1' %} - {{ - _('web_ui.repos.single.heading.name_{}') - .format(display_info.info.long_name) - }} - {% else %} + {% if display_info.is_local_semirepo -%} {{ _('web_ui.repos.local_packages_semirepo') }} - {% endif %} + {% else -%} + {{ _('web_ui.repos.single.heading.name_{}').format(display_info.name) }} + {% endif -%} </h3> - {% if display_info.deleted == True %} + {% if display_info.deleted and not display_info.is_local_semirepo -%} <div> {{ _('web_ui.repos.single.repo_is_deleted') }} </div> - {% elif display_info.deleted == False %} + {% elif not display_info.deleted -%} <input id="show_url_edit_form" type="checkbox" class="chbx-tricks-show-hide" checked=""> <div> @@ -54,7 +52,8 @@ in a proprietary work, I am not going to enforce this in court. </label> </div> </div> - <form method="POST"> + {% set action_url = url_for('.update_repo_url', repo_id=repo_id) -%} + <form method="POST" action="{{ action_url }}"> <input type="hidden" name="action" value="update_url"> <div> <input name="url" value="{{ display_info.url }}"> @@ -69,22 +68,23 @@ in a proprietary work, I am not going to enforce this in court. </div> </form> <div> - {% if display_info.last_refreshed is None %} + {% if display_info.last_refreshed is none -%} {{ _('web_ui.repos.single.repo_never_refreshed') }} - {% else %} + {% else -%} {{ _('web_ui.repos.single.last_refreshed_{}') .format(display_info.last_refreshed.strftime('%F %H:%M')) }} - {% endif %} - <form method="POST"> + {% endif -%} + {% set action_url = url_for('.refresh_repo', repo_id=repo_id) -%} + <form method="POST" action="{{ action_url }}"> <input type="hidden" name="action" value="refresh_repo"> <button class="green-button"> {{ _('web_ui.repos.single.refresh_now_button') }} </button> </form> </div> - {% endif %} + {% endif -%} <div> {{ _('web_ui.repos.item_count_{mappings}_{resources}') @@ -94,4 +94,12 @@ in a proprietary work, I am not going to enforce this in court. ) }} </div> -{% endblock %} + {% if not display_info.is_local_semirepo -%} + {% set action_url = url_for('.remove_repo', repo_id=repo_id) -%} + <form method="POST" action="{{ action_url }}"> + <button class="green-button"> + {{ _('web_ui.repos.single.remove_button') }} + </button> + </form> + {% endif -%} +{% endblock -%} |