From cce43c2c0123d5eb21184be587b05ae172b66d05 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Thu, 19 Oct 2017 17:55:40 +0200 Subject: [PATCH] suite --- app/assets/javascripts/public.js.coffee | 102 +++++++++--------- app/assets/stylesheets/public.scss | 51 +++++++++ app/views/layouts/public.html.haml | 5 +- .../product_order_products/_cart.html.haml | 25 +++++ .../product_order_products/create.js.erb | 7 +- ...171019131823_add_image_to_lang_articles.rb | 5 - ...20171019131823_add_images_to_lang_pages.rb | 5 - 7 files changed, 138 insertions(+), 62 deletions(-) create mode 100644 app/views/public/product_order_products/_cart.html.haml delete mode 100644 db/migrate/20171019131823_add_image_to_lang_articles.rb delete mode 100644 db/migrate/20171019131823_add_images_to_lang_pages.rb diff --git a/app/assets/javascripts/public.js.coffee b/app/assets/javascripts/public.js.coffee index f86154f..e48dd4b 100755 --- a/app/assets/javascripts/public.js.coffee +++ b/app/assets/javascripts/public.js.coffee @@ -23,7 +23,59 @@ +@resize = -> + $("#document_cart").css('margin-top': (($(window).height()-($("#document_cart").outerHeight()+0))/ 2-30)+'px') + + $(".with_ratio").each -> + ratio = parseFloat($(this).data("ratio")) + height = $(this).width()*ratio + + $(this).css("height",height+"px") + + + $(".customer_message_list .height_frame").css + "height" : $(".customer_message_show").height()+"px" + min_height = 0 + min_height = $(window).height() - $(".top").height() - $(".top_home").height() - $(".bottom").height() - 30 + + $("#main").css("min-height", min_height+"px") + + $("iframe").each -> + $(this).css + "height" : Math.round($(this).width()/ 1.77)+"px" + + if $(window).width() > 1250 + $(".infos .main").css + "position" : "static" + $(".bottom_image").css + "left" : "0px" + + else + $(".infos .main").css + "position" : "relative" + $(".bottom_image").css + "left" : "-120px" + + + + + $("#large").css "min-height", ($(window).height()-30)+"px" + + $(".bxslider").each -> + + + height = ($(window).height()) + optimal_height = Math.round($(this).width()/ $(this).data("ratio")) + if optimal_height < height + height = optimal_height + + $(this).find("li").css("max-height", height+"px") + + + position_img_now(); + + @flash_delay = -> $("#flashs").find(".alert").each -> @@ -236,55 +288,7 @@ $("document").ready -> top = 0 offset= 0 - resize = -> - - $(".with_ratio").each -> - ratio = parseFloat($(this).data("ratio")) - height = $(this).width()*ratio - - $(this).css("height",height+"px") - - - $(".customer_message_list .height_frame").css - "height" : $(".customer_message_show").height()+"px" - min_height = 0 - min_height = $(window).height() - $(".top").height() - $(".top_home").height() - $(".bottom").height() - 30 - - $("#main").css("min-height", min_height+"px") - - $("iframe").each -> - $(this).css - "height" : Math.round($(this).width()/ 1.77)+"px" - - if $(window).width() > 1250 - $(".infos .main").css - "position" : "static" - $(".bottom_image").css - "left" : "0px" - - else - $(".infos .main").css - "position" : "relative" - $(".bottom_image").css - "left" : "-120px" - - - - - $("#large").css "min-height", ($(window).height()-30)+"px" - - $(".bxslider").each -> - - - height = ($(window).height()) - optimal_height = Math.round($(this).width()/ $(this).data("ratio")) - if optimal_height < height - height = optimal_height - - $(this).find("li").css("max-height", height+"px") - - - position_img_now(); + diff --git a/app/assets/stylesheets/public.scss b/app/assets/stylesheets/public.scss index 8e296b4..0933c62 100755 --- a/app/assets/stylesheets/public.scss +++ b/app/assets/stylesheets/public.scss @@ -16,6 +16,57 @@ @import "vendor/flipclock"; + + + +#document_cart_overlay{ + background:rgba(255,255,255,0.9); + position:fixed; + top:0; + left:0; + right:0; + bottom:0; + z-index:10000; + + #document_cart{ + position:relative; + width:90%; + max-width:600px; + margin:auto; + background:white; + text-align:center; + padding:20px; + box-shadow:0 0 10px rgba(0,0,0,0.3); + .button{ + padding:5px 10px; + text-transform:uppercase; + font-weight:bold; + cursor:pointer; + display:inline-block; + margin:20px 10px; + + } + + a{ + .button{ + color:white; + background:$orange; + } + } + } + .close{ + padding:5px 10px; + background:#F7F7F7; + position:absolute; + right:20px; + top:-30px; + cursor:hand; + } + +} + + + .reseaux_body{ .top{ diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml index 526d201..83a63d2 100755 --- a/app/views/layouts/public.html.haml +++ b/app/views/layouts/public.html.haml @@ -43,8 +43,9 @@ -if @reseaux_layout =link_to image_tag("/logo-mb.png", :id => "logo-mb"), "/" -if @reseaux_layout - .reseaux_top.with_ratio{:data => {:ratio => "0.2"},:style => "background-image:url('"+(@reseaux.background_image_file.file.large.url if @reseaux.background_image_file).to_s+"');"} - =link_to "" do + =link_to public_reseaux_products_path(:reseaux_id => session[:reseaux_id].to_i) do + .reseaux_top.with_ratio{:data => {:ratio => "0.2"},:style => "background-image:url('"+(@reseaux.background_image_file.file.large.url if @reseaux.background_image_file).to_s+"');"} + =image_tag @reseaux.logo_image_file.file.large.url, :class => "logo_reseaux" if @reseaux.logo_image_file diff --git a/app/views/public/product_order_products/_cart.html.haml b/app/views/public/product_order_products/_cart.html.haml new file mode 100644 index 0000000..f915511 --- /dev/null +++ b/app/views/public/product_order_products/_cart.html.haml @@ -0,0 +1,25 @@ +#document_cart_overlay{:onclick => "$(this).remove()"} + #document_cart + + %strong + =documents_number = @product_order.product_order_products.count + -if documents_number > 1 + articles sont prêts + -else + article est prêt + à être + -if documents_number > 1 + commandés + -else + commandé + + + .buttons + .button{:onclick => "$('#document_cart_overlay').remove()"} + Continuer ma visite + + =link_to public_my_cart_path do + .button + Commander + + diff --git a/app/views/public/product_order_products/create.js.erb b/app/views/public/product_order_products/create.js.erb index 687d8fe..e8b7e78 100644 --- a/app/views/public/product_order_products/create.js.erb +++ b/app/views/public/product_order_products/create.js.erb @@ -1,10 +1,15 @@ + $("#cart_infos").html("<%= escape_javascript(render(:partial => "public/shared/cart")) %>"); + $(".cart_link").animate({color: "#fecb31"}, function (){ $(".cart_link").animate({color: "black"}); }); -$(".cart_link").effect( "bounce", {times:5}, 1000 ); \ No newline at end of file + +$("body").append("<%= escape_javascript(render(:partial => "cart")) %>"); + +resize(); \ No newline at end of file diff --git a/db/migrate/20171019131823_add_image_to_lang_articles.rb b/db/migrate/20171019131823_add_image_to_lang_articles.rb deleted file mode 100644 index 77e86d3..0000000 --- a/db/migrate/20171019131823_add_image_to_lang_articles.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddImageToLangArticles < ActiveRecord::Migration - def change - add_column :lang_articles, :without_text_image_file_id, :integer - end -end diff --git a/db/migrate/20171019131823_add_images_to_lang_pages.rb b/db/migrate/20171019131823_add_images_to_lang_pages.rb deleted file mode 100644 index a83dcda..0000000 --- a/db/migrate/20171019131823_add_images_to_lang_pages.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddImageToLangPages < ActiveRecord::Migration - def change - add_column :lang_pages, :without_text_image_file_id, :integer - end -end