spree_backend 3.0.0.rc1 → 3.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/spree/admin/general_settings_controller.rb +3 -3
  3. data/app/controllers/spree/admin/resource_controller.rb +121 -118
  4. data/app/controllers/spree/admin/roles_controller.rb +6 -0
  5. data/app/controllers/spree/admin/search_controller.rb +9 -9
  6. data/app/controllers/spree/admin/users_controller.rb +4 -0
  7. data/app/helpers/spree/admin/base_helper.rb +5 -0
  8. data/app/helpers/spree/admin/navigation_helper.rb +1 -1
  9. data/app/models/spree/admin/resource.rb +33 -0
  10. data/app/views/kaminari/_paginator.html.erb +7 -7
  11. data/app/views/spree/admin/adjustments/_adjustment.html.erb +2 -2
  12. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +10 -8
  13. data/app/views/spree/admin/adjustments/edit.html.erb +1 -1
  14. data/app/views/spree/admin/adjustments/index.html.erb +6 -6
  15. data/app/views/spree/admin/adjustments/new.html.erb +1 -1
  16. data/app/views/spree/admin/countries/index.html.erb +4 -4
  17. data/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb +1 -1
  18. data/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +2 -2
  19. data/app/views/spree/admin/customer_returns/edit.html.erb +3 -3
  20. data/app/views/spree/admin/customer_returns/index.html.erb +5 -5
  21. data/app/views/spree/admin/customer_returns/new.html.erb +1 -1
  22. data/app/views/spree/admin/general_settings/edit.html.erb +9 -9
  23. data/app/views/spree/admin/images/edit.html.erb +1 -1
  24. data/app/views/spree/admin/images/index.html.erb +7 -5
  25. data/app/views/spree/admin/images/new.html.erb +1 -1
  26. data/app/views/spree/admin/option_types/index.html.erb +2 -2
  27. data/app/views/spree/admin/orders/_form.html.erb +4 -4
  28. data/app/views/spree/admin/orders/_line_item.html.erb +1 -1
  29. data/app/views/spree/admin/orders/_line_items_edit_form.html.erb +2 -2
  30. data/app/views/spree/admin/orders/customer_details/_form.html.erb +31 -21
  31. data/app/views/spree/admin/orders/customer_details/edit.html.erb +13 -11
  32. data/app/views/spree/admin/orders/edit.html.erb +2 -2
  33. data/app/views/spree/admin/orders/index.html.erb +5 -5
  34. data/app/views/spree/admin/payment_methods/index.html.erb +6 -6
  35. data/app/views/spree/admin/payments/_list.html.erb +2 -2
  36. data/app/views/spree/admin/payments/index.html.erb +1 -1
  37. data/app/views/spree/admin/payments/new.html.erb +1 -1
  38. data/app/views/spree/admin/product_properties/_product_property_fields.html.erb +2 -2
  39. data/app/views/spree/admin/product_properties/index.html.erb +6 -6
  40. data/app/views/spree/admin/products/_autocomplete.js.erb +1 -1
  41. data/app/views/spree/admin/products/_form.html.erb +36 -12
  42. data/app/views/spree/admin/products/index.html.erb +2 -2
  43. data/app/views/spree/admin/products/new.html.erb +1 -1
  44. data/app/views/spree/admin/products/stock.html.erb +10 -8
  45. data/app/views/spree/admin/promotion_categories/index.html.erb +2 -2
  46. data/app/views/spree/admin/promotions/index.html.erb +2 -2
  47. data/app/views/spree/admin/promotions/rules/_first_order.html.erb +0 -0
  48. data/app/views/spree/admin/properties/index.html.erb +2 -2
  49. data/app/views/spree/admin/prototypes/_form.html.erb +0 -5
  50. data/app/views/spree/admin/prototypes/index.html.erb +2 -2
  51. data/app/views/spree/admin/refund_reasons/index.html.erb +3 -2
  52. data/app/views/spree/admin/refunds/edit.html.erb +1 -1
  53. data/app/views/spree/admin/refunds/new.html.erb +1 -1
  54. data/app/views/spree/admin/reimbursement_types/index.html.erb +2 -3
  55. data/app/views/spree/admin/return_authorization_reasons/index.html.erb +3 -2
  56. data/app/views/spree/admin/return_authorizations/edit.html.erb +1 -1
  57. data/app/views/spree/admin/return_authorizations/index.html.erb +4 -4
  58. data/app/views/spree/admin/return_authorizations/new.html.erb +1 -1
  59. data/app/views/spree/admin/roles/_form.html.erb +8 -0
  60. data/app/views/spree/admin/roles/edit.html.erb +10 -0
  61. data/app/views/spree/admin/roles/index.html.erb +34 -0
  62. data/app/views/spree/admin/roles/new.html.erb +10 -0
  63. data/app/views/spree/admin/shared/_address.html.erb +38 -0
  64. data/app/views/spree/admin/shared/_address_form.html.erb +2 -2
  65. data/app/views/spree/admin/shared/_head.html.erb +2 -2
  66. data/app/views/spree/admin/shared/_index_table_options.html.erb +2 -2
  67. data/app/views/spree/admin/shared/_order_tabs.html.erb +6 -6
  68. data/app/views/spree/admin/shared/_product_tabs.html.erb +3 -3
  69. data/app/views/spree/admin/shared/_refunds.html.erb +1 -1
  70. data/app/views/spree/admin/shared/named_types/_index.html.erb +3 -3
  71. data/app/views/spree/admin/shared/sub_menu/_configuration.html.erb +17 -16
  72. data/app/views/spree/admin/shipping_categories/index.html.erb +6 -6
  73. data/app/views/spree/admin/shipping_methods/index.html.erb +6 -6
  74. data/app/views/spree/admin/state_changes/index.html.erb +1 -1
  75. data/app/views/spree/admin/states/_state_list.html.erb +2 -2
  76. data/app/views/spree/admin/states/index.html.erb +2 -2
  77. data/app/views/spree/admin/stock_locations/_form.html.erb +2 -3
  78. data/app/views/spree/admin/stock_locations/index.html.erb +6 -7
  79. data/app/views/spree/admin/stock_movements/index.html.erb +1 -1
  80. data/app/views/spree/admin/stock_transfers/index.html.erb +5 -5
  81. data/app/views/spree/admin/stock_transfers/show.html.erb +2 -2
  82. data/app/views/spree/admin/tax_categories/index.html.erb +7 -7
  83. data/app/views/spree/admin/tax_rates/index.html.erb +6 -6
  84. data/app/views/spree/admin/taxonomies/index.html.erb +2 -2
  85. data/app/views/spree/admin/taxons/edit.html.erb +2 -2
  86. data/app/views/spree/admin/trackers/index.html.erb +5 -5
  87. data/app/views/spree/admin/users/_sidebar.html.erb +4 -4
  88. data/app/views/spree/admin/users/addresses.html.erb +2 -2
  89. data/app/views/spree/admin/users/edit.html.erb +2 -2
  90. data/app/views/spree/admin/users/index.html.erb +1 -1
  91. data/app/views/spree/admin/users/items.html.erb +1 -1
  92. data/app/views/spree/admin/users/new.html.erb +1 -1
  93. data/app/views/spree/admin/users/orders.html.erb +1 -1
  94. data/app/views/spree/admin/variants/index.html.erb +17 -13
  95. data/app/views/spree/admin/zones/index.html.erb +5 -5
  96. data/config/routes.rb +1 -0
  97. metadata +14 -6
@@ -30,11 +30,11 @@
30
30
 
31
31
  <div class="col-md-4" data-hook="admin_product_form_right">
32
32
  <div data-hook="admin_product_form_price">
33
- <%= f.field_container :price, class: ['form-group'] do %>
34
- <%= f.label :price, raw(Spree.t(:master_price) + content_tag(:span, ' *', class: "required")) %>
35
- <%= f.text_field :price, value: number_to_currency(@product.price, unit: ''), class: 'form-control' %>
36
- <%= f.error_message_on :price %>
37
- <% end %>
33
+ <%= f.field_container :price, class: ['form-group'] do %>
34
+ <%= f.label :price, raw(Spree.t(:master_price) + content_tag(:span, ' *', class: "required")) %>
35
+ <%= f.text_field :price, value: number_to_currency(@product.price, unit: ''), class: 'form-control', disabled: (cannot? :update, Spree::Price) %>
36
+ <%= f.error_message_on :price %>
37
+ <% end %>
38
38
  </div>
39
39
 
40
40
  <div data-hook="admin_product_form_cost_price" class="alpha two columns">
@@ -78,7 +78,7 @@
78
78
  </div>
79
79
  <div class="info-actions">
80
80
  <% if can?(:admin, Spree::Variant) %>
81
- <%= link_to_with_icon 'variants', 'Manage Variants', admin_product_variants_url(@product), class: "btn btn-default" %>
81
+ <%= link_to_with_icon 'variants', 'Manage Variants', spree.admin_product_variants_url(@product), class: "btn btn-default" %>
82
82
  <% end %>
83
83
  </div>
84
84
  </div>
@@ -109,9 +109,9 @@
109
109
  <div id="shipping_specs_width_field" data-hook="admin_product_form_width" class="form-group">
110
110
  <%= f.label :width, Spree.t(:width) %>
111
111
  <%= f.text_field :width, size: 4, class: 'form-control' %>
112
- </div>
112
+ </div>
113
113
  </div>
114
-
114
+
115
115
  <div class="col-md-6">
116
116
  <div id="shipping_specs_depth_field" data-hook="admin_product_form_depth" class="form-group">
117
117
  <%= f.label :depth, Spree.t(:depth) %>
@@ -124,7 +124,7 @@
124
124
  <div data-hook="admin_product_form_shipping_categories">
125
125
  <%= f.field_container :shipping_categories, class: ['form-group'] do %>
126
126
  <%= f.label :shipping_category_id, Spree.t(:shipping_categories) %>
127
- <%= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2' }) %>
127
+ <%= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2', disabled: (cannot? :edit, Spree::ShippingCategory) }) %>
128
128
  <%= f.error_message_on :shipping_category %>
129
129
  <% end %>
130
130
  </div>
@@ -132,7 +132,7 @@
132
132
  <div data-hook="admin_product_form_tax_category">
133
133
  <%= f.field_container :tax_category, class: ['form-group'] do %>
134
134
  <%= f.label :tax_category_id, Spree.t(:tax_category) %>
135
- <%= f.collection_select(:tax_category_id, @tax_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2' }) %>
135
+ <%= f.collection_select(:tax_category_id, @tax_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2', disabled: (cannot? :edit, Spree::TaxCategory) }) %>
136
136
  <%= f.error_message_on :tax_category %>
137
137
  <% end %>
138
138
  </div>
@@ -143,14 +143,38 @@
143
143
  <div data-hook="admin_product_form_taxons">
144
144
  <%= f.field_container :taxons, class: ['form-group'] do %>
145
145
  <%= f.label :taxon_ids, Spree.t(:taxons) %>
146
- <%= f.hidden_field :taxon_ids, value: @product.taxon_ids.join(',') %>
146
+
147
+ <% if can? :modify, Spree::Classification %>
148
+ <%= f.hidden_field :taxon_ids, value: @product.taxon_ids.join(',') %>
149
+ <% elsif @product.taxons.any? %>
150
+ <ul class="text_list">
151
+ <% @product.taxons.each do |taxon| %>
152
+ <li><%= taxon.name %></li>
153
+ <% end %>
154
+ </ul>
155
+ <% else %>
156
+ <div class="alert alert-info"><%= Spree.t(:no_resource_found, resource: :taxons) %></div>
157
+ <% end %>
158
+
147
159
  <% end %>
148
160
  </div>
149
161
 
150
162
  <div data-hook="admin_product_form_option_types">
151
163
  <%= f.field_container :option_types, class: ['form-group'] do %>
152
164
  <%= f.label :option_type_ids, Spree.t(:option_types) %>
153
- <%= f.hidden_field :option_type_ids, value: @product.option_type_ids.join(',') %>
165
+
166
+ <% if can? :modify, Spree::OptionType %>
167
+ <%= f.hidden_field :option_type_ids, value: @product.option_type_ids.join(',') %>
168
+ <% elsif @product.option_types.any? %>
169
+ <ul class="text_list">
170
+ <% @product.option_types.each do |type| %>
171
+ <li><%= type.presentation %> (<%= type.name %>)</li>
172
+ <% end %>
173
+ </ul>
174
+ <% else %>
175
+ <div class="alert alert-info"><%= Spree.t(:no_resource_found, resource: :option_types) %></div>
176
+ <% end %>
177
+
154
178
  <% end %>
155
179
  </div>
156
180
 
@@ -1,5 +1,5 @@
1
1
  <% content_for :page_title do %>
2
- <%= Spree::Product.model_name.human(count: :many) %>
2
+ <%= plural_resource_name(Spree::Product) %>
3
3
  <% end %>
4
4
 
5
5
  <% content_for :page_actions do %>
@@ -73,7 +73,7 @@
73
73
  </table>
74
74
  <% else %>
75
75
  <div class="alert alert-info no-objects-found">
76
- <%= Spree.t(:no_resource_found, resource: Spree::Product.model_name.human(count: :many)) %>,
76
+ <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Product)) %>,
77
77
  <%= link_to Spree.t(:add_one), new_object_url %>!
78
78
  </div>
79
79
  <% end %>
@@ -68,7 +68,7 @@
68
68
  <script type="text/javascript">
69
69
  //<![CDATA[
70
70
  (function($){
71
- var base_url = "<%= admin_prototypes_url %>";
71
+ var base_url = "<%= spree.admin_prototypes_url %>";
72
72
  var prototype_select = $('#product_prototype_id');
73
73
  prototype_select.change(function() {
74
74
  var id = prototype_select.val();
@@ -1,9 +1,11 @@
1
1
  <%= render :partial => 'spree/admin/shared/product_tabs', :locals => { :current => 'Stock Management' } %>
2
2
  <%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @product } %>
3
3
 
4
- <div id="add_stock_form" class="panel panel-default">
5
- <%= render 'add_stock_form' %>
6
- </div>
4
+ <% if can? :create, Spree::StockMovement %>
5
+ <div id="add_stock_form" class="panel panel-default">
6
+ <%= render 'add_stock_form' %>
7
+ </div>
8
+ <% end %>
7
9
 
8
10
  <div class="panel panel-default">
9
11
  <table class="table table-bordered" id="listing_product_stock">
@@ -24,7 +26,7 @@
24
26
  </td>
25
27
  <td>
26
28
  <%= variant.sku_and_options_text %>
27
- <%= form_tag admin_product_variants_including_master_path(@product, variant, format: :js), method: :put, class: 'toggle_variant_track_inventory' do %>
29
+ <%= form_tag admin_product_variants_including_master_path(@product, variant, format: :js), method: :post, class: 'toggle_variant_track_inventory' do %>
28
30
  <div class="checkbox">
29
31
  <%= label_tag :track_inventory do %>
30
32
  <%= check_box_tag 'track_inventory', 1, variant.track_inventory?,
@@ -35,7 +37,7 @@
35
37
  <%= hidden_field_tag 'variant[track_inventory]', variant.track_inventory?,
36
38
  class: 'variant_track_inventory',
37
39
  id: "variant_track_inventory_#{variant.id}" %>
38
- <% end %>
40
+ <% end if can?(:update, @product) && can?(:update, variant) %>
39
41
  </td>
40
42
 
41
43
  <td colspan="3" class="stock_location_info">
@@ -58,10 +60,10 @@
58
60
  item.backorderable?,
59
61
  class: 'stock_item_backorderable',
60
62
  id: "stock_item_backorderable_#{item.stock_location.id}" %>
61
- <% end %>
63
+ <% end if can? :update, item %>
62
64
  </td>
63
65
  <td class="actions actions-1 text-center">
64
- <%= link_to_with_icon 'delete', Spree.t(:remove), [:admin, item], method: :delete, remote: true, class: 'icon_link btn btn-danger btn-sm', data: { action: :remove, confirm: Spree.t(:are_you_sure) }, no_text: true %>
66
+ <%= link_to_with_icon('delete', Spree.t(:remove), [:admin, item], method: :delete, remote: true, class: 'icon_link btn btn-danger btn-sm', data: { action: :remove, confirm: Spree.t(:are_you_sure) }, no_text: true) if can? :destroy, item %>
65
67
  </td>
66
68
  </tr>
67
69
  <% end %>
@@ -73,4 +75,4 @@
73
75
  <% end %>
74
76
  </tbody>
75
77
  </table>
76
- </div>
78
+ </div>
@@ -1,5 +1,5 @@
1
1
  <% content_for :page_title do %>
2
- <%= Spree::PromotionCategory.model_name.human(count: :many) %>
2
+ <%= plural_resource_name(Spree::PromotionCategory) %>
3
3
  <% end %>
4
4
 
5
5
  <% content_for :page_actions do %>
@@ -28,7 +28,7 @@
28
28
  </table>
29
29
  <% else %>
30
30
  <div class="alert alert-info no-objects-found">
31
- <%= Spree.t(:no_resource_found, resource: Spree::PromotionCategory.model_name.human(count: :many)) %>,
31
+ <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::PromotionCategory)) %>,
32
32
  <%= link_to Spree.t(:add_one), new_object_url %>!
33
33
  </div>
34
34
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :page_title do %>
2
- <%= Spree::Promotion.model_name.human(count: :many) %>
2
+ <%= plural_resource_name(Spree::Promotion) %>
3
3
  <% end %>
4
4
 
5
5
  <% content_for :page_actions do %>
@@ -76,7 +76,7 @@
76
76
  </table>
77
77
  <% else %>
78
78
  <div class="alert alert-info no-objects-found">
79
- <%= Spree.t(:no_resource_found, resource: Spree::Promotion.model_name.human(count: :many)) %>,
79
+ <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Promotion)) %>,
80
80
  <%= link_to Spree.t(:add_one), new_object_url %>!
81
81
  </div>
82
82
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :page_title do %>
2
- <%= Spree::Property.model_name.human(count: :many) %>
2
+ <%= plural_resource_name(Spree::Property) %>
3
3
  <% end %>
4
4
 
5
5
  <% content_for :page_actions do %>
@@ -60,7 +60,7 @@
60
60
  </table>
61
61
  <% else %>
62
62
  <div class="alert alert-info no-objects-found">
63
- <%= Spree.t(:no_resource_found, resource: Spree::Property.model_name.human(count: :many)) %>,
63
+ <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Property)) %>,
64
64
  <%= link_to Spree.t(:add_one), new_object_url %>!
65
65
  </div>
66
66
  <% end %>
@@ -25,9 +25,4 @@
25
25
  <%= f.select :taxon_ids, Spree::Taxon.all.map { |t| [t.name, t.id] }, {}, { multiple: true, class: "select2" } %>
26
26
  <% end %>
27
27
  </div>
28
-
29
- <%= f.field_container :option_type_ids, class: ['form-group'] do %>
30
- <%= f.label :option_type_ids, Spree.t(:option_types) %>
31
- <%= f.select :option_type_ids, Spree::OptionType.all.map { |ot| [ot.presentation, ot.id] }, {}, { multiple: true, class: "select2" } %>
32
- <% end %>
33
28
  </div>
@@ -1,5 +1,5 @@
1
1
  <% content_for :page_title do %>
2
- <%= Spree::Prototype.model_name.human(count: :many) %>
2
+ <%= plural_resource_name(Spree::Prototype) %>
3
3
  <% end %>
4
4
 
5
5
  <% content_for :page_actions do %>
@@ -28,7 +28,7 @@
28
28
  </table>
29
29
  <% else %>
30
30
  <div class="alert alert-info no-objects-found">
31
- <%= Spree.t(:no_resource_found, resource: Spree::Prototype.model_name.human(count: :many)) %>,
31
+ <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Prototype)) %>,
32
32
  <%= link_to Spree.t(:add_one), new_object_url %>!
33
33
  </div>
34
34
  <% end %>
@@ -1,5 +1,6 @@
1
1
  <%= render partial: 'spree/admin/shared/named_types/index', locals: {
2
- page_title: Spree::RefundReason.model_name.human(count: :many),
2
+ page_title: plural_resource_name(Spree::RefundReason),
3
3
  new_button_text: Spree.t(:new_refund_reason),
4
- resource_name: Spree::RefundReason.model_name.human(count: :many)
4
+ resource_name: plural_resource_name(Spree::RefundReason),
5
+ resource: Spree::RefundReason
5
6
  } %>
@@ -21,7 +21,7 @@
21
21
  <div class="form-actions" data-hook="buttons">
22
22
  <%= button Spree.t('actions.save'), 'save' %>
23
23
  <span class="or"><%= Spree.t(:or) %></span>
24
- <%= button_link_to Spree.t('actions.cancel'), admin_order_payments_url(@refund.payment.order), :icon => "delete" %>
24
+ <%= button_link_to Spree.t('actions.cancel'), spree.admin_order_payments_url(@refund.payment.order), :icon => "delete" %>
25
25
  </div>
26
26
  </fieldset>
27
27
  <% end %>
@@ -29,7 +29,7 @@
29
29
  <div class="form-actions" data-hook="buttons">
30
30
  <%= button Spree.t(:refund), 'save' %>
31
31
  <span class="or"><%= Spree.t(:or) %></span>
32
- <%= button_link_to Spree.t('actions.cancel'), admin_order_payments_url(@refund.payment.order), :icon => "delete" %>
32
+ <%= button_link_to Spree.t('actions.cancel'), spree.admin_order_payments_url(@refund.payment.order), :icon => "delete" %>
33
33
  </div>
34
34
  </fieldset>
35
35
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :page_title do %>
2
- <%= Spree::ReimbursementType.model_name.human(count: :many) %>
2
+ <%= plural_resource_name(Spree::ReimbursementType) %>
3
3
  <% end %>
4
4
 
5
5
  <% if @reimbursement_types.any? %>
@@ -25,7 +25,6 @@
25
25
  </table>
26
26
  <% else %>
27
27
  <div class="alert alert-info no-objects-found">
28
- <%= Spree.t(:no_resource_found, resource: Spree::ReimbursementType.model_name.human(count: :many)) %>,
29
- <%= link_to Spree.t(:add_one), new_object_url %>!
28
+ <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::ReimbursementType)) %>
30
29
  </div>
31
30
  <% end %>
@@ -1,5 +1,6 @@
1
1
  <%= render partial: 'spree/admin/shared/named_types/index', locals: {
2
- page_title: Spree::ReturnAuthorizationReason.model_name.human(count: :many),
2
+ page_title: plural_resource_name(Spree::ReturnAuthorizationReason),
3
3
  new_button_text: Spree.t(:new_rma_reason),
4
- resource_name: Spree::ReturnAuthorizationReason.model_name.human(count: :many)
4
+ resource_name: plural_resource_name(Spree::ReturnAuthorizationReason),
5
+ resource: Spree::RefundReason
5
6
  } %>
@@ -24,7 +24,7 @@
24
24
  <div class="form-actions" data-hook="buttons">
25
25
  <%= button Spree.t('actions.update'), 'repeat' %>
26
26
  <span class="or"><%= Spree.t(:or) %></span>
27
- <%= button_link_to Spree.t('actions.cancel'), admin_order_return_authorizations_url(@order), :icon => 'delete' %>
27
+ <%= button_link_to Spree.t('actions.cancel'), spree.admin_order_return_authorizations_url(@order), :icon => 'delete' %>
28
28
  </div>
29
29
  </fieldset>
30
30
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <%= render :partial => 'spree/admin/shared/order_tabs', :locals => { :current => 'Return Authorizations' } %>
2
2
 
3
3
  <% content_for :page_actions do %>
4
- <% if @order.shipments.any? &:shipped? %>
4
+ <% if @order.shipments.any?(&:shipped?) && can?(:create, Spree::ReturnAuthorization) %>
5
5
  <%= button_link_to Spree.t(:new_return_authorization), new_admin_order_return_authorization_url(@order), :class => "btn-success", :icon => 'add' %>
6
6
  <% end %>
7
7
  <% end %>
@@ -29,8 +29,8 @@
29
29
  <td><%= return_authorization.display_pre_tax_total.to_html %></td>
30
30
  <td><%= pretty_time(return_authorization.created_at) %></td>
31
31
  <td class="actions actions-2">
32
- <%= link_to_edit return_authorization, :no_text => true, :class => 'edit' %>
33
- <% unless return_authorization.customer_returned_items? %>
32
+ <%= link_to_edit(return_authorization, :no_text => true, :class => 'edit') if can?(:edit, return_authorization) %>
33
+ <% if can?(:delete, return_authorization) && !return_authorization.customer_returned_items? %>
34
34
  <%= link_to_delete return_authorization, :no_text => true %>
35
35
  <% end %>
36
36
  </td>
@@ -40,7 +40,7 @@
40
40
  </table>
41
41
  <% elsif @order.shipments.any?(&:shipped?) %>
42
42
  <div class="alert alert-info no-objects-found">
43
- <%= Spree.t(:no_resource_found, resource: Spree::ReturnAuthorization.model_name.human(count: :many)) %>
43
+ <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::ReturnAuthorization)) %>
44
44
  </div>
45
45
  <% else %>
46
46
  <div data-hook="rma_cannont_create" class="alert alert-info no-objects-found">
@@ -12,7 +12,7 @@
12
12
  <div class="form-actions" data-hook="buttons">
13
13
  <%= button Spree.t(:create), 'save' %>
14
14
  <span class="or"><%= Spree.t(:or) %></span>
15
- <%= button_link_to Spree.t('actions.cancel'), admin_order_return_authorizations_url(@order), :icon => 'delete' %>
15
+ <%= button_link_to Spree.t('actions.cancel'), spree.admin_order_return_authorizations_url(@order), :icon => 'delete' %>
16
16
  </div>
17
17
  </fieldset>
18
18
  <% end %>
@@ -0,0 +1,8 @@
1
+ <div data-hook="admin_role_form_fields">
2
+ <div data-hook="role_name" class="form-group">
3
+ <%= f.label :name, Spree.t(:name) %> <span class="required">*</span>
4
+ <%= f.text_field :name, class: 'form-control' %>
5
+ </div>
6
+
7
+ <div data-hook="additional_role_fields"></div>
8
+ </div>
@@ -0,0 +1,10 @@
1
+ <% content_for :page_title do %>
2
+ <%= Spree.t(:editing_resource, resource: Spree::Role.model_name.human) %>
3
+ <% end %>
4
+
5
+ <%= form_for [:admin, @role] do |f| %>
6
+ <fieldset>
7
+ <%= render partial: 'form', locals: { f: f } %>
8
+ <%= render partial: 'spree/admin/shared/new_resource_links' %>
9
+ </fieldset>
10
+ <% end %>
@@ -0,0 +1,34 @@
1
+ <% content_for :page_title do %>
2
+ <%= Spree.t(:roles) %>
3
+ <% end %>
4
+
5
+ <% content_for :page_actions do %>
6
+ <%= button_link_to Spree.t(:new_role), new_object_url, class: "btn-success", icon: 'add', id: 'admin_new_role_link' if can? :create, Spree::Role %>
7
+ <% end if can? :create, Spree::Role %>
8
+
9
+ <% if @roles.any? %>
10
+ <table class="table">
11
+ <thead>
12
+ <tr data-hook="admin_roles_index_headers">
13
+ <th><%= Spree.t(:role_id) %></th>
14
+ <th class="actions"></th>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <% @roles.each do |role|%>
19
+ <tr id="<%= spree_dom_id role %>" data-hook="admin_roles_index_rows">
20
+ <td><%= role.name %></td>
21
+ <td class="actions text-right">
22
+ <%= link_to_edit(role, no_text: true) if can? :edit, role %>
23
+ <%= link_to_delete(role, no_text: true) if can? :destroy, role %>
24
+ </td>
25
+ </tr>
26
+ <% end %>
27
+ </tbody>
28
+ </table>
29
+ <% else %>
30
+ <div class="alert alert-warning">
31
+ <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Role)) %>,
32
+ <%= link_to(Spree.t(:add_one), new_object_url) if can? :create, Spree::Role %>!
33
+ </div>
34
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <% content_for :page_title do %>
2
+ <%= Spree.t(:new_role) %>
3
+ <% end %>
4
+
5
+ <%= form_for [:admin, @role] do |f| %>
6
+ <fieldset>
7
+ <%= render partial: 'form', locals: { f: f } %>
8
+ <%= render partial: 'spree/admin/shared/new_resource_links' %>
9
+ </fieldset>
10
+ <% end %>
@@ -0,0 +1,38 @@
1
+ <div class="address vcard">
2
+ <div class="fn"><%= address.full_name %></div>
3
+ <% unless address.company.blank? %>
4
+ <div class="org">
5
+ <%= address.company %>
6
+ </div>
7
+ <% end %>
8
+ <div class="adr">
9
+ <div class="street-address">
10
+ <div class="street-address-line">
11
+ <%= address.address1 %>
12
+ </div>
13
+ <% unless address.address2.blank? %>
14
+ <div class="street-address-line">
15
+ <%= address.address2 %>
16
+ </div>
17
+ <% end %>
18
+ </div>
19
+ <div class="local">
20
+ <span class="locality"><%= address.city %></span>
21
+ <span class="region"><%= address.state_text %></span>
22
+ <span class="postal-code"><%= address.zipcode %></span>
23
+ <div class="country-name"><%= address.country.try(:name) %></div>
24
+ </div>
25
+ </div>
26
+ <% unless address.phone.blank? %>
27
+ <div class="tel">
28
+ <span class="type"><%= Spree.t(:phone) %></span>
29
+ <%= address.phone %>
30
+ </div>
31
+ <% end %>
32
+ <% unless address.alternative_phone.blank? %>
33
+ <div class="alternative-phone tel">
34
+ <span class="type"><%= Spree.t(:alternative_phone) %></span>
35
+ <%= address.alternative_phone %>
36
+ </div>
37
+ <% end %>
38
+ </div>
@@ -62,9 +62,9 @@
62
62
  </div>
63
63
 
64
64
  <% content_for :head do %>
65
- <%= javascript_tag do -%>
65
+ <%= javascript_tag do %>
66
66
  $(document).ready(function(){
67
67
  $('span#<%= s_or_b %>country .select2').on('change', function() { update_state('<%= s_or_b %>'); });
68
68
  });
69
- <% end -%>
69
+ <% end %>
70
70
  <% end %>
@@ -18,8 +18,8 @@
18
18
  <%= javascript_include_tag 'spree/backend/all' %>
19
19
  <%= render "spree/admin/shared/translations" %>
20
20
 
21
- <%= javascript_tag do -%>
21
+ <%= javascript_tag do %>
22
22
  <%== "var AUTH_TOKEN = #{form_authenticity_token.inspect};" %>
23
- <% end -%>
23
+ <% end %>
24
24
 
25
25
  <%= yield :head %>
@@ -13,11 +13,11 @@
13
13
  </div>
14
14
 
15
15
  <% content_for :head do %>
16
- <%= javascript_tag do -%>
16
+ <%= javascript_tag do %>
17
17
  $(document).ready(function() {
18
18
  $("#js-per-page-select").change(function() {
19
19
  $("#js-per-page-form").submit();
20
20
  });
21
21
  });
22
- <% end -%>
22
+ <% end %>
23
23
  <% end %>
@@ -13,7 +13,7 @@
13
13
 
14
14
  <% if can?(:update, @order) && @order.checkout_steps.include?("address") %>
15
15
  <li<%== ' class="active"' if current == 'Customer Details' %> data-hook='admin_order_tabs_customer_details'>
16
- <%= link_to_with_icon 'user', Spree.t(:customer), admin_order_customer_url(@order) %>
16
+ <%= link_to_with_icon 'user', Spree.t(:customer), spree.admin_order_customer_url(@order) %>
17
17
  </li>
18
18
  <% end %>
19
19
 
@@ -25,20 +25,20 @@
25
25
 
26
26
  <% if can? :index, Spree::Adjustment %>
27
27
  <li<%== ' class="active"' if current == 'Adjustments' %> data-hook='admin_order_tabs_adjustments'>
28
- <%= link_to_with_icon 'wrench', Spree.t(:adjustments), admin_order_adjustments_url(@order) %>
28
+ <%= link_to_with_icon 'wrench', Spree.t(:adjustments), spree.admin_order_adjustments_url(@order) %>
29
29
  </li>
30
30
  <% end %>
31
31
 
32
32
  <% if can?(:index, Spree::Payment) %>
33
33
  <li<%== ' class="active"' if current == 'Payments' %> data-hook='admin_order_tabs_payments'>
34
- <%= link_to_with_icon 'credit-card', Spree.t(:payments), admin_order_payments_url(@order) %>
34
+ <%= link_to_with_icon 'credit-card', Spree.t(:payments), spree.admin_order_payments_url(@order) %>
35
35
  </li>
36
36
  <% end %>
37
37
 
38
38
  <% if can? :index, Spree::ReturnAuthorization %>
39
39
  <% if @order.completed? %>
40
40
  <li<%== ' class="active"' if current == 'Returns' %> data-hook='admin_order_tabs_return_authorizations'>
41
- <%= link_to_with_icon 'transfer', Spree.t(:returns), admin_order_return_authorizations_url(@order) %>
41
+ <%= link_to_with_icon 'transfer', Spree.t(:returns), spree.admin_order_return_authorizations_url(@order) %>
42
42
  </li>
43
43
  <% end %>
44
44
  <% end %>
@@ -46,14 +46,14 @@
46
46
  <% if can? :index, Spree::CustomerReturn %>
47
47
  <% if @order.completed? %>
48
48
  <li<%== ' class="active"' if current == 'Customer Returns' %>>
49
- <%= link_to_with_icon 'transfer', Spree.t(:customer_returns), admin_order_customer_returns_url(@order) %>
49
+ <%= link_to_with_icon 'transfer', Spree.t(:customer_returns), spree.admin_order_customer_returns_url(@order) %>
50
50
  </li>
51
51
  <% end %>
52
52
  <% end %>
53
53
 
54
54
  <% if can? :update, @order %>
55
55
  <li<%== ' class="active"' if current == 'State Changes' %> data-hook='admin_order_tabs_state_changes'>
56
- <%= link_to_with_icon 'refresh', Spree::StateChange.human_attribute_name(:state_changes), admin_order_state_changes_url(@order) %>
56
+ <%= link_to_with_icon 'refresh', Spree::StateChange.human_attribute_name(:state_changes), spree.admin_order_state_changes_url(@order) %>
57
57
  </li>
58
58
  <% end %>
59
59
  </ul>
@@ -9,13 +9,13 @@
9
9
  <%= link_to_with_icon 'edit', Spree.t(:details), edit_admin_product_url(@product) %>
10
10
  <% end if can?(:admin, Spree::Product) %>
11
11
  <%= content_tag :li, :class => ('active' if current == 'Images') do %>
12
- <%= link_to_with_icon 'picture', Spree.t(:images), admin_product_images_url(@product) %>
12
+ <%= link_to_with_icon 'picture', Spree.t(:images), spree.admin_product_images_url(@product) %>
13
13
  <% end if can?(:admin, Spree::Image) %>
14
14
  <%= content_tag :li, :class => ('active' if current == 'Variants') do %>
15
- <%= link_to_with_icon 'th-large', Spree.t(:variants), admin_product_variants_url(@product) %>
15
+ <%= link_to_with_icon 'th-large', Spree.t(:variants), spree.admin_product_variants_url(@product) %>
16
16
  <% end if can?(:admin, Spree::Variant) %>
17
17
  <%= content_tag :li, :class => ('active' if current == 'Product Properties') do %>
18
- <%= link_to_with_icon 'list-alt', Spree.t(:properties), admin_product_product_properties_url(@product) %>
18
+ <%= link_to_with_icon 'list-alt', Spree.t(:properties), spree.admin_product_product_properties_url(@product) %>
19
19
  <% end if can?(:admin, Spree::ProductProperty) %>
20
20
  <%= content_tag :li, :class => ('active' if current == 'Stock Management') do %>
21
21
  <%= link_to_with_icon 'home', Spree.t(:stock), stock_admin_product_url(@product) %>
@@ -23,7 +23,7 @@
23
23
  <td><%= truncate(refund.reason.name, length: 100) %></td>
24
24
  <% if show_actions %>
25
25
  <td class="actions actions-1">
26
- <%= link_to_with_icon 'edit', Spree.t(:edit), edit_admin_order_payment_refund_path(refund.payment.order, refund.payment, refund), no_text: true, :class => "btn btn-default btn-sm" %>
26
+ <%= link_to_with_icon('edit', Spree.t(:edit), edit_admin_order_payment_refund_path(refund.payment.order, refund.payment, refund), no_text: true, :class => "btn btn-default btn-sm") if can?(:edit, refund) %>
27
27
  </td>
28
28
  <% end %>
29
29
  </tr>
@@ -4,7 +4,7 @@
4
4
 
5
5
  <% content_for :page_actions do %>
6
6
  <%= button_link_to new_button_text, new_object_url, { icon: 'add', id: 'admin_new_named_type', :class => "btn-success" } %>
7
- <% end %>
7
+ <% end if can? :create, resource %>
8
8
 
9
9
  <% if @collection.any? %>
10
10
  <table class="table" id='listing_named_types' data-hook>
@@ -26,7 +26,7 @@
26
26
  </td>
27
27
  <td class="actions actions-1 text-right">
28
28
  <% if named_type.mutable? %>
29
- <%= link_to_edit named_type, no_text: true %>
29
+ <%= link_to_edit(named_type, no_text: true) if can? :edit, named_type %>
30
30
  <% end %>
31
31
  </td>
32
32
  </tr>
@@ -36,6 +36,6 @@
36
36
  <% else %>
37
37
  <div class="alert alert-info no-objects-found">
38
38
  <%= Spree.t(:no_resource_found, resource: resource_name) %>,
39
- <%= link_to Spree.t(:add_one), new_object_url %>!
39
+ <%= link_to(Spree.t(:add_one), new_object_url) if can? :create, resource %>!
40
40
  </div>
41
41
  <% end %>