summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-03-01 16:05:51 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-03-01 16:05:51 +0200
commit5c3cb47c16cacd8e9056f2a68978d69bc153a0f8 (patch)
tree39204ec0a55c20310d1a92c5958ef7522ac86135
parenta73e58f70b264b36b3291bba9a8a2789235ccadb (diff)
parent2f1f05d431d1df062e46365930b98b358554a07d (diff)
downloadgitlab-ce-5c3cb47c16cacd8e9056f2a68978d69bc153a0f8.tar.gz
Merge branch 'team-and-group-descriptions' of https://github.com/Undev/gitlabhq into Undev-team-and-group-descriptions
Conflicts: db/schema.rb
-rw-r--r--app/models/group.rb15
-rw-r--r--app/models/namespace.rb19
-rw-r--r--app/models/user_team.rb3
-rw-r--r--app/views/admin/groups/edit.html.haml9
-rw-r--r--app/views/admin/groups/index.html.haml4
-rw-r--r--app/views/admin/groups/new.html.haml10
-rw-r--r--app/views/admin/groups/show.html.haml8
-rw-r--r--app/views/admin/teams/edit.html.haml9
-rw-r--r--app/views/admin/teams/index.html.haml4
-rw-r--r--app/views/admin/teams/new.html.haml11
-rw-r--r--app/views/admin/teams/show.html.haml8
-rw-r--r--app/views/groups/edit.html.haml11
-rw-r--r--app/views/groups/new.html.haml12
-rw-r--r--app/views/groups/show.html.haml5
-rw-r--r--app/views/teams/edit.html.haml10
-rw-r--r--app/views/teams/new.html.haml11
-rw-r--r--app/views/teams/show.html.haml5
-rw-r--r--db/migrate/20130206084024_add_description_to_namsespace.rb5
-rw-r--r--db/migrate/20130207104426_add_description_to_teams.rb5
-rw-r--r--db/schema.rb19
-rw-r--r--features/steps/admin/admin_groups.rb2
-rw-r--r--features/steps/admin/admin_teams.rb2
-rw-r--r--features/steps/group/group.rb4
-rw-r--r--features/steps/userteams/userteams.rb7
-rw-r--r--features/teams/team.feature1
-rw-r--r--spec/factories/user_teams.rb1
26 files changed, 155 insertions, 45 deletions
diff --git a/app/models/group.rb b/app/models/group.rb
index 8ba92980a9b..7651ce23cb6 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -2,13 +2,14 @@
#
# Table name: namespaces
#
-# id :integer not null, primary key
-# name :string(255) not null
-# path :string(255) not null
-# owner_id :integer not null
-# created_at :datetime not null
-# updated_at :datetime not null
-# type :string(255)
+# id :integer not null, primary key
+# name :string(255) not null
+# description :string(255) not null
+# path :string(255) not null
+# owner_id :integer not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# type :string(255)
#
class Group < Namespace
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 385fa291b48..c6b3e94d05d 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -2,17 +2,18 @@
#
# Table name: namespaces
#
-# id :integer not null, primary key
-# name :string(255) not null
-# path :string(255) not null
-# owner_id :integer not null
-# created_at :datetime not null
-# updated_at :datetime not null
-# type :string(255)
+# id :integer not null, primary key
+# name :string(255) not null
+# description :string(255) not null
+# path :string(255) not null
+# owner_id :integer not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# type :string(255)
#
class Namespace < ActiveRecord::Base
- attr_accessible :name, :path
+ attr_accessible :name, :description, :path
has_many :projects, dependent: :destroy
belongs_to :owner, class_name: "User"
@@ -22,7 +23,7 @@ class Namespace < ActiveRecord::Base
length: { within: 0..255 },
format: { with: Gitlab::Regex.name_regex,
message: "only letters, digits, spaces & '_' '-' '.' allowed." }
-
+ validates :description, length: { within: 0..255 }
validates :path, uniqueness: true, presence: true, length: { within: 1..255 },
format: { with: Gitlab::Regex.path_regex,
message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
diff --git a/app/models/user_team.rb b/app/models/user_team.rb
index 2f3091c2353..0cb84edd66d 100644
--- a/app/models/user_team.rb
+++ b/app/models/user_team.rb
@@ -11,7 +11,7 @@
#
class UserTeam < ActiveRecord::Base
- attr_accessible :name, :owner_id, :path
+ attr_accessible :name, :description, :owner_id, :path
belongs_to :owner, class_name: User
@@ -26,6 +26,7 @@ class UserTeam < ActiveRecord::Base
length: { within: 0..255 },
format: { with: Gitlab::Regex.name_regex,
message: "only letters, digits, spaces & '_' '-' '.' allowed." }
+ validates :description, length: { within: 0..255 }
validates :path, uniqueness: true, presence: true, length: { within: 1..255 },
format: { with: Gitlab::Regex.path_regex,
message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
diff --git a/app/views/admin/groups/edit.html.haml b/app/views/admin/groups/edit.html.haml
index dce044956c3..bb1398f66cd 100644
--- a/app/views/admin/groups/edit.html.haml
+++ b/app/views/admin/groups/edit.html.haml
@@ -1,4 +1,4 @@
-%h3.page_title Rename Group
+%h3.page_title Edit Group
%hr
= form_for [:admin, @group] do |f|
- if @group.errors.any?
@@ -10,7 +10,10 @@
.input
= f.text_field :name, placeholder: "Example Group", class: "xxlarge"
-
+ .clearfix.group-description-holder
+ = f.label :description, "Details"
+ .input
+ = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4
.clearfix.group_name_holder
= f.label :path do
@@ -24,5 +27,5 @@
%li It will change the git path to repositories under this group.
.form-actions
- = f.submit 'Rename group', class: "btn btn-remove"
+ = f.submit 'Edit group', class: "btn btn-remove"
= link_to 'Cancel', admin_groups_path, class: "btn btn-cancel"
diff --git a/app/views/admin/groups/index.html.haml b/app/views/admin/groups/index.html.haml
index 6d5a293ef7f..1b4ffcb6e02 100644
--- a/app/views/admin/groups/index.html.haml
+++ b/app/views/admin/groups/index.html.haml
@@ -17,6 +17,7 @@
Name
%i.icon-sort-down
%th Path
+ %th Description
%th Projects
%th Owner
%th.cred Danger Zone!
@@ -25,11 +26,12 @@
%tr
%td
%strong= link_to group.name, [:admin, group]
+ %td= group.description
%td= group.path
%td= group.projects.count
%td
= link_to group.owner_name, admin_user_path(group.owner)
%td.bgred
- = link_to 'Rename', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn btn-small"
+ = link_to 'Edit', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: "btn btn-small"
= link_to 'Destroy', [:admin, group], confirm: "REMOVE #{group.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove"
= paginate @groups, theme: "admin"
diff --git a/app/views/admin/groups/new.html.haml b/app/views/admin/groups/new.html.haml
index 60c6fa5ad09..3fa63e1ba25 100644
--- a/app/views/admin/groups/new.html.haml
+++ b/app/views/admin/groups/new.html.haml
@@ -9,8 +9,14 @@
Group name is
.input
= f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left"
- &nbsp;
- = f.submit 'Create group', class: "btn btn-primary"
+ .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 'Create group', class: "btn btn-primary"
+
%hr
.padded
%ul
diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml
index 90f8fc0f814..63ea78fdd99 100644
--- a/app/views/admin/groups/show.html.haml
+++ b/app/views/admin/groups/show.html.haml
@@ -16,7 +16,13 @@
&nbsp;
= link_to edit_admin_group_path(@group), class: "btn btn-small pull-right" do
%i.icon-edit
- Rename
+ Edit
+ %tr
+ %td
+ %b
+ Description:
+ %td
+ = @group.description
%tr
%td
%b
diff --git a/app/views/admin/teams/edit.html.haml b/app/views/admin/teams/edit.html.haml
index 9282398ce5b..0a3d993b132 100644
--- a/app/views/admin/teams/edit.html.haml
+++ b/app/views/admin/teams/edit.html.haml
@@ -1,4 +1,4 @@
-%h3.page_title Rename Team
+%h3.page_title Edit Team
%hr
= form_for @team, url: admin_team_path(@team), method: :put do |f|
- if @team.errors.any?
@@ -10,6 +10,11 @@
.input
= f.text_field :name, placeholder: "Example Team", class: "xxlarge"
+ .clearfix.team-description-holder
+ = f.label :description, "Details"
+ .input
+ = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4
+
.clearfix.team_name_holder
= f.label :path do
%span.cred Team path is
@@ -19,5 +24,5 @@
%li It will change web url for access team and team projects.
.form-actions
- = f.submit 'Rename team', class: "btn btn-remove"
+ = f.submit 'Edit team', class: "btn btn-remove"
= link_to 'Cancel', admin_teams_path, class: "btn btn-cancel"
diff --git a/app/views/admin/teams/index.html.haml b/app/views/admin/teams/index.html.haml
index bb0487d43e9..62af4b50936 100644
--- a/app/views/admin/teams/index.html.haml
+++ b/app/views/admin/teams/index.html.haml
@@ -16,6 +16,7 @@
%th
Name
%i.icon-sort-down
+ %th Description
%th Path
%th Projects
%th Members
@@ -26,13 +27,14 @@
%tr
%td
%strong= link_to team.name, admin_team_path(team)
+ %td= team.description
%td= team.path
%td= team.projects.count
%td= team.members.count
%td
= link_to team.owner.name, admin_user_path(team.owner)
%td.bgred
- = link_to 'Rename', edit_admin_team_path(team), id: "edit_#{dom_id(team)}", class: "btn btn-small"
+ = link_to 'Edit', edit_admin_team_path(team), id: "edit_#{dom_id(team)}", class: "btn btn-small"
= link_to 'Destroy', admin_team_path(team), confirm: "REMOVE #{team.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove"
= paginate @teams, theme: "admin"
diff --git a/app/views/admin/teams/new.html.haml b/app/views/admin/teams/new.html.haml
index 5d55a7975ee..1c90cb20c10 100644
--- a/app/views/admin/teams/new.html.haml
+++ b/app/views/admin/teams/new.html.haml
@@ -9,8 +9,15 @@
Team name is
.input
= f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left"
- &nbsp;
- = f.submit 'Create team', class: "btn btn-primary"
+
+ .clearfix.team-description-holder
+ = f.label :description, "Details"
+ .input
+ = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4
+
+ .form-actions
+ = f.submit 'Create team', class: "btn btn-primary"
+
%hr
.padded
%ul
diff --git a/app/views/admin/teams/show.html.haml b/app/views/admin/teams/show.html.haml
index e5d079981c0..abdfada8c5e 100644
--- a/app/views/admin/teams/show.html.haml
+++ b/app/views/admin/teams/show.html.haml
@@ -16,7 +16,13 @@
&nbsp;
= link_to edit_admin_team_path(@team), class: "btn btn-small pull-right" do
%i.icon-edit
- Rename
+ Edit
+ %tr
+ %td
+ %b
+ Description:
+ %td
+ = @team.description
%tr
%td
%b
diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml
index 41ebf60698b..bf16b70c7f1 100644
--- a/app/views/groups/edit.html.haml
+++ b/app/views/groups/edit.html.haml
@@ -9,8 +9,15 @@
Group name is
.input
= f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left"
- &nbsp;
- = f.submit 'Save group', class: "btn btn-save"
+
+ .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
diff --git a/app/views/groups/new.html.haml b/app/views/groups/new.html.haml
index 73be474e278..2104db8684b 100644
--- a/app/views/groups/new.html.haml
+++ b/app/views/groups/new.html.haml
@@ -9,8 +9,16 @@
Group name is
.input
= f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left"
- &nbsp;
- = f.submit 'Create group', class: "btn btn-create"
+
+ .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 'Create group', class: "btn btn-primary"
+
+
%hr
.padded
%ul
diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml
index a140b401b9d..fe08e0b551a 100644
--- a/app/views/groups/show.html.haml
+++ b/app/views/groups/show.html.haml
@@ -1,3 +1,8 @@
+- if @group.description.present?
+ .description
+ = @group.description
+ %hr
+
.projects
.activities.span8
= render "events/event_last_push", event: @last_push
diff --git a/app/views/teams/edit.html.haml b/app/views/teams/edit.html.haml
index 751fe94c654..5491993d5f4 100644
--- a/app/views/teams/edit.html.haml
+++ b/app/views/teams/edit.html.haml
@@ -12,13 +12,20 @@
.input
= f.text_field :name, placeholder: "Ex. OpenSource", class: "xlarge left"
+ .clearfix.team-description-holder
+ = f.label :description, "Details"
+ .input
+ = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4
+
.clearfix
= f.label :path do
Team path is
.input
= f.text_field :path, placeholder: "opensource", class: "xlarge left"
+
.form-actions
- = f.submit 'Save team changes', class: "btn btn-save"
+ = f.submit 'Save team changes', class: "btn btn-primary"
+ = link_to 'Delete team', team_path(@team), method: :delete, confirm: "You are shure?", class: "btn btn-remove pull-right"
.span5
.ui-box
%h5.title Remove team
@@ -26,4 +33,3 @@
%p
Removed team can not be restored!
= link_to 'Remove team', team_path(@team), method: :delete, confirm: "You are sure?", class: "btn btn-remove btn-small"
-
diff --git a/app/views/teams/new.html.haml b/app/views/teams/new.html.haml
index 7089f791558..332a6a558d8 100644
--- a/app/views/teams/new.html.haml
+++ b/app/views/teams/new.html.haml
@@ -9,8 +9,15 @@
Team name is
.input
= f.text_field :name, placeholder: "Ex. Ruby Developers", class: "xxlarge left"
- &nbsp;
- = f.submit 'Create team', class: "btn btn-create"
+
+ .clearfix.team-description-holder
+ = f.label :description, "Details"
+ .input
+ = f.text_area :description, maxlength: 250, class: "xxlarge js-gfm-input", rows: 4
+
+ .form-actions
+ = f.submit 'Create team', class: "btn btn-create"
+
%hr
.padded
%ul
diff --git a/app/views/teams/show.html.haml b/app/views/teams/show.html.haml
index d6e80e2a51e..34be7692416 100644
--- a/app/views/teams/show.html.haml
+++ b/app/views/teams/show.html.haml
@@ -1,3 +1,8 @@
+- if @team.description.present?
+ .description
+ = @team.description
+ %hr
+
.projects
.activities.span8
= link_to dashboard_path, class: 'btn btn-tiny' do
diff --git a/db/migrate/20130206084024_add_description_to_namsespace.rb b/db/migrate/20130206084024_add_description_to_namsespace.rb
new file mode 100644
index 00000000000..ef02e489d03
--- /dev/null
+++ b/db/migrate/20130206084024_add_description_to_namsespace.rb
@@ -0,0 +1,5 @@
+class AddDescriptionToNamsespace < ActiveRecord::Migration
+ def change
+ add_column :namespaces, :description, :string, default: '', null: false
+ end
+end
diff --git a/db/migrate/20130207104426_add_description_to_teams.rb b/db/migrate/20130207104426_add_description_to_teams.rb
new file mode 100644
index 00000000000..6d03777901c
--- /dev/null
+++ b/db/migrate/20130207104426_add_description_to_teams.rb
@@ -0,0 +1,5 @@
+class AddDescriptionToTeams < ActiveRecord::Migration
+ def change
+ add_column :user_teams, :description, :string, default: '', null: false
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e9d428e5ef5..3eb3a7dceec 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -112,6 +112,7 @@ ActiveRecord::Schema.define(:version => 20130220133245) do
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "type"
+ t.string "description", :default => "", :null => false
end
add_index "namespaces", ["name"], :name => "index_namespaces_on_name"
@@ -142,14 +143,14 @@ ActiveRecord::Schema.define(:version => 20130220133245) do
t.string "name"
t.string "path"
t.text "description"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.integer "creator_id"
t.string "default_branch"
- t.boolean "issues_enabled", :default => true, :null => false
- t.boolean "wall_enabled", :default => true, :null => false
- t.boolean "merge_requests_enabled", :default => true, :null => false
- t.boolean "wiki_enabled", :default => true, :null => false
+ t.boolean "issues_enabled", :default => true, :null => false
+ t.boolean "wall_enabled", :default => true, :null => false
+ t.boolean "merge_requests_enabled", :default => true, :null => false
+ t.boolean "wiki_enabled", :default => true, :null => false
t.integer "namespace_id"
t.boolean "public", :default => false, :null => false
t.string "issues_tracker", :default => "gitlab", :null => false
@@ -232,8 +233,14 @@ ActiveRecord::Schema.define(:version => 20130220133245) do
t.string "name"
t.string "path"
t.integer "owner_id"
+<<<<<<< HEAD
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
+=======
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "description", :default => "", :null => false
+>>>>>>> 2f1f05d431d1df062e46365930b98b358554a07d
end
create_table "users", :force => true do |t|
diff --git a/features/steps/admin/admin_groups.rb b/features/steps/admin/admin_groups.rb
index cbca2daa701..167763b6912 100644
--- a/features/steps/admin/admin_groups.rb
+++ b/features/steps/admin/admin_groups.rb
@@ -25,11 +25,13 @@ class AdminGroups < Spinach::FeatureSteps
And 'submit form with new group info' do
fill_in 'group_name', :with => 'gitlab'
+ fill_in 'group_description', :with => 'Group description'
click_button "Create group"
end
Then 'I should see newly created group' do
page.should have_content "Group: gitlab"
+ page.should have_content "Group description"
end
Then 'I should be redirected to group page' do
diff --git a/features/steps/admin/admin_teams.rb b/features/steps/admin/admin_teams.rb
index 637fc4e58f3..6423f3dfd9b 100644
--- a/features/steps/admin/admin_teams.rb
+++ b/features/steps/admin/admin_teams.rb
@@ -18,6 +18,7 @@ class AdminTeams < Spinach::FeatureSteps
And 'submit form with new team info' do
fill_in 'user_team_name', with: 'gitlab'
+ fill_in 'user_team_description', with: 'description'
click_button 'Create team'
end
@@ -27,6 +28,7 @@ class AdminTeams < Spinach::FeatureSteps
And 'I should see newly created team' do
page.should have_content "Team: gitlab"
+ page.should have_content "description"
end
When 'I visit admin teams page' do
diff --git a/features/steps/group/group.rb b/features/steps/group/group.rb
index 81f1aefbd52..5ac958e3fc2 100644
--- a/features/steps/group/group.rb
+++ b/features/steps/group/group.rb
@@ -69,12 +69,14 @@ class Groups < Spinach::FeatureSteps
end
And 'submit form with new group info' do
- fill_in 'group_name', :with => 'Samurai'
+ fill_in 'group_name', with: 'Samurai'
+ fill_in 'group_description', with: 'Tokugawa Shogunate'
click_button "Create group"
end
Then 'I should see newly created group' do
page.should have_content "Samurai"
+ page.should have_content "Tokugawa Shogunate"
page.should have_content "You will only see events from projects in this group"
end
diff --git a/features/steps/userteams/userteams.rb b/features/steps/userteams/userteams.rb
index 1abb0f49122..862259dcb4e 100644
--- a/features/steps/userteams/userteams.rb
+++ b/features/steps/userteams/userteams.rb
@@ -44,9 +44,16 @@ class Userteams < Spinach::FeatureSteps
And 'I submit form with new team info' do
fill_in 'name', with: 'gitlab'
+
+ fill_in 'user_team_description', with: 'team description'
click_button 'Create team'
end
+ And 'I should see newly created team' do
+ page.should have_content "gitlab"
+ page.should have_content "team description"
+ end
+
Then 'I should be redirected to new team page' do
team = UserTeam.last
current_path.should == team_path(team)
diff --git a/features/teams/team.feature b/features/teams/team.feature
index 9255e0daadb..f7774597dc3 100644
--- a/features/teams/team.feature
+++ b/features/teams/team.feature
@@ -20,6 +20,7 @@ Feature: UserTeams
When I click to "New team" link
And I submit form with new team info
Then I should be redirected to new team page
+ Then I should see newly created team
Scenario: I should see team dashboard list
When I have teams with projects and members
diff --git a/spec/factories/user_teams.rb b/spec/factories/user_teams.rb
index 1a9ae8e885c..8d1ee11ee75 100644
--- a/spec/factories/user_teams.rb
+++ b/spec/factories/user_teams.rb
@@ -15,6 +15,7 @@
FactoryGirl.define do
factory :user_team do
sequence(:name) { |n| "team#{n}" }
+ sequence(:description) { |n| "team_description#{n}" }
path { name.downcase.gsub(/\s/, '_') }
owner
end