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
421215e3
Commit
421215e3
authored
Mar 17, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the flash success message
Removes the group if empty
parent
8f872020
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
41 deletions
+35
-41
app/assets/javascripts/todos.js.coffee
app/assets/javascripts/todos.js.coffee
+20
-32
app/assets/stylesheets/framework/buttons.scss
app/assets/stylesheets/framework/buttons.scss
+10
-0
app/assets/stylesheets/framework/flash.scss
app/assets/stylesheets/framework/flash.scss
+0
-6
app/controllers/dashboard/todos_controller.rb
app/controllers/dashboard/todos_controller.rb
+2
-2
app/views/dashboard/todos/_todo.html.haml
app/views/dashboard/todos/_todo.html.haml
+3
-1
No files found.
app/assets/javascripts/todos.js.coffee
View file @
421215e3
class
@
Todos
_this
=
null
;
constructor
:
(
@
name
)
->
_this
=
@
@
clearListeners
()
@
initBtnListeners
()
clearListeners
:
->
$
(
'.done-todo'
).
off
(
'click'
)
initBtnListeners
:
->
$
(
'.done-todo'
).
on
(
'click'
,
@
doneClicked
)
doneClicked
:
(
e
)
->
$this
=
$
(
this
)
doneURL
=
$this
.
attr
(
'href'
)
doneClicked
:
(
e
)
=>
e
.
preventDefault
()
e
.
stopImmediatePropagation
()
$spinner
=
$
(
'<i></i>'
).
addClass
(
'fa fa-spinner fa-spin'
)
$this
.
addClass
(
"disabled"
)
$this
.
append
(
$spinner
)
$this
=
$
(
e
.
currentTarget
)
$this
.
disable
()
$
.
ajax
type
:
'POST'
url
:
doneURL
url
:
$this
.
attr
(
'href'
)
dataType
:
'json'
data
:
'_method'
:
'delete'
error
:
(
data
,
textStatus
,
jqXHR
)
->
new
Flash
(
'Unable to update your todos.'
,
'alert'
)
_this
.
clearDone
(
$this
.
closest
(
'li'
))
return
success
:
(
data
,
textStatus
,
jqXHR
)
->
_this
.
clearDone
(
$this
.
closest
(
'li'
))
return
success
:
(
data
)
=>
@
clearDone
$this
.
closest
(
'li'
),
data
clearDone
:
(
$row
)
->
clearDone
:
(
$row
,
data
)
->
$ul
=
$row
.
closest
(
'ul'
)
$row
.
remove
()
$
(
'.todos-pending .badge, .todos-pending-count'
).
text
data
.
count
$
(
'.todos-done .badge'
).
text
data
.
done_count
if
not
$ul
.
find
(
'li'
).
length
Turbolinks
.
visit
(
location
.
href
)
else
$pendingBadge
=
$
(
'.todos-pending .badge'
)
$pendingBadge
.
text
parseInt
(
$pendingBadge
.
text
())
-
1
$doneBadge
=
$
(
'.todos-done .badge'
)
$doneBadge
.
text
parseInt
(
$doneBadge
.
text
())
+
1
$mainTodosPendingBadge
=
$
(
'.todos-pending-count'
)
$mainTodosPendingBadge
.
text
parseInt
(
$mainTodosPendingBadge
.
text
())
-
1
return
\ No newline at end of file
$ul
.
parents
(
'.panel'
).
remove
()
app/assets/stylesheets/framework/buttons.scss
View file @
421215e3
...
...
@@ -208,3 +208,13 @@
background-color
:
#e4e7ed
!
important
;
}
}
.btn-loading
{
&
:not
(
.disabled
)
.fa
{
display
:
none
;
}
.fa
{
margin-right
:
5px
;
}
}
app/assets/stylesheets/framework/flash.scss
View file @
421215e3
...
...
@@ -5,12 +5,6 @@
width
:
100%
;
z-index
:
100
;
.flash-success
{
@extend
.alert
;
@extend
.alert-success
;
margin
:
0
;
}
.flash-notice
{
@extend
.alert
;
@extend
.alert-info
;
...
...
app/controllers/dashboard/todos_controller.rb
View file @
421215e3
class
Dashboard::TodosController
<
Dashboard
::
ApplicationController
before_action
:find_todos
,
only:
[
:index
,
:destroy_all
]
before_action
:find_todos
,
only:
[
:index
,
:destroy
,
:destroy
_all
]
def
index
@todos
=
@todos
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
...
...
@@ -14,7 +14,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController
format
.
html
{
redirect_to
dashboard_todos_path
,
notice:
todo_notice
}
format
.
js
{
render
nothing:
true
}
format
.
json
do
render
json:
{
status:
'OK'
,
notice:
todo_notice
}
render
json:
{
count:
@todos
.
size
,
done_count:
current_user
.
todos
.
done
.
count
}
end
end
end
...
...
app/views/dashboard/todos/_todo.html.haml
View file @
421215e3
...
...
@@ -16,7 +16,9 @@
-
if
todo
.
pending?
.todo-actions.pull-right
=
link_to
'Done'
,
[
:dashboard
,
todo
],
method: :delete
,
class:
'btn done-todo'
=
link_to
[
:dashboard
,
todo
],
method: :delete
,
class:
'btn btn-loading done-todo'
do
=
icon
(
'spinner spin'
)
Done
.todo-body
.todo-note
...
...
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