Commit 6c416aaac85fe16cd4900a686714627e9a0fcdbc
1 parent
da3e34c0
Exists in
master
and in
4 other branches
Issues, MR, Wall can be enabled/disabled per project
Showing
9 changed files
with
116 additions
and
26 deletions
Show diff stats
app/controllers/issues_controller.rb
1 | 1 | class IssuesController < ApplicationController |
2 | 2 | before_filter :authenticate_user! |
3 | 3 | before_filter :project |
4 | + before_filter :module_enabled | |
4 | 5 | before_filter :issue, :only => [:edit, :update, :destroy, :show] |
5 | 6 | layout "project" |
6 | 7 | |
... | ... | @@ -132,4 +133,8 @@ class IssuesController < ApplicationController |
132 | 133 | def authorize_admin_issue! |
133 | 134 | can?(current_user, :admin_issue, @issue) |
134 | 135 | end |
136 | + | |
137 | + def module_enabled | |
138 | + return render_404 unless @project.issues_enabled | |
139 | + end | |
135 | 140 | end | ... | ... |
app/controllers/merge_requests_controller.rb
1 | 1 | class MergeRequestsController < ApplicationController |
2 | 2 | before_filter :authenticate_user! |
3 | 3 | before_filter :project |
4 | + before_filter :module_enabled | |
4 | 5 | before_filter :merge_request, :only => [:edit, :update, :destroy, :show, :commits, :diffs] |
5 | 6 | layout "project" |
6 | 7 | |
... | ... | @@ -114,4 +115,8 @@ class MergeRequestsController < ApplicationController |
114 | 115 | def authorize_admin_merge_request! |
115 | 116 | can?(current_user, :admin_merge_request, @merge_request) |
116 | 117 | end |
118 | + | |
119 | + def module_enabled | |
120 | + return render_404 unless @project.merge_requests_enabled | |
121 | + end | |
117 | 122 | end | ... | ... |
app/controllers/projects_controller.rb
app/views/layouts/_project_side.html.haml
... | ... | @@ -9,11 +9,15 @@ |
9 | 9 | = link_to "Code", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class |
10 | 10 | = link_to "Commits", project_commits_path(@project), :class => (controller.controller_name == "commits") ? "current" : nil |
11 | 11 | = link_to "Network", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil |
12 | - = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do | |
13 | - Issues | |
14 | - = link_to project_merge_requests_path(@project), :class => (controller.controller_name == "merge_requests") ? "current" : nil do | |
15 | - Merge Requests | |
16 | - = link_to wall_project_path(@project), :class => current_page?(:controller => "projects", :action => "wall", :id => @project) ? "current" : nil do | |
17 | - @Wall | |
18 | - - if @project.common_notes.today.count > 0 | |
19 | - %span.label= @project.common_notes.today.count | |
12 | + - if @project.issues_enabled | |
13 | + = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do | |
14 | + Issues | |
15 | + - if @project.merge_requests_enabled | |
16 | + = link_to project_merge_requests_path(@project), :class => (controller.controller_name == "merge_requests") ? "current" : nil do | |
17 | + Merge Requests | |
18 | + | |
19 | + - if @project.wall_enabled | |
20 | + = link_to wall_project_path(@project), :class => current_page?(:controller => "projects", :action => "wall", :id => @project) ? "current" : nil do | |
21 | + @Wall | |
22 | + - if @project.common_notes.today.count > 0 | |
23 | + %span.label= @project.common_notes.today.count | ... | ... |
app/views/projects/_form.html.haml
... | ... | @@ -23,10 +23,24 @@ |
23 | 23 | = f.label :default_branch, "Default Branch" |
24 | 24 | .input= f.select(:default_branch, @project.heads.map(&:name), {}, :style => "width:210px;") |
25 | 25 | |
26 | + .well | |
27 | + %h5 Features | |
28 | + | |
29 | + .clearfix | |
30 | + = f.label :issues_enabled, "Issues" | |
31 | + .input= f.check_box :issues_enabled | |
32 | + | |
33 | + .clearfix | |
34 | + = f.label :merge_requests_enabled, "Merge Requests" | |
35 | + .input= f.check_box :merge_requests_enabled | |
36 | + | |
37 | + .clearfix | |
38 | + = f.label :wall_enabled, "Wall" | |
39 | + .input= f.check_box :wall_enabled | |
26 | 40 | |
27 | 41 | .clearfix |
28 | 42 | = f.label :description |
29 | - .input= f.text_area :description, :placeholder => "project description", :style => "height:50px" | |
43 | + .input= f.text_area :description, :placeholder => "project description", :class => "xlarge", :rows => 4 | |
30 | 44 | |
31 | 45 | %br |
32 | 46 | ... | ... |
app/views/projects/info.html.haml
1 | 1 | = render "project_head" |
2 | -%h3= @project.name | |
3 | -%br | |
4 | 2 | |
5 | - | |
3 | +.entry | |
4 | + %h3= @project.name | |
5 | + %br | |
6 | + | |
7 | + | |
8 | + | |
9 | + %pre | |
10 | + = "git clone #{@project.url_to_repo}" | |
11 | + | |
6 | 12 | |
7 | -%pre | |
8 | - = "git clone #{@project.url_to_repo}" | |
9 | 13 | |
14 | +%h4 Details: | |
10 | 15 | |
11 | 16 | %table |
12 | 17 | %tr |
... | ... | @@ -54,6 +59,38 @@ |
54 | 59 | %tr |
55 | 60 | %td{:colspan => 2}= simple_format @project.description |
56 | 61 | |
62 | + | |
63 | +%h4 Features: | |
64 | + | |
65 | +%table | |
66 | + %tr | |
67 | + %td Issues | |
68 | + %td | |
69 | + - if @project.issues_enabled | |
70 | + .alert-message.success | |
71 | + Enabled | |
72 | + - else | |
73 | + .alert-message.error | |
74 | + Disabled | |
75 | + | |
76 | + %tr | |
77 | + %td Merge Requests | |
78 | + %td | |
79 | + - if @project.merge_requests_enabled | |
80 | + .alert-message.success | |
81 | + Enabled | |
82 | + - else | |
83 | + .alert-message.error | |
84 | + Disabled | |
85 | + %tr | |
86 | + %td Wall | |
87 | + %td | |
88 | + - if @project.wall_enabled | |
89 | + .alert-message.success | |
90 | + Enabled | |
91 | + - else | |
92 | + .alert-message.error | |
93 | + Disabled | |
57 | 94 | .actions |
58 | 95 | = link_to "Edit", edit_project_path(@project), :class => "btn" |
59 | 96 | ... | ... |
app/views/widgets/_project_member.html.haml
... | ... | @@ -16,13 +16,14 @@ |
16 | 16 | %span.label= member.repo_access_human |
17 | 17 | |
18 | 18 | - if can? current_user, :write_project, @project |
19 | - %hr | |
20 | - .span3 | |
21 | - %p You have access to create new issue or merge request. | |
22 | - %div | |
23 | - = link_to new_project_issue_path(@project), :title => "New Issue", :class => "" do | |
24 | - New Issue » | |
25 | - %div | |
26 | - = link_to new_project_merge_request_path(@project), :title => "New Merge Request", :class => "" do | |
27 | - New Merge Request » | |
19 | + - if @project.issues_enabled && @project.merge_requests_enabled | |
20 | + %hr | |
21 | + .span3 | |
22 | + %p You have access to create new issue or merge request. | |
23 | + %div | |
24 | + = link_to new_project_issue_path(@project), :title => "New Issue", :class => "" do | |
25 | + New Issue » | |
26 | + %div | |
27 | + = link_to new_project_merge_request_path(@project), :title => "New Merge Request", :class => "" do | |
28 | + New Merge Request » | |
28 | 29 | ... | ... |
db/migrate/20120206170141_add_modularity_fields_to_project.rb
0 → 100644
... | ... | @@ -0,0 +1,7 @@ |
1 | +class AddModularityFieldsToProject < ActiveRecord::Migration | |
2 | + def change | |
3 | + add_column :projects, :issues_enabled, :boolean, :null => false, :default => true | |
4 | + add_column :projects, :wall_enabled, :boolean, :null => false, :default => true | |
5 | + add_column :projects, :merge_requests_enabled, :boolean, :null => false, :default => true | |
6 | + end | |
7 | +end | ... | ... |
db/schema.rb
... | ... | @@ -11,7 +11,19 @@ |
11 | 11 | # |
12 | 12 | # It's strongly recommended to check this file into your version control system. |
13 | 13 | |
14 | -ActiveRecord::Schema.define(:version => 20120121122616) do | |
14 | +ActiveRecord::Schema.define(:version => 20120206170141) do | |
15 | + | |
16 | + create_table "features", :force => true do |t| | |
17 | + t.string "name" | |
18 | + t.string "branch_name" | |
19 | + t.integer "assignee_id" | |
20 | + t.integer "author_id" | |
21 | + t.integer "project_id" | |
22 | + t.datetime "created_at" | |
23 | + t.datetime "updated_at" | |
24 | + t.string "version" | |
25 | + t.integer "status", :default => 0, :null => false | |
26 | + end | |
15 | 27 | |
16 | 28 | create_table "issues", :force => true do |t| |
17 | 29 | t.string "title" |
... | ... | @@ -73,10 +85,13 @@ ActiveRecord::Schema.define(:version => 20120121122616) do |
73 | 85 | t.text "description" |
74 | 86 | t.datetime "created_at" |
75 | 87 | t.datetime "updated_at" |
76 | - t.boolean "private_flag", :default => true, :null => false | |
88 | + t.boolean "private_flag", :default => true, :null => false | |
77 | 89 | t.string "code" |
78 | 90 | t.integer "owner_id" |
79 | - t.string "default_branch", :default => "master", :null => false | |
91 | + t.string "default_branch", :default => "master", :null => false | |
92 | + t.boolean "issues_enabled", :default => true, :null => false | |
93 | + t.boolean "wall_enabled", :default => true, :null => false | |
94 | + t.boolean "merge_requests_enabled", :default => true, :null => false | |
80 | 95 | end |
81 | 96 | |
82 | 97 | create_table "snippets", :force => true do |t| | ... | ... |