class IssuesController < ApplicationController
before_filter :authenticate_user!
before_filter :project
+ before_filter :module_enabled
before_filter :issue, :only => [:edit, :update, :destroy, :show]
layout "project"
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"
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
#
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)
= 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
- = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
- Issues
- = link_to project_merge_requests_path(@project), :class => (controller.controller_name == "merge_requests") ? "current" : nil do
- Merge Requests
- = 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
+ - 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
+ %span.label= @project.common_notes.today.count
= 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
+ = "git clone #{@project.url_to_repo}"
+
-%pre
- = "git clone #{@project.url_to_repo}"
+%h4 Details:
%table
%tr
%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"
%span.label= member.repo_access_human
- if can? current_user, :write_project, @project
- %hr
- .span3
- %p You have access to create new issue or merge request.
- %div
- = link_to new_project_issue_path(@project), :title => "New Issue", :class => "" do
- New Issue »
- %div
- = link_to new_project_merge_request_path(@project), :title => "New Merge Request", :class => "" do
- New Merge Request »
+ - if @project.issues_enabled && @project.merge_requests_enabled
+ %hr
+ .span3
+ %p You have access to create new issue or merge request.
+ %div
+ = link_to new_project_issue_path(@project), :title => "New Issue", :class => "" do
+ New Issue »
+ %div
+ = link_to new_project_merge_request_path(@project), :title => "New Merge Request", :class => "" do
+ New Merge Request »
--- /dev/null
+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
#
# 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"
t.text "description"
t.datetime "created_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.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
create_table "snippets", :force => true do |t|