[issue #279] Fixed some bugs:
* Redirect to repositroies page when remove repository. * Fixed sorting background in Datatables styles. * Fixed save button translation in platforms form. * Fixed platform save & create flashes. * Fixed cancel buttons in platform, product & repository forms. * Redirect to created product on creation. * Redirect to platform's products page after product destruction. * Fixed permissions to Build button on product page. * Fixed permissions to Add button on repository page. * Fixed forbidden redirect when trying to acces RepositoriesController#projects_list by unprivilleged user.
This commit is contained in:
parent
9911d9f25e
commit
cc68163238
|
@ -568,3 +568,12 @@ div#crontab_generator .leftlist select,
|
||||||
div#crontab_generator .rightlist select {
|
div#crontab_generator .rightlist select {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.dataTable tr.odd td.sorting_1 {
|
||||||
|
background-color: #F0F0F6;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.dataTable tr.even td.sorting_1 {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,10 +57,10 @@ class PlatformsController < ApplicationController
|
||||||
@platform.owner = @admin_id.blank? ? get_owner : User.find(@admin_id)
|
@platform.owner = @admin_id.blank? ? get_owner : User.find(@admin_id)
|
||||||
|
|
||||||
if @platform.save
|
if @platform.save
|
||||||
flash[:notice] = I18n.t("flash.platform.saved")
|
flash[:notice] = I18n.t("flash.platform.created")
|
||||||
redirect_to @platform
|
redirect_to @platform
|
||||||
else
|
else
|
||||||
flash[:error] = I18n.t("flash.platform.save_error")
|
flash[:error] = I18n.t("flash.platform.create_error")
|
||||||
render :action => :new
|
render :action => :new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -125,7 +125,7 @@ class PlatformsController < ApplicationController
|
||||||
@platform.delay.destroy if @platform
|
@platform.delay.destroy if @platform
|
||||||
|
|
||||||
flash[:notice] = t("flash.platform.destroyed")
|
flash[:notice] = t("flash.platform.destroyed")
|
||||||
redirect_to root_path
|
redirect_to platforms_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def forbidden
|
def forbidden
|
||||||
|
|
|
@ -35,7 +35,7 @@ class ProductsController < ApplicationController
|
||||||
@product = @platform.products.new params[:product]
|
@product = @platform.products.new params[:product]
|
||||||
if @product.save
|
if @product.save
|
||||||
flash[:notice] = t('flash.product.saved')
|
flash[:notice] = t('flash.product.saved')
|
||||||
redirect_to @platform
|
redirect_to platform_product_path(@platform, @product)
|
||||||
else
|
else
|
||||||
flash[:error] = t('flash.product.save_error')
|
flash[:error] = t('flash.product.save_error')
|
||||||
render :action => :new
|
render :action => :new
|
||||||
|
@ -58,7 +58,7 @@ class ProductsController < ApplicationController
|
||||||
def destroy
|
def destroy
|
||||||
@product.destroy
|
@product.destroy
|
||||||
flash[:notice] = t("flash.product.destroyed")
|
flash[:notice] = t("flash.product.destroyed")
|
||||||
redirect_to @platform
|
redirect_to platform_products_path(@platform)
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -36,7 +36,7 @@ class RepositoriesController < ApplicationController
|
||||||
platform_id = @repository.platform_id
|
platform_id = @repository.platform_id
|
||||||
|
|
||||||
flash[:notice] = t("flash.repository.destroyed")
|
flash[:notice] = t("flash.repository.destroyed")
|
||||||
redirect_to platform_path(platform_id)
|
redirect_to platform_repositories_path(platform_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
|
|
@ -79,10 +79,10 @@ class Ability
|
||||||
can(:destroy, Platform) {|platform| owner? platform}
|
can(:destroy, Platform) {|platform| owner? platform}
|
||||||
can :autocomplete_user_uname, Platform
|
can :autocomplete_user_uname, Platform
|
||||||
|
|
||||||
can :read, Repository, :platform => {:visibility => 'open'}
|
can [:read, :projects_list], Repository, :platform => {:visibility => 'open'}
|
||||||
can :read, Repository, :platform => {:owner_type => 'User', :owner_id => user.id}
|
can [:read, :projects_list], Repository, :platform => {:owner_type => 'User', :owner_id => user.id}
|
||||||
can :read, Repository, :platform => {:owner_type => 'Group', :owner_id => user.group_ids}
|
can [:read, :projects_list], Repository, :platform => {:owner_type => 'Group', :owner_id => user.group_ids}
|
||||||
can(:read, Repository, read_relations_for('repositories', 'platforms')) {|repository| local_reader? repository.platform}
|
can([:read, :projects_list], Repository, read_relations_for('repositories', 'platforms')) {|repository| local_reader? repository.platform}
|
||||||
can([:create, :update, :projects_list, :add_project, :remove_project], Repository) {|repository| local_admin? repository.platform}
|
can([:create, :update, :projects_list, :add_project, :remove_project], Repository) {|repository| local_admin? repository.platform}
|
||||||
can([:change_visibility, :settings, :destroy], Repository) {|repository| owner? repository.platform}
|
can([:change_visibility, :settings, :destroy], Repository) {|repository| owner? repository.platform}
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,24 @@
|
||||||
- unless ['edit', 'update'].include? controller.action_name
|
- unless ['edit', 'update'].include? controller.action_name
|
||||||
.leftlist= f.label :name, :class => :label
|
.leftlist= f.label :name, :class => :label
|
||||||
.rightlist= f.text_field :name, :class => 'text_field'
|
.rightlist= f.text_field :name, :class => 'text_field'
|
||||||
|
.both
|
||||||
|
|
||||||
.leftlist= f.label :description, :class => :label
|
.leftlist= f.label :description, :class => :label
|
||||||
.rightlist= f.text_field :description, :class => 'text_field'
|
.rightlist= f.text_area :description, :class => 'text_field'
|
||||||
|
.both
|
||||||
|
|
||||||
- unless ['edit', 'update'].include? controller.action_name
|
- unless ['edit', 'update'].include? controller.action_name
|
||||||
.leftlist= f.label :distrib_type, :class => :label
|
.leftlist= f.label :distrib_type, :class => :label
|
||||||
.rightlist= f.select :distrib_type, options_for_select(APP_CONFIG['distr_types'])
|
.rightlist= f.select :distrib_type, options_for_select(APP_CONFIG['distr_types'])
|
||||||
|
.both
|
||||||
|
|
||||||
.leftlist= f.label :parent, :class => :label
|
.leftlist= f.label :parent, :class => :label
|
||||||
.rightlist= f.collection_select :parent_platform_id, Platform.all, :id, :description, :include_blank => true
|
.rightlist= f.collection_select :parent_platform_id, Platform.all, :id, :description, :include_blank => true
|
||||||
|
.both
|
||||||
|
|
||||||
.leftlist= f.label :released, :class => :label
|
.leftlist= f.label :released, :class => :label
|
||||||
.rightlist= f.check_box :released, :class => 'check_box'
|
.rightlist= f.check_box :released, :class => 'check_box'
|
||||||
|
.both
|
||||||
|
|
||||||
.leftlist= label_tag "", t("layout.platforms.admin_id"), :class => :label
|
.leftlist= label_tag "", t("layout.platforms.admin_id"), :class => :label
|
||||||
.rightlist= autocomplete_field_tag 'admin_id', @admin_uname, autocomplete_user_uname_platforms_path, :id_element => '#admin_id_field'
|
.rightlist= autocomplete_field_tag 'admin_id', @admin_uname, autocomplete_user_uname_platforms_path, :id_element => '#admin_id_field'
|
||||||
|
@ -21,9 +26,9 @@
|
||||||
.both
|
.both
|
||||||
|
|
||||||
.button_block
|
.button_block
|
||||||
= submit_tag t("layout.clone")
|
= submit_tag t("layout.save")
|
||||||
-#%input.button{:type => "submit", :class => "button"}
|
-#%input.button{:type => "submit", :class => "button"}
|
||||||
-#= image_tag("choose.png", :alt => t("layout.save"))
|
-#= image_tag("choose.png", :alt => t("layout.save"))
|
||||||
-#= t("layout.clone")
|
-#= t("layout.clone")
|
||||||
%span.text_button_padding= t("layout.or")
|
%span.text_button_padding= t("layout.or")
|
||||||
= link_to t("layout.cancel"), @platforms_path, :class => "button"
|
= link_to t("layout.cancel"), @platform.new_record? ? root_path : platform_path(@platform), :class => "button"
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
.block
|
%h3= t("layout.platforms.new_header")
|
||||||
|
|
||||||
|
= form_for :platform, :url => platforms_path, :html => { :class => :form } do |f|
|
||||||
|
= render :partial => "form", :locals => {:f => f}
|
||||||
|
|
||||||
|
-#.block
|
||||||
.secondary-navigation
|
.secondary-navigation
|
||||||
%ul.wat-cf
|
%ul.wat-cf
|
||||||
%li.first= link_to "#{t("layout.platforms.list")}", @platforms_path
|
%li.first= link_to "#{t("layout.platforms.list")}", @platforms_path
|
||||||
|
|
|
@ -48,5 +48,5 @@
|
||||||
-#= image_tag("choose.png", :alt => t("layout.save"))
|
-#= image_tag("choose.png", :alt => t("layout.save"))
|
||||||
-#= t("layout.clone")
|
-#= t("layout.clone")
|
||||||
%span.text_button_padding= t("layout.or")
|
%span.text_button_padding= t("layout.or")
|
||||||
= link_to t("layout.cancel"), platform_path(@platform), :class => "button"
|
= link_to t("layout.cancel"), @product.new_record? ? platform_path(@platform) : platform_product_path(@platform, @product), :class => "button"
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
= link_to image_tag("x.png", :alt => t("layout.delete")) + " " + t("layout.delete"), platform_product_path(@platform, @product), :method => "delete", :class => "button", :confirm => t("layout.products.confirm_delete")
|
= link_to image_tag("x.png", :alt => t("layout.delete")) + " " + t("layout.delete"), platform_product_path(@platform, @product), :method => "delete", :class => "button", :confirm => t("layout.products.confirm_delete")
|
||||||
-# if @product.can_clone?
|
-# if @product.can_clone?
|
||||||
=# link_to t("layout.products.clone"), clone_platform_product_path(@platform, @product), :class => "button"
|
=# link_to t("layout.products.clone"), clone_platform_product_path(@platform, @product), :class => "button"
|
||||||
- if can?(:create, @product => ProductBuildList)
|
- if can?(:create, @product.product_build_lists.build)
|
||||||
= link_to t("layout.products.build"), platform_product_product_build_lists_path(@platform, @product), :class => "button", :method => 'post', :confirm => t("layout.confirm")
|
= link_to t("layout.products.build"), platform_product_product_build_lists_path(@platform, @product), :class => "button", :method => 'post', :confirm => t("layout.confirm")
|
||||||
|
|
||||||
%h3= t("layout.products.build_lists_monitoring")
|
%h3= t("layout.products.build_lists_monitoring")
|
||||||
|
|
|
@ -12,4 +12,4 @@
|
||||||
-#= image_tag("choose.png", :alt => t("layout.save"))
|
-#= image_tag("choose.png", :alt => t("layout.save"))
|
||||||
-#= t("layout.clone")
|
-#= t("layout.clone")
|
||||||
%span.text_button_padding= t("layout.or")
|
%span.text_button_padding= t("layout.or")
|
||||||
= link_to t("layout.cancel"), @repositories_path, :class => "button"
|
= link_to t("layout.cancel"), @repository.new_record? ? platform_repositories_path(@platform) : platform_repository_path(@platform, @repository), :class => "button"
|
||||||
|
|
|
@ -15,22 +15,17 @@
|
||||||
%>",
|
%>",
|
||||||
"<%=j project.description %>",
|
"<%=j project.description %>",
|
||||||
"<%=
|
"<%=
|
||||||
j(link_to('<span class="delete"> </span>'.html_safe, remove_project_repository_path(@repository, :project_id => project.id), :method => :delete, :confirm => t("layout.confirm")))
|
if can? :remove_project, @repository
|
||||||
#j link_to t("layout.add"), url_for(:controller => :repositories, :action => :add_project, :project_id => project.id)
|
j(link_to('<span class="delete"> </span>'.html_safe,
|
||||||
|
remove_project_repository_path(@repository, :project_id => project.id),
|
||||||
|
:method => :delete, :confirm => t("layout.confirm")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else
|
||||||
|
''
|
||||||
|
end
|
||||||
%>"
|
%>"
|
||||||
]<%= project == @projects.last ? '' : ',' %>
|
]<%= project == @projects.last ? '' : ',' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
]
|
]
|
||||||
<%
|
|
||||||
# %tr{:id => "Row#{project_counter}", :class => cycle('odd', 'even')}
|
|
||||||
# %td
|
|
||||||
# = link_to project do
|
|
||||||
# .table-sort-left= image_tag visibility_icon(project.visibility)
|
|
||||||
# .table-sort-right #{project.owner.uname} / #{project.name}
|
|
||||||
# %td.td2
|
|
||||||
# %span= project.description
|
|
||||||
# %td.buttons
|
|
||||||
# = link_to remove_project_repository_path(@repository, :project_id => project.id), :method => :delete, :confirm => t("layout.confirm") do
|
|
||||||
# %span.delete
|
|
||||||
%>
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
%h3.fix= t("layout.projects.list_header")
|
%h3.fix= t("layout.projects.list_header")
|
||||||
= link_to t("layout.projects.add"), add_project_repository_path(@repository), :class => 'button'
|
- if can? :add_project, @repository
|
||||||
|
= link_to t("layout.projects.add"), add_project_repository_path(@repository), :class => 'button'
|
||||||
|
|
||||||
= render :partial => 'proj_list'#, :object => @projects
|
= render :partial => 'proj_list'#, :object => @projects
|
||||||
=# will_paginate @projects
|
=# will_paginate @projects
|
||||||
|
|
|
@ -39,7 +39,9 @@ en:
|
||||||
flash:
|
flash:
|
||||||
platform:
|
platform:
|
||||||
saved: Platform saved
|
saved: Platform saved
|
||||||
|
created: Platform created
|
||||||
save_error: Platform saves error
|
save_error: Platform saves error
|
||||||
|
create_error: Platform create error
|
||||||
freezed: Platform freezed
|
freezed: Platform freezed
|
||||||
freeze_error: Platform freezing error, try again
|
freeze_error: Platform freezing error, try again
|
||||||
unfreezed: Platform unfreezed
|
unfreezed: Platform unfreezed
|
||||||
|
|
|
@ -38,8 +38,10 @@ ru:
|
||||||
|
|
||||||
flash:
|
flash:
|
||||||
platform:
|
platform:
|
||||||
saved: Платформа успешно добавлена
|
saved: Платформа успешно сохранена
|
||||||
save_error: Не удалось создать платформу
|
created: Платформа успешно добавлена
|
||||||
|
save_error: Не удалось сохранить платформу
|
||||||
|
create_error: Не удалось создать платформу
|
||||||
freezed: Платформа успешно заморожена
|
freezed: Платформа успешно заморожена
|
||||||
freeze_error: Не удалось заморозить платформу, попробуйте еще раз
|
freeze_error: Не удалось заморозить платформу, попробуйте еще раз
|
||||||
unfreezed: Платформа успешно разморожена
|
unfreezed: Платформа успешно разморожена
|
||||||
|
|
Loading…
Reference in New Issue