BigW Consortium Gitlab

Commit 843dd24b by Phil Hughes

Mobile improvements

Added group name to members row Fixed saving group member
parent e33cda96
((w) => { ((w) => {
window.gl = window.gl || {}; w.gl = w.gl || {};
class ProjectMembers { class ProjectMembers {
constructor() { constructor() {
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
removeListeners() { removeListeners() {
$('.project_member, .group_member').off('ajax:success'); $('.project_member, .group_member').off('ajax:success');
$('.js-member-update-control').off('change'); $('.js-member-update-control').off('change');
$('.js-edit-member-form').off('ajax:success');
} }
addListeners() { addListeners() {
...@@ -17,6 +18,10 @@ ...@@ -17,6 +18,10 @@
$('.js-member-update-control').on('change', function () { $('.js-member-update-control').on('change', function () {
$(this).closest('form') $(this).closest('form')
.trigger("submit.rails"); .trigger("submit.rails");
$(this).disable();
});
$('.js-edit-member-form').on('ajax:success', function () {
$(this).find('.js-member-update-control').enable();
}); });
} }
......
...@@ -128,6 +128,10 @@ ul.content-list { ...@@ -128,6 +128,10 @@ ul.content-list {
color: $gl-dark-link-color; color: $gl-dark-link-color;
} }
.member-group-link {
color: $blue-normal;
}
.description { .description {
p { p {
@include str-truncated; @include str-truncated;
...@@ -166,8 +170,8 @@ ul.content-list { ...@@ -166,8 +170,8 @@ ul.content-list {
.member-controls { .member-controls {
float: none; float: none;
@media (min-width: $screen-md-min) { @media (min-width: $screen-sm-min) {
float: right; float: right;
} }
} }
......
...@@ -8,24 +8,52 @@ ...@@ -8,24 +8,52 @@
.list-item-name { .list-item-name {
float: none; float: none;
@media (min-width: $screen-md-min) { @media (min-width: $screen-sm-min) {
float: left; float: left;
width: 50%; width: 50%;
} }
} }
.controls { .controls {
display: flex; @media (min-width: $screen-sm-min) {
width: 400px; display: flex;
width: 400px;
max-width: 50%;
}
} }
.form-horizontal { .form-horizontal {
display: flex; margin-top: 5px;
flex: 1;
margin-top: 3px; @media (min-width: $screen-sm-min) {
display: flex;
flex: 1;
margin-top: 3px;
}
}
.btn-remove {
width: 100%;
@media (min-width: $screen-sm-min) {
width: auto;
}
}
}
.member-form-control {
@media (max-width: $screen-xs-max) {
padding: 5px 0;
margin-left: 0;
margin-right: 0;
} }
.member-form-control { @media (min-width: $screen-sm-min) {
width: 50%; width: 50%;
} }
} }
.member-access-text {
margin-left: auto;
line-height: 43px;
}
:plain :plain
$("##{dom_id(@group_member)}").replaceWith('#{escape_javascript(render('shared/members/member', member: @group_member))}'); var $listItem = $('#{escape_javascript(render('shared/members/member', member: @group_member))}');
new gl.MemberExpirationDate(); $("##{dom_id(@group_member)} .list-item-name").replaceWith($listItem.find('.list-item-name'));
...@@ -6,4 +6,4 @@ ...@@ -6,4 +6,4 @@
%ul.content-list %ul.content-list
- members.each do |user| - members.each do |user|
- member = @project.team.find_member(user.id) - member = @project.team.find_member(user.id)
= render 'shared/members/member', member: member = render 'shared/members/member', member: member, user: user
...@@ -17,7 +17,10 @@ ...@@ -17,7 +17,10 @@
.prepend-left-5.append-right-10.clearable-input.member-form-control .prepend-left-5.append-right-10.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}" = 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}"
%i.clear-icon.js-clear-input %i.clear-icon.js-clear-input
= link_to icon('trash'), namespace_project_group_link_path(@project.namespace, @project, group_link), = link_to namespace_project_group_link_path(@project.namespace, @project, group_link),
remote: true, remote: true,
method: :delete, method: :delete,
class: 'btn btn-remove' class: 'btn btn-remove' do
%span.visible-xs-block
Delete
= icon('trash', class: 'hidden-xs')
- show_roles = local_assigns.fetch(:show_roles, true) - show_roles = local_assigns.fetch(:show_roles, true)
- show_controls = local_assigns.fetch(:show_controls, true) - show_controls = local_assigns.fetch(:show_controls, true)
- user = member.user - user = local_assigns.fetch(:user, member.user)
%li.member{ class: dom_class(member), id: dom_id(member) } %li.member{ class: dom_class(member), id: dom_id(member) }
%span{ class: ("list-item-name" if show_controls) } %span{ class: ("list-item-name" if show_controls) }
...@@ -11,12 +11,16 @@ ...@@ -11,12 +11,16 @@
%span.cgray= user.to_reference %span.cgray= user.to_reference
- if user == current_user - if user == current_user
%span.label.label-success It's you %span.label.label-success.prepend-left-5 It's you
- if user.blocked? - if user.blocked?
%label.label.label-danger %label.label.label-danger
%strong Blocked %strong Blocked
- if member.respond_to?(:group) && !@group
= link_to member.group, class: "member-group-link prepend-left-5" do
= #{member.group.name}"
.cgray .cgray
- if member.request? - if member.request?
Requested Requested
...@@ -40,11 +44,14 @@ ...@@ -40,11 +44,14 @@
- if show_roles - if show_roles
.controls.member-controls .controls.member-controls
- if show_controls - if show_controls
= form_for member, remote: true, html: { class: 'form-horizontal' } do |f| - if user != current_user
= f.select :access_level, options_for_select(member.class.access_level_roles, member.access_level), {}, class: 'form-control member-form-control append-right-5 js-member-update-control', id: "member_access_level_#{member.id}", disabled: !can?(current_user, action_member_permission(:update, member), member) = form_for member, remote: true, html: { class: 'form-horizontal js-edit-member-form' } do |f|
.prepend-left-5.append-right-10.clearable-input.member-form-control = f.select :access_level, options_for_select(member.class.access_level_roles, member.access_level), {}, class: 'form-control member-form-control append-right-5 js-member-update-control', id: "member_access_level_#{member.id}", disabled: !can?(current_user, action_member_permission(:update, member), member)
= f.text_field :expires_at, class: 'form-control js-access-expiration-date js-member-update-control', placeholder: 'Expiration date', id: "member_expires_at_#{member.id}", disabled: !can?(current_user, action_member_permission(:update, member), member) .prepend-left-5.append-right-10.clearable-input.member-form-control
%i.clear-icon.js-clear-input = f.text_field :expires_at, class: 'form-control js-access-expiration-date js-member-update-control', placeholder: 'Expiration date', id: "member_expires_at_#{member.id}", disabled: !can?(current_user, action_member_permission(:update, member), member)
%i.clear-icon.js-clear-input
- else
%span.member-access-text= member.human_access
- if !user && can?(current_user, action_member_permission(:admin, member), member.source) - if !user && can?(current_user, action_member_permission(:admin, member), member.source)
= link_to 'Resend invite', polymorphic_path([:resend_invite, member]), = link_to 'Resend invite', polymorphic_path([:resend_invite, member]),
method: :post, method: :post,
...@@ -63,9 +70,12 @@ ...@@ -63,9 +70,12 @@
data: { confirm: leave_confirmation_message(member.source) }, data: { confirm: leave_confirmation_message(member.source) },
class: 'btn btn-remove' class: 'btn btn-remove'
- else - else
= link_to icon('trash'), member, = link_to member,
remote: true, remote: true,
method: :delete, method: :delete,
data: { confirm: remove_member_message(member) }, data: { confirm: remove_member_message(member) },
class: 'btn btn-remove', class: 'btn btn-remove',
title: remove_member_title(member) title: remove_member_title(member) do
%span.visible-xs-block
Delete
= icon('trash', class: 'hidden-xs')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment