From cc1dd624aab2f5f85ec121506884965f5353411d Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 14 Mar 2013 11:31:33 +0200 Subject: [PATCH] Restyled group -> edit area. Use select2 for transfer autocomplete --- .../stylesheets/gitlab_bootstrap/blocks.scss | 25 ++++ .../stylesheets/gitlab_bootstrap/common.scss | 4 + app/assets/stylesheets/selects.scss | 28 +++- app/controllers/groups_controller.rb | 1 + app/views/groups/edit.html.haml | 130 ++++++++++-------- app/views/layouts/group.html.haml | 3 +- 6 files changed, 127 insertions(+), 64 deletions(-) diff --git a/app/assets/stylesheets/gitlab_bootstrap/blocks.scss b/app/assets/stylesheets/gitlab_bootstrap/blocks.scss index ce939bc2..6bb57673 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/blocks.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/blocks.scss @@ -20,6 +20,15 @@ background: #FFF; } + &.ui-box-danger { + .title { + @include linear-gradient(#F26E5E, #bd362f); + color: #fff; + text-shadow: 0 1px 1px #900; + font-weight: bold; + } + } + img { max-width: 100%; } pre { @@ -141,4 +150,20 @@ text-decoration: underline; } } + + .form-holder { + padding-top: 20px; + form { + margin-bottom: 0; + .form-actions { + margin-bottom: 0; + } + } + } +} + +.tab-pane { + .ui-box { + margin: 3px 3px 25px 3px; + } } diff --git a/app/assets/stylesheets/gitlab_bootstrap/common.scss b/app/assets/stylesheets/gitlab_bootstrap/common.scss index 00d2e88a..6bdd1652 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/common.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/common.scss @@ -73,3 +73,7 @@ fieldset legend { font-size: 17px; } border-bottom: 2px solid $style_color; } } + +.tab-content { + overflow: visible; +} diff --git a/app/assets/stylesheets/selects.scss b/app/assets/stylesheets/selects.scss index 8eec1559..07f7db75 100644 --- a/app/assets/stylesheets/selects.scss +++ b/app/assets/stylesheets/selects.scss @@ -13,11 +13,6 @@ } } -.select2-no-results, .select2-searching { - padding: 7px; - color: #666; -} - /** Branch/tag selector **/ .project-refs-form { margin: 0; @@ -108,3 +103,26 @@ } } } + +/** Select2 styling **/ +.select2-container .select2-choice { + background: #f1f1f1; + background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, whitesmoke), to(#e1e1e1)); + background-image: -webkit-linear-gradient(whitesmoke 6.6%, #e1e1e1); + background-image: -moz-linear-gradient(whitesmoke 6.6%, #e1e1e1); + background-image: -o-linear-gradient(whitesmoke 6.6%, #e1e1e1); +} + +.select2-container .select2-choice div { + border: none; + background: none; +} + +.select2-drop { + padding-top: 8px; +} + +.select2-no-results, .select2-searching { + padding: 7px; + color: #666; +} diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 7b8649a6..cbb024bb 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -94,6 +94,7 @@ class GroupsController < ApplicationController if owner_id @group.owner = User.find(owner_id) + @group.save end if @group.update_attributes(group_params) diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml index bf16b70c..eb4f324b 100644 --- a/app/views/groups/edit.html.haml +++ b/app/views/groups/edit.html.haml @@ -1,59 +1,75 @@ -%h3.page_title Edit Group -%hr -= form_for @group do |f| - - if @group.errors.any? - .alert.alert-error - %span= @group.errors.full_messages.first - .clearfix - = f.label :name do - Group name is - .input - = f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left" - - .clearfix.group-description-holder - = f.label :description, "Details" - .input - = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 - - .form-actions - = f.submit 'Save group', class: "btn btn-save" - -%hr - - .row - .span7 - .ui-box - %h5.title Projects - %ul.well-list - - @group.projects.each do |project| - %li - - if project.public - %i.icon-share - - else - %i.icon-lock.cgreen - = link_to project.name_with_namespace, project - .pull-right - = link_to 'Team', project_team_index_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" - = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" - = link_to 'Remove', project, confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" - - if @group.projects.blank? - %p.nothing_here_message This group has no projects yet + .span3 + %ul.nav.nav-pills.nav-stacked + %li.active + = link_to 'Projects', '#tab-projects', 'data-toggle' => 'tab' + %li + = link_to 'Edit Group', '#tab-edit', 'data-toggle' => 'tab' + %li + = link_to 'Transfer', '#tab-transfer', 'data-toggle' => 'tab' + %li + = link_to 'Remove', '#tab-remove', 'data-toggle' => 'tab' - .span5 - .ui-box - %h5.title Transfer group - .padded - %p - Transferring group will cause loss of admin control over group and all child projects - = form_for @group do |f| - = f.select :owner_id, User.all.map { |user| [user.name, user.id] }, {}, {class: 'chosen'} - = f.submit 'Transfer group', class: "btn btn-small" - .ui-box - %h5.title Remove group - .padded.bgred - %p - Remove of group will cause removing all child projects and resources - %br - Removed group can not be restored! - = link_to 'Remove Group', @group, confirm: 'Removed group can not be restored! Are you sure?', method: :delete, class: "btn btn-remove btn-small" + .span9 + .tab-content + .tab-pane.active#tab-projects + .ui-box + %h5.title Projects + %ul.well-list + - @group.projects.each do |project| + %li + - if project.public + %i.icon-share + - else + %i.icon-lock.cgreen + = link_to project.name_with_namespace, project + .pull-right + = link_to 'Team', project_team_index_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" + = link_to 'Edit', edit_project_path(project), id: "edit_#{dom_id(project)}", class: "btn btn-small" + = link_to 'Remove', project, confirm: "REMOVE #{project.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" + - if @group.projects.blank? + %p.nothing_here_message This group has no projects yet + + .tab-pane#tab-edit + .ui-box + %h5.title Edit Group + %div.form-holder + = form_for @group do |f| + - if @group.errors.any? + .alert.alert-error + %span= @group.errors.full_messages.first + .clearfix + = f.label :name do + Group name is + .input + = f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left" + + .clearfix.group-description-holder + = f.label :description, "Details" + .input + = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 + + .form-actions + = f.submit 'Save group', class: "btn btn-save" + + .tab-pane#tab-transfer + .ui-box.ui-box-danger + %h5.title Transfer group + .ui-box-body + %p + Transferring group will cause loss of admin control over group and all child projects + = form_for @group do |f| + = users_select_tag(:'group[owner_id]') + %hr + = f.submit 'Transfer group', class: "btn btn-small btn-remove" + + .tab-pane#tab-remove + .ui-box.ui-box-danger + %h5.title Remove group + .ui-box-body + %p + Remove of group will cause removing all child projects and resources. + %p + %strong Removed group can not be restored! + + = link_to 'Remove Group', @group, confirm: 'Removed group can not be restored! Are you sure?', method: :delete, class: "btn btn-remove btn-small" diff --git a/app/views/layouts/group.html.haml b/app/views/layouts/group.html.haml index 2c144de4..624d5ab5 100644 --- a/app/views/layouts/group.html.haml +++ b/app/views/layouts/group.html.haml @@ -25,7 +25,6 @@ - if can?(current_user, :manage_group, @group) = nav_link(path: 'groups#edit') do = link_to edit_group_path(@group), class: "tab " do - %i.icon-edit - Edit Group + Settings .content= yield