From be4c6380e797ee5aa8590f5680541d4d0e34f0ee Mon Sep 17 00:00:00 2001 From: mespeche Date: Thu, 26 Sep 2013 15:24:31 +0200 Subject: [PATCH] Setting taxe rule drag and drop functionnal with sortable rule group --- .../Thelia/Config/Resources/routing/admin.xml | 5 + .../Controller/Admin/TaxRuleController.php | 6 + .../default/assets/less/thelia/thelia.less | 76 ++++++ templates/admin/default/tax-rule-edit.html | 228 ++++++++++++++++++ 4 files changed, 315 insertions(+) create mode 100644 templates/admin/default/tax-rule-edit.html diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index 55dc7b583..2f043c2f4 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -559,6 +559,11 @@ Thelia\Controller\Admin\TaxRuleController::defaultAction + + Thelia\Controller\Admin\TaxRuleController::updateAction + \d+ + + diff --git a/core/lib/Thelia/Controller/Admin/TaxRuleController.php b/core/lib/Thelia/Controller/Admin/TaxRuleController.php index ca51b4ac9..2a4f37a77 100644 --- a/core/lib/Thelia/Controller/Admin/TaxRuleController.php +++ b/core/lib/Thelia/Controller/Admin/TaxRuleController.php @@ -36,4 +36,10 @@ class TaxRuleController extends BaseAdminController return $this->render("taxes-rules", array("display_taxes_rules" => 20)); } + public function updateAction($tax_rule_id){ + return $this->render("tax-rule-edit", array( + "tax_rule_id" => $tax_rule_id + )); + } + } \ No newline at end of file diff --git a/templates/admin/default/assets/less/thelia/thelia.less b/templates/admin/default/assets/less/thelia/thelia.less index 822130a5c..802d57e96 100644 --- a/templates/admin/default/assets/less/thelia/thelia.less +++ b/templates/admin/default/assets/less/thelia/thelia.less @@ -276,4 +276,80 @@ background: url("@{imgDir}/ajax-loader.gif") no-repeat; height: 30px; width: 30px; +} + +// -- Drag & drop -- +.take{ + + .draggable{ + border: 2px dashed @gray-light; + margin-bottom: 10px; + padding: 10px; + + &:last-child{ + margin-bottom: 0; + } + } + + .over{ + .drop-message{ + border-color: @brand-primary; + color: @brand-primary; + } + } + +} + +.place{ + + .over{ + .drop-message{ + border-color: @brand-primary; + color: @brand-primary; + } + } + + .panel-body{ + + .draggable{ + margin: 5px 0; + padding: 10px; + border: 1px dashed @gray-light; + } + + .drop-group{ + padding: 10px; + border: 2px dashed @gray-light; + margin-bottom: 10px; + + &:last-child{ + margin-bottom: 0; + } + } + + } + +} + +.take, .place{ + + .drop-message{ + width: 50%; + margin: 10px auto; + padding: 10px; + color: @gray; + border: 2px dashed @gray; + text-align: center; + .opacity(0.5); + + .glyphicon{ + display: block; + font-size: @font-size-large; + margin-bottom: 10px; + } + } + + .ui-draggable-dragging{ + z-index: 100; + } } \ No newline at end of file diff --git a/templates/admin/default/tax-rule-edit.html b/templates/admin/default/tax-rule-edit.html new file mode 100644 index 000000000..1bf6346d1 --- /dev/null +++ b/templates/admin/default/tax-rule-edit.html @@ -0,0 +1,228 @@ +{extends file="admin-layout.tpl"} + +{block name="page-title"}{intl l='Edit a tax rule'}{/block} + +{block name="check-permissions"}admin.configuration.taxes-rules.edit{/block} + +{block name="main-content"} +
+ +
+ + + +
+
+ +
+ {intl l="Edit tax rule $TITLE"} +
+ +
+ +
+ +
+ + + + +
+
+ +
+ +

{intl l="Countries that have the same tax rule"} :

+

+ Italy + England + Japan +

+ +
+
+ + + +
+
+

Create a tax rule

+
+
+ +
+

+ + {intl l="Add tax to this group"} +

+
+ +
+ +
+ + + +
+
+ +
+
+

List of taxes

+
+
+
Cras justo odio
+
Dapibus ac facilisis in
+
Morbi leo risus
+
Porta ac consectetur ac
+
Vestibulum at eros
+
+ +
+ +
+
+ +
+
+ +
+
+{/block} + +{block name="javascript-initialization"} + + {javascripts file='assets/js/bootstrap-select/bootstrap-select.js'} + + {/javascripts} + + {javascripts file='assets/js/main.js'} + + {/javascripts} + + + + +{/block} \ No newline at end of file