Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor <idrozdov@gitlab.com>2019-04-04 19:28:56 +0300
committerDouwe Maan <douwe@gitlab.com>2019-04-04 19:28:56 +0300
commit866b58a54e95415ad74b8f004db40abb4343c753 (patch)
treeed7436c916e4d3db48c255267255e9bbc4fbaa22 /app/helpers/wiki_helper.rb
parent8647230fa509cbba8e1853aae500315bf1116005 (diff)
Allow to sort wiki pages by date and title
- Add controls for sorting by title and date - Execute Gitaly call which now accepts sorting params for wikis
Diffstat (limited to 'app/helpers/wiki_helper.rb')
-rw-r--r--app/helpers/wiki_helper.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb
index 647f34e57ed..edd48f82729 100644
--- a/app/helpers/wiki_helper.rb
+++ b/app/helpers/wiki_helper.rb
@@ -47,4 +47,24 @@ module WikiHelper
def wiki_attachment_upload_url
expose_url(api_v4_projects_wikis_attachments_path(id: @project.id))
end
+
+ def wiki_sort_controls(project, sort, direction)
+ sort ||= ProjectWiki::TITLE_ORDER
+ link_class = 'btn btn-default has-tooltip reverse-sort-btn qa-reverse-sort'
+ reversed_direction = direction == 'desc' ? 'asc' : 'desc'
+ icon_class = direction == 'desc' ? 'highest' : 'lowest'
+
+ link_to(project_wikis_pages_path(project, sort: sort, direction: reversed_direction),
+ type: 'button', class: link_class, title: _('Sort direction')) do
+ sprite_icon("sort-#{icon_class}", size: 16)
+ end
+ end
+
+ def wiki_sort_title(key)
+ if key == ProjectWiki::CREATED_AT_ORDER
+ s_("Wiki|Created date")
+ else
+ s_("Wiki|Title")
+ end
+ end
end