Skip to content

Commit

Permalink
Merge pull request democrateam#68 from StemvanGroningen/custom_images
Browse files Browse the repository at this point in the history
Add new images to admin site customization
  • Loading branch information
decabeza committed Oct 7, 2020
2 parents db900d5 + 09629e4 commit 71989c8
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 20 deletions.
Binary file added app/assets/images/custom/auth_bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/assets/images/custom/auth_bg.png
Binary file not shown.
15 changes: 2 additions & 13 deletions app/assets/stylesheets/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -914,19 +914,7 @@ footer {
.subfooter {
border-top: 0;
font-size: $base-font-size;
margin-top: $line-height * 12;
padding: $line-height 0;
position: relative;

&::before {
background-image: image-url("bg_footer.png");
background-repeat: no-repeat;
background-size: contain;
height: 311px;
position: absolute;
top: -276px;
width: 100%;
}

ul {
padding-left: $line-height / 4;
Expand Down Expand Up @@ -2452,7 +2440,8 @@ footer {
}

.auth-image {
background: $brand image-url("auth_bg.png");
background-color: transparent;
background-size: auto;

@include breakpoint(medium) {
min-height: rem-calc(1390);
Expand Down
7 changes: 6 additions & 1 deletion app/models/site_customization/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ class SiteCustomization::Image < ApplicationRecord
"budget_no_image" => [400, 300],
"map" => [420, 500],
"logo_email" => [400, 80],
"header_homepage" => [500, 400]
"header_homepage" => [500, 400],
"welcome/step_1" => [270, 240],
"welcome/step_2" => [270, 240],
"welcome/step_3" => [270, 240],
"bg_footer" => [1200, 300],
"auth_bg" => [934, 1398]
}.freeze

has_attached_file :image
Expand Down
4 changes: 4 additions & 0 deletions app/views/custom/layouts/_footer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
</div>

<div class="subfooter row">
<div class="margin">
<%= image_tag(image_path_for("bg_footer.png"), alt: "") %>
</div>

&copy; <%= t("layouts.footer.copyright", year: Time.current.year) %> - 1.1.0
<ul class="no-bullet">
<li><%= link_to t("layouts.footer.privacy"), page_path("privacy") %>&nbsp;|</li>
Expand Down
3 changes: 2 additions & 1 deletion app/views/custom/welcome/_header.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<% if header.present? %>
<div class="jumbo highlight" style="background-image: url(<%= image_path_for("header_homepage.png") %>)">
<div class="jumbo highlight"
style="background-image: url(<%= asset_url(image_path_for("header_homepage.png")) %>)">
<div class="row">
<div class="small-12 large-7 column">
<span><%= header.label %></span>
Expand Down
6 changes: 3 additions & 3 deletions app/views/custom/welcome/_steps.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
</div>

<div class="small-12 medium-4 column step">
<%= image_tag("welcome/step_1.png", alt: "", class: "margin") %>
<%= image_tag(image_path_for("welcome/step_1.png"), alt: "", class: "margin") %>
<span class="number"><%= t("welcome.steps.step_1.number") %></span>
<h3><%= t("welcome.steps.step_1.title") %></h3>
<p><%= t("welcome.steps.step_1.description") %></p>
<%= link_to t("welcome.steps.step_1.link"), new_user_registration_path %>
</div>

<div class="small-12 medium-4 column step">
<%= image_tag("welcome/step_2.png", alt: "", class: "margin") %>
<%= image_tag(image_path_for("welcome/step_2.png"), alt: "", class: "margin") %>
<span class="number"><%= t("welcome.steps.step_2.number") %></span>
<h3><%= t("welcome.steps.step_2.title") %></h3>
<p><%= t("welcome.steps.step_2.description") %></p>
<%= link_to t("welcome.steps.step_2.link"), budgets_path, data: { smooth_scroll: true } %>
</div>

<div class="small-12 medium-4 column step">
<%= image_tag("welcome/step_3.png", alt: "", class: "margin") %>
<%= image_tag(image_path_for("welcome/step_3.png"), alt: "", class: "margin") %>
<span class="number"><%= t("welcome.steps.step_3.number") %></span>
<h3><%= t("welcome.steps.step_3.title") %></h3>
<p><%= t("welcome.steps.step_3.description") %></p>
Expand Down
2 changes: 1 addition & 1 deletion app/views/debates/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<%= paginate @debates %>
<% unless @search_terms || @advanced_search_terms || @tag_filter %>
<div id="section_help" class="section-help" class="margin" data-magellan-target="section_help">
<div id="section_help" class="section-help margin" data-magellan-target="section_help">
<p class="lead">
<strong><%= t("debates.index.section_footer.title") %></strong>
</p>
Expand Down
3 changes: 2 additions & 1 deletion app/views/layouts/devise.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<body class="auth-page">
<%= raw setting["html.per_page_code_body"] %>
<div class="wrapper">
<div class="auth-image small-12 medium-3 column">
<div class="auth-image small-12 medium-3 column"
style="background-image: url(<%= asset_url(image_path_for("auth_bg.jpg")) %>)">
<h1 class="logo margin">
<%= link_to root_path do %>
<%= image_tag(image_path_for("logo_header.png"), class: "float-left", alt: t("layouts.header.logo")) %>
Expand Down
9 changes: 9 additions & 0 deletions spec/features/admin/site_customization/images_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
login_as(admin.user)
end

scenario "List of customizable images" do
valid_images = SiteCustomization::Image::VALID_IMAGES
%w[logo_header social_media_icon social_media_icon_twitter apple-touch-icon-200 budget_execution_no_image
budget_no_image map logo_email header_homepage welcome/step_1 welcome/step_2 welcome/step_3 bg_footer
auth_bg].each do |image_name|
expect(valid_images.keys).to include(image_name)
end
end

scenario "Upload valid png image" do
visit admin_root_path

Expand Down

0 comments on commit 71989c8

Please sign in to comment.