Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The sorting feature is added to all the tables #60

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
8 changes: 6 additions & 2 deletions templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
{{ msg('app-title') }}
</title>
{% block stylesheets %}
<link rel="stylesheet" href="//tools-static.wmflabs.org/cdnjs/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css" />
<link rel="stylesheet" href="//tools-static.wmflabs.org/cdnjs/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the extra spaces at the end of the line.

{% endblock %}
{% block scripts %}
<script type="text/javascript" src="//tools-static.wmflabs.org/cdnjs/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script type="text/javascript" src="//tools-static.wmflabs.org/cdnjs/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.14.0/Sortable.min.js"></script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (which is https://github.com/SortableJS/Sortable ) doesn't seem to be a table-sorting library, but rather is for sorting lists. The one I was suggesting is https://github.com/HubSpot/sortable

Libraries should also be loaded from the tools-static.wmflabs.org/cdnjs service.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it was working for me. But will surely look into this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry perhaps I'm testing it wrongly.

I was expecting to see sorting icons on the table headers, is that right? I don't see anything like that, and there are no errors in the JS console.

{% endblock %}
</head>
<body>
Expand Down Expand Up @@ -49,7 +50,10 @@
{% block main %}
{% endblock %}
</main>

<script>
var table = document.getElementById('sortable');
var sortable = new Sortable(table);
</script>
<footer class="text-right">
<hr />
<ul class="list-inline">
Expand Down
4 changes: 2 additions & 2 deletions templates/contests.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</a>
</p>

<table class="table">
<table class="table" id="sortable">
<thead>
<tr>
<th>{{ msg('contest-col-header') }}</th>
Expand Down Expand Up @@ -46,7 +46,7 @@
{% endif %}

<h2>{{ msg('recently-ended-contests') }}</h2>
<table class="table">
<table class="table" id="sortable">
<tbody>
{% for contest in recent_contests %}
<tr class="
Expand Down
2 changes: 1 addition & 1 deletion templates/contests_view.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<div id="scores">
<h3>{{ msg('scores') }}</h3>
{% if can_view_scores %}
<table class="table">
<table class="table" id="sortable">
<caption>{{ msg('scores-legend', [score_calculation_interval~'']) }}</caption>
<thead>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion templates/contests_viewuser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<h2>{{ user.name }}</h2>

<table class="table table-condensed">
<table class="table table-condensed" id="sortable">
<thead>
<tr>
<th>{{ msg('index-page') }}</th>
Expand Down
2 changes: 1 addition & 1 deletion templates/home.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
3) the total number of constructive <em>Contributions</em> of all sorts.
</p>

<table class="table" role="table">
<table class="table" role="table" id="sortable">
<caption>Scoring system</caption>
<tr><th>Action taken</th><th>Points</th><th>Validations</th><th>Contributions</th></tr>
<tr><td>From any status to Proofread:</td><td>&nbsp;3</td><td>&nbsp;0</td><td>&nbsp;1</td></tr>
Expand Down