This commit is contained in:
Nicolas Bally 2018-05-28 17:47:46 +02:00
parent db35804629
commit 94ae0f4e7e
6 changed files with 63 additions and 2 deletions

View File

@ -235,4 +235,17 @@ $vert:#7BAE53;
background:center center no-repeat;
background-size:100%;
background-size:cover;
}
}
.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;
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,5 @@
class AddDataFileIdToPlumes < ActiveRecord::Migration
def change
add_column :plumes, :data_file_id, :integer
end
end

View File

@ -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|