From 137e9b2a78d21d810541d3900fcb3491a3c4eefb Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Thu, 22 Mar 2018 16:32:14 +0100 Subject: [PATCH] saut de page articles --- .../admin/plume_articles_controller.rb | 2 +- .../portlet/dynamic_contents_controller.rb | 5 +++++ app/models/dynamic_content.rb | 2 +- .../plume_articles/_plume_article.html.haml | 7 +++++++ app/views/layouts/plume.html.haml | 1 + app/views/layouts/public.html.haml | 1 + .../portlets/dynamic_contents/_saut.html.haml | 18 ++++++++++++++++++ app/views/public/plumes/print.html.haml | 4 +++- 8 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 app/views/portlets/dynamic_contents/_saut.html.haml diff --git a/app/controllers/admin/plume_articles_controller.rb b/app/controllers/admin/plume_articles_controller.rb index e23a073..72ed2a3 100644 --- a/app/controllers/admin/plume_articles_controller.rb +++ b/app/controllers/admin/plume_articles_controller.rb @@ -30,7 +30,7 @@ class Admin::PlumeArticlesController < ApplicationController def edit - + @admin = true @plume_article = PlumeArticle.find(params[:id]) diff --git a/app/controllers/portlet/dynamic_contents_controller.rb b/app/controllers/portlet/dynamic_contents_controller.rb index 421a5d1..329702c 100644 --- a/app/controllers/portlet/dynamic_contents_controller.rb +++ b/app/controllers/portlet/dynamic_contents_controller.rb @@ -3,6 +3,7 @@ class Portlet::DynamicContentsController < ApplicationController layout "admin" def new + @admin = true @dynamic_content = DynamicContent.new respond_to do |format| @@ -16,6 +17,7 @@ class Portlet::DynamicContentsController < ApplicationController end def create + @admin = true @dynamic_content = DynamicContent.new(params.require(:dynamic_content).permit!) respond_to do |format| @@ -46,6 +48,7 @@ class Portlet::DynamicContentsController < ApplicationController end def edit + @admin = true @dynamic_content = DynamicContent.find(params[:id]) @portlet = Portlet.find(params[:portlet_id]) respond_to do |format| @@ -68,6 +71,7 @@ class Portlet::DynamicContentsController < ApplicationController end def update + @admin = true @dynamic_content = DynamicContent.find(params[:id]) @portlet = @dynamic_content.portlet @@ -93,6 +97,7 @@ class Portlet::DynamicContentsController < ApplicationController end def destroy + @admin = true @portlet = Portlet.find(params[:portlet_id]) @dynamic_content = DynamicContent.find(params[:id]) @dynamic_content.destroy diff --git a/app/models/dynamic_content.rb b/app/models/dynamic_content.rb index 1af6aa1..54a9169 100644 --- a/app/models/dynamic_content.rb +++ b/app/models/dynamic_content.rb @@ -4,7 +4,7 @@ class DynamicContent < ActiveRecord::Base belongs_to :item - NAMES = {} + NAMES = {"saut" => "Saut de page"} def self.picto "cog" diff --git a/app/views/admin/plume_articles/_plume_article.html.haml b/app/views/admin/plume_articles/_plume_article.html.haml index fef0ffb..8d8a02d 100644 --- a/app/views/admin/plume_articles/_plume_article.html.haml +++ b/app/views/admin/plume_articles/_plume_article.html.haml @@ -1,12 +1,19 @@ %tr#plume_article_row.plume_article_row{:id => plume_article.id} %td=plume_article.title + %td + -if plume_article.article_type == "demi" + Demi article + -else + Article pleine page + %td =link_to "voir", public_plume_article_path(plume_article), :target => "plume_article_#{plume_article.id}" + %td{:style => "width:140px"} diff --git a/app/views/layouts/plume.html.haml b/app/views/layouts/plume.html.haml index 6fd436c..8b60652 100644 --- a/app/views/layouts/plume.html.haml +++ b/app/views/layouts/plume.html.haml @@ -1,3 +1,4 @@ +-@public = true !!! %html{:lang => "fr", "xml:lang" => "fr", :xmlns => "http://www.w3.org/1999/xhtml"} diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml index b603964..9fd8ef8 100644 --- a/app/views/layouts/public.html.haml +++ b/app/views/layouts/public.html.haml @@ -1,3 +1,4 @@ +-@public = true !!! %html{:lang => "fr", "xml:lang" => "fr", :xmlns => "http://www.w3.org/1999/xhtml"} diff --git a/app/views/portlets/dynamic_contents/_saut.html.haml b/app/views/portlets/dynamic_contents/_saut.html.haml new file mode 100644 index 0000000..23b8ec1 --- /dev/null +++ b/app/views/portlets/dynamic_contents/_saut.html.haml @@ -0,0 +1,18 @@ +-if @plume_article and @print + =raw "
" + .page_header{:style => ""} + .right + =image_tag "http://lepicvert.org/plume-header.png" + %span + La Plume + ="N°#{@plume_article.plume.number}" + .left= @plume_article.plume_cat.title + .clear + + =raw "
" +-elsif @admin + %hr + Saut de page + %hr + + \ No newline at end of file diff --git a/app/views/public/plumes/print.html.haml b/app/views/public/plumes/print.html.haml index f5200e2..8a1a00f 100644 --- a/app/views/public/plumes/print.html.haml +++ b/app/views/public/plumes/print.html.haml @@ -1,3 +1,5 @@ +-@print = true + %html %head %meta{:charset => "utf-8"}/ @@ -39,7 +41,7 @@ -@plume.plume_cats.order(:position).each do |plume_cat| -if plume_cat.title != "Brèves" -plume_cat.plume_articles.each do |plume_article| - + -@plume_article = plume_article -if plume_article.article_type == "page" or (plume_article.article_type == "demi" and i ==0) and plume_article.plume_cat .page_header .right