Restyled group -> edit area. Use select2 for transfer autocomplete

This commit is contained in:
Dmitriy Zaporozhets 2013-03-14 11:31:33 +02:00
parent 2f6d289f32
commit cc1dd624aa
6 changed files with 127 additions and 64 deletions

View file

@ -20,6 +20,15 @@
background: #FFF; 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%; } img { max-width: 100%; }
pre { pre {
@ -141,4 +150,20 @@
text-decoration: underline; 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;
}
} }

View file

@ -73,3 +73,7 @@ fieldset legend { font-size: 17px; }
border-bottom: 2px solid $style_color; border-bottom: 2px solid $style_color;
} }
} }
.tab-content {
overflow: visible;
}

View file

@ -13,11 +13,6 @@
} }
} }
.select2-no-results, .select2-searching {
padding: 7px;
color: #666;
}
/** Branch/tag selector **/ /** Branch/tag selector **/
.project-refs-form { .project-refs-form {
margin: 0; 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;
}

View file

@ -94,6 +94,7 @@ class GroupsController < ApplicationController
if owner_id if owner_id
@group.owner = User.find(owner_id) @group.owner = User.find(owner_id)
@group.save
end end
if @group.update_attributes(group_params) if @group.update_attributes(group_params)

View file

@ -1,28 +1,18 @@
%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 .row
.span7 .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'
.span9
.tab-content
.tab-pane.active#tab-projects
.ui-box .ui-box
%h5.title Projects %h5.title Projects
%ul.well-list %ul.well-list
@ -40,20 +30,46 @@
- if @group.projects.blank? - if @group.projects.blank?
%p.nothing_here_message This group has no projects yet %p.nothing_here_message This group has no projects yet
.span5 .tab-pane#tab-edit
.ui-box .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 %h5.title Transfer group
.padded .ui-box-body
%p %p
Transferring group will cause loss of admin control over group and all child projects Transferring group will cause loss of admin control over group and all child projects
= form_for @group do |f| = form_for @group do |f|
= f.select :owner_id, User.all.map { |user| [user.name, user.id] }, {}, {class: 'chosen'} = users_select_tag(:'group[owner_id]')
= f.submit 'Transfer group', class: "btn btn-small" %hr
.ui-box = f.submit 'Transfer group', class: "btn btn-small btn-remove"
.tab-pane#tab-remove
.ui-box.ui-box-danger
%h5.title Remove group %h5.title Remove group
.padded.bgred .ui-box-body
%p %p
Remove of group will cause removing all child projects and resources Remove of group will cause removing all child projects and resources.
%br %p
Removed group can not be restored! %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" = link_to 'Remove Group', @group, confirm: 'Removed group can not be restored! Are you sure?', method: :delete, class: "btn btn-remove btn-small"

View file

@ -25,7 +25,6 @@
- if can?(current_user, :manage_group, @group) - if can?(current_user, :manage_group, @group)
= nav_link(path: 'groups#edit') do = nav_link(path: 'groups#edit') do
= link_to edit_group_path(@group), class: "tab " do = link_to edit_group_path(@group), class: "tab " do
%i.icon-edit Settings
Edit Group
.content= yield .content= yield