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
ca9cded4
Commit
ca9cded4
authored
Apr 06, 2017
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes as per feedback
parent
f16377e7
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
20 additions
and
20 deletions
+20
-20
app/assets/javascripts/protected_tags/index.js
app/assets/javascripts/protected_tags/index.js
+0
-3
app/assets/javascripts/protected_tags/protected_tag_access_dropdown.js
...vascripts/protected_tags/protected_tag_access_dropdown.js
+2
-2
app/assets/javascripts/protected_tags/protected_tag_create.js
...assets/javascripts/protected_tags/protected_tag_create.js
+2
-2
app/assets/javascripts/protected_tags/protected_tag_dropdown.js
...sets/javascripts/protected_tags/protected_tag_dropdown.js
+2
-1
app/assets/javascripts/protected_tags/protected_tag_edit.js
app/assets/javascripts/protected_tags/protected_tag_edit.js
+8
-8
app/assets/javascripts/protected_tags/protected_tag_edit_list.js
...ets/javascripts/protected_tags/protected_tag_edit_list.js
+3
-2
app/assets/stylesheets/pages/projects.scss
app/assets/stylesheets/pages/projects.scss
+2
-1
app/views/projects/protected_tags/_create_protected_tag.html.haml
...s/projects/protected_tags/_create_protected_tag.html.haml
+1
-1
No files found.
app/assets/javascripts/protected_tags/index.js
View file @
ca9cded4
export
{
default
as
ProtectedTagAccessDropdown
}
from
'
./protected_tag_access_dropdown
'
;
export
{
default
as
ProtectedTagCreate
}
from
'
./protected_tag_create
'
;
export
{
default
as
ProtectedTagDropdown
}
from
'
./protected_tag_dropdown
'
;
export
{
default
as
ProtectedTagEdit
}
from
'
./protected_tag_edit
'
;
export
{
default
as
ProtectedTagEditList
}
from
'
./protected_tag_edit_list
'
;
app/assets/javascripts/protected_tags/protected_tag_access_dropdown.js
View file @
ca9cded4
...
...
@@ -11,8 +11,8 @@ export default class ProtectedTagAccessDropdown {
selectable
:
true
,
inputId
:
this
.
options
.
$dropdown
.
data
(
'
input-id
'
),
fieldName
:
this
.
options
.
$dropdown
.
data
(
'
field-name
'
),
toggleLabel
(
item
,
el
)
{
if
(
el
.
is
(
'
.is-active
'
))
{
toggleLabel
(
item
,
$
el
)
{
if
(
$
el
.
is
(
'
.is-active
'
))
{
return
item
.
text
;
}
return
'
Select
'
;
...
...
app/assets/javascripts/protected_tags/protected_tag_create.js
View file @
ca9cded4
...
...
@@ -3,7 +3,7 @@ import ProtectedTagDropdown from './protected_tag_dropdown';
export
default
class
ProtectedTagCreate
{
constructor
()
{
this
.
$form
=
$
(
'
.
new_protected_
tag
'
);
this
.
$form
=
$
(
'
.
js-new-protected-
tag
'
);
this
.
buildDropdowns
();
}
...
...
@@ -34,7 +34,7 @@ export default class ProtectedTagCreate {
onSelect
()
{
// Enable submit button
const
$tagInput
=
this
.
$form
.
find
(
'
input[name="protected_tag[name]"]
'
);
const
$allowedToCreateInput
=
this
.
$form
.
find
(
'
input[name="protected_tag[create_access_levels_attributes][0][access_level]"]
'
);
const
$allowedToCreateInput
=
this
.
$form
.
find
(
'
#create_access_levels_attributes
'
);
this
.
$form
.
find
(
'
input[type="submit"]
'
).
attr
(
'
disabled
'
,
!
(
$tagInput
.
val
()
&&
$allowedToCreateInput
.
length
));
}
...
...
app/assets/javascripts/protected_tags/protected_tag_dropdown.js
View file @
ca9cded4
...
...
@@ -50,9 +50,10 @@ export default class ProtectedTagDropdown {
this
.
$protectedTag
.
on
(
'
click
'
,
this
.
onClickCreateWildcard
.
bind
(
this
));
}
onClickCreateWildcard
()
{
onClickCreateWildcard
(
e
)
{
this
.
$dropdown
.
data
(
'
glDropdown
'
).
remote
.
execute
();
this
.
$dropdown
.
data
(
'
glDropdown
'
).
selectRowAtIndex
();
e
.
preventDefault
();
}
getProtectedTags
(
term
,
callback
)
{
...
...
app/assets/javascripts/protected_tags/protected_tag_edit.js
View file @
ca9cded4
...
...
@@ -6,7 +6,8 @@ import ProtectedTagAccessDropdown from './protected_tag_access_dropdown';
export
default
class
ProtectedTagEdit
{
constructor
(
options
)
{
this
.
$wrap
=
options
.
$wrap
;
this
.
$allowedToCreateDropdown
=
this
.
$wrap
.
find
(
'
.js-allowed-to-create
'
);
this
.
$allowedToCreateDropdownButton
=
this
.
$wrap
.
find
(
'
.js-allowed-to-create
'
);
this
.
onSelectCallback
=
this
.
onSelect
.
bind
(
this
);
this
.
buildDropdowns
();
}
...
...
@@ -14,19 +15,19 @@ export default class ProtectedTagEdit {
buildDropdowns
()
{
// Allowed to create dropdown
this
.
protectedTagAccessDropdown
=
new
ProtectedTagAccessDropdown
({
$dropdown
:
this
.
$allowedToCreateDropdown
,
$dropdown
:
this
.
$allowedToCreateDropdown
Button
,
data
:
gon
.
create_access_levels
,
onSelect
:
this
.
onSelect
.
bind
(
this
)
,
onSelect
:
this
.
onSelect
Callback
,
});
}
onSelect
()
{
const
$allowedToCreateInput
=
this
.
$wrap
.
find
(
`input[name="
${
this
.
$allowedToCreateDropdown
.
data
(
'
fieldName
'
)}
"]`
);
const
$allowedToCreateInput
=
this
.
$wrap
.
find
(
`input[name="
${
this
.
$allowedToCreateDropdown
Button
.
data
(
'
fieldName
'
)}
"]`
);
// Do not update if one dropdown has not selected any option
if
(
!
$allowedToCreateInput
.
length
)
return
;
this
.
$allowedToCreateDropdown
.
disable
();
this
.
$allowedToCreateDropdown
Button
.
disable
();
$
.
ajax
({
type
:
'
POST
'
,
...
...
@@ -36,17 +37,16 @@ export default class ProtectedTagEdit {
_method
:
'
PATCH
'
,
protected_tag
:
{
create_access_levels_attributes
:
[{
id
:
this
.
$allowedToCreateDropdown
.
data
(
'
access-level-id
'
),
id
:
this
.
$allowedToCreateDropdown
Button
.
data
(
'
access-level-id
'
),
access_level
:
$allowedToCreateInput
.
val
(),
}],
},
},
error
()
{
$
.
scrollTo
(
0
);
new
Flash
(
'
Failed to update tag!
'
);
},
}).
always
(()
=>
{
this
.
$allowedToCreateDropdown
.
enable
();
this
.
$allowedToCreateDropdown
Button
.
enable
();
});
}
}
app/assets/javascripts/protected_tags/protected_tag_edit_list.js
View file @
ca9cded4
/* eslint-disable no-new */
import
ProtectedTagEdit
from
'
./protected_tag_edit
'
;
export
default
class
ProtectedTagEditList
{
constructor
()
{
this
.
$wrap
=
$
(
'
.protected-tags-list
'
);
this
.
protectedTagList
=
[];
this
.
initEditForm
();
}
initEditForm
()
{
this
.
$wrap
.
find
(
'
.js-protected-tag-edit-form
'
).
each
((
i
,
el
)
=>
{
this
.
protectedTagList
[
i
]
=
new
ProtectedTagEdit
({
new
ProtectedTagEdit
({
$wrap
:
$
(
el
),
});
});
...
...
app/assets/stylesheets/pages/projects.scss
View file @
ca9cded4
...
...
@@ -779,7 +779,8 @@ pre.light-well {
.protected-tags-list
{
.dropdown-menu-toggle
{
width
:
300px
;
width
:
100%
;
max-width
:
300px
;
}
}
...
...
app/views/projects/protected_tags/_create_protected_tag.html.haml
View file @
ca9cded4
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@protected_tag
],
html:
{
class:
'
new_protected_
tag'
}
do
|
f
|
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@protected_tag
],
html:
{
class:
'
js-new-protected-
tag'
}
do
|
f
|
.panel.panel-default
.panel-heading
%h3
.panel-title
...
...
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