From 5f657203a1c19b3eca38b3961dfe24e3a06af910 Mon Sep 17 00:00:00 2001 From: Andrew8xx8 Date: Thu, 7 Feb 2013 15:10:14 +0400 Subject: [PATCH] Description added to temas --- app/assets/stylesheets/application.scss | 1 + app/assets/stylesheets/sections/teams.scss | 31 +++++++++++++++++++ app/models/user_team.rb | 3 +- app/views/admin/teams/edit.html.haml | 9 ++++-- app/views/admin/teams/index.html.haml | 4 ++- app/views/admin/teams/new.html.haml | 11 +++++-- app/views/admin/teams/show.html.haml | 8 ++++- app/views/dashboard/_teams.html.haml | 16 +++++----- ...20130207104426_add_description_to_teams.rb | 5 +++ 9 files changed, 74 insertions(+), 14 deletions(-) create mode 100644 app/assets/stylesheets/sections/teams.scss create mode 100644 db/migrate/20130207104426_add_description_to_teams.rb diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 8afda88af46..25cef4324cc 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -21,6 +21,7 @@ @import "sections/commits.scss"; @import "sections/issues.scss"; @import "sections/groups.scss"; +@import "sections/teams.scss"; @import "sections/projects.scss"; @import "sections/snippets.scss"; @import "sections/votes.scss"; diff --git a/app/assets/stylesheets/sections/teams.scss b/app/assets/stylesheets/sections/teams.scss new file mode 100644 index 00000000000..b5c546ca5fa --- /dev/null +++ b/app/assets/stylesheets/sections/teams.scss @@ -0,0 +1,31 @@ +.projects { + @extend .row; + .activities { + } + + .side { + @extend .right; + + .teams_box { + > .title { + padding: 2px 15px; + } + .well-list { + li { padding: 15px; } + .edit { + float: right; + margin: 0; + } + .description { + padding-top: 5px; + display: block; + span, strong { + font-size: 12px; + color: #666; + } + } + } + @extend .ui-box; + } + } +} 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/teams/edit.html.haml b/app/views/admin/teams/edit.html.haml index 9282398ce5b..a48a369b3b9 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..a852b4cbbfa 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" -   - = 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 @@   = 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/dashboard/_teams.html.haml b/app/views/dashboard/_teams.html.haml index f56115856a7..76e9785ee2c 100644 --- a/app/views/dashboard/_teams.html.haml +++ b/app/views/dashboard/_teams.html.haml @@ -1,4 +1,4 @@ -.ui-box.teams-box +.ui-box.teams_box %h5.title Teams %small @@ -12,9 +12,11 @@ %li = link_to team_path(id: team.path), class: dom_class(team) do %strong.well-title= truncate(team.name, length: 35) - %span.pull-right.light - - if team.owner == current_user - %i.icon-wrench - - tm = current_user.user_team_user_relationships.find_by_user_team_id(team.id) - - if tm - = tm.access_human + %span.edit.light + - if team.owner == current_user + %i.icon-wrench + - tm = current_user.user_team_user_relationships.find_by_user_team_id(team.id) + - if tm + = tm.access_human + %span.description + %strong= team.description 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 -- GitLab