Skip to content

Commit

Permalink
TopEdits: show page assessment if applicable
Browse files Browse the repository at this point in the history
EditCounter: rm unused code
  • Loading branch information
MusikAnimal committed Oct 10, 2017
1 parent b3122fe commit 2909e2c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 40 deletions.
22 changes: 20 additions & 2 deletions app/Resources/views/topedits/result_namespace.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
{% else %}

{% for ns, pages in te.topEdits %}
{% set showPageAssessment = ns == 0 and project.hasPageAssessments %}
{% set content %}
<table class="table table-bordered table-hover table-striped topedits-namespace-table xt-show-hide--target">
<thead><tr>
Expand All @@ -51,17 +52,34 @@
<span class="glyphicon glyphicon-sort"></span>
</span>
</th>
{% if showPageAssessment %}
<th>
<span class="sort-link sort-link--assessment" data-column="assessment">
{{ msg('assessment') }}
<span class="glyphicon glyphicon-sort"></span>
</span>
</th>
{% endif %}
<th>{{ msg('links') }}</th>
</tr></thead>
<tbody>
{% for page in pages %}
<tr>
<td class="sort-entry--edits tdnum" data-value="{{ page.count }}">
<td class="sort-entry--edits" data-value="{{ page.count }}">
{{ page.count|num_format }}
</td>
<td class="sort-entry--page display-title" data-value="{{ page.page_title_ns }}">
{{ wiki.pageLinkRaw(page.page_title_ns, project, page.displaytitle) }}
</td>
{% if showPageAssessment %}
<td class="sort-entry--assessment" data-value="{{ page.pa_class ? page.pa_class : 'Unknown' }}">
{% set badge = project.assessmentBadgeURL(page.pa_class)%}
{% if badge is defined %}
<img alt="{{ page.pa_class }}" src="{{ badge }}" class="assessment-badge" />
{% endif %}
{{ page.pa_class ? page.pa_class : msg('unknown') }}
</td>
{% endif %}
<td>
{{ wiki.pageLogLinkRaw(page.page_title_ns, project) }}
&middot;
Expand All @@ -73,7 +91,7 @@
{% endfor %}
{% if pages|length >= 10 and te.topEdits|length > 1 %}
<tr>
<td colspan=3>
<td colspan={{ showPageAssessment ? 4 : 3 }}>
<a href="{{ path('TopEditsResults', {project:project.domain, username:user.username, namespace:ns, article:''}) }}">
{{ msg('more') }}&hellip;
</a>
Expand Down
38 changes: 0 additions & 38 deletions web/static/js/editcounter.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,46 +43,12 @@ $(function () {
});
});

/**
* Load top edits HTML via AJAX, to not slow down the initial page load.
* Only load if container is present, which is missing in subroutes, e.g. ec-namespacetotals, etc.
* @return {Deferred} jQuery Deferred promise.
*/
// function loadTopEdits()
// {
// var dfd = $.Deferred();
// var $topEditsContainer = $("#topedits-container");

// if ($topEditsContainer[0]) {
// /** global: xtBaseUrl */
// var url = xtBaseUrl + 'topedits/'
// + $topEditsContainer.data('project') + '/'
// + $topEditsContainer.data('username') + '/all?htmlonly=yes';
// $.ajax({
// url: url,
// timeout: 30000
// }).done(function (data) {
// $topEditsContainer.replaceWith(data);
// }).fail(function (_xhr, _status, message) {
// $topEditsContainer.replaceWith(
// $.i18n('api-error', 'TopEdits API: <code>' + message + '</code>')
// );
// }).always(function () {
// dfd.resolve();
// });
// }

// return dfd;
// };

/**
* Load recent global edits' HTML via AJAX, to not slow down the initial page load.
* Only load if container is present, which is missing in subroutes, e.g. ec-namespacetotals, etc.
* @return {Deferred} jQuery Deferred promise.
*/
function loadLatestGlobal()
{
var dfd = $.Deferred();
var $latestGlobalContainer = $("#latestglobal-container");

if ($latestGlobalContainer[0]) {
Expand All @@ -99,12 +65,8 @@ function loadLatestGlobal()
$latestGlobalContainer.replaceWith(
$.i18n('api-error', 'Global contributions API: <code>' + message + '</code>')
);
}).always(function () {
dfd.resolve();
});
}

return dfd;
}

/**
Expand Down

0 comments on commit 2909e2c

Please sign in to comment.