Commit 6c416aaa authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Issues, MR, Wall can be enabled/disabled per project

parent da3e34c0
class IssuesController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :module_enabled
before_filter :issue, :only => [:edit, :update, :destroy, :show]
layout "project"
......@@ -132,4 +133,8 @@ class IssuesController < ApplicationController
def authorize_admin_issue!
can?(current_user, :admin_issue, @issue)
end
def module_enabled
return render_404 unless @project.issues_enabled
end
end
class MergeRequestsController < ApplicationController
before_filter :authenticate_user!
before_filter :project
before_filter :module_enabled
before_filter :merge_request, :only => [:edit, :update, :destroy, :show, :commits, :diffs]
layout "project"
......@@ -114,4 +115,8 @@ class MergeRequestsController < ApplicationController
def authorize_admin_merge_request!
can?(current_user, :admin_merge_request, @merge_request)
end
def module_enabled
return render_404 unless @project.merge_requests_enabled
end
end
......@@ -85,6 +85,8 @@ class ProjectsController < ApplicationController
#
def wall
return render_404 unless @project.wall_enabled
@note = Note.new
@notes = @project.common_notes.order("created_at DESC")
@notes = @notes.fresh.limit(20)
......
......@@ -9,10 +9,14 @@
= link_to "Code", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class
= link_to "Commits", project_commits_path(@project), :class => (controller.controller_name == "commits") ? "current" : nil
= link_to "Network", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil
- if @project.issues_enabled
= link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
Issues
- if @project.merge_requests_enabled
= link_to project_merge_requests_path(@project), :class => (controller.controller_name == "merge_requests") ? "current" : nil do
Merge Requests
- if @project.wall_enabled
= link_to wall_project_path(@project), :class => current_page?(:controller => "projects", :action => "wall", :id => @project) ? "current" : nil do
@Wall
- if @project.common_notes.today.count > 0
......
......@@ -23,10 +23,24 @@
= f.label :default_branch, "Default Branch"
.input= f.select(:default_branch, @project.heads.map(&:name), {}, :style => "width:210px;")
.well
%h5 Features
.clearfix
= f.label :issues_enabled, "Issues"
.input= f.check_box :issues_enabled
.clearfix
= f.label :merge_requests_enabled, "Merge Requests"
.input= f.check_box :merge_requests_enabled
.clearfix
= f.label :wall_enabled, "Wall"
.input= f.check_box :wall_enabled
.clearfix
= f.label :description
.input= f.text_area :description, :placeholder => "project description", :style => "height:50px"
.input= f.text_area :description, :placeholder => "project description", :class => "xlarge", :rows => 4
%br
......
= render "project_head"
%h3= @project.name
%br
.entry
%h3= @project.name
%br
%pre
%pre
= "git clone #{@project.url_to_repo}"
%h4 Details:
%table
%tr
%td Name
......@@ -54,6 +59,38 @@
%tr
%td{:colspan => 2}= simple_format @project.description
%h4 Features:
%table
%tr
%td Issues
%td
- if @project.issues_enabled
.alert-message.success
Enabled
- else
.alert-message.error
Disabled
%tr
%td Merge Requests
%td
- if @project.merge_requests_enabled
.alert-message.success
Enabled
- else
.alert-message.error
Disabled
%tr
%td Wall
%td
- if @project.wall_enabled
.alert-message.success
Enabled
- else
.alert-message.error
Disabled
.actions
= link_to "Edit", edit_project_path(@project), :class => "btn"
......@@ -16,6 +16,7 @@
%span.label= member.repo_access_human
- if can? current_user, :write_project, @project
- if @project.issues_enabled && @project.merge_requests_enabled
%hr
.span3
%p You have access to create new issue or merge request.
......
class AddModularityFieldsToProject < ActiveRecord::Migration
def change
add_column :projects, :issues_enabled, :boolean, :null => false, :default => true
add_column :projects, :wall_enabled, :boolean, :null => false, :default => true
add_column :projects, :merge_requests_enabled, :boolean, :null => false, :default => true
end
end
......@@ -11,7 +11,19 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120121122616) do
ActiveRecord::Schema.define(:version => 20120206170141) do
create_table "features", :force => true do |t|
t.string "name"
t.string "branch_name"
t.integer "assignee_id"
t.integer "author_id"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "version"
t.integer "status", :default => 0, :null => false
end
create_table "issues", :force => true do |t|
t.string "title"
......@@ -77,6 +89,9 @@ ActiveRecord::Schema.define(:version => 20120121122616) do
t.string "code"
t.integer "owner_id"
t.string "default_branch", :default => "master", :null => false
t.boolean "issues_enabled", :default => true, :null => false
t.boolean "wall_enabled", :default => true, :null => false
t.boolean "merge_requests_enabled", :default => true, :null => false
end
create_table "snippets", :force => true do |t|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment