Commit 1cfc2b6fc7e49f8281a055b340509863c7706ada
Exists in
master
and in
4 other branches
Merge branch 'Undev-team-and-group-descriptions'
Showing
27 changed files
with
149 additions
and
48 deletions
Show diff stats
app/assets/stylesheets/gitlab_bootstrap/common.scss
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,9 +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" | |
14 | - %hr | |
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-create" | |
20 | + | |
21 | + | |
15 | 22 | .padded |
16 | 23 | %ul |
17 | 24 | %li Group is kind of directory for several projects | ... | ... |
app/views/groups/show.html.haml
... | ... | @@ -12,6 +12,9 @@ |
12 | 12 | %p.nothing_here_message Project activity will be displayed here |
13 | 13 | .loading.hide |
14 | 14 | .side.span4 |
15 | + - if @group.description.present? | |
16 | + .description.well.light | |
17 | + = @group.description | |
15 | 18 | = render "projects", projects: @projects |
16 | 19 | %div |
17 | 20 | %span.rss-icon | ... | ... |
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,9 +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" | |
14 | - %hr | |
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 | + | |
15 | 21 | .padded |
16 | 22 | %ul |
17 | 23 | %li All created teams are public (users can view who enter into team and which project are assigned for this team) | ... | ... |
app/views/teams/show.html.haml
... | ... | @@ -11,6 +11,9 @@ |
11 | 11 | %p.nothing_here_message Projects activity will be displayed here |
12 | 12 | .loading.hide |
13 | 13 | .side.span4 |
14 | + - if @team.description.present? | |
15 | + .description.well.light | |
16 | + = @team.description | |
14 | 17 | = render "projects", projects: @projects |
15 | 18 | %div |
16 | 19 | %span.rss-icon | ... | ... |
db/migrate/20130206084024_add_description_to_namsespace.rb
0 → 100644
db/schema.rb
... | ... | @@ -106,12 +106,13 @@ ActiveRecord::Schema.define(:version => 20130220133245) do |
106 | 106 | add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id" |
107 | 107 | |
108 | 108 | create_table "namespaces", :force => true do |t| |
109 | - t.string "name", :null => false | |
110 | - t.string "path", :null => false | |
111 | - t.integer "owner_id", :null => false | |
112 | - t.datetime "created_at", :null => false | |
113 | - t.datetime "updated_at", :null => false | |
109 | + t.string "name", :null => false | |
110 | + t.string "path", :null => false | |
111 | + t.integer "owner_id", :null => false | |
112 | + t.datetime "created_at", :null => false | |
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" |
... | ... | @@ -232,8 +233,9 @@ ActiveRecord::Schema.define(:version => 20130220133245) do |
232 | 233 | t.string "name" |
233 | 234 | t.string "path" |
234 | 235 | t.integer "owner_id" |
235 | - t.datetime "created_at", :null => false | |
236 | - t.datetime "updated_at", :null => false | |
236 | + t.datetime "created_at", :null => false | |
237 | + t.datetime "updated_at", :null => false | |
238 | + t.string "description", :default => "", :null => false | |
237 | 239 | end |
238 | 240 | |
239 | 241 | 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