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
ef22b76b
Commit
ef22b76b
authored
Apr 11, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify Projects::NotificationSettingsController
parent
fe58c1f1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
9 deletions
+2
-9
app/controllers/projects/notification_settings_controller.rb
app/controllers/projects/notification_settings_controller.rb
+0
-7
app/views/projects/buttons/_notifications.html.haml
app/views/projects/buttons/_notifications.html.haml
+1
-1
config/routes.rb
config/routes.rb
+1
-1
No files found.
app/controllers/projects/notification_settings_controller.rb
View file @
ef22b76b
class
Projects::NotificationSettingsController
<
Projects
::
ApplicationController
class
Projects::NotificationSettingsController
<
Projects
::
ApplicationController
before_action
:authenticate_user!
before_action
:authenticate_user!
def
create
notification_setting
=
current_user
.
notification_settings_for
(
project
)
saved
=
notification_setting
.
update_attributes
(
notification_setting_params
)
render
json:
{
saved:
saved
}
end
def
update
def
update
notification_setting
=
current_user
.
notification_settings_for
(
project
)
notification_setting
=
current_user
.
notification_settings_for
(
project
)
saved
=
notification_setting
.
update_attributes
(
notification_setting_params
)
saved
=
notification_setting
.
update_attributes
(
notification_setting_params
)
...
...
app/views/projects/buttons/_notifications.html.haml
View file @
ef22b76b
-
if
@notification_setting
-
if
@notification_setting
=
form_for
@notification_setting
,
url:
namespace_project_notification_setting_path
(
@project
.
namespace
.
becomes
(
Namespace
),
@project
),
remote:
true
,
html:
{
class:
'inline'
,
id:
'notification-form'
}
do
|
f
|
=
form_for
@notification_setting
,
url:
namespace_project_notification_setting_path
(
@project
.
namespace
.
becomes
(
Namespace
),
@project
),
method: :patch
,
remote:
true
,
html:
{
class:
'inline'
,
id:
'notification-form'
}
do
|
f
|
=
f
.
hidden_field
:level
=
f
.
hidden_field
:level
%span
.dropdown
%span
.dropdown
%a
.dropdown-new.btn.notifications-btn
#notifications-button
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%a
.dropdown-new.btn.notifications-btn
#notifications-button
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
...
...
config/routes.rb
View file @
ef22b76b
...
@@ -608,7 +608,7 @@ Rails.application.routes.draw do
...
@@ -608,7 +608,7 @@ Rails.application.routes.draw do
resources
:forks
,
only:
[
:index
,
:new
,
:create
]
resources
:forks
,
only:
[
:index
,
:new
,
:create
]
resource
:import
,
only:
[
:new
,
:create
,
:show
]
resource
:import
,
only:
[
:new
,
:create
,
:show
]
resource
:notification_setting
,
only:
[
:
create
,
:
update
]
resource
:notification_setting
,
only:
[
:update
]
resources
:refs
,
only:
[]
do
resources
:refs
,
only:
[]
do
collection
do
collection
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