[refs #223] fixed rendering fork button

This commit is contained in:
Alexander Machehin 2012-04-10 20:15:15 +06:00
parent 18bda07369
commit 4ba17be536
1 changed files with 25 additions and 23 deletions

View File

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