From d80a59c7b1d3459579c3da95b64a5f235021aa59 Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Thu, 4 Dec 2014 12:10:38 +0200
Subject: [PATCH] Create helper for sort drowdown option names

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
---
 app/helpers/sorting_helper.rb               | 17 +++++++++++++++++
 app/views/admin/projects/index.html.haml    |  8 ++++----
 app/views/admin/users/index.html.haml       |  5 +++--
 app/views/dashboard/projects.html.haml      |  9 +++++----
 app/views/explore/groups/index.html.haml    |  8 ++++----
 app/views/explore/projects/index.html.haml  |  8 ++++----
 app/views/projects/branches/index.html.haml |  4 ++--
 app/views/shared/_sort_dropdown.html.haml   |  8 ++++----
 8 files changed, 43 insertions(+), 24 deletions(-)
 create mode 100644 app/helpers/sorting_helper.rb

diff --git a/app/helpers/sorting_helper.rb b/app/helpers/sorting_helper.rb
new file mode 100644
index 00000000000..59e58e2f3d3
--- /dev/null
+++ b/app/helpers/sorting_helper.rb
@@ -0,0 +1,17 @@
+module SortingHelper
+  def sort_title_oldest_updated
+    'Oldest updated'
+  end
+
+  def sort_title_recently_updated
+    'Recently updated'
+  end
+
+  def sort_title_oldest_created
+    'Recently updated'
+  end
+
+  def sort_title_recently_created
+    'Recently updated'
+  end
+end
diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml
index 2cd6b12be7f..aa59f38d213 100644
--- a/app/views/admin/projects/index.html.haml
+++ b/app/views/admin/projects/index.html.haml
@@ -56,13 +56,13 @@
                 = link_to admin_projects_path(sort: nil) do
                   Name
                 = link_to admin_projects_path(sort: 'newest') do
-                  Newest
+                  = sort_title_recently_created
                 = link_to admin_projects_path(sort: 'oldest') do
-                  Oldest
+                  = sort_title_oldest_created
                 = link_to admin_projects_path(sort: 'recently_updated') do
-                  Recently updated
+                  = sort_title_recently_updated
                 = link_to admin_projects_path(sort: 'last_updated') do
-                  Last updated
+                  = sort_title_oldest_updated
                 = link_to admin_projects_path(sort: 'largest_repository') do
                   Largest repository
           = link_to 'New Project', new_project_path, class: "btn btn-new"
diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml
index 92c619738a2..8e1ecb41a85 100644
--- a/app/views/admin/users/index.html.haml
+++ b/app/views/admin/users/index.html.haml
@@ -49,9 +49,10 @@
                 = link_to admin_users_path(sort: 'oldest_sign_in') do
                   Oldest sign in
                 = link_to admin_users_path(sort: 'recently_created') do
-                  Recently created
+                  = sort_title_recently_created
                 = link_to admin_users_path(sort: 'late_created') do
-                  Late created
+                  = sort_title_oldest_created
+
           = link_to 'New User', new_admin_user_path, class: "btn btn-new"
       %ul.well-list
         - @users.each do |user|
diff --git a/app/views/dashboard/projects.html.haml b/app/views/dashboard/projects.html.haml
index f124c688be1..5b7835b097b 100644
--- a/app/views/dashboard/projects.html.haml
+++ b/app/views/dashboard/projects.html.haml
@@ -14,13 +14,14 @@
         = link_to projects_dashboard_filter_path(sort: nil) do
           Name
         = link_to projects_dashboard_filter_path(sort: 'newest') do
-          Newest
+          = sort_title_recently_created
         = link_to projects_dashboard_filter_path(sort: 'oldest') do
-          Oldest
+          = sort_title_oldest_created
         = link_to projects_dashboard_filter_path(sort: 'recently_updated') do
-          Recently updated
+          = sort_title_recently_updated
         = link_to projects_dashboard_filter_path(sort: 'last_updated') do
-          Last updated
+          = sort_title_oldest_updated
+
 %p.light
   All projects you have access to are listed here. Public projects are not included here unless you are a member
 %hr
diff --git a/app/views/explore/groups/index.html.haml b/app/views/explore/groups/index.html.haml
index 709d062df83..9b1d7d0416d 100644
--- a/app/views/explore/groups/index.html.haml
+++ b/app/views/explore/groups/index.html.haml
@@ -20,13 +20,13 @@
           = link_to explore_groups_path(sort: nil) do
             Name
           = link_to explore_groups_path(sort: 'newest') do
-            Newest
+            = sort_title_recently_created
           = link_to explore_groups_path(sort: 'oldest') do
-            Oldest
+            = sort_title_oldest_created
           = link_to explore_groups_path(sort: 'recently_updated') do
-            Recently updated
+            = sort_title_recently_updated
           = link_to explore_groups_path(sort: 'last_updated') do
-            Last updated
+            = sort_title_oldest_updated
 
 %hr
 
diff --git a/app/views/explore/projects/index.html.haml b/app/views/explore/projects/index.html.haml
index f797c4e3830..02586077d8c 100644
--- a/app/views/explore/projects/index.html.haml
+++ b/app/views/explore/projects/index.html.haml
@@ -20,13 +20,13 @@
           = link_to explore_projects_path(sort: nil) do
             Name
           = link_to explore_projects_path(sort: 'newest') do
-            Newest
+            = sort_title_recently_created
           = link_to explore_projects_path(sort: 'oldest') do
-            Oldest
+            = sort_title_oldest_created
           = link_to explore_projects_path(sort: 'recently_updated') do
-            Recently updated
+            = sort_title_recently_updated
           = link_to explore_projects_path(sort: 'last_updated') do
-            Last updated
+            = sort_title_oldest_updated
 
 %hr
 .public-projects
diff --git a/app/views/projects/branches/index.html.haml b/app/views/projects/branches/index.html.haml
index 9f2b1b59292..d2aefd815a1 100644
--- a/app/views/projects/branches/index.html.haml
+++ b/app/views/projects/branches/index.html.haml
@@ -20,9 +20,9 @@
           = link_to project_branches_path(sort: nil) do
             Name
           = link_to project_branches_path(sort: 'recently_updated') do
-            Recently updated
+            = sort_title_recently_updated
           = link_to project_branches_path(sort: 'last_updated') do
-            Last updated
+            = sort_title_oldest_updated
 %hr
 - unless @branches.empty?
   %ul.bordered-list.top-list.all-branches
diff --git a/app/views/shared/_sort_dropdown.html.haml b/app/views/shared/_sort_dropdown.html.haml
index 7b37b39780e..54f59245690 100644
--- a/app/views/shared/_sort_dropdown.html.haml
+++ b/app/views/shared/_sort_dropdown.html.haml
@@ -9,13 +9,13 @@
   %ul.dropdown-menu
     %li
       = link_to project_filter_path(sort: 'newest') do
-        Newest
+        = sort_title_recently_created
       = link_to project_filter_path(sort: 'oldest') do
-        Oldest
+        = sort_title_oldest_created
       = link_to project_filter_path(sort: 'recently_updated') do
-        Recently updated
+        = sort_title_recently_updated
       = link_to project_filter_path(sort: 'last_updated') do
-        Last updated
+        = sort_title_oldest_updated
       = link_to project_filter_path(sort: 'milestone_due_soon') do
         Milestone due soon
       = link_to project_filter_path(sort: 'milestone_due_later') do
-- 
GitLab