nouvelle gestion des portlets
This commit is contained in:
parent
0117c1eb10
commit
efb5592bd0
@ -37,244 +37,278 @@
|
|||||||
|
|
||||||
|
|
||||||
@flash_delay = ->
|
@flash_delay = ->
|
||||||
$("#flashs").find(".alert").each ->
|
$("#flashs").find(".alert").each ->
|
||||||
|
|
||||||
if !$(this).hasClass("delay")
|
if !$(this).hasClass("delay")
|
||||||
$(this).addClass("delay")
|
$(this).addClass("delay")
|
||||||
$(this).delay(3000).fadeOut();
|
$(this).delay(3000).fadeOut();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@init_menu_items_list = ->
|
@init_menu_items_list = ->
|
||||||
|
|
||||||
if $(".prevv_folder").length > 0
|
if $(".prevv_folder").length > 0
|
||||||
|
|
||||||
$(".prevv_folder").sortable({
|
$(".prevv_folder").sortable({
|
||||||
group:"menu_items",
|
group:"menu_items",
|
||||||
containerSelector :".receptable",
|
containerSelector :".receptable",
|
||||||
itemSelector:".menu_item_row",
|
itemSelector:".menu_item_row",
|
||||||
handle: ".handle",
|
handle: ".handle",
|
||||||
nested:false,
|
nested:false,
|
||||||
placeholder:"<div class='placeholder'></div>",
|
placeholder:"<div class='placeholder'></div>",
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
oldContainer = ""
|
oldContainer = ""
|
||||||
$("#sortable_menu_item").sortable({
|
$("#sortable_menu_item").sortable({
|
||||||
group:"menu_items",
|
group:"menu_items",
|
||||||
containerSelector :".receptable",
|
containerSelector :".receptable",
|
||||||
itemSelector:".menu_item_row",
|
itemSelector:".menu_item_row",
|
||||||
handle: ".handle",
|
handle: ".handle",
|
||||||
nested:true,
|
nested:true,
|
||||||
placeholder:"<div class='placeholder'></div>",
|
placeholder:"<div class='placeholder'></div>",
|
||||||
afterMove: (placeholder, container) ->
|
afterMove: (placeholder, container) ->
|
||||||
if oldContainer != container and container.el.hasClass("prevv_folder")
|
if oldContainer != container and container.el.hasClass("prevv_folder")
|
||||||
if oldContainer
|
if oldContainer
|
||||||
oldContainer.el.removeClass("active")
|
oldContainer.el.removeClass("active")
|
||||||
container.el.addClass("active")
|
container.el.addClass("active")
|
||||||
oldContainer = container
|
oldContainer = container
|
||||||
onDrop: (item, Container, _super) ->
|
onDrop: (item, Container, _super) ->
|
||||||
|
|
||||||
|
|
||||||
if Container
|
if Container
|
||||||
|
|
||||||
parent_id = Container.el.data("parent-id")
|
parent_id = Container.el.data("parent-id")
|
||||||
menu_id = Container.el.data("menu-id")
|
menu_id = Container.el.data("menu-id")
|
||||||
id = item.data("menu-item-id")
|
id = item.data("menu-item-id")
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:"/admin/menu_items/"+id+".js",
|
url:"/admin/menu_items/"+id+".js",
|
||||||
type: "PUT",
|
type: "PUT",
|
||||||
data: {
|
data: {
|
||||||
reorder : true,
|
reorder : true,
|
||||||
menu_item : {
|
menu_item : {
|
||||||
parent_id : parent_id,
|
parent_id : parent_id,
|
||||||
menu_id : menu_id
|
menu_id : menu_id
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
success : ->
|
success : ->
|
||||||
|
|
||||||
|
|
||||||
_super(item)
|
_super(item)
|
||||||
item.remove()
|
item.remove()
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_super(item)
|
_super(item)
|
||||||
|
|
||||||
sortable_data = {parent_id :$("#sortable_menu_item").data("parent-id"), menu_id :$("#sortable_menu_item").data("menu-id") , menu_items_ids : []}
|
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_menu_item").find(".menu_item_row").each ->
|
||||||
sortable_data.menu_items_ids.push $(this).data("menu-item-id")
|
sortable_data.menu_items_ids.push $(this).data("menu-item-id")
|
||||||
|
|
||||||
|
|
||||||
$.ajax({url : "/admin/menu_items/reorder", data : sortable_data, type: "POST"});
|
$.ajax({url : "/admin/menu_items/reorder", data : sortable_data, type: "POST"});
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@update_block_portlet_order = (block_portlet_id) ->
|
@update_block_portlet_order = (block_portlet_id) ->
|
||||||
return_order = []
|
return_order = []
|
||||||
|
|
||||||
block_portlet = $("#block_portlet_"+block_portlet_id)
|
block_portlet = $("#block_portlet_"+block_portlet_id)
|
||||||
|
|
||||||
block_data = {block_id : block_portlet.data('block_id'), block_portlet_ids : []}
|
block_data = {block_id : block_portlet.data('block_id'), block_portlet_ids : []}
|
||||||
|
|
||||||
block_portlet.children('.portlet').each ->
|
block_portlet.children('.portlet').each ->
|
||||||
if $(this).data('portlet_id')
|
if $(this).data('portlet_id')
|
||||||
block_data.block_portlet_ids.push($(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 ->
|
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",
|
containerSelector :".block",
|
||||||
itemSelector:".portlet",
|
itemSelector:".portlet",
|
||||||
handle: ".handle",
|
handle: ".handle",
|
||||||
nested:true,
|
nested:true,
|
||||||
placeholder:"<div class='placeholder'></div>"
|
placeholder:"<div class='placeholder'></div>"
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
flash_delay();
|
flash_delay();
|
||||||
|
|
||||||
|
|
||||||
item_catched = ""
|
item_catched = ""
|
||||||
$(".block_portlets_sortable").sortable({
|
$(".block_portlets_sortable").sortable({
|
||||||
nested:true,
|
nested:true,
|
||||||
handle: ".handle",
|
handle: ".handle",
|
||||||
group : "block_portlets",
|
group : "block_portlets",
|
||||||
containerSelector :".block_portlets",
|
containerSelector :".block_portlets",
|
||||||
itemSelector:".portlet",
|
itemSelector:".portlet",
|
||||||
placeholder:"<div class='placeholder'></div>",
|
placeholder:"<div class='placeholder'></div>",
|
||||||
onDrop: ($item, container, _super) ->
|
onDrop: ($item, container, _super) ->
|
||||||
|
|
||||||
$item.removeClass("dragged").removeAttr("style")
|
$item.removeClass("dragged").removeAttr("style")
|
||||||
$("body").removeClass("dragging")
|
$("body").removeClass("dragging")
|
||||||
|
|
||||||
|
|
||||||
if $item.data("portlet_id")
|
if $item.data("portlet_id")
|
||||||
|
|
||||||
block_portlet_id = $item.closest(".block_portlets").data('block_id')
|
block_portlet_id = $item.closest(".block_portlets").data('block_id')
|
||||||
|
|
||||||
update_block_portlet_order block_portlet_id
|
update_block_portlet_order block_portlet_id
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
$("#content_types").html item_catched
|
$("#content_types").html item_catched
|
||||||
|
|
||||||
block_id = container.el.data("block_id")
|
block_id = container.el.data("block_id")
|
||||||
|
|
||||||
|
|
||||||
$item.replaceWith('<div id="new_portlet_form_inline" class="portlet"><div id="new_portlet_content_form"></div></div>');
|
$item.replaceWith('<div id="new_portlet_form_inline" class="portlet"><div id="new_portlet_content_form"></div></div>');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:"/portlet/portlets/new.js",
|
url:"/portlet/portlets/new.js",
|
||||||
type: "GET",
|
type: "GET",
|
||||||
data: {
|
data: {
|
||||||
block_id : $(this).attr("data_block_id"),
|
block_id : $(this).attr("data_block_id"),
|
||||||
position : $(this).attr("data_position"),
|
position : $(this).attr("data_position"),
|
||||||
content_type : $item.attr("data_type")
|
content_type : $item.attr("data_type")
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
isValidTarget: ($item, container) ->
|
isValidTarget: ($item, container) ->
|
||||||
|
|
||||||
if container.el.attr("id") != "content_types"
|
if container.el.attr("id") != "content_types"
|
||||||
return true
|
return true
|
||||||
|
|
||||||
onDragStart: ($item, container, _super) ->
|
onDragStart: ($item, container, _super) ->
|
||||||
item_catched = $("#content_types").html()
|
item_catched = $("#content_types").html()
|
||||||
|
|
||||||
|
|
||||||
$item.css({
|
$item.css({
|
||||||
height: $item.height(),
|
height: $item.height(),
|
||||||
width: $item.width()
|
width: $item.width()
|
||||||
})
|
})
|
||||||
$item.addClass("dragged")
|
$item.addClass("dragged")
|
||||||
$("body").addClass("dragging")
|
$("body").addClass("dragging")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
adjustment = ""
|
adjustment = ""
|
||||||
|
|
||||||
$("#menu_item_inspector_container").sortable({
|
$("#menu_item_inspector_container").sortable({
|
||||||
|
|
||||||
|
|
||||||
itemSelector:"#menu_item_informations",
|
itemSelector:"#menu_item_informations",
|
||||||
pullPlaceholder :false,
|
pullPlaceholder :false,
|
||||||
placeholder : "",
|
placeholder : "",
|
||||||
handle: ".inspector_handle",
|
handle: ".inspector_handle",
|
||||||
onDragStart: ($item, container, _super) ->
|
onDragStart: ($item, container, _super) ->
|
||||||
$item.css({
|
$item.css({
|
||||||
height: $item.height(),
|
height: $item.height(),
|
||||||
width: $item.width()
|
width: $item.width()
|
||||||
})
|
})
|
||||||
|
|
||||||
$("body").addClass("dragging")
|
$("body").addClass("dragging")
|
||||||
|
|
||||||
offset = $item.offset()
|
offset = $item.offset()
|
||||||
pointer = container.rootGroup.pointer
|
pointer = container.rootGroup.pointer
|
||||||
adjustment = {
|
adjustment = {
|
||||||
left: pointer.left - offset.left,
|
left: pointer.left - offset.left,
|
||||||
top: pointer.top - offset.top
|
top: pointer.top - offset.top
|
||||||
}
|
}
|
||||||
|
|
||||||
onCancel : ($item, container, _super) ->
|
onCancel : ($item, container, _super) ->
|
||||||
$item.css(position)
|
$item.css(position)
|
||||||
$item.removeClass("dragged")
|
$item.removeClass("dragged")
|
||||||
$("body").removeClass("dragging")
|
$("body").removeClass("dragging")
|
||||||
|
|
||||||
onDrag: ($item, position, _super) ->
|
onDrag: ($item, position, _super) ->
|
||||||
|
|
||||||
$item.css({
|
$item.css({
|
||||||
left: position.left - adjustment.left,
|
left: position.left - adjustment.left,
|
||||||
top: position.top - adjustment.top - $(window).scrollTop()
|
top: position.top - adjustment.top - $(window).scrollTop()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$(document).on "mouseover", ".portlet", ->
|
$(document).on "mouseover", ".portlet", ->
|
||||||
|
|
||||||
$(this).children(".btn-toolbar").show()
|
$(this).children(".btn-toolbar").show()
|
||||||
|
|
||||||
|
|
||||||
$(document).on "mouseout", ".portlet div", ->
|
$(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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -153,13 +153,16 @@ text-decoration:none;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#toolbar-text{
|
#toolbar-text{
|
||||||
position:fixed;
|
position:fixed;
|
||||||
top:40px;
|
z-index:2;
|
||||||
left:0px;
|
box-shadow: #000000 0px 0px 5px;
|
||||||
right:0px;
|
top:40px;
|
||||||
|
left:0px;
|
||||||
|
right:330px;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#flashs{
|
#flashs{
|
||||||
position:fixed;
|
position:fixed;
|
||||||
@ -268,11 +271,29 @@ text-decoration:none;
|
|||||||
}
|
}
|
||||||
|
|
||||||
#menu_item_informations{
|
#menu_item_informations{
|
||||||
|
|
||||||
|
|
||||||
|
form{
|
||||||
|
|
||||||
|
.preview{
|
||||||
|
|
||||||
|
img{
|
||||||
|
height:50px;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
position:fixed;
|
position:fixed;
|
||||||
top:100px;
|
z-index:3;
|
||||||
right:2em;
|
overflow:auto;
|
||||||
|
box-shadow:rgba(0,0,0,1) 0px 0px 5px;
|
||||||
|
margin-bottom:0px;
|
||||||
|
top:40px;
|
||||||
|
right:0px;
|
||||||
width:330px;
|
width:330px;
|
||||||
height:70%;
|
bottom:0px;
|
||||||
|
background:white;
|
||||||
.placeholder{
|
.placeholder{
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
width:91px;
|
width:91px;
|
||||||
@ -310,9 +331,9 @@ text-decoration:none;
|
|||||||
#menu_item_inspector_container{
|
#menu_item_inspector_container{
|
||||||
|
|
||||||
.accordion{
|
.accordion{
|
||||||
box-shadow:rgba(0,0,0,1) 0px 0px 5px;
|
|
||||||
height:auto;
|
height:auto;
|
||||||
background:black;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.accordion-group{
|
.accordion-group{
|
||||||
@ -351,6 +372,7 @@ text-decoration:none;
|
|||||||
|
|
||||||
.portlet{
|
.portlet{
|
||||||
img{height:50px;cursor:pointer;}
|
img{height:50px;cursor:pointer;}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
111
app/controllers/portlet.old/block_contents_controller.rb
Normal file
111
app/controllers/portlet.old/block_contents_controller.rb
Normal file
@ -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
|
116
app/controllers/portlet.old/break_contents_controller.rb
Normal file
116
app/controllers/portlet.old/break_contents_controller.rb
Normal file
@ -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
|
109
app/controllers/portlet.old/download_contents_controller.rb
Normal file
109
app/controllers/portlet.old/download_contents_controller.rb
Normal file
@ -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
|
116
app/controllers/portlet.old/dynamic_contents_controller.rb
Normal file
116
app/controllers/portlet.old/dynamic_contents_controller.rb
Normal file
@ -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
|
100
app/controllers/portlet.old/event_contents_controller.rb
Normal file
100
app/controllers/portlet.old/event_contents_controller.rb
Normal file
@ -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
|
109
app/controllers/portlet.old/gallery_contents_controller.rb
Normal file
109
app/controllers/portlet.old/gallery_contents_controller.rb
Normal file
@ -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
|
82
app/controllers/portlet.old/gallery_images_controller.rb
Normal file
82
app/controllers/portlet.old/gallery_images_controller.rb
Normal file
@ -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
|
116
app/controllers/portlet.old/html_contents_controller.rb
Normal file
116
app/controllers/portlet.old/html_contents_controller.rb
Normal file
@ -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
|
100
app/controllers/portlet.old/image_contents_controller.rb
Normal file
100
app/controllers/portlet.old/image_contents_controller.rb
Normal file
@ -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
|
112
app/controllers/portlet.old/img_link_contents_controller.rb
Normal file
112
app/controllers/portlet.old/img_link_contents_controller.rb
Normal file
@ -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
|
110
app/controllers/portlet.old/link_contents_controller.rb
Normal file
110
app/controllers/portlet.old/link_contents_controller.rb
Normal file
@ -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
|
116
app/controllers/portlet.old/map_contents_controller.rb
Normal file
116
app/controllers/portlet.old/map_contents_controller.rb
Normal file
@ -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
|
124
app/controllers/portlet.old/portlets_controller.rb
Normal file
124
app/controllers/portlet.old/portlets_controller.rb
Normal file
@ -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
|
35
app/controllers/portlet.old/table_cols_controller.rb
Normal file
35
app/controllers/portlet.old/table_cols_controller.rb
Normal file
@ -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
|
108
app/controllers/portlet.old/table_contents_controller.rb
Normal file
108
app/controllers/portlet.old/table_contents_controller.rb
Normal file
@ -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
|
106
app/controllers/portlet.old/table_rows_controller.rb
Normal file
106
app/controllers/portlet.old/table_rows_controller.rb
Normal file
@ -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
|
116
app/controllers/portlet.old/text_contents_controller.rb
Normal file
116
app/controllers/portlet.old/text_contents_controller.rb
Normal file
@ -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
|
116
app/controllers/portlet.old/title_contents_controller.rb
Normal file
116
app/controllers/portlet.old/title_contents_controller.rb
Normal file
@ -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
|
@ -47,7 +47,7 @@ class Portlet::TitleContentsController < ApplicationController
|
|||||||
|
|
||||||
def edit
|
def edit
|
||||||
@title_content = TitleContent.find(params[:id])
|
@title_content = TitleContent.find(params[:id])
|
||||||
@portlet = Portlet.find(params[:portlet_id])
|
@portlet = @title_content.portlet
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
if request.xhr?
|
if request.xhr?
|
||||||
@ -82,7 +82,7 @@ class Portlet::TitleContentsController < ApplicationController
|
|||||||
end
|
end
|
||||||
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" }
|
format.js { render :template => "portlet/shared/update" }
|
||||||
else
|
else
|
||||||
format.html { render :action => "portlet/shared/edit" }
|
format.html { render :action => "portlet/shared/edit" }
|
||||||
|
@ -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
|
#menu_item_inspector_container
|
||||||
.accordion#menu_item_informations
|
|
||||||
|
.accordion#menu_item_informations
|
||||||
.accordion-group
|
|
||||||
.inspector_handle
|
.accordion-group
|
||||||
.accordion-heading.navbar-inner.navbar-inverse
|
=#.inspector_handle
|
||||||
%a.accordion-toggle{:href => "#collapseOne",:data => {:toggle => "collapse", :parent => "#menu_item_informations"}}
|
.accordion-heading.navbar-inner.navbar-inverse
|
||||||
Infos sur la page
|
%a.accordion-toggle{:href => "#collapseOne",:data => {:toggle => "collapse", :parent => "#menu_item_informations"}}
|
||||||
|
Infos sur la page
|
||||||
|
|
||||||
#collapseOne.accordion-body.collapse
|
|
||||||
.accordion-inner
|
#collapseOne.accordion-body.collapse
|
||||||
=render :partial => "edit_form"
|
.accordion-inner
|
||||||
|
=render :partial => "edit_form"
|
||||||
|
|
||||||
.accordion-heading.navbar-inner.navbar-inverse
|
|
||||||
%a.accordion-toggle{:href => "#collapse2",:data => {:toggle => "collapse", :parent => "#menu_item_informations"}}
|
.accordion-heading.navbar-inner.navbar-inverse
|
||||||
éléments
|
%a.accordion-toggle{:href => "#collapse2",:data => {:toggle => "collapse", :parent => "#menu_item_informations"}}
|
||||||
|
éléments
|
||||||
|
|
||||||
#collapse2.accordion-body.collapse.in
|
|
||||||
.accordion-inner
|
#collapse2.accordion-body.collapse.in
|
||||||
.block_portlets_sortable#content_types
|
.accordion-inner
|
||||||
-page.blocks[0].alloweds_types.each do |slug, name|
|
.block_portlets_sortable#content_types
|
||||||
|
-page.blocks[0].alloweds_types.each do |slug, name|
|
||||||
|
|
||||||
.portlet{:id => slug, :data_type => slug}
|
.portlet{:id => slug, :data_type => slug}
|
||||||
=image_tag("admin/content_type/type_"+slug.to_s+".png", :alt => name, :title => name, :class => "handle")
|
=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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -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
|
89
app/views/portlet.old/block_contents/_form.html.haml
Normal file
89
app/views/portlet.old/block_contents/_form.html.haml
Normal file
@ -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"
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
%hr
|
15
app/views/portlet.old/break_contents/_form.html.haml
Normal file
15
app/views/portlet.old/break_contents/_form.html.haml
Normal file
@ -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"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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
|
39
app/views/portlet.old/download_contents/_form.html.haml
Normal file
39
app/views/portlet.old/download_contents/_form.html.haml
Normal file
@ -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"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
=DynamicContent::NAMES[dynamic_content.name] if dynamic_content.name
|
18
app/views/portlet.old/dynamic_contents/_form.html.haml
Normal file
18
app/views/portlet.old/dynamic_contents/_form.html.haml
Normal file
@ -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"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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;"}
|
56
app/views/portlet.old/event_contents/_form.html.haml
Normal file
56
app/views/portlet.old/event_contents/_form.html.haml
Normal file
@ -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"
|
||||||
|
|
||||||
|
|
9
app/views/portlet.old/gallery_contents/_form.html.haml
Normal file
9
app/views/portlet.old/gallery_contents/_form.html.haml
Normal file
@ -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"
|
||||||
|
|
||||||
|
|
@ -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
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
32
app/views/portlet.old/gallery_images/_form.html.haml
Normal file
32
app/views/portlet.old/gallery_images/_form.html.haml
Normal file
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
1
app/views/portlet.old/gallery_images/create.js.erb
Normal file
1
app/views/portlet.old/gallery_images/create.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
$('#portlet_<%= @gallery_content.portlet.id %> .gallery_images').prepend("<%= escape_javascript(render(@gallery_images)) %>");
|
4
app/views/portlet.old/gallery_images/destroy.js.erb
Normal file
4
app/views/portlet.old/gallery_images/destroy.js.erb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
$("#gallery_image_<%= @gallery_image.id.to_s %>").fadeOut(500).delay(6000).remove();
|
||||||
|
|
||||||
|
<%= flash_js %>
|
2
app/views/portlet.old/gallery_images/edit.js.erb
Normal file
2
app/views/portlet.old/gallery_images/edit.js.erb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
$('<%= escape_javascript(render(:partial => "form"))%>').modal('show');
|
0
app/views/portlet.old/gallery_images/reorder.js.erb
Normal file
0
app/views/portlet.old/gallery_images/reorder.js.erb
Normal file
5
app/views/portlet.old/gallery_images/update.js.erb
Normal file
5
app/views/portlet.old/gallery_images/update.js.erb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
close_pane_hover();
|
||||||
|
$('#gallery_image_<%= @gallery_image.id %>').effect("highlight", 1000);
|
||||||
|
|
||||||
|
|
||||||
|
<%= flash_js %>
|
60
app/views/portlet.old/html_contents/_form.html.haml
Normal file
60
app/views/portlet.old/html_contents/_form.html.haml
Normal file
@ -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;"}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var editor;
|
||||||
|
|
||||||
|
editor = ace.edit("ace_editor_pre");
|
||||||
|
editor.setTheme("ace/theme/textmate");
|
||||||
|
editor.getSession().setMode("ace/mode/html");
|
||||||
|
editor.setPrintMarginColumn(0);
|
||||||
|
editor.session.setUseWrapMode(true);
|
||||||
|
|
||||||
|
var textarea = $('#ace_editor_textarea').hide();
|
||||||
|
editor.getSession().setValue(textarea.val());
|
||||||
|
|
||||||
|
editor.getSession().on('change', function(){
|
||||||
|
|
||||||
|
textarea.val(editor.getSession().getValue());
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
%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
|
||||||
|
|
||||||
|
|
||||||
|
|
11
app/views/portlet.old/html_contents/_html_content.html.haml
Normal file
11
app/views/portlet.old/html_contents/_html_content.html.haml
Normal file
@ -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
|
32
app/views/portlet.old/image_contents/_form.html.haml
Normal file
32
app/views/portlet.old/image_contents/_form.html.haml
Normal file
@ -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"
|
||||||
|
|
||||||
|
|
@ -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
|
20
app/views/portlet.old/img_link_contents/_form.html.haml
Normal file
20
app/views/portlet.old/img_link_contents/_form.html.haml
Normal file
@ -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"
|
||||||
|
|
||||||
|
|
@ -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
|
14
app/views/portlet.old/link_contents/_form.html.haml
Normal file
14
app/views/portlet.old/link_contents/_form.html.haml
Normal file
@ -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"
|
||||||
|
|
||||||
|
|
10
app/views/portlet.old/link_contents/_link_content.html.haml
Normal file
10
app/views/portlet.old/link_contents/_link_content.html.haml
Normal file
@ -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
|
26
app/views/portlet.old/map_contents/_form.html.haml
Normal file
26
app/views/portlet.old/map_contents/_form.html.haml
Normal file
@ -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"
|
||||||
|
|
||||||
|
|
||||||
|
|
64
app/views/portlet.old/map_contents/_map_content.html.haml
Normal file
64
app/views/portlet.old/map_contents/_map_content.html.haml
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#map_content_map.map_content_map{:id => map_content.id, :style => "width:400px; height:300px;margin:auto;"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
="var address ='#{escape_javascript(map_content.address.to_s)}';"
|
||||||
|
|
||||||
|
var geocoder;
|
||||||
|
geocoder = new google.maps.Geocoder();
|
||||||
|
|
||||||
|
geocoder.geocode( { 'address': address}, function(results, status) {
|
||||||
|
if (status == google.maps.GeocoderStatus.OK) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var myLatlng = results[0].geometry.location;
|
||||||
|
var myOptions = {
|
||||||
|
="zoom:#{escape_javascript(map_content.zoom.to_s)},"
|
||||||
|
center: myLatlng,
|
||||||
|
|
||||||
|
-if map_content.view == 1
|
||||||
|
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||||
|
-elsif map_content.view == 2
|
||||||
|
mapTypeId: google.maps.MapTypeId.HYBRID
|
||||||
|
|
||||||
|
-elsif map_content.view == 3
|
||||||
|
mapTypeId: google.maps.MapTypeId.SATELLITE
|
||||||
|
};
|
||||||
|
|
||||||
|
="var map = new google.maps.Map(document.getElementById('map_content_map_#{map_content.id}'),"
|
||||||
|
myOptions);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var marker = new google.maps.Marker({
|
||||||
|
position: myLatlng,
|
||||||
|
|
||||||
|
map : map,
|
||||||
|
|
||||||
|
="title:'=#{escape_javascript(map_content.name)}',"
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var infowindow = new google.maps.InfoWindow({
|
||||||
|
="content:'#{escape_javascript(map_content.name)}',"
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-if map_content.info_bule
|
||||||
|
infowindow.open(map,marker);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
34
app/views/portlet.old/portlets/_portlet.html.haml
Normal file
34
app/views/portlet.old/portlets/_portlet.html.haml
Normal file
@ -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}
|
||||||
|
|
||||||
|
|
||||||
|
|
7
app/views/portlet.old/portlets/new.html.haml
Normal file
7
app/views/portlet.old/portlets/new.html.haml
Normal file
@ -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
|
12
app/views/portlet.old/portlets/new.js.erb
Normal file
12
app/views/portlet.old/portlets/new.js.erb
Normal file
@ -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 (){
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
8
app/views/portlet.old/portlets/update.js.erb
Normal file
8
app/views/portlet.old/portlets/update.js.erb
Normal file
@ -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() %>
|
6
app/views/portlet.old/shared/_new.html.haml
Normal file
6
app/views/portlet.old/shared/_new.html.haml
Normal file
@ -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}');
|
||||||
|
|
13
app/views/portlet.old/shared/create.js.erb
Normal file
13
app/views/portlet.old/shared/create.js.erb
Normal file
@ -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 %>
|
4
app/views/portlet.old/shared/destroy.js.erb
Normal file
4
app/views/portlet.old/shared/destroy.js.erb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
$("#portlet_<%= @portlet.id %>").remove();
|
||||||
|
<%= flash_js %>
|
||||||
|
block_js_initialize();
|
||||||
|
update_portlet_order();
|
18
app/views/portlet.old/shared/edit.js.erb
Normal file
18
app/views/portlet.old/shared/edit.js.erb
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
$("#portlet_<%= @portlet.id %>").html("<div id='edit_portlet_content_form'></div>");
|
||||||
|
|
||||||
|
$("#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 %>');
|
||||||
|
|
||||||
|
|
||||||
|
|
21
app/views/portlet.old/shared/new.js.erb
Normal file
21
app/views/portlet.old/shared/new.js.erb
Normal file
@ -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();
|
7
app/views/portlet.old/shared/update.js.erb
Normal file
7
app/views/portlet.old/shared/update.js.erb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
$("#portlet_<%= @portlet.id %>").replaceWith("<%= escape_javascript(render(@portlet)) %>");
|
||||||
|
|
||||||
|
|
||||||
|
$(".block_portlets").sortable("enable");
|
||||||
|
|
||||||
|
<%= flash_js %>
|
4
app/views/portlet.old/table_cols/create.js.erb
Normal file
4
app/views/portlet.old/table_cols/create.js.erb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
$("#portlet_<%= @table_content.portlet.id %>").replaceWith("<%= escape_javascript(render(@table_content.portlet)) %>");
|
||||||
|
|
||||||
|
<%= flash_js %>
|
4
app/views/portlet.old/table_cols/destroy.js.erb
Normal file
4
app/views/portlet.old/table_cols/destroy.js.erb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
$("#portlet_<%= @table_content.portlet.id %>").replaceWith("<%= escape_javascript(render(@table_content.portlet)) %>");
|
||||||
|
|
||||||
|
<%= flash_js %>
|
22
app/views/portlet.old/table_contents/_form.html.haml
Normal file
22
app/views/portlet.old/table_contents/_form.html.haml
Normal file
@ -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"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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
|
6
app/views/portlet.old/table_contents/destroy_row.js.erb
Normal file
6
app/views/portlet.old/table_contents/destroy_row.js.erb
Normal file
@ -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() %>
|
4
app/views/portlet.old/table_rows/create.js.erb
Normal file
4
app/views/portlet.old/table_rows/create.js.erb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
$("#portlet_<%= @portlet.id %>").replaceWith("<%= escape_javascript(render(@portlet)) %>");
|
||||||
|
|
||||||
|
<%= flash_js %>
|
4
app/views/portlet.old/table_rows/destroy.js.erb
Normal file
4
app/views/portlet.old/table_rows/destroy.js.erb
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
$("#portlet_<%= @table_row.table_content.portlet.id %>").replaceWith("<%= escape_javascript(render(@table_row.table_content.portlet)) %>");
|
||||||
|
|
||||||
|
<%= flash_js %>
|
35
app/views/portlet.old/text_contents/_form.html.haml
Normal file
35
app/views/portlet.old/text_contents/_form.html.haml
Normal file
@ -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']
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
%p=raw text_content.content
|
15
app/views/portlet.old/title_contents/_form.html.haml
Normal file
15
app/views/portlet.old/title_contents/_form.html.haml
Normal file
@ -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"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
|||||||
|
=raw '<h'+title_content.level.to_s+">"
|
||||||
|
=title_content.content
|
||||||
|
=raw "</h"+title_content.level.to_s+">"
|
||||||
|
|
@ -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}
|
#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"
|
-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
|
.btn-group
|
||||||
%a.btn.handle{:href => "#"}=i :move, :icon => false
|
%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(: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
|
.btn-group
|
||||||
%a.btn.handle{:href => "#"}=i :move, :icon => false
|
%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(: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}
|
=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)") }
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
|||||||
$("#portlet_<%= @portlet.id %>").html("<div id='edit_portlet_content_form'></div>");
|
//$("#portlet_<%= @portlet.id %>").html("<div id='edit_portlet_content_form'></div>");
|
||||||
|
|
||||||
$("#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)); %>
|
<%- 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 %>');
|
$("#portlet_<%= @portlet.id %>").find('.buttons ol').prepend('<%= cancel_button %>');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
$("#portlet_<%= @portlet.id %>").replaceWith("<%= escape_javascript(render(@portlet)) %>");
|
$("#portlet_<%= @portlet.id %>").replaceWith("<%= escape_javascript(render(@portlet)) %>");
|
||||||
|
|
||||||
|
$("#element_form").html("")
|
||||||
$(".block_portlets").sortable("enable");
|
//$(".block_portlets").sortable("enable");
|
||||||
|
|
||||||
<%= flash_js %>
|
<%= flash_js %>
|
@ -1,35 +1,76 @@
|
|||||||
=semantic_form_for( [:portlet, @text_content], :remote => true) do |f|
|
-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"
|
|
||||||
|
%p{:style => "text-align:center;"}= f.submit "Sauvegarder", :class => "btn btn-primary"
|
||||||
=f.text_area :content, :style => "width:98%;height:600px;", :class => "redactor_content"
|
|
||||||
|
=f.text_area :content, :style => "width:98%;height:600px;", :class => "redactor_content", :style => "display:none;"
|
||||||
|
|
||||||
#toolbar-text
|
|
||||||
|
|
||||||
|
|
||||||
-if TextContent::STYLES.size > 0
|
-if TextContent::STYLES.size > 0
|
||||||
Style :
|
Style :
|
||||||
= f.select :style, TextContent::STYLES
|
= f.select :style, TextContent::STYLES
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
:javascript
|
||||||
|
$("#element_form form").submit(function (e){
|
||||||
:javascript
|
|
||||||
|
$("textarea").val($('#portlet_'+$("#element_form form").data("portlet-id")+' .content').html());
|
||||||
$('.redactor_content').redactor({
|
$("#toolbar-text").html("");
|
||||||
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']
|
$('#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']
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1 +1,2 @@
|
|||||||
%p=raw text_content.content
|
|
||||||
|
.content=raw text_content.content
|
@ -1,6 +1,6 @@
|
|||||||
=semantic_form_for( [:portlet, @title_content], :remote => true) do |f|
|
=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 :
|
Importance :
|
||||||
= f.select :level, TitleContent::LEVELS
|
= f.select :level, TitleContent::LEVELS
|
||||||
|
30
app/views/portlets.old/render_public/_blockcontent.html.haml
Normal file
30
app/views/portlets.old/render_public/_blockcontent.html.haml
Normal file
@ -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 '</div>' if !admin
|
||||||
|
|
||||||
|
- css_class = ""
|
||||||
|
- css_class = "fond-gris" if input.style == 2
|
||||||
|
- css_class = "fond-bleu" if input.style == 3
|
||||||
|
|
||||||
|
=raw "<div class='#{css_class}'>" 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 "</div>" if !admin
|
||||||
|
=raw '<div class="row-fluid">' if !admin
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
%hr
|
@ -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, ""
|
@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
|
=render :partial => "portlets/dynamic_contents/"+input.name.to_s.downcase if input.name
|
106
app/views/portlets.old/render_public/_eventcontent.html.haml
Normal file
106
app/views/portlets.old/render_public/_eventcontent.html.haml
Normal file
@ -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;"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
="var address ='#{escape_javascript(input.address.to_s)}';"
|
||||||
|
|
||||||
|
var geocoder;
|
||||||
|
geocoder = new google.maps.Geocoder();
|
||||||
|
|
||||||
|
geocoder.geocode( { 'address': address}, function(results, status) {
|
||||||
|
if (status == google.maps.GeocoderStatus.OK) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var myLatlng = results[0].geometry.location;
|
||||||
|
var myOptions = {
|
||||||
|
="zoom:#{escape_javascript(12.to_s)},"
|
||||||
|
center: myLatlng,
|
||||||
|
|
||||||
|
|
||||||
|
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
="var map = new google.maps.Map(document.getElementById('map_#{input.id}'),"
|
||||||
|
myOptions);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var marker = new google.maps.Marker({
|
||||||
|
position: myLatlng,
|
||||||
|
|
||||||
|
map : map,
|
||||||
|
|
||||||
|
="title:'=#{escape_javascript(input.title)}',"
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var infowindow = new google.maps.InfoWindow({
|
||||||
|
="content:'#{escape_javascript(input.title)}',"
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%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;"}
|
||||||
|
|
136
app/views/portlets.old/render_public/_gallerycontent.html.haml
Normal file
136
app/views/portlets.old/render_public/_gallerycontent.html.haml
Normal file
@ -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:"<div class='placeholder' style='display:inline-block;width:50px;height:170px;'></div>",
|
||||||
|
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
|
||||||
|
</div>
|
||||||
|
|
||||||
|
#slider
|
||||||
|
|
||||||
|
<div id="wrapper" >
|
||||||
|
<div id="carousel" >
|
||||||
|
|
||||||
|
-input.gallery_images.each do |gallery_images|
|
||||||
|
=image_tag gallery_images.image_file.file.large.medium.url
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-elsif input.style==1
|
||||||
|
.portlet.input
|
||||||
|
%table.gallery_images
|
||||||
|
=raw "<tr>"
|
||||||
|
|
||||||
|
- 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 "</tr><tr>"
|
||||||
|
|
||||||
|
|
||||||
|
=raw "</tr>"
|
||||||
|
|
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
-begin
|
||||||
|
=render :inline => input.content, :type => input.content_type
|
||||||
|
-rescue Exception=>e
|
||||||
|
=raw "<br /><br /><br /><br />"
|
51
app/views/portlets.old/render_public/_imagecontent.html.haml
Normal file
51
app/views/portlets.old/render_public/_imagecontent.html.haml
Normal file
@ -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 )
|
@ -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
|
||||||
|
|
@ -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
|
64
app/views/portlets.old/render_public/_mapcontent.html.haml
Normal file
64
app/views/portlets.old/render_public/_mapcontent.html.haml
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#map_content_map.map_content_map{:id => input.id, :style => "width:100%; height:400px;margin:auto;"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
="var address ='#{escape_javascript(input.address.to_s)}';"
|
||||||
|
|
||||||
|
var geocoder;
|
||||||
|
geocoder = new google.maps.Geocoder();
|
||||||
|
|
||||||
|
geocoder.geocode( { 'address': address}, function(results, status) {
|
||||||
|
if (status == google.maps.GeocoderStatus.OK) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var myLatlng = results[0].geometry.location;
|
||||||
|
var myOptions = {
|
||||||
|
="zoom:#{escape_javascript(input.zoom.to_s)},"
|
||||||
|
center: myLatlng,
|
||||||
|
|
||||||
|
-if input.view == 1
|
||||||
|
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||||
|
-elsif input.view == 2
|
||||||
|
mapTypeId: google.maps.MapTypeId.HYBRID
|
||||||
|
|
||||||
|
-elsif input.view == 3
|
||||||
|
mapTypeId: google.maps.MapTypeId.SATELLITE
|
||||||
|
};
|
||||||
|
|
||||||
|
="var map = new google.maps.Map(document.getElementById('map_content_map_#{input.id}'),"
|
||||||
|
myOptions);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var marker = new google.maps.Marker({
|
||||||
|
position: myLatlng,
|
||||||
|
|
||||||
|
map : map,
|
||||||
|
|
||||||
|
="title:'=#{escape_javascript(input.name)}',"
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var infowindow = new google.maps.InfoWindow({
|
||||||
|
="content:'#{escape_javascript(input.name)}',"
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-if input.info_bule
|
||||||
|
infowindow.open(map,marker);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
74
app/views/portlets.old/render_public/_tablecontent.html.haml
Normal file
74
app/views/portlets.old/render_public/_tablecontent.html.haml
Normal file
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
=raw(input.content)
|
@ -0,0 +1,5 @@
|
|||||||
|
-level = (input.level || "1").to_s
|
||||||
|
|
||||||
|
=raw '<h'+level+" >"
|
||||||
|
=input.content
|
||||||
|
=raw '</h'+level+" >"
|
@ -133,4 +133,5 @@
|
|||||||
|
|
||||||
|
|
||||||
=raw "</tr>"
|
=raw "</tr>"
|
||||||
|
|
||||||
|
|
@ -1,25 +1,25 @@
|
|||||||
|
|
||||||
-if input.image_file
|
-if input.image_file
|
||||||
|
|
||||||
-if input.style== "1"
|
-if input.style== "1"
|
||||||
-url =input.image_file.file.large.medium.url
|
-url =input.image_file.file.large.medium.url
|
||||||
|
|
||||||
-elsif input.style== "2"
|
-elsif input.style== "2"
|
||||||
-url =input.image_file.file.large.medium.small.url
|
-url =input.image_file.file.large.medium.small.url
|
||||||
|
|
||||||
-elsif input.style== "3"
|
-elsif input.style== "3"
|
||||||
-url =input.image_file.file.square.url
|
-url =input.image_file.file.square.url
|
||||||
|
|
||||||
-elsif input.style== "4"
|
-elsif input.style== "4"
|
||||||
-url =input.image_file.file.large.medium.small.thumb.url
|
-url =input.image_file.file.large.medium.small.thumb.url
|
||||||
|
|
||||||
-elsif input.style== "5"
|
-elsif input.style== "5"
|
||||||
-url =input.image_file.file.large.url
|
-url =input.image_file.file.large.url
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-else
|
-else
|
||||||
-url =""
|
-url =""
|
||||||
|
|
||||||
-url = "http://"+request.host_with_port+url
|
-url = "http://"+request.host_with_port+url
|
||||||
-style = ""
|
-style = ""
|
||||||
@ -27,25 +27,29 @@
|
|||||||
|
|
||||||
|
|
||||||
-style = "float:right;" if input.alignement == "right"
|
-style = "float:right;" if input.alignement == "right"
|
||||||
|
|
||||||
|
|
||||||
-style = "float:left;" if input.alignement == "left"
|
-style = "float:left;" if input.alignement == "left"
|
||||||
|
|
||||||
- if input.cible
|
- if input.cible
|
||||||
-link = input.cible.cible_url
|
-link = input.cible.cible_url
|
||||||
|
|
||||||
-styleimg=""
|
-styleimg=""
|
||||||
-styleimg += "width:"+input.width.to_s+"px;" if input.width?
|
-styleimg += "width:"+input.width.to_s+"px;" if input.width?
|
||||||
-styleimg += "height:"+input.height.to_s+"px;" if input.height?
|
-styleimg += "height:"+input.height.to_s+"px;" if input.height?
|
||||||
|
|
||||||
%p.img{:style =>style}
|
%p.img{:style =>style}
|
||||||
-if link
|
-if admin
|
||||||
|
=link_to image_tag(url, :alt => input.alt.to_s, :style => styleimg ), edit_link, :remote => true
|
||||||
=link_to image_tag(url, :alt => input.alt.to_s, :style => styleimg ), link, :title => input.alt.to_s, :target => (input.popup ? "_blank" : "")
|
-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
|
-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
|
=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
|
-else
|
||||||
=image_tag(url, :alt => input.alt.to_s, :style => styleimg )
|
=image_tag(url, :alt => input.alt.to_s, :style => styleimg )
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
-else
|
-else
|
||||||
|
|
||||||
%table{:class =>("condensed" if input.style == 2)}
|
%table
|
||||||
-table_rows = input.table_rows
|
-table_rows = input.table_rows
|
||||||
|
|
||||||
|
|
||||||
|
@ -1 +1,4 @@
|
|||||||
=raw(input.content)
|
-if admin
|
||||||
|
.content=raw(input.content)
|
||||||
|
-else
|
||||||
|
=raw(input.content)
|
@ -1,5 +1,8 @@
|
|||||||
-level = (input.level || "1").to_s
|
-level = (input.level || "1").to_s
|
||||||
|
|
||||||
=raw '<h'+level+" >"
|
-if admin
|
||||||
|
=raw '<h'+level+" contenteditable='true' class='inline-contenteditable title_content_inline' data-title-id='"+input.id.to_s+"'>"
|
||||||
|
-else
|
||||||
|
=raw '<h'+level+" >"
|
||||||
=input.content
|
=input.content
|
||||||
=raw '</h'+level+" >"
|
=raw '</h'+level+" >"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user