Merge pull request #218 from warpc/217-product_abilities
[Fix #217] * Add local admin ability to build product * Fix template links * Refactor
This commit is contained in:
commit
3715331021
|
@ -80,6 +80,7 @@ class Ability
|
|||
can :read, Product, :platform => {:owner_type => 'User', :owner_id => user.id}
|
||||
can :read, Product, :platform => {:owner_type => 'Group', :owner_id => user.group_ids}
|
||||
can(:manage, Product, read_relations_for('products', 'platforms')) {|product| local_admin? product.platform}
|
||||
can(:create, ProductBuildList) {|pbl| pbl.product.can_build? and can?(:update, pbl.product)}
|
||||
|
||||
can [:read, :platforms], Category
|
||||
|
||||
|
|
|
@ -26,11 +26,13 @@
|
|||
= t("layout.#{@product.system_wide?}_")
|
||||
|
||||
.wat-cf
|
||||
= link_to image_tag("web-app-theme/icons/application_edit.png", :alt => t("layout.edit")) + " " + t("layout.edit"), edit_platform_product_path(@platform, @product), :class => "button"
|
||||
= link_to image_tag("web-app-theme/icons/cross.png", :alt => t("layout.delete")) + " " + t("layout.delete"), platform_product_path(@platform, @product), :method => "delete", :class => "button", :confirm => t("layout.products.confirm_delete")
|
||||
- if can? :update, @product
|
||||
= link_to image_tag("web-app-theme/icons/application_edit.png", :alt => t("layout.edit")) + " " + t("layout.edit"), edit_platform_product_path(@platform, @product), :class => "button"
|
||||
- if can? :destroy, @product
|
||||
= link_to image_tag("web-app-theme/icons/cross.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?
|
||||
= link_to t("layout.products.clone"), clone_platform_product_path(@platform, @product), :class => "button"
|
||||
- if @product.can_build?
|
||||
- if can?(:create, @product => ProductBuildList)
|
||||
= link_to t("layout.products.build"), platform_product_product_build_lists_path(@platform, @product), :class => "button", :method => 'post', :confirm => t("layout.confirm")
|
||||
|
||||
.block
|
||||
|
|
Loading…
Reference in New Issue