Commit edf41005b2c6cf3d429b8ca10f41fe64306b044a

Authored by Dmitriy Zaporozhets
1 parent 880cb8aa

Add project labels support

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
... ... @@ -49,6 +49,10 @@
49 49 .left
50 50 - if project.description.present?
51 51 %span.light= project.description
  52 + - project.labels.each do |label|
  53 + %span.label.label-info
  54 + %i.icon-tag
  55 + = label.name
52 56  
53 57 .pull-right.light
54 58 %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'
... ...