clean newsletter and sheets code
This commit is contained in:
parent
e6a521b57f
commit
caabbae554
@ -1,6 +1,6 @@
|
|||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
|
|
||||||
class NewslettersController < ApplicationController
|
class Admin::NewslettersController < ApplicationController
|
||||||
layout "admin"
|
layout "admin"
|
||||||
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
|||||||
module Forum::ForumUserHelper
|
|
||||||
end
|
|
@ -1,3 +0,0 @@
|
|||||||
# -*- encoding : utf-8 -*-
|
|
||||||
module SurveysHelper
|
|
||||||
end
|
|
@ -1,3 +0,0 @@
|
|||||||
# -*- encoding : utf-8 -*-
|
|
||||||
module TinyUrlsHelper
|
|
||||||
end
|
|
@ -1,4 +1,4 @@
|
|||||||
=form_for @newsletter do |f|
|
=form_for [:admin, @newsletter] do |f|
|
||||||
=f.submit "sauvegarder"
|
=f.submit "sauvegarder"
|
||||||
%p
|
%p
|
||||||
Sujet :
|
Sujet :
|
11
app/views/admin/newsletters/_sheets_selecteds.html.haml
Normal file
11
app/views/admin/newsletters/_sheets_selecteds.html.haml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
-if @sheets
|
||||||
|
=form_tag send_newsletter_admin_newsletter_path(params[:id]) do
|
||||||
|
%table#sheets_checkboxs.table.table-striped
|
||||||
|
-@sheets.sort{|u,v| ((u.person.surname if u.person) || u.corporate).to_s <=>(( v.person.surname if v.person )|| v.corporate).to_s}.each do |sheet|
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
=check_box_tag "confirmed_sheets[]", sheet.id,true, :id => "confirmed_sheets_"+sheet.id.to_s
|
||||||
|
%label{:for => "confirmed_sheets_"+sheet.id.to_s, :style => "display:inline;"}=(sheet.person.name if sheet.person and (!sheet.corporate or sheet.corporate == "")) || sheet.corporate
|
||||||
|
|
||||||
|
|
||||||
|
=submit_tag "Envoyer la newsletter à toutes les adresses de ces fiches", :class => "btn btn-danger"
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
.right
|
.right
|
||||||
=link_to i(:plus, :icon => false)+" Créer une newsletter", new_newsletter_path, :class => "btn btn-primary"
|
=link_to i(:plus, :icon => false)+" Créer une newsletter", new_admin_newsletter_path, :class => "btn btn-primary"
|
||||||
|
|
||||||
%h1 Newsletters
|
%h1 Newsletters
|
||||||
|
|
||||||
@ -26,16 +26,16 @@
|
|||||||
|
|
||||||
%td{:style => "text-align:right;"}
|
%td{:style => "text-align:right;"}
|
||||||
- if has_permission?('newsletter.send')
|
- if has_permission?('newsletter.send')
|
||||||
=form_tag send_test_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 => ""
|
||||||
= submit_tag "Envoyer un email de test", :class => "btn"
|
= submit_tag "Envoyer un email de test", :class => "btn"
|
||||||
|
|
||||||
%td{:style => "width:150px;text-align:right;"}
|
%td{:style => "width:150px;text-align:right;"}
|
||||||
= link_to i(:trash), u, :method => :delete, :confirm => 'Voulez-vous vraiment supprimer cette newsletter ?'
|
= link_to i(:trash), [:admin, u], :method => :delete, :confirm => 'Voulez-vous vraiment supprimer cette newsletter ?'
|
||||||
= link_to i(:"envelope-alt"), select_recipients_newsletter_path(u)
|
= link_to i(:"envelope-alt"), select_recipients_admin_newsletter_path(u)
|
||||||
= link_to i(:pencil), edit_newsletter_path(u)
|
= link_to i(:pencil), edit_admin_newsletter_path(u)
|
||||||
= link_to i(:"eye-open"), newsletter_path(u), :target => "_blank"
|
= link_to i(:"eye-open"), admin_newsletter_path(u), :target => "_blank"
|
||||||
|
|
||||||
|
|
||||||
|
|
64
app/views/admin/newsletters/select_recipients.html.haml
Normal file
64
app/views/admin/newsletters/select_recipients.html.haml
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
|
||||||
|
|
||||||
|
%h1 Envoyer une newsletter
|
||||||
|
%p
|
||||||
|
= link_to i(:"eye-open"), admin_newsletter_path(@newsletter), :target => "_blank"
|
||||||
|
|
||||||
|
Newsletter sélectionnée :
|
||||||
|
=@newsletter.title
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%ul.nav.nav-tabs#myTab
|
||||||
|
%li.active
|
||||||
|
%a{:href => "#send_sheets"}
|
||||||
|
Envoyer à une selection d'adhérents
|
||||||
|
%li
|
||||||
|
%a{:href => "#groups"}
|
||||||
|
Envoyer à des groupes d'inscrits
|
||||||
|
.tab-content
|
||||||
|
.tab-pane.active#send_sheets
|
||||||
|
|
||||||
|
%h3 Sélectionner des fiches :
|
||||||
|
|
||||||
|
|
||||||
|
=render :partial => "admin/sheets/sheets_search", :locals => {:url => ""}
|
||||||
|
|
||||||
|
|
||||||
|
%h3 Fiches sélectionnées
|
||||||
|
%a{:href => "#", :onclick => "$('#sheets_selecteds input:checkbox').attr('checked', true);return false"} Tout sélectionner.
|
||||||
|
%a{:href => "#", :onclick => "$('#sheets_selecteds input:checkbox').attr('checked', false);return false"} Tout désélectionner
|
||||||
|
#sheets_selecteds
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.tab-pane#groups
|
||||||
|
=form_tag send_newsletter_admin_newsletter_path(:id => params[:id]) do
|
||||||
|
|
||||||
|
%table.table.table-striped
|
||||||
|
-Newsgroup.all.each do |ng|
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
=check_box_tag "confirmed_groups[]", ng.id,false, :id => "confirmed_groups_"+ng.id.to_s
|
||||||
|
%label{:for => "confirmed_groups_"+ng.id.to_s, :style => "display:inline;"}=ng.name
|
||||||
|
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
=submit_tag "Envoyer la newsletter à toutes les personnes de ce groupe", :class => "btn btn-danger"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$('#myTab a').click(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$(this).tab('show');
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
%br
|
@ -44,7 +44,7 @@
|
|||||||
%b.caret
|
%b.caret
|
||||||
%ul.dropdown-menu
|
%ul.dropdown-menu
|
||||||
%li=link_to "liste des adhérents", admin_sheets_path
|
%li=link_to "liste des adhérents", admin_sheets_path
|
||||||
%li=link_to "gestion newsletters", newsletters_path
|
%li=link_to "gestion newsletters", admin_newsletters_path
|
||||||
%li.divider
|
%li.divider
|
||||||
%li=link_to "Sondages", admin_survey_types_path
|
%li=link_to "Sondages", admin_survey_types_path
|
||||||
%li=link_to "Petitions", admin_petitions_path
|
%li=link_to "Petitions", admin_petitions_path
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
-if @sheets
|
|
||||||
=form_tag send_newsletter_newsletter_path(params[:id]) do
|
|
||||||
#sheets_checkboxs
|
|
||||||
-@sheets.sort{|u,v| ((u.person.surname if u.person) || u.corporate).to_s <=>(( v.person.surname if v.person )|| v.corporate).to_s}.each do |sheet|
|
|
||||||
=check_box_tag "confirmed_sheets[]", sheet.id,true, :id => "confirmed_sheets_"+sheet.id.to_s
|
|
||||||
%label{:for => "confirmed_sheets_"+sheet.id.to_s}=(sheet.person.name if sheet.person and (!sheet.corporate or sheet.corporate == "")) || sheet.corporate
|
|
||||||
%br
|
|
||||||
|
|
||||||
=submit_tag "Envoyer la newsletter à toutes les adresses de ces fiches"
|
|
@ -1,29 +0,0 @@
|
|||||||
%h2
|
|
||||||
Newsletter sélectionnée :
|
|
||||||
=@newsletter.title
|
|
||||||
|
|
||||||
%h2 Envoyer la newsletter en sélectionnant des fiches :
|
|
||||||
%h3 Sélectionner des fiches :
|
|
||||||
|
|
||||||
|
|
||||||
=render :partial => "sheets/sheets_search", :locals => {:url => ""}
|
|
||||||
|
|
||||||
|
|
||||||
%h3 Fiches sélectionnées
|
|
||||||
%a{:href => "#", :onclick => "$('#sheets_selecteds input:checkbox').attr('checked', true);return false"} Tout sélectionner.
|
|
||||||
%a{:href => "#", :onclick => "$('#sheets_selecteds input:checkbox').attr('checked', false);return false"} Tout désélectionner
|
|
||||||
#sheets_selecteds
|
|
||||||
|
|
||||||
|
|
||||||
%h2 Envoyer la newsletter directement à un ou plusieurs groupes d'inscrit :
|
|
||||||
=form_tag :controller => "newsletters", :action => "send_newsletter", :id => params[:id] do
|
|
||||||
-Newsgroup.all.each do |ng|
|
|
||||||
=check_box_tag "confirmed_groups[]", ng.id,false, :id => "confirmed_sheets_"+ng.id.to_s
|
|
||||||
%label{:for => "confirmed_groups_"+ng.id.to_s}=ng.name
|
|
||||||
%br
|
|
||||||
%br
|
|
||||||
%br
|
|
||||||
=submit_tag "Envoyer la newsletter à toutes les personnes de ce groupe"
|
|
||||||
%br
|
|
||||||
%br
|
|
||||||
%br
|
|
@ -1 +0,0 @@
|
|||||||
La newsletter a bien été envoyée à l'email de test
|
|
@ -39,6 +39,16 @@ Survey::Application.routes.draw do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resources :newsletters do
|
||||||
|
member do
|
||||||
|
get "select_recipients"
|
||||||
|
put "select_recipients"
|
||||||
|
post "send_test"
|
||||||
|
post "send_newsletter"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -65,23 +75,13 @@ Survey::Application.routes.draw do
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
resources :newsletters do
|
|
||||||
member do
|
|
||||||
get "select_recipients"
|
|
||||||
put "select_recipients"
|
|
||||||
post "send_test"
|
|
||||||
post "send_newsletter"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
match 'u/:id' => 'tiny_urls#show', :as => :tiny_url
|
match 'u/:id' => 'tiny_urls#show', :as => :tiny_url
|
||||||
|
|
||||||
resources :tiny_urls
|
|
||||||
|
|
||||||
get "surveys/index"
|
|
||||||
|
|
||||||
match 'sondages/:slug/merci-de-votre-participation.:f' => 'survey_sets#thank', :as => :thank_survey_set, :f => "html"
|
match 'sondages/:slug/merci-de-votre-participation.:f' => 'survey_sets#thank', :as => :thank_survey_set, :f => "html"
|
||||||
match 'sondages/:slug.:f' => 'survey_sets#new', :as => :new_survey_set, :f => "html"
|
match 'sondages/:slug.:f' => 'survey_sets#new', :as => :new_survey_set, :f => "html"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user