Commit 5c3cb47c16cacd8e9056f2a68978d69bc153a0f8
Exists in
master
and in
4 other branches
Merge branch 'team-and-group-descriptions' of https://github.com/Undev/gitlabhq …
…into Undev-team-and-group-descriptions Conflicts: db/schema.rb
Showing
26 changed files
with
155 additions
and
45 deletions
Show diff stats
app/models/group.rb
| ... | ... | @@ -2,13 +2,14 @@ |
| 2 | 2 | # |
| 3 | 3 | # Table name: namespaces |
| 4 | 4 | # |
| 5 | -# id :integer not null, primary key | |
| 6 | -# name :string(255) not null | |
| 7 | -# path :string(255) not null | |
| 8 | -# owner_id :integer not null | |
| 9 | -# created_at :datetime not null | |
| 10 | -# updated_at :datetime not null | |
| 11 | -# type :string(255) | |
| 5 | +# id :integer not null, primary key | |
| 6 | +# name :string(255) not null | |
| 7 | +# description :string(255) not null | |
| 8 | +# path :string(255) not null | |
| 9 | +# owner_id :integer not null | |
| 10 | +# created_at :datetime not null | |
| 11 | +# updated_at :datetime not null | |
| 12 | +# type :string(255) | |
| 12 | 13 | # |
| 13 | 14 | |
| 14 | 15 | class Group < Namespace | ... | ... |
app/models/namespace.rb
| ... | ... | @@ -2,17 +2,18 @@ |
| 2 | 2 | # |
| 3 | 3 | # Table name: namespaces |
| 4 | 4 | # |
| 5 | -# id :integer not null, primary key | |
| 6 | -# name :string(255) not null | |
| 7 | -# path :string(255) not null | |
| 8 | -# owner_id :integer not null | |
| 9 | -# created_at :datetime not null | |
| 10 | -# updated_at :datetime not null | |
| 11 | -# type :string(255) | |
| 5 | +# id :integer not null, primary key | |
| 6 | +# name :string(255) not null | |
| 7 | +# description :string(255) not null | |
| 8 | +# path :string(255) not null | |
| 9 | +# owner_id :integer not null | |
| 10 | +# created_at :datetime not null | |
| 11 | +# updated_at :datetime not null | |
| 12 | +# type :string(255) | |
| 12 | 13 | # |
| 13 | 14 | |
| 14 | 15 | class Namespace < ActiveRecord::Base |
| 15 | - attr_accessible :name, :path | |
| 16 | + attr_accessible :name, :description, :path | |
| 16 | 17 | |
| 17 | 18 | has_many :projects, dependent: :destroy |
| 18 | 19 | belongs_to :owner, class_name: "User" |
| ... | ... | @@ -22,7 +23,7 @@ class Namespace < ActiveRecord::Base |
| 22 | 23 | length: { within: 0..255 }, |
| 23 | 24 | format: { with: Gitlab::Regex.name_regex, |
| 24 | 25 | message: "only letters, digits, spaces & '_' '-' '.' allowed." } |
| 25 | - | |
| 26 | + validates :description, length: { within: 0..255 } | |
| 26 | 27 | validates :path, uniqueness: true, presence: true, length: { within: 1..255 }, |
| 27 | 28 | format: { with: Gitlab::Regex.path_regex, |
| 28 | 29 | message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } | ... | ... |
app/models/user_team.rb
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | # |
| 12 | 12 | |
| 13 | 13 | class UserTeam < ActiveRecord::Base |
| 14 | - attr_accessible :name, :owner_id, :path | |
| 14 | + attr_accessible :name, :description, :owner_id, :path | |
| 15 | 15 | |
| 16 | 16 | belongs_to :owner, class_name: User |
| 17 | 17 | |
| ... | ... | @@ -26,6 +26,7 @@ class UserTeam < ActiveRecord::Base |
| 26 | 26 | length: { within: 0..255 }, |
| 27 | 27 | format: { with: Gitlab::Regex.name_regex, |
| 28 | 28 | message: "only letters, digits, spaces & '_' '-' '.' allowed." } |
| 29 | + validates :description, length: { within: 0..255 } | |
| 29 | 30 | validates :path, uniqueness: true, presence: true, length: { within: 1..255 }, |
| 30 | 31 | format: { with: Gitlab::Regex.path_regex, |
| 31 | 32 | message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } | ... | ... |
app/views/admin/groups/edit.html.haml
| 1 | -%h3.page_title Rename Group | |
| 1 | +%h3.page_title Edit Group | |
| 2 | 2 | %hr |
| 3 | 3 | = form_for [:admin, @group] do |f| |
| 4 | 4 | - if @group.errors.any? |
| ... | ... | @@ -10,7 +10,10 @@ |
| 10 | 10 | .input |
| 11 | 11 | = f.text_field :name, placeholder: "Example Group", class: "xxlarge" |
| 12 | 12 | |
| 13 | - | |
| 13 | + .clearfix.group-description-holder | |
| 14 | + = f.label :description, "Details" | |
| 15 | + .input | |
| 16 | + = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 | |
| 14 | 17 | |
| 15 | 18 | .clearfix.group_name_holder |
| 16 | 19 | = f.label :path do |
| ... | ... | @@ -24,5 +27,5 @@ |
| 24 | 27 | %li It will change the git path to repositories under this group. |
| 25 | 28 | |
| 26 | 29 | .form-actions |
| 27 | - = f.submit 'Rename group', class: "btn btn-remove" | |
| 30 | + = f.submit 'Edit group', class: "btn btn-remove" | |
| 28 | 31 | = link_to 'Cancel', admin_groups_path, class: "btn btn-cancel" | ... | ... |
app/views/admin/groups/index.html.haml
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | Name |
| 18 | 18 | %i.icon-sort-down |
| 19 | 19 | %th Path |
| 20 | + %th Description | |
| 20 | 21 | %th Projects |
| 21 | 22 | %th Owner |
| 22 | 23 | %th.cred Danger Zone! |
| ... | ... | @@ -25,11 +26,12 @@ |
| 25 | 26 | %tr |
| 26 | 27 | %td |
| 27 | 28 | %strong= link_to group.name, [:admin, group] |
| 29 | + %td= group.description | |
| 28 | 30 | %td= group.path |
| 29 | 31 | %td= group.projects.count |
| 30 | 32 | %td |
| 31 | 33 | = link_to group.owner_name, admin_user_path(group.owner) |
| 32 | 34 | %td.bgred |
| 33 | - = link_to 'Rename', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn btn-small" | |
| 35 | + = link_to 'Edit', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn btn-small" | |
| 34 | 36 | = link_to 'Destroy', [:admin, group], confirm: "REMOVE #{group.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" |
| 35 | 37 | = paginate @groups, theme: "admin" | ... | ... |
app/views/admin/groups/new.html.haml
| ... | ... | @@ -9,8 +9,14 @@ |
| 9 | 9 | Group name is |
| 10 | 10 | .input |
| 11 | 11 | = f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left" |
| 12 | - | |
| 13 | - = f.submit 'Create group', class: "btn btn-primary" | |
| 12 | + .clearfix.group-description-holder | |
| 13 | + = f.label :description, "Details" | |
| 14 | + .input | |
| 15 | + = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 | |
| 16 | + | |
| 17 | + .form-actions | |
| 18 | + = f.submit 'Create group', class: "btn btn-primary" | |
| 19 | + | |
| 14 | 20 | %hr |
| 15 | 21 | .padded |
| 16 | 22 | %ul | ... | ... |
app/views/admin/groups/show.html.haml
app/views/admin/teams/edit.html.haml
| 1 | -%h3.page_title Rename Team | |
| 1 | +%h3.page_title Edit Team | |
| 2 | 2 | %hr |
| 3 | 3 | = form_for @team, url: admin_team_path(@team), method: :put do |f| |
| 4 | 4 | - if @team.errors.any? |
| ... | ... | @@ -10,6 +10,11 @@ |
| 10 | 10 | .input |
| 11 | 11 | = f.text_field :name, placeholder: "Example Team", class: "xxlarge" |
| 12 | 12 | |
| 13 | + .clearfix.team-description-holder | |
| 14 | + = f.label :description, "Details" | |
| 15 | + .input | |
| 16 | + = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 | |
| 17 | + | |
| 13 | 18 | .clearfix.team_name_holder |
| 14 | 19 | = f.label :path do |
| 15 | 20 | %span.cred Team path is |
| ... | ... | @@ -19,5 +24,5 @@ |
| 19 | 24 | %li It will change web url for access team and team projects. |
| 20 | 25 | |
| 21 | 26 | .form-actions |
| 22 | - = f.submit 'Rename team', class: "btn btn-remove" | |
| 27 | + = f.submit 'Edit team', class: "btn btn-remove" | |
| 23 | 28 | = link_to 'Cancel', admin_teams_path, class: "btn btn-cancel" | ... | ... |
app/views/admin/teams/index.html.haml
| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | %th |
| 17 | 17 | Name |
| 18 | 18 | %i.icon-sort-down |
| 19 | + %th Description | |
| 19 | 20 | %th Path |
| 20 | 21 | %th Projects |
| 21 | 22 | %th Members |
| ... | ... | @@ -26,13 +27,14 @@ |
| 26 | 27 | %tr |
| 27 | 28 | %td |
| 28 | 29 | %strong= link_to team.name, admin_team_path(team) |
| 30 | + %td= team.description | |
| 29 | 31 | %td= team.path |
| 30 | 32 | %td= team.projects.count |
| 31 | 33 | %td= team.members.count |
| 32 | 34 | %td |
| 33 | 35 | = link_to team.owner.name, admin_user_path(team.owner) |
| 34 | 36 | %td.bgred |
| 35 | - = link_to 'Rename', edit_admin_team_path(team), id: "edit_#{dom_id(team)}", class: "btn btn-small" | |
| 37 | + = link_to 'Edit', edit_admin_team_path(team), id: "edit_#{dom_id(team)}", class: "btn btn-small" | |
| 36 | 38 | = link_to 'Destroy', admin_team_path(team), confirm: "REMOVE #{team.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" |
| 37 | 39 | |
| 38 | 40 | = paginate @teams, theme: "admin" | ... | ... |
app/views/admin/teams/new.html.haml
| ... | ... | @@ -9,8 +9,15 @@ |
| 9 | 9 | Team name is |
| 10 | 10 | .input |
| 11 | 11 | = f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left" |
| 12 | - | |
| 13 | - = f.submit 'Create team', class: "btn btn-primary" | |
| 12 | + | |
| 13 | + .clearfix.team-description-holder | |
| 14 | + = f.label :description, "Details" | |
| 15 | + .input | |
| 16 | + = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 | |
| 17 | + | |
| 18 | + .form-actions | |
| 19 | + = f.submit 'Create team', class: "btn btn-primary" | |
| 20 | + | |
| 14 | 21 | %hr |
| 15 | 22 | .padded |
| 16 | 23 | %ul | ... | ... |
app/views/admin/teams/show.html.haml
app/views/groups/edit.html.haml
| ... | ... | @@ -9,8 +9,15 @@ |
| 9 | 9 | Group name is |
| 10 | 10 | .input |
| 11 | 11 | = f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left" |
| 12 | - | |
| 13 | - = f.submit 'Save group', class: "btn btn-save" | |
| 12 | + | |
| 13 | + .clearfix.group-description-holder | |
| 14 | + = f.label :description, "Details" | |
| 15 | + .input | |
| 16 | + = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 | |
| 17 | + | |
| 18 | + .form-actions | |
| 19 | + = f.submit 'Save group', class: "btn btn-save" | |
| 20 | + | |
| 14 | 21 | %hr |
| 15 | 22 | |
| 16 | 23 | ... | ... |
app/views/groups/new.html.haml
| ... | ... | @@ -9,8 +9,16 @@ |
| 9 | 9 | Group name is |
| 10 | 10 | .input |
| 11 | 11 | = f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left" |
| 12 | - | |
| 13 | - = f.submit 'Create group', class: "btn btn-create" | |
| 12 | + | |
| 13 | + .clearfix.group-description-holder | |
| 14 | + = f.label :description, "Details" | |
| 15 | + .input | |
| 16 | + = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 | |
| 17 | + | |
| 18 | + .form-actions | |
| 19 | + = f.submit 'Create group', class: "btn btn-primary" | |
| 20 | + | |
| 21 | + | |
| 14 | 22 | %hr |
| 15 | 23 | .padded |
| 16 | 24 | %ul | ... | ... |
app/views/groups/show.html.haml
app/views/teams/edit.html.haml
| ... | ... | @@ -12,13 +12,20 @@ |
| 12 | 12 | .input |
| 13 | 13 | = f.text_field :name, placeholder: "Ex. OpenSource", class: "xlarge left" |
| 14 | 14 | |
| 15 | + .clearfix.team-description-holder | |
| 16 | + = f.label :description, "Details" | |
| 17 | + .input | |
| 18 | + = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 | |
| 19 | + | |
| 15 | 20 | .clearfix |
| 16 | 21 | = f.label :path do |
| 17 | 22 | Team path is |
| 18 | 23 | .input |
| 19 | 24 | = f.text_field :path, placeholder: "opensource", class: "xlarge left" |
| 25 | + | |
| 20 | 26 | .form-actions |
| 21 | - = f.submit 'Save team changes', class: "btn btn-save" | |
| 27 | + = f.submit 'Save team changes', class: "btn btn-primary" | |
| 28 | + = link_to 'Delete team', team_path(@team), method: :delete, confirm: "You are shure?", class: "btn btn-remove pull-right" | |
| 22 | 29 | .span5 |
| 23 | 30 | .ui-box |
| 24 | 31 | %h5.title Remove team |
| ... | ... | @@ -26,4 +33,3 @@ |
| 26 | 33 | %p |
| 27 | 34 | Removed team can not be restored! |
| 28 | 35 | = link_to 'Remove team', team_path(@team), method: :delete, confirm: "You are sure?", class: "btn btn-remove btn-small" |
| 29 | - | ... | ... |
app/views/teams/new.html.haml
| ... | ... | @@ -9,8 +9,15 @@ |
| 9 | 9 | Team name is |
| 10 | 10 | .input |
| 11 | 11 | = f.text_field :name, placeholder: "Ex. Ruby Developers", class: "xxlarge left" |
| 12 | - | |
| 13 | - = f.submit 'Create team', class: "btn btn-create" | |
| 12 | + | |
| 13 | + .clearfix.team-description-holder | |
| 14 | + = f.label :description, "Details" | |
| 15 | + .input | |
| 16 | + = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4 | |
| 17 | + | |
| 18 | + .form-actions | |
| 19 | + = f.submit 'Create team', class: "btn btn-create" | |
| 20 | + | |
| 14 | 21 | %hr |
| 15 | 22 | .padded |
| 16 | 23 | %ul | ... | ... |
app/views/teams/show.html.haml
db/migrate/20130206084024_add_description_to_namsespace.rb
0 → 100644
db/schema.rb
| ... | ... | @@ -112,6 +112,7 @@ ActiveRecord::Schema.define(:version => 20130220133245) do |
| 112 | 112 | t.datetime "created_at", :null => false |
| 113 | 113 | t.datetime "updated_at", :null => false |
| 114 | 114 | t.string "type" |
| 115 | + t.string "description", :default => "", :null => false | |
| 115 | 116 | end |
| 116 | 117 | |
| 117 | 118 | add_index "namespaces", ["name"], :name => "index_namespaces_on_name" |
| ... | ... | @@ -142,14 +143,14 @@ ActiveRecord::Schema.define(:version => 20130220133245) do |
| 142 | 143 | t.string "name" |
| 143 | 144 | t.string "path" |
| 144 | 145 | t.text "description" |
| 145 | - t.datetime "created_at", :null => false | |
| 146 | - t.datetime "updated_at", :null => false | |
| 146 | + t.datetime "created_at", :null => false | |
| 147 | + t.datetime "updated_at", :null => false | |
| 147 | 148 | t.integer "creator_id" |
| 148 | 149 | t.string "default_branch" |
| 149 | - t.boolean "issues_enabled", :default => true, :null => false | |
| 150 | - t.boolean "wall_enabled", :default => true, :null => false | |
| 151 | - t.boolean "merge_requests_enabled", :default => true, :null => false | |
| 152 | - t.boolean "wiki_enabled", :default => true, :null => false | |
| 150 | + t.boolean "issues_enabled", :default => true, :null => false | |
| 151 | + t.boolean "wall_enabled", :default => true, :null => false | |
| 152 | + t.boolean "merge_requests_enabled", :default => true, :null => false | |
| 153 | + t.boolean "wiki_enabled", :default => true, :null => false | |
| 153 | 154 | t.integer "namespace_id" |
| 154 | 155 | t.boolean "public", :default => false, :null => false |
| 155 | 156 | t.string "issues_tracker", :default => "gitlab", :null => false |
| ... | ... | @@ -232,8 +233,14 @@ ActiveRecord::Schema.define(:version => 20130220133245) do |
| 232 | 233 | t.string "name" |
| 233 | 234 | t.string "path" |
| 234 | 235 | t.integer "owner_id" |
| 236 | +<<<<<<< HEAD | |
| 235 | 237 | t.datetime "created_at", :null => false |
| 236 | 238 | t.datetime "updated_at", :null => false |
| 239 | +======= | |
| 240 | + t.datetime "created_at", :null => false | |
| 241 | + t.datetime "updated_at", :null => false | |
| 242 | + t.string "description", :default => "", :null => false | |
| 243 | +>>>>>>> 2f1f05d431d1df062e46365930b98b358554a07d | |
| 237 | 244 | end |
| 238 | 245 | |
| 239 | 246 | create_table "users", :force => true do |t| | ... | ... |
features/steps/admin/admin_groups.rb
| ... | ... | @@ -25,11 +25,13 @@ class AdminGroups < Spinach::FeatureSteps |
| 25 | 25 | |
| 26 | 26 | And 'submit form with new group info' do |
| 27 | 27 | fill_in 'group_name', :with => 'gitlab' |
| 28 | + fill_in 'group_description', :with => 'Group description' | |
| 28 | 29 | click_button "Create group" |
| 29 | 30 | end |
| 30 | 31 | |
| 31 | 32 | Then 'I should see newly created group' do |
| 32 | 33 | page.should have_content "Group: gitlab" |
| 34 | + page.should have_content "Group description" | |
| 33 | 35 | end |
| 34 | 36 | |
| 35 | 37 | Then 'I should be redirected to group page' do | ... | ... |
features/steps/admin/admin_teams.rb
| ... | ... | @@ -18,6 +18,7 @@ class AdminTeams < Spinach::FeatureSteps |
| 18 | 18 | |
| 19 | 19 | And 'submit form with new team info' do |
| 20 | 20 | fill_in 'user_team_name', with: 'gitlab' |
| 21 | + fill_in 'user_team_description', with: 'description' | |
| 21 | 22 | click_button 'Create team' |
| 22 | 23 | end |
| 23 | 24 | |
| ... | ... | @@ -27,6 +28,7 @@ class AdminTeams < Spinach::FeatureSteps |
| 27 | 28 | |
| 28 | 29 | And 'I should see newly created team' do |
| 29 | 30 | page.should have_content "Team: gitlab" |
| 31 | + page.should have_content "description" | |
| 30 | 32 | end |
| 31 | 33 | |
| 32 | 34 | When 'I visit admin teams page' do | ... | ... |
features/steps/group/group.rb
| ... | ... | @@ -69,12 +69,14 @@ class Groups < Spinach::FeatureSteps |
| 69 | 69 | end |
| 70 | 70 | |
| 71 | 71 | And 'submit form with new group info' do |
| 72 | - fill_in 'group_name', :with => 'Samurai' | |
| 72 | + fill_in 'group_name', with: 'Samurai' | |
| 73 | + fill_in 'group_description', with: 'Tokugawa Shogunate' | |
| 73 | 74 | click_button "Create group" |
| 74 | 75 | end |
| 75 | 76 | |
| 76 | 77 | Then 'I should see newly created group' do |
| 77 | 78 | page.should have_content "Samurai" |
| 79 | + page.should have_content "Tokugawa Shogunate" | |
| 78 | 80 | page.should have_content "You will only see events from projects in this group" |
| 79 | 81 | end |
| 80 | 82 | ... | ... |
features/steps/userteams/userteams.rb
| ... | ... | @@ -44,9 +44,16 @@ class Userteams < Spinach::FeatureSteps |
| 44 | 44 | |
| 45 | 45 | And 'I submit form with new team info' do |
| 46 | 46 | fill_in 'name', with: 'gitlab' |
| 47 | + | |
| 48 | + fill_in 'user_team_description', with: 'team description' | |
| 47 | 49 | click_button 'Create team' |
| 48 | 50 | end |
| 49 | 51 | |
| 52 | + And 'I should see newly created team' do | |
| 53 | + page.should have_content "gitlab" | |
| 54 | + page.should have_content "team description" | |
| 55 | + end | |
| 56 | + | |
| 50 | 57 | Then 'I should be redirected to new team page' do |
| 51 | 58 | team = UserTeam.last |
| 52 | 59 | current_path.should == team_path(team) | ... | ... |
features/teams/team.feature
| ... | ... | @@ -20,6 +20,7 @@ Feature: UserTeams |
| 20 | 20 | When I click to "New team" link |
| 21 | 21 | And I submit form with new team info |
| 22 | 22 | Then I should be redirected to new team page |
| 23 | + Then I should see newly created team | |
| 23 | 24 | |
| 24 | 25 | Scenario: I should see team dashboard list |
| 25 | 26 | When I have teams with projects and members | ... | ... |
spec/factories/user_teams.rb