radiant-shop-extension 0.11.5 → 0.11.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/app/controllers/admin/shop/discounts/discountables_controller.rb +44 -0
- data/app/controllers/admin/shop/discounts_controller.rb +64 -0
- data/app/controllers/admin/shop/orders_controller.rb +19 -3
- data/app/controllers/admin/shop/packages_controller.rb +1 -3
- data/app/controllers/admin/shop/products_controller.rb +1 -2
- data/app/controllers/admin/shop/variants_controller.rb +3 -4
- data/app/models/form_address.rb +4 -2
- data/app/models/form_discount.rb +39 -0
- data/app/models/form_line_item.rb +1 -11
- data/app/models/shop_category.rb +3 -0
- data/app/models/shop_customer.rb +0 -9
- data/app/models/shop_discount.rb +37 -0
- data/app/models/shop_discountable.rb +64 -0
- data/app/models/shop_line_item.rb +24 -1
- data/app/models/shop_order.rb +41 -28
- data/app/models/shop_product.rb +11 -0
- data/app/models/shop_product_variant.rb +3 -0
- data/app/models/shop_variant.rb +1 -3
- data/app/views/admin/shop/discounts/edit.html.haml +11 -0
- data/app/views/admin/shop/discounts/edit/_foot.html.haml +16 -0
- data/app/views/admin/shop/discounts/edit/_form.html.haml +15 -0
- data/app/views/admin/shop/discounts/edit/_head.html.haml +4 -0
- data/app/views/admin/shop/discounts/edit/_inputs.html.haml +2 -0
- data/app/views/admin/shop/discounts/edit/_meta.html.haml +8 -0
- data/app/views/admin/shop/discounts/edit/_parts.html.haml +9 -0
- data/app/views/admin/shop/discounts/edit/_popups.html.haml +4 -0
- data/app/views/admin/shop/discounts/edit/buttons/_browse_categories.html.haml +1 -0
- data/app/views/admin/shop/discounts/edit/buttons/_browse_products.html.haml +1 -0
- data/app/views/admin/shop/discounts/edit/inputs/_amount.html.haml +3 -0
- data/app/views/admin/shop/discounts/edit/inputs/_code.html.haml +3 -0
- data/app/views/admin/shop/discounts/edit/inputs/_name.html.haml +3 -0
- data/app/views/admin/shop/discounts/edit/meta/_finish.html.haml +5 -0
- data/app/views/admin/shop/discounts/edit/meta/_start.html.haml +5 -0
- data/app/views/admin/shop/discounts/edit/parts/_categories.html.haml +3 -0
- data/app/views/admin/shop/discounts/edit/parts/_products.html.haml +3 -0
- data/app/views/admin/shop/discounts/edit/popups/_browse_categories.html.haml +6 -0
- data/app/views/admin/shop/discounts/edit/popups/_browse_products.html.haml +6 -0
- data/app/views/admin/shop/discounts/edit/shared/_category.html.haml +11 -0
- data/app/views/admin/shop/discounts/edit/shared/_product.html.haml +12 -0
- data/app/views/admin/shop/discounts/index.html.haml +13 -0
- data/app/views/admin/shop/discounts/index/_discount.html.haml +13 -0
- data/app/views/admin/shop/discounts/index/_foot.html.haml +5 -0
- data/app/views/admin/shop/discounts/index/_head.html.haml +2 -0
- data/app/views/admin/shop/discounts/index/buttons/_new_discount.html.haml +1 -0
- data/app/views/admin/shop/discounts/new.html.haml +11 -0
- data/app/views/admin/shop/discounts/remove.html.haml +12 -0
- data/app/views/admin/shop/orders/index.html.haml +1 -1
- data/app/views/admin/shop/orders/index/_foot.html.haml +3 -1
- data/app/views/admin/shop/orders/index/_head.html.haml +1 -3
- data/app/views/admin/shop/packages/index.html.haml +1 -1
- data/app/views/admin/shop/packages/index/_foot.html.haml +3 -2
- data/app/views/admin/shop/packages/index/_head.html.haml +1 -3
- data/app/views/admin/shop/packages/index/buttons/_new_package.html.haml +1 -0
- data/app/views/admin/shop/products/index.html.haml +1 -1
- data/app/views/admin/shop/products/index/_foot.html.haml +3 -2
- data/app/views/admin/shop/products/index/_head.html.haml +1 -3
- data/app/views/admin/shop/products/index/buttons/_add_category.html.haml +1 -0
- data/app/views/admin/shop/products/index/buttons/_variants.html.haml +1 -1
- data/app/views/admin/shop/variants/index.html.haml +1 -1
- data/app/views/admin/shop/variants/index/_foot.html.haml +3 -2
- data/app/views/admin/shop/variants/index/_head.html.haml +1 -3
- data/app/views/admin/shop/variants/index/buttons/_add_variant.html.haml +1 -0
- data/app/views/admin/shop/variants/index/buttons/_categories.html.haml +1 -0
- data/config/routes.rb +11 -5
- data/db/migrate/20101010071143_create_discounts.rb +29 -0
- data/db/migrate/20101010072225_modify_categories_remove_variant.rb +9 -0
- data/db/migrate/20101010130034_change_discountables_add_observer.rb +15 -0
- data/db/migrate/20101011063133_change_orders_set_limits_to_null.rb +11 -0
- data/lib/shop/interface/discounts.rb +34 -0
- data/lib/shop/interface/orders.rb +2 -2
- data/lib/shop/interface/packages.rb +2 -2
- data/lib/shop/interface/products.rb +2 -2
- data/lib/shop/interface/variants.rb +2 -2
- data/lib/shop/models/form_extension.rb +12 -1
- data/lib/shop/models/user.rb +18 -0
- data/lib/shop/tags/cart.rb +24 -0
- data/lib/shop/tags/helpers.rb +1 -1
- data/lib/shop/tags/item.rb +26 -11
- data/lib/shop/tags/tax.rb +73 -0
- data/lib/tasks/shop_extension_tasks.rake +1 -1
- data/mockups/discounts/new-edit.bmml +49 -49
- data/public/javascripts/admin/extensions/shop/discounts/edit.js +76 -0
- data/public/stylesheets/sass/admin/extensions/shop/discounts/edit.sass +125 -0
- data/public/stylesheets/sass/admin/extensions/shop/index.sass +14 -40
- data/radiant-shop-extension.gemspec +70 -7
- data/shop_extension.rb +23 -12
- data/spec/controllers/admin/shop/discounts/discountables_controller_spec.rb +73 -0
- data/spec/controllers/admin/shop/discounts_controller_spec.rb +81 -0
- data/spec/controllers/admin/shop/orders_controller_spec.rb +35 -0
- data/spec/datasets/forms.rb +23 -12
- data/spec/datasets/shop_discountables.rb +22 -0
- data/spec/datasets/shop_discounts.rb +29 -0
- data/spec/lib/shop/tags/cart_spec.rb +75 -1
- data/spec/lib/shop/tags/item_spec.rb +4 -7
- data/spec/lib/shop/tags/tax_spec.rb +201 -0
- data/spec/models/form_discount_spec.rb +63 -0
- data/spec/models/shop_category_spec.rb +8 -0
- data/spec/models/shop_discount_spec.rb +130 -0
- data/spec/models/shop_discountable_spec.rb +114 -0
- data/spec/models/shop_line_item_spec.rb +9 -1
- data/spec/models/shop_order_spec.rb +253 -199
- data/spec/models/shop_product_spec.rb +31 -2
- data/spec/models/shop_variant_spec.rb +0 -15
- metadata +97 -21
- data/app/views/admin/shop/products/index/buttons/_discounts.html.haml +0 -1
- data/app/views/admin/shop/products/index/buttons/_packages.html.haml +0 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
<mockup version="1.0" skin="sketch" measuredW="2141" measuredH="
|
1
|
+
<mockup version="1.0" skin="sketch" measuredW="2141" measuredH="1573" mockupW="2100" mockupH="1531">
|
2
2
|
<controls>
|
3
3
|
<control controlID="0" controlTypeID="com.balsamiq.mockups::BrowserWindow" x="31" y="32" w="1024" h="732" measuredW="450" measuredH="400" zOrder="0" locked="false" isInGroup="-1">
|
4
4
|
<controlProperties>
|
@@ -165,7 +165,7 @@
|
|
165
165
|
<text>Free%20Friday</text>
|
166
166
|
</controlProperties>
|
167
167
|
</control>
|
168
|
-
<control controlID="40" controlTypeID="com.balsamiq.mockups::Label" x="1154" y="267" w="-1" h="-1" measuredW="
|
168
|
+
<control controlID="40" controlTypeID="com.balsamiq.mockups::Label" x="1154" y="267" w="-1" h="-1" measuredW="38" measuredH="23" zOrder="31" locked="false" isInGroup="-1">
|
169
169
|
<controlProperties>
|
170
170
|
<text>Name</text>
|
171
171
|
</controlProperties>
|
@@ -176,24 +176,24 @@
|
|
176
176
|
<color>13421772</color>
|
177
177
|
</controlProperties>
|
178
178
|
</control>
|
179
|
-
<control controlID="42" controlTypeID="com.balsamiq.mockups::TextInput" x="1154" y="364" w="930" h="-1" measuredW="
|
179
|
+
<control controlID="42" controlTypeID="com.balsamiq.mockups::TextInput" x="1154" y="364" w="930" h="-1" measuredW="35" measuredH="36" zOrder="33" locked="false" isInGroup="-1">
|
180
180
|
<controlProperties>
|
181
181
|
<size>20</size>
|
182
182
|
<text>25</text>
|
183
183
|
</controlProperties>
|
184
184
|
</control>
|
185
|
-
<control controlID="43" controlTypeID="com.balsamiq.mockups::Label" x="1154" y="341" w="-1" h="-1" measuredW="
|
185
|
+
<control controlID="43" controlTypeID="com.balsamiq.mockups::Label" x="1154" y="341" w="-1" h="-1" measuredW="71" measuredH="23" zOrder="34" locked="false" isInGroup="-1">
|
186
186
|
<controlProperties>
|
187
187
|
<text>Discount%20%25</text>
|
188
188
|
</controlProperties>
|
189
189
|
</control>
|
190
|
-
<control controlID="44" controlTypeID="com.balsamiq.mockups::TextInput" x="1154" y="438" w="930" h="-1" measuredW="
|
190
|
+
<control controlID="44" controlTypeID="com.balsamiq.mockups::TextInput" x="1154" y="438" w="930" h="-1" measuredW="53" measuredH="36" zOrder="35" locked="false" isInGroup="-1">
|
191
191
|
<controlProperties>
|
192
192
|
<size>20</size>
|
193
193
|
<text>ff25</text>
|
194
194
|
</controlProperties>
|
195
195
|
</control>
|
196
|
-
<control controlID="45" controlTypeID="com.balsamiq.mockups::Label" x="1154" y="415" w="-1" h="-1" measuredW="
|
196
|
+
<control controlID="45" controlTypeID="com.balsamiq.mockups::Label" x="1154" y="415" w="-1" h="-1" measuredW="85" measuredH="23" zOrder="36" locked="false" isInGroup="-1">
|
197
197
|
<controlProperties>
|
198
198
|
<text>Voucher%20Code</text>
|
199
199
|
</controlProperties>
|
@@ -203,7 +203,7 @@
|
|
203
203
|
<color>5263440</color>
|
204
204
|
</controlProperties>
|
205
205
|
</control>
|
206
|
-
<control controlID="47" controlTypeID="com.balsamiq.mockups::Label" x="1156" y="576" w="85" h="19" measuredW="
|
206
|
+
<control controlID="47" controlTypeID="com.balsamiq.mockups::Label" x="1156" y="576" w="85" h="19" measuredW="27" measuredH="19" zOrder="38" locked="false" isInGroup="-1">
|
207
207
|
<controlProperties>
|
208
208
|
<align>center</align>
|
209
209
|
<color>16777215</color>
|
@@ -212,17 +212,17 @@
|
|
212
212
|
</controlProperties>
|
213
213
|
</control>
|
214
214
|
<control controlID="48" controlTypeID="com.balsamiq.mockups::Canvas" x="1154" y="793" w="930" h="49" measuredW="100" measuredH="70" zOrder="39" locked="false" isInGroup="-1"/>
|
215
|
-
<control controlID="49" controlTypeID="com.balsamiq.mockups::Button" x="1164" y="803" w="-1" h="-1" measuredW="
|
215
|
+
<control controlID="49" controlTypeID="com.balsamiq.mockups::Button" x="1164" y="803" w="-1" h="-1" measuredW="52" measuredH="28" zOrder="40" locked="false" isInGroup="-1">
|
216
216
|
<controlProperties>
|
217
217
|
<text>Save</text>
|
218
218
|
</controlProperties>
|
219
219
|
</control>
|
220
|
-
<control controlID="50" controlTypeID="com.balsamiq.mockups::Button" x="1231" y="803" w="193" h="28" measuredW="
|
220
|
+
<control controlID="50" controlTypeID="com.balsamiq.mockups::Button" x="1231" y="803" w="193" h="28" measuredW="179" measuredH="28" zOrder="41" locked="false" isInGroup="-1">
|
221
221
|
<controlProperties>
|
222
222
|
<text>Save%20and%20Continue%20Editing</text>
|
223
223
|
</controlProperties>
|
224
224
|
</control>
|
225
|
-
<control controlID="51" controlTypeID="com.balsamiq.mockups::Link" x="1434" y="806" w="-1" h="-1" measuredW="
|
225
|
+
<control controlID="51" controlTypeID="com.balsamiq.mockups::Link" x="1434" y="806" w="-1" h="-1" measuredW="42" measuredH="23" zOrder="42" locked="false" isInGroup="-1">
|
226
226
|
<controlProperties>
|
227
227
|
<text>cancel</text>
|
228
228
|
</controlProperties>
|
@@ -232,19 +232,19 @@
|
|
232
232
|
<color>5263440</color>
|
233
233
|
</controlProperties>
|
234
234
|
</control>
|
235
|
-
<control controlID="53" controlTypeID="com.balsamiq.mockups::Button" x="1852" y="195" w="111" h="28" measuredW="
|
235
|
+
<control controlID="53" controlTypeID="com.balsamiq.mockups::Button" x="1852" y="195" w="111" h="28" measuredW="79" measuredH="28" zOrder="44" locked="false" isInGroup="-1">
|
236
236
|
<controlProperties>
|
237
237
|
<color>16777215</color>
|
238
238
|
<text>Packages</text>
|
239
239
|
</controlProperties>
|
240
240
|
</control>
|
241
|
-
<control controlID="54" controlTypeID="com.balsamiq.mockups::Button" x="1726" y="195" w="111" h="28" measuredW="
|
241
|
+
<control controlID="54" controlTypeID="com.balsamiq.mockups::Button" x="1726" y="195" w="111" h="28" measuredW="74" measuredH="28" zOrder="45" locked="false" isInGroup="-1">
|
242
242
|
<controlProperties>
|
243
243
|
<color>16777215</color>
|
244
244
|
<text>Variants</text>
|
245
245
|
</controlProperties>
|
246
246
|
</control>
|
247
|
-
<control controlID="55" controlTypeID="com.balsamiq.mockups::Button" x="1973" y="195" w="111" h="28" measuredW="
|
247
|
+
<control controlID="55" controlTypeID="com.balsamiq.mockups::Button" x="1973" y="195" w="111" h="28" measuredW="80" measuredH="28" zOrder="46" locked="false" isInGroup="-1">
|
248
248
|
<controlProperties>
|
249
249
|
<color>13421772</color>
|
250
250
|
<text>Discounts</text>
|
@@ -266,7 +266,7 @@
|
|
266
266
|
<text>Orders</text>
|
267
267
|
</controlProperties>
|
268
268
|
</control>
|
269
|
-
<control controlID="60" controlTypeID="com.balsamiq.mockups::Label" x="1338" y="150" w="122" h="29" measuredW="
|
269
|
+
<control controlID="60" controlTypeID="com.balsamiq.mockups::Label" x="1338" y="150" w="122" h="29" measuredW="90" measuredH="29" zOrder="51" locked="false" isInGroup="-1">
|
270
270
|
<controlProperties>
|
271
271
|
<align>center</align>
|
272
272
|
<size>18</size>
|
@@ -279,7 +279,7 @@
|
|
279
279
|
<text>categories</text>
|
280
280
|
</controlProperties>
|
281
281
|
</control>
|
282
|
-
<control controlID="62" controlTypeID="com.balsamiq.mockups::CheckBoxGroup" x="1171" y="672" w="899" h="77" measuredW="
|
282
|
+
<control controlID="62" controlTypeID="com.balsamiq.mockups::CheckBoxGroup" x="1171" y="672" w="899" h="77" measuredW="80" measuredH="69" zOrder="53" locked="false" isInGroup="-1">
|
283
283
|
<controlProperties>
|
284
284
|
<text>%5B%20%5D%20books%0A%5Bx%5D%20movies%0A%5B%20%5D%20figurines</text>
|
285
285
|
</controlProperties>
|
@@ -289,25 +289,25 @@
|
|
289
289
|
<color>5263440</color>
|
290
290
|
</controlProperties>
|
291
291
|
</control>
|
292
|
-
<control controlID="64" controlTypeID="com.balsamiq.mockups::Label" x="1171" y="483" w="100" h="24" measuredW="
|
292
|
+
<control controlID="64" controlTypeID="com.balsamiq.mockups::Label" x="1171" y="483" w="100" h="24" measuredW="72" measuredH="23" zOrder="55" locked="false" isInGroup="-1">
|
293
293
|
<controlProperties>
|
294
294
|
<color>16777215</color>
|
295
295
|
<text>Start%20Date</text>
|
296
296
|
</controlProperties>
|
297
297
|
</control>
|
298
|
-
<control controlID="65" controlTypeID="com.balsamiq.mockups::Label" x="1171" y="533" w="100" h="24" measuredW="
|
298
|
+
<control controlID="65" controlTypeID="com.balsamiq.mockups::Label" x="1171" y="533" w="100" h="24" measuredW="60" measuredH="23" zOrder="56" locked="false" isInGroup="-1">
|
299
299
|
<controlProperties>
|
300
300
|
<color>16777215</color>
|
301
301
|
<text>End%20Date</text>
|
302
302
|
</controlProperties>
|
303
303
|
</control>
|
304
|
-
<control controlID="66" controlTypeID="com.balsamiq.mockups::TextInput" x="1258" y="481" w="186" h="-1" measuredW="79" measuredH="
|
304
|
+
<control controlID="66" controlTypeID="com.balsamiq.mockups::TextInput" x="1258" y="481" w="186" h="-1" measuredW="79" measuredH="27" zOrder="57" locked="false" isInGroup="-1">
|
305
305
|
<controlProperties>
|
306
306
|
<size>13</size>
|
307
307
|
<text/>
|
308
308
|
</controlProperties>
|
309
309
|
</control>
|
310
|
-
<control controlID="67" controlTypeID="com.balsamiq.mockups::TextInput" x="1258" y="531" w="186" h="-1" measuredW="79" measuredH="
|
310
|
+
<control controlID="67" controlTypeID="com.balsamiq.mockups::TextInput" x="1258" y="531" w="186" h="-1" measuredW="79" measuredH="27" zOrder="58" locked="false" isInGroup="-1">
|
311
311
|
<controlProperties>
|
312
312
|
<size>13</size>
|
313
313
|
<text/>
|
@@ -325,82 +325,82 @@
|
|
325
325
|
<icon>CalendarIcon%7Cmedium</icon>
|
326
326
|
</controlProperties>
|
327
327
|
</control>
|
328
|
-
<control controlID="70" controlTypeID="com.balsamiq.mockups::Label" x="75" y="194" w="-1" h="-1" measuredW="
|
328
|
+
<control controlID="70" controlTypeID="com.balsamiq.mockups::Label" x="75" y="194" w="-1" h="-1" measuredW="109" measuredH="29" zOrder="61" locked="false" isInGroup="-1">
|
329
329
|
<controlProperties>
|
330
330
|
<color>16777215</color>
|
331
331
|
<size>18</size>
|
332
332
|
<text>New%20Product</text>
|
333
333
|
</controlProperties>
|
334
334
|
</control>
|
335
|
-
<control controlID="71" controlTypeID="com.balsamiq.mockups::Label" x="1154" y="194" w="-1" h="-1" measuredW="
|
335
|
+
<control controlID="71" controlTypeID="com.balsamiq.mockups::Label" x="1154" y="194" w="-1" h="-1" measuredW="98" measuredH="29" zOrder="62" locked="false" isInGroup="-1">
|
336
336
|
<controlProperties>
|
337
337
|
<color>16777215</color>
|
338
338
|
<size>18</size>
|
339
339
|
<text>Free%20Friday</text>
|
340
340
|
</controlProperties>
|
341
341
|
</control>
|
342
|
-
<control controlID="72" controlTypeID="com.balsamiq.mockups::BrowserWindow" x="
|
342
|
+
<control controlID="72" controlTypeID="com.balsamiq.mockups::BrowserWindow" x="38" y="831" w="1024" h="732" measuredW="450" measuredH="400" zOrder="63" locked="false" isInGroup="-1">
|
343
343
|
<controlProperties>
|
344
344
|
<text>A%20Web%20Page%0Ahttp%3A//admin/shop/discounts/new</text>
|
345
345
|
</controlProperties>
|
346
346
|
</control>
|
347
|
-
<control controlID="73" controlTypeID="com.balsamiq.mockups::Canvas" x="
|
347
|
+
<control controlID="73" controlTypeID="com.balsamiq.mockups::Canvas" x="43" y="900" w="1019" h="637" measuredW="100" measuredH="70" zOrder="64" locked="false" isInGroup="-1">
|
348
348
|
<controlProperties>
|
349
349
|
<color>10027008</color>
|
350
350
|
</controlProperties>
|
351
351
|
</control>
|
352
|
-
<control controlID="74" controlTypeID="com.balsamiq.mockups::TabBar" x="
|
352
|
+
<control controlID="74" controlTypeID="com.balsamiq.mockups::TabBar" x="45" y="912" w="1017" h="625" measuredW="364" measuredH="100" zOrder="65" locked="false" isInGroup="-1">
|
353
353
|
<controlProperties>
|
354
354
|
<selectedIndex>3</selectedIndex>
|
355
355
|
<size>18</size>
|
356
356
|
<text>content%2C%20Design%2C%20Settings%2C%20Shop</text>
|
357
357
|
</controlProperties>
|
358
358
|
</control>
|
359
|
-
<control controlID="75" controlTypeID="com.balsamiq.mockups::TextInput" x="
|
359
|
+
<control controlID="75" controlTypeID="com.balsamiq.mockups::TextInput" x="85" y="1089" w="930" h="-1" measuredW="118" measuredH="36" zOrder="66" locked="false" isInGroup="-1">
|
360
360
|
<controlProperties>
|
361
361
|
<size>20</size>
|
362
362
|
<text>Free%20Friday</text>
|
363
363
|
</controlProperties>
|
364
364
|
</control>
|
365
|
-
<control controlID="76" controlTypeID="com.balsamiq.mockups::Label" x="
|
365
|
+
<control controlID="76" controlTypeID="com.balsamiq.mockups::Label" x="85" y="1066" w="-1" h="-1" measuredW="38" measuredH="23" zOrder="67" locked="false" isInGroup="-1">
|
366
366
|
<controlProperties>
|
367
367
|
<text>Name</text>
|
368
368
|
</controlProperties>
|
369
369
|
</control>
|
370
|
-
<control controlID="77" controlTypeID="com.balsamiq.mockups::Canvas" x="
|
370
|
+
<control controlID="77" controlTypeID="com.balsamiq.mockups::Canvas" x="45" y="940" w="117" h="44" measuredW="100" measuredH="70" zOrder="68" locked="false" isInGroup="-1">
|
371
371
|
<controlProperties>
|
372
372
|
<borderStyle>none</borderStyle>
|
373
373
|
<color>13421772</color>
|
374
374
|
</controlProperties>
|
375
375
|
</control>
|
376
|
-
<control controlID="78" controlTypeID="com.balsamiq.mockups::TextInput" x="
|
376
|
+
<control controlID="78" controlTypeID="com.balsamiq.mockups::TextInput" x="85" y="1163" w="930" h="-1" measuredW="79" measuredH="36" zOrder="69" locked="false" isInGroup="-1">
|
377
377
|
<controlProperties>
|
378
378
|
<size>20</size>
|
379
379
|
<text/>
|
380
380
|
</controlProperties>
|
381
381
|
</control>
|
382
|
-
<control controlID="79" controlTypeID="com.balsamiq.mockups::Label" x="
|
382
|
+
<control controlID="79" controlTypeID="com.balsamiq.mockups::Label" x="85" y="1140" w="-1" h="-1" measuredW="71" measuredH="23" zOrder="70" locked="false" isInGroup="-1">
|
383
383
|
<controlProperties>
|
384
384
|
<text>Discount%20%25</text>
|
385
385
|
</controlProperties>
|
386
386
|
</control>
|
387
|
-
<control controlID="80" controlTypeID="com.balsamiq.mockups::TextInput" x="
|
387
|
+
<control controlID="80" controlTypeID="com.balsamiq.mockups::TextInput" x="85" y="1237" w="930" h="-1" measuredW="79" measuredH="36" zOrder="71" locked="false" isInGroup="-1">
|
388
388
|
<controlProperties>
|
389
389
|
<size>20</size>
|
390
390
|
<text/>
|
391
391
|
</controlProperties>
|
392
392
|
</control>
|
393
|
-
<control controlID="81" controlTypeID="com.balsamiq.mockups::Label" x="
|
393
|
+
<control controlID="81" controlTypeID="com.balsamiq.mockups::Label" x="85" y="1214" w="-1" h="-1" measuredW="85" measuredH="23" zOrder="72" locked="false" isInGroup="-1">
|
394
394
|
<controlProperties>
|
395
395
|
<text>Voucher%20Code</text>
|
396
396
|
</controlProperties>
|
397
397
|
</control>
|
398
|
-
<control controlID="82" controlTypeID="com.balsamiq.mockups::Canvas" x="
|
398
|
+
<control controlID="82" controlTypeID="com.balsamiq.mockups::Canvas" x="85" y="1270" w="87" h="27" measuredW="100" measuredH="70" zOrder="73" locked="false" isInGroup="-1">
|
399
399
|
<controlProperties>
|
400
400
|
<color>5263440</color>
|
401
401
|
</controlProperties>
|
402
402
|
</control>
|
403
|
-
<control controlID="83" controlTypeID="com.balsamiq.mockups::Label" x="
|
403
|
+
<control controlID="83" controlTypeID="com.balsamiq.mockups::Label" x="87" y="1273" w="85" h="19" measuredW="27" measuredH="19" zOrder="74" locked="false" isInGroup="-1">
|
404
404
|
<controlProperties>
|
405
405
|
<align>center</align>
|
406
406
|
<color>16777215</color>
|
@@ -408,80 +408,80 @@
|
|
408
408
|
<text>more</text>
|
409
409
|
</controlProperties>
|
410
410
|
</control>
|
411
|
-
<control controlID="84" controlTypeID="com.balsamiq.mockups::Canvas" x="
|
412
|
-
<control controlID="85" controlTypeID="com.balsamiq.mockups::Button" x="
|
411
|
+
<control controlID="84" controlTypeID="com.balsamiq.mockups::Canvas" x="85" y="1461" w="930" h="49" measuredW="100" measuredH="70" zOrder="75" locked="false" isInGroup="-1"/>
|
412
|
+
<control controlID="85" controlTypeID="com.balsamiq.mockups::Button" x="95" y="1471" w="-1" h="-1" measuredW="52" measuredH="28" zOrder="76" locked="false" isInGroup="-1">
|
413
413
|
<controlProperties>
|
414
414
|
<text>Save</text>
|
415
415
|
</controlProperties>
|
416
416
|
</control>
|
417
|
-
<control controlID="86" controlTypeID="com.balsamiq.mockups::Button" x="
|
417
|
+
<control controlID="86" controlTypeID="com.balsamiq.mockups::Button" x="162" y="1471" w="193" h="28" measuredW="179" measuredH="28" zOrder="77" locked="false" isInGroup="-1">
|
418
418
|
<controlProperties>
|
419
419
|
<text>Save%20and%20Continue%20Editing</text>
|
420
420
|
</controlProperties>
|
421
421
|
</control>
|
422
|
-
<control controlID="87" controlTypeID="com.balsamiq.mockups::Link" x="
|
422
|
+
<control controlID="87" controlTypeID="com.balsamiq.mockups::Link" x="365" y="1474" w="-1" h="-1" measuredW="42" measuredH="23" zOrder="78" locked="false" isInGroup="-1">
|
423
423
|
<controlProperties>
|
424
424
|
<text>cancel</text>
|
425
425
|
</controlProperties>
|
426
426
|
</control>
|
427
|
-
<control controlID="88" controlTypeID="com.balsamiq.mockups::Canvas" x="
|
427
|
+
<control controlID="88" controlTypeID="com.balsamiq.mockups::Canvas" x="45" y="984" w="1017" h="49" measuredW="100" measuredH="70" zOrder="79" locked="false" isInGroup="-1">
|
428
428
|
<controlProperties>
|
429
429
|
<color>5263440</color>
|
430
430
|
</controlProperties>
|
431
431
|
</control>
|
432
|
-
<control controlID="89" controlTypeID="com.balsamiq.mockups::Button" x="
|
432
|
+
<control controlID="89" controlTypeID="com.balsamiq.mockups::Button" x="778" y="994" w="111" h="28" measuredW="79" measuredH="28" zOrder="80" locked="false" isInGroup="-1">
|
433
433
|
<controlProperties>
|
434
434
|
<color>16777215</color>
|
435
435
|
<text>Packages</text>
|
436
436
|
</controlProperties>
|
437
437
|
</control>
|
438
|
-
<control controlID="90" controlTypeID="com.balsamiq.mockups::Button" x="
|
438
|
+
<control controlID="90" controlTypeID="com.balsamiq.mockups::Button" x="652" y="994" w="111" h="28" measuredW="74" measuredH="28" zOrder="81" locked="false" isInGroup="-1">
|
439
439
|
<controlProperties>
|
440
440
|
<color>16777215</color>
|
441
441
|
<text>Variants</text>
|
442
442
|
</controlProperties>
|
443
443
|
</control>
|
444
|
-
<control controlID="91" controlTypeID="com.balsamiq.mockups::Button" x="
|
444
|
+
<control controlID="91" controlTypeID="com.balsamiq.mockups::Button" x="904" y="994" w="111" h="28" measuredW="80" measuredH="28" zOrder="82" locked="false" isInGroup="-1">
|
445
445
|
<controlProperties>
|
446
446
|
<color>13421772</color>
|
447
447
|
<text>Discounts</text>
|
448
448
|
</controlProperties>
|
449
449
|
</control>
|
450
|
-
<control controlID="92" controlTypeID="com.balsamiq.mockups::VRule" x="
|
451
|
-
<control controlID="93" controlTypeID="com.balsamiq.mockups::VRule" x="
|
452
|
-
<control controlID="94" controlTypeID="com.balsamiq.mockups::Label" x="
|
450
|
+
<control controlID="92" controlTypeID="com.balsamiq.mockups::VRule" x="269" y="944" w="-1" h="40" measuredW="5" measuredH="100" zOrder="83" locked="false" isInGroup="-1"/>
|
451
|
+
<control controlID="93" controlTypeID="com.balsamiq.mockups::VRule" x="391" y="944" w="-1" h="40" measuredW="5" measuredH="100" zOrder="84" locked="false" isInGroup="-1"/>
|
452
|
+
<control controlID="94" controlTypeID="com.balsamiq.mockups::Label" x="45" y="949" w="117" h="29" measuredW="77" measuredH="29" zOrder="85" locked="false" isInGroup="-1">
|
453
453
|
<controlProperties>
|
454
454
|
<align>center</align>
|
455
455
|
<size>18</size>
|
456
456
|
<text>Products</text>
|
457
457
|
</controlProperties>
|
458
458
|
</control>
|
459
|
-
<control controlID="95" controlTypeID="com.balsamiq.mockups::Label" x="
|
459
|
+
<control controlID="95" controlTypeID="com.balsamiq.mockups::Label" x="162" y="949" w="109" h="29" measuredW="60" measuredH="29" zOrder="86" locked="false" isInGroup="-1">
|
460
460
|
<controlProperties>
|
461
461
|
<align>center</align>
|
462
462
|
<size>18</size>
|
463
463
|
<text>Orders</text>
|
464
464
|
</controlProperties>
|
465
465
|
</control>
|
466
|
-
<control controlID="96" controlTypeID="com.balsamiq.mockups::Label" x="
|
466
|
+
<control controlID="96" controlTypeID="com.balsamiq.mockups::Label" x="269" y="949" w="122" h="29" measuredW="90" measuredH="29" zOrder="87" locked="false" isInGroup="-1">
|
467
467
|
<controlProperties>
|
468
468
|
<align>center</align>
|
469
469
|
<size>18</size>
|
470
470
|
<text>Customers</text>
|
471
471
|
</controlProperties>
|
472
472
|
</control>
|
473
|
-
<control controlID="97" controlTypeID="com.balsamiq.mockups::TabBar" x="
|
473
|
+
<control controlID="97" controlTypeID="com.balsamiq.mockups::TabBar" x="85" y="1316" w="930" h="124" measuredW="167" measuredH="100" zOrder="88" locked="false" isInGroup="-1">
|
474
474
|
<controlProperties>
|
475
475
|
<selectedIndex>0</selectedIndex>
|
476
476
|
<text>categories</text>
|
477
477
|
</controlProperties>
|
478
478
|
</control>
|
479
|
-
<control controlID="98" controlTypeID="com.balsamiq.mockups::CheckBoxGroup" x="
|
479
|
+
<control controlID="98" controlTypeID="com.balsamiq.mockups::CheckBoxGroup" x="102" y="1357" w="899" h="115" measuredW="80" measuredH="69" zOrder="89" locked="false" isInGroup="-1">
|
480
480
|
<controlProperties>
|
481
481
|
<text>%5B%20%5D%20books%0A%5Bx%5D%20movies%0A%5B%20%5D%20figurines</text>
|
482
482
|
</controlProperties>
|
483
483
|
</control>
|
484
|
-
<control controlID="99" controlTypeID="com.balsamiq.mockups::Label" x="
|
484
|
+
<control controlID="99" controlTypeID="com.balsamiq.mockups::Label" x="82" y="993" w="-1" h="-1" measuredW="109" measuredH="29" zOrder="90" locked="false" isInGroup="-1">
|
485
485
|
<controlProperties>
|
486
486
|
<color>16777215</color>
|
487
487
|
<size>18</size>
|
@@ -0,0 +1,76 @@
|
|
1
|
+
/* <li
|
2
|
+
class="discountable product" || class="discountable discounted"
|
3
|
+
id="product_1"
|
4
|
+
data-discounted_type_human="Product"
|
5
|
+
data-discounted_id="1"
|
6
|
+
data-discounted_type="ShopProduct"
|
7
|
+
data-success_element="discount_products"
|
8
|
+
/>
|
9
|
+
*/
|
10
|
+
|
11
|
+
document.observe("dom:loaded", function() {
|
12
|
+
shop_discount_edit = new ShopDiscountEdit();
|
13
|
+
shop_discount_edit.initialize();
|
14
|
+
|
15
|
+
Event.addBehavior({
|
16
|
+
'.discountable.available:click': function(e) { shop_discount_edit.discountedAttach($(this)) },
|
17
|
+
'.discountable.discounted .delete:click': function(e) { shop_discount_edit.discountedRemove($(this)) },
|
18
|
+
})
|
19
|
+
});
|
20
|
+
|
21
|
+
var ShopDiscountEdit = Class.create({
|
22
|
+
|
23
|
+
initialize: function() {
|
24
|
+
},
|
25
|
+
|
26
|
+
discountedAttach: function(element) {
|
27
|
+
var route = shop.getRoute('admin_shop_discount_discountables_path');
|
28
|
+
|
29
|
+
showStatus('Adding '+element.getAttribute('data-discounted_type_human')+'...');
|
30
|
+
new Ajax.Request(route, {
|
31
|
+
method: 'post',
|
32
|
+
parameters: {
|
33
|
+
'discounted_id': element.getAttribute('data-discounted_id'),
|
34
|
+
'discounted_type': element.getAttribute('data-discounted_type'),
|
35
|
+
},
|
36
|
+
onSuccess: function(data) {
|
37
|
+
$(element.getAttribute('data-success_element')).insert({ 'bottom' : data.responseText});
|
38
|
+
shop_discount_edit.postChanges(element);
|
39
|
+
}.bind(element),
|
40
|
+
onFailure: function() {
|
41
|
+
shop_discount_edit.errorStatus();
|
42
|
+
}
|
43
|
+
});
|
44
|
+
},
|
45
|
+
|
46
|
+
discountedRemove: function(element) {
|
47
|
+
var element = element.up('.discounted');
|
48
|
+
var discountable_id = element.readAttribute('data-discountable_id');
|
49
|
+
var route = shop.getRoute('admin_shop_discount_discountable_path', 'js', discountable_id);
|
50
|
+
|
51
|
+
showStatus('Removing '+element.getAttribute('data-discounted_type_human')+'...');
|
52
|
+
element.hide();
|
53
|
+
new Ajax.Request(route, {
|
54
|
+
method: 'delete',
|
55
|
+
onSuccess: function(data) {
|
56
|
+
$(element.getAttribute('data-success_element')).insert({ 'bottom' : data.responseText });
|
57
|
+
shop_discount_edit.postChanges(element);
|
58
|
+
},
|
59
|
+
onFailure: function(data) {
|
60
|
+
shop_discount_edit.errorStatus();
|
61
|
+
}
|
62
|
+
});
|
63
|
+
},
|
64
|
+
|
65
|
+
postChanges: function(element) {
|
66
|
+
element.remove();
|
67
|
+
|
68
|
+
hideStatus();
|
69
|
+
},
|
70
|
+
|
71
|
+
errorStatus: function() {
|
72
|
+
setStatus('Something went wrong, refreshing.');
|
73
|
+
location.reload(true);
|
74
|
+
}
|
75
|
+
|
76
|
+
});
|
@@ -0,0 +1,125 @@
|
|
1
|
+
ul.discounteds, .availables
|
2
|
+
padding:
|
3
|
+
top: 10px
|
4
|
+
|
5
|
+
li.discounted, .available
|
6
|
+
float: left
|
7
|
+
position: relative
|
8
|
+
padding: 10px
|
9
|
+
height: 100px
|
10
|
+
width: 100px
|
11
|
+
margin:
|
12
|
+
right: 10px
|
13
|
+
border:
|
14
|
+
radius: 6px
|
15
|
+
-moz:
|
16
|
+
border:
|
17
|
+
radius: 6px
|
18
|
+
-webkit:
|
19
|
+
border:
|
20
|
+
radius: 6px
|
21
|
+
cursor: move
|
22
|
+
overflow: hidden
|
23
|
+
*
|
24
|
+
vertical:
|
25
|
+
align: middle
|
26
|
+
|
27
|
+
.wrapper
|
28
|
+
display: table-cell
|
29
|
+
height: 100px
|
30
|
+
width: 100px
|
31
|
+
text:
|
32
|
+
align: center
|
33
|
+
vertical:
|
34
|
+
align: middle
|
35
|
+
|
36
|
+
img
|
37
|
+
width: 100px
|
38
|
+
max:
|
39
|
+
height: 100px
|
40
|
+
|
41
|
+
.name
|
42
|
+
line-height: 12px
|
43
|
+
font-size: 12px
|
44
|
+
position: absolute
|
45
|
+
display: block
|
46
|
+
width: 96%
|
47
|
+
top: 37.5px
|
48
|
+
left: 0
|
49
|
+
padding: 4px 2%
|
50
|
+
overflow: hidden
|
51
|
+
text-align: center
|
52
|
+
|
53
|
+
.sku, .handle
|
54
|
+
visibility: hidden
|
55
|
+
font-size: 10px
|
56
|
+
line-height: 12px
|
57
|
+
position: absolute
|
58
|
+
display: block
|
59
|
+
width: 96%
|
60
|
+
bottom: 12.5px
|
61
|
+
left: 0
|
62
|
+
padding: 4px 2%
|
63
|
+
overflow: hidden
|
64
|
+
text-align: center
|
65
|
+
color: #757575
|
66
|
+
|
67
|
+
&:hover
|
68
|
+
background:
|
69
|
+
color: #f9f6fe
|
70
|
+
|
71
|
+
.sku, .handle
|
72
|
+
visibility: visible
|
73
|
+
|
74
|
+
.name
|
75
|
+
background-color: #f9f6fe
|
76
|
+
|
77
|
+
ul.discounteds
|
78
|
+
overflow: hidden
|
79
|
+
|
80
|
+
li.discounted
|
81
|
+
|
82
|
+
.actions
|
83
|
+
position: absolute
|
84
|
+
display: block
|
85
|
+
width: 100%
|
86
|
+
top: 0
|
87
|
+
left: 0
|
88
|
+
|
89
|
+
.delete
|
90
|
+
position: absolute
|
91
|
+
top: 4px
|
92
|
+
right: -4px
|
93
|
+
width: 20px
|
94
|
+
height: 20px
|
95
|
+
overflow: hidden
|
96
|
+
display: block
|
97
|
+
cursor: pointer
|
98
|
+
background:
|
99
|
+
image: url('/images/admin/minus_disabled.png')
|
100
|
+
repeat: no-repeat
|
101
|
+
position: 0 0
|
102
|
+
cursor: pointer
|
103
|
+
|
104
|
+
&:hover
|
105
|
+
background:
|
106
|
+
image: url('/images/admin/minus.png')
|
107
|
+
|
108
|
+
ul.availables
|
109
|
+
/* This makes the scroll look nice */
|
110
|
+
margin:
|
111
|
+
right: -10px
|
112
|
+
top: -10px
|
113
|
+
padding:
|
114
|
+
left: 15px
|
115
|
+
bottom: 10px
|
116
|
+
width: 680px
|
117
|
+
max-height: 350px
|
118
|
+
overflow-y: scroll
|
119
|
+
|
120
|
+
li.available
|
121
|
+
|
122
|
+
.actions
|
123
|
+
|
124
|
+
.delete
|
125
|
+
display: none
|