diff --git a/app/assets/javascripts/legislation_admin.js.coffee b/app/assets/javascripts/legislation_admin.js.coffee index 5aa19f083..4f26eb790 100644 --- a/app/assets/javascripts/legislation_admin.js.coffee +++ b/app/assets/javascripts/legislation_admin.js.coffee @@ -1,5 +1,13 @@ App.LegislationAdmin = + update_background_color: (selector, text_selector, background_color) -> + $(selector).css('background-color', background_color); + $(text_selector).val(background_color); + + update_font_color: (selector, text_selector, font_color) -> + $(selector).css('color', font_color); + $(text_selector).val(font_color); + initialize: -> $("input[type='checkbox'][data-disable-date]").on change: -> @@ -14,3 +22,23 @@ App.LegislationAdmin = $("#nested_question_options").on "cocoon:after-insert", -> App.Globalize.refresh_visible_translations() + + #banner colors for proccess header + + $("#legislation_process_background_color_picker").on + change: -> + App.LegislationAdmin.update_background_color("#js-legislation_process-background", "#legislation_process_background_color", $(this).val()); + + $("#legislation_process_background_color").on + change: -> + App.LegislationAdmin.update_background_color("#js-legislation_process-background", "#legislation_process_background_color_picker", $(this).val()); + + $("#legislation_process_font_color_picker").on + change: -> + App.LegislationAdmin.update_font_color("#js-legislation_process-title", "#legislation_process_font_color", $(this).val()); + App.LegislationAdmin.update_font_color("#js-legislation_process-description", "#legislation_process_font_color", $(this).val()); + + $("#legislation_process_font_color").on + change: -> + App.LegislationAdmin.update_font_color("#js-legislation_process-title", "#legislation_process_font_color_picker", $(this).val()); + App.LegislationAdmin.update_font_color("#js-legislation_process-description", "#legislation_process_font_color_picker", $(this).val()); diff --git a/app/assets/stylesheets/pages.scss b/app/assets/stylesheets/pages.scss index efde88d07..d37c1d14b 100644 --- a/app/assets/stylesheets/pages.scss +++ b/app/assets/stylesheets/pages.scss @@ -30,6 +30,22 @@ } } +.jumboAlt { + background: $highlight; + margin-bottom: $line-height; + margin-top: rem-calc(-24); + padding-bottom: $line-height; + padding-top: $line-height; + + @include breakpoint(medium) { + padding: rem-calc(24) 0; + } + + &.light { + background: #ecf0f1; + } +} + .lead { font-size: rem-calc(24); } diff --git a/app/controllers/admin/legislation/processes_controller.rb b/app/controllers/admin/legislation/processes_controller.rb index 780ee7478..1df9cdd66 100644 --- a/app/controllers/admin/legislation/processes_controller.rb +++ b/app/controllers/admin/legislation/processes_controller.rb @@ -66,8 +66,11 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll :result_publication_enabled, :published, :custom_list, + :background_color, + :font_color, translation_params(::Legislation::Process), - documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy] + documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy], + image_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy] ] end diff --git a/app/models/legislation/process.rb b/app/models/legislation/process.rb index dc880552b..36a606314 100644 --- a/app/models/legislation/process.rb +++ b/app/models/legislation/process.rb @@ -2,6 +2,7 @@ class Legislation::Process < ActiveRecord::Base include ActsAsParanoidAliases include Taggable include Milestoneable + include Imageable include Documentable documentable max_documents_allowed: 3, max_file_size: 3.megabytes, diff --git a/app/views/admin/legislation/processes/_form.html.erb b/app/views/admin/legislation/processes/_form.html.erb index 1e43da6db..d47947be2 100644 --- a/app/views/admin/legislation/processes/_form.html.erb +++ b/app/views/admin/legislation/processes/_form.html.erb @@ -201,6 +201,35 @@
+
+ <%= render 'images/nested_image', imageable: @process, f: f %> +
+ +
+
+
+ +
+

Process banner color

+
+ +
+
+ <%= f.label :sections, "Background color" %> + <%= color_field(:process, :background_color, id: 'legislation_process_background_color_picker') %> + <%= f.text_field :background_color, label: false %> +
+
+ <%= f.label :sections, "Font color" %> + <%= color_field(:process, :font_color, id: 'legislation_process_font_color_picker') %> + <%= f.text_field :font_color, label: false %> +
+
+ +
+
+
+ <%= f.translatable_fields do |translations_form| %>
<%= translations_form.text_field :title, diff --git a/app/views/legislation/processes/_header.html.erb b/app/views/legislation/processes/_header.html.erb index 4c6acea90..dd21b36ee 100644 --- a/app/views/legislation/processes/_header.html.erb +++ b/app/views/legislation/processes/_header.html.erb @@ -1,7 +1,19 @@ -
+
+ class="legislation-hero jumboAlt" style="background:<%= process.background_color %>; color:<%= process.font_color %>;" + <% else %> + class="legislation-hero jumbo" + <% end %>>
- <%= back_link_to legislation_processes_path %> + + <% if process.background_color.present? && process.font_color.present? %> + <%= link_to content_tag(:span, nil, class: "icon-angle-left", + style: "color:#{process.font_color};") + t("shared.back"), + legislation_processes_path, class: 'back', style: 'color:#FFFFFF !important;'%> + <% else %> + <%= back_link_to legislation_processes_path %> + <% end %> +

<%= @process.title %>

<% if header == :small %> @@ -35,6 +47,11 @@ description: @process.title } %> + <% if @process.image.present? %> +
+ <%= image_tag(@process.image_url(:large), alt: @process.title, id:'image') %> + <% end %> + <% if process.draft_publication.enabled? %>
- + + style="background:<%= process.font_color %>; color:<%= process.background_color %>;" + <% end %>> <%= t("legislation.processes.header.additional_info") %> <% end %> diff --git a/db/migrate/20181220163447_add_header_color_settings_to_legislation_processes.rb b/db/migrate/20181220163447_add_header_color_settings_to_legislation_processes.rb new file mode 100644 index 000000000..b4c7b3ad8 --- /dev/null +++ b/db/migrate/20181220163447_add_header_color_settings_to_legislation_processes.rb @@ -0,0 +1,6 @@ +class AddHeaderColorSettingsToLegislationProcesses < ActiveRecord::Migration + def change + add_column :legislation_processes, :background_color, :text + add_column :legislation_processes, :font_color, :text + end +end \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index e3241fd8d..043a6ba0d 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: 20181206153510) do +ActiveRecord::Schema.define(version: 20181220163447) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -504,6 +504,46 @@ ActiveRecord::Schema.define(version: 20181206153510) do add_index "geozones_polls", ["geozone_id"], name: "index_geozones_polls_on_geozone_id", using: :btree add_index "geozones_polls", ["poll_id"], name: "index_geozones_polls_on_poll_id", using: :btree + create_table "house_images", force: :cascade do |t| + t.integer "house_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "house_news", force: :cascade do |t| + t.string "title" + t.string "photo" + t.string "link" + t.string "house_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "houses", force: :cascade do |t| + t.string "name" + t.string "address" + t.string "schedule" + t.string "phone" + t.string "email" + t.string "photo" + t.boolean "disability_access" + t.integer "zonal_administration_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "houses_administrators", force: :cascade do |t| + t.integer "user_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "houses_age_ranges", force: :cascade do |t| + t.string "name" + t.datetime "created_at" + t.datetime "updated_at" + end + create_table "i18n_content_translations", force: :cascade do |t| t.integer "i18n_content_id", null: false t.string "locale", null: false @@ -666,6 +706,8 @@ ActiveRecord::Schema.define(version: 20181206153510) do t.date "draft_end_date" t.boolean "draft_phase_enabled", default: false t.boolean "homepage_enabled", default: false + t.text "background_color" + t.text "font_color" end add_index "legislation_processes", ["allegations_end_date"], name: "index_legislation_processes_on_allegations_end_date", using: :btree @@ -792,6 +834,7 @@ ActiveRecord::Schema.define(version: 20181206153510) do t.integer "zoom" t.integer "proposal_id" t.integer "investment_id" + t.integer "house_id" end add_index "map_locations", ["investment_id"], name: "index_map_locations_on_investment_id", using: :btree @@ -838,6 +881,13 @@ ActiveRecord::Schema.define(version: 20181206153510) do add_index "moderators", ["user_id"], name: "index_moderators_on_user_id", using: :btree + create_table "neighborhoods", force: :cascade do |t| + t.string "name" + t.integer "id_parish" + t.datetime "created_at" + t.datetime "updated_at" + end + create_table "newsletters", force: :cascade do |t| t.string "subject" t.string "segment_recipient", null: false @@ -870,6 +920,12 @@ ActiveRecord::Schema.define(version: 20181206153510) do add_index "organizations", ["user_id"], name: "index_organizations_on_user_id", using: :btree + create_table "parishes", force: :cascade do |t| + t.string "name" + t.datetime "created_at" + t.datetime "updated_at" + end + create_table "poll_answers", force: :cascade do |t| t.integer "question_id" t.integer "author_id" @@ -1379,6 +1435,11 @@ ActiveRecord::Schema.define(version: 20181206153510) do t.integer "failed_email_digests_count", default: 0 t.text "former_users_data_log", default: "" t.boolean "public_interests", default: false + t.string "userlastname" + t.integer "user_parish" + t.integer "user_neighborhood" + t.string "ethnic_group" + t.string "studies_level" t.boolean "recommended_debates", default: true t.boolean "recommended_proposals", default: true end @@ -1457,6 +1518,39 @@ ActiveRecord::Schema.define(version: 20181206153510) do add_index "visits", ["started_at"], name: "index_visits_on_started_at", using: :btree add_index "visits", ["user_id"], name: "index_visits_on_user_id", using: :btree + create_table "volunt_categories", force: :cascade do |t| + t.string "name" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "volunt_programs", force: :cascade do |t| + t.string "title" + t.text "photo" + t.string "schedule" + t.integer "quota" + t.string "short_description" + t.text "long_description" + t.integer "volunt_category_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "phone" + t.string "email" + end + + create_table "volunt_users", force: :cascade do |t| + t.integer "id_user" + t.integer "volunt_program_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "volunteerings_administrators", force: :cascade do |t| + t.integer "user_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "votes", force: :cascade do |t| t.integer "votable_id" t.string "votable_type" @@ -1500,11 +1594,14 @@ ActiveRecord::Schema.define(version: 20181206153510) do t.string "link_text" t.string "link_url" t.string "label" - t.boolean "header", default: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.boolean "header", default: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "site_customization_page_id", default: 0 end + add_index "widget_cards", ["site_customization_page_id"], name: "index_widget_cards_on_site_customization_page_id", using: :btree + create_table "widget_feeds", force: :cascade do |t| t.string "kind" t.integer "limit", default: 3 @@ -1512,6 +1609,41 @@ ActiveRecord::Schema.define(version: 20181206153510) do t.datetime "updated_at", null: false end + create_table "workshop_images", force: :cascade do |t| + t.integer "workshop_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "workshop_users", force: :cascade do |t| + t.integer "id_user" + t.integer "workshop_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "status" + end + + create_table "workshops", force: :cascade do |t| + t.string "name" + t.string "teacher" + t.string "schedule" + t.integer "quota" + t.string "short_description" + t.text "long_description" + t.string "photo" + t.integer "house_id" + t.integer "id_age_range" + t.datetime "created_at" + t.datetime "updated_at" + t.string "status" + end + + create_table "zonal_administrations", force: :cascade do |t| + t.string "name" + t.datetime "created_at" + t.datetime "updated_at" + end + add_foreign_key "administrators", "users" add_foreign_key "annotations", "legacy_legislations" add_foreign_key "annotations", "users"