From a3d3c6063d4c17035b6414f1da250e50943bb5b9 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Wed, 21 Oct 2015 15:41:51 +0200 Subject: [PATCH] agenda suite --- app/models/event.rb | 2 + app/views/admin/articles/_article.html.haml | 2 +- app/views/admin/events/_form.html.haml | 2 +- app/views/admin/events/edit.html.haml | 105 +++++++++++------- config/deploy.rb | 2 +- ...20151021132546_add_image_file_to_events.rb | 5 + db/schema.rb | 5 +- 7 files changed, 77 insertions(+), 46 deletions(-) create mode 100644 db/migrate/20151021132546_add_image_file_to_events.rb diff --git a/app/models/event.rb b/app/models/event.rb index dea6992..efe4e88 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -2,6 +2,8 @@ class Event < ActiveRecord::Base date_format = /\A(0[1-9]|[12][0-9]|3[01])[\/](0[1-9]|1[012])[\/](19|20)\d\d\z/i hour_format = /\A([0-1]?[0-9]|2[0-3]):([0-5][0-9])(:[0-5][0-9])?\z/i validates :title, :presence => true + + belongs_to :image_file # validates :start_at_date, :presence => true, :format => { :with => date_format } # validates :start_at_time, :presence => true, :format => { :with => hour_format }, :if => :with_time? diff --git a/app/views/admin/articles/_article.html.haml b/app/views/admin/articles/_article.html.haml index 6cbcbaa..ee76841 100644 --- a/app/views/admin/articles/_article.html.haml +++ b/app/views/admin/articles/_article.html.haml @@ -13,7 +13,7 @@ = link_to i(:"trash-o"), [:admin, article], :confirm => 'Voulez-vous vraiment supprimer cet article ?', :method => :delete, :remote => true = link_to i(:pencil), edit_admin_article_path(article), :style => "padding:0px 0px 0px 0px;", :remote => true - = link_to i(:info), edit_admin_article_path(article), :style => "padding:0px 0px 0px 0px;" + = link_to i(:plus), edit_admin_article_path(article), :style => "padding:0px 0px 0px 0px;" =link_to i(:"level-down"), admin_article_path(:id => article.id, :format => "js"), :class => "set_tag" diff --git a/app/views/admin/events/_form.html.haml b/app/views/admin/events/_form.html.haml index 9c8ca5d..f8c1c3e 100644 --- a/app/views/admin/events/_form.html.haml +++ b/app/views/admin/events/_form.html.haml @@ -3,7 +3,7 @@ = form.inputs do = form.input :title, :label => "Titre :" = form.hidden_field :event_id - + =form.input :image_file_id, :as => :qi_image_select .event_date_form -if form.object.errors.messages[:start_at_date] or form.object.errors.messages[:start_at_time] or form.object.errors.messages[:stop_at_date] or form.object.errors.messages[:stop_at_time] %p.errors diff --git a/app/views/admin/events/edit.html.haml b/app/views/admin/events/edit.html.haml index 5465357..2e2cc9c 100644 --- a/app/views/admin/events/edit.html.haml +++ b/app/views/admin/events/edit.html.haml @@ -1,60 +1,81 @@ - #toolbar-text - - - -#event_block_edit{:style => "margin-right:330px;margin-top:45px;"} - +#menu_item_block_edit{:style => "margin-right:330px;margin-top:45px;"} + =render :partial => "admin/blocks/block", :locals => {:block => @event.block, :sortable => true} - +%br +%br +%br +%br +%br +%br +%br +%br +%br +%br +%br #menu_item_inspector_container - .accordion#menu_item_informations - - .accordion-group - .inspector_handle - .accordion-heading.navbar-inner.navbar-inverse - %a.accordion-toggle{:href => "#collapseOne",:data => {:toggle => "collapse", :parent => "#menu_item_informations"}} - Infos sur l'event + + + + + + + + #menu_item_informations + %h4 + Infos sur l'event - #collapseOne.accordion-body.collapse - .accordion-inner - =link_to "modifier", edit_admin_event_path(@event), :remote => true,:class => "btn" - =render :partial => "show" + .panel#collapseOne{:style => "display:none;"} + =render :partial => "form" - - .accordion-heading.navbar-inner.navbar-inverse - %a.accordion-toggle{:href => "#collapse2",:data => {:toggle => "collapse", :parent => "#menu_item_informations"}} - éléments + %h4 éléments - - #collapse2.accordion-body.collapse.in - .accordion-inner - .block_portlets_sortable#content_types - -@event.alloweds_types.each do |slug, name| + .panel#collapse2 + .block_portlets_sortable#content_types + -@event.block.alloweds_types.each do |slug, name| + + .content_type{:id => slug, :"data-type" => slug} + =#i slug.to_s.constantize.picto + =image_tag("admin/content_type/type_"+slug.to_s+".png", :alt => name, :title => name, :class => "handle") + - .portlet{:id => slug, :data_type => slug} - =image_tag("admin/content_type/type_"+slug.to_s+".png", :alt => name, :class => "handle") - - - - .accordion-heading.navbar-inner.navbar-inverse - %a.accordion-toggle{:href => "#collapse3",:data => {:toggle => "collapse", :parent => "#menu_item_informations"}} - Modifier l'élément + #collapse3{:style => "display:none;"} + %h4 Modifier l'élément - #collapse3.accordion-body.collapse -   + .panel #element_form + + %div#element_form_action + %a.move.btn.btn-default.portlet_handle{:href => "#", :data => {:portlet_id => nil}} + %span.move_message + =ic :arrows +   + déplacer + %span.cancel_message + =ic :ban +   + annuler + + =link_to ic(:"trash-o"), "#", :method => :delete, :data => { :confirm => "Etes-vous sûr ?"}, :remote => true, :class => "btn btn-danger trash" + + %button.save.btn.btn-primary + =ic(:"floppy-o") +   + Sauvegarder + + + + + + + + - - - - - diff --git a/config/deploy.rb b/config/deploy.rb index 5487e6a..23c7154 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -35,7 +35,7 @@ role :db, domain, :primary => true set :scm, :git - set :repository, "git@gitlab.bally.me:root/pic_vert_app.git" + set :repository, "git@git.nicolasbally.com:root/pic_vert_app.git" set :branch, "master" diff --git a/db/migrate/20151021132546_add_image_file_to_events.rb b/db/migrate/20151021132546_add_image_file_to_events.rb new file mode 100644 index 0000000..934e4cc --- /dev/null +++ b/db/migrate/20151021132546_add_image_file_to_events.rb @@ -0,0 +1,5 @@ +class AddImageFileToEvents < ActiveRecord::Migration + def change + add_reference :events, :image_file, index: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 5b70d53..71a24d3 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: 20150309094403) do +ActiveRecord::Schema.define(version: 20151021132546) do create_table "admins", force: true do |t| t.string "email", default: "", null: false @@ -212,8 +212,11 @@ ActiveRecord::Schema.define(version: 20150309094403) do t.boolean "many_days" t.datetime "created_at" t.datetime "updated_at" + t.integer "image_file_id" end + add_index "events", ["image_file_id"], name: "index_events_on_image_file_id", using: :btree + create_table "external_links", force: true do |t| t.string "title" t.text "description"