{% import "components/paginator.html" as paginator with context %} {% import "components/user.html" as user with context %} {% set articleItems = adminPage.items if adminPage and adminPage.items else ddocs %} {% set articleTotal = adminPage.total if adminPage and adminPage.total is defined else (articleItems.length|default(0)) %} {% set currentPage = adminPage.page|default(page)|default(1) %} {% set pageCount = adminPage.pageCount|default(dpcount)|default(0) %} {% macro placements_for(item) %} {% set placements = item.placements|default([]) %}
{% if placements.length %} {% for domainId in placements %} {% if domainId == '*' %} {{ _('All domains') }} {% else %} {% set domainName = domainNames[domainId]|default(domainId) %} {{ domainName }}{% if domainName != domainId %} ({{ domainId }}){% endif %} {% endif %} {% endfor %} {% else %} {{ _('Not featured in any domain') }} {% endif %}
{% endmacro %} {% macro state_for(item, did) %} {% set isModerationAllowed = item.visibility == 'visible' or (item.visibility is undefined and not item.moderationHidden) %} {% set authorHidden = item.authorHidden|default(false) %} {% set commentsOpen = item.comments == 'open' or (item.comments is undefined and not item.lock) %} {% set canSetVisibility = item.canSetVisibility|default(canManageGlobal) %} {% set canSetComments = item.canSetComments|default(canManageGlobal) %}
{% if isModerationAllowed %}{{ _('Not blocked') }}{% else %}{{ _('Blocked by system') }}{% endif %} {% if authorHidden %} {{ _('Hidden by author') }}{% endif %} {% if commentsOpen %}{{ _('Comments open') }}{% else %}{{ _('Comments locked') }}{% endif %}
{% if canSetVisibility or canSetComments %}
{% if canSetVisibility %}{% endif %} {% if canSetComments %}{% endif %}
{% endif %} {% endmacro %} {% macro article_actions(item, did, surface) %} {% set placements = item.placements|default([]) %} {% set allDomains = '*' in placements %} {% set currentDomainPlaced = allDomains or handler.domain._id in placements %} {% set canSetPlacement = item.canSetPlacement|default(true) %} {% set canEdit = item.canEdit|default(canManageGlobal) %}
{% endmacro %}

{{ _('Articles') }}

{{ _('{0} articles found').format(articleTotal) }}

{% if qs %} {{ _('Filters applied') }}{% endif %}
{{ _('{0} selected').format(0) }}
{{ _('Up to 100 articles per batch') }}
{% if articleItems.length %}
{% for item in articleItems %} {% set did = item.did|default(item._id) %} {% set placements = item.placements|default([]) %} {% set allDomains = '*' in placements %} {% set canSelect = item.canSetVisibility|default(canManageGlobal) or item.canSetComments|default(canManageGlobal) or (item.canSetPlacement|default(true) and not (managerScope == 'domain' and allDomains)) %} {% endfor %}
{{ _('Article') }} {{ _('Author and classification') }} {{ _('Reach') }} {{ _('Status and placement') }} {{ _('Actions') }}
{{ item.title }} {{ did }} {% if item.excerpt %}{{ item.excerpt }}{% endif %}
{{ user.render_inline(udict[item.owner], badge=false) }} {% if item.category and item.category != 'none' %}{{ _('Category') }}: {{ item.category }}{% endif %} {% if item.courseRef %} {{ _('Course article') }}{% endif %}
{{ _('{0} views').format(item.views|default(0)) }} {{ _('{0} comments').format(item.nReply|default(0)) }} {{ _('Edited') }}: {{ datetimeSpan(item.contentUpdatedAt|default(item.updateAt)|default(item._id))|safe }}{% if item.contentUpdatedAtEstimated %} {{ _('Estimated') }}{% endif %} {% if item.activityAt %}{{ _('Active') }}: {{ datetimeSpan(item.activityAt)|safe }}{% endif %}
{{ state_for(item, did) }}
{{ _('Featured domains') }}
{{ placements_for(item) }}
{{ article_actions(item, did, 'desktop') }}
{% for item in articleItems %} {% set did = item.did|default(item._id) %} {% set placements = item.placements|default([]) %} {% set allDomains = '*' in placements %} {% set canSelect = item.canSetVisibility|default(canManageGlobal) or item.canSetComments|default(canManageGlobal) or (item.canSetPlacement|default(true) and not (managerScope == 'domain' and allDomains)) %}
{{ item.title }}{{ did }}
{{ article_actions(item, did, 'mobile') }}
{% if item.excerpt %}{{ item.excerpt }}{% endif %}
{{ _('Author and classification') }} {{ user.render_inline(udict[item.owner], badge=false) }} {% if item.category and item.category != 'none' %}{{ item.category }}{% endif %} {% if item.courseRef %} {{ _('Course article') }}{% endif %}
{{ _('Reach') }} {{ _('{0} views').format(item.views|default(0)) }} ยท {{ _('{0} comments').format(item.nReply|default(0)) }} {{ _('Edited') }}: {{ datetimeSpan(item.contentUpdatedAt|default(item.updateAt)|default(item._id))|safe }}{% if item.contentUpdatedAtEstimated %} {{ _('Estimated') }}{% endif %}
{{ _('Status') }} {{ state_for(item, did) }}
{{ _('Featured domains') }} {{ placements_for(item) }}
{% endfor %}
{% else %}

{{ _('No articles match these filters') }}

{{ _('Try clearing one or more filters. No article data has been changed.') }}

{{ _('Clear filters') }}
{% endif %} {% if currentPage and pageCount %}{{ paginator.render(currentPage, pageCount, add_qs=qs) }}{% endif %}