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
Kazuhiko Shiozaki
gitlab-ce
Commits
d53ae7f1
Commit
d53ae7f1
authored
Feb 20, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add "Mark all as done" button
parent
57d16552
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
5 deletions
+49
-5
app/controllers/dashboard/todos_controller.rb
app/controllers/dashboard/todos_controller.rb
+15
-1
app/helpers/todos_helper.rb
app/helpers/todos_helper.rb
+26
-0
app/views/dashboard/todos/index.html.haml
app/views/dashboard/todos/index.html.haml
+8
-4
No files found.
app/controllers/dashboard/todos_controller.rb
View file @
d53ae7f1
class
Dashboard::TodosController
<
Dashboard
::
ApplicationController
before_filter
:find_todos
,
only:
[
:index
,
:destroy_all
]
def
index
@todos
=
TodosFinder
.
new
(
current_user
,
params
).
execute
@todos
=
@todos
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
end
...
...
@@ -13,9 +14,22 @@ class Dashboard::TodosController < Dashboard::ApplicationController
end
end
def
destroy_all
@todos
.
each
(
&
:done
)
respond_to
do
|
format
|
format
.
html
{
redirect_to
dashboard_todos_path
,
notice:
'All todos were marked as done.'
}
format
.
js
{
render
nothing:
true
}
end
end
private
def
todo
@todo
||=
current_user
.
todos
.
find
(
params
[
:id
])
end
def
find_todos
@todos
=
TodosFinder
.
new
(
current_user
,
params
).
execute
end
end
app/helpers/todos_helper.rb
View file @
d53ae7f1
...
...
@@ -19,6 +19,32 @@ module TodosHelper
todo
.
project
,
todo
.
target
],
anchor:
anchor
)
end
def
todos_filter_params
{
state:
params
[
:state
],
project_id:
params
[
:project_id
],
author_id:
params
[
:author_id
],
type:
params
[
:type
],
action_id:
params
[
:action_id
],
}
end
def
todos_filter_path
(
options
=
{})
without
=
options
.
delete
(
:without
)
options
=
todos_filter_params
.
merge
(
options
)
if
without
.
present?
without
.
each
do
|
key
|
options
.
delete
(
key
)
end
end
path
=
request
.
path
path
<<
"?
#{
options
.
to_param
}
"
path
end
def
todo_actions_options
actions
=
[
OpenStruct
.
new
(
id:
''
,
title:
'Any Action'
),
...
...
app/views/dashboard/todos/index.html.haml
View file @
d53ae7f1
...
...
@@ -4,21 +4,25 @@
.top-area
%ul
.nav-links
%li
{
class:
(
'active'
if
params
[
:state
].
blank?
||
params
[
:state
]
==
'pending'
)}
=
link_to
page
_filter_path
(
state:
'pending'
)
do
=
link_to
todos
_filter_path
(
state:
'pending'
)
do
%span
To do
%span
{
class:
'badge'
}
=
todos_pending_count
%li
{
class:
(
'active'
if
params
[
:state
]
==
'done'
)}
=
link_to
page
_filter_path
(
state:
'done'
)
do
=
link_to
todos
_filter_path
(
state:
'done'
)
do
%span
Done
%span
{
class:
'badge'
}
=
todos_done_count
.nav-controls
-
if
@todos
.
any?
(
&
:pending?
)
=
link_to
'Mark all as done'
,
destroy_all_dashboard_todos_path
(
todos_filter_params
),
class:
'btn'
,
method: :delete
.todos-filters
.gray-content-block.second-block
=
form_tag
page_filter_path
(
without:
[
:assignee_id
,
:milestone_title
,
:label_name
,
:scope
,
:sort
]),
method: :get
,
class:
'filter-form'
do
=
form_tag
todos_filter_path
(
without:
[
:project_id
,
:author_id
,
:type
,
:action_id
]),
method: :get
,
class:
'filter-form'
do
.filter-item.inline
=
select_tag
(
'project_id'
,
todo_projects_options
,
class:
'select2 trigger-submit'
,
include_blank:
true
,
...
...
@@ -47,7 +51,7 @@
=
render
group
[
1
]
=
paginate
@todos
,
theme:
"gitlab"
-
else
.nothing-here-block
No todos to show
.nothing-here-block
You're all done!
:javascript
new
UsersSelect
();
...
...
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