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
Show 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
class
@
Todos
_this
=
null
;
constructor
:
(
@
name
)
->
constructor
:
(
@
name
)
->
_this
=
@
@
clearListeners
()
@
initBtnListeners
()
@
initBtnListeners
()
clearListeners
:
->
$
(
'.done-todo'
).
off
(
'click'
)
initBtnListeners
:
->
initBtnListeners
:
->
$
(
'.done-todo'
).
on
(
'click'
,
@
doneClicked
)
$
(
'.done-todo'
).
on
(
'click'
,
@
doneClicked
)
doneClicked
:
(
e
)
->
doneClicked
:
(
e
)
=>
$this
=
$
(
this
)
doneURL
=
$this
.
attr
(
'href'
)
e
.
preventDefault
()
e
.
preventDefault
()
e
.
stopImmediatePropagation
()
e
.
stopImmediatePropagation
()
$spinner
=
$
(
'<i></i>'
).
addClass
(
'fa fa-spinner fa-spin'
)
$this
.
addClass
(
"disabled"
)
$this
=
$
(
e
.
currentTarget
)
$this
.
append
(
$spinner
)
$this
.
disable
()
$
.
ajax
$
.
ajax
type
:
'POST'
type
:
'POST'
url
:
doneURL
url
:
$this
.
attr
(
'href'
)
dataType
:
'json'
dataType
:
'json'
data
:
'_method'
:
'delete'
data
:
'_method'
:
'delete'
error
:
(
data
,
textStatus
,
jqXHR
)
->
success
:
(
data
)
=>
new
Flash
(
'Unable to update your todos.'
,
'alert'
)
@
clearDone
$this
.
closest
(
'li'
),
data
_this
.
clearDone
(
$this
.
closest
(
'li'
))
return
success
:
(
data
,
textStatus
,
jqXHR
)
->
_this
.
clearDone
(
$this
.
closest
(
'li'
))
return
clearDone
:
(
$row
)
->
clearDone
:
(
$row
,
data
)
->
$ul
=
$row
.
closest
(
'ul'
)
$ul
=
$row
.
closest
(
'ul'
)
$row
.
remove
()
$row
.
remove
()
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'
)
$
(
'.todos-pending .badge, .todos-pending-count'
).
text
data
.
count
$mainTodosPendingBadge
.
text
parseInt
(
$mainTodosPendingBadge
.
text
())
-
1
$
(
'.todos-done .badge'
).
text
data
.
done_count
return
if
not
$ul
.
find
(
'li'
).
length
$ul
.
parents
(
'.panel'
).
remove
()
app/assets/stylesheets/framework/buttons.scss
View file @
421215e3
...
@@ -208,3 +208,13 @@
...
@@ -208,3 +208,13 @@
background-color
:
#e4e7ed
!
important
;
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 @@
...
@@ -5,12 +5,6 @@
width
:
100%
;
width
:
100%
;
z-index
:
100
;
z-index
:
100
;
.flash-success
{
@extend
.alert
;
@extend
.alert-success
;
margin
:
0
;
}
.flash-notice
{
.flash-notice
{
@extend
.alert
;
@extend
.alert
;
@extend
.alert-info
;
@extend
.alert-info
;
...
...
app/controllers/dashboard/todos_controller.rb
View file @
421215e3
class
Dashboard::TodosController
<
Dashboard
::
ApplicationController
class
Dashboard::TodosController
<
Dashboard
::
ApplicationController
before_action
:find_todos
,
only:
[
:index
,
:destroy_all
]
before_action
:find_todos
,
only:
[
:index
,
:destroy
,
:destroy
_all
]
def
index
def
index
@todos
=
@todos
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
@todos
=
@todos
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
...
@@ -14,7 +14,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController
...
@@ -14,7 +14,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController
format
.
html
{
redirect_to
dashboard_todos_path
,
notice:
todo_notice
}
format
.
html
{
redirect_to
dashboard_todos_path
,
notice:
todo_notice
}
format
.
js
{
render
nothing:
true
}
format
.
js
{
render
nothing:
true
}
format
.
json
do
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
end
end
end
...
...
app/views/dashboard/todos/_todo.html.haml
View file @
421215e3
...
@@ -16,7 +16,9 @@
...
@@ -16,7 +16,9 @@
-
if
todo
.
pending?
-
if
todo
.
pending?
.todo-actions.pull-right
.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-body
.todo-note
.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