From efb5592bd07860f61bbdb61aa458c5420003c1a9 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Fri, 20 Jun 2014 17:37:27 +0200 Subject: [PATCH] nouvelle gestion des portlets --- app/assets/javascripts/admin.coffee | 462 ++++++++++-------- app/assets/stylesheets/admin.css.less | 44 +- .../portlet.old/block_contents_controller.rb | 111 +++++ .../portlet.old/break_contents_controller.rb | 116 +++++ .../download_contents_controller.rb | 109 +++++ .../dynamic_contents_controller.rb | 116 +++++ .../portlet.old/event_contents_controller.rb | 100 ++++ .../gallery_contents_controller.rb | 109 +++++ .../portlet.old/gallery_images_controller.rb | 82 ++++ .../portlet.old/html_contents_controller.rb | 116 +++++ .../portlet.old/image_contents_controller.rb | 100 ++++ .../img_link_contents_controller.rb | 112 +++++ .../portlet.old/link_contents_controller.rb | 110 +++++ .../portlet.old/map_contents_controller.rb | 116 +++++ .../portlet.old/portlets_controller.rb | 124 +++++ .../portlet.old/table_cols_controller.rb | 35 ++ .../portlet.old/table_contents_controller.rb | 108 ++++ .../portlet.old/table_rows_controller.rb | 106 ++++ .../portlet.old/text_contents_controller.rb | 116 +++++ .../portlet.old/title_contents_controller.rb | 116 +++++ .../portlet/title_contents_controller.rb | 4 +- app/views/admin/pages/_page.html.haml | 79 +-- .../block_contents/_block_content.html.haml | 20 + .../block_contents/_form.html.haml | 89 ++++ .../break_contents/_break_content.html.haml | 1 + .../break_contents/_form.html.haml | 15 + .../_download_content.html.haml | 8 + .../download_contents/_form.html.haml | 39 ++ .../_dynamic_content.html.haml | 1 + .../dynamic_contents/_form.html.haml | 18 + .../event_contents/_event_content.html.haml | 48 ++ .../event_contents/_form.html.haml | 56 +++ .../gallery_contents/_form.html.haml | 9 + .../_gallery_content.html.haml | 18 + .../gallery_images/_form.html.haml | 32 ++ .../gallery_images/_gallery_image.html.haml | 9 + .../portlet.old/gallery_images/create.js.erb | 1 + .../portlet.old/gallery_images/destroy.js.erb | 4 + .../portlet.old/gallery_images/edit.js.erb | 2 + .../portlet.old/gallery_images/reorder.js.erb | 0 .../portlet.old/gallery_images/update.js.erb | 5 + .../portlet.old/html_contents/_form.html.haml | 60 +++ .../html_contents/_html_content.html.haml | 11 + .../image_contents/_form.html.haml | 32 ++ .../image_contents/_image_content.html.haml | 42 ++ .../img_link_contents/_form.html.haml | 20 + .../_img_link_content.html.haml | 16 + .../portlet.old/link_contents/_form.html.haml | 14 + .../link_contents/_link_content.html.haml | 10 + .../portlet.old/map_contents/_form.html.haml | 26 + .../map_contents/_map_content.html.haml | 64 +++ .../portlet.old/portlets/_portlet.html.haml | 34 ++ app/views/portlet.old/portlets/new.html.haml | 7 + app/views/portlet.old/portlets/new.js.erb | 12 + app/views/portlet.old/portlets/update.js.erb | 8 + app/views/portlet.old/shared/_new.html.haml | 6 + app/views/portlet.old/shared/create.js.erb | 13 + app/views/portlet.old/shared/destroy.js.erb | 4 + app/views/portlet.old/shared/edit.js.erb | 18 + app/views/portlet.old/shared/new.js.erb | 21 + app/views/portlet.old/shared/update.js.erb | 7 + .../portlet.old/table_cols/create.js.erb | 4 + .../portlet.old/table_cols/destroy.js.erb | 4 + .../table_contents/_form.html.haml | 22 + .../table_contents/_table_content.html.haml | 46 ++ .../_table_content_edit_pane.html.haml | 33 ++ .../table_contents/destroy_row.js.erb | 6 + .../portlet.old/table_rows/create.js.erb | 4 + .../portlet.old/table_rows/destroy.js.erb | 4 + .../portlet.old/text_contents/_form.html.haml | 35 ++ .../text_contents/_text_content.html.haml | 1 + .../title_contents/_form.html.haml | 15 + .../title_contents/_title_content.html.haml | 4 + app/views/portlet/portlets/_portlet.html.haml | 14 +- app/views/portlet/shared/edit.js.erb | 13 +- app/views/portlet/shared/update.js.erb | 4 +- .../portlet/text_contents/_form.html.haml | 99 ++-- .../text_contents/_text_content.html.haml | 3 +- .../portlet/title_contents/_form.html.haml | 2 +- .../render_public/_blockcontent.html.haml | 30 ++ .../render_public/_breakcontent.html.haml | 1 + .../render_public/_downloadcontent.html.haml | 11 + .../render_public/_dynamiccontent.html.haml | 3 + .../render_public/_eventcontent.html.haml | 106 ++++ .../render_public/_gallerycontent.html.haml | 136 ++++++ .../render_public/_htmlcontent.html.haml | 5 + .../render_public/_imagecontent.html.haml | 51 ++ .../render_public/_imglinkcontent.html.haml | 27 + .../render_public/_linkcontent.html.haml | 6 + .../render_public/_mapcontent.html.haml | 64 +++ .../render_public/_tablecontent.html.haml | 74 +++ .../render_public/_textcontent.html.haml | 1 + .../render_public/_titlecontent.html.haml | 5 + .../render_public/_gallerycontent.html.haml | 3 +- .../render_public/_imagecontent.html.haml | 54 +- .../render_public/_tablecontent.html.haml | 2 +- .../render_public/_textcontent.html.haml | 5 +- .../render_public/_titlecontent.html.haml | 5 +- 98 files changed, 3854 insertions(+), 339 deletions(-) create mode 100644 app/controllers/portlet.old/block_contents_controller.rb create mode 100644 app/controllers/portlet.old/break_contents_controller.rb create mode 100644 app/controllers/portlet.old/download_contents_controller.rb create mode 100644 app/controllers/portlet.old/dynamic_contents_controller.rb create mode 100644 app/controllers/portlet.old/event_contents_controller.rb create mode 100644 app/controllers/portlet.old/gallery_contents_controller.rb create mode 100644 app/controllers/portlet.old/gallery_images_controller.rb create mode 100644 app/controllers/portlet.old/html_contents_controller.rb create mode 100644 app/controllers/portlet.old/image_contents_controller.rb create mode 100644 app/controllers/portlet.old/img_link_contents_controller.rb create mode 100644 app/controllers/portlet.old/link_contents_controller.rb create mode 100644 app/controllers/portlet.old/map_contents_controller.rb create mode 100644 app/controllers/portlet.old/portlets_controller.rb create mode 100644 app/controllers/portlet.old/table_cols_controller.rb create mode 100644 app/controllers/portlet.old/table_contents_controller.rb create mode 100644 app/controllers/portlet.old/table_rows_controller.rb create mode 100644 app/controllers/portlet.old/text_contents_controller.rb create mode 100644 app/controllers/portlet.old/title_contents_controller.rb create mode 100644 app/views/portlet.old/block_contents/_block_content.html.haml create mode 100644 app/views/portlet.old/block_contents/_form.html.haml create mode 100644 app/views/portlet.old/break_contents/_break_content.html.haml create mode 100644 app/views/portlet.old/break_contents/_form.html.haml create mode 100644 app/views/portlet.old/download_contents/_download_content.html.haml create mode 100644 app/views/portlet.old/download_contents/_form.html.haml create mode 100644 app/views/portlet.old/dynamic_contents/_dynamic_content.html.haml create mode 100644 app/views/portlet.old/dynamic_contents/_form.html.haml create mode 100644 app/views/portlet.old/event_contents/_event_content.html.haml create mode 100644 app/views/portlet.old/event_contents/_form.html.haml create mode 100644 app/views/portlet.old/gallery_contents/_form.html.haml create mode 100644 app/views/portlet.old/gallery_contents/_gallery_content.html.haml create mode 100644 app/views/portlet.old/gallery_images/_form.html.haml create mode 100644 app/views/portlet.old/gallery_images/_gallery_image.html.haml create mode 100644 app/views/portlet.old/gallery_images/create.js.erb create mode 100644 app/views/portlet.old/gallery_images/destroy.js.erb create mode 100644 app/views/portlet.old/gallery_images/edit.js.erb create mode 100644 app/views/portlet.old/gallery_images/reorder.js.erb create mode 100644 app/views/portlet.old/gallery_images/update.js.erb create mode 100644 app/views/portlet.old/html_contents/_form.html.haml create mode 100644 app/views/portlet.old/html_contents/_html_content.html.haml create mode 100644 app/views/portlet.old/image_contents/_form.html.haml create mode 100644 app/views/portlet.old/image_contents/_image_content.html.haml create mode 100644 app/views/portlet.old/img_link_contents/_form.html.haml create mode 100644 app/views/portlet.old/img_link_contents/_img_link_content.html.haml create mode 100644 app/views/portlet.old/link_contents/_form.html.haml create mode 100644 app/views/portlet.old/link_contents/_link_content.html.haml create mode 100644 app/views/portlet.old/map_contents/_form.html.haml create mode 100644 app/views/portlet.old/map_contents/_map_content.html.haml create mode 100644 app/views/portlet.old/portlets/_portlet.html.haml create mode 100644 app/views/portlet.old/portlets/new.html.haml create mode 100644 app/views/portlet.old/portlets/new.js.erb create mode 100644 app/views/portlet.old/portlets/update.js.erb create mode 100644 app/views/portlet.old/shared/_new.html.haml create mode 100644 app/views/portlet.old/shared/create.js.erb create mode 100644 app/views/portlet.old/shared/destroy.js.erb create mode 100644 app/views/portlet.old/shared/edit.js.erb create mode 100644 app/views/portlet.old/shared/new.js.erb create mode 100644 app/views/portlet.old/shared/update.js.erb create mode 100644 app/views/portlet.old/table_cols/create.js.erb create mode 100644 app/views/portlet.old/table_cols/destroy.js.erb create mode 100644 app/views/portlet.old/table_contents/_form.html.haml create mode 100644 app/views/portlet.old/table_contents/_table_content.html.haml create mode 100644 app/views/portlet.old/table_contents/_table_content_edit_pane.html.haml create mode 100644 app/views/portlet.old/table_contents/destroy_row.js.erb create mode 100644 app/views/portlet.old/table_rows/create.js.erb create mode 100644 app/views/portlet.old/table_rows/destroy.js.erb create mode 100644 app/views/portlet.old/text_contents/_form.html.haml create mode 100644 app/views/portlet.old/text_contents/_text_content.html.haml create mode 100644 app/views/portlet.old/title_contents/_form.html.haml create mode 100644 app/views/portlet.old/title_contents/_title_content.html.haml create mode 100644 app/views/portlets.old/render_public/_blockcontent.html.haml create mode 100644 app/views/portlets.old/render_public/_breakcontent.html.haml create mode 100644 app/views/portlets.old/render_public/_downloadcontent.html.haml create mode 100644 app/views/portlets.old/render_public/_dynamiccontent.html.haml create mode 100644 app/views/portlets.old/render_public/_eventcontent.html.haml create mode 100644 app/views/portlets.old/render_public/_gallerycontent.html.haml create mode 100644 app/views/portlets.old/render_public/_htmlcontent.html.haml create mode 100644 app/views/portlets.old/render_public/_imagecontent.html.haml create mode 100644 app/views/portlets.old/render_public/_imglinkcontent.html.haml create mode 100644 app/views/portlets.old/render_public/_linkcontent.html.haml create mode 100644 app/views/portlets.old/render_public/_mapcontent.html.haml create mode 100644 app/views/portlets.old/render_public/_tablecontent.html.haml create mode 100644 app/views/portlets.old/render_public/_textcontent.html.haml create mode 100644 app/views/portlets.old/render_public/_titlecontent.html.haml diff --git a/app/assets/javascripts/admin.coffee b/app/assets/javascripts/admin.coffee index 841926c..b780b8c 100644 --- a/app/assets/javascripts/admin.coffee +++ b/app/assets/javascripts/admin.coffee @@ -37,244 +37,278 @@ @flash_delay = -> - $("#flashs").find(".alert").each -> - - if !$(this).hasClass("delay") - $(this).addClass("delay") - $(this).delay(3000).fadeOut(); - - + $("#flashs").find(".alert").each -> + + if !$(this).hasClass("delay") + $(this).addClass("delay") + $(this).delay(3000).fadeOut(); + + @init_menu_items_list = -> - - if $(".prevv_folder").length > 0 - - $(".prevv_folder").sortable({ - group:"menu_items", - containerSelector :".receptable", - itemSelector:".menu_item_row", - handle: ".handle", - nested:false, - placeholder:"
", + + if $(".prevv_folder").length > 0 + + $(".prevv_folder").sortable({ + group:"menu_items", + containerSelector :".receptable", + itemSelector:".menu_item_row", + handle: ".handle", + nested:false, + placeholder:"
", - - }) - oldContainer = "" - $("#sortable_menu_item").sortable({ - group:"menu_items", - containerSelector :".receptable", - itemSelector:".menu_item_row", - handle: ".handle", - nested:true, - placeholder:"
", - afterMove: (placeholder, container) -> - if oldContainer != container and container.el.hasClass("prevv_folder") - if oldContainer - oldContainer.el.removeClass("active") - container.el.addClass("active") - oldContainer = container - onDrop: (item, Container, _super) -> - - - if Container - - parent_id = Container.el.data("parent-id") - menu_id = Container.el.data("menu-id") - id = item.data("menu-item-id") - $.ajax({ - url:"/admin/menu_items/"+id+".js", - type: "PUT", - data: { - reorder : true, - menu_item : { - parent_id : parent_id, - menu_id : menu_id - } - }, - success : -> - - - _super(item) - item.remove() - - }) - - - - - - else + + }) + oldContainer = "" + $("#sortable_menu_item").sortable({ + group:"menu_items", + containerSelector :".receptable", + itemSelector:".menu_item_row", + handle: ".handle", + nested:true, + placeholder:"
", + afterMove: (placeholder, container) -> + if oldContainer != container and container.el.hasClass("prevv_folder") + if oldContainer + oldContainer.el.removeClass("active") + container.el.addClass("active") + oldContainer = container + onDrop: (item, Container, _super) -> + + + if Container + + parent_id = Container.el.data("parent-id") + menu_id = Container.el.data("menu-id") + id = item.data("menu-item-id") + $.ajax({ + url:"/admin/menu_items/"+id+".js", + type: "PUT", + data: { + reorder : true, + menu_item : { + parent_id : parent_id, + menu_id : menu_id + } + }, + success : -> + + + _super(item) + item.remove() + + }) + + + + + + else - - - _super(item) - - sortable_data = {parent_id :$("#sortable_menu_item").data("parent-id"), menu_id :$("#sortable_menu_item").data("menu-id") , menu_items_ids : []} - - $("#sortable_menu_item").find(".menu_item_row").each -> - sortable_data.menu_items_ids.push $(this).data("menu-item-id") - - - $.ajax({url : "/admin/menu_items/reorder", data : sortable_data, type: "POST"}); - - }) - + + + _super(item) + + sortable_data = {parent_id :$("#sortable_menu_item").data("parent-id"), menu_id :$("#sortable_menu_item").data("menu-id") , menu_items_ids : []} + + $("#sortable_menu_item").find(".menu_item_row").each -> + sortable_data.menu_items_ids.push $(this).data("menu-item-id") + + + $.ajax({url : "/admin/menu_items/reorder", data : sortable_data, type: "POST"}); + + }) + @update_block_portlet_order = (block_portlet_id) -> - return_order = [] - - block_portlet = $("#block_portlet_"+block_portlet_id) - - block_data = {block_id : block_portlet.data('block_id'), block_portlet_ids : []} + return_order = [] + + block_portlet = $("#block_portlet_"+block_portlet_id) + + block_data = {block_id : block_portlet.data('block_id'), block_portlet_ids : []} - block_portlet.children('.portlet').each -> - if $(this).data('portlet_id') - block_data.block_portlet_ids.push($(this).data('portlet_id')) - + block_portlet.children('.portlet').each -> + if $(this).data('portlet_id') + block_data.block_portlet_ids.push($(this).data('portlet_id')) + - - return_order.push(block_data); + + return_order.push(block_data); - $.ajax({url : "/portlet/portlets/reorder", data : {blocks:return_order}, type: "POST"}) - + $.ajax({url : "/portlet/portlets/reorder", data : {blocks:return_order}, type: "POST"}) + jQuery -> - + + $(".inline-contenteditable").keypress (e) -> + if e.which == 13 + false + else + $(this).html($(this).text()) + return true + + + $(document).on 'click', ".portlet_title_content .inline-contenteditable", () -> + + $.ajax + url : "/portlet/title_contents/"+$(this).data("title-id")+"/edit.js", + type: "GET", + + $(document).on 'blur keyup paste', ".portlet_title_content .inline-contenteditable", () -> + $(this).html($(this).text()) + $.ajax + url : "/portlet/title_contents/"+$(this).data("title-id"), + type: "PUT", + data : + title_content : + content : $(this).html() + - $(".sortable").sortable({ + $(".sortable").sortable({ - containerSelector :".block", - itemSelector:".portlet", - handle: ".handle", - nested:true, - placeholder:"
" - - }) - - - - - - flash_delay(); - + containerSelector :".block", + itemSelector:".portlet", + handle: ".handle", + nested:true, + placeholder:"
" + + }) + + + + + + flash_delay(); + - item_catched = "" - $(".block_portlets_sortable").sortable({ - nested:true, - handle: ".handle", - group : "block_portlets", - containerSelector :".block_portlets", - itemSelector:".portlet", - placeholder:"
", - onDrop: ($item, container, _super) -> - - $item.removeClass("dragged").removeAttr("style") - $("body").removeClass("dragging") - - - if $item.data("portlet_id") - - block_portlet_id = $item.closest(".block_portlets").data('block_id') - - update_block_portlet_order block_portlet_id - - - else - $("#content_types").html item_catched - - block_id = container.el.data("block_id") - - - $item.replaceWith('
'); - - $.ajax({ - url:"/portlet/portlets/new.js", - type: "GET", - data: { - block_id : $(this).attr("data_block_id"), - position : $(this).attr("data_position"), - content_type : $item.attr("data_type") - } - - }) - - - - isValidTarget: ($item, container) -> - - if container.el.attr("id") != "content_types" - return true - - onDragStart: ($item, container, _super) -> - item_catched = $("#content_types").html() - - - $item.css({ - height: $item.height(), - width: $item.width() - }) - $item.addClass("dragged") - $("body").addClass("dragging") - - - - }) - - - - adjustment = "" - - $("#menu_item_inspector_container").sortable({ + item_catched = "" + $(".block_portlets_sortable").sortable({ + nested:true, + handle: ".handle", + group : "block_portlets", + containerSelector :".block_portlets", + itemSelector:".portlet", + placeholder:"
", + onDrop: ($item, container, _super) -> + + $item.removeClass("dragged").removeAttr("style") + $("body").removeClass("dragging") + + + if $item.data("portlet_id") + + block_portlet_id = $item.closest(".block_portlets").data('block_id') + + update_block_portlet_order block_portlet_id + + + else + $("#content_types").html item_catched + + block_id = container.el.data("block_id") + + + $item.replaceWith('
'); + + $.ajax({ + url:"/portlet/portlets/new.js", + type: "GET", + data: { + block_id : $(this).attr("data_block_id"), + position : $(this).attr("data_position"), + content_type : $item.attr("data_type") + } + + }) + + + + isValidTarget: ($item, container) -> + + if container.el.attr("id") != "content_types" + return true + + onDragStart: ($item, container, _super) -> + item_catched = $("#content_types").html() + + + $item.css({ + height: $item.height(), + width: $item.width() + }) + $item.addClass("dragged") + $("body").addClass("dragging") + + + + }) + + + + adjustment = "" + + $("#menu_item_inspector_container").sortable({ - itemSelector:"#menu_item_informations", - pullPlaceholder :false, - placeholder : "", - handle: ".inspector_handle", - onDragStart: ($item, container, _super) -> - $item.css({ - height: $item.height(), - width: $item.width() - }) - - $("body").addClass("dragging") - - offset = $item.offset() - pointer = container.rootGroup.pointer - adjustment = { - left: pointer.left - offset.left, - top: pointer.top - offset.top - } - - onCancel : ($item, container, _super) -> - $item.css(position) - $item.removeClass("dragged") - $("body").removeClass("dragging") - - onDrag: ($item, position, _super) -> + itemSelector:"#menu_item_informations", + pullPlaceholder :false, + placeholder : "", + handle: ".inspector_handle", + onDragStart: ($item, container, _super) -> + $item.css({ + height: $item.height(), + width: $item.width() + }) + + $("body").addClass("dragging") + + offset = $item.offset() + pointer = container.rootGroup.pointer + adjustment = { + left: pointer.left - offset.left, + top: pointer.top - offset.top + } + + onCancel : ($item, container, _super) -> + $item.css(position) + $item.removeClass("dragged") + $("body").removeClass("dragging") + + onDrag: ($item, position, _super) -> - $item.css({ - left: position.left - adjustment.left, - top: position.top - adjustment.top - $(window).scrollTop() - }) + $item.css({ + left: position.left - adjustment.left, + top: position.top - adjustment.top - $(window).scrollTop() + }) - - }) - - + + }) + + $(document).on "mouseover", ".portlet", -> - - $(this).children(".btn-toolbar").show() - + + $(this).children(".btn-toolbar").show() + $(document).on "mouseout", ".portlet div", -> - $(".btn-toolbar").hide() - - - + $(".btn-toolbar").hide() + + +$(document).on "scroll", () -> + + if( $(this).scrollTop() <= 40 ) + top = 40 - $(this).scrollTop() + else + top = 0 + + $("#toolbar-text, #menu_item_informations").css + top : top + + + diff --git a/app/assets/stylesheets/admin.css.less b/app/assets/stylesheets/admin.css.less index 3f52c0b..1b95f63 100644 --- a/app/assets/stylesheets/admin.css.less +++ b/app/assets/stylesheets/admin.css.less @@ -153,13 +153,16 @@ text-decoration:none; - #toolbar-text{ - position:fixed; - top:40px; - left:0px; - right:0px; + #toolbar-text{ + position:fixed; + z-index:2; + box-shadow: #000000 0px 0px 5px; + top:40px; + left:0px; + right:330px; + - } + } #flashs{ position:fixed; @@ -268,11 +271,29 @@ text-decoration:none; } #menu_item_informations{ + + + form{ + + .preview{ + + img{ + height:50px; + + } + } + } + position:fixed; - top:100px; - right:2em; + z-index:3; + overflow:auto; + box-shadow:rgba(0,0,0,1) 0px 0px 5px; + margin-bottom:0px; + top:40px; + right:0px; width:330px; - height:70%; + bottom:0px; + background:white; .placeholder{ display:inline-block; width:91px; @@ -310,9 +331,9 @@ text-decoration:none; #menu_item_inspector_container{ .accordion{ - box-shadow:rgba(0,0,0,1) 0px 0px 5px; + height:auto; - background:black; + } .accordion-group{ @@ -351,6 +372,7 @@ text-decoration:none; .portlet{ img{height:50px;cursor:pointer;} + } } diff --git a/app/controllers/portlet.old/block_contents_controller.rb b/app/controllers/portlet.old/block_contents_controller.rb new file mode 100644 index 0000000..cc92966 --- /dev/null +++ b/app/controllers/portlet.old/block_contents_controller.rb @@ -0,0 +1,111 @@ +# -*- encoding : utf-8 -*- +class Portlet::BlockContentsController < ApplicationController + layout "admin" + + def new + @block_content = BlockContent.new(:nbr_columns => 2) + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + def create + @block_content = BlockContent.new(params.require(:block_content).permit!) + + respond_to do |format| + if @block_content.save + @block_content.nbr_columns.times do + @block = Block.new(:block_name => "") + @block.blockable = @block_content + @block.save + end + + @portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @block_content) + + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + + end + + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js { render :template => "portlet/shared/create" } + else + format.html { render :action => "new" } + format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @block_content = BlockContent.find(params[:id]) + @portlet = Portlet.find(params[:portlet_id]) + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @block_content = BlockContent.find(params[:id]) + @portlet = @block_content.portlet + + respond_to do |format| + if @block_content.update_attributes(params.require(:block_content).permit!) + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + + end + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + @portlet = Portlet.find(params[:portlet_id]) + @block_content = BlockContent.find(params[:id]) + @block_content.destroy + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + + end + + respond_to do |format| + format.html {} + format.js { render :template => "portlet/shared/destroy" } + end + end + + +end diff --git a/app/controllers/portlet.old/break_contents_controller.rb b/app/controllers/portlet.old/break_contents_controller.rb new file mode 100644 index 0000000..4f136f2 --- /dev/null +++ b/app/controllers/portlet.old/break_contents_controller.rb @@ -0,0 +1,116 @@ +# -*- encoding : utf-8 -*- +class Portlet::BreakContentsController < ApplicationController + layout "admin" + + def new + @break_content = BreakContent.new(:line => true) + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + def create + @break_content = BreakContent.new(params.require(:break_content).permit) + + respond_to do |format| + if @break_content.save + + + @portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @break_content) + + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + #to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)") + end + end + + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js { render :template => "portlet/shared/create" } + else + format.html { render :action => "new" } + format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @break_content = BreakContent.find(params[:id]) + @portlet = Portlet.find(params[:portlet_id]) + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @break_content = BreakContent.find(params[:id]) + @portlet = @break_content.portlet + + respond_to do |format| + if @break_content.update_attributes(params.require(:break_content).permit!) + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + #to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)") + end + end + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + @portlet = Portlet.find(params[:portlet_id]) + @break_content = BreakContent.find(params[:id]) + @break_content.destroy + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + ##to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)") + end + end + + respond_to do |format| + format.html {} + format.js { render :template => "portlet/shared/destroy" } + end + end + + +end diff --git a/app/controllers/portlet.old/download_contents_controller.rb b/app/controllers/portlet.old/download_contents_controller.rb new file mode 100644 index 0000000..fff4014 --- /dev/null +++ b/app/controllers/portlet.old/download_contents_controller.rb @@ -0,0 +1,109 @@ +# -*- encoding : utf-8 -*- +class Portlet::DownloadContentsController < ApplicationController + layout "admin" + + def new + @download_content = DownloadContent.new + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + def create + @download_content = DownloadContent.new(params.require(:download_content).permit!) + + respond_to do |format| + if @download_content.save + + + @portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @download_content) + + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + #to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)") + end + end + + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js { render :template => "portlet/shared/create" } + else + format.html { render :action => "new" } + format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @download_content = DownloadContent.find(params[:id]) + @portlet = Portlet.find(params[:portlet_id]) + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @download_content = DownloadContent.find(params[:id]) + @portlet = @download_content.portlet + + respond_to do |format| + if @download_content.update_attributes(params.require(:download_content).permit!) + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + @portlet = Portlet.find(params[:portlet_id]) + @download_content = DownloadContent.find(params[:id]) + @download_content.destroy + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + ##to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)") + end + end + + respond_to do |format| + format.html {} + format.js { render :template => "portlet/shared/destroy" } + end + end + + +end diff --git a/app/controllers/portlet.old/dynamic_contents_controller.rb b/app/controllers/portlet.old/dynamic_contents_controller.rb new file mode 100644 index 0000000..3800542 --- /dev/null +++ b/app/controllers/portlet.old/dynamic_contents_controller.rb @@ -0,0 +1,116 @@ +# -*- encoding : utf-8 -*- +class Portlet::DynamicContentsController < ApplicationController + layout "admin" + + def new + @dynamic_content = DynamicContent.new + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + def create + @dynamic_content = DynamicContent.new(params.require(:dynamic_content).permit!) + + respond_to do |format| + if @dynamic_content.save + + + @portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @dynamic_content) + + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + #to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)") + end + end + + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js { render :template => "portlet/shared/create" } + else + format.html { render :action => "new" } + format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @dynamic_content = DynamicContent.find(params[:id]) + @portlet = Portlet.find(params[:portlet_id]) + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @dynamic_content = DynamicContent.find(params[:id]) + @portlet = @dynamic_content.portlet + + respond_to do |format| + if @dynamic_content.update_attributes(paramsparams.require(:dynamic_content).permit!) + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + #to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)") + end + end + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + @portlet = Portlet.find(params[:portlet_id]) + @dynamic_content = DynamicContent.find(params[:id]) + @dynamic_content.destroy + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + ##to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)") + end + end + + respond_to do |format| + format.html {} + format.js { render :template => "portlet/shared/destroy" } + end + end + + +end diff --git a/app/controllers/portlet.old/event_contents_controller.rb b/app/controllers/portlet.old/event_contents_controller.rb new file mode 100644 index 0000000..86322be --- /dev/null +++ b/app/controllers/portlet.old/event_contents_controller.rb @@ -0,0 +1,100 @@ +# -*- encoding : utf-8 -*- +class Portlet::EventContentsController < ApplicationController + layout "admin" + + def new + @event_content = EventContent.new() + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + def create + @event_content = EventContent.new(params.require(:event_content).permit!) + + respond_to do |format| + if @event_content.save + + + @portlet = Portlet.create(:content => @event_content) + + + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js { render :template => "portlet/shared/create" } + else + format.html { render :action => "new" } + format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @event_content = EventContent.find(params[:id]) + @portlet = Portlet.find(params[:portlet_id]) + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @event_content = EventContent.find(params[:id]) + @portlet = @event_content.portlet + + respond_to do |format| + if @event_content.update_attributes(params.require(:event_content).permit!) + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + #to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)") + end + end + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + @portlet = Portlet.find(params[:portlet_id]) + @event_content = EventContent.find(params[:id]) + @event_content.destroy + + + + respond_to do |format| + format.html {} + format.js { render :template => "portlet/shared/destroy" } + end + end + + +end diff --git a/app/controllers/portlet.old/gallery_contents_controller.rb b/app/controllers/portlet.old/gallery_contents_controller.rb new file mode 100644 index 0000000..aa51bb2 --- /dev/null +++ b/app/controllers/portlet.old/gallery_contents_controller.rb @@ -0,0 +1,109 @@ +# -*- encoding : utf-8 -*- +class Portlet::GalleryContentsController < ApplicationController + layout "admin" + + def new + @gallery_content = GalleryContent.new + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + + def create + @gallery_content = GalleryContent.new(params.require(:gallery_content).permit!) + + respond_to do |format| + if @gallery_content.save + + + @portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @gallery_content) + + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + #to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)") + end + end + + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js { render :template => "portlet/shared/create" } + else + format.html { render :action => "new" } + format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @gallery_content = GalleryContent.find(params[:id]) + @portlet = @gallery_content.portlet + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @gallery_content = GalleryContent.find(params[:id]) + @portlet = @gallery_content.portlet + + respond_to do |format| + if @gallery_content.update_attributes(params.require(:gallery_content).permit!) + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + @portlet = Portlet.find(params[:portlet_id]) + @gallery_content = GalleryContent.find(params[:id]) + @gallery_content.destroy + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + ##to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)") + end + end + + respond_to do |format| + format.html {} + format.js { render :template => "portlet/shared/destroy" } + end + end + + +end diff --git a/app/controllers/portlet.old/gallery_images_controller.rb b/app/controllers/portlet.old/gallery_images_controller.rb new file mode 100644 index 0000000..4b19a5d --- /dev/null +++ b/app/controllers/portlet.old/gallery_images_controller.rb @@ -0,0 +1,82 @@ +# -*- encoding : utf-8 -*- +class Portlet::GalleryImagesController < ApplicationController + layout "admin" + + + def reorder + i = 0 + params[:order].each do |gallery_image_id| + i += 1 + gallery_image = GalleryImage.find(gallery_image_id) + gallery_image.position = i + gallery_image.save + end + + end + + def create + + @gallery_content = GalleryContent.find(params[:gallery_content_id]) + @gallery_images = [] + if params[:image_file_ids].kind_of?(Array) + params[:image_file_ids].each do |image_file_id| + image_file = ImageFile.find(image_file_id) + gallery_image = GalleryImage.create(:image_file_id => image_file.id, :title => image_file.name, :description => image_file.description, :gallery_content_id => @gallery_content.id ) + + @gallery_images << gallery_image + end + end + + + + respond_to do |format| + + format.js + + end + end + + + + def edit + @gallery_image = GalleryImage.find(params[:id]) + + if request.xhr? + render :layout => false + end + + end + + + + + + def show + + + end + + def update + @gallery_image = GalleryImage.find(params[:id]) + respond_to do |format| + if @gallery_image.update_attributes(params.require(:gallery_image).permit!) + + format.js + else + format.html { render :action => "edit", :layout => false} + format.js { render :action => "edit" } + end + + end + end + + def destroy + + @gallery_image = GalleryImage.find(params[:id]) + @gallery_image.destroy + + + end + + +end diff --git a/app/controllers/portlet.old/html_contents_controller.rb b/app/controllers/portlet.old/html_contents_controller.rb new file mode 100644 index 0000000..522cf6b --- /dev/null +++ b/app/controllers/portlet.old/html_contents_controller.rb @@ -0,0 +1,116 @@ +# -*- encoding : utf-8 -*- +class Portlet::HtmlContentsController < ApplicationController + layout "admin" + + def new + @html_content = HtmlContent.new + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + def create + @html_content = HtmlContent.new(params.require(:html_content).permit!) + + respond_to do |format| + if @html_content.save + + + @portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @html_content) + + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + #to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)") + end + end + + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js { render :template => "portlet/shared/create" } + else + format.html { render :action => "new" } + format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @html_content = HtmlContent.find(params[:id]) + @portlet = Portlet.find(params[:portlet_id]) + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @html_content = HtmlContent.find(params[:id]) + @portlet = @html_content.portlet + + respond_to do |format| + if @html_content.update_attributes(params.require(:html_content).permit!) + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + #to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)") + end + end + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + @portlet = Portlet.find(params[:portlet_id]) + @html_content = HtmlContent.find(params[:id]) + @html_content.destroy + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + # #to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)") + end + end + + respond_to do |format| + format.html {} + format.js { render :template => "portlet/shared/destroy" } + end + end + + +end diff --git a/app/controllers/portlet.old/image_contents_controller.rb b/app/controllers/portlet.old/image_contents_controller.rb new file mode 100644 index 0000000..b956d49 --- /dev/null +++ b/app/controllers/portlet.old/image_contents_controller.rb @@ -0,0 +1,100 @@ +# -*- encoding : utf-8 -*- +class Portlet::ImageContentsController < ApplicationController + layout "admin" + + def new + @image_content = ImageContent.new(:expandable => true) + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + def create + @image_content = ImageContent.new(params.require(:image_content).permit!) + + respond_to do |format| + if @image_content.save + + + @portlet = Portlet.create(:content => @image_content) + + + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js { render :template => "portlet/shared/create" } + else + format.html { render :action => "new" } + format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @image_content = ImageContent.find(params[:id]) + @portlet = Portlet.find(params[:portlet_id]) + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @image_content = ImageContent.find(params[:id]) + @portlet = @image_content.portlet + + respond_to do |format| + if @image_content.update_attributes(params.require(:image_content).permit!) + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + #to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)") + end + end + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + @portlet = Portlet.find(params[:portlet_id]) + @image_content = ImageContent.find(params[:id]) + @image_content.destroy + + + + respond_to do |format| + format.html {} + format.js { render :template => "portlet/shared/destroy" } + end + end + + +end diff --git a/app/controllers/portlet.old/img_link_contents_controller.rb b/app/controllers/portlet.old/img_link_contents_controller.rb new file mode 100644 index 0000000..660f3aa --- /dev/null +++ b/app/controllers/portlet.old/img_link_contents_controller.rb @@ -0,0 +1,112 @@ +# -*- encoding : utf-8 -*- +class Portlet::ImgLinkContentsController < ApplicationController + layout "admin" + + def new + @img_link_content = ImgLinkContent.new + + + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + def create + + + + + @img_link_content = ImgLinkContent.new(params.require(:img_link_content).permit!) + + + + respond_to do |format| + if @img_link_content.save + + + @portlet = Portlet.create(:content => @img_link_content) + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js { render :template => "portlet/shared/create" } + else + format.html { render :action => "new" } + format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @img_link_content = ImgLinkContent.find(params[:id]) + @portlet = @img_link_content.portlet + + puts "TESt" + + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @img_link_content = ImgLinkContent.find(params[:id]) + @portlet = @img_link_content.portlet + + + + + respond_to do |format| + if @img_link_content.update_attributes(params.require(:img_link_content).permit!) + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + @portlet = Portlet.find(params[:portlet_id]) + @img_link_content = ImgLinkContent.find(params[:id]) + @img_link_content.destroy + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + # #to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)") + end + end + + respond_to do |format| + format.html {} + format.js { render :template => "portlet/shared/destroy" } + end + end + + +end diff --git a/app/controllers/portlet.old/link_contents_controller.rb b/app/controllers/portlet.old/link_contents_controller.rb new file mode 100644 index 0000000..0583d92 --- /dev/null +++ b/app/controllers/portlet.old/link_contents_controller.rb @@ -0,0 +1,110 @@ +# -*- encoding : utf-8 -*- +class Portlet::LinkContentsController < ApplicationController + layout "admin" + + def new + @link_content = LinkContent.new + + + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + def create + + + + + @link_content = LinkContent.new(params.require(:link_content).permit!) + + + + respond_to do |format| + if @link_content.save + + + @portlet = Portlet.create(:content => @link_content) + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js { render :template => "portlet/shared/create" } + else + format.html { render :action => "new" } + format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @link_content = LinkContent.find(params[:id]) + @portlet = @link_content.portlet + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @link_content = LinkContent.find(params[:id]) + @portlet = @link_content.portlet + + + + + + respond_to do |format| + if @link_content.update_attributes(params.require(:link_content).permit!) + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + @portlet = Portlet.find(params[:portlet_id]) + @link_content = LinkContent.find(params[:id]) + @link_content.destroy + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + ##to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)") + end + end + + respond_to do |format| + format.html {} + format.js { render :template => "portlet/shared/destroy" } + end + end + + +end diff --git a/app/controllers/portlet.old/map_contents_controller.rb b/app/controllers/portlet.old/map_contents_controller.rb new file mode 100644 index 0000000..2066e7c --- /dev/null +++ b/app/controllers/portlet.old/map_contents_controller.rb @@ -0,0 +1,116 @@ +# -*- encoding : utf-8 -*- +class Portlet::MapContentsController < ApplicationController + layout "admin" + + def new + @map_content = MapContent.new(:zoom => 12, :view => 1) + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + def create + @map_content = MapContent.new(params.require(:map_content).permit!) + + respond_to do |format| + if @map_content.save + + + @portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @map_content) + + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + #to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)") + end + end + + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js { render :template => "portlet/shared/create" } + else + format.html { render :action => "new" } + format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @map_content = MapContent.find(params[:id]) + @portlet = @map_content.portlet + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @map_content = MapContent.find(params[:id]) + @portlet = @map_content.portlet + + respond_to do |format| + if @map_content.update_attributes(params.require(:map_content).permit!) + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + ##to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)") + end + end + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + @portlet = Portlet.find(params[:portlet_id]) + @map_content = MapContent.find(params[:id]) + @map_content.destroy + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + # #to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)") + end + end + + respond_to do |format| + format.html {} + format.js { render :template => "portlet/shared/destroy" } + end + end + + +end diff --git a/app/controllers/portlet.old/portlets_controller.rb b/app/controllers/portlet.old/portlets_controller.rb new file mode 100644 index 0000000..ea41804 --- /dev/null +++ b/app/controllers/portlet.old/portlets_controller.rb @@ -0,0 +1,124 @@ +# -*- encoding : utf-8 -*- +class Portlet::PortletsController < ApplicationController + layout "admin" + + + + def new + @portlet = Portlet.new(:block_id => params[:block_id]) + + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js + end + + end + + + def show + @portlet = Portlet.find(params[:id]) + + render :template => "portlet/shared/update" + end + + + + def edit + @portlet = Portlet.find(params[:id]) + if request.xhr? + render :layout => false + end + end + + + + def update + @portlet = Portlet.find(params[:id]) + + flash[:notice] = "Le contenu à été mis à jour avec succès." + if @portlet.update_attributes(params[:portlet]) + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + #to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s) + end + end + render :action => "update" + + else + render :action => "edit" + end + + + + + end + + def destroy + @portlet = Portlet.find(params[:id]) + @portlet.destroy + flash[:notice] = "Le contenu à été supprimé avec succès." + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + end + end + + def ajax_create + @t = params[:type] + if @t == "Title" + @content = TitleContent.new() + elsif @t == "Text" + @content = TextContent.new() + elsif @t == "Image" + @content = ImageContent.new() + elsif @t == "Gallery" + @content = GalleryContent.new() + elsif @t == "Link" + @content = LinkContent.new() + elsif @t == "Break" + @content = BreakContent.new() + elsif @t == "Html" + @content = HtmlContent.new() + elsif @t == "Download" + @content = DownloadContent.new() + elsif @t == "DynamicContent" + @content = DynamicContent.new() + end + @portlet = Portlet.new(:block_id => params[:block_id]) + @content.portlets << @portlet + @content.save! + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + end + flash[:notice] = "Le contenu à été créé avec succès." + end + + def reorder + + params[:blocks].each do |index, block| + + block_id = block["block_id"].to_i + i = 0 + if block["block_portlet_ids"].kind_of?(Array) + block["block_portlet_ids"].each do |portlet_id| + i += 1 + Portlet.find(portlet_id.to_i).update_attributes(:position => i, :block_id => block_id) + end + end + + end + + render :inline => "ok" + + end +end diff --git a/app/controllers/portlet.old/table_cols_controller.rb b/app/controllers/portlet.old/table_cols_controller.rb new file mode 100644 index 0000000..f623bcf --- /dev/null +++ b/app/controllers/portlet.old/table_cols_controller.rb @@ -0,0 +1,35 @@ +# -*- encoding : utf-8 -*- +class Portlet::TableColsController < ApplicationController + def create + + @table_content = TableContent.find(params[:table_content_id]) + + @table_content.table_rows.each do |table_row| + CelTable.create( :position => params[:position], :table_row_id => table_row.id) + + + end + @table_content.nbr_cols = @table_content.nbr_cols + 1 + @table_content.save + end + + def update + end + + def destroy + @table_content = TableContent.find(params[:table_content_id]) + + + + + + CelTable.where(:table_row_id => @table_content.table_row_ids,:position => params[:id] ).each do |cel_table| + cel_table.destroy + + end + + @table_content.nbr_cols = @table_content.nbr_cols - 1 + @table_content.save + end + +end diff --git a/app/controllers/portlet.old/table_contents_controller.rb b/app/controllers/portlet.old/table_contents_controller.rb new file mode 100644 index 0000000..fff8c49 --- /dev/null +++ b/app/controllers/portlet.old/table_contents_controller.rb @@ -0,0 +1,108 @@ +# -*- encoding : utf-8 -*- +class Portlet::TableContentsController < ApplicationController + layout "admin" + + def new + @table_content = TableContent.new + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + def create + @table_content = TableContent.new(params.require(:table_content).permit!) + + respond_to do |format| + if @table_content.save + + + @portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @table_content) + + + + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js { render :template => "portlet/shared/create" } + else + format.html { render :action => "new" } + format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @table_content = TableContent.find(params[:id]) + @portlet = Portlet.find(params[:portlet_id]) + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @table_content = TableContent.find(params[:id]) + @portlet = @table_content.portlet + + respond_to do |format| + if @table_content.update_attributes(params.require(:table_content).permit!) + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + ##to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)") + end + end + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + @portlet = Portlet.find(params[:portlet_id]) + @table_content = TableContent.find(params[:id]) + @table_content.destroy + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + ##to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)") + end + end + + respond_to do |format| + format.html {} + format.js { render :template => "portlet/shared/destroy" } + end + end + + +end diff --git a/app/controllers/portlet.old/table_rows_controller.rb b/app/controllers/portlet.old/table_rows_controller.rb new file mode 100644 index 0000000..daa65ac --- /dev/null +++ b/app/controllers/portlet.old/table_rows_controller.rb @@ -0,0 +1,106 @@ +# -*- encoding : utf-8 -*- +class Portlet::TableRowsController < ApplicationController + layout "admin" + + def new + @title_content = TitleContent.new + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + def create + @table_row = TableRow.new(params.require(:table_row).permit!) + + respond_to do |format| + if @table_row.save + + @table = @table_row.table_content + @table.nbr_cols.times do + cel_table = CelTable.new + @table_row.cel_tables << cel_table + end + nbr_past = @table.nbr_rows + @table.nbr_rows = nbr_past +1 + @table.save + + + @portlet = Portlet.find(@table.portlet.id) + + #format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js + else + #format.html { render :action => "new" } + #format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @title_content = TitleContent.find(params[:id]) + @portlet = Portlet.find(params[:portlet_id]) + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @title_content = TitleContent.find(params[:id]) + @portlet = Portlet.find(params[:portlet_id]) + + respond_to do |format| + if @title_content.update_attributes(params.require(:table_row).permit!) + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + ##to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)") + end + end + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + + @table_row = TableRow.find(params[:id]) + @table_content = @table_row.table_content + @table_row.destroy + + + respond_to do |format| + format.html {} + format.js + end + end + + +end diff --git a/app/controllers/portlet.old/text_contents_controller.rb b/app/controllers/portlet.old/text_contents_controller.rb new file mode 100644 index 0000000..834a3d4 --- /dev/null +++ b/app/controllers/portlet.old/text_contents_controller.rb @@ -0,0 +1,116 @@ +# -*- encoding : utf-8 -*- +class Portlet::TextContentsController < ApplicationController + layout "admin" + + def new + @text_content = TextContent.new + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + def create + @text_content = TextContent.new(params.require(:text_content).permit!) + + respond_to do |format| + if @text_content.save + + + @portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @text_content) + + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + ##to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)") + end + end + + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js { render :template => "portlet/shared/create" } + else + format.html { render :action => "new" } + format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @text_content = TextContent.find(params[:id]) + @portlet = Portlet.find(params[:portlet_id]) + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @text_content = TextContent.find(params[:id]) + @portlet = @text_content.portlet + + respond_to do |format| + if @text_content.update_attributes(params.require(:text_content).permit!) + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + ##to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)") + end + end + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + @portlet = Portlet.find(params[:portlet_id]) + @text_content = TextContent.find(params[:id]) + @text_content.destroy + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + ##to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)") + end + end + + respond_to do |format| + format.html {} + format.js { render :template => "portlet/shared/destroy" } + end + end + + +end diff --git a/app/controllers/portlet.old/title_contents_controller.rb b/app/controllers/portlet.old/title_contents_controller.rb new file mode 100644 index 0000000..d2bcca4 --- /dev/null +++ b/app/controllers/portlet.old/title_contents_controller.rb @@ -0,0 +1,116 @@ +# -*- encoding : utf-8 -*- +class Portlet::TitleContentsController < ApplicationController + layout "admin" + + def new + @title_content = TitleContent.new + + respond_to do |format| + format.html { + if request.xhr? + render :layout => false + end + } + format.js { render :template => "portlet/shared/new" } + end + end + + def create + @title_content = TitleContent.new(params.require(:title_content).permit!) + + respond_to do |format| + if @title_content.save + + + @portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @title_content) + + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + ##to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)") + end + end + + + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') } + format.js { render :template => "portlet/shared/create" } + else + format.html { render :action => "new" } + format.js { render :template => "portlet/shared/new" } + end + end + end + + def edit + @title_content = TitleContent.find(params[:id]) + @portlet = Portlet.find(params[:portlet_id]) + respond_to do |format| + format.html { + if request.xhr? + render :template => "portlet/shared/edit", :layout => false + end + } + format.js { render :template => "portlet/shared/edit" } + end + end + + + + + + def show + + + end + + def update + @title_content = TitleContent.find(params[:id]) + @portlet = @title_content.portlet + + respond_to do |format| + if @title_content.update_attributes(params.require(:title_content).permit!) + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + + end + end + + format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.js { render :template => "portlet/shared/update" } + else + format.html { render :action => "portlet/shared/edit" } + format.js { render :template => "portlet/shared/edit" } + end + + end + end + + def destroy + @portlet = Portlet.find(params[:portlet_id]) + @title_content = TitleContent.find(params[:id]) + @title_content.destroy + + if @portlet.block and @portlet.block.blockable + @portlet.block.blockable.updated_at = Time.now + @portlet.block.blockable.save + if @portlet.block.blockable_type == "Page" + + flash[:notice] = "Portlet supprimé." + end + end + + respond_to do |format| + format.html {} + format.js { render :template => "portlet/shared/destroy" } + end + end + + +end diff --git a/app/controllers/portlet/title_contents_controller.rb b/app/controllers/portlet/title_contents_controller.rb index d2bcca4..a770ad5 100644 --- a/app/controllers/portlet/title_contents_controller.rb +++ b/app/controllers/portlet/title_contents_controller.rb @@ -47,7 +47,7 @@ class Portlet::TitleContentsController < ApplicationController def edit @title_content = TitleContent.find(params[:id]) - @portlet = Portlet.find(params[:portlet_id]) + @portlet = @title_content.portlet respond_to do |format| format.html { if request.xhr? @@ -82,7 +82,7 @@ class Portlet::TitleContentsController < ApplicationController end end - format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') } + format.html { render :inline => "ok" } format.js { render :template => "portlet/shared/update" } else format.html { render :action => "portlet/shared/edit" } diff --git a/app/views/admin/pages/_page.html.haml b/app/views/admin/pages/_page.html.haml index ef6c2b3..a5fdaee 100644 --- a/app/views/admin/pages/_page.html.haml +++ b/app/views/admin/pages/_page.html.haml @@ -1,44 +1,55 @@ -#menu_item_block_edit +#toolbar-text - =render :partial => "admin/blocks/block", :locals => {:block => page.blocks[0], :sortable => true} - - +#menu_item_block_edit{:style => "margin-right:330px;margin-top:45px;"} + + =render :partial => "admin/blocks/block", :locals => {:block => page.blocks[0], :sortable => true} + + #menu_item_inspector_container - .accordion#menu_item_informations - - .accordion-group - .inspector_handle - .accordion-heading.navbar-inner.navbar-inverse - %a.accordion-toggle{:href => "#collapseOne",:data => {:toggle => "collapse", :parent => "#menu_item_informations"}} - Infos sur la page - - - #collapseOne.accordion-body.collapse - .accordion-inner - =render :partial => "edit_form" - - - .accordion-heading.navbar-inner.navbar-inverse - %a.accordion-toggle{:href => "#collapse2",:data => {:toggle => "collapse", :parent => "#menu_item_informations"}} - éléments - - - #collapse2.accordion-body.collapse.in - .accordion-inner - .block_portlets_sortable#content_types - -page.blocks[0].alloweds_types.each do |slug, name| + + .accordion#menu_item_informations + + .accordion-group + =#.inspector_handle + .accordion-heading.navbar-inner.navbar-inverse + %a.accordion-toggle{:href => "#collapseOne",:data => {:toggle => "collapse", :parent => "#menu_item_informations"}} + Infos sur la page + + + #collapseOne.accordion-body.collapse + .accordion-inner + =render :partial => "edit_form" + + + .accordion-heading.navbar-inner.navbar-inverse + %a.accordion-toggle{:href => "#collapse2",:data => {:toggle => "collapse", :parent => "#menu_item_informations"}} + éléments + + + #collapse2.accordion-body.collapse.in + .accordion-inner + .block_portlets_sortable#content_types + -page.blocks[0].alloweds_types.each do |slug, name| - .portlet{:id => slug, :data_type => slug} - =image_tag("admin/content_type/type_"+slug.to_s+".png", :alt => name, :title => name, :class => "handle") - + .portlet{:id => slug, :data_type => slug} + =image_tag("admin/content_type/type_"+slug.to_s+".png", :alt => name, :title => name, :class => "handle") + + .accordion-heading.navbar-inner.navbar-inverse + %a.accordion-toggle{:href => "#collapse3",:data => {:toggle => "collapse", :parent => "#menu_item_informations"}} + Modifier l'élément + + + #collapse3.accordion-body.collapse +   + #element_form + + + - - - - + diff --git a/app/views/portlet.old/block_contents/_block_content.html.haml b/app/views/portlet.old/block_contents/_block_content.html.haml new file mode 100644 index 0000000..aad17fe --- /dev/null +++ b/app/views/portlet.old/block_contents/_block_content.html.haml @@ -0,0 +1,20 @@ +-style="" +-if block_content.style== 2 + -style += "background:#d8d8d8;" +-if block_content.nbr_columns == 1 + -block_content.blocks.each do |block| + + .container_12{:style => "padding:0px;"+style.to_s} + .grid_12 + =render :partial => "admin/blocks/block", :locals => {:block => block} + .clear +-else + .container_12{:style => "padding:0px;"+style.to_s} + -i = 0 + -block_content.blocks.each do |block| + -i+=1 + .grid_6.col{:class => ("col_"+i.to_s)} + + =render :partial => "admin/blocks/block", :locals => {:block => block} + + .clear \ No newline at end of file diff --git a/app/views/portlet.old/block_contents/_form.html.haml b/app/views/portlet.old/block_contents/_form.html.haml new file mode 100644 index 0000000..e5fd920 --- /dev/null +++ b/app/views/portlet.old/block_contents/_form.html.haml @@ -0,0 +1,89 @@ + +=semantic_form_for( [:portlet, @block_content], :remote => true) do |f| + -if !@block_content.id + %table + %tr + %td Nombre de colonnes : + %td + + %p + =f.radio_button :nbr_columns, 1 + Une colonne + %p + =f.radio_button :nbr_columns, 2 + Deux colonnes + + %p + =f.radio_button :nbr_columns, 3 + Trois colonnes + + %p + =f.radio_button :nbr_columns, 4 + Quatre colonnes + + -else + + + #column_sliders{:style => "height:22px;"} + -for i in 1..(@block_content.nbr_columns.to_i-1) + + .column_slider{:"data-slider-value"=>eval("@block_content.row#{i}_value.to_i"), :style => "width:100%;"} + + + + :javascript + function compareNumbers(a, b) + { + return a - b; + } + + $(".column_slider").slider({ + max: 12, + min: 0, + step:1 + }).on("slide", function(ev) + { + var return_array = new Array(); + + $("#column_sliders .column_slider").each(function(){ + return_array.push($(this).data('slider').getValue()); + + }); + + var cols_values = []; + prev_value= 0; + $.each(return_array.sort(compareNumbers), function(index, value) { + cols_values.push(value-prev_value); + + + prev_value = value; + + }); + + cols_values.push(12-prev_value); + + $.each(cols_values, function(index, value) { + + $("#row"+(index+1)).val(value); + + + }); + + + + }); + + =f.hidden_field :row1, :id => "row1" + =f.hidden_field :row2, :id => "row2" + =f.hidden_field :row3, :id => "row3" + =f.hidden_field :row4, :id => "row4" + + -if BlockContent::STYLES.size > 0 + Style : + = f.select :style, BlockContent::STYLES + %br + + + = f.submit "Sauvegarder", :class => "btn btn-primary" + + diff --git a/app/views/portlet.old/break_contents/_break_content.html.haml b/app/views/portlet.old/break_contents/_break_content.html.haml new file mode 100644 index 0000000..a287381 --- /dev/null +++ b/app/views/portlet.old/break_contents/_break_content.html.haml @@ -0,0 +1 @@ +%hr \ No newline at end of file diff --git a/app/views/portlet.old/break_contents/_form.html.haml b/app/views/portlet.old/break_contents/_form.html.haml new file mode 100644 index 0000000..25fd51f --- /dev/null +++ b/app/views/portlet.old/break_contents/_form.html.haml @@ -0,0 +1,15 @@ +=semantic_form_for( [:portlet, @break_content], :remote => true) do |f| + %table.form_table + %tr + %td Trait ? + %td=f.check_box :line + + -if BreakContent::STYLES.size > 0 + %tr + %td Style : + %td= f.select :style, BreakContent::STYLES + + = f.submit "Sauvegarder", :class => "btn btn-primary" + + + diff --git a/app/views/portlet.old/download_contents/_download_content.html.haml b/app/views/portlet.old/download_contents/_download_content.html.haml new file mode 100644 index 0000000..701df56 --- /dev/null +++ b/app/views/portlet.old/download_contents/_download_content.html.haml @@ -0,0 +1,8 @@ + +%p + Titre : + =download_content.title + +%p + Téléchargement : + =download_content.data_file.abstract_file_name if download_content.data_file diff --git a/app/views/portlet.old/download_contents/_form.html.haml b/app/views/portlet.old/download_contents/_form.html.haml new file mode 100644 index 0000000..26ee980 --- /dev/null +++ b/app/views/portlet.old/download_contents/_form.html.haml @@ -0,0 +1,39 @@ +=semantic_form_for( [:portlet, @download_content], :remote => true) do |f| + + + + %table.form_table + + %tr + %td Titre : + %td=f.text_field :title + + %tr + %td + -r = rand(1000000000000000000000000000) + Fichier : + %td + #name{:id => r} + =f.object.data_file.abstract_file_name if f.object.data_file + =f.hidden_field :data_file_id, :id => "input_"+r.to_s + + =link_to "Modifier ce fichier", "#", :onclick => "select_file_from_manager('"+r.to_s+"');return false;" + + + + -if DownloadContent::STYLES.size >0 + %tr + %td Style : + %td= f.select :style, DownloadContent::STYLES + + + + + = f.submit "Sauvegarder", :class => "btn btn-primary" + + + + + + + diff --git a/app/views/portlet.old/dynamic_contents/_dynamic_content.html.haml b/app/views/portlet.old/dynamic_contents/_dynamic_content.html.haml new file mode 100644 index 0000000..aa8aa31 --- /dev/null +++ b/app/views/portlet.old/dynamic_contents/_dynamic_content.html.haml @@ -0,0 +1 @@ +=DynamicContent::NAMES[dynamic_content.name] if dynamic_content.name \ No newline at end of file diff --git a/app/views/portlet.old/dynamic_contents/_form.html.haml b/app/views/portlet.old/dynamic_contents/_form.html.haml new file mode 100644 index 0000000..f4ce1e8 --- /dev/null +++ b/app/views/portlet.old/dynamic_contents/_form.html.haml @@ -0,0 +1,18 @@ +=semantic_form_for( [:portlet, @dynamic_content], :remote => true) do |f| + + + %table.form_table + + %tr + + %td= f.select :name, DynamicContent::NAMES.map {|u| [u[1], u[0]] } + + + + + + + = f.submit "Sauvegarder", :class => "btn btn-primary" + + + diff --git a/app/views/portlet.old/event_contents/_event_content.html.haml b/app/views/portlet.old/event_contents/_event_content.html.haml new file mode 100644 index 0000000..c70ffec --- /dev/null +++ b/app/views/portlet.old/event_contents/_event_content.html.haml @@ -0,0 +1,48 @@ + +-if event_content.image_file + + -url =event_content.image_file.file.square.url + + + + +-else + -url ="admin/default_image.png" +-style = "float:left;" + + +-styleimg="" + + + + +%p.img{:style =>style} + =image_tag(url,:style => styleimg) + + + +%h3 + Evenement - + =EventContent::TYPES[event_content.event_type.to_i-1][0] +%h2=event_content.title +%p= event_content.artist +%p= l event_content.start_at +%p + %strong=event_content.place + %br + =event_content.address + +%p= simple_format event_content.description + + +-if event_content.with_cible? + + + - if event_content.cible + %strong + Liens vers + = event_content.cible.cible_name + ="s'ouvre dans une nouvelle page" if event_content.popup + + +%p{:style => "clear:both;"} \ No newline at end of file diff --git a/app/views/portlet.old/event_contents/_form.html.haml b/app/views/portlet.old/event_contents/_form.html.haml new file mode 100644 index 0000000..6dea246 --- /dev/null +++ b/app/views/portlet.old/event_contents/_form.html.haml @@ -0,0 +1,56 @@ + + += semantic_form_for [:portlet, @event_content], :remote => true do |form| + + + + + + %br + + + = form.inputs do + + + = form.input :event_type, :label => "Type d'événement :", :as => :select, :collection => EventContent::TYPES, :include_blank => false + + .event_date_form{:style => "position:relative;z-index:1000;"} + -if form.object.errors.messages[:start_at_date] or form.object.errors.messages[:start_at_time] + %p.errors + Tout les champs doivent être remplis. Les dates doivent être au format jj/mm/yyyy et les heures au format hh:mm. + %p + =form.label :start_at_date, "Début :", :style=>"display:inline-block;width:50px" + =form.text_field :start_at_date, :id => "event_start_at_date", :class => "datepicker" + %span.event_time + =form.label :start_at_time, "heure :" + =form.text_field :start_at_time, :id => "event_start_at_time", :class => "timepicker", :style => "width:50px" + + + + = form.input :image_file_id, :label => "Image :" , :as => :qi_image_select + + + = form.input :title, :label => "Titre :" + = form.input :artist, :label => "Artiste :" + = form.input :tremplin, :label => "Tremplin ?", :as => :boolean + = form.input :description, :label => "Description :", :as => :text + + = form.input :place, :label => "Lieu :" + = form.input :address, :label => "Adresse :", :as => :text + + + + = form.input :with_cible, :as => :boolean, :label => "Avec lien ?", :input_html => { :onchange => "if ($('#with_cible').is(':checked')) { $('#with_cible').closest('form').find('.cible_space').show(); }else{ $('#with_cible').closest('form').find('.cible_space').hide(); }", :id => "with_cible" }, :label_html => {:onchange => ""} + + + + + .cible_space{:style => ((!@event_content.cible and !@event_content.with_cible) ? "display:none;" : "display:block;" )} + = form.inputs do + = form.input :cible, :label => "Cible :" , :as => :qi_cible_select + = form.input :popup, :label => "Ouvrir dans une popup ?", :as => :boolean + + + = form.submit "Sauvegarder", :class => "btn btn-primary" + + diff --git a/app/views/portlet.old/gallery_contents/_form.html.haml b/app/views/portlet.old/gallery_contents/_form.html.haml new file mode 100644 index 0000000..0a03a59 --- /dev/null +++ b/app/views/portlet.old/gallery_contents/_form.html.haml @@ -0,0 +1,9 @@ += semantic_form_for [:portlet, @gallery_content], :remote => true do |form| + + -if GalleryContent::STYLES.size > 0 + Style : + = form.select :style, GalleryContent::STYLES + + = form.submit "Sauvegarder", :class => "btn btn-primary" + + diff --git a/app/views/portlet.old/gallery_contents/_gallery_content.html.haml b/app/views/portlet.old/gallery_contents/_gallery_content.html.haml new file mode 100644 index 0000000..e8e2953 --- /dev/null +++ b/app/views/portlet.old/gallery_contents/_gallery_content.html.haml @@ -0,0 +1,18 @@ +%h2=gallery_content.name +.description + =raw gallery_content.description + +%p{:style => "text-align:center;"}=link_to "Ajouter des images", "#", :onclick => "select_gallery_images_from_manager('"+gallery_content.id.to_s+"');return false;", :class => "btn" + +.gallery_images + =render :collection => gallery_content.gallery_images, :partial => "portlet/gallery_images/gallery_image" + %p{:style => "clear:both;"} + +:javascript + $('.gallery_images').sortable({ + itemSelector:".gallery_image", + nested:true + }); + + + \ No newline at end of file diff --git a/app/views/portlet.old/gallery_images/_form.html.haml b/app/views/portlet.old/gallery_images/_form.html.haml new file mode 100644 index 0000000..d64ae28 --- /dev/null +++ b/app/views/portlet.old/gallery_images/_form.html.haml @@ -0,0 +1,32 @@ +#myModal.modal.fade{"aria-hidden" => "true", "aria-labelledby" => "myModalLabel", :role => "dialog", :tabindex => "-1"} + + + + + .modal-header + %button.close{"aria-hidden" => "true", "data-dismiss" => "modal", :type => "button"} × + %h3#myModalLabel Modifier les infos + .modal-body + + = semantic_form_for [:portlet, @gallery_image], :remote => true do |form| + = form.inputs do + = form.input :title, :label => "Titre :" + = form.input :tags, :label => "Tags :" + = form.input :description, :label => "Description :", :as => :text, :input_html => {:class => "text_editor"} + + + + + + .modal-footer + %button.btn{"aria-hidden" => "true", "data-dismiss" => "modal"} Annuler + %button.btn.btn-primary{"aria-hidden" => "true", "data-dismiss" => "modal", :onclick => "$(this).closest('.modal').find('form').submit();"} Sauvegarder + + + + + + + + + diff --git a/app/views/portlet.old/gallery_images/_gallery_image.html.haml b/app/views/portlet.old/gallery_images/_gallery_image.html.haml new file mode 100644 index 0000000..39ec3d5 --- /dev/null +++ b/app/views/portlet.old/gallery_images/_gallery_image.html.haml @@ -0,0 +1,9 @@ +-if gallery_image.image_file + .gallery_image.image_square#gallery_image{:id => gallery_image.id, :data => { :title => gallery_image.title , :description => gallery_image.description, :id => gallery_image.id} } + .img{:style => "background-image : url('#{gallery_image.image_file.file.large.medium.small.thumb.url}');"} + + .actions + =link_to i(:trash), [:portlet, gallery_image], :confirm => 'Voulez-vous vraiment supprimer cette image ?', :method => :delete, :remote => true + =link_to i(:pencil), edit_portlet_gallery_image_path(gallery_image), :remote => true + + \ No newline at end of file diff --git a/app/views/portlet.old/gallery_images/create.js.erb b/app/views/portlet.old/gallery_images/create.js.erb new file mode 100644 index 0000000..8b50597 --- /dev/null +++ b/app/views/portlet.old/gallery_images/create.js.erb @@ -0,0 +1 @@ +$('#portlet_<%= @gallery_content.portlet.id %> .gallery_images').prepend("<%= escape_javascript(render(@gallery_images)) %>"); \ No newline at end of file diff --git a/app/views/portlet.old/gallery_images/destroy.js.erb b/app/views/portlet.old/gallery_images/destroy.js.erb new file mode 100644 index 0000000..c4e8f8a --- /dev/null +++ b/app/views/portlet.old/gallery_images/destroy.js.erb @@ -0,0 +1,4 @@ + +$("#gallery_image_<%= @gallery_image.id.to_s %>").fadeOut(500).delay(6000).remove(); + +<%= flash_js %> \ No newline at end of file diff --git a/app/views/portlet.old/gallery_images/edit.js.erb b/app/views/portlet.old/gallery_images/edit.js.erb new file mode 100644 index 0000000..0412d2c --- /dev/null +++ b/app/views/portlet.old/gallery_images/edit.js.erb @@ -0,0 +1,2 @@ + +$('<%= escape_javascript(render(:partial => "form"))%>').modal('show'); diff --git a/app/views/portlet.old/gallery_images/reorder.js.erb b/app/views/portlet.old/gallery_images/reorder.js.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/portlet.old/gallery_images/update.js.erb b/app/views/portlet.old/gallery_images/update.js.erb new file mode 100644 index 0000000..7f4b7c8 --- /dev/null +++ b/app/views/portlet.old/gallery_images/update.js.erb @@ -0,0 +1,5 @@ +close_pane_hover(); +$('#gallery_image_<%= @gallery_image.id %>').effect("highlight", 1000); + + +<%= flash_js %> \ No newline at end of file diff --git a/app/views/portlet.old/html_contents/_form.html.haml b/app/views/portlet.old/html_contents/_form.html.haml new file mode 100644 index 0000000..347a6e9 --- /dev/null +++ b/app/views/portlet.old/html_contents/_form.html.haml @@ -0,0 +1,60 @@ +.html_content_form + + =semantic_form_for( [:portlet, @html_content], :remote => true) do |f| + + + =f.text_area :content, :style => "width:98%;height:400px;", :class => "inputText", :id => "ace_editor_textarea" + + %pre#ace_editor_pre{:style => "margin:0px;"} + + + + + %table.form_table + %tr + %td Style : + %td= f.select :content_type, HtmlContent::CONTENT_TYPES + + + + .action + %button{:onclick => "$(this).closest('.html_content_form').toggleClass('large');editor.resize() ;return false;"} zoom + = f.submit "Sauvegarder", :class => "btn btn-primary" + + + + + + + + + + -if HtmlContent::STYLES.size > 0 + %table.form_table + %tr + %td Style : + %td= f.select :style, HtmlContent::STYLES + + + diff --git a/app/views/portlet.old/html_contents/_html_content.html.haml b/app/views/portlet.old/html_contents/_html_content.html.haml new file mode 100644 index 0000000..bfdff74 --- /dev/null +++ b/app/views/portlet.old/html_contents/_html_content.html.haml @@ -0,0 +1,11 @@ +-begin + =render :inline => html_content.content, :type => html_content.content_type +-rescue Exception=>e + -if html_content.content_type == "haml" + %h3= e.message + %p + à la ligne + = e.original_exception.line + + -else + %h3= e.message diff --git a/app/views/portlet.old/image_contents/_form.html.haml b/app/views/portlet.old/image_contents/_form.html.haml new file mode 100644 index 0000000..7056bf1 --- /dev/null +++ b/app/views/portlet.old/image_contents/_form.html.haml @@ -0,0 +1,32 @@ + + += semantic_form_for [:portlet, @image_content], :remote => true do |form| + + = form.inputs do + = form.input :image_file_id, :label => "Image :" , :as => :qi_image_select + + + = form.input :alt, :label => "Texte alternatif :" + + = form.input :alignement, :label => "Alignement :", :as => :select, :collection => ImageContent::ALIGNS, :include_blank => false + = form.input :style, :label => "Style :", :as => :select, :collection => ImageContent::STYLES, :include_blank => false + = form.input :width, :label => "Largeur :" + = form.input :height, :label => "Hauteur :" + + + = form.input :with_cible, :as => :boolean, :label => "Avec lien ?", :input_html => { :onchange => "if ($('#with_cible').is(':checked')) { $('#with_cible').closest('form').find('.cible_space').show();$('#with_cible').closest('form').find('.expandable').hide(); }else{ $('#with_cible').closest('form').find('.cible_space').hide();$('#with_cible').closest('form').find('.expandable').show(); }", :id => "with_cible" }, :label_html => {:onchange => ""} + + .expandable{:style => ((!@image_content.cible and !@image_content.with_cible) ? "display:block;" : "display:none;" )} + = form.inputs do + = form.input :expandable,:as => :boolean , :label => "L'image peut être agrandie ? :" + + + .cible_space{:style => ((!@image_content.cible and !@image_content.with_cible) ? "display:none;" : "display:block;" )} + = form.inputs do + = form.input :cible, :label => "Cible :" , :as => :qi_cible_select + = form.input :popup, :label => "Ouvrir dans une popup ?", :as => :boolean + + + = form.submit "Sauvegarder", :class => "btn btn-primary" + + diff --git a/app/views/portlet.old/image_contents/_image_content.html.haml b/app/views/portlet.old/image_contents/_image_content.html.haml new file mode 100644 index 0000000..4d10c9a --- /dev/null +++ b/app/views/portlet.old/image_contents/_image_content.html.haml @@ -0,0 +1,42 @@ + +-if image_content.image_file + + -if image_content.style== "1" + -url =image_content.image_file.file.large.medium.url + + -elsif image_content.style== "2" + -url =image_content.image_file.file.large.medium.small.url + + -elsif image_content.style== "3" + -url =image_content.image_file.file.square.url + + -elsif image_content.style== "4" + -url =image_content.image_file.file.large.medium.small.thumb.url + -elsif image_content.style== "5" + -url =image_content.image_file.file.large.url + + + =image_content.style + +-else + -url ="admin/default_image.png" +-style = "" +-style = "text-align:center;" if image_content.alignement == "center" + + +-style = "text-align:right;" if image_content.alignement == "right" + + +-style = "text-align:left;" if image_content.alignement == "left" + +-styleimg="" +-styleimg += "width:"+image_content.width.to_s+"px;" if image_content.width? +-styleimg += "height:"+image_content.height.to_s+"px;" if image_content.height? + + + +%p.img{:style =>style} + =image_tag(url, :alt => image_content.alt.to_s, :style => styleimg) + + +="L'image peut être agrandie si l'on clique dessus" if image_content.expandable \ No newline at end of file diff --git a/app/views/portlet.old/img_link_contents/_form.html.haml b/app/views/portlet.old/img_link_contents/_form.html.haml new file mode 100644 index 0000000..0375fad --- /dev/null +++ b/app/views/portlet.old/img_link_contents/_form.html.haml @@ -0,0 +1,20 @@ += semantic_form_for [:portlet, @img_link_content], :remote => true do |form| + + .form1 + = form.inputs do + + = form.input :image_file_id, :label => "Image :" , :as => :qi_image_select + = form.input :title, :label => "Title :" , :as => :string + = form.input :description, :label => "Description :", :as => :text, :input_html => {:class => "text_editor"} + + + + = form.input :with_cible, :as => :boolean, :label => "Avec lien ?", :input_html => {:id => "with_cible", :onchange => "if ($(this).attr('checked') == 'checked') { $(this).closest('form').find('.cible_space').show(); }else{ $(this).closest('form').find('.cible_space').hide(); }" } + + .cible_space{:style => ("display:none;" if !@img_link_content.cible and !@img_link_content.with_cible )} + = form.inputs do + = form.input :cible, :label => "Cible :" , :as => :qi_cible_select + + = form.commit_button "Sauvegarder", :class => "btn btn-primary" + + diff --git a/app/views/portlet.old/img_link_contents/_img_link_content.html.haml b/app/views/portlet.old/img_link_contents/_img_link_content.html.haml new file mode 100644 index 0000000..ed06422 --- /dev/null +++ b/app/views/portlet.old/img_link_contents/_img_link_content.html.haml @@ -0,0 +1,16 @@ + + +.img_link_portlet + .image_file + =image_tag(img_link_content.image_file.file.square.url) if img_link_content.image_file + + .title + %h3=img_link_content.title + .description + = simple_format(img_link_content.description) + .clear + +- if img_link_content.cible + %strong + Liens vers + = img_link_content.cible.cible_name \ No newline at end of file diff --git a/app/views/portlet.old/link_contents/_form.html.haml b/app/views/portlet.old/link_contents/_form.html.haml new file mode 100644 index 0000000..d6e906f --- /dev/null +++ b/app/views/portlet.old/link_contents/_form.html.haml @@ -0,0 +1,14 @@ += semantic_form_for [:portlet, @link_content], :remote => true do |form| + + .form1 + = form.inputs do + = form.input :name, :label => "Texte à afficher :" + =# form.input :title, :label => "Title :" + = form.input :popup,:as => :boolean , :label => "Ouvrir dans une nouvelle fenêtre ?" + + = form.input :cible, :label => "Cible :" , :as => :qi_cible_select + + + = form.submit "Sauvegarder", :class => "btn btn-primary" + + diff --git a/app/views/portlet.old/link_contents/_link_content.html.haml b/app/views/portlet.old/link_contents/_link_content.html.haml new file mode 100644 index 0000000..20387b2 --- /dev/null +++ b/app/views/portlet.old/link_contents/_link_content.html.haml @@ -0,0 +1,10 @@ + +Texte affiché : +%strong=link_content.name.to_s +%br +="s'ouvre dans une nouvelle page" if link_content.popup + +- if link_content.cible + %strong + Liens vers + = link_content.cible.cible_name \ No newline at end of file diff --git a/app/views/portlet.old/map_contents/_form.html.haml b/app/views/portlet.old/map_contents/_form.html.haml new file mode 100644 index 0000000..3298e04 --- /dev/null +++ b/app/views/portlet.old/map_contents/_form.html.haml @@ -0,0 +1,26 @@ +=semantic_form_for( [:portlet, @map_content], :remote => true) do |f| + + %p + Adresse : + =f.text_field :address, :style => "width:98%;", :class => "inputText" + + %p + Nom du lieu : + =f.text_field :name, :style => "width:98%;", :class => "inputText" + + %p + Infobule + =f.check_box :info_bule + + %p + Vue + = f.select :view, MapContent::VIEWS + + %p + Zoom + = f.select :zoom, MapContent::ZOOMS + %br + = f.submit "Sauvegarder", :class => "btn btn-primary" + + + diff --git a/app/views/portlet.old/map_contents/_map_content.html.haml b/app/views/portlet.old/map_contents/_map_content.html.haml new file mode 100644 index 0000000..54e9ac9 --- /dev/null +++ b/app/views/portlet.old/map_contents/_map_content.html.haml @@ -0,0 +1,64 @@ +#map_content_map.map_content_map{:id => map_content.id, :style => "width:400px; height:300px;margin:auto;"} + + + + \ No newline at end of file diff --git a/app/views/portlet.old/portlets/_portlet.html.haml b/app/views/portlet.old/portlets/_portlet.html.haml new file mode 100644 index 0000000..54c8dc6 --- /dev/null +++ b/app/views/portlet.old/portlets/_portlet.html.haml @@ -0,0 +1,34 @@ + + + +#portlet.portlet{:id => portlet.id,:"data-portlet_id" => portlet.id, :class => "portlet_"+portlet.content_type.tableize.singularize+(" " if portlet.content_type == "BlockContent").to_s} + + + -if portlet.content_type == "BlockContent" + .btn-toolbar{:style => "position:absolute;margin-left:10px;margin-top:-3em;"} + .btn-group + %a.btn.handle{:href => "#"}=i :move, :icon => false + =link_to i(:pencil, :icon => false), eval("edit_portlet_"+portlet.content_type.tableize.singularize+"_path(portlet.content, :portlet_id => portlet.id)"), :remote => true, :class => "btn" + =link_to i(:trash, :icon => false), eval("portlet_"+portlet.content_type.tableize.singularize+"_path(portlet.content, :portlet_id => portlet.id)"), :method => :delete, :data => { :confirm => "Etes-vous sûr ?"}, :remote => true, :class => "btn" + + + + + + -else + .btn-toolbar{:style => "position:absolute;margin-left:10px;z-index:1;"} + .btn-group + %a.btn.handle{:href => "#"}=i :move, :icon => false + =link_to i(:pencil, :icon => false), eval("edit_portlet_"+portlet.content_type.tableize.singularize+"_path(portlet.content, :portlet_id => portlet.id)"), :remote => true, :class => "btn" + =link_to i(:trash, :icon => false), eval("portlet_"+portlet.content_type.tableize.singularize+"_path(portlet.content, :portlet_id => portlet.id)"), :method => :delete, :data => { :confirm => "Etes-vous sûr ?"}, :remote => true, :class => "btn" + + + + + + + + =render :partial => "portlets/render_public/"+portlet.content_type.to_s.downcase, :locals => {:input => portlet.content, :admin => true} + + + \ No newline at end of file diff --git a/app/views/portlet.old/portlets/new.html.haml b/app/views/portlet.old/portlets/new.html.haml new file mode 100644 index 0000000..80d216a --- /dev/null +++ b/app/views/portlet.old/portlets/new.html.haml @@ -0,0 +1,7 @@ +.portlet_types + -ContentType.all.each do |content_type| + =link_to content_type.name, eval("new_portlet_"+content_type.slug.tableize.singularize+"_path(:block_id => @portlet.block_id, :position => params[:position])"), :remote => true + +%br +%br +#new_portlet_content_form \ No newline at end of file diff --git a/app/views/portlet.old/portlets/new.js.erb b/app/views/portlet.old/portlets/new.js.erb new file mode 100644 index 0000000..09bde8f --- /dev/null +++ b/app/views/portlet.old/portlets/new.js.erb @@ -0,0 +1,12 @@ +$.ajax({ + url:"<%= eval("new_portlet_"+params[:content_type].tableize.singularize+"_path(:format => 'js')") %>", + type: "GET", + data: { + block_id : "<%= params[:block_id] %>", + position : "<%= params[:position] %>" + } , + success : function (){ + + } +}); + diff --git a/app/views/portlet.old/portlets/update.js.erb b/app/views/portlet.old/portlets/update.js.erb new file mode 100644 index 0000000..3438a65 --- /dev/null +++ b/app/views/portlet.old/portlets/update.js.erb @@ -0,0 +1,8 @@ + + + +$("#block_portlets_<%= @portlet.block.id %>").replaceWith("<%= escape_javascript(render(:partial => 'admin/blocks/block', :locals => {:block => @portlet.block})) %>"); +$("#portlet_<%= @portlet.id %>").effect("highlight", {}, 3000); +block_js_initialize(); + +<%= flash_notice() %> \ No newline at end of file diff --git a/app/views/portlet.old/shared/_new.html.haml b/app/views/portlet.old/shared/_new.html.haml new file mode 100644 index 0000000..3f49e23 --- /dev/null +++ b/app/views/portlet.old/shared/_new.html.haml @@ -0,0 +1,6 @@ +=render :partial => "form" + +-cancel_button = escape_javascript(link_to("annuler", "#", :class => "button cancel", :onclick => "$('#new_portlet_form_inline').remove();block_js_initialize();return false;")); +:javascript + $('#new_portlet_form_inline').find('.buttons ol').prepend('#{cancel_button}'); + \ No newline at end of file diff --git a/app/views/portlet.old/shared/create.js.erb b/app/views/portlet.old/shared/create.js.erb new file mode 100644 index 0000000..ec20433 --- /dev/null +++ b/app/views/portlet.old/shared/create.js.erb @@ -0,0 +1,13 @@ +block_portlet_id = $("#new_portlet_form_inline").closest(".block_portlets").data('block_id'); + +$("#new_portlet_form_inline").replaceWith("<%= escape_javascript(render(@portlet)) %>"); + + + + +update_block_portlet_order(block_portlet_id); + + +$(".block_portlets").sortable("enable"); + +<%= flash_js %> \ No newline at end of file diff --git a/app/views/portlet.old/shared/destroy.js.erb b/app/views/portlet.old/shared/destroy.js.erb new file mode 100644 index 0000000..64fd98f --- /dev/null +++ b/app/views/portlet.old/shared/destroy.js.erb @@ -0,0 +1,4 @@ +$("#portlet_<%= @portlet.id %>").remove(); +<%= flash_js %> +block_js_initialize(); +update_portlet_order(); \ No newline at end of file diff --git a/app/views/portlet.old/shared/edit.js.erb b/app/views/portlet.old/shared/edit.js.erb new file mode 100644 index 0000000..6e09501 --- /dev/null +++ b/app/views/portlet.old/shared/edit.js.erb @@ -0,0 +1,18 @@ +$("#portlet_<%= @portlet.id %>").html("
"); + +$("#edit_portlet_content_form").html("<%= escape_javascript(render( :partial => "form")) %>"); + +$(".block_portlets").sortable("disable"); + + +$("#edit_portlet_content_form .text_editor").each(function() { + + + auto_tiny_mce($(this)); +}); + +<%- cancel_button = escape_javascript(link_to("annuler", portlet_portlet_path(@portlet), :class => "button cancel", :remote => true)); %> +$("#portlet_<%= @portlet.id %>").find('.buttons ol').prepend('<%= cancel_button %>'); + + + diff --git a/app/views/portlet.old/shared/new.js.erb b/app/views/portlet.old/shared/new.js.erb new file mode 100644 index 0000000..d8a994a --- /dev/null +++ b/app/views/portlet.old/shared/new.js.erb @@ -0,0 +1,21 @@ +$("#new_portlet_content_form").html("<%= escape_javascript(render( :partial => "portlet/shared/new")) %>"); + +$(".block_portlets").sortable("disable"); + + + +var first_form_element = $("#new_portlet_content_form input:text:visible:first") +if(first_form_element.length == 0){ + first_form_element = $("#new_portlet_content_form .text_editor:first") + + //first_form_element.tinymce().focus(); +} + +if(first_form_element.length == 0){ + first_form_element = $("#new_portlet_content_form textarea:first") +} + + +first_form_element.focus(); + +uninitialize_block_js(); diff --git a/app/views/portlet.old/shared/update.js.erb b/app/views/portlet.old/shared/update.js.erb new file mode 100644 index 0000000..d47c241 --- /dev/null +++ b/app/views/portlet.old/shared/update.js.erb @@ -0,0 +1,7 @@ + +$("#portlet_<%= @portlet.id %>").replaceWith("<%= escape_javascript(render(@portlet)) %>"); + + +$(".block_portlets").sortable("enable"); + +<%= flash_js %> \ No newline at end of file diff --git a/app/views/portlet.old/table_cols/create.js.erb b/app/views/portlet.old/table_cols/create.js.erb new file mode 100644 index 0000000..2db2ece --- /dev/null +++ b/app/views/portlet.old/table_cols/create.js.erb @@ -0,0 +1,4 @@ + +$("#portlet_<%= @table_content.portlet.id %>").replaceWith("<%= escape_javascript(render(@table_content.portlet)) %>"); + +<%= flash_js %> \ No newline at end of file diff --git a/app/views/portlet.old/table_cols/destroy.js.erb b/app/views/portlet.old/table_cols/destroy.js.erb new file mode 100644 index 0000000..2db2ece --- /dev/null +++ b/app/views/portlet.old/table_cols/destroy.js.erb @@ -0,0 +1,4 @@ + +$("#portlet_<%= @table_content.portlet.id %>").replaceWith("<%= escape_javascript(render(@table_content.portlet)) %>"); + +<%= flash_js %> \ No newline at end of file diff --git a/app/views/portlet.old/table_contents/_form.html.haml b/app/views/portlet.old/table_contents/_form.html.haml new file mode 100644 index 0000000..d194428 --- /dev/null +++ b/app/views/portlet.old/table_contents/_form.html.haml @@ -0,0 +1,22 @@ + +=semantic_form_for( [:portlet, @table_content], :remote => true) do |f| + + + -if !@table_content.id + %table + %tr + %td Nombre de lignes : + %td=f.text_field :nbr_rows + %tr + %td Nombre de colonnes : + %td=f.text_field :nbr_cols + + -if BlockContent::STYLES.size > 0 + Style : + = f.select :style, TableContent::STYLES + + %br + = f.submit "Sauvegarder", :class => "btn btn-primary" + + + diff --git a/app/views/portlet.old/table_contents/_table_content.html.haml b/app/views/portlet.old/table_contents/_table_content.html.haml new file mode 100644 index 0000000..bf948ab --- /dev/null +++ b/app/views/portlet.old/table_contents/_table_content.html.haml @@ -0,0 +1,46 @@ + + + +%table.table_content + -table_rows = table_content.table_rows + %tr + -i = 0 + -table_content.nbr_cols.times do + -i += 1 + %td.add_col + %span.innerWrapper + .col_menu + =link_to "Ajouter une colonne avant", portlet_table_cols_path(:position => i, :table_content_id =>table_content.id ), :method => :post, :remote => true + + =link_to "Ajouter une colonne après", portlet_table_cols_path(:position => i+1, :table_content_id =>table_content.id ), :method => :post, :remote => true + + -if table_content.nbr_cols > 1 + =link_to "Supprimer cette colonne", portlet_table_col_path(:id => i, :table_content_id =>table_content.id ), :method => :delete, :remote => true, :confirm => "Voulez-vous vraiment supprimer cette colonne ?" + = i(:cog_alt, :gray_light, 12) + + %td + + -table_rows.each do |table_row| + %tr{:id => table_row.id} + + + -CelTable.where(:table_row_id => table_row.id).order("position ASC").each do |cel_table| + + %td.table_content_cel{:id => cel_table.id} + + =render :partial => "admin/blocks/block", :locals => {:block => cel_table.block} + + %td.add_cel + + .innerWrapper + .row_menu + =link_to "Ajouter un rang avant", portlet_table_rows_path(:table_row => {:table_content_id => table_content.id, :position => (table_row.position)}), :method => :post, :remote => true + + =link_to "Ajouter un rang après", portlet_table_rows_path(:table_row => {:table_content_id => table_content.id, :position => (table_row.position+1)}), :method => :post, :remote => true + -if table_content.nbr_rows > 1 + =link_to "Supprimer ce rang", portlet_table_row_path(table_row), :method => :delete, :remote => true, :confirm => "Voulez-vous vraiment supprimer ce rang ?" + = i(:cog_alt, :gray_light, 12) + + + + \ No newline at end of file diff --git a/app/views/portlet.old/table_contents/_table_content_edit_pane.html.haml b/app/views/portlet.old/table_contents/_table_content_edit_pane.html.haml new file mode 100644 index 0000000..7d42a41 --- /dev/null +++ b/app/views/portlet.old/table_contents/_table_content_edit_pane.html.haml @@ -0,0 +1,33 @@ +%table.table_content + -table_rows = @table_content.table_rows + %tr + + + + + -table_rows.each do |table_row| + %tr + %td.row_left + .crl + %a{:href => "#", :onclick => "$('.table_row_menu').hide();$('#table_row_menu_"+table_row.id.to_s+"').toggle();return false;"}+ + + + + + .table_row_menu#table_row_menu{:id => table_row.id} + =link_to "ajouter un rang avant", portlet_table_rows_path(:table_row => {:table_content_id => @table_content.id, :position => (table_row.position)}), :method => :post + %br + =link_to "ajouter un rang après", portlet_table_rows_path(:table_row => {:table_content_id => @table_content.id, :position => (table_row.position+1)}), :method => :post + %br + =link_to "supprimer ce rang", [:portlet, table_row], :method => :delete, :confirm => "Voulez-vous vraiment supprimer ce rang ainsi que son contenu ?", :remote => true + + -table_row.cel_tables.each do |cel_table| + + %td.table_content_cel + =auto_load_div(admin_block_path(cel_table.block),"Page_"+"@page.id.to_s"+"_blocks_part") + + %td.add_col + %span + + -@table_content.nbr_cols.times do + %td.add_col + %span +f diff --git a/app/views/portlet.old/table_contents/destroy_row.js.erb b/app/views/portlet.old/table_contents/destroy_row.js.erb new file mode 100644 index 0000000..8fd1b2d --- /dev/null +++ b/app/views/portlet.old/table_contents/destroy_row.js.erb @@ -0,0 +1,6 @@ + + + + +$("#table_content_edit_pane_<%= @table_content.id %>").html("<%= escape_javascript(render(:partial => "portlet/table_contents/table_content_edit_pane")) %>"); +<%= flash_notice() %> \ No newline at end of file diff --git a/app/views/portlet.old/table_rows/create.js.erb b/app/views/portlet.old/table_rows/create.js.erb new file mode 100644 index 0000000..928d700 --- /dev/null +++ b/app/views/portlet.old/table_rows/create.js.erb @@ -0,0 +1,4 @@ + +$("#portlet_<%= @portlet.id %>").replaceWith("<%= escape_javascript(render(@portlet)) %>"); + +<%= flash_js %> \ No newline at end of file diff --git a/app/views/portlet.old/table_rows/destroy.js.erb b/app/views/portlet.old/table_rows/destroy.js.erb new file mode 100644 index 0000000..687bbba --- /dev/null +++ b/app/views/portlet.old/table_rows/destroy.js.erb @@ -0,0 +1,4 @@ + +$("#portlet_<%= @table_row.table_content.portlet.id %>").replaceWith("<%= escape_javascript(render(@table_row.table_content.portlet)) %>"); + +<%= flash_js %> \ No newline at end of file diff --git a/app/views/portlet.old/text_contents/_form.html.haml b/app/views/portlet.old/text_contents/_form.html.haml new file mode 100644 index 0000000..0a3cd7d --- /dev/null +++ b/app/views/portlet.old/text_contents/_form.html.haml @@ -0,0 +1,35 @@ +=semantic_form_for( [:portlet, @text_content], :remote => true) do |f| + + %p{:style => "text-align:center;"}= f.submit "Sauvegarder", :class => "btn btn-primary" + + =f.text_area :content, :style => "width:98%;height:600px;", :class => "redactor_content" + + #toolbar-text + + + -if TextContent::STYLES.size > 0 + Style : + = f.select :style, TextContent::STYLES + + + + + + :javascript + + $('.redactor_content').redactor({ + toolbarExternal: '#toolbar-text', + + lang: 'fr', + buttons : ['html', '|', 'formatting', '|', 'bold', 'italic', 'deleted','underline','|', 'alignleft', 'aligncenter', 'alignright', 'justify', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'table', 'link', '|','fontcolor', 'backcolor','|', 'horizontalrule'] + + + }); + + + + + + + + diff --git a/app/views/portlet.old/text_contents/_text_content.html.haml b/app/views/portlet.old/text_contents/_text_content.html.haml new file mode 100644 index 0000000..afdbae0 --- /dev/null +++ b/app/views/portlet.old/text_contents/_text_content.html.haml @@ -0,0 +1 @@ +%p=raw text_content.content \ No newline at end of file diff --git a/app/views/portlet.old/title_contents/_form.html.haml b/app/views/portlet.old/title_contents/_form.html.haml new file mode 100644 index 0000000..c0c9db3 --- /dev/null +++ b/app/views/portlet.old/title_contents/_form.html.haml @@ -0,0 +1,15 @@ +=semantic_form_for( [:portlet, @title_content], :remote => true) do |f| + + =f.text_field :content, :style => "width:98%;", :class => "inputText" + + Importance : + = f.select :level, TitleContent::LEVELS + -if TitleContent::STYLES.size > 0 + Style : + = f.select :style, TitleContent::STYLES + %br + + = f.submit "Sauvegarder", :class => "btn btn-primary" + + + diff --git a/app/views/portlet.old/title_contents/_title_content.html.haml b/app/views/portlet.old/title_contents/_title_content.html.haml new file mode 100644 index 0000000..c394932 --- /dev/null +++ b/app/views/portlet.old/title_contents/_title_content.html.haml @@ -0,0 +1,4 @@ +=raw '" +=title_content.content +=raw "" + diff --git a/app/views/portlet/portlets/_portlet.html.haml b/app/views/portlet/portlets/_portlet.html.haml index 54c8dc6..86bb426 100644 --- a/app/views/portlet/portlets/_portlet.html.haml +++ b/app/views/portlet/portlets/_portlet.html.haml @@ -1,15 +1,12 @@ - - - #portlet.portlet{:id => portlet.id,:"data-portlet_id" => portlet.id, :class => "portlet_"+portlet.content_type.tableize.singularize+(" " if portlet.content_type == "BlockContent").to_s} -if portlet.content_type == "BlockContent" - .btn-toolbar{:style => "position:absolute;margin-left:10px;margin-top:-3em;"} + .btn-toolbar{:style => "position:absolute;margin-left:150px;margin-top:5px;"} .btn-group %a.btn.handle{:href => "#"}=i :move, :icon => false =link_to i(:pencil, :icon => false), eval("edit_portlet_"+portlet.content_type.tableize.singularize+"_path(portlet.content, :portlet_id => portlet.id)"), :remote => true, :class => "btn" - =link_to i(:trash, :icon => false), eval("portlet_"+portlet.content_type.tableize.singularize+"_path(portlet.content, :portlet_id => portlet.id)"), :method => :delete, :data => { :confirm => "Etes-vous sûr ?"}, :remote => true, :class => "btn" + =link_to i(:"trash", :icon => false), eval("portlet_"+portlet.content_type.tableize.singularize+"_path(portlet.content, :portlet_id => portlet.id)"), :method => :delete, :data => { :confirm => "Etes-vous sûr ?"}, :remote => true, :class => "btn" @@ -20,7 +17,7 @@ .btn-group %a.btn.handle{:href => "#"}=i :move, :icon => false =link_to i(:pencil, :icon => false), eval("edit_portlet_"+portlet.content_type.tableize.singularize+"_path(portlet.content, :portlet_id => portlet.id)"), :remote => true, :class => "btn" - =link_to i(:trash, :icon => false), eval("portlet_"+portlet.content_type.tableize.singularize+"_path(portlet.content, :portlet_id => portlet.id)"), :method => :delete, :data => { :confirm => "Etes-vous sûr ?"}, :remote => true, :class => "btn" + =link_to i(:"trash", :icon => false), eval("portlet_"+portlet.content_type.tableize.singularize+"_path(portlet.content, :portlet_id => portlet.id)"), :method => :delete, :data => { :confirm => "Etes-vous sûr ?"}, :remote => true, :class => "btn" @@ -28,7 +25,4 @@ - =render :partial => "portlets/render_public/"+portlet.content_type.to_s.downcase, :locals => {:input => portlet.content, :admin => true} - - - \ No newline at end of file + =render :partial => "portlets/render_public/"+portlet.content_type.to_s.downcase, :locals => {:input => portlet.content, :admin => true, :edit_link => eval("edit_portlet_"+portlet.content_type.tableize.singularize+"_path(portlet.content, :portlet_id => portlet.id)") } \ No newline at end of file diff --git a/app/views/portlet/shared/edit.js.erb b/app/views/portlet/shared/edit.js.erb index 6e09501..b42ce41 100644 --- a/app/views/portlet/shared/edit.js.erb +++ b/app/views/portlet/shared/edit.js.erb @@ -1,15 +1,16 @@ -$("#portlet_<%= @portlet.id %>").html("
"); +//$("#portlet_<%= @portlet.id %>").html("
"); -$("#edit_portlet_content_form").html("<%= escape_javascript(render( :partial => "form")) %>"); +//$("#edit_portlet_content_form").html("<%= escape_javascript(render( :partial => "form")) %>"); -$(".block_portlets").sortable("disable"); +$("#element_form").html("<%= escape_javascript(render( :partial => "form")) %>"); -$("#edit_portlet_content_form .text_editor").each(function() { +$("#collapse2").collapse('hide'); +$("#collapse3").collapse('show'); +//$(".block_portlets").sortable("disable"); + - auto_tiny_mce($(this)); -}); <%- cancel_button = escape_javascript(link_to("annuler", portlet_portlet_path(@portlet), :class => "button cancel", :remote => true)); %> $("#portlet_<%= @portlet.id %>").find('.buttons ol').prepend('<%= cancel_button %>'); diff --git a/app/views/portlet/shared/update.js.erb b/app/views/portlet/shared/update.js.erb index d47c241..39957c6 100644 --- a/app/views/portlet/shared/update.js.erb +++ b/app/views/portlet/shared/update.js.erb @@ -1,7 +1,7 @@ $("#portlet_<%= @portlet.id %>").replaceWith("<%= escape_javascript(render(@portlet)) %>"); - -$(".block_portlets").sortable("enable"); +$("#element_form").html("") +//$(".block_portlets").sortable("enable"); <%= flash_js %> \ No newline at end of file diff --git a/app/views/portlet/text_contents/_form.html.haml b/app/views/portlet/text_contents/_form.html.haml index 0a3cd7d..a42911d 100644 --- a/app/views/portlet/text_contents/_form.html.haml +++ b/app/views/portlet/text_contents/_form.html.haml @@ -1,35 +1,76 @@ -=semantic_form_for( [:portlet, @text_content], :remote => true) do |f| - - %p{:style => "text-align:center;"}= f.submit "Sauvegarder", :class => "btn btn-primary" - - =f.text_area :content, :style => "width:98%;height:600px;", :class => "redactor_content" +-if @text_content.id + =semantic_form_for( [:portlet, @text_content], :remote => true, :html => {:"data-portlet-id" => @text_content.portlet.id}) do |f| + + %p{:style => "text-align:center;"}= f.submit "Sauvegarder", :class => "btn btn-primary" + + =f.text_area :content, :style => "width:98%;height:600px;", :class => "redactor_content", :style => "display:none;" - #toolbar-text - - - -if TextContent::STYLES.size > 0 - Style : - = f.select :style, TextContent::STYLES + + + + -if TextContent::STYLES.size > 0 + Style : + = f.select :style, TextContent::STYLES - - - - :javascript - - $('.redactor_content').redactor({ - toolbarExternal: '#toolbar-text', - - lang: 'fr', - buttons : ['html', '|', 'formatting', '|', 'bold', 'italic', 'deleted','underline','|', 'alignleft', 'aligncenter', 'alignright', 'justify', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'table', 'link', '|','fontcolor', 'backcolor','|', 'horizontalrule'] - - - }); - - + + :javascript + $("#element_form form").submit(function (e){ + + $("textarea").val($('#portlet_'+$("#element_form form").data("portlet-id")+' .content').html()); + $("#toolbar-text").html(""); + + }); + + $('#portlet_'+$("#element_form form").data("portlet-id")+' .content').redactor({ + toolbarExternal: '#toolbar-text', + lang: 'fr', + buttons : ['undo','redo','|', 'formatting', '|', 'bold', 'italic', 'deleted','underline','|', 'alignleft', 'aligncenter', 'alignright', 'justify', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'table', 'link', '|','fontcolor', 'backcolor','|', 'horizontalrule', '|','html'] + + + + }); + + - - - + + + +-else + =semantic_form_for( [:portlet, @text_content], :remote => true) do |f| + + %p{:style => "text-align:center;"}= f.submit "Sauvegarder", :class => "btn btn-primary" + + =f.text_area :content, :style => "width:98%;height:600px;", :class => "redactor_content" + + + + + -if TextContent::STYLES.size > 0 + Style : + = f.select :style, TextContent::STYLES + + + + + + :javascript + + $('.redactor_content').redactor({ + toolbarExternal: '#toolbar-text', + lang: 'fr', + + buttons : ['undo','redo','|', 'formatting', '|', 'bold', 'italic', 'deleted','underline','|', 'alignleft', 'aligncenter', 'alignright', 'justify', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'table', 'link', '|','fontcolor', 'backcolor','|', 'horizontalrule', '|','html'] + + + }); + + + + + + + + diff --git a/app/views/portlet/text_contents/_text_content.html.haml b/app/views/portlet/text_contents/_text_content.html.haml index afdbae0..f36ab60 100644 --- a/app/views/portlet/text_contents/_text_content.html.haml +++ b/app/views/portlet/text_contents/_text_content.html.haml @@ -1 +1,2 @@ -%p=raw text_content.content \ No newline at end of file + +.content=raw text_content.content \ No newline at end of file diff --git a/app/views/portlet/title_contents/_form.html.haml b/app/views/portlet/title_contents/_form.html.haml index c0c9db3..b084cfd 100644 --- a/app/views/portlet/title_contents/_form.html.haml +++ b/app/views/portlet/title_contents/_form.html.haml @@ -1,6 +1,6 @@ =semantic_form_for( [:portlet, @title_content], :remote => true) do |f| - =f.text_field :content, :style => "width:98%;", :class => "inputText" + =f.text_field :content, :style => "width:98%;", :class => "inputText" if !@title_content.id Importance : = f.select :level, TitleContent::LEVELS diff --git a/app/views/portlets.old/render_public/_blockcontent.html.haml b/app/views/portlets.old/render_public/_blockcontent.html.haml new file mode 100644 index 0000000..220b93d --- /dev/null +++ b/app/views/portlets.old/render_public/_blockcontent.html.haml @@ -0,0 +1,30 @@ + +-if input.nbr_columns == 1 and admin == "dd" + -input.blocks.each do |block| + .block + =render :partial => "admin/blocks/block", :locals => {:block => block, :sortable => false} + .clear + +-else + =raw '' if !admin + + - css_class = "" + - css_class = "fond-gris" if input.style == 2 + - css_class = "fond-bleu" if input.style == 3 + + =raw "
" if !admin + + %div{:class => css_class} + .row-fluid + -for i in 1..input.nbr_columns.to_i + %div{:class => "span"+eval("input.row#{i}").to_s} + -if admin + =render :partial => "admin/blocks/block", :locals => {:admin => false,:block => input.blocks[i-1], :sortable => false} + -else + =render :partial => "public/blocks/block", :locals => {:admin => false, :block => input.blocks[i-1], :sortable => false} + + + =raw "
" if !admin + =raw '
' if !admin + + \ No newline at end of file diff --git a/app/views/portlets.old/render_public/_breakcontent.html.haml b/app/views/portlets.old/render_public/_breakcontent.html.haml new file mode 100644 index 0000000..a287381 --- /dev/null +++ b/app/views/portlets.old/render_public/_breakcontent.html.haml @@ -0,0 +1 @@ +%hr \ No newline at end of file diff --git a/app/views/portlets.old/render_public/_downloadcontent.html.haml b/app/views/portlets.old/render_public/_downloadcontent.html.haml new file mode 100644 index 0000000..8165052 --- /dev/null +++ b/app/views/portlets.old/render_public/_downloadcontent.html.haml @@ -0,0 +1,11 @@ +-if input.data_file + + + + .portlet.download_content + =link_to input.title.to_s, input.data_file.file.url + +-else + + .portlet.download_content + =link_to input.title.to_s, "" diff --git a/app/views/portlets.old/render_public/_dynamiccontent.html.haml b/app/views/portlets.old/render_public/_dynamiccontent.html.haml new file mode 100644 index 0000000..7b58256 --- /dev/null +++ b/app/views/portlets.old/render_public/_dynamiccontent.html.haml @@ -0,0 +1,3 @@ + + +=render :partial => "portlets/dynamic_contents/"+input.name.to_s.downcase if input.name \ No newline at end of file diff --git a/app/views/portlets.old/render_public/_eventcontent.html.haml b/app/views/portlets.old/render_public/_eventcontent.html.haml new file mode 100644 index 0000000..c312515 --- /dev/null +++ b/app/views/portlets.old/render_public/_eventcontent.html.haml @@ -0,0 +1,106 @@ +.event{:class => input.event_type.to_i} + %a{:id => "event_#{input.id}"} + -if input.image_file + + %p.img{:style =>"float:left;"} + =image_tag(input.image_file.file.large.medium.small.thumb) + + + + + + + + + + + + + %h2=input.title + %h3= input.artist + %h4 + ="Rencontre avec l'artiste" if input.event_type.to_i == 1 + = l input.start_at, :format => :human + %p{:style => "clear:both;margin-top:20px;"} + + #map.map{:id => input.id, :style => "width:400px; height:200px;"} + + + + + + + + + %p + %strong=input.place + %br + =simple_format input.address + + + + =simple_format input.description + %p=link_to "voir la carte en grand", "http://maps.google.com/maps?q="+u(input.address), :target => "blank" + + -if input.with_cible? + + + - if input.cible + =link_to "site de l'artiste", input.cible.cible_url, :target => ("_blank" if input.popup).to_s + + %p{:style => "clear:both;margin-top:10px;"} + \ No newline at end of file diff --git a/app/views/portlets.old/render_public/_gallerycontent.html.haml b/app/views/portlets.old/render_public/_gallerycontent.html.haml new file mode 100644 index 0000000..a9a2a60 --- /dev/null +++ b/app/views/portlets.old/render_public/_gallerycontent.html.haml @@ -0,0 +1,136 @@ + +-if admin + + %h2=input.name + .description + =raw input.description + + %p{:style => "text-align:center;"}=link_to "Ajouter des images", "#", :onclick => "select_gallery_images_from_manager('"+input.id.to_s+"');return false;", :class => "btn" + + .gallery_images + =render :collection => input.gallery_images, :partial => "portlet/gallery_images/gallery_image" + %p{:style => "clear:both;"} + + :coffeescript + + adjustment = "" + + $('.gallery_images').sortable({ + itemSelector:".gallery_image", + containerSelector :".gallery_images", + nested:true, + placeholder:"
", + onDragStart: ($item, container, _super) -> + $("body").addClass("dragging") + + offset = $item.offset() + pointer = container.rootGroup.pointer + adjustment = { + left: pointer.left - offset.left, + top: pointer.top - offset.top + } + onDrag: ($item, position, _super) -> + + $item.css({ + + left: position.left - adjustment.left, + top: position.top - adjustment.top - $(window).scrollTop() + + }) + + onDrop: ($item, container, _super) -> + + $item.removeClass("dragged").removeAttr("style") + $("body").removeClass("dragging") + + result = [] + container.el.find(".gallery_image").each -> + result.push $(this).data("id") + + + + + $.ajax({ + url:"/portlet/gallery_images/reorder.js", + type: "GET", + data: { + order : result + } + + }) + }); + + + + +-else + -if input.style == 4 + %ul#portfolio-filter + + %li + %a.current{:href => "#all"} Tous + + -input.tags.each do |tag| + %li + %a{:href => "##{tag.to_slug}"}= tag + + + + %ul#portfolio-list + -input.gallery_images.each do |gallery_images| + %li{:class => gallery_images.tags_class}=link_to image_tag(gallery_images.image_file.file.square.url),gallery_images.image_file.file.large.url, :title => "#{gallery_images.title}", :rel => "prettyPhoto" + + + :coffeescript + $('#portfolio-list').filterable({ + animationSpeed: 300, + show: { height: 'show',width: 'show' }, + hide: { height: 'hide' ,width: 'hide'} + }) + + + + -if input.style == 3 + .portlet.input + .gallery_images + -input.gallery_images.each do |gallery_images| + =link_to image_tag(gallery_images.image_file.file.square.url, :alt => "#{gallery_images.title}"), gallery_images.image_file.file.large.url, :rel => "prettyPhoto" + %p{:style => "clear:both;"} + + + -elsif input.style==2 +
+ + #slider + +
+ +
+
+ + + + -elsif input.style==1 + .portlet.input + %table.gallery_images + =raw "" + + - i = 0 + -input.gallery_images.each do |gallery_images| + - i = i+1 + + %td=link_to image_tag(gallery_images.image_file.file.large.medium.small.thumb.url, :alt => "#{gallery_images.title}"), gallery_images.image_file.file.large.url, :rel => "prettyPhoto" + + -if i % 4 == 0 + =raw "" + + + =raw "" + \ No newline at end of file diff --git a/app/views/portlets.old/render_public/_htmlcontent.html.haml b/app/views/portlets.old/render_public/_htmlcontent.html.haml new file mode 100644 index 0000000..edf5dc6 --- /dev/null +++ b/app/views/portlets.old/render_public/_htmlcontent.html.haml @@ -0,0 +1,5 @@ + +-begin + =render :inline => input.content, :type => input.content_type +-rescue Exception=>e + =raw "



" \ No newline at end of file diff --git a/app/views/portlets.old/render_public/_imagecontent.html.haml b/app/views/portlets.old/render_public/_imagecontent.html.haml new file mode 100644 index 0000000..57f456a --- /dev/null +++ b/app/views/portlets.old/render_public/_imagecontent.html.haml @@ -0,0 +1,51 @@ + +-if input.image_file + + -if input.style== "1" + -url =input.image_file.file.large.medium.url + + -elsif input.style== "2" + -url =input.image_file.file.large.medium.small.url + + -elsif input.style== "3" + -url =input.image_file.file.square.url + + -elsif input.style== "4" + -url =input.image_file.file.large.medium.small.thumb.url + + -elsif input.style== "5" + -url =input.image_file.file.large.url + + + +-else + -url ="" + +-url = "http://"+request.host_with_port+url +-style = "" +-style = "text-align:center;" if input.alignement == "center" + + +-style = "float:right;" if input.alignement == "right" + + +-style = "float:left;" if input.alignement == "left" + +- if input.cible + -link = input.cible.cible_url + +-styleimg="" +-styleimg += "width:"+input.width.to_s+"px;" if input.width? +-styleimg += "height:"+input.height.to_s+"px;" if input.height? + +%p.img{:style =>style} + -if link + + =link_to image_tag(url, :alt => input.alt.to_s, :style => styleimg ), link, :title => input.alt.to_s, :target => (input.popup ? "_blank" : "") + + + -elsif input.expandable + =link_to image_tag(url, :alt => input.alt.to_s, :style => styleimg ), (input.image_file ? input.image_file.file.large.url : ""), :rel => "prettyPhoto", :title => input.alt.to_s + + -else + =image_tag(url, :alt => input.alt.to_s, :style => styleimg ) diff --git a/app/views/portlets.old/render_public/_imglinkcontent.html.haml b/app/views/portlets.old/render_public/_imglinkcontent.html.haml new file mode 100644 index 0000000..673a185 --- /dev/null +++ b/app/views/portlets.old/render_public/_imglinkcontent.html.haml @@ -0,0 +1,27 @@ +.img_link_portlet + + - if input.cible + -url = input.cible.cible_url + + .image_file + =link_to image_tag(input.image_file.file.square.url), url if input.image_file + + .title + %h3=link_to input.title, url + .description + = link_to simple_format(input.description), url + .clear + + + -else + + + .image_file + =image_tag(input.image_file.file.square.url) if input.image_file + + .title + %h3=input.title + .description + = simple_format(input.description) + .clear + diff --git a/app/views/portlets.old/render_public/_linkcontent.html.haml b/app/views/portlets.old/render_public/_linkcontent.html.haml new file mode 100644 index 0000000..6cf9229 --- /dev/null +++ b/app/views/portlets.old/render_public/_linkcontent.html.haml @@ -0,0 +1,6 @@ +.portlet.link_content + - if input.cible + -url = input.cible.cible_url + -else + -url = "" + =link_to input.name.to_s, url.to_s, :class => "external_link", :target => ("_blank" if input.popup).to_s \ No newline at end of file diff --git a/app/views/portlets.old/render_public/_mapcontent.html.haml b/app/views/portlets.old/render_public/_mapcontent.html.haml new file mode 100644 index 0000000..7fd76a6 --- /dev/null +++ b/app/views/portlets.old/render_public/_mapcontent.html.haml @@ -0,0 +1,64 @@ +#map_content_map.map_content_map{:id => input.id, :style => "width:100%; height:400px;margin:auto;"} + + + + \ No newline at end of file diff --git a/app/views/portlets.old/render_public/_tablecontent.html.haml b/app/views/portlets.old/render_public/_tablecontent.html.haml new file mode 100644 index 0000000..bf01fc8 --- /dev/null +++ b/app/views/portlets.old/render_public/_tablecontent.html.haml @@ -0,0 +1,74 @@ +-if admin + + + + + + %table + -table_rows = input.table_rows + %tr + -i = 0 + -input.nbr_cols.times do + -i += 1 + %td.add_col{:style => "text-align:center;"} + + .btn-group + %a.btn.dropdown-toggle{:href => "#", :data => {:toggle => "dropdown"}} + = i(:cog) + + %ul.dropdown-menu + %li=link_to "Ajouter une colonne avant", portlet_table_cols_path(:position => i, :table_content_id =>input.id ), :method => :post, :remote => true + + %li=link_to "Ajouter une colonne après", portlet_table_cols_path(:position => i+1, :table_content_id =>input.id ), :method => :post, :remote => true + + -if input.nbr_cols > 1 + %li=link_to "Supprimer cette colonne", portlet_table_col_path(:id => i, :table_content_id =>input.id ), :method => :delete, :remote => true, :confirm => "Voulez-vous vraiment supprimer cette colonne ?" + + + %td + + -table_rows.each do |table_row| + %tr{:id => table_row.id} + + + -CelTable.where(:table_row_id => table_row.id).order("position ASC").each do |cel_table| + + %td.input_cel{:id => cel_table.id, :style => "border:1px solid black;"} + + =render :partial => "admin/blocks/block", :locals => {:block => cel_table.block, :sortable => false} + + %td.add_cel + + .btn-group{:style => "position:relative;"} + %a.btn.dropdown-toggle{:href => "#", :data => {:toggle => "dropdown"}} + = i(:cog) + + %ul.dropdown-menu{:style => "position:absolute;right:40px !important;left:auto !important;top:-2px !important;"} + %li=link_to "Ajouter un rang avant", portlet_table_rows_path(:table_row => {:table_content_id => input.id, :position => (table_row.position)}), :method => :post, :remote => true + + %li=link_to "Ajouter un rang après", portlet_table_rows_path(:table_row => {:table_content_id => input.id, :position => (table_row.position+1)}), :method => :post, :remote => true + -if input.nbr_rows > 1 + %li=link_to "Supprimer ce rang", portlet_table_row_path(table_row), :method => :delete, :remote => true, :confirm => "Voulez-vous vraiment supprimer ce rang ?" + + + + + +-else + + %table{:class =>("condensed" if input.style == 2)} + -table_rows = input.table_rows + + + -table_rows.each do |table_row| + %tr + + -table_row.cel_tables.each do |cel_table| + + %td + + =render cel_table.block + + + + diff --git a/app/views/portlets.old/render_public/_textcontent.html.haml b/app/views/portlets.old/render_public/_textcontent.html.haml new file mode 100644 index 0000000..81883ed --- /dev/null +++ b/app/views/portlets.old/render_public/_textcontent.html.haml @@ -0,0 +1 @@ +=raw(input.content) \ No newline at end of file diff --git a/app/views/portlets.old/render_public/_titlecontent.html.haml b/app/views/portlets.old/render_public/_titlecontent.html.haml new file mode 100644 index 0000000..72e2a08 --- /dev/null +++ b/app/views/portlets.old/render_public/_titlecontent.html.haml @@ -0,0 +1,5 @@ +-level = (input.level || "1").to_s + +=raw '" +=input.content +=raw '" diff --git a/app/views/portlets/render_public/_gallerycontent.html.haml b/app/views/portlets/render_public/_gallerycontent.html.haml index a9a2a60..bb5f02a 100644 --- a/app/views/portlets/render_public/_gallerycontent.html.haml +++ b/app/views/portlets/render_public/_gallerycontent.html.haml @@ -133,4 +133,5 @@ =raw "" - \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/portlets/render_public/_imagecontent.html.haml b/app/views/portlets/render_public/_imagecontent.html.haml index 57f456a..df149ba 100644 --- a/app/views/portlets/render_public/_imagecontent.html.haml +++ b/app/views/portlets/render_public/_imagecontent.html.haml @@ -1,25 +1,25 @@ - + -if input.image_file - -if input.style== "1" - -url =input.image_file.file.large.medium.url + -if input.style== "1" + -url =input.image_file.file.large.medium.url - -elsif input.style== "2" - -url =input.image_file.file.large.medium.small.url + -elsif input.style== "2" + -url =input.image_file.file.large.medium.small.url - -elsif input.style== "3" - -url =input.image_file.file.square.url + -elsif input.style== "3" + -url =input.image_file.file.square.url - -elsif input.style== "4" - -url =input.image_file.file.large.medium.small.thumb.url - - -elsif input.style== "5" - -url =input.image_file.file.large.url - - + -elsif input.style== "4" + -url =input.image_file.file.large.medium.small.thumb.url + + -elsif input.style== "5" + -url =input.image_file.file.large.url + + -else - -url ="" + -url ="" -url = "http://"+request.host_with_port+url -style = "" @@ -27,25 +27,29 @@ -style = "float:right;" if input.alignement == "right" - + -style = "float:left;" if input.alignement == "left" - if input.cible - -link = input.cible.cible_url + -link = input.cible.cible_url -styleimg="" -styleimg += "width:"+input.width.to_s+"px;" if input.width? -styleimg += "height:"+input.height.to_s+"px;" if input.height? %p.img{:style =>style} - -if link - - =link_to image_tag(url, :alt => input.alt.to_s, :style => styleimg ), link, :title => input.alt.to_s, :target => (input.popup ? "_blank" : "") + -if admin + =link_to image_tag(url, :alt => input.alt.to_s, :style => styleimg ), edit_link, :remote => true + -else + + -if link + + =link_to image_tag(url, :alt => input.alt.to_s, :style => styleimg ), link, :title => input.alt.to_s, :target => (input.popup ? "_blank" : "") - - -elsif input.expandable - =link_to image_tag(url, :alt => input.alt.to_s, :style => styleimg ), (input.image_file ? input.image_file.file.large.url : ""), :rel => "prettyPhoto", :title => input.alt.to_s + + -elsif input.expandable + =link_to image_tag(url, :alt => input.alt.to_s, :style => styleimg ), (input.image_file ? input.image_file.file.large.url : ""), :rel => "prettyPhoto", :title => input.alt.to_s - -else - =image_tag(url, :alt => input.alt.to_s, :style => styleimg ) + -else + =image_tag(url, :alt => input.alt.to_s, :style => styleimg ) diff --git a/app/views/portlets/render_public/_tablecontent.html.haml b/app/views/portlets/render_public/_tablecontent.html.haml index bf01fc8..bed8375 100644 --- a/app/views/portlets/render_public/_tablecontent.html.haml +++ b/app/views/portlets/render_public/_tablecontent.html.haml @@ -56,7 +56,7 @@ -else - %table{:class =>("condensed" if input.style == 2)} + %table -table_rows = input.table_rows diff --git a/app/views/portlets/render_public/_textcontent.html.haml b/app/views/portlets/render_public/_textcontent.html.haml index 81883ed..3208fe0 100644 --- a/app/views/portlets/render_public/_textcontent.html.haml +++ b/app/views/portlets/render_public/_textcontent.html.haml @@ -1 +1,4 @@ -=raw(input.content) \ No newline at end of file +-if admin + .content=raw(input.content) +-else + =raw(input.content) \ No newline at end of file diff --git a/app/views/portlets/render_public/_titlecontent.html.haml b/app/views/portlets/render_public/_titlecontent.html.haml index 72e2a08..364280d 100644 --- a/app/views/portlets/render_public/_titlecontent.html.haml +++ b/app/views/portlets/render_public/_titlecontent.html.haml @@ -1,5 +1,8 @@ -level = (input.level || "1").to_s -=raw '" +-if admin + =raw '" +-else + =raw '" =input.content =raw '"