spree_backend 3.0.0.rc1 → 3.0.0.rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/spree/admin/general_settings_controller.rb +3 -3
- data/app/controllers/spree/admin/resource_controller.rb +121 -118
- data/app/controllers/spree/admin/roles_controller.rb +6 -0
- data/app/controllers/spree/admin/search_controller.rb +9 -9
- data/app/controllers/spree/admin/users_controller.rb +4 -0
- data/app/helpers/spree/admin/base_helper.rb +5 -0
- data/app/helpers/spree/admin/navigation_helper.rb +1 -1
- data/app/models/spree/admin/resource.rb +33 -0
- data/app/views/kaminari/_paginator.html.erb +7 -7
- data/app/views/spree/admin/adjustments/_adjustment.html.erb +2 -2
- data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +10 -8
- data/app/views/spree/admin/adjustments/edit.html.erb +1 -1
- data/app/views/spree/admin/adjustments/index.html.erb +6 -6
- data/app/views/spree/admin/adjustments/new.html.erb +1 -1
- data/app/views/spree/admin/countries/index.html.erb +4 -4
- data/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb +1 -1
- data/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +2 -2
- data/app/views/spree/admin/customer_returns/edit.html.erb +3 -3
- data/app/views/spree/admin/customer_returns/index.html.erb +5 -5
- data/app/views/spree/admin/customer_returns/new.html.erb +1 -1
- data/app/views/spree/admin/general_settings/edit.html.erb +9 -9
- data/app/views/spree/admin/images/edit.html.erb +1 -1
- data/app/views/spree/admin/images/index.html.erb +7 -5
- data/app/views/spree/admin/images/new.html.erb +1 -1
- data/app/views/spree/admin/option_types/index.html.erb +2 -2
- data/app/views/spree/admin/orders/_form.html.erb +4 -4
- data/app/views/spree/admin/orders/_line_item.html.erb +1 -1
- data/app/views/spree/admin/orders/_line_items_edit_form.html.erb +2 -2
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +31 -21
- data/app/views/spree/admin/orders/customer_details/edit.html.erb +13 -11
- data/app/views/spree/admin/orders/edit.html.erb +2 -2
- data/app/views/spree/admin/orders/index.html.erb +5 -5
- data/app/views/spree/admin/payment_methods/index.html.erb +6 -6
- data/app/views/spree/admin/payments/_list.html.erb +2 -2
- data/app/views/spree/admin/payments/index.html.erb +1 -1
- data/app/views/spree/admin/payments/new.html.erb +1 -1
- data/app/views/spree/admin/product_properties/_product_property_fields.html.erb +2 -2
- data/app/views/spree/admin/product_properties/index.html.erb +6 -6
- data/app/views/spree/admin/products/_autocomplete.js.erb +1 -1
- data/app/views/spree/admin/products/_form.html.erb +36 -12
- data/app/views/spree/admin/products/index.html.erb +2 -2
- data/app/views/spree/admin/products/new.html.erb +1 -1
- data/app/views/spree/admin/products/stock.html.erb +10 -8
- data/app/views/spree/admin/promotion_categories/index.html.erb +2 -2
- data/app/views/spree/admin/promotions/index.html.erb +2 -2
- data/app/views/spree/admin/promotions/rules/_first_order.html.erb +0 -0
- data/app/views/spree/admin/properties/index.html.erb +2 -2
- data/app/views/spree/admin/prototypes/_form.html.erb +0 -5
- data/app/views/spree/admin/prototypes/index.html.erb +2 -2
- data/app/views/spree/admin/refund_reasons/index.html.erb +3 -2
- data/app/views/spree/admin/refunds/edit.html.erb +1 -1
- data/app/views/spree/admin/refunds/new.html.erb +1 -1
- data/app/views/spree/admin/reimbursement_types/index.html.erb +2 -3
- data/app/views/spree/admin/return_authorization_reasons/index.html.erb +3 -2
- data/app/views/spree/admin/return_authorizations/edit.html.erb +1 -1
- data/app/views/spree/admin/return_authorizations/index.html.erb +4 -4
- data/app/views/spree/admin/return_authorizations/new.html.erb +1 -1
- data/app/views/spree/admin/roles/_form.html.erb +8 -0
- data/app/views/spree/admin/roles/edit.html.erb +10 -0
- data/app/views/spree/admin/roles/index.html.erb +34 -0
- data/app/views/spree/admin/roles/new.html.erb +10 -0
- data/app/views/spree/admin/shared/_address.html.erb +38 -0
- data/app/views/spree/admin/shared/_address_form.html.erb +2 -2
- data/app/views/spree/admin/shared/_head.html.erb +2 -2
- data/app/views/spree/admin/shared/_index_table_options.html.erb +2 -2
- data/app/views/spree/admin/shared/_order_tabs.html.erb +6 -6
- data/app/views/spree/admin/shared/_product_tabs.html.erb +3 -3
- data/app/views/spree/admin/shared/_refunds.html.erb +1 -1
- data/app/views/spree/admin/shared/named_types/_index.html.erb +3 -3
- data/app/views/spree/admin/shared/sub_menu/_configuration.html.erb +17 -16
- data/app/views/spree/admin/shipping_categories/index.html.erb +6 -6
- data/app/views/spree/admin/shipping_methods/index.html.erb +6 -6
- data/app/views/spree/admin/state_changes/index.html.erb +1 -1
- data/app/views/spree/admin/states/_state_list.html.erb +2 -2
- data/app/views/spree/admin/states/index.html.erb +2 -2
- data/app/views/spree/admin/stock_locations/_form.html.erb +2 -3
- data/app/views/spree/admin/stock_locations/index.html.erb +6 -7
- data/app/views/spree/admin/stock_movements/index.html.erb +1 -1
- data/app/views/spree/admin/stock_transfers/index.html.erb +5 -5
- data/app/views/spree/admin/stock_transfers/show.html.erb +2 -2
- data/app/views/spree/admin/tax_categories/index.html.erb +7 -7
- data/app/views/spree/admin/tax_rates/index.html.erb +6 -6
- data/app/views/spree/admin/taxonomies/index.html.erb +2 -2
- data/app/views/spree/admin/taxons/edit.html.erb +2 -2
- data/app/views/spree/admin/trackers/index.html.erb +5 -5
- data/app/views/spree/admin/users/_sidebar.html.erb +4 -4
- data/app/views/spree/admin/users/addresses.html.erb +2 -2
- data/app/views/spree/admin/users/edit.html.erb +2 -2
- data/app/views/spree/admin/users/index.html.erb +1 -1
- data/app/views/spree/admin/users/items.html.erb +1 -1
- data/app/views/spree/admin/users/new.html.erb +1 -1
- data/app/views/spree/admin/users/orders.html.erb +1 -1
- data/app/views/spree/admin/variants/index.html.erb +17 -13
- data/app/views/spree/admin/zones/index.html.erb +5 -5
- data/config/routes.rb +1 -0
- metadata +14 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5f5db59f9bb47a1c51a531a664dfef2aa549dee7
|
|
4
|
+
data.tar.gz: 426c2b2ff66046c8fe9bcb9f9f72f174a7c26a1e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d3060c017cb9bcc9d65bbcb76622450005b8eb7c6de162c86ad543519f2705e0d4dcc598102f3da2d0829ee4666f0e932ce6aaad1398b4c060f22c77766272e
|
|
7
|
+
data.tar.gz: f0736eafd142aa3acabd97408f501f97c6a6dd13c96e382cc6c77e2c781b46b8cc51ac3bd65a17a757ae4bcfa63a773f63c83dffd652177c8f4f7e62dda57b3c
|
|
@@ -17,16 +17,16 @@ module Spree
|
|
|
17
17
|
|
|
18
18
|
current_store.update_attributes store_params
|
|
19
19
|
|
|
20
|
-
flash[:success] = Spree.t(:successfully_updated, :
|
|
20
|
+
flash[:success] = Spree.t(:successfully_updated, resource: Spree.t(:general_settings))
|
|
21
21
|
redirect_to edit_admin_general_settings_path
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def dismiss_alert
|
|
25
25
|
if request.xhr? and params[:alert_id]
|
|
26
26
|
dismissed = Spree::Config[:dismissed_spree_alerts] || ''
|
|
27
|
-
Spree::Config.set :
|
|
27
|
+
Spree::Config.set dismissed_spree_alerts: dismissed.split(',').push(params[:alert_id]).join(',')
|
|
28
28
|
filter_dismissed_alerts
|
|
29
|
-
render :
|
|
29
|
+
render nothing: true
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -100,159 +100,162 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
|
|
|
100
100
|
|
|
101
101
|
protected
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
def resource_not_found
|
|
115
|
-
flash[:error] = flash_message_for(model_class.new, :not_found)
|
|
116
|
-
redirect_to collection_url
|
|
103
|
+
class << self
|
|
104
|
+
attr_accessor :parent_data
|
|
105
|
+
|
|
106
|
+
def belongs_to(model_name, options = {})
|
|
107
|
+
@parent_data ||= {}
|
|
108
|
+
@parent_data[:model_name] = model_name
|
|
109
|
+
@parent_data[:model_class] = model_name.to_s.classify.constantize
|
|
110
|
+
@parent_data[:find_by] = options[:find_by] || :id
|
|
117
111
|
end
|
|
112
|
+
end
|
|
118
113
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
114
|
+
def model_class
|
|
115
|
+
@model_class ||= resource.model_class
|
|
116
|
+
end
|
|
122
117
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
def resource_not_found
|
|
119
|
+
flash[:error] = flash_message_for(model_class.new, :not_found)
|
|
120
|
+
redirect_to collection_url
|
|
121
|
+
end
|
|
126
122
|
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
def resource
|
|
124
|
+
return @resource if @resource
|
|
125
|
+
if parent_data
|
|
126
|
+
parent_model_name = parent_data[:model_name]
|
|
129
127
|
end
|
|
128
|
+
@resource = Spree::Admin::Resource.new controller_path, controller_name, parent_model_name
|
|
129
|
+
end
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
def load_resource
|
|
132
|
+
if member_action?
|
|
133
|
+
@object ||= load_resource_instance
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
# call authorize! a third time (called twice already in Admin::BaseController)
|
|
136
|
+
# this time we pass the actual instance so fine-grained abilities can control
|
|
137
|
+
# access to individual records, not just entire models.
|
|
138
|
+
authorize! action, @object
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
instance_variable_set("@#{resource.object_name}", @object)
|
|
141
|
+
else
|
|
142
|
+
@collection ||= collection
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
# note: we don't call authorize here as the collection method should use
|
|
145
|
+
# CanCan's accessible_by method to restrict the actual records returned
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
end
|
|
147
|
+
instance_variable_set("@#{controller_name}", @collection)
|
|
149
148
|
end
|
|
149
|
+
end
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
end
|
|
151
|
+
def load_resource_instance
|
|
152
|
+
if new_actions.include?(action)
|
|
153
|
+
build_resource
|
|
154
|
+
elsif params[:id]
|
|
155
|
+
find_resource
|
|
157
156
|
end
|
|
157
|
+
end
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
def parent_data
|
|
160
|
+
self.class.parent_data
|
|
161
|
+
end
|
|
162
162
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
163
|
+
def parent
|
|
164
|
+
if parent_data.present?
|
|
165
|
+
@parent ||= parent_data[:model_class].
|
|
166
|
+
send("find_by_#{parent_data[:find_by]}", params["#{resource.model_name}_id"])
|
|
167
|
+
instance_variable_set("@#{resource.model_name}", @parent)
|
|
168
|
+
else
|
|
169
|
+
nil
|
|
170
170
|
end
|
|
171
|
+
end
|
|
171
172
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
end
|
|
173
|
+
def find_resource
|
|
174
|
+
if parent_data.present?
|
|
175
|
+
parent.send(controller_name).find(params[:id])
|
|
176
|
+
else
|
|
177
|
+
model_class.find(params[:id])
|
|
178
178
|
end
|
|
179
|
+
end
|
|
179
180
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
end
|
|
181
|
+
def build_resource
|
|
182
|
+
if parent_data.present?
|
|
183
|
+
parent.send(controller_name).build
|
|
184
|
+
else
|
|
185
|
+
model_class.new
|
|
186
186
|
end
|
|
187
|
+
end
|
|
187
188
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
189
|
+
def collection
|
|
190
|
+
return parent.send(controller_name) if parent_data.present?
|
|
191
|
+
if model_class.respond_to?(:accessible_by) &&
|
|
192
|
+
!current_ability.has_block?(params[:action], model_class)
|
|
193
|
+
model_class.accessible_by(current_ability, action)
|
|
194
|
+
else
|
|
195
|
+
model_class.where(nil)
|
|
195
196
|
end
|
|
197
|
+
end
|
|
196
198
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
199
|
+
def location_after_destroy
|
|
200
|
+
collection_url
|
|
201
|
+
end
|
|
200
202
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
def location_after_save
|
|
204
|
+
collection_url
|
|
205
|
+
end
|
|
204
206
|
|
|
205
|
-
|
|
207
|
+
# URL helpers
|
|
206
208
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
end
|
|
209
|
+
def new_object_url(options = {})
|
|
210
|
+
if parent_data.present?
|
|
211
|
+
spree.new_polymorphic_url([:admin, parent, model_class], options)
|
|
212
|
+
else
|
|
213
|
+
spree.new_polymorphic_url([:admin, model_class], options)
|
|
213
214
|
end
|
|
215
|
+
end
|
|
214
216
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
217
|
+
def edit_object_url(object, options = {})
|
|
218
|
+
if parent_data.present?
|
|
219
|
+
spree.send "edit_admin_#{resource.model_name}_#{resource.object_name}_url",
|
|
220
|
+
parent, object, options
|
|
221
|
+
else
|
|
222
|
+
spree.send "edit_admin_#{resource.object_name}_url", object, options
|
|
221
223
|
end
|
|
224
|
+
end
|
|
222
225
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
end
|
|
226
|
+
def object_url(object = nil, options = {})
|
|
227
|
+
target = object ? object : @object
|
|
228
|
+
if parent_data.present?
|
|
229
|
+
spree.send "admin_#{resource.model_name}_#{resource.object_name}_url", parent, target, options
|
|
230
|
+
else
|
|
231
|
+
spree.send "admin_#{resource.object_name}_url", target, options
|
|
230
232
|
end
|
|
233
|
+
end
|
|
231
234
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
end
|
|
235
|
+
def collection_url(options = {})
|
|
236
|
+
if parent_data.present?
|
|
237
|
+
spree.polymorphic_url([:admin, parent, model_class], options)
|
|
238
|
+
else
|
|
239
|
+
spree.polymorphic_url([:admin, model_class], options)
|
|
238
240
|
end
|
|
241
|
+
end
|
|
239
242
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
# Allow all attributes to be updatable.
|
|
244
|
+
#
|
|
245
|
+
# Other controllers can, should, override it to set custom logic
|
|
246
|
+
def permitted_resource_params
|
|
247
|
+
params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new
|
|
248
|
+
end
|
|
246
249
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
+
def collection_actions
|
|
251
|
+
[:index]
|
|
252
|
+
end
|
|
250
253
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
+
def member_action?
|
|
255
|
+
!collection_actions.include? action
|
|
256
|
+
end
|
|
254
257
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
+
def new_actions
|
|
259
|
+
[:new, :create]
|
|
260
|
+
end
|
|
258
261
|
end
|
|
@@ -9,28 +9,28 @@ module Spree
|
|
|
9
9
|
# And then JSON building with something like Active Model Serializers
|
|
10
10
|
def users
|
|
11
11
|
if params[:ids]
|
|
12
|
-
@users = Spree.user_class.where(:
|
|
12
|
+
@users = Spree.user_class.where(id: params[:ids].split(',').flatten)
|
|
13
13
|
else
|
|
14
14
|
@users = Spree.user_class.ransack({
|
|
15
|
-
:
|
|
16
|
-
:
|
|
17
|
-
:
|
|
18
|
-
:
|
|
19
|
-
:
|
|
20
|
-
:
|
|
15
|
+
m: 'or',
|
|
16
|
+
email_start: params[:q],
|
|
17
|
+
ship_address_firstname_start: params[:q],
|
|
18
|
+
ship_address_lastname_start: params[:q],
|
|
19
|
+
bill_address_firstname_start: params[:q],
|
|
20
|
+
bill_address_lastname_start: params[:q]
|
|
21
21
|
}).result.limit(10)
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def products
|
|
26
26
|
if params[:ids]
|
|
27
|
-
@products = Product.where(:
|
|
27
|
+
@products = Product.where(id: params[:ids].split(",").flatten)
|
|
28
28
|
else
|
|
29
29
|
@products = Product.ransack(params[:q]).result
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
@products = @products.distinct.page(params[:page]).per(params[:per_page])
|
|
33
|
-
expires_in 15.minutes, :
|
|
33
|
+
expires_in 15.minutes, public: true
|
|
34
34
|
headers['Surrogate-Control'] = "max-age=#{15.minutes}"
|
|
35
35
|
end
|
|
36
36
|
end
|
|
@@ -35,6 +35,10 @@ module Spree
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def update
|
|
38
|
+
if params[:user][:password].blank? && params[:user][:password_confirmation].blank?
|
|
39
|
+
params[:user].delete(:password)
|
|
40
|
+
params[:user].delete(:password_confirmation)
|
|
41
|
+
end
|
|
38
42
|
|
|
39
43
|
if @user.update_attributes(user_params)
|
|
40
44
|
set_roles
|
|
@@ -135,6 +135,11 @@ module Spree
|
|
|
135
135
|
dom_id(record, 'spree')
|
|
136
136
|
end
|
|
137
137
|
|
|
138
|
+
I18N_PLURAL_MANY_COUNT = 2.1
|
|
139
|
+
def plural_resource_name(resource_class)
|
|
140
|
+
resource_class.model_name.human(count: I18N_PLURAL_MANY_COUNT)
|
|
141
|
+
end
|
|
142
|
+
|
|
138
143
|
private
|
|
139
144
|
def attribute_name_for(field_name)
|
|
140
145
|
field_name.gsub(' ', '_').downcase
|
|
@@ -31,7 +31,7 @@ module Spree
|
|
|
31
31
|
selected = if options[:match_path].is_a? Regexp
|
|
32
32
|
request.fullpath =~ options[:match_path]
|
|
33
33
|
elsif options[:match_path]
|
|
34
|
-
request.fullpath.starts_with?("#{admin_path}#{options[:match_path]}")
|
|
34
|
+
request.fullpath.starts_with?("#{spree.admin_path}#{options[:match_path]}")
|
|
35
35
|
else
|
|
36
36
|
args.include?(controller.controller_name.to_sym)
|
|
37
37
|
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Admin
|
|
3
|
+
class Resource
|
|
4
|
+
def initialize(controller_path, controller_name, parent_model)
|
|
5
|
+
@controller_path = controller_path
|
|
6
|
+
@controller_name = controller_name
|
|
7
|
+
@parent_model = parent_model
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def sub_namespace_parts
|
|
11
|
+
@controller_path.split('/')[2..-2]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def model_class
|
|
15
|
+
sub_namespace = sub_namespace_parts.map { |s| s.capitalize }.join('::')
|
|
16
|
+
sub_namespace = "#{sub_namespace}::" if sub_namespace.length > 0
|
|
17
|
+
"Spree::#{sub_namespace}#{@controller_name.classify}".constantize
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def model_name
|
|
21
|
+
sub_namespace = sub_namespace_parts.join('/')
|
|
22
|
+
sub_namespace = "#{sub_namespace}/" if sub_namespace.length > 0
|
|
23
|
+
@parent_model.gsub("spree/#{sub_namespace}", '')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def object_name
|
|
27
|
+
sub_namespace = sub_namespace_parts.join('_')
|
|
28
|
+
sub_namespace = "#{sub_namespace}_" if sub_namespace.length > 0
|
|
29
|
+
"#{sub_namespace}#{@controller_name.singularize}"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
remote: data-remote
|
|
7
7
|
paginator: the paginator that renders the pagination tags inside
|
|
8
8
|
-%>
|
|
9
|
-
<%= paginator.render do
|
|
9
|
+
<%= paginator.render do %>
|
|
10
10
|
<ul class="pagination pagination-sm">
|
|
11
11
|
<%= prev_page_tag %>
|
|
12
|
-
<% each_page do |page|
|
|
13
|
-
<% if page.left_outer? || page.right_outer? || page.inside_window?
|
|
12
|
+
<% each_page do |page| %>
|
|
13
|
+
<% if page.left_outer? || page.right_outer? || page.inside_window? %>
|
|
14
14
|
<%= page_tag page %>
|
|
15
|
-
<% elsif !page.was_truncated?
|
|
15
|
+
<% elsif !page.was_truncated? %>
|
|
16
16
|
<%= gap_tag %>
|
|
17
|
-
<% end
|
|
18
|
-
<% end
|
|
17
|
+
<% end %>
|
|
18
|
+
<% end %>
|
|
19
19
|
<%= next_page_tag %>
|
|
20
20
|
</ul>
|
|
21
|
-
<% end
|
|
21
|
+
<% end %>
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
<td class="text-center"><span class="label label-<%= adjustment.state %>"><%= adjustment.state %></td>
|
|
11
11
|
<td class="actions actions-2 text-center">
|
|
12
12
|
<% if adjustment.open? %>
|
|
13
|
-
<%= link_to_edit
|
|
14
|
-
<%= link_to_delete
|
|
13
|
+
<%= link_to_edit(adjustment, no_text: true) if can?(:edit, adjustment) %>
|
|
14
|
+
<%= link_to_delete(adjustment, no_text: true) if can?(:delete, adjustment) %>
|
|
15
15
|
<% end %>
|
|
16
16
|
</td>
|
|
17
17
|
</tr>
|
|
@@ -17,13 +17,15 @@
|
|
|
17
17
|
</tbody>
|
|
18
18
|
</table>
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
<div class="
|
|
22
|
-
<div class="
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
<% if can?(:edit, Spree::Adjustment) %>
|
|
21
|
+
<div class="panel-footer">
|
|
22
|
+
<div class="row text-center">
|
|
23
|
+
<div class="col-md-6">
|
|
24
|
+
<%= button_to Spree.t(:open_all_adjustments), open_adjustments_admin_order_path(@order), method: :get, class: "btn btn-success" %>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="col-md-6">
|
|
27
|
+
<%= button_to Spree.t(:close_all_adjustments), close_adjustments_admin_order_path(@order), method: :get, class: "btn btn-danger" %>
|
|
28
|
+
</div>
|
|
27
29
|
</div>
|
|
28
30
|
</div>
|
|
29
|
-
|
|
31
|
+
<% end %>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<div class="form-actions" data-hook="buttons">
|
|
14
14
|
<%= button Spree.t(:continue), 'save' %>
|
|
15
15
|
<span class="or"><%= Spree.t(:or) %></span>
|
|
16
|
-
<%= button_link_to Spree.t('actions.cancel'), admin_order_adjustments_url(@order), icon: 'delete' %>
|
|
16
|
+
<%= button_link_to Spree.t('actions.cancel'), spree.admin_order_adjustments_url(@order), icon: 'delete' %>
|
|
17
17
|
</div>
|
|
18
18
|
</fieldset>
|
|
19
19
|
<% end %>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
<%= render partial: 'spree/admin/shared/order_tabs', locals: { current: Spree.t(:adjustments)} %>
|
|
2
2
|
|
|
3
3
|
<% content_for :page_title do %>
|
|
4
|
-
/ <%= Spree::Adjustment
|
|
4
|
+
/ <%= plural_resource_name(Spree::Adjustment) %>
|
|
5
5
|
<% end %>
|
|
6
6
|
|
|
7
7
|
<% content_for :page_actions do %>
|
|
8
|
-
<%= button_link_to
|
|
8
|
+
<%= button_link_to(Spree.t(:new_adjustment), new_admin_order_adjustment_url(@order), class: "btn-success", icon: 'add') if can? :create, Spree::Adjustment %>
|
|
9
9
|
<% end %>
|
|
10
10
|
|
|
11
11
|
<% if @adjustments.present? %>
|
|
12
|
-
<div class="panel panel-default">
|
|
12
|
+
<div class="panel panel-default">
|
|
13
13
|
<%= render :partial => 'adjustments_table' %>
|
|
14
14
|
</div>
|
|
15
15
|
<% else %>
|
|
16
16
|
<div class="alert alert-warning">
|
|
17
|
-
<%= Spree.t(:no_resource_found, resource: Spree::Adjustment
|
|
17
|
+
<%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Adjustment)) %>
|
|
18
18
|
</div>
|
|
19
19
|
<% end %>
|
|
20
20
|
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
</div>
|
|
28
28
|
<% end %>
|
|
29
29
|
|
|
30
|
-
<%= javascript_tag do
|
|
30
|
+
<%= javascript_tag do %>
|
|
31
31
|
var order_number = '<%= @order.number %>';
|
|
32
|
-
<% end
|
|
32
|
+
<% end %>
|
|
33
33
|
|
|
34
34
|
<%= render partial: 'spree/admin/shared/order_summary' %>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<div class="form-actions" data-hook="buttons">
|
|
14
14
|
<%= button Spree.t(:continue), 'save' %>
|
|
15
15
|
<span class="or"><%= Spree.t(:or) %></span>
|
|
16
|
-
<%= button_link_to Spree.t('actions.cancel'), admin_order_adjustments_url(@order), :icon => 'delete' %>
|
|
16
|
+
<%= button_link_to Spree.t('actions.cancel'), spree.admin_order_adjustments_url(@order), :icon => 'delete' %>
|
|
17
17
|
</div>
|
|
18
18
|
</fieldset>
|
|
19
19
|
<% end %>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<% content_for :page_title do %>
|
|
2
|
-
<%= Spree::Country
|
|
2
|
+
<%= plural_resource_name(Spree::Country) %>
|
|
3
3
|
<% end %>
|
|
4
4
|
|
|
5
5
|
<% content_for :page_actions do %>
|
|
6
6
|
<%= button_link_to Spree.t(:new_country), new_object_url, { :class => "btn-success", :icon => 'add', :id => 'admin_new_country' } %>
|
|
7
|
-
<% end %>
|
|
7
|
+
<% end if can? :create, Spree::Country %>
|
|
8
8
|
|
|
9
9
|
<table class="table" id='listing_countries' data-hook>
|
|
10
10
|
<thead>
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
<td><%= country.iso_name %></td>
|
|
23
23
|
<td class="text-center"><%= country.states_required? ? Spree.t(:say_yes) : Spree.t(:say_no) %></td>
|
|
24
24
|
<td class="actions actions-2 text-right">
|
|
25
|
-
<%= link_to_edit
|
|
26
|
-
<%= link_to_delete
|
|
25
|
+
<%= link_to_edit(country, :no_text => true) if can? :edit, country %>
|
|
26
|
+
<%= link_to_delete(country, :no_text => true) if can? :delete, country %>
|
|
27
27
|
</td>
|
|
28
28
|
</tr>
|
|
29
29
|
<% end %>
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<td><%= pretty_time(reimbursement.created_at) %></td>
|
|
28
28
|
<td class="actions actions-1">
|
|
29
29
|
<% if !reimbursement.reimbursed? %>
|
|
30
|
-
<%= link_to_edit_url
|
|
30
|
+
<%= link_to_edit_url(url_for([:edit, :admin, @order, reimbursement]), title: "admin_edit_#{dom_id(reimbursement)}", no_text: true) if can?(:edit, reimbursement) %>
|
|
31
31
|
<% end %>
|
|
32
32
|
</td>
|
|
33
33
|
</tr>
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
<td class='actions actions-2'>
|
|
39
39
|
<%= button_to [:admin, return_item], { class: 'icon icon-thumbs-up icon_link no-text with-tip display-inline', params: { "return_item[acceptance_status]" => 'accepted' }, "data-action" => 'save', title: Spree.t(:accept), method: 'put' } do %>
|
|
40
40
|
Spree.t(:accept)
|
|
41
|
-
<% end %>
|
|
41
|
+
<% end if can?(:accept, return_item) %>
|
|
42
42
|
<%= button_to [:admin, return_item], { class: 'icon icon-thumbs-down icon_link no-text with-tip display-inline', params: { "return_item[acceptance_status]" => 'rejected' }, "data-action" => 'remove', title: Spree.t(:reject), method: 'put' } do %>
|
|
43
43
|
Spree.t(:reject)
|
|
44
|
-
<% end %>
|
|
44
|
+
<% end if can?(:reject, return_item) %>
|
|
45
45
|
</td>
|
|
46
46
|
<% end %>
|
|
47
47
|
</tr>
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
</fieldset>
|
|
33
33
|
<% end %>
|
|
34
34
|
|
|
35
|
-
<% if !@customer_return.fully_reimbursed? && @pending_reimbursements.empty? %>
|
|
35
|
+
<% if !@customer_return.fully_reimbursed? && @pending_reimbursements.empty? && can?(:create, Spree::Reimbursement) %>
|
|
36
36
|
<fieldset data-hook="reimbursements" class="marginb">
|
|
37
37
|
<% if @customer_return.completely_decided? %>
|
|
38
38
|
<%= form_for [:admin, @order, Spree::Reimbursement.new] do |f| %>
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
<% end %>
|
|
51
51
|
|
|
52
52
|
<fieldset data-hook="reimbursements">
|
|
53
|
-
<legend><%= Spree::Reimbursement
|
|
53
|
+
<legend><%= plural_resource_name(Spree::Reimbursement) %></legend>
|
|
54
54
|
<% if @customer_return.reimbursements.any? %>
|
|
55
55
|
<%= render partial: 'reimbursements_table', locals: {reimbursements: @customer_return.reimbursements} %>
|
|
56
56
|
<% else %>
|
|
57
57
|
<div class="alert alert-info no-objects-found">
|
|
58
|
-
<%= Spree.t(:no_resource_found, resource: Spree::Reimbursement
|
|
58
|
+
<%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Reimbursement)) %>
|
|
59
59
|
</div>
|
|
60
60
|
<% end %>
|
|
61
61
|
</fieldset>
|