Issues, MR, Wall can be enabled/disabled per project
This commit is contained in:
parent
da3e34c0fd
commit
6c416aaac8
9 changed files with 116 additions and 26 deletions
|
@ -1,6 +1,7 @@
|
||||||
class IssuesController < ApplicationController
|
class IssuesController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
before_filter :project
|
before_filter :project
|
||||||
|
before_filter :module_enabled
|
||||||
before_filter :issue, :only => [:edit, :update, :destroy, :show]
|
before_filter :issue, :only => [:edit, :update, :destroy, :show]
|
||||||
layout "project"
|
layout "project"
|
||||||
|
|
||||||
|
@ -132,4 +133,8 @@ class IssuesController < ApplicationController
|
||||||
def authorize_admin_issue!
|
def authorize_admin_issue!
|
||||||
can?(current_user, :admin_issue, @issue)
|
can?(current_user, :admin_issue, @issue)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def module_enabled
|
||||||
|
return render_404 unless @project.issues_enabled
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
class MergeRequestsController < ApplicationController
|
class MergeRequestsController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
before_filter :project
|
before_filter :project
|
||||||
|
before_filter :module_enabled
|
||||||
before_filter :merge_request, :only => [:edit, :update, :destroy, :show, :commits, :diffs]
|
before_filter :merge_request, :only => [:edit, :update, :destroy, :show, :commits, :diffs]
|
||||||
layout "project"
|
layout "project"
|
||||||
|
|
||||||
|
@ -114,4 +115,8 @@ class MergeRequestsController < ApplicationController
|
||||||
def authorize_admin_merge_request!
|
def authorize_admin_merge_request!
|
||||||
can?(current_user, :admin_merge_request, @merge_request)
|
can?(current_user, :admin_merge_request, @merge_request)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def module_enabled
|
||||||
|
return render_404 unless @project.merge_requests_enabled
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,6 +85,8 @@ class ProjectsController < ApplicationController
|
||||||
#
|
#
|
||||||
|
|
||||||
def wall
|
def wall
|
||||||
|
return render_404 unless @project.wall_enabled
|
||||||
|
|
||||||
@note = Note.new
|
@note = Note.new
|
||||||
@notes = @project.common_notes.order("created_at DESC")
|
@notes = @project.common_notes.order("created_at DESC")
|
||||||
@notes = @notes.fresh.limit(20)
|
@notes = @notes.fresh.limit(20)
|
||||||
|
|
|
@ -9,11 +9,15 @@
|
||||||
= link_to "Code", tree_project_ref_path(@project, @project.root_ref), :class => tree_tab_class
|
= 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 "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
|
= link_to "Network", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil
|
||||||
= link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
|
- if @project.issues_enabled
|
||||||
Issues
|
= link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
|
||||||
= link_to project_merge_requests_path(@project), :class => (controller.controller_name == "merge_requests") ? "current" : nil do
|
Issues
|
||||||
Merge Requests
|
- if @project.merge_requests_enabled
|
||||||
= link_to wall_project_path(@project), :class => current_page?(:controller => "projects", :action => "wall", :id => @project) ? "current" : nil do
|
= link_to project_merge_requests_path(@project), :class => (controller.controller_name == "merge_requests") ? "current" : nil do
|
||||||
@Wall
|
Merge Requests
|
||||||
- if @project.common_notes.today.count > 0
|
|
||||||
%span.label= @project.common_notes.today.count
|
- 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
|
||||||
|
%span.label= @project.common_notes.today.count
|
||||||
|
|
|
@ -23,10 +23,24 @@
|
||||||
= f.label :default_branch, "Default Branch"
|
= f.label :default_branch, "Default Branch"
|
||||||
.input= f.select(:default_branch, @project.heads.map(&:name), {}, :style => "width:210px;")
|
.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
|
.clearfix
|
||||||
= f.label :description
|
= 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
|
%br
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
= render "project_head"
|
= render "project_head"
|
||||||
%h3= @project.name
|
|
||||||
%br
|
|
||||||
|
|
||||||
|
.entry
|
||||||
|
%h3= @project.name
|
||||||
|
%br
|
||||||
|
|
||||||
%pre
|
|
||||||
= "git clone #{@project.url_to_repo}"
|
|
||||||
|
|
||||||
|
%pre
|
||||||
|
= "git clone #{@project.url_to_repo}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%h4 Details:
|
||||||
|
|
||||||
%table
|
%table
|
||||||
%tr
|
%tr
|
||||||
|
@ -54,6 +59,38 @@
|
||||||
%tr
|
%tr
|
||||||
%td{:colspan => 2}= simple_format @project.description
|
%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
|
.actions
|
||||||
= link_to "Edit", edit_project_path(@project), :class => "btn"
|
= link_to "Edit", edit_project_path(@project), :class => "btn"
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,14 @@
|
||||||
%span.label= member.repo_access_human
|
%span.label= member.repo_access_human
|
||||||
|
|
||||||
- if can? current_user, :write_project, @project
|
- if can? current_user, :write_project, @project
|
||||||
%hr
|
- if @project.issues_enabled && @project.merge_requests_enabled
|
||||||
.span3
|
%hr
|
||||||
%p You have access to create new issue or merge request.
|
.span3
|
||||||
%div
|
%p You have access to create new issue or merge request.
|
||||||
= link_to new_project_issue_path(@project), :title => "New Issue", :class => "" do
|
%div
|
||||||
New Issue »
|
= link_to new_project_issue_path(@project), :title => "New Issue", :class => "" do
|
||||||
%div
|
New Issue »
|
||||||
= link_to new_project_merge_request_path(@project), :title => "New Merge Request", :class => "" do
|
%div
|
||||||
New Merge Request »
|
= link_to new_project_merge_request_path(@project), :title => "New Merge Request", :class => "" do
|
||||||
|
New Merge Request »
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
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
|
21
db/schema.rb
21
db/schema.rb
|
@ -11,7 +11,19 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# 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|
|
create_table "issues", :force => true do |t|
|
||||||
t.string "title"
|
t.string "title"
|
||||||
|
@ -73,10 +85,13 @@ ActiveRecord::Schema.define(:version => 20120121122616) do
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.boolean "private_flag", :default => true, :null => false
|
t.boolean "private_flag", :default => true, :null => false
|
||||||
t.string "code"
|
t.string "code"
|
||||||
t.integer "owner_id"
|
t.integer "owner_id"
|
||||||
t.string "default_branch", :default => "master", :null => false
|
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
|
end
|
||||||
|
|
||||||
create_table "snippets", :force => true do |t|
|
create_table "snippets", :force => true do |t|
|
||||||
|
|
Loading…
Reference in a new issue