Commit 8f259c5ecca69af417e10cba11c329a95d3052d9
Exists in
spb-stable
and in
2 other branches
Merge branch 'improve-group-settings-ui' into 'master'
Improve group settings ui
Showing
7 changed files
with
110 additions
and
94 deletions
Show diff stats
app/assets/stylesheets/gl_bootstrap.scss
app/controllers/groups_controller.rb
... | ... | @@ -9,7 +9,7 @@ class GroupsController < ApplicationController |
9 | 9 | before_filter :authorize_create_group!, only: [:new, :create] |
10 | 10 | |
11 | 11 | # Load group projects |
12 | - before_filter :projects, except: [:new, :create] | |
12 | + before_filter :load_projects, except: [:new, :create, :projects, :edit, :update] | |
13 | 13 | |
14 | 14 | before_filter :default_filter, only: [:issues, :merge_requests] |
15 | 15 | |
... | ... | @@ -79,9 +79,13 @@ class GroupsController < ApplicationController |
79 | 79 | def edit |
80 | 80 | end |
81 | 81 | |
82 | + def projects | |
83 | + @projects = @group.projects.page(params[:page]) | |
84 | + end | |
85 | + | |
82 | 86 | def update |
83 | 87 | if @group.update_attributes(params[:group]) |
84 | - redirect_to @group, notice: 'Group was successfully updated.' | |
88 | + redirect_to edit_group_path(@group), notice: 'Group was successfully updated.' | |
85 | 89 | else |
86 | 90 | render action: "edit" |
87 | 91 | end |
... | ... | @@ -99,7 +103,7 @@ class GroupsController < ApplicationController |
99 | 103 | @group ||= Group.find_by(path: params[:id]) |
100 | 104 | end |
101 | 105 | |
102 | - def projects | |
106 | + def load_projects | |
103 | 107 | @projects ||= ProjectsFinder.new.execute(current_user, group: group).sorted_by_activity.non_archived |
104 | 108 | end |
105 | 109 | ... | ... |
... | ... | @@ -0,0 +1,10 @@ |
1 | +%ul.nav.nav-pills.nav-stacked.nav-stacked-menu | |
2 | + = nav_link(path: 'groups#edit') do | |
3 | + = link_to edit_group_path(@group) do | |
4 | + %i.icon-edit | |
5 | + Group | |
6 | + = nav_link(path: 'groups#projects') do | |
7 | + = link_to projects_group_path(@group) do | |
8 | + %i.icon-folder-close | |
9 | + Projects | |
10 | + | ... | ... |
app/views/groups/edit.html.haml
1 | 1 | .row |
2 | 2 | .col-md-2 |
3 | - %ul.nav.nav-pills.nav-stacked.nav-stacked-menu | |
4 | - %li.active | |
5 | - = link_to '#tab-edit', 'data-toggle' => 'tab' do | |
6 | - %i.icon-edit | |
7 | - Group | |
8 | - %li | |
9 | - = link_to '#tab-projects', 'data-toggle' => 'tab' do | |
10 | - %i.icon-folder-close | |
11 | - Projects | |
12 | - %li | |
13 | - = link_to '#tab-remove', 'data-toggle' => 'tab' do | |
14 | - %i.icon-remove-sign | |
15 | - Remove | |
16 | - | |
3 | + = render 'settings_nav' | |
17 | 4 | .col-md-10 |
18 | - .tab-content | |
19 | - .tab-pane.active#tab-edit | |
20 | - .panel.panel-default | |
21 | - .panel-heading | |
22 | - %strong= @group.name | |
23 | - group settings: | |
24 | - %div.form-holder | |
25 | - = form_for @group, html: { multipart: true, class: "form-horizontal" }, authenticity_token: true do |f| | |
26 | - - if @group.errors.any? | |
27 | - .alert.alert-danger | |
28 | - %span= @group.errors.full_messages.first | |
29 | - .form-group | |
30 | - = f.label :name, class: 'control-label' do | |
31 | - Group name | |
32 | - .col-sm-10 | |
33 | - = f.text_field :name, placeholder: "Ex. OpenSource", class: "form-control left" | |
34 | - | |
35 | - .form-group.group-description-holder | |
36 | - = f.label :description, "Details", class: 'control-label' | |
37 | - .col-sm-10 | |
38 | - = f.text_area :description, maxlength: 250, class: "form-control js-gfm-input", rows: 4 | |
5 | + .panel.panel-default | |
6 | + .panel-heading | |
7 | + %strong= @group.name | |
8 | + group settings: | |
9 | + .panel-body | |
10 | + = form_for @group, html: { multipart: true, class: "form-horizontal" }, authenticity_token: true do |f| | |
11 | + - if @group.errors.any? | |
12 | + .alert.alert-danger | |
13 | + %span= @group.errors.full_messages.first | |
14 | + .form-group | |
15 | + = f.label :name, class: 'control-label' do | |
16 | + Group name | |
17 | + .col-sm-10 | |
18 | + = f.text_field :name, placeholder: "Ex. OpenSource", class: "form-control left" | |
39 | 19 | |
40 | - .form-group | |
41 | - .col-sm-2 | |
42 | - .col-sm-10 | |
43 | - = image_tag group_icon(@group.to_param), alt: '', class: 'avatar s160' | |
44 | - %p.light | |
45 | - - if @group.avatar? | |
46 | - You can change your group avatar here | |
47 | - - else | |
48 | - You can upload a group avatar here | |
49 | - %a.choose-btn.btn.btn-small.js-choose-group-avatar-button | |
50 | - %i.icon-paper-clip | |
51 | - %span Choose File ... | |
52 | - | |
53 | - %span.file_name.js-avatar-filename File name... | |
54 | - = f.file_field :avatar, class: "js-group-avatar-input hidden" | |
55 | - .light The maximum file size allowed is 100KB. | |
56 | - - if @group.avatar? | |
57 | - %hr | |
58 | - = link_to 'Remove avatar', group_avatar_path(@group.to_param), data: { confirm: "Group avatar will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-small remove-avatar" | |
20 | + .form-group.group-description-holder | |
21 | + = f.label :description, "Details", class: 'control-label' | |
22 | + .col-sm-10 | |
23 | + = f.text_area :description, maxlength: 250, class: "form-control js-gfm-input", rows: 4 | |
59 | 24 | |
60 | - .form-actions | |
61 | - = f.submit 'Save group', class: "btn btn-save" | |
25 | + .form-group | |
26 | + .col-sm-2 | |
27 | + .col-sm-10 | |
28 | + = image_tag group_icon(@group.to_param), alt: '', class: 'avatar s160' | |
29 | + %p.light | |
30 | + - if @group.avatar? | |
31 | + You can change your group avatar here | |
32 | + - else | |
33 | + You can upload a group avatar here | |
34 | + %a.choose-btn.btn.btn-small.js-choose-group-avatar-button | |
35 | + %i.icon-paper-clip | |
36 | + %span Choose File ... | |
37 | + | |
38 | + %span.file_name.js-avatar-filename File name... | |
39 | + = f.file_field :avatar, class: "js-group-avatar-input hidden" | |
40 | + .light The maximum file size allowed is 100KB. | |
41 | + - if @group.avatar? | |
42 | + %hr | |
43 | + = link_to 'Remove avatar', group_avatar_path(@group.to_param), data: { confirm: "Group avatar will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-small remove-avatar" | |
62 | 44 | |
63 | - .tab-pane#tab-projects | |
64 | - .panel.panel-default | |
65 | - .panel-heading | |
66 | - %strong= @group.name | |
67 | - projects: | |
68 | - - if can? current_user, :manage_group, @group | |
69 | - %span.pull-right | |
70 | - = link_to new_project_path(namespace_id: @group.id), class: "btn btn-tiny" do | |
71 | - %i.icon-plus | |
72 | - New Project | |
73 | - %ul.well-list | |
74 | - - @group.projects.each do |project| | |
75 | - %li | |
76 | - .list-item-name | |
77 | - = visibility_level_icon(project.visibility_level) | |
78 | - = link_to project.name_with_namespace, project | |
79 | - .pull-right | |
80 | - = link_to 'Members', project_team_index_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" | |
81 | - = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" | |
82 | - = link_to 'Remove', project, data: { confirm: remove_project_message(project)}, method: :delete, class: "btn btn-small btn-remove" | |
83 | - - if @group.projects.blank? | |
84 | - .nothing-here-block This group has no projects yet | |
45 | + .form-actions | |
46 | + = f.submit 'Save group', class: "btn btn-save" | |
85 | 47 | |
86 | - .tab-pane#tab-remove | |
87 | - .panel.panel-default.panel.panel-danger | |
88 | - .panel-heading Remove group | |
89 | - .panel-body | |
90 | - %p | |
91 | - Removing group will cause all child projects and resources to be removed. | |
92 | - %p | |
93 | - %strong Removed group can not be restored! | |
48 | + .panel.panel-danger | |
49 | + .panel-heading Remove group | |
50 | + .panel-body | |
51 | + %p | |
52 | + Removing group will cause all child projects and resources to be removed. | |
53 | + %br | |
54 | + %strong Removed group can not be restored! | |
94 | 55 | |
95 | - = link_to 'Remove Group', @group, data: {confirm: 'Removed group can not be restored! Are you sure?'}, method: :delete, class: "btn btn-remove" | |
56 | + = link_to 'Remove Group', @group, data: {confirm: 'Removed group can not be restored! Are you sure?'}, method: :delete, class: "btn btn-remove" | ... | ... |
... | ... | @@ -0,0 +1,29 @@ |
1 | +.row | |
2 | + .col-md-2 | |
3 | + = render 'settings_nav' | |
4 | + .col-md-10 | |
5 | + .panel.panel-default | |
6 | + .panel-heading | |
7 | + %strong= @group.name | |
8 | + projects: | |
9 | + - if can? current_user, :manage_group, @group | |
10 | + .panel-head-actions | |
11 | + = link_to new_project_path(namespace_id: @group.id), class: "btn btn-new" do | |
12 | + %i.icon-plus | |
13 | + New Project | |
14 | + %ul.well-list | |
15 | + - @projects.each do |project| | |
16 | + %li | |
17 | + .list-item-name | |
18 | + = visibility_level_icon(project.visibility_level) | |
19 | + %strong= link_to project.name_with_namespace, project | |
20 | + %span.label.label-gray | |
21 | + = repository_size(project) | |
22 | + .pull-right | |
23 | + = link_to 'Members', project_team_index_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" | |
24 | + = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" | |
25 | + = link_to 'Remove', project, data: { confirm: remove_project_message(project)}, method: :delete, class: "btn btn-small btn-remove" | |
26 | + - if @projects.blank? | |
27 | + .nothing-here-block This group has no projects yet | |
28 | + | |
29 | + = paginate @projects, theme: "gitlab" | ... | ... |
config/routes.rb
features/steps/group/group.rb
... | ... | @@ -38,22 +38,22 @@ class Groups < Spinach::FeatureSteps |
38 | 38 | end |
39 | 39 | |
40 | 40 | Then 'I should see user "John Doe" in team list' do |
41 | - projects_with_access = find(".ui-box .well-list") | |
41 | + projects_with_access = find(".panel .well-list") | |
42 | 42 | projects_with_access.should have_content("John Doe") |
43 | 43 | end |
44 | 44 | |
45 | 45 | Then 'I should not see user "John Doe" in team list' do |
46 | - projects_with_access = find(".ui-box .well-list") | |
46 | + projects_with_access = find(".panel .well-list") | |
47 | 47 | projects_with_access.should_not have_content("John Doe") |
48 | 48 | end |
49 | 49 | |
50 | 50 | Then 'I should see user "Mary Jane" in team list' do |
51 | - projects_with_access = find(".ui-box .well-list") | |
51 | + projects_with_access = find(".panel .well-list") | |
52 | 52 | projects_with_access.should have_content("Mary Jane") |
53 | 53 | end |
54 | 54 | |
55 | 55 | Then 'I should not see user "Mary Jane" in team list' do |
56 | - projects_with_access = find(".ui-box .well-list") | |
56 | + projects_with_access = find(".panel .well-list") | |
57 | 57 | projects_with_access.should_not have_content("Mary Jane") |
58 | 58 | end |
59 | 59 | ... | ... |