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
Boxiang Sun
gitlab-ce
Commits
2dd9a9af
Commit
2dd9a9af
authored
Jul 04, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix variables_controller.rb and format
parent
d228662f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
app/controllers/groups/variables_controller.rb
app/controllers/groups/variables_controller.rb
+1
-2
app/controllers/projects/variables_controller.rb
app/controllers/projects/variables_controller.rb
+8
-6
No files found.
app/controllers/groups/variables_controller.rb
View file @
2dd9a9af
...
@@ -46,8 +46,7 @@ module Groups
...
@@ -46,8 +46,7 @@ module Groups
end
end
def
group_params
def
group_params
params
.
require
(
:variable
)
params
.
require
(
:variable
).
permit
([
:key
,
:value
,
:protected
])
.
permit
([
:key
,
:value
,
:protected
])
end
end
def
variable
def
variable
...
...
app/controllers/projects/variables_controller.rb
View file @
2dd9a9af
...
@@ -13,18 +13,21 @@ class Projects::VariablesController < Projects::ApplicationController
...
@@ -13,18 +13,21 @@ class Projects::VariablesController < Projects::ApplicationController
def
update
def
update
if
@variable
.
update
(
project_params
)
if
@variable
.
update
(
project_params
)
redirect_to
namespace_project_variables_path
(
project
.
namespace
,
project
),
notice:
'Variable was successfully updated.'
redirect_to
namespace_project_variables_path
(
project
.
namespace
,
project
),
notice:
'Variable was successfully updated.'
else
else
render
"show"
render
"show"
end
end
end
end
def
create
def
create
@
variable
=
Ci
::
Variable
.
new
(
project_params
)
new_
variable
=
Ci
::
Variable
.
new
(
project_params
)
if
@variable
.
valid?
&&
@project
.
variables
<<
@variable
if
new_variable
.
valid?
&&
@project
.
variables
<<
new_variable
redirect_to
namespace_project_settings_ci_cd_path
(
project
.
namespace
,
project
),
notice:
'Variables were successfully updated.'
redirect_to
namespace_project_settings_ci_cd_path
(
project
.
namespace
,
project
),
notice:
'Variables were successfully updated.'
else
else
@variable
=
new_variable
.
present
(
current_user:
current_user
)
render
"show"
render
"show"
end
end
end
end
...
@@ -40,8 +43,7 @@ class Projects::VariablesController < Projects::ApplicationController
...
@@ -40,8 +43,7 @@ class Projects::VariablesController < Projects::ApplicationController
private
private
def
project_params
def
project_params
params
.
require
(
:variable
)
params
.
require
(
:variable
).
permit
([
:id
,
:key
,
:value
,
:protected
,
:_destroy
])
.
permit
([
:id
,
:key
,
:value
,
:protected
,
:_destroy
])
end
end
def
variable
def
variable
...
...
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