#641: added is_package checkbox to #new page, updated model
This commit is contained in:
parent
459e1ba2fa
commit
8d35786183
|
@ -828,11 +828,11 @@ article div.activity div.fulltext.view {
|
|||
margin: 0px 0px 10px 0px;
|
||||
}
|
||||
|
||||
.right div.rightlist div.check {
|
||||
div.rightlist div.check {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.right div.rightlist div.forcheck {
|
||||
div.rightlist div.forcheck {
|
||||
float: left;
|
||||
margin: 1px 0px 0px 5px;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ class Project < ActiveRecord::Base
|
|||
) }
|
||||
|
||||
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
|
||||
|
||||
|
@ -169,7 +169,12 @@ class Project < ActiveRecord::Base
|
|||
protected
|
||||
|
||||
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
|
||||
|
||||
def set_maintainer
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
= label_tag t("activerecord.attributes.project.who_owns.me")
|
||||
- if Group.can_own_project(current_user).count > 0
|
||||
= 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")
|
||||
= 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!
|
||||
|
@ -33,23 +31,22 @@
|
|||
= image_tag("lock.png")
|
||||
= t("activerecord.attributes.project.visibilities.#{visibility}")
|
||||
.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
|
||||
.leftlist= t("activerecord.attributes.project.default_branch")
|
||||
.rightlist
|
||||
= f.select :default_branch,
|
||||
options_from_collection_for_select(@project.repo.branches,
|
||||
:name, :name, @project.default_branch),
|
||||
options_from_collection_for_select( @project.repo.branches,
|
||||
:name, :name, @project.default_branch),
|
||||
:class => 'sel80', :id => 'branch_selector'
|
||||
.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'}
|
||||
= f.hidden_field :maintainer_id, :value => @project.maintainer_id
|
||||
.leftlist
|
||||
|
|
Loading…
Reference in New Issue