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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ba599120
Commit
ba599120
authored
Mar 27, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepare UI for notification settings
parent
d55ade16
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
80 additions
and
19 deletions
+80
-19
app/assets/javascripts/behaviors/toggler_behavior.coffee
app/assets/javascripts/behaviors/toggler_behavior.coffee
+8
-0
app/assets/javascripts/extensions/jquery.js.coffee
app/assets/javascripts/extensions/jquery.js.coffee
+9
-0
app/assets/javascripts/main.js.coffee
app/assets/javascripts/main.js.coffee
+2
-0
app/assets/javascripts/profile.js.coffee
app/assets/javascripts/profile.js.coffee
+4
-2
app/controllers/notifications_controller.rb
app/controllers/notifications_controller.rb
+3
-1
app/views/notifications/show.html.haml
app/views/notifications/show.html.haml
+47
-5
app/views/notifications/update.js.haml
app/views/notifications/update.js.haml
+7
-0
spec/requests/notifications_spec.rb
spec/requests/notifications_spec.rb
+0
-11
No files found.
app/assets/javascripts/behaviors/toggler_behavior.coffee
View file @
ba599120
...
...
@@ -3,3 +3,11 @@ $ ->
container
=
$
(
@
).
closest
(
".js-toggler-container"
)
container
.
toggleClass
(
"on"
)
$
(
"body"
).
on
"click"
,
".js-toggle-visibility-link"
,
(
e
)
->
$
(
@
).
find
(
'i'
).
toggleClass
(
'icon-chevron-down'
).
toggleClass
(
'icon-chevron-up'
)
container
=
$
(
".js-toggle-visibility-container"
)
container
.
toggleClass
(
"hide"
)
e
.
preventDefault
()
app/assets/javascripts/extensions/jquery.js.coffee
0 → 100644
View file @
ba599120
$
.
fn
.
showAndHide
=
->
$
(
@
).
show
().
delay
(
3000
).
fadeOut
()
$
.
fn
.
enableButton
=
->
$
(
@
).
removeAttr
(
'disabled'
).
removeClass
(
'disabled'
)
app/assets/javascripts/main.js.coffee
View file @
ba599120
...
...
@@ -7,6 +7,8 @@ window.slugify = (text) ->
window
.
ajaxGet
=
(
url
)
->
$
.
ajax
({
type
:
"GET"
,
url
:
url
,
dataType
:
"script"
})
window
.
showAndHide
=
(
selector
)
->
window
.
errorMessage
=
(
message
)
->
ehtml
=
$
(
"<p>"
)
ehtml
.
addClass
(
"error_message"
)
...
...
app/assets/javascripts/profile.js.coffee
View file @
ba599120
...
...
@@ -15,6 +15,8 @@ $ ->
$
(
this
).
find
(
'.update-failed'
).
hide
()
$
(
'.update-username form'
).
on
'ajax:complete'
,
->
$
(
this
).
find
(
'.save-btn'
).
removeAttr
(
'disabled'
)
$
(
this
).
find
(
'.save-btn'
).
removeClass
(
'disabled'
)
$
(
this
).
find
(
'.btn-save'
).
enableButton
()
$
(
this
).
find
(
'.loading-gif'
).
hide
()
$
(
'.update-notifications'
).
on
'ajax:complete'
,
->
$
(
this
).
find
(
'.btn-save'
).
enableButton
()
app/controllers/notifications_controller.rb
View file @
ba599120
...
...
@@ -3,9 +3,11 @@ class NotificationsController < ApplicationController
def
show
@notification
=
current_user
.
notification
@projects
=
current_user
.
authorized_projects
end
def
update
@notification
=
current_user
.
notification
current_user
.
notification_level
=
params
[
:notification_level
]
@saved
=
current_user
.
save
end
end
app/views/notifications/show.html.haml
View file @
ba599120
%h3
.page_title
Setup your notification level
%hr
%br
=
form_tag
profile_notifications_path
do
%p
.light
%strong
Disabled
–
You will not get any notifications via email
%p
.light
%strong
Participating
–
You will receive only notifications from related resources(ex. from assigned issue or your commit)
%p
.light
%strong
Watch
–
You will receive all notifications from projects in which you participate
%hr
%ul
.unstyled
=
form_tag
profile_notifications_path
,
method: :put
,
remote:
true
,
class:
'update-notifications'
do
%ul
.well-list
%li
.row
.span
3
.span
4
%h5
Global
.span
9
.span
7
=
label_tag
do
=
radio_button_tag
:notification_level
,
Notification
::
N_DISABLED
,
@notification
.
disabled?
%span
Disabled
...
...
@@ -22,5 +32,37 @@
=
radio_button_tag
:notification_level
,
Notification
::
N_WATCH
,
@notification
.
watch?
%span
Watch
=
link_to
'#'
,
class:
'js-toggle-visibility-link'
do
%h6
.btn.btn-tiny
%i
.icon-chevron-down
%span
Per project notifications settings
%ul
.well-list.js-toggle-visibility-container.hide
-
@projects
.
each
do
|
project
|
%li
.row
.span4
%span
=
project
.
name_with_namespace
.span7
=
label_tag
do
=
radio_button_tag
:"notification_level[
#{
project
.
id
}
]"
,
Notification
::
N_DISABLED
,
@notification
.
disabled?
,
disabled:
true
%span
Disabled
=
label_tag
do
=
radio_button_tag
:"notification_level[
#{
project
.
id
}
]"
,
Notification
::
N_PARTICIPATING
,
@notification
.
participating?
,
disabled:
true
%span
Participating
=
label_tag
do
=
radio_button_tag
:"notification_level[
#{
project
.
id
}
]"
,
Notification
::
N_WATCH
,
@notification
.
watch?
,
disabled:
true
%span
Watch
.form-actions
=
submit_tag
'Save'
,
class:
'btn btn-save'
%span
.update-success.cgreen.hide
%i
.icon-ok
Saved
%span
.update-failed.cred.hide
%i
.icon-remove
Failed
app/views/notifications/update.js.haml
0 → 100644
View file @
ba599120
-
if
@saved
:plain
$('.update-notifications .update-success').showAndHide();
-
else
:plain
$('.update-notifications .update-failed').showAndHide();
spec/requests/notifications_spec.rb
deleted
100644 → 0
View file @
d55ade16
require
'spec_helper'
describe
"Notifications"
do
describe
"GET /notifications"
do
it
"works! (now write some real specs)"
do
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
get
notifications_path
response
.
status
.
should
be
(
200
)
end
end
end
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