Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
bbca6a0a
Commit
bbca6a0a
authored
Feb 05, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor sorting in project
parent
e0aa5c37
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
195 additions
and
108 deletions
+195
-108
app/controllers/admin/groups_controller.rb
app/controllers/admin/groups_controller.rb
+2
-1
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+2
-2
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+2
-2
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+1
-1
app/helpers/sorting_helper.rb
app/helpers/sorting_helper.rb
+79
-0
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+1
-9
app/models/concerns/sortable.rb
app/models/concerns/sortable.rb
+15
-10
app/models/group.rb
app/models/group.rb
+10
-16
app/models/project.rb
app/models/project.rb
+4
-7
app/models/user.rb
app/models/user.rb
+4
-5
app/views/admin/groups/index.html.haml
app/views/admin/groups/index.html.haml
+21
-0
app/views/admin/projects/index.html.haml
app/views/admin/projects/index.html.haml
+8
-10
app/views/admin/users/index.html.haml
app/views/admin/users/index.html.haml
+14
-10
app/views/dashboard/_projects_filter.html.haml
app/views/dashboard/_projects_filter.html.haml
+8
-8
app/views/explore/groups/index.html.haml
app/views/explore/groups/index.html.haml
+7
-8
app/views/explore/projects/index.html.haml
app/views/explore/projects/index.html.haml
+6
-8
app/views/shared/_sort_dropdown.html.haml
app/views/shared/_sort_dropdown.html.haml
+10
-10
features/steps/groups.rb
features/steps/groups.rb
+1
-1
No files found.
app/controllers/admin/groups_controller.rb
View file @
bbca6a0a
...
@@ -2,7 +2,8 @@ class Admin::GroupsController < Admin::ApplicationController
...
@@ -2,7 +2,8 @@ class Admin::GroupsController < Admin::ApplicationController
before_filter
:group
,
only:
[
:edit
,
:show
,
:update
,
:destroy
,
:project_update
,
:project_teams_update
]
before_filter
:group
,
only:
[
:edit
,
:show
,
:update
,
:destroy
,
:project_update
,
:project_teams_update
]
def
index
def
index
@groups
=
Group
.
order_name
@groups
=
Group
.
all
@groups
=
@groups
.
sort
(
@sort
=
params
[
:sort
])
@groups
=
@groups
.
search
(
params
[
:name
])
if
params
[
:name
].
present?
@groups
=
@groups
.
search
(
params
[
:name
])
if
params
[
:name
].
present?
@groups
=
@groups
.
page
(
params
[
:page
]).
per
(
20
)
@groups
=
@groups
.
page
(
params
[
:page
]).
per
(
20
)
end
end
...
...
app/controllers/admin/users_controller.rb
View file @
bbca6a0a
...
@@ -2,10 +2,10 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -2,10 +2,10 @@ class Admin::UsersController < Admin::ApplicationController
before_filter
:user
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
before_filter
:user
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
def
index
def
index
@users
=
User
.
filter
(
params
[
:filter
])
@users
=
User
.
order_name_asc
.
filter
(
params
[
:filter
])
@users
=
@users
.
search
(
params
[
:name
])
if
params
[
:name
].
present?
@users
=
@users
.
search
(
params
[
:name
])
if
params
[
:name
].
present?
@users
=
@users
.
sort
(
@sort
=
params
[
:sort
])
@users
=
@users
.
sort
(
@sort
=
params
[
:sort
])
@users
=
@users
.
order_name
.
page
(
params
[
:page
])
@users
=
@users
.
page
(
params
[
:page
])
end
end
def
show
def
show
...
...
app/controllers/application_controller.rb
View file @
bbca6a0a
...
@@ -254,7 +254,7 @@ class ApplicationController < ActionController::Base
...
@@ -254,7 +254,7 @@ class ApplicationController < ActionController::Base
end
end
def
set_filters_params
def
set_filters_params
params
[
:sort
]
||=
'
newest
'
params
[
:sort
]
||=
'
created_desc
'
params
[
:scope
]
=
'all'
if
params
[
:scope
].
blank?
params
[
:scope
]
=
'all'
if
params
[
:scope
].
blank?
params
[
:state
]
=
'opened'
if
params
[
:state
].
blank?
params
[
:state
]
=
'opened'
if
params
[
:state
].
blank?
...
@@ -280,7 +280,7 @@ class ApplicationController < ActionController::Base
...
@@ -280,7 +280,7 @@ class ApplicationController < ActionController::Base
author_id
=
@filter_params
[
:author_id
]
author_id
=
@filter_params
[
:author_id
]
milestone_id
=
@filter_params
[
:milestone_id
]
milestone_id
=
@filter_params
[
:milestone_id
]
@sort
=
@filter_params
[
:sort
]
.
try
(
:humanize
)
@sort
=
@filter_params
[
:sort
]
@assignees
=
User
.
where
(
id:
collection
.
pluck
(
:assignee_id
))
@assignees
=
User
.
where
(
id:
collection
.
pluck
(
:assignee_id
))
@authors
=
User
.
where
(
id:
collection
.
pluck
(
:author_id
))
@authors
=
User
.
where
(
id:
collection
.
pluck
(
:author_id
))
@milestones
=
Milestone
.
where
(
id:
collection
.
pluck
(
:milestone_id
))
@milestones
=
Milestone
.
where
(
id:
collection
.
pluck
(
:milestone_id
))
...
...
app/controllers/dashboard_controller.rb
View file @
bbca6a0a
...
@@ -9,7 +9,7 @@ class DashboardController < ApplicationController
...
@@ -9,7 +9,7 @@ class DashboardController < ApplicationController
# If user needs more - point to Dashboard#projects page
# If user needs more - point to Dashboard#projects page
@projects_limit
=
30
@projects_limit
=
30
@groups
=
current_user
.
authorized_groups
.
sort_by
(
&
:human_name
)
@groups
=
current_user
.
authorized_groups
.
order_name_asc
@has_authorized_projects
=
@projects
.
count
>
0
@has_authorized_projects
=
@projects
.
count
>
0
@projects_count
=
@projects
.
count
@projects_count
=
@projects
.
count
@projects
=
@projects
.
limit
(
@projects_limit
)
@projects
=
@projects
.
limit
(
@projects_limit
)
...
...
app/helpers/sorting_helper.rb
View file @
bbca6a0a
module
SortingHelper
module
SortingHelper
def
sort_options_hash
{
sort_value_name
=>
sort_title_name
,
sort_value_recently_updated
=>
sort_title_recently_updated
,
sort_value_oldest_updated
=>
sort_title_oldest_updated
,
sort_value_recently_created
=>
sort_title_recently_created
,
sort_value_oldest_created
=>
sort_title_oldest_created
,
sort_value_milestone_soon
=>
sort_title_milestone_soon
,
sort_value_milestone_later
=>
sort_title_milestone_later
,
sort_value_largest_repo
=>
sort_title_largest_repo
,
sort_value_recently_signin
=>
sort_title_recently_signin
,
sort_value_oldest_signin
=>
sort_title_oldest_signin
,
}
end
def
sort_title_oldest_updated
def
sort_title_oldest_updated
'Oldest updated'
'Oldest updated'
end
end
...
@@ -14,4 +29,68 @@ module SortingHelper
...
@@ -14,4 +29,68 @@ module SortingHelper
def
sort_title_recently_created
def
sort_title_recently_created
'Recently created'
'Recently created'
end
end
def
sort_title_milestone_soon
'Milestone due soon'
end
def
sort_title_milestone_later
'Milestone due later'
end
def
sort_title_name
'Name'
end
def
sort_title_largest_repo
'Largest repository'
end
def
sort_title_recently_signin
'Recent sign in'
end
def
sort_title_oldest_signin
'Oldest sign in'
end
def
sort_value_oldest_updated
'updated_asc'
end
def
sort_value_recently_updated
'updated_desc'
end
def
sort_value_oldest_created
'created_asc'
end
def
sort_value_recently_created
'created_desc'
end
def
sort_value_milestone_soon
'milestone_due_asc'
end
def
sort_value_milestone_later
'milestone_due_desc'
end
def
sort_value_name
'name_asc'
end
def
sort_value_largest_repo
'repository_size_desc'
end
def
sort_value_recently_signin
'recent_sign_in'
end
def
sort_value_oldest_signin
'oldest_sign_in'
end
end
end
app/models/concerns/issuable.rb
View file @
bbca6a0a
...
@@ -54,15 +54,7 @@ module Issuable
...
@@ -54,15 +54,7 @@ module Issuable
end
end
def
sort
(
method
)
def
sort
(
method
)
case
method
.
to_s
order_by
(
method
)
when
'newest'
then
reorder
(
"
#{
table_name
}
.created_at DESC"
)
when
'oldest'
then
reorder
(
"
#{
table_name
}
.created_at ASC"
)
when
'recently_updated'
then
reorder
(
"
#{
table_name
}
.updated_at DESC"
)
when
'last_updated'
then
reorder
(
"
#{
table_name
}
.updated_at ASC"
)
when
'milestone_due_soon'
then
joins
(
:milestone
).
reorder
(
"milestones.due_date ASC"
)
when
'milestone_due_later'
then
joins
(
:milestone
).
reorder
(
"milestones.due_date DESC"
)
else
reorder
(
"
#{
table_name
}
.created_at DESC"
)
end
end
end
end
end
...
...
app/models/concerns/sortable.rb
View file @
bbca6a0a
...
@@ -9,21 +9,26 @@ module Sortable
...
@@ -9,21 +9,26 @@ module Sortable
# By default all models should be ordered
# By default all models should be ordered
# by created_at field starting from newest
# by created_at field starting from newest
default_scope
{
order
(
created_at: :desc
,
id: :desc
)
}
default_scope
{
order
(
created_at: :desc
,
id: :desc
)
}
scope
:order_name
,
->
{
reorder
(
name: :asc
)
}
scope
:order_recent
,
->
{
reorder
(
created_at: :desc
,
id: :desc
)
}
scope
:order_name_asc
,
->
{
reorder
(
name: :asc
)
}
scope
:order_oldest
,
->
{
reorder
(
created_at: :asc
,
id: :asc
)
}
scope
:order_created_desc
,
->
{
reorder
(
created_at: :desc
,
id: :desc
)
}
scope
:order_recent_updated
,
->
{
reorder
(
updated_at: :desc
,
id: :desc
)
}
scope
:order_created_asc
,
->
{
reorder
(
created_at: :asc
,
id: :asc
)
}
scope
:order_oldest_updated
,
->
{
reorder
(
updated_at: :asc
,
id: :asc
)
}
scope
:order_updated_desc
,
->
{
reorder
(
updated_at: :desc
,
id: :desc
)
}
scope
:order_updated_asc
,
->
{
reorder
(
updated_at: :asc
,
id: :asc
)
}
scope
:order_milestone_due_desc
,
->
{
joins
(
:milestone
).
reorder
(
'milestones.due_date DESC, milestones.id DESC'
)
}
scope
:order_milestone_due_asc
,
->
{
joins
(
:milestone
).
reorder
(
'milestones.due_date ASC, milestones.id ASC'
)
}
end
end
module
ClassMethods
module
ClassMethods
def
order_by
(
method
)
def
order_by
(
method
)
case
method
.
to_s
case
method
.
to_s
when
'name'
then
order_name_asc
when
'name_asc'
then
order_name_asc
when
'recent'
then
order_recent
when
'updated_asc'
then
order_updated_asc
when
'oldest'
then
order_oldest
when
'updated_desc'
then
order_updated_desc
when
'recent_updated'
then
order_recent_updated
when
'created_asc'
then
order_created_asc
when
'oldest_updated'
then
order_oldest_updated
when
'created_desc'
then
order_created_desc
when
'milestone_due_asc'
then
order_milestone_due_asc
when
'milestone_due_desc'
then
order_milestone_due_desc
else
else
all
all
end
end
...
...
app/models/group.rb
View file @
bbca6a0a
...
@@ -28,6 +28,16 @@ class Group < Namespace
...
@@ -28,6 +28,16 @@ class Group < Namespace
after_create
:post_create_hook
after_create
:post_create_hook
after_destroy
:post_destroy_hook
after_destroy
:post_destroy_hook
class
<<
self
def
search
(
query
)
where
(
"LOWER(namespaces.name) LIKE :query or LOWER(namespaces.path) LIKE :query"
,
query:
"%
#{
query
.
downcase
}
%"
)
end
def
sort
(
method
)
order_by
(
method
)
end
end
def
human_name
def
human_name
name
name
end
end
...
@@ -88,20 +98,4 @@ class Group < Namespace
...
@@ -88,20 +98,4 @@ class Group < Namespace
def
system_hook_service
def
system_hook_service
SystemHooksService
.
new
SystemHooksService
.
new
end
end
class
<<
self
def
search
(
query
)
where
(
"LOWER(namespaces.name) LIKE :query or LOWER(namespaces.path) LIKE :query"
,
query:
"%
#{
query
.
downcase
}
%"
)
end
def
sort
(
method
)
case
method
.
to_s
when
"newest"
then
reorder
(
"namespaces.created_at DESC"
)
when
"oldest"
then
reorder
(
"namespaces.created_at ASC"
)
when
"recently_updated"
then
reorder
(
"namespaces.updated_at DESC"
)
when
"last_updated"
then
reorder
(
"namespaces.updated_at ASC"
)
else
reorder
(
"namespaces.path, namespaces.name ASC"
)
end
end
end
end
end
app/models/project.rb
View file @
bbca6a0a
...
@@ -231,13 +231,10 @@ class Project < ActiveRecord::Base
...
@@ -231,13 +231,10 @@ class Project < ActiveRecord::Base
end
end
def
sort
(
method
)
def
sort
(
method
)
case
method
.
to_s
if
method
==
'repository_size_desc'
when
'newest'
then
reorder
(
'projects.created_at DESC'
)
reorder
(
repository_size: :desc
,
id: :desc
)
when
'oldest'
then
reorder
(
'projects.created_at ASC'
)
else
when
'recently_updated'
then
reorder
(
'projects.updated_at DESC'
)
order_by
(
method
)
when
'last_updated'
then
reorder
(
'projects.updated_at ASC'
)
when
'largest_repository'
then
reorder
(
'projects.repository_size DESC'
)
else
reorder
(
'namespaces.path, projects.name ASC'
)
end
end
end
end
end
end
...
...
app/models/user.rb
View file @
bbca6a0a
...
@@ -199,11 +199,10 @@ class User < ActiveRecord::Base
...
@@ -199,11 +199,10 @@ class User < ActiveRecord::Base
def
sort
(
method
)
def
sort
(
method
)
case
method
.
to_s
case
method
.
to_s
when
'recent_sign_in'
then
reorder
(
'users.last_sign_in_at DESC'
)
when
'recent_sign_in'
then
reorder
(
last_sign_in_at: :desc
)
when
'oldest_sign_in'
then
reorder
(
'users.last_sign_in_at ASC'
)
when
'oldest_sign_in'
then
reorder
(
last_sign_in_at: :asc
)
when
'recently_created'
then
reorder
(
'users.created_at DESC'
)
else
when
'late_created'
then
reorder
(
'users.created_at ASC'
)
order_by
(
method
)
else
reorder
(
"users.name ASC"
)
end
end
end
end
...
...
app/views/admin/groups/index.html.haml
View file @
bbca6a0a
...
@@ -8,10 +8,31 @@
...
@@ -8,10 +8,31 @@
%hr
%hr
=
form_tag
admin_groups_path
,
method: :get
,
class:
'form-inline'
do
=
form_tag
admin_groups_path
,
method: :get
,
class:
'form-inline'
do
=
hidden_field_tag
:sort
,
@sort
.form-group
.form-group
=
text_field_tag
:name
,
params
[
:name
],
class:
"form-control input-mn-300"
=
text_field_tag
:name
,
params
[
:name
],
class:
"form-control input-mn-300"
=
button_tag
"Search"
,
class:
"btn submit btn-primary"
=
button_tag
"Search"
,
class:
"btn submit btn-primary"
.pull-right
.dropdown.inline
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%span
.light
sort:
-
if
@sort
.
present?
=
sort_options_hash
[
@sort
]
-
else
=
sort_title_recently_created
%b
.caret
%ul
.dropdown-menu
%li
=
link_to
admin_groups_path
(
sort:
sort_value_recently_created
)
do
=
sort_title_recently_created
=
link_to
admin_groups_path
(
sort:
sort_value_oldest_created
)
do
=
sort_title_oldest_created
=
link_to
admin_groups_path
(
sort:
sort_value_recently_updated
)
do
=
sort_title_recently_updated
=
link_to
admin_groups_path
(
sort:
sort_value_oldest_updated
)
do
=
sort_title_oldest_updated
%hr
%hr
%ul
.bordered-list
%ul
.bordered-list
...
...
app/views/admin/projects/index.html.haml
View file @
bbca6a0a
...
@@ -47,24 +47,22 @@
...
@@ -47,24 +47,22 @@
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%span
.light
sort:
%span
.light
sort:
-
if
@sort
.
present?
-
if
@sort
.
present?
=
@sort
.
humanize
=
sort_options_hash
[
@sort
]
-
else
-
else
Name
=
sort_title_recently_created
%b
.caret
%b
.caret
%ul
.dropdown-menu
%ul
.dropdown-menu
%li
%li
=
link_to
admin_projects_path
(
sort:
nil
)
do
=
link_to
admin_projects_path
(
sort:
sort_value_recently_created
)
do
Name
=
link_to
admin_projects_path
(
sort:
'newest'
)
do
=
sort_title_recently_created
=
sort_title_recently_created
=
link_to
admin_projects_path
(
sort:
'oldest'
)
do
=
link_to
admin_projects_path
(
sort:
sort_value_oldest_created
)
do
=
sort_title_oldest_created
=
sort_title_oldest_created
=
link_to
admin_projects_path
(
sort:
'recently_updated'
)
do
=
link_to
admin_projects_path
(
sort:
sort_value_recently_updated
)
do
=
sort_title_recently_updated
=
sort_title_recently_updated
=
link_to
admin_projects_path
(
sort:
'last_updated'
)
do
=
link_to
admin_projects_path
(
sort:
sort_value_oldest_updated
)
do
=
sort_title_oldest_updated
=
sort_title_oldest_updated
=
link_to
admin_projects_path
(
sort:
'largest_repository'
)
do
=
link_to
admin_projects_path
(
sort:
sort_value_largest_repo
)
do
Largest repository
=
sort_title_largest_repo
=
link_to
'New Project'
,
new_project_path
,
class:
"btn btn-new"
=
link_to
'New Project'
,
new_project_path
,
class:
"btn btn-new"
%ul
.well-list
%ul
.well-list
-
@projects
.
each
do
|
project
|
-
@projects
.
each
do
|
project
|
...
...
app/views/admin/users/index.html.haml
View file @
bbca6a0a
...
@@ -36,22 +36,26 @@
...
@@ -36,22 +36,26 @@
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%span
.light
sort:
%span
.light
sort:
-
if
@sort
.
present?
-
if
@sort
.
present?
=
@sort
.
humanize
=
sort_options_hash
[
@sort
]
-
else
-
else
N
ame
=
sort_title_n
ame
%b
.caret
%b
.caret
%ul
.dropdown-menu
%ul
.dropdown-menu
%li
%li
=
link_to
admin_users_path
(
sort:
nil
)
do
=
link_to
admin_users_path
(
sort:
sort_value_name
)
do
N
ame
=
sort_title_n
ame
=
link_to
admin_users_path
(
sort:
'recent_sign_in'
)
do
=
link_to
admin_users_path
(
sort:
sort_value_recently_signin
)
do
Recent sign
in
=
sort_title_recently_sign
in
=
link_to
admin_users_path
(
sort:
'oldest_sign_in'
)
do
=
link_to
admin_users_path
(
sort:
sort_value_oldest_signin
)
do
Oldest sign
in
=
sort_title_oldest_sign
in
=
link_to
admin_users_path
(
sort:
'recently_created'
)
do
=
link_to
admin_users_path
(
sort:
sort_value_recently_created
)
do
=
sort_title_recently_created
=
sort_title_recently_created
=
link_to
admin_users_path
(
sort:
'late_created'
)
do
=
link_to
admin_users_path
(
sort:
sort_value_oldest_created
)
do
=
sort_title_oldest_created
=
sort_title_oldest_created
=
link_to
admin_users_path
(
sort:
sort_value_recently_updated
)
do
=
sort_title_recently_updated
=
link_to
admin_users_path
(
sort:
sort_value_oldest_updated
)
do
=
sort_title_oldest_updated
=
link_to
'New User'
,
new_admin_user_path
,
class:
"btn btn-new"
=
link_to
'New User'
,
new_admin_user_path
,
class:
"btn btn-new"
%ul
.well-list
%ul
.well-list
...
...
app/views/dashboard/_projects_filter.html.haml
View file @
bbca6a0a
...
@@ -82,19 +82,19 @@
...
@@ -82,19 +82,19 @@
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%span
.light
sort:
%span
.light
sort:
-
if
@sort
.
present?
-
if
@sort
.
present?
=
@sort
.
humanize
=
sort_options_hash
[
@sort
]
-
else
-
else
Name
=
sort_title_recently_created
%b
.caret
%b
.caret
%ul
.dropdown-menu
%ul
.dropdown-menu
%li
%li
=
link_to
projects_dashboard_filter_path
(
sort:
nil
)
do
=
link_to
projects_dashboard_filter_path
(
sort:
sort_value_recently_created
)
do
Name
=
link_to
projects_dashboard_filter_path
(
sort:
'newest'
)
do
=
sort_title_recently_created
=
sort_title_recently_created
=
link_to
projects_dashboard_filter_path
(
sort:
'oldest'
)
do
=
link_to
projects_dashboard_filter_path
(
sort:
sort_value_oldest_created
)
do
=
sort_title_oldest_created
=
sort_title_oldest_created
=
link_to
projects_dashboard_filter_path
(
sort:
'recently_updated'
)
do
=
link_to
projects_dashboard_filter_path
(
sort:
sort_value_recently_updated
)
do
=
sort_title_recently_updated
=
sort_title_recently_updated
=
link_to
projects_dashboard_filter_path
(
sort:
'last_updated'
)
do
=
link_to
projects_dashboard_filter_path
(
sort:
sort_value_oldest_updated
)
do
=
sort_title_oldest_updated
=
sort_title_oldest_updated
=
link_to
projects_dashboard_filter_path
(
sort:
sort_value_name
)
do
=
sort_title_name
app/views/explore/groups/index.html.haml
View file @
bbca6a0a
.clearfix
.clearfix
.pull-left
.pull-left
=
form_tag
explore_groups_path
,
method: :get
,
class:
'form-inline form-tiny'
do
|
f
|
=
form_tag
explore_groups_path
,
method: :get
,
class:
'form-inline form-tiny'
do
|
f
|
=
hidden_field_tag
:sort
,
@sort
.form-group
.form-group
=
search_field_tag
:search
,
params
[
:search
],
placeholder:
"Filter by name"
,
class:
"form-control search-text-input input-mn-300"
,
id:
"groups_search"
=
search_field_tag
:search
,
params
[
:search
],
placeholder:
"Filter by name"
,
class:
"form-control search-text-input input-mn-300"
,
id:
"groups_search"
.form-group
.form-group
...
@@ -11,21 +12,19 @@
...
@@ -11,21 +12,19 @@
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%span
.light
sort:
%span
.light
sort:
-
if
@sort
.
present?
-
if
@sort
.
present?
=
@sort
.
humanize
=
sort_options_hash
[
@sort
]
-
else
-
else
Name
=
sort_title_recently_created
%b
.caret
%b
.caret
%ul
.dropdown-menu
%ul
.dropdown-menu
%li
%li
=
link_to
explore_groups_path
(
sort:
nil
)
do
=
link_to
explore_groups_path
(
sort:
sort_value_recently_created
)
do
Name
=
link_to
explore_groups_path
(
sort:
'newest'
)
do
=
sort_title_recently_created
=
sort_title_recently_created
=
link_to
explore_groups_path
(
sort:
'oldest'
)
do
=
link_to
explore_groups_path
(
sort:
sort_value_oldest_created
)
do
=
sort_title_oldest_created
=
sort_title_oldest_created
=
link_to
explore_groups_path
(
sort:
'recently_updated'
)
do
=
link_to
explore_groups_path
(
sort:
sort_value_recently_updated
)
do
=
sort_title_recently_updated
=
sort_title_recently_updated
=
link_to
explore_groups_path
(
sort:
'last_updated'
)
do
=
link_to
explore_groups_path
(
sort:
sort_value_oldest_updated
)
do
=
sort_title_oldest_updated
=
sort_title_oldest_updated
%hr
%hr
...
...
app/views/explore/projects/index.html.haml
View file @
bbca6a0a
...
@@ -11,21 +11,19 @@
...
@@ -11,21 +11,19 @@
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%span
.light
sort:
%span
.light
sort:
-
if
@sort
.
present?
-
if
@sort
.
present?
=
@sort
.
humanize
=
sort_options_hash
[
@sort
]
-
else
-
else
Name
=
sort_title_recently_created
%b
.caret
%b
.caret
%ul
.dropdown-menu
%ul
.dropdown-menu
%li
%li
=
link_to
explore_projects_path
(
sort:
nil
)
do
=
link_to
explore_projects_path
(
sort:
sort_value_recently_created
)
do
Name
=
link_to
explore_projects_path
(
sort:
'newest'
)
do
=
sort_title_recently_created
=
sort_title_recently_created
=
link_to
explore_projects_path
(
sort:
'oldest'
)
do
=
link_to
explore_projects_path
(
sort:
sort_value_oldest_created
)
do
=
sort_title_oldest_created
=
sort_title_oldest_created
=
link_to
explore_projects_path
(
sort:
'recently_updated'
)
do
=
link_to
explore_projects_path
(
sort:
sort_value_recently_updated
)
do
=
sort_title_recently_updated
=
sort_title_recently_updated
=
link_to
explore_projects_path
(
sort:
'last_updated'
)
do
=
link_to
explore_projects_path
(
sort:
sort_value_oldest_updated
)
do
=
sort_title_oldest_updated
=
sort_title_oldest_updated
%hr
%hr
...
...
app/views/shared/_sort_dropdown.html.haml
View file @
bbca6a0a
...
@@ -2,21 +2,21 @@
...
@@ -2,21 +2,21 @@
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%a
.dropdown-toggle.btn
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%span
.light
sort:
%span
.light
sort:
-
if
@sort
.
present?
-
if
@sort
.
present?
=
@sort
=
sort_options_hash
[
@sort
]
-
else
-
else
Newest
=
sort_title_recently_created
%b
.caret
%b
.caret
%ul
.dropdown-menu.dropdown-menu-align-right
%ul
.dropdown-menu.dropdown-menu-align-right
%li
%li
=
link_to
page_filter_path
(
sort:
'newest'
)
do
=
link_to
page_filter_path
(
sort:
sort_value_recently_created
)
do
=
sort_title_recently_created
=
sort_title_recently_created
=
link_to
page_filter_path
(
sort:
'oldest'
)
do
=
link_to
page_filter_path
(
sort:
sort_value_oldest_created
)
do
=
sort_title_oldest_created
=
sort_title_oldest_created
=
link_to
page_filter_path
(
sort:
'recently_updated'
)
do
=
link_to
page_filter_path
(
sort:
sort_value_recently_updated
)
do
=
sort_title_recently_updated
=
sort_title_recently_updated
=
link_to
page_filter_path
(
sort:
'last_updated'
)
do
=
link_to
page_filter_path
(
sort:
sort_value_oldest_updated
)
do
=
sort_title_oldest_updated
=
sort_title_oldest_updated
=
link_to
page_filter_path
(
sort:
'milestone_due_soon'
)
do
=
link_to
page_filter_path
(
sort:
sort_value_milestone_soon
)
do
Milestone due
soon
=
sort_title_milestone_
soon
=
link_to
page_filter_path
(
sort:
'milestone_due_later'
)
do
=
link_to
page_filter_path
(
sort:
sort_value_milestone_later
)
do
Milestone due
later
=
sort_title_milestone_
later
features/steps/groups.rb
View file @
bbca6a0a
...
@@ -83,7 +83,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
...
@@ -83,7 +83,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
end
end
step
'I should be redirected to group "Samurai" page'
do
step
'I should be redirected to group "Samurai" page'
do
current_path
.
should
==
group_path
(
Group
.
last
)
current_path
.
should
==
group_path
(
Group
.
find_by
(
name:
'Samurai'
)
)
end
end
step
'I should see newly created group "Samurai"'
do
step
'I should see newly created group "Samurai"'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment