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
a648bcad
Commit
a648bcad
authored
Dec 04, 2018
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extract protected variable logic to helper
parent
ccecf436
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
app/helpers/ci_variables_helper.rb
app/helpers/ci_variables_helper.rb
+15
-0
app/views/ci/variables/_variable_row.html.haml
app/views/ci/variables/_variable_row.html.haml
+2
-2
No files found.
app/helpers/ci_variables_helper.rb
0 → 100644
View file @
a648bcad
# frozen_string_literal: true
module
CiVariablesHelper
def
ci_variable_protected_by_default?
Gitlab
::
CurrentSettings
.
current_application_settings
.
protected_ci_variables
end
def
ci_variable_protected?
(
variable
,
only_key_value
)
if
variable
&&
!
only_key_value
variable
.
protected
else
ci_variable_protected_by_default?
end
end
end
app/views/ci/variables/_variable_row.html.haml
View file @
a648bcad
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
-
id
=
variable
&
.
id
-
id
=
variable
&
.
id
-
key
=
variable
&
.
key
-
key
=
variable
&
.
key
-
value
=
variable
&
.
value
-
value
=
variable
&
.
value
-
is_protected_default
=
Gitlab
::
CurrentSettings
.
current_application_settings
.
protected_ci_variables
-
is_protected_default
=
ci_variable_protected_by_default?
-
is_protected
=
variable
&&
!
only_key_value
?
variable
.
protected
:
is_protected_default
-
is_protected
=
ci_variable_protected?
(
variable
,
only_key_value
)
-
id_input_name
=
"
#{
form_field
}
[variables_attributes][][id]"
-
id_input_name
=
"
#{
form_field
}
[variables_attributes][][id]"
-
destroy_input_name
=
"
#{
form_field
}
[variables_attributes][][_destroy]"
-
destroy_input_name
=
"
#{
form_field
}
[variables_attributes][][_destroy]"
...
...
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