#641: added is_package checkbox to #new page, updated model

This commit is contained in:
Vokhmin Alexey V 2012-09-12 19:06:34 +04:00
parent 459e1ba2fa
commit 8d35786183
3 changed files with 19 additions and 17 deletions

View File

@ -828,11 +828,11 @@ article div.activity div.fulltext.view {
margin: 0px 0px 10px 0px; margin: 0px 0px 10px 0px;
} }
.right div.rightlist div.check { div.rightlist div.check {
float: left; float: left;
} }
.right div.rightlist div.forcheck { div.rightlist div.forcheck {
float: left; float: left;
margin: 1px 0px 0px 5px; margin: 1px 0px 0px 5px;
} }

View File

@ -51,7 +51,7 @@ class Project < ActiveRecord::Base
) } ) }
before_create :set_maintainer before_create :set_maintainer
after_create :attach_to_personal_repository after_save :attach_to_personal_repository
has_ancestry :orphan_strategy => :rootify #:adopt not available yet has_ancestry :orphan_strategy => :rootify #:adopt not available yet
@ -169,7 +169,12 @@ class Project < ActiveRecord::Base
protected protected
def attach_to_personal_repository def attach_to_personal_repository
repositories << self.owner.personal_repository if !repositories.exists?(:id => self.owner.personal_repository) owner_rep = self.owner.personal_repository
if is_package
repositories << owner_rep unless repositories.exists?(:id => owner_rep)
else
repositories.delete owner_rep
end
end end
def set_maintainer def set_maintainer

View File

@ -12,8 +12,6 @@
= label_tag t("activerecord.attributes.project.who_owns.me") = label_tag t("activerecord.attributes.project.who_owns.me")
- if Group.can_own_project(current_user).count > 0 - if Group.can_own_project(current_user).count > 0
= radio_button_tag :who_owns, 'me', @who_owns == :me #{}.merge( (@who_owns == :me) ? {:checked => 'checked'} : {} ) = radio_button_tag :who_owns, 'me', @who_owns == :me #{}.merge( (@who_owns == :me) ? {:checked => 'checked'} : {} )
- puts @who_owns.inspect
- puts @who_owns == :group
= label_tag t("activerecord.attributes.project.who_owns.group") = label_tag t("activerecord.attributes.project.who_owns.group")
= radio_button_tag :who_owns, 'group', @who_owns == :group #{}.merge( (@who_owns == :group) ? {:checked => 'checked'} : {} ) = radio_button_tag :who_owns, 'group', @who_owns == :group #{}.merge( (@who_owns == :group) ? {:checked => 'checked'} : {} )
-# TODO: Make our own select_box helper with new design, blackjack and bitches! -# TODO: Make our own select_box helper with new design, blackjack and bitches!
@ -33,23 +31,22 @@
= image_tag("lock.png") = image_tag("lock.png")
= t("activerecord.attributes.project.visibilities.#{visibility}") = t("activerecord.attributes.project.visibilities.#{visibility}")
.both .both
.leftlist
\ 
.rightlist
.check
%span#niceCheckbox1.niceCheck-main= f.check_box :is_package#, :class => 'niceCheckbox1'
.forcheck= t("activerecord.attributes.project.is_package")
.both
.both
- if [:edit, :update].include? act - if [:edit, :update].include? act
.leftlist= t("activerecord.attributes.project.default_branch") .leftlist= t("activerecord.attributes.project.default_branch")
.rightlist .rightlist
= f.select :default_branch, = f.select :default_branch,
options_from_collection_for_select(@project.repo.branches, options_from_collection_for_select( @project.repo.branches,
:name, :name, @project.default_branch), :name, :name, @project.default_branch),
:class => 'sel80', :id => 'branch_selector' :class => 'sel80', :id => 'branch_selector'
.both .both
- if [:edit, :update].include? act
.leftlist
\ 
.rightlist
.check
%span#niceCheckbox1.niceCheck-main= f.check_box :is_package#, :class => 'niceCheckbox1'
.forcheck= t("activerecord.attributes.project.is_package")
.both
.both
#maintainer_form{:class => @project.is_package ? '' : 'hidden'} #maintainer_form{:class => @project.is_package ? '' : 'hidden'}
= f.hidden_field :maintainer_id, :value => @project.maintainer_id = f.hidden_field :maintainer_id, :value => @project.maintainer_id
.leftlist .leftlist