[refs #353] always show fork popup

This commit is contained in:
Alexander Machehin 2012-04-11 00:05:06 +06:00
parent f0b9cabefa
commit 27f2be079d
2 changed files with 17 additions and 28 deletions

View File

@ -0,0 +1,9 @@
- if owner.projects.exists? :name => @project.name
- is_group = owner.class == Group ? "(#{t 'activerecord.models.group'})" : ''
%p.center
=t 'layout.projects.already_exists'
=link_to "#{owner.uname}/#{@project.name} #{is_group}", project_path(owner.projects.by_name(@project.name).first.id)
- else
= form_for @project, :url => fork_project_path(@project), :html => { :class => :form, :multipart => true, :method => :post } do |f|
= hidden_field_tag :group, owner.id if owner.class == Group
=f.submit t('layout.projects.fork_to', :to => "#{owner.uname} #{is_group}"), :class => 'btn btn-primary'

View File

@ -1,31 +1,11 @@
- if can? :fork, @project
- if Group.can_own_project(current_user).present?
.r#fork-and-edit= link_to t('layout.projects.fork_and_edit'), '#forkModal', :class => 'button', 'data-toggle' => 'modal'
#forkModal.modal{:style => 'display: none;'}
.modal-header
%a.close{"data-dismiss" => "modal"} ×
%h3=t 'layout.projects.fork_modal_header'
.modal-footer
- if current_user.projects.exists? :name => @project.name
%p.center
=t 'layout.projects.already_exists'
=link_to "#{current_user.uname}/#{@project.name}", project_path(current_user.projects.by_name(@project.name).first.id)
- else
= form_for @project, :url => fork_project_path(@project), :html => { :class => :form, :multipart => true, :method => :post } do |f|
=f.submit t('layout.projects.fork_to', :to => current_user.uname), :class => 'btn btn-primary'
- Group.can_own_project(current_user).each do |group|
.modal-footer
- if group.projects.exists? :name => @project.name
%p.center
=t 'layout.projects.already_exists'
=link_to "#{group.uname}/#{@project.name} (#{t 'activerecord.models.group'})", project_path(group.projects.by_name(@project.name).first.id)
- else
= form_for @project, :url => fork_project_path(@project), :html => { :class => :form, :multipart => true, :method => :post } do |f|
= hidden_field_tag :group, group.id
=f.submit t('layout.projects.fork_to', :to => "#{group.uname} (#{t 'activerecord.models.group'})"), :class => 'btn btn-primary'
- else
.r#fork-and-edit= link_to t('layout.projects.fork_and_edit'), fork_project_path(@project), :method => :post, :confirm => t("layout.confirm"), :class => 'button'
.r#fork-and-edit= link_to t('layout.projects.fork_and_edit'), '#forkModal', :class => 'button', 'data-toggle' => 'modal'
#forkModal.modal{:style => 'display: none;'}
.modal-header
%a.close{"data-dismiss" => "modal"} ×
%h3=t 'layout.projects.fork_modal_header'
.modal-footer=render :partial => 'git/shared/choose_fork', :locals => {:owner => current_user}
- Group.can_own_project(current_user).each do |group|
.modal-footer=render :partial => 'git/shared/choose_fork', :locals => {:owner => group}
- if can? :create, @project.build_lists.new
.r{:style => "display: block"}= link_to t('layout.projects.new_build_list'), new_project_build_list_path(@project), :class => 'button'