Remove legacy banner images and banner styles settings
This commit is contained in:
@@ -2245,76 +2245,6 @@ table {
|
|||||||
// 18. Banners
|
// 18. Banners
|
||||||
// -----------
|
// -----------
|
||||||
|
|
||||||
.banner-style-one {
|
|
||||||
background-color: $brand;
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-style-two {
|
|
||||||
background-color: $budget;
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-style-three {
|
|
||||||
background-color: #33dadf;
|
|
||||||
}
|
|
||||||
|
|
||||||
@include breakpoint(large) {
|
|
||||||
|
|
||||||
.banner-img-one {
|
|
||||||
background-image: image-url("banners/banner1.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-img-two {
|
|
||||||
background-image: image-url("banners/banner2.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-img-three {
|
|
||||||
background-image: image-url("banners/banner3.png");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-img-one,
|
|
||||||
.banner-img-two,
|
|
||||||
.banner-img-three {
|
|
||||||
background-position: bottom right;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-style-one,
|
|
||||||
.banner-style-two,
|
|
||||||
.banner-style-three,
|
|
||||||
.banner {
|
|
||||||
margin: 0;
|
|
||||||
margin-bottom: $line-height;
|
|
||||||
|
|
||||||
@include breakpoint(large) {
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
width: 80%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
h2,
|
|
||||||
h3,
|
|
||||||
a {
|
|
||||||
color: #eaeaf2;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
padding: $line-height / 2;
|
|
||||||
padding-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
padding: $line-height / 2;
|
|
||||||
padding-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:hover h2,
|
|
||||||
a:hover h3 {
|
|
||||||
color: #eaeaf2 !important;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 19. Recommendations
|
// 19. Recommendations
|
||||||
// -------------------
|
// -------------------
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ class Admin::SettingsController < Admin::BaseController
|
|||||||
all_settings = Setting.all.group_by { |s| s.type }
|
all_settings = Setting.all.group_by { |s| s.type }
|
||||||
@settings = all_settings['common']
|
@settings = all_settings['common']
|
||||||
@feature_flags = all_settings['feature']
|
@feature_flags = all_settings['feature']
|
||||||
@banner_styles = all_settings['banner-style']
|
|
||||||
@banner_imgs = all_settings['banner-img']
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|||||||
@@ -2,16 +2,10 @@ class Setting < ActiveRecord::Base
|
|||||||
validates :key, presence: true, uniqueness: true
|
validates :key, presence: true, uniqueness: true
|
||||||
|
|
||||||
default_scope { order(id: :asc) }
|
default_scope { order(id: :asc) }
|
||||||
scope :banner_style, -> { where("key ilike ?", "banner-style.%")}
|
|
||||||
scope :banner_img, -> { where("key ilike ?", "banner-img.%")}
|
|
||||||
|
|
||||||
def type
|
def type
|
||||||
if feature_flag?
|
if feature_flag?
|
||||||
'feature'
|
'feature'
|
||||||
elsif banner_style?
|
|
||||||
'banner-style'
|
|
||||||
elsif banner_img?
|
|
||||||
'banner-img'
|
|
||||||
else
|
else
|
||||||
'common'
|
'common'
|
||||||
end
|
end
|
||||||
@@ -25,14 +19,6 @@ class Setting < ActiveRecord::Base
|
|||||||
feature_flag? && value.present?
|
feature_flag? && value.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def banner_style?
|
|
||||||
key.start_with?('banner-style.')
|
|
||||||
end
|
|
||||||
|
|
||||||
def banner_img?
|
|
||||||
key.start_with?('banner-img.')
|
|
||||||
end
|
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def [](key)
|
def [](key)
|
||||||
where(key: key).pluck(:value).first.presence
|
where(key: key).pluck(:value).first.presence
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
<% if @banner_imgs.present?%>
|
|
||||||
<h2><%= t("admin.settings.index.banner_imgs") %></h2>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
<% @banner_imgs.each do |setting| %>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<strong><%= t("settings.#{setting.key}") %></strong>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
|
|
||||||
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
|
|
||||||
<%= f.submit(t('admin.settings.index.update_setting'), class: "button small success") %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<% else %>
|
|
||||||
<h3><%= t("admin.settings.index.no_banners_images") %></h3>
|
|
||||||
<% end %>
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
<% if @banner_styles.present? %>
|
|
||||||
<h2><%= t("admin.settings.index.banners") %></h2>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
<% @banner_styles.each do |setting| %>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<strong><%= t("settings.#{setting.key}") %></strong>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<%= form_for(setting, url: admin_setting_path(setting), html: { id: "edit_#{dom_id(setting)}"}) do |f| %>
|
|
||||||
<%= f.text_area :value, label: false, id: dom_id(setting), lines: 1 %>
|
|
||||||
<%= f.submit(t('admin.settings.index.update_setting'), class: "button hollow") %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<% else %>
|
|
||||||
<h3><%= t("admin.settings.index.no_banners_styles") %></h3>
|
|
||||||
<% end %>
|
|
||||||
@@ -17,18 +17,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="tabs-title">
|
|
||||||
<%= link_to "#tab-banner-styles" do %>
|
|
||||||
<%= t("admin.settings.index.banners") %>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="tabs-title">
|
|
||||||
<%= link_to "#tab-banner-images" do %>
|
|
||||||
<%= t("admin.settings.index.banner_imgs") %>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="tabs-title" id="map-tab">
|
<li class="tabs-title" id="map-tab">
|
||||||
<%= link_to "#tab-map-configuration" do %>
|
<%= link_to "#tab-map-configuration" do %>
|
||||||
<%= t("admin.settings.index.map.title") %>
|
<%= t("admin.settings.index.map.title") %>
|
||||||
|
|||||||
@@ -10,14 +10,6 @@
|
|||||||
<%= render "feature_flags" %>
|
<%= render "feature_flags" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tabs-panel" id="tab-banner-styles">
|
|
||||||
<%= render "banner_styles" %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tabs-panel" id="tab-banner-images">
|
|
||||||
<%= render "banner_images" %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tabs-panel" id="tab-map-configuration">
|
<div class="tabs-panel" id="tab-map-configuration">
|
||||||
<%= render "map_configuration" %>
|
<%= render "map_configuration" %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1126,10 +1126,6 @@ en:
|
|||||||
flash:
|
flash:
|
||||||
updated: Value updated
|
updated: Value updated
|
||||||
index:
|
index:
|
||||||
banners: Banner styles
|
|
||||||
banner_imgs: Banner images
|
|
||||||
no_banners_images: No banner images
|
|
||||||
no_banners_styles: No banner styles
|
|
||||||
title: Configuration settings
|
title: Configuration settings
|
||||||
update_setting: Update
|
update_setting: Update
|
||||||
feature_flags: Features
|
feature_flags: Features
|
||||||
|
|||||||
@@ -1125,10 +1125,6 @@ es:
|
|||||||
flash:
|
flash:
|
||||||
updated: Valor actualizado
|
updated: Valor actualizado
|
||||||
index:
|
index:
|
||||||
banners: Estilo del banner
|
|
||||||
banner_imgs: Imagenes del banner
|
|
||||||
no_banners_images: No hay imagenes de banner
|
|
||||||
no_banners_styles: No hay estilos de banner
|
|
||||||
title: Configuración global
|
title: Configuración global
|
||||||
update_setting: Actualizar
|
update_setting: Actualizar
|
||||||
feature_flags: Funcionalidades
|
feature_flags: Funcionalidades
|
||||||
|
|||||||
10
db/seeds.rb
10
db/seeds.rb
@@ -88,16 +88,6 @@ Setting['feature.help_page'] = true
|
|||||||
# Spending proposals feature flags
|
# Spending proposals feature flags
|
||||||
Setting['feature.spending_proposal_features.voting_allowed'] = nil
|
Setting['feature.spending_proposal_features.voting_allowed'] = nil
|
||||||
|
|
||||||
# Banner styles
|
|
||||||
Setting['banner-style.banner-style-one'] = "Banner style 1"
|
|
||||||
Setting['banner-style.banner-style-two'] = "Banner style 2"
|
|
||||||
Setting['banner-style.banner-style-three'] = "Banner style 3"
|
|
||||||
|
|
||||||
# Banner images
|
|
||||||
Setting['banner-img.banner-img-one'] = "Banner image 1"
|
|
||||||
Setting['banner-img.banner-img-two'] = "Banner image 2"
|
|
||||||
Setting['banner-img.banner-img-three'] = "Banner image 3"
|
|
||||||
|
|
||||||
# Proposal notifications
|
# Proposal notifications
|
||||||
Setting['proposal_notification_minimum_interval_in_days'] = 3
|
Setting['proposal_notification_minimum_interval_in_days'] = 3
|
||||||
Setting['direct_message_max_per_day'] = 3
|
Setting['direct_message_max_per_day'] = 3
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
namespace :banners do
|
|
||||||
|
|
||||||
desc "Migrate styles to background_color and font_color"
|
|
||||||
task migrate_style: :environment do
|
|
||||||
|
|
||||||
Banner.all.each do |banner|
|
|
||||||
banner.font_color = '#FFFFFF'
|
|
||||||
case banner.style
|
|
||||||
when "banner-style banner-style-one"
|
|
||||||
banner.background_color = '#004a83'
|
|
||||||
when "banner-style banner-style-two"
|
|
||||||
banner.background_color = '#7e328a'
|
|
||||||
when "banner-style banner-style-three"
|
|
||||||
banner.background_color = '#33dadf'
|
|
||||||
end
|
|
||||||
banner.save
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -54,28 +54,4 @@ describe Setting do
|
|||||||
expect(setting.enabled?).to eq false
|
expect(setting.enabled?).to eq false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#banner_style?" do
|
|
||||||
it "is true if key starts with 'banner-style.'" do
|
|
||||||
setting = described_class.create(key: "banner-style.whatever")
|
|
||||||
expect(setting.banner_style?).to eq true
|
|
||||||
end
|
|
||||||
|
|
||||||
it "is false if key does not start with 'banner-style.'" do
|
|
||||||
setting = described_class.create(key: "whatever")
|
|
||||||
expect(setting.banner_style?).to eq false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#banner_img?" do
|
|
||||||
it "is true if key starts with 'banner-img.'" do
|
|
||||||
setting = described_class.create(key: "banner-img.whatever")
|
|
||||||
expect(setting.banner_img?).to eq true
|
|
||||||
end
|
|
||||||
|
|
||||||
it "is false if key does not start with 'banner-img.'" do
|
|
||||||
setting = described_class.create(key: "whatever")
|
|
||||||
expect(setting.banner_img?).to eq false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user