Commit 68a317808f90c0e5685dfd91abf5604f5012ab01
Exists in
master
and in
4 other branches
Merge branch 'feature/project_labels' of /home/git/repositories/gitlab/gitlabhq
Showing
6 changed files
with
39 additions
and
1 deletions
Show diff stats
app/assets/stylesheets/gitlab_bootstrap/lists.scss
app/controllers/dashboard_controller.rb
... | ... | @@ -34,6 +34,7 @@ class DashboardController < ApplicationController |
34 | 34 | @projects |
35 | 35 | end |
36 | 36 | |
37 | + @projects = @projects.tagged_with(params[:label]) if params[:label].present? | |
37 | 38 | @projects = @projects.search(params[:search]) if params[:search].present? |
38 | 39 | @projects = @projects.page(params[:page]).per(30) |
39 | 40 | end | ... | ... |
app/helpers/projects_helper.rb
... | ... | @@ -3,6 +3,10 @@ module ProjectsHelper |
3 | 3 | "You are going to remove #{user.name} from #{project.name} project team. Are you sure?" |
4 | 4 | end |
5 | 5 | |
6 | + def projects_labels | |
7 | + Project.tag_counts_on(:labels).map(&:name) | |
8 | + end | |
9 | + | |
6 | 10 | def link_to_project project |
7 | 11 | link_to project do |
8 | 12 | title = content_tag(:strong, project.name) | ... | ... |
app/models/project.rb
... | ... | @@ -28,12 +28,14 @@ class Project < ActiveRecord::Base |
28 | 28 | include Gitlab::ShellAdapter |
29 | 29 | extend Enumerize |
30 | 30 | |
31 | - attr_accessible :name, :path, :description, :default_branch, :issues_tracker, | |
31 | + attr_accessible :name, :path, :description, :default_branch, :issues_tracker, :label_list, | |
32 | 32 | :issues_enabled, :wall_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id, |
33 | 33 | :wiki_enabled, :public, :import_url, :last_activity_at, as: [:default, :admin] |
34 | 34 | |
35 | 35 | attr_accessible :namespace_id, :creator_id, as: :admin |
36 | 36 | |
37 | + acts_as_taggable_on :labels | |
38 | + | |
37 | 39 | attr_accessor :import_url |
38 | 40 | |
39 | 41 | # Relations | ... | ... |
app/views/dashboard/projects.html.haml
... | ... | @@ -20,6 +20,15 @@ |
20 | 20 | = nav_tab :scope, 'joined' do |
21 | 21 | = link_to "Joined", projects_dashboard_path(scope: 'joined') |
22 | 22 | |
23 | + %p.light Filter by label: | |
24 | + %ul.bordered-list | |
25 | + - projects_labels.each do |label| | |
26 | + %li{ class: (label == params[:label]) ? 'active' : 'light' } | |
27 | + = link_to projects_dashboard_path(scope: params[:scope], label: label) do | |
28 | + %i.icon-tag | |
29 | + = label | |
30 | + | |
31 | + | |
23 | 32 | .span9 |
24 | 33 | = form_tag projects_dashboard_path, method: 'get' do |
25 | 34 | %fieldset.dashboard-search-filter |
... | ... | @@ -49,6 +58,10 @@ |
49 | 58 | .left |
50 | 59 | - if project.description.present? |
51 | 60 | %span.light= project.description |
61 | + - project.labels.each do |label| | |
62 | + %span.label.label-info | |
63 | + %i.icon-tag | |
64 | + = label.name | |
52 | 65 | |
53 | 66 | .pull-right.light |
54 | 67 | %small.light | ... | ... |
app/views/projects/_form.html.haml
... | ... | @@ -59,6 +59,15 @@ |
59 | 59 | |
60 | 60 | %fieldset.features |
61 | 61 | %legend |
62 | + Labels: | |
63 | + .control-group | |
64 | + = f.label :label_list, "Labels", class: 'control-label' | |
65 | + .controls | |
66 | + = f.text_field :label_list, maxlength: 2000, class: "xxlarge" | |
67 | + %p.hint Separate with comma. | |
68 | + | |
69 | + %fieldset.features | |
70 | + %legend | |
62 | 71 | Features: |
63 | 72 | .control-group |
64 | 73 | = f.label :issues_enabled, "Issues", class: 'control-label' | ... | ... |