diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-16 16:21:50 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-16 16:21:50 +0400 |
commit | 68a317808f90c0e5685dfd91abf5604f5012ab01 (patch) | |
tree | 31e18d14c073f99e57021fbf58c84878e396f858 /app | |
parent | 880cb8aa487a78c22bedb26b3cfd0e1d8590a932 (diff) | |
parent | 133d78229ec092cb5360d600b62286c7320869ff (diff) |
Merge branch 'feature/project_labels' of /home/git/repositories/gitlab/gitlabhq
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/gitlab_bootstrap/lists.scss | 9 | ||||
-rw-r--r-- | app/controllers/dashboard_controller.rb | 1 | ||||
-rw-r--r-- | app/helpers/projects_helper.rb | 4 | ||||
-rw-r--r-- | app/models/project.rb | 4 | ||||
-rw-r--r-- | app/views/dashboard/projects.html.haml | 13 | ||||
-rw-r--r-- | app/views/projects/_form.html.haml | 9 |
6 files changed, 39 insertions, 1 deletions
diff --git a/app/assets/stylesheets/gitlab_bootstrap/lists.scss b/app/assets/stylesheets/gitlab_bootstrap/lists.scss index 0f893a553ee..e661e02623e 100644 --- a/app/assets/stylesheets/gitlab_bootstrap/lists.scss +++ b/app/assets/stylesheets/gitlab_bootstrap/lists.scss @@ -69,5 +69,14 @@ ul.bordered-list { display: block; margin: 0px; &:last-child { border:none } + + &.active { + background: #f9f9f9; + a { font-weight: bold; } + } + + &.light { + a { color: #777; } + } } } diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 91a67985710..f651b02c1e5 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -34,6 +34,7 @@ class DashboardController < ApplicationController @projects end + @projects = @projects.tagged_with(params[:label]) if params[:label].present? @projects = @projects.search(params[:search]) if params[:search].present? @projects = @projects.page(params[:page]).per(30) end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 1db8b7c689c..9e7c4ee245a 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -3,6 +3,10 @@ module ProjectsHelper "You are going to remove #{user.name} from #{project.name} project team. Are you sure?" end + def projects_labels + Project.tag_counts_on(:labels).map(&:name) + end + def link_to_project project link_to project do title = content_tag(:strong, project.name) diff --git a/app/models/project.rb b/app/models/project.rb index cad8f1666d3..e811cbe7f41 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -28,12 +28,14 @@ class Project < ActiveRecord::Base include Gitlab::ShellAdapter extend Enumerize - attr_accessible :name, :path, :description, :default_branch, :issues_tracker, + attr_accessible :name, :path, :description, :default_branch, :issues_tracker, :label_list, :issues_enabled, :wall_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id, :wiki_enabled, :public, :import_url, :last_activity_at, as: [:default, :admin] attr_accessible :namespace_id, :creator_id, as: :admin + acts_as_taggable_on :labels + attr_accessor :import_url # Relations diff --git a/app/views/dashboard/projects.html.haml b/app/views/dashboard/projects.html.haml index f81af59b38f..511366cf1ab 100644 --- a/app/views/dashboard/projects.html.haml +++ b/app/views/dashboard/projects.html.haml @@ -20,6 +20,15 @@ = nav_tab :scope, 'joined' do = link_to "Joined", projects_dashboard_path(scope: 'joined') + %p.light Filter by label: + %ul.bordered-list + - projects_labels.each do |label| + %li{ class: (label == params[:label]) ? 'active' : 'light' } + = link_to projects_dashboard_path(scope: params[:scope], label: label) do + %i.icon-tag + = label + + .span9 = form_tag projects_dashboard_path, method: 'get' do %fieldset.dashboard-search-filter @@ -49,6 +58,10 @@ .left - if project.description.present? %span.light= project.description + - project.labels.each do |label| + %span.label.label-info + %i.icon-tag + = label.name .pull-right.light %small.light diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml index 4d51e10dc3e..eb5fa1755b4 100644 --- a/app/views/projects/_form.html.haml +++ b/app/views/projects/_form.html.haml @@ -59,6 +59,15 @@ %fieldset.features %legend + Labels: + .control-group + = f.label :label_list, "Labels", class: 'control-label' + .controls + = f.text_field :label_list, maxlength: 2000, class: "xxlarge" + %p.hint Separate with comma. + + %fieldset.features + %legend Features: .control-group = f.label :issues_enabled, "Issues", class: 'control-label' |