Commit 5f657203a1c19b3eca38b3961dfe24e3a06af910

Authored by Andrew8xx8
1 parent 9f45e01e

Description added to temas

app/assets/stylesheets/application.scss
@@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
21 @import "sections/commits.scss"; 21 @import "sections/commits.scss";
22 @import "sections/issues.scss"; 22 @import "sections/issues.scss";
23 @import "sections/groups.scss"; 23 @import "sections/groups.scss";
  24 +@import "sections/teams.scss";
24 @import "sections/projects.scss"; 25 @import "sections/projects.scss";
25 @import "sections/snippets.scss"; 26 @import "sections/snippets.scss";
26 @import "sections/votes.scss"; 27 @import "sections/votes.scss";
app/assets/stylesheets/sections/teams.scss 0 → 100644
@@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
  1 +.projects {
  2 + @extend .row;
  3 + .activities {
  4 + }
  5 +
  6 + .side {
  7 + @extend .right;
  8 +
  9 + .teams_box {
  10 + > .title {
  11 + padding: 2px 15px;
  12 + }
  13 + .well-list {
  14 + li { padding: 15px; }
  15 + .edit {
  16 + float: right;
  17 + margin: 0;
  18 + }
  19 + .description {
  20 + padding-top: 5px;
  21 + display: block;
  22 + span, strong {
  23 + font-size: 12px;
  24 + color: #666;
  25 + }
  26 + }
  27 + }
  28 + @extend .ui-box;
  29 + }
  30 + }
  31 +}
app/models/user_team.rb
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 # 11 #
12 12
13 class UserTeam < ActiveRecord::Base 13 class UserTeam < ActiveRecord::Base
14 - attr_accessible :name, :owner_id, :path 14 + attr_accessible :name, :description, :owner_id, :path
15 15
16 belongs_to :owner, class_name: User 16 belongs_to :owner, class_name: User
17 17
@@ -26,6 +26,7 @@ class UserTeam &lt; ActiveRecord::Base @@ -26,6 +26,7 @@ class UserTeam &lt; ActiveRecord::Base
26 length: { within: 0..255 }, 26 length: { within: 0..255 },
27 format: { with: Gitlab::Regex.name_regex, 27 format: { with: Gitlab::Regex.name_regex,
28 message: "only letters, digits, spaces & '_' '-' '.' allowed." } 28 message: "only letters, digits, spaces & '_' '-' '.' allowed." }
  29 + validates :description, length: { within: 0..255 }
29 validates :path, uniqueness: true, presence: true, length: { within: 1..255 }, 30 validates :path, uniqueness: true, presence: true, length: { within: 1..255 },
30 format: { with: Gitlab::Regex.path_regex, 31 format: { with: Gitlab::Regex.path_regex,
31 message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } 32 message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
app/views/admin/teams/edit.html.haml
1 -%h3.page_title Rename Team 1 +%h3.page_title Edit Team
2 %hr 2 %hr
3 = form_for @team, url: admin_team_path(@team), method: :put do |f| 3 = form_for @team, url: admin_team_path(@team), method: :put do |f|
4 - if @team.errors.any? 4 - if @team.errors.any?
@@ -10,6 +10,11 @@ @@ -10,6 +10,11 @@
10 .input 10 .input
11 = f.text_field :name, placeholder: "Example Team", class: "xxlarge" 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 .clearfix.team_name_holder 18 .clearfix.team_name_holder
14 = f.label :path do 19 = f.label :path do
15 %span.cred Team path is 20 %span.cred Team path is
@@ -19,5 +24,5 @@ @@ -19,5 +24,5 @@
19 %li It will change web url for access team and team projects. 24 %li It will change web url for access team and team projects.
20 25
21 .form-actions 26 .form-actions
22 - = f.submit 'Rename team', class: "btn btn-remove" 27 + = f.submit 'Edit team', class: "btn btn-remove"
23 = link_to 'Cancel', admin_teams_path, class: "btn btn-cancel" 28 = link_to 'Cancel', admin_teams_path, class: "btn btn-cancel"
app/views/admin/teams/index.html.haml
@@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
16 %th 16 %th
17 Name 17 Name
18 %i.icon-sort-down 18 %i.icon-sort-down
  19 + %th Description
19 %th Path 20 %th Path
20 %th Projects 21 %th Projects
21 %th Members 22 %th Members
@@ -26,13 +27,14 @@ @@ -26,13 +27,14 @@
26 %tr 27 %tr
27 %td 28 %td
28 %strong= link_to team.name, admin_team_path(team) 29 %strong= link_to team.name, admin_team_path(team)
  30 + %td= team.description
29 %td= team.path 31 %td= team.path
30 %td= team.projects.count 32 %td= team.projects.count
31 %td= team.members.count 33 %td= team.members.count
32 %td 34 %td
33 = link_to team.owner.name, admin_user_path(team.owner) 35 = link_to team.owner.name, admin_user_path(team.owner)
34 %td.bgred 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 = link_to 'Destroy', admin_team_path(team), confirm: "REMOVE #{team.name}? Are you sure?", method: :delete, class: "btn btn-small btn-remove" 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 = paginate @teams, theme: "admin" 40 = paginate @teams, theme: "admin"
app/views/admin/teams/new.html.haml
@@ -9,8 +9,15 @@ @@ -9,8 +9,15 @@
9 Team name is 9 Team name is
10 .input 10 .input
11 = f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left" 11 = f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left"
12 - &nbsp;  
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 %hr 21 %hr
15 .padded 22 .padded
16 %ul 23 %ul
app/views/admin/teams/show.html.haml
@@ -16,7 +16,13 @@ @@ -16,7 +16,13 @@
16 &nbsp; 16 &nbsp;
17 = link_to edit_admin_team_path(@team), class: "btn btn-small pull-right" do 17 = link_to edit_admin_team_path(@team), class: "btn btn-small pull-right" do
18 %i.icon-edit 18 %i.icon-edit
19 - Rename 19 + Edit
  20 + %tr
  21 + %td
  22 + %b
  23 + Description:
  24 + %td
  25 + = @team.description
20 %tr 26 %tr
21 %td 27 %td
22 %b 28 %b
app/views/dashboard/_teams.html.haml
1 -.ui-box.teams-box 1 +.ui-box.teams_box
2 %h5.title 2 %h5.title
3 Teams 3 Teams
4 %small 4 %small
@@ -12,9 +12,11 @@ @@ -12,9 +12,11 @@
12 %li 12 %li
13 = link_to team_path(id: team.path), class: dom_class(team) do 13 = link_to team_path(id: team.path), class: dom_class(team) do
14 %strong.well-title= truncate(team.name, length: 35) 14 %strong.well-title= truncate(team.name, length: 35)
15 - %span.pull-right.light  
16 - - if team.owner == current_user  
17 - %i.icon-wrench  
18 - - tm = current_user.user_team_user_relationships.find_by_user_team_id(team.id)  
19 - - if tm  
20 - = tm.access_human 15 + %span.edit.light
  16 + - if team.owner == current_user
  17 + %i.icon-wrench
  18 + - tm = current_user.user_team_user_relationships.find_by_user_team_id(team.id)
  19 + - if tm
  20 + = tm.access_human
  21 + %span.description
  22 + %strong= team.description
db/migrate/20130207104426_add_description_to_teams.rb 0 → 100644
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
  1 +class AddDescriptionToTeams < ActiveRecord::Migration
  2 + def change
  3 + add_column :user_teams, :description, :string, default: '', null: false
  4 + end
  5 +end