Skip to content

Commit

Permalink
Reconfigure filter warning messages
Browse files Browse the repository at this point in the history
Set up three filter-message sections (only one of which is
displayed) and modify the form-panel descriptions depending
on the event state.

Bug: T218340
  • Loading branch information
samwilson committed Mar 20, 2019
1 parent c2f0db0 commit 648eed6
Show file tree
Hide file tree
Showing 15 changed files with 223 additions and 49 deletions.
36 changes: 36 additions & 0 deletions app/Resources/assets/css/events.scss
Expand Up @@ -16,6 +16,10 @@
margin-bottom: 0;
}

.event-metadata {
margin-bottom: 2em;
}

.event-metadata td {
padding-bottom: 3px;

Expand All @@ -31,6 +35,38 @@
.event-wiki-stats--empty {
margin: 36px 0;
}
.event-errorbox {
padding: 20px;
margin: 0 0 10px 0;
border: 1px solid #eee;
border-left-width: 5px;
border-radius: 3px;
h3 {
margin-top: 0 !important;
}
&.warn {
border-left-color: #eea236;
}
&.warn h3 {
color: #eea236;
}
&.error {
border-left-color: #d9534f;
}
&.error h3 {
color: #d9534f;
}
}
.panel-heading .glyphicon {
display: inline-block;
margin-left: 1em;
&.error {
color: #d9534f;
}
&.warn {
color: #f0ad4e;
}
}

// Remove space above the 'Statistics' H2, and reduce the margin between it and the following element.
section#stats h2 {
Expand Down
15 changes: 8 additions & 7 deletions app/Resources/views/events/_categories.html.twig
Expand Up @@ -73,10 +73,11 @@
{{ form_end(form, {'render_rest': false}) }}
{% endset %}

{{
layout.panel(
'categories',
event.numCategories(true) ~ ' ' ~ msg('num-categories', [event.numCategories(true)]),
content
)
}}
{% if filtersMissing %}
{% set panelDesc = msg('no-categories') ~ ' <span class="error glyphicon glyphicon-asterisk"></span>' %}
{% elseif event.numParticipants == 0 and wikisWithoutCats.count %}
{% set panelDesc = msg('not-all-wikis-have-cats') ~ ' <span class="warn glyphicon glyphicon-warning-sign"></span>' %}
{% else %}
{% set panelDesc = msg('num-categories', [event.numCategories(true)]) %}
{% endif %}
{{ layout.panel('categories-panel-title', panelDesc, content) }}
17 changes: 10 additions & 7 deletions app/Resources/views/events/_participants.html.twig
Expand Up @@ -79,10 +79,13 @@
{% endset %}

{# Here we use event.participants.count, ensuring it's the number of manually entered participants (and not derived). #}
{{
layout.panel(
'participants',
event.participants.count ~ ' ' ~ msg('num-participants', [event.participants.count]),
content
)
}}
{% if event.participants.count == 0 and event.wikiByDomain('www.wikidata') %}
{% set panel_desc = msg('error-filters-wikidata-panel') ~ ' <span class="error glyphicon glyphicon-asterisk"></span>' %}
{% elseif not filtersMissing and event.participants.count == 0 and wikisWithoutCats.count %}
{% set panel_desc = msg('no-participants') ~ ' <span class="warn glyphicon glyphicon-warning-sign"></span>' %}
{% elseif filtersMissing %}
{% set panel_desc = msg('no-participants') ~ ' <span class="error glyphicon glyphicon-asterisk"></span>' %}
{% else %}
{% set panel_desc = msg('num-participants', [event.participants.count]) %}
{% endif %}
{{ layout.panel('participants-panel-title', panel_desc, content) }}
85 changes: 65 additions & 20 deletions app/Resources/views/events/show.html.twig
Expand Up @@ -26,6 +26,71 @@

{% include 'events/_metadata.html.twig' with {'event': event} %}

{% if filtersMissing %}
<section class="event-errorbox error">
<h3>{{ msg('error-filters-header') }}</h3>
<p>
{{ msg('error-filters-desc') }}
<a href="https://meta.wikimedia.org/wiki/Special:MyLanguage/Event_Metrics#adding-participants"
title="{{ msg('error-filters-desc-tooltip') }}">
<span class="glyphicon glyphicon-question-sign"></span>
</a>
</p>
<ul>
<li>{{ msg('error-filters-participants-or-categories') }}</li>
<li>{{ msg('error-filters-every-wiki') }}</li>
<li>{{ msg('error-filters-participants-desc') }}</li>
<li>{{ msg('error-filters-categories-desc') }}</li>
<li>{{ msg('error-filters-combination') }}</li>
</ul>
</section>

{% elseif event.numParticipants == 0 and wikisWithoutCats.count %}
<section class="event-errorbox warn">
<h3>{{ msg('category-warning-header') }}</h3>
<p>
{{ msg('category-warning-desc') }}
<a href="https://meta.wikimedia.org/wiki/Special:MyLanguage/Event_Metrics#adding-categories"
title="{{ msg('category-warning-desc-tooltip') }}">
<span class="glyphicon glyphicon glyphicon-question-sign"></span>
</a>
</p>
<ul>
<li>
{{ msg('error-filters-categories-missing') }}
<strong>
{% for noCatWiki in wikisWithoutCats %}
{{ noCatWiki.domain }}{% if not loop.last %},{% endif %}
{% endfor %}
</strong>
</li>
<li>{{ msg('error-filters-every-wiki') }}</li>
{% if event.wikiByDomain('www.wikidata') %}
<li>{{ msg('error-filters-wikidata') }}</li>
{% endif %}
<li>{{ msg('error-filters-participants-desc') }}</li>
<li>{{ msg('error-filters-categories-desc') }}</li>
</ul>
</section>

{% elseif not event.hasJob %}
<div class="alert alert-success">
{% if event.startUTC > date() %}
{{ msg('event-in-future') }}
(<a href="{{ path('EditEvent', {'programId': program.id, 'eventId': event.id}) }}">{{ msg('settings')|lower }}</a>)
{% else %}
{{ msg('event-no-data') }}
<a href="#" class="event-process-link">{{ msg('calculate-totals') }}</a>.
{% endif %}
</div>
{% endif %}

{### FORMS ###}
{% for formType, form in forms %}
{% form_theme form 'blocks/forms.html.twig' %}
{% include ('events/_' ~ formType|lower ~ '.html.twig') %}
{% endfor %}

<section id="stats">
{% if event.updated is not null %}
{% if event.wikis|length > 1 %}
Expand Down Expand Up @@ -63,28 +128,8 @@
{% else %}
{% include 'events/_stats_summary.html.twig' with {'event': event} %}
{% endif %}
{% else %}
<div class="text-center event-wiki-stats--empty">
{% if event.hasJob %}
&nbsp;
{% elseif event.numParticipants == 0 and event.numCategories == 0 %}
{{ msg('event-misconfig', [[msg('participants'), msg('categories')]|join(', ')]) }}
{% elseif event.startUTC > date() %}
{{ msg('event-in-future') }}
(<a href="{{ path('EditEvent', {'programId': program.id, 'eventId': event.id}) }}">{{ msg('settings')|lower }}</a>)
{% else %}
{{ msg('event-no-data') }}
<a href="#" class="event-process-link">{{ msg('calculate-totals') }}</a>.
{% endif %}
</div>
{% endif %}
</section><!-- #stats -->

{### FORMS ###}

{% for formType, form in forms %}
{% form_theme form 'blocks/forms.html.twig' %}
{% include ('events/_' ~ formType|lower ~ '.html.twig') with {'form': form, 'event': event, 'isOrganizer': isOrganizer} %}
{% endfor %}
</div>
{% endblock %}
2 changes: 1 addition & 1 deletion app/Resources/views/macros/layout.html.twig
Expand Up @@ -15,7 +15,7 @@
</a>
</h3>
<div class="panel-description text-right">
{{ description }}
{{ description|raw }}
</div>
</div>
<div id="panelBody{{ title|ucfirst }}" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="panelHeading{{ title|ucfirst }}">
Expand Down
25 changes: 22 additions & 3 deletions i18n/en.json
Expand Up @@ -22,8 +22,12 @@
"calculate-totals": "Calculate totals",
"cancel": "Cancel",
"categories": "Categories",
"categories-panel-title": "Categories filter",
"categories-description": "Enter categories (with wiki names) to limit metrics to pages in those categories",
"categories-commons-explanation": "On Commons only, use this to filter files (images, videos, etc.), instead of pages.",
"category-warning-header": "Event partially configured",
"category-warning-desc": "You will get metrics for some but not all of the wikis specified for the event. Narrowly focus your metrics.",
"category-warning-desc-tooltip": "Read more about how to enter categories",
"category-name": "Category name",
"close": "Close",
"confirm-deletion": "Are you sure you want to delete '$1'?",
Expand All @@ -48,6 +52,18 @@
"error-event-retry-link": "report this issue",
"error-event-timeout": "This process took too long and was stopped.",
"error-event-undeletable": "This event cannot be deleted because it has one or more participants.",
"error-filters-categories-desc": "Category filters are specific to individual wikis.",
"error-filters-categories-missing": "The following wikis require filtering:",
"error-filters-combination": "If you combine Categories and Participants, the system will provide metrics for contributions that satisfy both filters (i.e., Category AND Participants).",
"error-filters-desc": "Event setup isn't complete yet. Please use one or both of the filters below to more narrowly focus your metrics.",
"error-filters-desc-tooltip": "Read more about how to enter participant usernames",
"error-filters-every-wiki": "You must provide filtering for every wiki for which you want metrics.",
"error-filters-header": "Filters required",
"error-filters-participants-desc": "Participants filtering applies to all wikis and satisfies all filtering requirements.",
"error-filters-participants-none": "No participants supplied",
"error-filters-participants-or-categories": "You can filter by Participants or Categories—or combine the two.",
"error-filters-wikidata": "To get metrics about <strong>Wikidata</strong>, you must supply Participants. (Categories don't exist on Wikidata.)",
"error-filters-wikidata-panel": "Required for Wikidata",
"error-invalid": "This value is not valid.",
"error-non-organizer": "You are not authorized to view this program because you are not an organizer.",
"error-not-found": "The request program or event was not found. It may have been deleted or renamed.",
Expand All @@ -73,7 +89,6 @@
"event-list": "Event list",
"event-metrics": "Event Metrics",
"event-metrics-welcome": "Welcome to Event Metrics",
"event-misconfig": "This event has not been completely configured. In order to generate statistics, you must add one of the following: $1",
"event-no-data": "Statistics have not yet been generated for this event.",
"event-settings": "Event settings",
"event-summary": "Event summary",
Expand Down Expand Up @@ -102,14 +117,17 @@
"my-programs": "My programs",
"new-editors": "New editors",
"new-editors-desc": "The number of new accounts created, including users that registered up to $1 {{PLURAL:$1|day|days}} before the event (on any wiki).",
"no-categories": "No categories supplied",
"no-events": "No events in this program yet!",
"no-participants": "No participants supplied",
"no-programs": "You have not created any programs.",
"no-results": "No results found",
"num-categories": "{{PLURAL:$1|category|categories}}",
"not-all-wikis-have-cats": "Categories not supplied for some wikis",
"num-categories": "$1 {{PLURAL:$1|category|categories}}",
"num-days": "{{PLURAL:$1|day|days}}",
"num-hours": "{{PLURAL:$1|hour|hours}}",
"num-minutes": "{{PLURAL:$1|minute|minutes}}",
"num-participants": "{{PLURAL:$1|participant|participants}}",
"num-participants": "$1 {{PLURAL:$1|participant|participants}}",
"num-revisions": "{{PLURAL:$1|revision|revisions}}",
"num-seconds": "{{PLURAL:$1|second|seconds}}",
"num-wikis": "{{PLURAL:$1|wiki|wikis}}",
Expand All @@ -129,6 +147,7 @@
"pageviews-average": "Avg. daily pageviews",
"pageviews-cumulative": "Pageviews, cumulative",
"participants": "Participants",
"participants-panel-title": "Participants filter",
"please-login": "Please login to continue.",
"program": "Program",
"program-created": "The program '$1' was successfully created.",
Expand Down
25 changes: 22 additions & 3 deletions i18n/qqq.json
Expand Up @@ -22,8 +22,12 @@
"calculate-totals": "Label for button to calculate the statistics for an event.",
"cancel": "Label for button\n{{Identical|Cancel}}",
"categories": "Label for section showing MediaWiki categories associated with an Event.\n{{Identical|Category}}",
"categories-panel-title": "Title for the categories' filter form panel. Same function as {{msg-wm|participants-panel-title}}.",
"categories-description": "Description of how categories are used to generate statistics.",
"categories-commons-explanation": "Additional explanation the category selection interface.",
"category-warning-header": "Header for an error box describing incomplete filter state.",
"category-warning-desc": "More detailed description in an error box, shown below {{msg-wm|category-warning-header}}.",
"category-warning-desc-tooltip": "Tooltip for the help link that follows {{msg-wm|category-warning-desc}}.",
"category-name": "Placeholder for input to enter the name of a category.",
"close": "Button text to close a modal.\n{{Identical|Close}}",
"confirm-deletion": "Popup message confirming the user wants to delete the program or event. $1 is the name of the program or event.",
Expand All @@ -48,6 +52,18 @@
"error-event-retry-link": "Text for the link to report an issue, used in the 'error-event-retry' message.",
"error-event-timeout": "Error message shown when updating an event timed out.",
"error-event-undeletable": "Error message shown when the user attempts to delete an Event that has one or more participants.",
"error-filters-categories-desc": "Bullet-point help sentence about category filters.",
"error-filters-categories-missing": "Bullet-point help label for a comma-separated list of wiki domain names.",
"error-filters-combination": "Bullet-point help sentence describing the conjunctive nature of the filters.",
"error-filters-desc": "Description of an error box when no filters are provided. Followed by a link with {{msg-wm|error-filters-desc-tooltip}} as the tooltip.",
"error-filters-desc-tooltip": "Tooltip for a help link that follows {{msg-wm|error-filters-desc}}.",
"error-filters-every-wiki": "Bullet-point help sentence about requiring some sort of filter for every wiki in an event.",
"error-filters-header": "Header of an error box describing missing filters.",
"error-filters-participants-desc": "Bullet-point help sentence about the participants filter.",
"error-filters-participants-none": "Description shown in the participants form panel.",
"error-filters-participants-or-categories": "Bullet-list help sentence about requiring at least one filter type.",
"error-filters-wikidata": "Bullet-point help sentence describing the requirement of Participants if Wikidata is an event wiki. The word 'Wikidata' should be strongly emphasised with HTML.",
"error-filters-wikidata-panel": "Description shown in the participants' form panel.",
"error-invalid": "Generic error message shown next to a field, indicating that it is invalid.",
"error-non-organizer": "Error message saying a user can't view a program or event because they are not an organizer.",
"error-not-found": "Error message shown when a user tries to view a program or event that does not exist.",
Expand All @@ -72,7 +88,6 @@
"event-list": "Title of page that list all the events belonging to a program.",
"event-metrics": "Title of the Event Metrics application.",
"event-metrics-welcome": "Message shown on the homepage. 'Event Metrics' is the name of the application.",
"event-misconfig": "Message saying that the event needs more configuration before statistics can be generated. $1 is a list of things the user needs to add.",
"event-no-data": "Message saying that statistics have not been generated for the event yet.",
"event-settings": "Name of the page to configure an event.",
"event-summary": "Name of the page that shows the overall statistics for an event.",
Expand Down Expand Up @@ -101,14 +116,17 @@
"my-programs": "Heading for the 'My Programs' page, which list all the programs an organizer has created.",
"new-editors": "Heading for the column listing the number of new editors that participated in a program, shown in the 'My Programs' table.",
"new-editors-desc": "Description for the 'new editors' metric. $1 is a number of days.",
"no-categories": "Description shown in categories' form panel header when there are no categories.",
"no-events": "Message shown on the Programs page when the user has not created any events yet.",
"no-participants": "Description shown in categories' form panel header when there are no participants.",
"no-programs": "Message shown when the user has not created any programs yet.",
"no-results": "Notice telling the user that no results were found",
"num-categories": "Conditional PLURAL form of 'category', as in a MediaWiki category. $1 is the number.\n{{Identical|Category}}",
"not-all-wikis-have-cats": "Description shown in categories' form panel header when some wikis are missing categories.",
"num-categories": "Description text for the header of the categories' filter panel.\n$1 is the number of categories.",
"num-days": "Conditional PLURAL form of 'day'. $1 is the number.\n{{Identical|Day}}",
"num-hours": "Conditional PLURAL form of 'hour'. $1 is the number.\n{{Identical|Hour}}",
"num-minutes": "Conditional PLURAL form of 'minute'. $1 is the number.\n{{Identical|Minute}}",
"num-participants": "Conditional PLURAL form of 'participant'. $1 is the number.",
"num-participants": "Description text for the header of the participants filter panel. $1 is the number of participants.",
"num-revisions": "Conditional PLURAL form of 'revisions'. $1 is the number.\n{{Identical|Revision}}",
"num-seconds": "Conditional PLURAL form of 'second'. $1 is the number.\n{{Identical|Second}}",
"num-wikis": "Conditional PLURAL form of 'wiki'. $1 is the number.\n{{Identical|Wiki}}",
Expand All @@ -128,6 +146,7 @@
"pageviews-average": "Label for value that is the average number of pageviews a page has received per day.",
"pageviews-cumulative": "Label for value that is the number of pageviews a page has received to date.",
"participants": "Heading for the column listing the number of participants of a program in the 'My Programs' table.",
"participants-panel-title": "Title for the participants' form panel. Same function as {{msg-wm|categories-panel-title}}.",
"please-login": "Error message saying the user needs to login in order to continue.",
"program": "Heading for the column listing program titles in the 'My Programs' table.\n{{Identical|Program}}",
"program-created": "Message saying a program was created. $1 is the name of the program.",
Expand Down

0 comments on commit 648eed6

Please sign in to comment.