les liens ont maintenant le nouveau système de cible, avec le plugin pour formtastic.
This commit is contained in:
parent
be00fd918f
commit
d22d3d05b8
@ -7,11 +7,6 @@ class Portlet::LinkContentsController < ApplicationController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
params[:link_content_cible_type] = "CibleUrl" if !params[:link_content_cible_type]
|
|
||||||
|
|
||||||
@cible = params[:link_content_cible_type].constantize.new()
|
|
||||||
@link_content.cible = @cible
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
if request.xhr?
|
if request.xhr?
|
||||||
@ -25,15 +20,11 @@ class Portlet::LinkContentsController < ApplicationController
|
|||||||
def create
|
def create
|
||||||
|
|
||||||
|
|
||||||
params_cible = params[:link_content].delete(:cible_attributes)
|
|
||||||
cible_type = params[:link_content][:cible_type]
|
|
||||||
|
|
||||||
@link_content = LinkContent.new(params[:link_content])
|
@link_content = LinkContent.new(params[:link_content])
|
||||||
|
|
||||||
|
|
||||||
cible = cible_type.constantize.new(params_cible)
|
|
||||||
|
|
||||||
@link_content.cible = cible
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @link_content.save
|
if @link_content.save
|
||||||
@ -79,18 +70,6 @@ class Portlet::LinkContentsController < ApplicationController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
params_cible = params[:link_content].delete(:cible_attributes)
|
|
||||||
cible_type = params[:link_content][:cible_type]
|
|
||||||
|
|
||||||
|
|
||||||
if !(params[:link_content][:cible_id] and params[:link_content][:cible_id] != "")
|
|
||||||
cible = cible_type.constantize.new(params_cible)
|
|
||||||
@link_content.cible = cible
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
-menu_item.ancestors.size.times do
|
|
||||||
|
|
||||||
=f.radio_button :menu_item_id, menu_item.id, :disabled => ("disabled" if menu_item.menu_content_type =="MenuAlias")
|
|
||||||
%label{:for => params[:resource].to_s+"_cible_attributes_menu_item_id_"+menu_item.id.to_s}=menu_item.name
|
|
||||||
%br
|
|
||||||
-menu_item.children.find(:all, :order => :position).each do |m|
|
|
||||||
=render :partial => "portlet/link_contents/alias_form_line", :locals => {:f => f, :menu_item => m}
|
|
@ -1,2 +0,0 @@
|
|||||||
Lien vers l'élément de menu
|
|
||||||
=cible.menu_item.name if cible.menu_item
|
|
@ -1,5 +0,0 @@
|
|||||||
=form.semantic_fields_for :cible do |cible|
|
|
||||||
= cible.inputs do
|
|
||||||
|
|
||||||
-MenuItem.find(:all, :conditions => {:parent_id => nil}, :order => :position).each do |m|
|
|
||||||
=render :partial => "portlet/link_contents/alias_form_line", :locals => {:f => cible, :menu_item => m}
|
|
@ -1,2 +0,0 @@
|
|||||||
Lien vers l'article
|
|
||||||
=cible.article.title if cible.article
|
|
@ -1,13 +0,0 @@
|
|||||||
|
|
||||||
=form.semantic_fields_for :cible do |cible|
|
|
||||||
= cible.inputs do
|
|
||||||
-Folder.all.each do |folder|
|
|
||||||
|
|
||||||
%h4=folder.title
|
|
||||||
|
|
||||||
-folder.articles.each do |article|
|
|
||||||
%p
|
|
||||||
=cible.radio_button :article_id, article.id
|
|
||||||
%label{:for => "link_content_cible_attributes_article_id_"+article.id.to_s}=article.title
|
|
||||||
%br
|
|
||||||
%br
|
|
@ -1,2 +0,0 @@
|
|||||||
Lien vers le dossier
|
|
||||||
=cible.folder.title if cible.folder
|
|
@ -1,8 +0,0 @@
|
|||||||
|
|
||||||
=form.semantic_fields_for :cible do |cible|
|
|
||||||
= cible.inputs do
|
|
||||||
-Folder.all.each do |folder|
|
|
||||||
%p
|
|
||||||
=cible.radio_button :folder_id, folder.id
|
|
||||||
%label{:for => "link_content_cible_attributes_folder_id_"+folder.id.to_s}=folder.title
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
|||||||
Lien vers l'url
|
|
||||||
=cible.url
|
|
@ -1,6 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
=form.semantic_fields_for :cible do |cible|
|
|
||||||
= cible.inputs do
|
|
||||||
= cible.input :url, :as => :string, :label => "Url :"
|
|
@ -6,22 +6,9 @@
|
|||||||
=# form.input :title, :label => "Title :"
|
=# form.input :title, :label => "Title :"
|
||||||
= form.input :popup,:as => :boolean , :label => "Ouvrir dans une nouvelle fenêtre ?"
|
= form.input :popup,:as => :boolean , :label => "Ouvrir dans une nouvelle fenêtre ?"
|
||||||
|
|
||||||
|
= form.input :cible, :label => "Cible :" , :as => :qi_cible_select
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#select_cible_type_bar.bar.dark_blue
|
|
||||||
-CibleType.all.each do |cible_type|
|
|
||||||
=link_to cible_type.name, new_portlet_link_content_path(:link_content_cible_type => cible_type.slug ), :onclick => "$('#link_content_cible_form').load($(this).attr('href')+' #link_content_cible_form_content');$('#select_cible_type_bar .active').removeClass('active');$(this).addClass('active');return false;",:class => ("active" if cible_type.slug == @link_content.cible_type).to_s
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#link_content_cible_form.form2
|
|
||||||
#link_content_cible_form_content
|
|
||||||
= form.inputs do
|
|
||||||
= form.input :cible_type,:as => :hidden
|
|
||||||
= form.input :cible_id,:as => :hidden
|
|
||||||
=render :partial => "portlet/link_contents/"+@link_content.cible_type.tableize.singularize.to_s+"_form", :locals => {:form => form}
|
|
||||||
|
|
||||||
= form.buttons do
|
= form.buttons do
|
||||||
= form.commit_button "Sauvegarder"
|
= form.commit_button "Sauvegarder"
|
||||||
|
|
||||||
|
@ -4,4 +4,7 @@ Texte affiché :
|
|||||||
%br
|
%br
|
||||||
="s'ouvre dans une nouvelle page" if link_content.popup
|
="s'ouvre dans une nouvelle page" if link_content.popup
|
||||||
|
|
||||||
=render :partial => "portlet/link_contents/"+link_content.cible_type.tableize.singularize, :locals => {:cible => link_content.cible}
|
- if link_content.cible
|
||||||
|
%strong
|
||||||
|
Liens vers
|
||||||
|
= link_content.cible.cible_name
|
@ -1 +0,0 @@
|
|||||||
=render :partial => "form"
|
|
@ -1,3 +1,6 @@
|
|||||||
.portlet.link_content
|
.portlet.link_content
|
||||||
|
- if input.cible
|
||||||
=link_to input.name.to_s, input.url.to_s, :class => "external_link", :target => ("_blank" if input.popup).to_s
|
-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
|
Loading…
x
Reference in New Issue
Block a user