diff --git a/app/assets/stylesheets/public/plume.css.scss b/app/assets/stylesheets/public/plume.css.scss index db3fa53..56fa659 100644 --- a/app/assets/stylesheets/public/plume.css.scss +++ b/app/assets/stylesheets/public/plume.css.scss @@ -235,4 +235,17 @@ $vert:#7BAE53; background:center center no-repeat; background-size:100%; background-size:cover; -} \ No newline at end of file +} + +.plume_right_buttons{ + margin-top:50px; + text-align:right; + .btn{ + background:$vert; + color:white; + font-weight:bold; + padding:10px 20px; + text-transform:uppercase; + border-radius:0; + } +} diff --git a/app/models/plume.rb b/app/models/plume.rb index 65f5c62..1ccd878 100644 --- a/app/models/plume.rb +++ b/app/models/plume.rb @@ -1,6 +1,11 @@ class Plume < ActiveRecord::Base belongs_to :image_file + belongs_to :data_file + + belongs_to :couv_image_file, :class_name => "ImageFile" + + has_many :plume_cats has_many :plume_articles, :through => :plume_cats diff --git a/app/views/admin/plumes/_form.html.haml b/app/views/admin/plumes/_form.html.haml index 4b84058..b015209 100644 --- a/app/views/admin/plumes/_form.html.haml +++ b/app/views/admin/plumes/_form.html.haml @@ -8,9 +8,40 @@ = form.input :number, :label => "Numéro plume :" = form.input :p_version, :label => "Ligne 'version' :" = form.input :image_file_id, :as => :qi_image_select + + + = form.input :credits, :label => "Crédit photo couverture :" = form.input :redaction_credits, :label => "Crédits rédac & relecture :" + %hr + + + %p + %strong + Infos PDF + + = form.input :couv_image_file_id, :as => :qi_image_select + %p + %table.form_table + + + + %tr + %td{:style => "vertical-align:top;padding-right:10px;"} + -r = rand(1000000000000000000000000000) + %strong Fichier associé : + %td + #name{:id => r} + -if form.object.data_file + =form.object.data_file.abstract_file_name if form.object.data_file + =link_to "Supprimer", "#", :onclick => "$('#input_"+r.to_s+"').val('');$('#name_"+r.to_s+"').html('');return false;" + + =form.hidden_field :data_file_id, :id => "input_"+r.to_s + + =link_to "Modifier ce fichier", "#", :onclick => "select_file_from_manager('"+r.to_s+"');return false;" + + %hr diff --git a/app/views/public/plumes/show.html.haml b/app/views/public/plumes/show.html.haml index a85d635..11fd7a9 100644 --- a/app/views/public/plumes/show.html.haml +++ b/app/views/public/plumes/show.html.haml @@ -50,6 +50,12 @@ =article.description .clear + .plume_right_buttons + -if @plume.data_file + =link_to "Télécharger la version PDF", @plume.data_file.file.path, :target => "plume_pdf_#{plume.id}", :class => "btn" + -else + =link_to "Télécharger la version PDF", print_public_plume_path(@plume, :format => "pdf"), :target => "plume_pdf_#{@plume.id}", :class => "btn" + .clear .plume_bottom diff --git a/db/migrate/20180528150643_add_data_file_id_to_plumes.rb b/db/migrate/20180528150643_add_data_file_id_to_plumes.rb new file mode 100644 index 0000000..f54d232 --- /dev/null +++ b/db/migrate/20180528150643_add_data_file_id_to_plumes.rb @@ -0,0 +1,5 @@ +class AddDataFileIdToPlumes < ActiveRecord::Migration + def change + add_column :plumes, :data_file_id, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 807f892..7a056d9 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: 20180329135016) do +ActiveRecord::Schema.define(version: 20180528150643) do create_table "admins", force: true do |t| t.string "email", default: "", null: false @@ -727,6 +727,7 @@ ActiveRecord::Schema.define(version: 20180329135016) do t.datetime "enabled_at" t.datetime "created_at" t.datetime "updated_at" + t.integer "data_file_id" end create_table "portlets", force: true do |t|