nouvelle fonction newsletter

This commit is contained in:
Nicolas Bally 2015-01-20 22:41:37 +01:00
parent 15cbda8ffe
commit 58c4cc3f4f
10 changed files with 140 additions and 11 deletions

View File

@ -832,3 +832,16 @@ height:auto !important;
} }
.newsletter_block_edit{
max-width:770px;
margin:10px auto;
padding:10px;
box-shadow:0 0 10px rgba(0,0,0,0.1);
border:1px solid #C8C8CA;
}

View File

@ -85,7 +85,7 @@ end
def send_test def send_test
@errors = []
@newsletter = Newsletter.find(params[:id]) @newsletter = Newsletter.find(params[:id])
#NewsletterMails.newsletter(@newsletter, params[:email]).deliver #NewsletterMails.newsletter(@newsletter, params[:email]).deliver
send_helper @newsletter, params[:email] send_helper @newsletter, params[:email]

View File

@ -0,0 +1,14 @@
# -*- encoding : utf-8 -*-
class DownloadDataFilesController < ApplicationController
def index
end
def show
@data_file = DataFile.find_by_token(params[:id])
send_file @data_file.file.path #, :disposition => "inline"
end
end

View File

@ -34,7 +34,7 @@ class MenuItem < ActiveRecord::Base
end end
def cible_url def cible_url
menu_item_path(:url => self.permalink) "http://"+HOSTNAME+menu_item_path(:url => self.permalink)
end end
before_validation do before_validation do

View File

@ -3,6 +3,23 @@
class Newsletter < ActiveRecord::Base class Newsletter < ActiveRecord::Base
validates_presence_of :title validates_presence_of :title
has_one :block, :as => :blockable
after_create :after_creation
def after_creation
@block = Block.new(:block_name => "Contenu")
@block.blockable = self
@block.save
end
def alloweds_types
self.block.allow_types :TitleContent, :TextContent, :ImageContent, :LinkContent, :GalleryContent, :HtmlContent, :DownloadContent
end
#attr_accessible :title, :content, :email_from #attr_accessible :title, :content, :email_from
#EMAIL_FROMS=["Le Pic Vert <contact@lepicvert.asso.fr>", "Le Pic Vert <s.montchalin@lepicvert.asso.fr>"] #EMAIL_FROMS=["Le Pic Vert <contact@lepicvert.asso.fr>", "Le Pic Vert <s.montchalin@lepicvert.asso.fr>"]

View File

@ -1,4 +1,85 @@
%h1 Modifier une newsletter -if @newsletter.block
=render :partial => "form" #toolbar-text
%div{:style => "margin-right:330px;margin-top:45px;"}
.newsletter_block_edit
#menu_item_block_edit
=render :partial => "admin/blocks/block", :locals => {:block => @newsletter.block, :sortable => true}
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
%br
#menu_item_inspector_container
#menu_item_informations
%h4
Infos sur l'newsletter
.panel#collapseOne{:style => "display:none;"}
=render :partial => "form"
%h4 éléments
.panel#collapse2
.block_portlets_sortable#content_types
-@newsletter.alloweds_types.each do |slug, name|
.content_type{:id => slug, :"data-type" => slug}
=#i slug.to_s.constantize.picto
=image_tag("admin/content_type/type_"+slug.to_s+".png", :alt => name, :title => name, :class => "handle")
#collapse3{:style => "display:none;"}
%h4 Modifier l'élément
.panel
#element_form
%div#element_form_action
%a.move.btn.btn-default.portlet_handle{:href => "#", :data => {:portlet_id => nil}}
%span.move_message
=ic :arrows
&nbsp;
déplacer
%span.cancel_message
=ic :ban
&nbsp;
annuler
=link_to ic(:"trash-o"), "#", :method => :delete, :data => { :confirm => "Etes-vous sûr ?"}, :remote => true, :class => "btn btn-danger trash"
%button.save.btn.btn-primary
=ic(:"floppy-o")
&nbsp;
Sauvegarder
-else
=raw @newsletter.content

View File

@ -25,7 +25,7 @@
%td{:style => "text-align:right;"} %td{:style => "text-align:right;"}
- if has_permission?('newsletter.send') - if has_permission?('newsletter.send') and u.block
=form_tag send_test_admin_newsletter_path(u), :style => "display:inline;" do =form_tag send_test_admin_newsletter_path(u), :style => "display:inline;" do
.input-append{:style => "display:inline-block;margin:2px;"} .input-append{:style => "display:inline-block;margin:2px;"}
= text_field_tag :email,"", :class => "" = text_field_tag :email,"", :class => ""
@ -33,6 +33,7 @@
%td{:style => "width:180px;text-align:right;"} %td{:style => "width:180px;text-align:right;"}
= link_to i(:"trash-o"), [:admin, u], :method => :delete, :confirm => 'Voulez-vous vraiment supprimer cette newsletter ?' = link_to i(:"trash-o"), [:admin, u], :method => :delete, :confirm => 'Voulez-vous vraiment supprimer cette newsletter ?'
-if u.block
= link_to i(:"envelope-o"), select_recipients_admin_newsletter_path(u) = link_to i(:"envelope-o"), select_recipients_admin_newsletter_path(u)
= link_to i(:pencil), edit_admin_newsletter_path(u) = link_to i(:pencil), edit_admin_newsletter_path(u)
= link_to i(:"eye"), admin_newsletter_path(u), :target => "_blank" = link_to i(:"eye"), admin_newsletter_path(u), :target => "_blank"

View File

@ -4,6 +4,9 @@
-else -else
- @lien_inscription_forum = link_to(new_forum_forum_user_url(:email => @email),new_forum_forum_user_url(:email => @email)) - @lien_inscription_forum = link_to(new_forum_forum_user_url(:email => @email),new_forum_forum_user_url(:email => @email))
=#raw @content.gsub(/\[lien_inscription_forum\]/, @lien_inscription_forum)
-@content = render(:partial => "public/blocks/block", :object => @newsletter.block)
=raw @content.gsub(/\[lien_inscription_forum\]/, @lien_inscription_forum) =raw @content.gsub(/\[lien_inscription_forum\]/, @lien_inscription_forum)
-if @newsletter.email_from and @newsletter.email_from != "" and @newsletter.email_from != "contact@lepicvert.asso.fr" -if @newsletter.email_from and @newsletter.email_from != "" and @newsletter.email_from != "contact@lepicvert.asso.fr"

View File

@ -23,7 +23,7 @@
-else -else
-url ="" -url =""
-url = "http://"+request.host_with_port+url -url = "http://"+HOSTNAME+url
-style = "" -style = ""
-style = "text-align:center;" if input.alignement == "center" -style = "text-align:center;" if input.alignement == "center"

View File

@ -151,7 +151,7 @@ Survey::Application.routes.draw do
get "forum_user/index" get "forum_user/index"
resources :download_data_files
namespace :forum do namespace :forum do
root :to => "forum_topics#index", :id => 1 root :to => "forum_topics#index", :id => 1
resources :forum_topics do resources :forum_topics do