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
16ebeede
Commit
16ebeede
authored
Dec 26, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update branch status with ajax call.
parent
2cbfc515
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
6 deletions
+26
-6
app/assets/javascripts/protected_branches.js.coffee
app/assets/javascripts/protected_branches.js.coffee
+19
-0
app/controllers/projects/protected_branches_controller.rb
app/controllers/projects/protected_branches_controller.rb
+7
-6
No files found.
app/assets/javascripts/protected_branches.js.coffee
0 → 100644
View file @
16ebeede
$
->
$
(
":checkbox"
).
change
->
id
=
$
(
this
).
val
()
checked
=
$
(
this
).
is
(
":checked"
)
url
=
$
(
this
).
data
(
"url"
)
$
.
ajax
type
:
"PUT"
url
:
url
dataType
:
"json"
data
:
id
:
id
developers_can_push
:
checked
success
:
->
new
Flash
(
"Branch updated."
,
"notice"
)
location
.
reload
true
error
:
->
new
Flash
(
"Failed to update branch!"
,
"alert"
)
app/controllers/projects/protected_branches_controller.rb
View file @
16ebeede
...
@@ -22,13 +22,14 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
...
@@ -22,13 +22,14 @@ class Projects::ProtectedBranchesController < Projects::ApplicationController
protected_branch
.
update_attributes
(
protected_branch
.
update_attributes
(
developers_can_push:
params
[
:developers_can_push
]
developers_can_push:
params
[
:developers_can_push
]
)
)
flash
[
:notice
]
=
'Branch was successfully updated.'
else
flash
[
:alert
]
=
'Could not update the branch.'
end
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
redirect_to
project_protected_branches_path
}
format
.
json
{
render
:json
=>
protected_branch
,
status: :ok
}
end
else
respond_to
do
|
format
|
format
.
json
{
render
json:
protected_branch
.
errors
,
status: :unprocessable_entity
}
end
end
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