default_branch for project & fixed project destroy

This commit is contained in:
Dmitriy Zaporozhets 2011-12-07 23:56:57 +02:00
parent 2552a877df
commit d68ec5e0fb
7 changed files with 18 additions and 6 deletions

View file

@ -61,7 +61,7 @@ class ApplicationController < ActionController::Base
else
@branch = params[:branch].blank? ? nil : params[:branch]
@tag = params[:tag].blank? ? nil : params[:tag]
@ref = @branch || @tag || Repository.default_ref
@ref = @branch || @tag || @project.try(:default_branch) || Repository.default_ref
end
end

View file

@ -158,7 +158,7 @@ class Project < ActiveRecord::Base
end
def root_ref
"master"
default_branch || "master"
end
def public?

View file

@ -49,7 +49,7 @@
%span{ :class => "number" }= @project.snippets.non_expired.count
- if can? current_user, :admin_project, @project
= link_to "Project", edit_project_path(@project), :class => (current_page?(edit_project_path(@project))) ? "current" : nil
= link_to "Admin", edit_project_path(@project), :class => (current_page?(edit_project_path(@project))) ? "current" : nil
.medium-tags{:style => 'padding: 10px 0 0 10px; width: 210px;'}= tag_list @project

View file

@ -29,6 +29,11 @@
%cite.right= "http://#{GIT_HOST["host"]}/"
%td= f.text_field :code, :placeholder => "example"
- unless @project.heads.empty?
%tr
%td= f.label :default_branch, "Default Branch"
%td= f.select(:default_branch, @project.heads.map(&:name), {}, :style => "width:300px;")
%tr
%td= f.label :tag_list
%td= f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field
@ -57,4 +62,5 @@
:javascript
$(function(){
taggifyForm();
$('form #project_default_branch').chosen();
})