From e5f8f65f77bbc2e870051c45589b9665ff575430 Mon Sep 17 00:00:00 2001 From: mespeche Date: Fri, 30 Aug 2013 15:47:13 +0200 Subject: [PATCH] WIP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Suite de mise en place de la page d'édition des coupons avec miniBrowser --- templates/admin/default/assets/css/admin.less | 17 +- templates/admin/default/assets/js/main.js | 116 ++++++++ templates/admin/default/coupon/edit.html | 270 +++++++++++++++--- templates/admin/default/coupon/list.html | 25 +- templates/admin/default/coupon/read.html | 23 +- web/test_to_remove/datas_coupon_edit.json | 85 ++++++ 6 files changed, 454 insertions(+), 82 deletions(-) create mode 100644 templates/admin/default/assets/js/main.js create mode 100644 web/test_to_remove/datas_coupon_edit.json diff --git a/templates/admin/default/assets/css/admin.less b/templates/admin/default/assets/css/admin.less index a9ca23bf1..e2ef57293 100755 --- a/templates/admin/default/assets/css/admin.less +++ b/templates/admin/default/assets/css/admin.less @@ -47,7 +47,7 @@ filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",argb(@startColor),argb(@endColor))); // IE9 and down } .vertical(@startColor: #555, @endColor: #333) { - background-color: mix(@startColor, @endColor, 60%); + background-color: @endColor; background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+ background-image: -webkit-linear-gradient(top, @startColor, @endColor); // Safari 5.1+, Chrome 10+ @@ -158,7 +158,7 @@ hr { } .btn-primary, .btn-large { - #gradient > .vertical(rgb(243,153,34), rgb(227,83,11)); + #gradient > .vertical(rgb(243,153,34), rgb(227,83,11)); box-shadow: inset 0px 0px 2px rgba(250,250,250,0.5), 0px 1px 3px rgba(0,0,0,0.2); color: white; } @@ -874,9 +874,18 @@ label { .input-append, .input-prepend { &.date { - .add-on span { + span.add-on span { display: block; cursor: pointer; } } -} \ No newline at end of file +} + +// -- Rules form ----------------------------------------------------- +.input-append{ + button.add-on{ + height: auto; + } +} + + diff --git a/templates/admin/default/assets/js/main.js b/templates/admin/default/assets/js/main.js new file mode 100644 index 000000000..7b5cc812f --- /dev/null +++ b/templates/admin/default/assets/js/main.js @@ -0,0 +1,116 @@ +(function($, window, document){ + + $(function($){ + + // -- Init datepicker -- + if($('.date').length){ + $('.date').datepicker(); + } + + // -- Init tablesorter -- + if($('.tablesorter').length){ + $('.tablesorter').tablesorter(); + } + + // -- Effect description + if($('[name=effect]').length){ + var $effectSelect = $('[name=effect]'), + $helpBlock = $effectSelect.next('.help-block'); + + $effectSelect.change(function(){ + var description = $(this).find(":selected").data('description'); + $helpBlock.text(description); + }); + } + + // -- Confirm Box -- + if($('[data-toggle="confirm"]').length){ + $('[data-toggle="confirm"]').click(function(e){ + + var $link = $(this); + var modal = $(this).data('target'); + + $(modal).modal('show'); + + $(modal).on('shown', function () { + $('[data-confirm]').attr('href', $link.attr('href')); + }); + + if($(modal).is(':hidden')){ + e.preventDefault(); + } + + }); + } + + }); + + + +}(window.jQuery, window, document)); + +// -- Mini browser -- +function miniBrowser(root, url){ + + $.getJSON(url, { + root: root + }) + .done(function(data) { + var resultat = data; + + var breadcrumb = $('
'); + $(resultat.breadcrumb).each(function(k, v){ + breadcrumb.append( + $('').html(' > '), + $('').attr('href', '#').html(v.display).click(function(e){ + e.preventDefault(); + + miniBrowser(v.url) + }) + ); + }); + + var categories = $('
'); + $(resultat.categories).each(function(k, v){ + categories.append( + $('

').append( + $('').attr('href', '#').html(v.titre).click(function(e){ + e.preventDefault(); + + miniBrowser(v.id) + }) + ) + ); + }); + + var products = $('

'); + $(resultat.products).each(function(k, v){ + products.append( + $('

').append( + $('').attr('href', '#').html(v.titre).click(function(e){ + e.preventDefault(); + + $('#productToAdd_ref').val(v.ref); + $('#productToAdd_titre').val(v.titre); + $('#productToAdd_quantite').val(1); + + manageStock(v.variants, v.promo?v.prix2:v.prix); + + $('#productToAdd_tva').val(v.tva); + + $('.productToAddInformation').show(); + $('#btn_ajout_produit').show(); + }) + ) + ); + }); + + $('#fastBrowser_breadcrumb').unbind().empty().append(breadcrumb); + $('#fastBrowser_categories').unbind().empty().append(categories); + $('#fastBrowser_products').unbind().empty().append(products); + }) + .fail(function() { + console.log('The JSON file cant be read'); + }); + +} \ No newline at end of file diff --git a/templates/admin/default/coupon/edit.html b/templates/admin/default/coupon/edit.html index 56c2b6229..4ad8f28c0 100755 --- a/templates/admin/default/coupon/edit.html +++ b/templates/admin/default/coupon/edit.html @@ -17,12 +17,12 @@

+ +
-
-
- - - +
+
+
@@ -35,72 +35,270 @@
+ +
+ +
-
- +
- - + +
-
- - - More description n°1 about item -
+
+
+ + + More description n°1 about item +
+
+ +
+
+ + +
+
+ + +
+
+
+ +
+ +
+ + +
+ +
+ + +
+ + + +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Rules + + + +
ConditionsOperatorValueActions
Total Amount>=300 + Edit + Delete +
AND NbArticleFromCategory=12 - Chaussettes rouges + Edit + Delete +
OR Date<=12/02/2014 + Edit + Delete +
+
+
+ +
+
+ +
+ + +
- +
+ + -
-
+ + + + + +
+ +
+ +
+ +
+ + +
+
+ + +
+ +
+ + + +
+
+ + +
+ + + + + + + + + + + + + + + +
+ + + +
+ +
+ +
+ +
+ + + + + {include file='includes/js.inc.html'} {javascripts file='../assets/bootstrap-datepicker/js/bootstrap-datepicker.js'} {/javascripts} +{javascripts file='../assets/js/main.js'} + +{/javascripts} + diff --git a/templates/admin/default/coupon/list.html b/templates/admin/default/coupon/list.html index 3b13d6eac..882b27005 100755 --- a/templates/admin/default/coupon/list.html +++ b/templates/admin/default/coupon/list.html @@ -180,27 +180,8 @@ {/javascripts} - +{javascripts file='../assets/js/main.js'} + +{/javascripts} {include file='includes/footer.inc.html'} \ No newline at end of file diff --git a/templates/admin/default/coupon/read.html b/templates/admin/default/coupon/read.html index 9161f0d72..c4f61a022 100755 --- a/templates/admin/default/coupon/read.html +++ b/templates/admin/default/coupon/read.html @@ -99,25 +99,8 @@ {/javascripts} - - +{javascripts file='../assets/js/main.js'} + +{/javascripts} {include file='includes/footer.inc.html'} diff --git a/web/test_to_remove/datas_coupon_edit.json b/web/test_to_remove/datas_coupon_edit.json new file mode 100644 index 000000000..d64345682 --- /dev/null +++ b/web/test_to_remove/datas_coupon_edit.json @@ -0,0 +1,85 @@ +{ + "breadcrumb" : [ + { + "url" : "0", + "display" : "Racine", + "edit" : "", + "browse" : "" + } + ], + "categories" : [ + { + "id" : "1", + "ligne" : "1", + "classement" : "1", + "titre" : "Boyaux", + "langue_courante" : true, + "parent" : 0 + }, + { + "id" : "18", + "ligne" : "1", + "classement" : "2", + "titre" : "Epices \/ condiments", + "langue_courante" : true, + "parent" : 0 + }, + { + "id" : "100", + "ligne" : "1", + "classement" : "3", + "titre" : "Emballage", + "langue_courante" : true, + "parent" : 0 + }, + { + "id" : "194", + "ligne" : "1", + "classement" : "4", + "titre" : "Petits mat\u00e9riels", + "langue_courante" : true, + "parent" : 0 + }, + { + "id" : "355", + "ligne" : "1", + "classement" : "5", + "titre" : "Materiel de cuisine", + "langue_courante" : true, + "parent" : 0 + }, + { + "id" : "426", + "ligne" : "0", + "classement" : "6", + "titre" : "Bacs", + "langue_courante" : true, + "parent" : 0 + }, + { + "id" : "458", + "ligne" : "1", + "classement" : "7", + "titre" : "Hygi\u00e8ne & entretien", + "langue_courante" : true, + "parent" : 0 + }, + { + "id" : "592", + "ligne" : "1", + "classement" : "8", + "titre" : "Art de la table", + "langue_courante" : true, + "parent" : 0 + }, + { + "id" : "601", + "ligne" : "1", + "classement" : "9", + "titre" : "Mat\u00e9riels", + "langue_courante" : true, + "parent" : 0 + } + ], + "products":[] +} \ No newline at end of file