aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja
blob: 4b6cdee700836de5039636b23c8b4921118a949e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
{#
SPDX-License-Identifier: GPL-3.0-or-later OR CC-BY-SA-4.0

Proxy web UI item version view page template.

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 of this
code in a proprietary work, I am not going to enforce this in court.
#}
{% extends "items/item_view.html.jinja" %}

{% macro item_file_list(file_specs, file_type) %}
  <ul class="item-list has-colored-links">
    {% for spec in file_specs %}
      <li class="invisible-entry-line">
        {%
          set url = url_for(
              '.show_{}_file'.format(version_display_info.type.value),
              item_version_id = version_display_info.ref.id,
              file_type       = file_type,
              name            = spec.name
          )
        %}
        <div>
          <a href="{{ url }}">
            {{ spec.name }}
          </a>
        </div>
      </li>
    {% endfor %}
  </ul>
{% endmacro %}

{% macro item_link_list(item_specs, make_url) %}
  <ul class="item-list has-colored-links">
    {% for spec in item_specs %}
      <li class="invisible-entry-line">
        <div>
          <a href="{{ make_url(spec) }}">
            {{ spec.identifier }}
          </a>
        </div>
      </li>
    {% endfor %}
  </ul>
{% endmacro %}

{% block top_errors %}
  {% if not version_display_info.info.compatible %}
    {{ error_note(_('web_ui.err.item_not_compatible')) }}
  {% endif %}
{% endblock %}

{% block main_info %}
  {{ super() }}

  {{ label(_('web_ui.items.single_version.identifier_label')) }}

  <p>
    {{ version_display_info.info.identifier }}
  </p>

  <div class="horizontal-separator"></div>

  {{ label(_('web_ui.items.single_version.version_label')) }}

  <p>
    {{ version_with_repo(version_display_info) }}
  </p>

  <div class="horizontal-separator"></div>

  {% if version_display_info.info.uuid is not none %}
    {{ label(_('web_ui.items.single_version.uuid_label')) }}

    <p>
      {{ version_display_info.info.uuid }}
    </p>

    <div class="horizontal-separator"></div>
  {% endif %}

  {% if version_display_info.info.description %}
    {{ label(_('web_ui.items.single_version.description_label')) }}

    <p>
      {{ version_display_info.info.description }}
    </p>

    <div class="horizontal-separator"></div>
  {% endif %}

  {{ label(_('web_ui.items.single_version.licenses_label')) }}

  {% if version_display_info.info.source_copyright %}
    {{ item_file_list(version_display_info.info.source_copyright, 'license') }}
  {% else %}
    <p>
      {{ _('web_ui.items.single_version.no_license_files') }}
    </p>
  {% endif %}

  <div class="horizontal-separator"></div>

  {% if version_display_info.info.required_mappings %}
    {{ label(_('web_ui.items.single_version.required_mappings_label')) }}

    {% macro make_mapping_url(spec) -%}
      {{
        url_for(
            '.show_required_mapping',
            item_type           = version_display_info.type.alt_name,
            item_version_id     = version_display_info.ref.id,
            required_identifier = spec.identifier
        )
      }}
    {%- endmacro %}

    {% set required_specs = version_display_info.info.required_mappings %}
    {{ item_link_list(required_specs, make_mapping_url) }}

    <div class="horizontal-separator"></div>
  {% endif %}

  {% if version_display_info.info.min_haketilo_ver != versions.int_ver_min %}
    {{ label(_('web_ui.items.single_version.min_haketilo_ver_label')) }}

    <p>
      {{ versions.version_string(version_display_info.info.min_haketilo_ver) }}
    </p>

    <div class="horizontal-separator"></div>
  {% endif %}

  {% if version_display_info.info.max_haketilo_ver != versions.int_ver_max %}
    {{ label(_('web_ui.items.single_version.max_haketilo_ver_label')) }}

    <p>
      {{ versions.version_string(version_display_info.info.max_haketilo_ver) }}
    </p>

    <div class="horizontal-separator"></div>
  {% endif %}

  {% block main_info_rest required %}{% endblock %}

  {%
    if settings.advanced_user and
       version_display_info.active != ActiveStatus.REQUIRED
  %}
    <div class="horizontal-separator"></div>

    {{ label(_('web_ui.items.single_version.install_uninstall_label')) }}

    {% set install_but_classes   = ['green-button'] %}
    {% set uninstall_but_classes = ['green-button'] %}
    {% if version_display_info.installed == InstalledStatus.FAILED_TO_INSTALL %}
      {%
        set install_text =
            _('web_ui.items.single_version.retry_install_button')
      %}
      {%
        set uninstall_text =
            _('web_ui.items.single_version.leave_uninstalled_button')
      %}
      <p>{% block item_install_failed_msg required %}{% endblock %}</p>
    {% else %}
      {% set install_text   = _('web_ui.items.single_version.install_button') %}
      {%
        set uninstall_text = _('web_ui.items.single_version.uninstall_button')
      %}
      {% if version_display_info.installed == InstalledStatus.INSTALLED %}
        {% do install_but_classes.append('disabled-button') %}
        {%
          if uninstall_disallowed is defined or
              version_display_info.active == ActiveStatus.REQUIRED
        %}
          {% do uninstall_but_classes.append('disabled-button') %}
        {% endif %}
        <p>{% block item_is_installed_msg required %}{% endblock %}</p>
      {% else %}
        {# version_display_info.installed == InstalledStatus.NOT_INSTALLED #}
        {% do uninstall_but_classes.append('disabled-button') %}
        <p>{% block item_is_not_installed_msg required %}{% endblock %}</p>
      {% endif %}
    {% endif %}{# else/ version_display_info.installed == InstalledStatus.... #}

    {% set uninstall_fields = {'action': 'uninstall_item_version'} %}
    {% set install_fields   = {'action': 'install_item_version'} %}

    {{
      button_row([
          (uninstall_but_classes, uninstall_text, uninstall_fields),
          (install_but_classes,   install_text,   install_fields)
      ])
    }}
  {% endif %}{# settings.advanced_user #}
{% endblock main_info %}