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
Jérome Perrin
gitlab-ce
Commits
1637ce4e
Commit
1637ce4e
authored
Dec 09, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated JS based on review
Fixed group links dropdown to match
parent
19fb84e3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
16 deletions
+28
-16
app/assets/javascripts/members.js.es6
app/assets/javascripts/members.js.es6
+8
-14
app/views/projects/group_links/update.js.haml
app/views/projects/group_links/update.js.haml
+1
-0
app/views/shared/members/_group.html.haml
app/views/shared/members/_group.html.haml
+19
-2
No files found.
app/assets/javascripts/members.js.es6
View file @
1637ce4e
...
@@ -31,14 +31,8 @@
...
@@ -31,14 +31,8 @@
toggleLabel(selected, $el) {
toggleLabel(selected, $el) {
return $el.text();
return $el.text();
},
},
clicked: (selected, $el) => {
clicked: (selected, $link) => {
const $link = $($el);
this.formSubmit(null, $link);
const { $toggle, $dateInput } = this.getMemberListItems($link);
$toggle.attr('disabled', true);
$dateInput.attr('disabled', true);
$btn.closest('form').trigger('submit.rails');
},
},
});
});
});
});
...
@@ -55,21 +49,21 @@
...
@@ -55,21 +49,21 @@
}
}
}
}
formSubmit(e) {
formSubmit(e
, $el = null
) {
const $this =
$(e.currentTarget)
;
const $this =
e ? $(e.currentTarget) : $el
;
const { $toggle, $dateInput } = this.getMemberListItems($this);
const { $toggle, $dateInput } = this.getMemberListItems($this);
$this.closest('form').trigger('submit.rails');
$this.closest('form').trigger('submit.rails');
$toggle.
attr('disabled', true
);
$toggle.
disable(
);
$dateInput.
attr('disabled', true
);
$dateInput.
disable(
);
}
}
formSuccess(e) {
formSuccess(e) {
const { $toggle, $dateInput } = this.getMemberListItems($(e.currentTarget).closest('.member'));
const { $toggle, $dateInput } = this.getMemberListItems($(e.currentTarget).closest('.member'));
$toggle.
removeAttr('disabled'
);
$toggle.
enable(
);
$dateInput.
removeAttr('disabled'
);
$dateInput.
enable(
);
}
}
getMemberListItems($el) {
getMemberListItems($el) {
...
...
app/views/projects/group_links/update.js.haml
View file @
1637ce4e
:plain
:plain
var $listItem = $('
#{
escape_javascript
(
render
(
'shared/members/group'
,
group_link:
@group_link
))
}
');
var $listItem = $('
#{
escape_javascript
(
render
(
'shared/members/group'
,
group_link:
@group_link
))
}
');
$("#group_member_
#{
@group_link
.
id
}
.list-item-name").replaceWith($listItem.find('.list-item-name'));
$("#group_member_
#{
@group_link
.
id
}
.list-item-name").replaceWith($listItem.find('.list-item-name'));
gl.utils.localTimeAgo($('.js-timeago'), $("#group_member_
#{
@group_link
.
id
}
"));
app/views/shared/members/_group.html.haml
View file @
1637ce4e
-
group_link
=
local_assigns
[
:group_link
]
-
group_link
=
local_assigns
[
:group_link
]
-
group
=
group_link
.
group
-
group
=
group_link
.
group
-
can_admin_member
=
can?
(
current_user
,
:admin_project_member
,
@project
)
-
can_admin_member
=
can?
(
current_user
,
:admin_project_member
,
@project
)
%li
.member.group_member
{
id:
"group_member_#{group_link.id}"
}
-
dom_id
=
"group_member_
#{
group_link
.
id
}
"
%li
.member.group_member
{
id:
dom_id
}
%span
{
class:
"list-item-name"
}
%span
{
class:
"list-item-name"
}
=
image_tag
group_icon
(
group
),
class:
"avatar s40"
,
alt:
''
=
image_tag
group_icon
(
group
),
class:
"avatar s40"
,
alt:
''
%strong
%strong
...
@@ -14,7 +15,23 @@
...
@@ -14,7 +15,23 @@
Expires in
#{
distance_of_time_in_words_to_now
(
group_link
.
expires_at
)
}
Expires in
#{
distance_of_time_in_words_to_now
(
group_link
.
expires_at
)
}
.controls.member-controls
.controls.member-controls
=
form_tag
namespace_project_group_link_path
(
@project
.
namespace
,
@project
,
group_link
),
method: :put
,
remote:
true
,
class:
'form-horizontal js-edit-member-form'
do
=
form_tag
namespace_project_group_link_path
(
@project
.
namespace
,
@project
,
group_link
),
method: :put
,
remote:
true
,
class:
'form-horizontal js-edit-member-form'
do
=
select_tag
'group_link[group_access]'
,
options_for_select
(
ProjectGroupLink
.
access_options
,
group_link
.
group_access
),
class:
'form-control member-form-control append-right-5 js-member-update-control'
,
id:
"member_access_level_
#{
group
.
id
}
"
,
disabled:
!
can_admin_member
=
hidden_field_tag
"group_link[group_access]"
,
group_link
.
group_access
.member-form-control.dropdown.append-right-5
%button
.dropdown-menu-toggle.js-member-permissions-dropdown
{
type:
"button"
,
disabled:
!
can_admin_member
,
data:
{
toggle:
"dropdown"
,
field_name:
"group_link[group_access]"
}
}
%span
.dropdown-toggle-text
=
group_link
.
human_access
=
icon
(
"chevron-down"
)
.dropdown-menu.dropdown-select.dropdown-menu-align-right.dropdown-menu-selectable
=
dropdown_title
(
"Change permissions"
)
.dropdown-content
%ul
-
Gitlab
::
Access
.
options
.
each
do
|
role
,
role_id
|
%li
=
link_to
role
,
"javascript:void(0)"
,
class:
(
"is-active"
if
group_link
.
group_access
==
role_id
),
data:
{
id:
role_id
,
el_id:
dom_id
}
.prepend-left-5.clearable-input.member-form-control
.prepend-left-5.clearable-input.member-form-control
=
text_field_tag
'group_link[expires_at]'
,
group_link
.
expires_at
,
class:
'form-control js-access-expiration-date js-member-update-control'
,
placeholder:
'Expiration date'
,
id:
"member_expires_at_
#{
group
.
id
}
"
,
disabled:
!
can_admin_member
=
text_field_tag
'group_link[expires_at]'
,
group_link
.
expires_at
,
class:
'form-control js-access-expiration-date js-member-update-control'
,
placeholder:
'Expiration date'
,
id:
"member_expires_at_
#{
group
.
id
}
"
,
disabled:
!
can_admin_member
%i
.clear-icon.js-clear-input
%i
.clear-icon.js-clear-input
...
...
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