Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Admin settings section #3328

Merged
merged 7 commits into from
Feb 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
70 changes: 0 additions & 70 deletions app/assets/stylesheets/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2245,76 +2245,6 @@ table {
// 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
// -------------------
Expand Down
4 changes: 1 addition & 3 deletions app/controllers/admin/settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ def index
all_settings = Setting.all.group_by { |s| s.type }
@settings = all_settings['common']
@feature_flags = all_settings['feature']
@banner_styles = all_settings['banner-style']
@banner_imgs = all_settings['banner-img']
end

def update
Expand All @@ -27,4 +25,4 @@ def settings_params
params.require(:setting).permit(:value)
end

end
end
6 changes: 0 additions & 6 deletions app/controllers/proposals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ def retire
def retire_form
end

def share
if Setting['proposal_improvement_path'].present?
@proposal_improvement_path = Setting['proposal_improvement_path']
end
end

def vote_featured
@proposal.register_vote(current_user, 'yes')
set_featured_proposal_votes(@proposal)
Expand Down
4 changes: 0 additions & 4 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ def home_page?
request.path == '/'
end

def opendata_page?
request.path == '/opendata'
end

# if current path is /debates current_path_with_query_params(foo: 'bar') returns /debates?foo=bar
# notice: if query_params have a param which also exist in current path, it "overrides" (query_params is merged last)
def current_path_with_query_params(query_parameters)
Expand Down
14 changes: 0 additions & 14 deletions app/models/setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@ class Setting < ActiveRecord::Base
validates :key, presence: true, uniqueness: true

default_scope { order(id: :asc) }
scope :banner_style, -> { where("key ilike ?", "banner-style.%")}
scope :banner_img, -> { where("key ilike ?", "banner-img.%")}

def type
if feature_flag?
'feature'
elsif banner_style?
'banner-style'
elsif banner_img?
'banner-img'
else
'common'
end
Expand All @@ -25,14 +19,6 @@ def enabled?
feature_flag? && value.present?
end

def banner_style?
key.start_with?('banner-style.')
end

def banner_img?
key.start_with?('banner-img.')
end

class << self
def [](key)
where(key: key).pluck(:value).first.presence
Expand Down
24 changes: 0 additions & 24 deletions app/views/admin/settings/_banner_images.html.erb

This file was deleted.

24 changes: 0 additions & 24 deletions app/views/admin/settings/_banner_styles.html.erb

This file was deleted.

12 changes: 0 additions & 12 deletions app/views/admin/settings/_filter_subnav.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,6 @@
<% end %>
</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">
<%= link_to "#tab-map-configuration" do %>
<%= t("admin.settings.index.map.title") %>
Expand Down
8 changes: 0 additions & 8 deletions app/views/admin/settings/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
<%= render "feature_flags" %>
</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">
<%= render "map_configuration" %>
</div>
Expand Down
9 changes: 0 additions & 9 deletions app/views/layouts/_footer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@
<% end %>
</li>
<% end %>
<% if setting['blog_url'] %>
<li class="inline-block">
<%= link_to setting['blog_url'], target: "_blank",
title: t("shared.go_to_page") + t("social.blog", org: setting['org_name']) + t('shared.target_blank_html') do %>
<span class="show-for-sr"><%= t("social.blog", org: setting['org_name']) %></span>
<span class="icon-blog" aria-hidden="true"></span>
<% end %>
</li>
<% end %>
<% if setting['youtube_handle'] %>
<li class="inline-block">
<%= link_to "https://www.youtube.com/#{setting['youtube_handle']}", target: "_blank",
Expand Down
7 changes: 0 additions & 7 deletions app/views/proposals/share.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@
description: @proposal.summary
} %>

<% if @proposal_improvement_path.present? %>
<div class="callout highlight margin-top text-center">
<p class="lead"><strong><%= t("proposals.proposal.improve_info") %></strong></p>
<%= link_to t("proposals.proposal.improve_info_link"), @proposal_improvement_path, class: "button" %>
</div>
<% end %>

<div class="small margin-bottom">
<%= link_to t("proposals.proposal.share.view_proposal"), proposal_path(@proposal) %>
</div>
Expand Down
10 changes: 0 additions & 10 deletions app/views/shared/_top_links.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
<ul class="no-bullet external-links">
<% if setting['blog_url'] %>
<li>
<%= link_to t("layouts.header.external_link_blog"),
setting['blog_url'],
target: "_blank",
rel: "",
title: t("shared.go_to_page") + t("layouts.header.external_link_blog") + t('shared.target_blank_html') %>
</li>
<% end %>

<%= raw content_block("top_links", I18n.locale) %>
</ul>
4 changes: 0 additions & 4 deletions config/locales/en/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1126,10 +1126,6 @@ en:
flash:
updated: Value updated
index:
banners: Banner styles
banner_imgs: Banner images
no_banners_images: No banner images
no_banners_styles: No banner styles
title: Configuration settings
update_setting: Update
feature_flags: Features
Expand Down
4 changes: 0 additions & 4 deletions config/locales/en/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ en:
available_locales: Available languages
collaborative_legislation: Legislation processes
debates: Debates
external_link_blog: Blog
locale: 'Language:'
logo: CONSUL logo
management: Management
Expand Down Expand Up @@ -398,8 +397,6 @@ en:
guide: "Now you can share it so people can start supporting."
edit: "Before it gets shared you'll be able to change the text as you like."
view_proposal: Not now, go to my proposal
improve_info: "Improve your campaign and get more supports"
improve_info_link: "See more information"
already_supported: You have already supported this proposal. Share it!
comments:
one: 1 comment
Expand Down Expand Up @@ -624,7 +621,6 @@ en:
see_more: See more recommendations
hide: Hide recommendations
social:
blog: "%{org} Blog"
facebook: "%{org} Facebook"
twitter: "%{org} Twitter"
youtube: "%{org} YouTube"
Expand Down
22 changes: 10 additions & 12 deletions config/locales/en/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@ en:
instagram_handle_description: "If filled in it will appear in the footer"
url: "Main URL"
url_description: "Main URL of your website"
org_name: "Organization"
org_name_description: "Name of your organization"
place_name: "Place"
place_name_description: "Name of your city"
org_name: "Site name"
org_name_description: "This name will appear on mailers subject, help pages..."
related_content_score_threshold: "Related content score threshold"
related_content_score_threshold_description: "Hides content that users mark as unrelated"
related_content_score_threshold_description: "According to the rating of votes in a related content, hides content that users mark as unrelated"
hot_score_period_in_days: "Period (days) used by the filter 'most active'"
hot_score_period_in_days_description: "The filter 'most active' used in multiple sections will be based on the votes during the last X days"
map_latitude: "Latitude"
Expand All @@ -61,7 +59,7 @@ en:
map_zoom: "Zoom"
map_zoom_description: "Zoom to show the map position"
mailer_from_name: "Sender email name"
mailer_from_name_description: "This name will appear in emails sent from the application"
mailer_from_name_description: "This name will appear as sender name in emails sent from the application"
mailer_from_address: "Sender email address"
mailer_from_address_description: "This email address will appear in emails sent from the application"
meta_title: "Site title (SEO)"
Expand All @@ -71,13 +69,13 @@ en:
meta_keywords: "Keywords (SEO)"
meta_keywords_description: 'Keywords <meta name="keywords">, used to improve SEO'
min_age_to_participate: Minimum age needed to participate
min_age_to_participate_description: "Users over this age can participate in all processes"
min_age_to_participate_description: "Users over this age can participate in all processes where a user verified account is needed"
analytics_url: "Analytics URL"
blog_url: "Blog URL"
transparency_url: "Transparency URL"
opendata_url: "Open Data URL"
verification_offices_url: Verification offices URL
proposal_improvement_path: Proposal improvement info internal link
proposal_notification_minimum_interval_in_days: "Minimum interval (in days) for authors of proposals to send new proposal notifications"
proposal_notification_minimum_interval_in_days_description: "The number of days user can send a notification for all supporters of their proposal"
direct_message_max_per_day: "Direct Message max number per day"
direct_message_max_per_day_description: "Number max of direct messages one user can send per day"
feature:
budgets: "Participatory budgeting"
budgets_description: "With participatory budgets, citizens decide which projects presented by their neighbours will receive a part of the municipal budget"
Expand Down Expand Up @@ -126,4 +124,4 @@ en:
public_stats: "Public stats"
public_stats_description: "Display public stats in the Administration panel"
help_page: "Help page"
help_page_description: "Displays a Help menu that contains a page with an info section about each enabled feature"
help_page_description: 'Displays a Help menu that contains a page with an info section about each enabled feature. Also custom pages and menus can be created in the "Custom pages" and "Custom content blocks" sections'
4 changes: 0 additions & 4 deletions config/locales/es/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1125,10 +1125,6 @@ es:
flash:
updated: Valor actualizado
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
update_setting: Actualizar
feature_flags: Funcionalidades
Expand Down
4 changes: 0 additions & 4 deletions config/locales/es/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ es:
available_locales: Idiomas disponibles
collaborative_legislation: Procesos legislativos
debates: Debates
external_link_blog: Blog
locale: 'Idioma:'
logo: Logo de CONSUL
management: Gestión
Expand Down Expand Up @@ -398,8 +397,6 @@ es:
guide: "Compártela para que la gente empiece a apoyarla."
edit: "Antes de que se publique podrás modificar el texto a tu gusto."
view_proposal: Ahora no, ir a mi propuesta
improve_info: "Mejora tu campaña y consigue más apoyos"
improve_info_link: "Ver más información"
already_supported: '¡Ya has apoyado esta propuesta, compártela!'
comments:
zero: Sin comentarios
Expand Down Expand Up @@ -623,7 +620,6 @@ es:
see_more: Ver más recomendaciones
hide: Ocultar recomendaciones
social:
blog: "Blog de %{org}"
facebook: "Facebook de %{org}"
twitter: "Twitter de %{org}"
youtube: "YouTube de %{org}"
Expand Down