Add image to legislation processes and banner colors

This commit is contained in:
Manu
2019-01-01 19:24:09 -05:00
parent 3bc3719507
commit bd4e12112d
9 changed files with 243 additions and 8 deletions

View File

@@ -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());

View File

@@ -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);
}

View File

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

View File

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

View File

@@ -201,6 +201,35 @@
<hr>
</div>
<div class="images small-12 column">
<%= render 'images/nested_image', imageable: @process, f: f %>
</div>
<div class="small-12 column">
<hr>
</div>
<div class="small-12 column">
<h4>Process banner color</h4>
</div>
<div class="row">
<div class="small-3 column">
<%= f.label :sections, "Background color" %>
<%= color_field(:process, :background_color, id: 'legislation_process_background_color_picker') %>
<%= f.text_field :background_color, label: false %>
</div>
<div class="small-3 column end">
<%= f.label :sections, "Font color" %>
<%= color_field(:process, :font_color, id: 'legislation_process_font_color_picker') %>
<%= f.text_field :font_color, label: false %>
</div>
</div>
<div class="small-12 column">
<hr>
</div>
<%= f.translatable_fields do |translations_form| %>
<div class="small-12 medium-9 column">
<%= translations_form.text_field :title,

View File

@@ -1,7 +1,19 @@
<div class="legislation-hero jumbo">
<div <% if process.background_color.present? && process.font_color.present? %>
class="legislation-hero jumboAlt" style="background:<%= process.background_color %>; color:<%= process.font_color %>;"
<% else %>
class="legislation-hero jumbo"
<% end %>>
<div class="row">
<div class="small-12 medium-9 column">
<%= 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 %>
<h2><%= @process.title %></h2>
<% if header == :small %>
@@ -35,6 +47,11 @@
description: @process.title
} %>
<% if @process.image.present? %>
<hr>
<%= image_tag(@process.image_url(:large), alt: @process.title, id:'image') %>
<% end %>
<% if process.draft_publication.enabled? %>
<div class="sidebar-divider"></div>
<p class="sidebar-title">

View File

@@ -10,7 +10,10 @@
<%= markdown @process.additional_info if @process.additional_info %>
</div>
<a class="button" data-toggle="additional_info">
<a class="button" data-toggle="additional_info"
<% if process.background_color.present? && process.font_color.present? %>
style="background:<%= process.font_color %>; color:<%= process.background_color %>;"
<% end %>>
<%= t("legislation.processes.header.additional_info") %>
</a>
<% end %>