BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
f8513d76
Commit
f8513d76
authored
Sep 02, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored code to rely less on IDs that could change
parent
4da474ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
project_new.js
app/assets/javascripts/project_new.js
+13
-5
projects_helper.rb
app/helpers/projects_helper.rb
+1
-1
No files found.
app/assets/javascripts/project_new.js
View file @
f8513d76
...
...
@@ -4,6 +4,8 @@
this
.
ProjectNew
=
(
function
()
{
function
ProjectNew
()
{
this
.
toggleSettings
=
bind
(
this
.
toggleSettings
,
this
);
this
.
$selects
=
$
(
'.features select'
);
$
(
'.project-edit-container'
).
on
(
'ajax:before'
,
(
function
(
_this
)
{
return
function
()
{
$
(
'.project-edit-container'
).
hide
();
...
...
@@ -15,17 +17,23 @@
}
ProjectNew
.
prototype
.
toggleSettings
=
function
()
{
this
.
_showOrHide
(
'#project_project_feature_attributes_builds_access_level'
,
'.builds-feature'
);
this
.
_showOrHide
(
'#project_project_feature_attributes_merge_requests_access_level'
,
'.merge-requests-feature'
);
var
self
=
this
;
this
.
$selects
.
each
(
function
()
{
var
$select
=
$
(
this
),
className
=
$select
.
data
(
'field'
).
replace
(
/_/g
,
'-'
)
.
replace
(
'access-level'
,
'feature'
);
self
.
_showOrHide
(
$select
,
'.'
+
className
);
});
};
ProjectNew
.
prototype
.
toggleSettingsOnclick
=
function
()
{
$
(
'#project_project_feature_attributes_builds_access_level, #project_project_feature_attributes_merge_requests_access_level'
)
.
on
(
'change'
,
this
.
toggleSettings
);
this
.
$selects
.
on
(
'change'
,
this
.
toggleSettings
);
};
ProjectNew
.
prototype
.
_showOrHide
=
function
(
checkElement
,
container
)
{
var
$container
;
$container
=
$
(
container
);
var
$container
=
$
(
container
)
;
if
(
$
(
checkElement
).
val
()
!==
'0'
)
{
return
$container
.
show
();
}
else
{
...
...
app/helpers/projects_helper.rb
View file @
f8513d76
...
...
@@ -431,6 +431,6 @@ module ProjectsHelper
options
.
delete
(
'Everyone with access'
)
if
@project
.
private?
&&
level
!=
ProjectFeature
::
ENABLED
options
=
options_for_select
(
options
,
selected:
@project
.
project_feature
.
public_send
(
field
)
||
ProjectFeature
::
ENABLED
)
content_tag
(
:select
,
options
,
name:
"project[project_feature_attributes][
#{
field
.
to_s
}
]"
,
id:
"project_project_feature_attributes_
#{
field
.
to_s
}
"
,
class:
"pull-right form-control"
).
html_safe
content_tag
(
:select
,
options
,
name:
"project[project_feature_attributes][
#{
field
.
to_s
}
]"
,
id:
"project_project_feature_attributes_
#{
field
.
to_s
}
"
,
class:
"pull-right form-control"
,
data:
{
field:
field
}
).
html_safe
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