diff --git a/app/assets/javascripts/manager.js b/app/assets/javascripts/manager.js index 1f0d182..30d28de 100644 --- a/app/assets/javascripts/manager.js +++ b/app/assets/javascripts/manager.js @@ -204,4 +204,15 @@ function select_video_from_manager(input_id){ } +function select_realisation_images_from_manager(realisation_id){ + + manager_prompt("/admin/image_files/?manager=true&multiple=true",function(m_return){ + + $.ajax({url:"/admin/realisation_images/", type: "POST", data : { image_file_ids : m_return, realisation_id : realisation_id }}); + + + }); + +} + diff --git a/app/assets/stylesheets/popover.scss b/app/assets/stylesheets/popover.scss index e7915fc..ead4da0 100644 --- a/app/assets/stylesheets/popover.scss +++ b/app/assets/stylesheets/popover.scss @@ -64,11 +64,11 @@ .rea-gal{ padding-left:0px; - margin-right:-5px; - margin-bottom:-5px; + margin-right:-25px; + margin-bottom:-25px; img{ - padding-right:5px; - padding-bottom:5px; + padding-right:25px; + padding-bottom:25px; width:200px; float:left; box-sizing: border-box; diff --git a/app/assets/stylesheets/public.scss b/app/assets/stylesheets/public.scss index 6efd8b3..68088ac 100644 --- a/app/assets/stylesheets/public.scss +++ b/app/assets/stylesheets/public.scss @@ -171,4 +171,42 @@ h1,h2,h3{ } } +.tag-gal{ + .element{ + float:left; + width:16%; + margin:2%; + text-align:center; + } + img{ + width:100%; + border-radius:50%; + + } + p{ + margin:0; + } + +} +.realisation_list{ + padding-left:0px; + margin-right:-25px; + margin-bottom:-25px; +.realisation{ + padding-right:25px; + padding-bottom:25px; + width:33%; + float:left; + box-sizing: border-box; + + .img{ + height:250px; + overflow:hidden; + width:100%; + background: no-repeat center center; + background-size:100%; + background-size:cover; + } + color:#8d8d8d; +}} \ No newline at end of file diff --git a/app/controllers/admin/realisation_images_controller.rb b/app/controllers/admin/realisation_images_controller.rb new file mode 100644 index 0000000..6c9f059 --- /dev/null +++ b/app/controllers/admin/realisation_images_controller.rb @@ -0,0 +1,82 @@ +# -*- encoding : utf-8 -*- +class Admin::RealisationImagesController < ApplicationController + layout "admin" + + + def reorder + i = 0 + params[:order].each do |realisation_image_id| + i += 1 + realisation_image = RealisationImage.find(realisation_image_id) + realisation_image.position = i + realisation_image.save + end + + end + + def create + + @realisation = Realisation.find(params[:realisation_id]) + @realisation_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) + realisation_image = RealisationImage.create(:image_file_id => image_file.id, :title => image_file.name, :description => image_file.description, :realisation_id => @realisation.id ) + + @realisation_images << realisation_image + end + end + + + + respond_to do |format| + + format.js + + end + end + + + + def edit + @realisation_image = RealisationImage.find(params[:id]) + + if request.xhr? + render :layout => false + end + + end + + + + + + def show + + + end + + def update + @realisation_image = RealisationImage.find(params[:id]) + respond_to do |format| + if @realisation_image.update_attributes(params.require(:realisation_image).permit!) + + format.js + else + format.html { render :action => "edit", :layout => false} + format.js { render :action => "edit" } + end + + end + end + + def destroy + + @realisation_image = RealisationImage.find(params[:id]) + @realisation_image.destroy + + + end + + +end diff --git a/app/controllers/admin/realisations_controller.rb b/app/controllers/admin/realisations_controller.rb new file mode 100644 index 0000000..577ae7b --- /dev/null +++ b/app/controllers/admin/realisations_controller.rb @@ -0,0 +1,136 @@ +# -*- encoding : utf-8 -*- + +class Admin::RealisationsController < ApplicationController + before_filter :auth_admin + + layout "admin" + + + before_filter :find_realisations + + + + + def index + + end + + + + + + def cible + @realisations = Realisation.all + + render :layout => false + end + + + def new + @realisation = Realisation.new() + + + end + + def edit + @realisation = Realisation.find(params[:id]) + end + + def show + @realisation = Realisation.find(params[:id]) + end + + + def create + @realisation = Realisation.new(params.require(:realisation).permit!) + + + if @realisation.save + self.find_realisations + flash[:notice] = "La catégorie à été ajouté avec succès." + + + else + render :action => "new" + + end + + end + + + def update + @realisation = Realisation.find(params[:id]) + + + + + + + @reorder = true if params[:reorder] + + + + + + + + respond_to do |format| + if @realisation.update_attributes(params.require(:realisation).permit!) + + #Realisation.all.each do |mi| + # mi.set_permalink + + #end + + flash[:notice] = "Le menu à été modifié avec succès." + format.html { redirect_to(admin_realisations_path(:parent_id => @realisation.parent_id)) } + if @reorder + format.js { + + render :action => "update" } + else + format.js { + @realisation = Realisation.find(@realisation.id) + render :action => "update_row" } + end + else + + flash[:error] = "Cet élément de menu n'a pas pu être déplacé. Vérifiez que son lien permanent n'éxiste pas déjà dans l'élément cible." + if @reorder + format.js { render :action => "update_reorder_failled" } + else + format.html { render :action => "edit" } + format.js { render :action => "edit" } + end + + + end + end + + + + + + end + + + def destroy + @realisation = Realisation.find(params[:id]) + + @realisation.destroy + + + flash[:notice] = "Le produit à bien été supprimé." + end + + + protected + + def find_realisations + @realisations = Realisation.all + + + + end + +end diff --git a/app/controllers/public/realisations_controller.rb b/app/controllers/public/realisations_controller.rb new file mode 100755 index 0000000..11df736 --- /dev/null +++ b/app/controllers/public/realisations_controller.rb @@ -0,0 +1,11 @@ +# -*- encoding : utf-8 -*- + +class Public::RealisationsController < ApplicationController + layout "public" + + def show + @realisation = Realisation.find_by_slug(params[:id]) + end + + +end diff --git a/app/models/dynamic_content.rb b/app/models/dynamic_content.rb index 9bd6d1e..3199e5d 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 = {"historique_monde" => "Historique monde"} + NAMES = {"realisations" => "Liste des réalisations"} def self.picto "cog" diff --git a/app/models/gallery_content.rb b/app/models/gallery_content.rb index 7825f54..4e1521b 100644 --- a/app/models/gallery_content.rb +++ b/app/models/gallery_content.rb @@ -4,7 +4,7 @@ class GalleryContent < ActiveRecord::Base has_one :portlet, :as => :content, :dependent => :destroy - STYLES = [["Petites miniatures",1], ["Diaporama",2], ["Petits carrés",3], ["Réalisations",4]] + STYLES = [["Petits carrés",3],["Petites miniatures",1], ["\"Tags\"",4]] def dup @new = GalleryContent.new(self.attributes) diff --git a/app/models/realisation.rb b/app/models/realisation.rb new file mode 100644 index 0000000..a4b8c18 --- /dev/null +++ b/app/models/realisation.rb @@ -0,0 +1,12 @@ +class Realisation < ActiveRecord::Base + + has_many :realisation_images, :dependent => :destroy + + belongs_to :default_image, :class_name => "RealisationImage" + + before_validation do + self.slug = self.title.to_slug + end + + +end diff --git a/app/models/realisation_image.rb b/app/models/realisation_image.rb new file mode 100644 index 0000000..4773baa --- /dev/null +++ b/app/models/realisation_image.rb @@ -0,0 +1,26 @@ +class RealisationImage < ActiveRecord::Base + belongs_to :image_file + + belongs_to :realisation + + + + after_save do + realisation_default_image + end + + after_destroy do + realisation_default_image + end + + def realisation_default_image + if !self.realisation.default_image + self.realisation.default_image = self.realisation.realisation_images.order("position").first + self.realisation.save + else + self.realisation.default_image = nil + self.realisation.save + end + + end +end diff --git a/app/views/admin/realisation_images/_form.html.haml b/app/views/admin/realisation_images/_form.html.haml new file mode 100644 index 0000000..f2e3baa --- /dev/null +++ b/app/views/admin/realisation_images/_form.html.haml @@ -0,0 +1,19 @@ += semantic_form_for [:portlet, @realisation_image], :remote => true do |form| + .content + + %h3 Modifier les infos + + = 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"} + + + + + .actions + =form.submit "Sauvegarder", :class => "btn btn-primary" + + + + diff --git a/app/views/admin/realisation_images/_realisation_image.html.haml b/app/views/admin/realisation_images/_realisation_image.html.haml new file mode 100644 index 0000000..4251cf3 --- /dev/null +++ b/app/views/admin/realisation_images/_realisation_image.html.haml @@ -0,0 +1,9 @@ +-if realisation_image.image_file + .realisation_image.image_square#realisation_image{:id => realisation_image.id, :data => { :title => realisation_image.title , :description => realisation_image.description, :id => realisation_image.id} } + .img{:style => "background-image : url('#{realisation_image.image_file.file.large.medium.small.thumb.url}');"} + + .actions + =link_to i(:"trash-o"), [:admin, realisation_image], :data => {:confirm => 'Voulez-vous vraiment supprimer cette image ?'}, :method => :delete, :remote => true + =#link_to i(:pencil), edit_admin_realisation_image_path(realisation_image), :remote => true + + \ No newline at end of file diff --git a/app/views/admin/realisation_images/create.js.erb b/app/views/admin/realisation_images/create.js.erb new file mode 100644 index 0000000..3fe1ef3 --- /dev/null +++ b/app/views/admin/realisation_images/create.js.erb @@ -0,0 +1 @@ +$('#realisation_images').prepend("<%= escape_javascript(render(@realisation_images)) %>"); \ No newline at end of file diff --git a/app/views/admin/realisation_images/destroy.js.erb b/app/views/admin/realisation_images/destroy.js.erb new file mode 100644 index 0000000..5ba5541 --- /dev/null +++ b/app/views/admin/realisation_images/destroy.js.erb @@ -0,0 +1,4 @@ + +$("#realisation_image_<%= @realisation_image.id.to_s %>").fadeOut(500).delay(6000).remove(); + +<%= flash_js %> \ No newline at end of file diff --git a/app/views/admin/realisation_images/edit.js.erb b/app/views/admin/realisation_images/edit.js.erb new file mode 100644 index 0000000..3d94bc2 --- /dev/null +++ b/app/views/admin/realisation_images/edit.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>"); \ No newline at end of file diff --git a/app/views/admin/realisation_images/reorder.js.erb b/app/views/admin/realisation_images/reorder.js.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/admin/realisation_images/update.js.erb b/app/views/admin/realisation_images/update.js.erb new file mode 100644 index 0000000..be5c9c2 --- /dev/null +++ b/app/views/admin/realisation_images/update.js.erb @@ -0,0 +1,5 @@ +close_pane_hover(); +$('#realisation_image_<%= @realisation_image.id %>').effect("highlight", 1000); + + +<%= flash_js %> \ No newline at end of file diff --git a/app/views/admin/realisations/_form.html.haml b/app/views/admin/realisations/_form.html.haml new file mode 100644 index 0000000..f3bff26 --- /dev/null +++ b/app/views/admin/realisations/_form.html.haml @@ -0,0 +1,11 @@ += semantic_form_for [:admin,@realisation], :remote => true do |form| + + .content + = form.input :title, :as => :string, :label => "Nom :" + = form.input :description, :label => "Descirption :" + + + + .actions + = form.submit "Sauvegarder", :class => "btn btn-primary" + \ No newline at end of file diff --git a/app/views/admin/realisations/_index_block.html.haml b/app/views/admin/realisations/_index_block.html.haml new file mode 100644 index 0000000..bbdfe55 --- /dev/null +++ b/app/views/admin/realisations/_index_block.html.haml @@ -0,0 +1,9 @@ +%table.table#realisations + %tr + %th + %th + Catégorie + %th + Nom du réalisation + %th + =render @realisations diff --git a/app/views/admin/realisations/_realisation.html.haml b/app/views/admin/realisations/_realisation.html.haml new file mode 100644 index 0000000..6233909 --- /dev/null +++ b/app/views/admin/realisations/_realisation.html.haml @@ -0,0 +1,16 @@ +%tr#realisation_row.realisation_row{:id => realisation.id} + %td{:style => "width:200px;"} + =image_tag realisation.default_image.image_file.file.large.medium.small.thumb.url if realisation.default_image + %td + =realisation.title + + %td.actions + + = link_to i(:"trash-o"), [:admin, realisation], :data =>{:remote => true, :confirm => 'Voulez-vous vraiment supprimer cet élément de menu ?'}, :method => :delete #, if current_admin.super_admin? || !realisation.super_admin + = link_to i(:eye), [:admin, realisation] + + = link_to i(:pencil), edit_admin_realisation_path(realisation), :data => {:remote => true} + + + + diff --git a/app/views/admin/realisations/cible.html.haml b/app/views/admin/realisations/cible.html.haml new file mode 100644 index 0000000..a034103 --- /dev/null +++ b/app/views/admin/realisations/cible.html.haml @@ -0,0 +1,6 @@ + +-Event.all.each do |event| + + %h4 + =event.title + = link_to i(:check_alt, :gray_light,12), "#",:onclick => "manager_send_cible("+event.id.to_s+", 'Folder', '#{escape_javascript(event.cible_name)}');return false;" if params[:manager] diff --git a/app/views/admin/realisations/create.js.erb b/app/views/admin/realisations/create.js.erb new file mode 100644 index 0000000..e8ba870 --- /dev/null +++ b/app/views/admin/realisations/create.js.erb @@ -0,0 +1,4 @@ +$('#realisations').html("<%= escape_javascript(render(:partial => "index_block")) %>"); + +close_pane_hover(); + diff --git a/app/views/admin/realisations/destroy.js.erb b/app/views/admin/realisations/destroy.js.erb new file mode 100644 index 0000000..896dfee --- /dev/null +++ b/app/views/admin/realisations/destroy.js.erb @@ -0,0 +1,2 @@ +$('#realisation_row_<%= @realisation.id %>').remove(); +<%= flash_js %> diff --git a/app/views/admin/realisations/edit.js.erb b/app/views/admin/realisations/edit.js.erb new file mode 100644 index 0000000..06a7cbc --- /dev/null +++ b/app/views/admin/realisations/edit.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",550,600); \ No newline at end of file diff --git a/app/views/admin/realisations/index.html.haml b/app/views/admin/realisations/index.html.haml new file mode 100644 index 0000000..27704b7 --- /dev/null +++ b/app/views/admin/realisations/index.html.haml @@ -0,0 +1,6 @@ +.header + .right= link_to 'Ajouter un réalisation', new_admin_realisation_path, :class => "btn btn-success", :remote => true + %h1 Liste des réalisations + +.padding + =render :partial => "index_block" diff --git a/app/views/admin/realisations/index.js.erb b/app/views/admin/realisations/index.js.erb new file mode 100644 index 0000000..dece0b5 --- /dev/null +++ b/app/views/admin/realisations/index.js.erb @@ -0,0 +1,13 @@ + + +if($('#realisation_index').length > 0){ + $('#realisation_index').replaceWith("<%= escape_javascript(render(:partial => "index_block")) %>"); + +} +else{ + + + $('body').html("<%= escape_javascript(render(:template => 'admin/realisations/index.html.haml')) %>"); + +} + diff --git a/app/views/admin/realisations/new.js.erb b/app/views/admin/realisations/new.js.erb new file mode 100644 index 0000000..06a7cbc --- /dev/null +++ b/app/views/admin/realisations/new.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",550,600); \ No newline at end of file diff --git a/app/views/admin/realisations/show.html.haml b/app/views/admin/realisations/show.html.haml new file mode 100644 index 0000000..f7059c9 --- /dev/null +++ b/app/views/admin/realisations/show.html.haml @@ -0,0 +1,59 @@ +.header + %h1 + Réalisation + ="|" + =@realisation.title + +.padding + %p + =link_to "Ajouter des images", "#", :onclick => "select_realisation_images_from_manager('#{@realisation.id.to_s}');return false;", :class => "btn btn-primary" + %br + #realisation_images + =render :collection => @realisation.realisation_images.order("position"), :partial => "admin/realisation_images/realisation_image" + %p{:style => "clear:both;"} + + :coffeescript + + adjustment = "" + + $('#realisation_images').sortable({ + itemSelector:".realisation_image", + containerSelector :"#realisation_images", + nested:true, + placeholder:"
", + 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(".realisation_image").each -> + result.push $(this).data("id") + + $.ajax({ + url:"/admin/realisation_images/reorder.js", + type: "GET", + data: { + order : result + } + + }) + }); \ No newline at end of file diff --git a/app/views/admin/realisations/update.js.erb b/app/views/admin/realisations/update.js.erb new file mode 100644 index 0000000..05a8db3 --- /dev/null +++ b/app/views/admin/realisations/update.js.erb @@ -0,0 +1,4 @@ +$('#realisation_index').replaceWith("<%= escape_javascript(render(:partial => "index_block")) %>"); + +close_pane_hover(); +<%= flash_js %> diff --git a/app/views/admin/realisations/update_row.js.erb b/app/views/admin/realisations/update_row.js.erb new file mode 100644 index 0000000..a81044d --- /dev/null +++ b/app/views/admin/realisations/update_row.js.erb @@ -0,0 +1,2 @@ +$('#realisation_row_<%= @realisation.id %>').replaceWith("<%= escape_javascript(render(@realisation))%>"); +close_pane_hover(); \ No newline at end of file diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index 004c3b9..0b3a67b 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -63,7 +63,8 @@ %li= link_to "Images", admin_image_files_path %li= link_to "Fichiers", admin_data_files_path =#%li= link_to "Vidéos", admin_video_files_path - =#%li= link_to "Sliders", admin_home_sliders_path + %li= link_to "Sliders", admin_home_sliders_path + %li= link_to "Réalisations", admin_realisations_path() diff --git a/app/views/portlets/dynamic_contents/_historique_monde.html.haml b/app/views/portlets/dynamic_contents/_historique_monde.html.haml deleted file mode 100644 index 5e46ab9..0000000 --- a/app/views/portlets/dynamic_contents/_historique_monde.html.haml +++ /dev/null @@ -1,106 +0,0 @@ - -.timeline_container - .timeline_line - .timeline_block - .tm_date 1998 - .tm_point - .tm_content - %ul - %li - %p - One Voice/Talis se mobilise aux côtés de PETA et des associations du monde entier en faveur des chiens de Taïwan et organise une action de sensibilisation sur le parvis du musée d’Orsay. La campagne reçoit le soutien de nombreuses célébrités telles que Brad Pitt, Kim Basinger, Michelle Pfeiffer, Peter Falk, Burt Reynolds, Oliver Stone, Jacky Chan, Steven Seagal, Alec Baldwin et bien d’autres. - %p - La mobilisation internationale aboutit au vote de la première loi de protection animale du pays et des mesures importantes en faveur des chiens errants sont prises. - - - - .timeline_block - .tm_date 2002 - .tm_point - .tm_content - - %ul - %li - =image_tag "/historique/monde/2002.jpg" - %p - One Voice révèle le trafic de chiots et de chatons des pays de l’Est, vendus illégalement en France après avoir transité en Belgique où leurs papiers sont falsifiés. L’association est accompagnée pour une partie de son enquête par des journalistes de France 2, France 5 et du Figaro. De très nombreux médias relaieront l’information. - %li - %p - Création avec Wildlife SOS du sanctuaire d’Agra pour les ours en Inde (voir l’historique de notre campagne pour les ours). - %li - %p - One Voice apporte son soutien à HELP Congo, au Congo Brazzaville, où Aliette Jamart réhabilite des chimpanzés à la vie sauvage ; ainsi qu’à ABC, au Congo Kinshasa, où Claudine André a créé le sanctuaire Lola ya Bonobo pour accueillir les bonobos orphelins sauvés du trafic et de la guerre. - %li - %p - Campagne pour les animaux du zoo de Kinshasa. - - .timeline_block - .tm_date 2003 - .tm_point - .tm_content - - %ul - %li - =image_tag "/historique/monde/2003.jpg" - %p - Enquête au Vietnam dans les « fermes à bile » et sur les chiens tués pour leur viande. - - %li - %p - En Inde, un programme de reconversion des Kalandars qui nous confient les ours en leur possession est initié, et la cellule antibraconnage ForestWatch est créée avec Wildlife SOS. - - %li - %p - Une enquête exclusive de One Voice au Japon prouve pour la première fois le lien entre les massacres de Taiji et l’industrie de la captivité. (voir l’historique de notre combat pour les cétacés) - - %li - %p - One Voice enquête sur les élevages d’animaux pour leur fourrure, en Croatie. Elle sauve 33 chinchillas et obtient la fermeture de la structure qui les élevait. (voir l’historique de notre combat contre la fourrure) - %li - %p - One Voice enquête avec TF1 dans deux centres de transit belges pour le trafic de chiots et de chatons en provenance des pays de l’Est. Une deuxième enquête la conduit jusqu’en Tchéquie via l’Espagne. Elle sauvera une trentaine de chiots et chatons qui y sont nés. - - .timeline_block - .tm_date 2004 - .tm_point - .tm_content - - %ul - %li - - %p - Une enquête de One Voice révèle les conditions sordides d’élevage des chiens en Hongrie avant d’être illégalement importés en France. - - %li - =image_tag "/historique/monde/2004-2.jpg" - %p - One Voice fait à nouveau la preuve du trafic européen de chiots en remontant une filière de la France à la Slovaquie, en passant par l’Espagne, où un entrepôt permet le transit de 500 chiots par mois. Son enquête fera l’objet d’un sujet au Journal de 20 heures sur France 2. - - %li - %p - Création du Fonds d’Action Solidaire pour financer des interventions urgentes. À peine 15 jours plus tard, il permettra à nos vétérinaires de se rendre sur le terrain après le tsunami qui a ravagé l’Asie du Sud-Est. - - %li - =image_tag "/historique/monde/2004.jpg" - %p - Avec le soutien des autorités haïtiennes, One Voice supervise la libération de six dauphins et de six tortues qui avaient été capturés pour l’industrie des loisirs. - - .timeline_block - .tm_date 2005 - .tm_point - .tm_content - - %ul - %li - =image_tag "/historique/monde/2005-1.jpg" - %p - One Voice répond à l’appel d’urgence de l’association Kalaweït qui sauve et réintroduit des gibbons en Indonésie. Le partenariat permet la création du sanctuaire d’Hampapak où vivent notamment des orangs-outans sauvages. - %li - =image_tag "/historique/monde/2005-3.jpg" - %p - Grâce au FAS, One Voice permet le sauvetage, avec Wildlife SOS, de nombreux animaux après les inondations et les torrents de boue qui ont dévasté l’État du Maharashtra en Inde. Cinq lions affamés sont notamment sortis du zoo où ils se mouraient pour être emmenés dans un centre de sauvetage. - %li - =image_tag "/historique/monde/2005-2.jpg" - %p - À la suite au tsunami, notre action continue. Un refuge mis en place à Port Blair permet d’héberger et de nourrir des animaux errants qui sont stérilisés et relâchés dès que leur état le permet. Au Sri Lanka, One Voice aide Turtle Conservation Project à reconstruire le sanctuaire marin qui a été dévasté. En Thaïlande, notre équipe vient en aide aux chiens errants qui survivaient grâce aux touristes. - \ No newline at end of file diff --git a/app/views/portlets/dynamic_contents/_realisations.html.haml b/app/views/portlets/dynamic_contents/_realisations.html.haml new file mode 100644 index 0000000..db9725b --- /dev/null +++ b/app/views/portlets/dynamic_contents/_realisations.html.haml @@ -0,0 +1,7 @@ +.realisation_list + -Realisation.all.each do |realisation| + =link_to public_realisation_path(:id => realisation.slug) do + .realisation + .img{:style => "background-image :url('"+(realisation.default_image.image_file.file.large.medium.url if realisation.default_image).to_s+"');"} + + %h3=realisation.title \ No newline at end of file diff --git a/app/views/portlets/render_public/_gallerycontent.html.haml b/app/views/portlets/render_public/_gallerycontent.html.haml index 10e7d10..d51e549 100644 --- a/app/views/portlets/render_public/_gallerycontent.html.haml +++ b/app/views/portlets/render_public/_gallerycontent.html.haml @@ -74,6 +74,18 @@ -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, :title => gallery_images.title .clear + -if input.style == 4 + .portlet.input + + + + .tag-gal + -input.gallery_images.each do |gallery_images| + .element + =image_tag(gallery_images.image_file.file.square.url, :alt => "#{gallery_images.title}") + %p + =gallery_images.title + .clear -elsif input.style==2 diff --git a/app/views/public/realisations/show.html.haml b/app/views/public/realisations/show.html.haml new file mode 100644 index 0000000..0a6c5dd --- /dev/null +++ b/app/views/public/realisations/show.html.haml @@ -0,0 +1,8 @@ +.center + %h1=@realisation.title + =simple_format @realisation.description + + .rea-gal + -@realisation.realisation_images.each do |realisation_images| + =link_to image_tag(realisation_images.image_file.file.square.url, :alt => "#{realisation_images.title}"), realisation_images.image_file.file.large.url, :title => realisation_images.title + .clear diff --git a/config/routes.rb b/config/routes.rb index ce2c181..98a971b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - + get "/realisations/:id.html" => "public/realisations#show", :as => :public_realisation get "fr/newsletters/:id.html" => "public/newsletters#show", :as => :public_newsletter get "/fr/assurance-vie.html"=> "public/home#assurance" @@ -22,8 +22,17 @@ Rails.application.routes.draw do get "fr/presse" => "public/press_releases#index", :as => :public_press_releases get "fr/presse/:id" => "public/press_releases#show", :as => :public_press_release namespace :admin do - resources :donators - resources :donator_transactions + resources :realisation_images do + collection do + get :reorder + end + + + end + resources :realisations + + + end namespace :admin do diff --git a/db/migrate/20160216085031_create_realisations.rb b/db/migrate/20160216085031_create_realisations.rb new file mode 100644 index 0000000..7b9cf5f --- /dev/null +++ b/db/migrate/20160216085031_create_realisations.rb @@ -0,0 +1,13 @@ +class CreateRealisations < ActiveRecord::Migration + def change + create_table :realisations do |t| + t.string :title + t.text :description + t.string :slug + t.boolean :enabled + t.datetime :realised_at + t.integer :default_image_id + t.timestamps null: false + end + end +end diff --git a/db/migrate/20160216085123_create_realisation_images.rb b/db/migrate/20160216085123_create_realisation_images.rb new file mode 100644 index 0000000..274e8be --- /dev/null +++ b/db/migrate/20160216085123_create_realisation_images.rb @@ -0,0 +1,13 @@ +class CreateRealisationImages < ActiveRecord::Migration + def change + create_table :realisation_images do |t| + t.string :title + t.text :description + t.references :realisation, index: true + t.integer :position + t.references :image_file + t.timestamps null: false + end + add_foreign_key :realisation_images, :realisations + end +end diff --git a/db/schema.rb b/db/schema.rb index 4f3c0de..0d54632 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160125135733) do +ActiveRecord::Schema.define(version: 20160216085123) do create_table "admins", force: :cascade do |t| t.string "name", limit: 255 @@ -517,6 +517,29 @@ ActiveRecord::Schema.define(version: 20160125135733) do t.datetime "updated_at", null: false end + create_table "realisation_images", force: :cascade do |t| + t.string "title", limit: 255 + t.text "description", limit: 65535 + t.integer "realisation_id", limit: 4 + t.integer "position", limit: 4 + t.integer "image_file_id", limit: 4 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "realisation_images", ["realisation_id"], name: "index_realisation_images_on_realisation_id", using: :btree + + create_table "realisations", force: :cascade do |t| + t.string "title", limit: 255 + t.text "description", limit: 65535 + t.string "slug", limit: 255 + t.boolean "enabled", limit: 1 + t.datetime "realised_at" + t.integer "default_image_id", limit: 4 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "registrants", force: :cascade do |t| t.string "token", limit: 255 t.string "name", limit: 255 @@ -684,5 +707,6 @@ ActiveRecord::Schema.define(version: 20160125135733) do add_foreign_key "lang_pages", "lang_sites" add_foreign_key "lang_pages", "pages" add_foreign_key "menu_item_langs", "lang_sites" + add_foreign_key "realisation_images", "realisations" add_foreign_key "video_files", "image_files" end diff --git a/test/fixtures/realisation_images.yml b/test/fixtures/realisation_images.yml new file mode 100644 index 0000000..84a284b --- /dev/null +++ b/test/fixtures/realisation_images.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + title: MyString + description: MyText + realisation_id: + +two: + title: MyString + description: MyText + realisation_id: diff --git a/test/fixtures/realisations.yml b/test/fixtures/realisations.yml new file mode 100644 index 0000000..1048f47 --- /dev/null +++ b/test/fixtures/realisations.yml @@ -0,0 +1,15 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + title: MyString + description: MyText + slug: MyString + enabled: false + realised_at: 2016-02-16 09:50:31 + +two: + title: MyString + description: MyText + slug: MyString + enabled: false + realised_at: 2016-02-16 09:50:31 diff --git a/test/models/realisation_image_test.rb b/test/models/realisation_image_test.rb new file mode 100644 index 0000000..e34d244 --- /dev/null +++ b/test/models/realisation_image_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class RealisationImageTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/realisation_test.rb b/test/models/realisation_test.rb new file mode 100644 index 0000000..0fcad95 --- /dev/null +++ b/test/models/realisation_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class RealisationTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end