Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 96 additions & 99 deletions src/moin/templates/itemviews.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
Comment and Transclusion links may be hidden by Javascript if item lacks content.
#}

{% set exists = fqname and storage.get_item(**fqname.query) %}
{% set item = item %}
{% set not_trash = not item_is_deleted if item_is_deleted is defined else True %}
{% set icon_classes = theme_supp.get_endpoint_iconmap() %}
Expand All @@ -21,116 +20,114 @@
<li class="moin-panel-heading">{{ _('Item Views') }}</li>
{%- for endpoint, label, title, check_exists in cfg.item_views if not endpoint in cfg.endpoints_excluded %}
{% set icon_class = icon_classes[endpoint] %}
{%- if not check_exists or check_exists and exists %}
{%- if endpoint in [
'frontend.show_item',
'frontend.show_item_meta',
'frontend.history',
'frontend.download_item',
] %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}
{%- if endpoint in [
'frontend.show_item',
'frontend.show_item_meta',
'frontend.history',
'frontend.download_item',
] %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}

{%- if not_trash and endpoint in [
'frontend.index',
'frontend.refs',
'frontend.sitemap',
'frontend.similar_names',
'frontend.copy_item',
] %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}
{%- if not_trash and endpoint in [
'frontend.index',
'frontend.refs',
'frontend.sitemap',
'frontend.similar_names',
'frontend.copy_item',
] %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}

{%- if endpoint == 'frontend.highlight_item' and item and ('text' in item.contenttype or 'docbook' in item.contenttype) %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}
{%- if endpoint == 'frontend.highlight_item' and item and ('text' in item.contenttype or 'docbook' in item.contenttype) %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}

{%- if endpoint == 'frontend.modify_item' and may.write and not_trash %}
<li>
<a class="moin-modify-button" href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}
{%- if endpoint == 'frontend.modify_item' and may.write and not_trash %}
<li>
<a class="moin-modify-button" href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}

{%- if endpoint in [
'frontend.rename_item', 'frontend.delete_item',
] and may.write and not_trash %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}
{%- if endpoint in [
'frontend.rename_item', 'frontend.delete_item',
] and may.write and not_trash %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}

{%- if endpoint in [
'frontend.convert_item',
] and may.write and item and theme_supp.is_markup_or_text(item.contenttype) and not_trash %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}
{%- if endpoint in [
'frontend.convert_item',
] and may.write and item and theme_supp.is_markup_or_text(item.contenttype) and not_trash %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}

{%- if endpoint == 'frontend.destroy_item' and may.destroy %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}
{%- if endpoint == 'frontend.destroy_item' and may.destroy %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}

{%- if endpoint == 'frontend.quicklink_item' and user.valid and not_trash %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">
{%- if user.is_quicklinked_to([fqname]) %}
{{ a_label(icon_class, _('Remove Link')) }}
{%- else %}
{{ a_label(icon_class, _('Add Link')) }}
{%- endif %}
</a>
</li>
{%- endif %}
{%- if endpoint == 'frontend.quicklink_item' and user.valid and not_trash %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">
{%- if user.is_quicklinked_to([fqname]) %}
{{ a_label(icon_class, _('Remove Link')) }}
{%- else %}
{{ a_label(icon_class, _('Add Link')) }}
{%- endif %}
</a>
</li>
{%- endif %}

{%- if endpoint == 'frontend.subscribe_item' and user.valid and not_trash %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">
{%- if user.is_subscribed_to(item) %}
{{ a_label(icon_class, _('Unsubscribe')) }}
{%- else %}
{{ a_label(icon_class, _('Subscribe')) }}
{%- endif %}
</a>
</li>
{%- endif %}
{%- if endpoint == 'frontend.subscribe_item' and user.valid and not_trash %}
<li>
<a href="{{ url_for(endpoint, item_name = fqname) }}" title="{{ title }}" rel="nofollow">
{%- if user.is_subscribed_to(item) %}
{{ a_label(icon_class, _('Unsubscribe')) }}
{%- else %}
{{ a_label(icon_class, _('Subscribe')) }}
{%- endif %}
</a>
</li>
{%- endif %}

{%- if endpoint == 'special.comments' and not_trash %}
<li class="moin-toggle-comments-button">
<a class="moin-toggle-comments-tooltip" href="#" title="{{ title }}">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}
{%- if endpoint == 'special.comments' and not_trash %}
<li class="moin-toggle-comments-button">
<a class="moin-toggle-comments-tooltip" href="#" title="{{ title }}">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}

{% if endpoint == 'special.transclusions' and not_trash -%}
<li class="moin-transclusions-button">
<a class="moin-transclusions-tooltip" href="#" title="{{ title }}">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}
{% if endpoint == 'special.transclusions' and not_trash -%}
<li class="moin-transclusions-button">
<a class="moin-transclusions-tooltip" href="#" title="{{ title }}">{{ a_label(icon_class, label) }}</a>
</li>
{%- endif %}

{%- if endpoint == 'special.supplementation' and fqname %}
{%- for sub_item_name in cfg.supplementation_item_names %}
{%- set current_sub = item_name.rsplit('/', 1)[-1] %}
{%- if not current_sub in cfg.supplementation_item_names %}
{%- set supp_name = '%s/%s' % (fqname, sub_item_name) %}
{%- if not_trash and (storage.has_item(supp_name) or user.may.write(supp_name)) %}
{% set title = _('Discuss contents of this item') %}
<li>
<a class="moin-subitem-discuss" href="{{ url_for('frontend.show_item', item_name = supp_name) }}"
title="{{ title }}" rel="nofollow">{{ a_label(icon_class, _(sub_item_name)) }}
</a>
</li>
{%- endif %}
{%- if endpoint == 'special.supplementation' and fqname %}
{%- for sub_item_name in cfg.supplementation_item_names %}
{%- set current_sub = item_name.rsplit('/', 1)[-1] %}
{%- if not current_sub in cfg.supplementation_item_names %}
{%- set supp_name = '%s/%s' % (fqname, sub_item_name) %}
{%- if not_trash and (storage.has_item(supp_name) or user.may.write(supp_name)) %}
{% set title = _('Discuss contents of this item') %}
<li>
<a class="moin-subitem-discuss" href="{{ url_for('frontend.show_item', item_name = supp_name) }}"
title="{{ title }}" rel="nofollow">{{ a_label(icon_class, _(sub_item_name)) }}
</a>
</li>
{%- endif %}
{%- endfor %}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- endif %}
{%- endfor %}
</ul>