Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions app/assets/stylesheets/components/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@
color: var(--color-text-primary);
}

.settings-page .settings-hint {
margin-bottom: var(--spacing-4);
color: var(--color-text-secondary);
font-size: var(--font-size-sm);
}

.settings-page fieldset[disabled] {
opacity: 0.6;
cursor: not-allowed;
}

.settings-page fieldset[disabled] input,
.settings-page fieldset[disabled] button {
cursor: not-allowed;
}

.settings-warning {
margin-bottom: var(--spacing-4);
color: var(--color-warning-text);
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/settings/teams_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def index
def show
@team_members = @team.team_members.includes(:user)
@can_manage = user_signed_in? && @team.admin?(current_user)
@can_invite = user_signed_in? && (@team.member?(current_user) || @team.admin?(current_user))
@can_invite = user_signed_in? && @team.admin?(current_user)
@can_view_invite = user_signed_in? && @team.member?(current_user)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new permission doesn't help, we already have a :before_action require_team_member! - only team members can see the page anyway. (and even if others could, displaying that message to them makes sense)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah totally right, missed that and dropped it.

end

def create
Expand Down
13 changes: 8 additions & 5 deletions app/views/settings/teams/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@
- else
p No members yet.

- if @can_invite
- if @can_view_invite
.invite-section
h2 Add member
- unless @can_invite
p.settings-hint Only team admins can add members.
= form_with url: settings_team_team_members_path(@team), method: :post, local: true do |f|
.form-group
= label_tag :username, "Username"
= text_field_tag :username, nil, required: true, placeholder: "existing_username"
= f.submit "Add", class: "button-primary"
fieldset disabled=(!@can_invite)
.form-group
= label_tag :username, "Username"
= text_field_tag :username, nil, required: true, placeholder: "existing_username"
= f.submit "Add", class: "button-primary"