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
e255e4de
Commit
e255e4de
authored
Jul 04, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ayufan nice catches
parent
2dd9a9af
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
app/controllers/groups/variables_controller.rb
app/controllers/groups/variables_controller.rb
+11
-7
app/controllers/projects/variables_controller.rb
app/controllers/projects/variables_controller.rb
+11
-7
No files found.
app/controllers/groups/variables_controller.rb
View file @
e255e4de
...
@@ -20,9 +20,9 @@ module Groups
...
@@ -20,9 +20,9 @@ module Groups
end
end
def
create
def
create
new_variable
=
Ci
::
GroupVariable
.
new
(
group_params
)
new_variable
=
group
.
variables
.
create
(
group_params
)
if
new_variable
.
valid?
&&
group
.
variables
<<
new_variable
if
new_variable
.
persisted?
redirect_to
group_settings_ci_cd_path
(
group
),
redirect_to
group_settings_ci_cd_path
(
group
),
notice:
'Variables were successfully updated.'
notice:
'Variables were successfully updated.'
else
else
...
@@ -32,11 +32,15 @@ module Groups
...
@@ -32,11 +32,15 @@ module Groups
end
end
def
destroy
def
destroy
variable
.
destroy
if
variable
.
destroy
redirect_to
group_settings_ci_cd_path
(
group
),
redirect_to
group_settings_ci_cd_path
(
group
),
status:
302
,
status:
302
,
notice:
'Variable was successfully removed.'
notice:
'Variable was successfully removed.'
else
redirect_to
group_settings_ci_cd_path
(
group
),
status:
302
,
notice:
'Failed to remove the variable'
end
end
end
private
private
...
...
app/controllers/projects/variables_controller.rb
View file @
e255e4de
...
@@ -21,9 +21,9 @@ class Projects::VariablesController < Projects::ApplicationController
...
@@ -21,9 +21,9 @@ class Projects::VariablesController < Projects::ApplicationController
end
end
def
create
def
create
new_variable
=
Ci
::
Variable
.
new
(
project_params
)
new_variable
=
project
.
variables
.
create
(
project_params
)
if
new_variable
.
valid?
&&
@project
.
variables
<<
new_variable
if
new_variable
.
persisted?
redirect_to
namespace_project_settings_ci_cd_path
(
project
.
namespace
,
project
),
redirect_to
namespace_project_settings_ci_cd_path
(
project
.
namespace
,
project
),
notice:
'Variables were successfully updated.'
notice:
'Variables were successfully updated.'
else
else
...
@@ -33,11 +33,15 @@ class Projects::VariablesController < Projects::ApplicationController
...
@@ -33,11 +33,15 @@ class Projects::VariablesController < Projects::ApplicationController
end
end
def
destroy
def
destroy
variable
.
destroy
if
variable
.
destroy
redirect_to
namespace_project_settings_ci_cd_path
(
project
.
namespace
,
project
),
redirect_to
namespace_project_settings_ci_cd_path
(
project
.
namespace
,
project
),
status:
302
,
status:
302
,
notice:
'Variable was successfully removed.'
notice:
'Variable was successfully removed.'
else
redirect_to
namespace_project_settings_ci_cd_path
(
project
.
namespace
,
project
),
status:
302
,
notice:
'Failed to remove the variable'
end
end
end
private
private
...
...
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