Skip to content

Commit

Permalink
fix promoted conferences (#17)
Browse files Browse the repository at this point in the history
* fix promoted conferences

* css corrections

* fix specs
  • Loading branch information
microstudi committed Sep 13, 2023
1 parent bae3ced commit 497f1ad
Show file tree
Hide file tree
Showing 17 changed files with 116 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Decidim
module Conferences
module ContentBlocks
module HighlightedConferencesCellOverride
def highlighted_conferences
Decidim::Conference.where(organization: current_organization, promoted: true).order(start_date: :asc)
end
end
end
end
end
2 changes: 1 addition & 1 deletion app/cells/decidim/content_blocks/active_processes/show.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<section id="active-processes" class="extended home-section">
<div class="wrapper-home">
<div class="row column">
<h3 class="section-heading"><%= t(".title") %></h3>
<!-- <h3 class="section-heading"><%= t(".title") %></h3> -->
<div class="text-center">
<div class="row small-up-1 medium-up-<%= items.size %>">
<% items.each do |item| %>
Expand Down
6 changes: 3 additions & 3 deletions app/cells/decidim/content_blocks/partner_logos/show.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
<div class="wrapper-home">
<div class="row column text-center">
<h2 class="heading3"><%= I18n.t(".decidim.content_blocks.partner_logos.title1") %></h2>
<div class="row small-up-1 medium-up-<%= [first_row.size, 3].min %> home-bullets">
<div class="row small-up-1 large-up-<%= [first_row.size, 6].min %> medium-up-<%= [first_row.size, 3].min %> home-bullets big-logos">
<% first_row.each do |image_path| %>
<div class="column">
<%= image_tag image_path %>
</div>
<% end %>
</div>
<h2 class="heading3"><%= I18n.t(".decidim.content_blocks.partner_logos.title2") %></h2>
<div class="row small-up-1 medium-up-<%= [second_row.size, 3].min %> home-bullets">
<div class="row small-up-1 large-up-<%= [second_row.size, 6].min %> medium-up-<%= [second_row.size, 3].min %> home-bullets big-logos">
<% second_row.each do |image_path| %>
<div class="column">
<%= image_tag image_path %>
</div>
<% end %>
</div>
<h2 class="heading3"><%= I18n.t(".decidim.content_blocks.partner_logos.title3") %></h2>
<div class="row small-up-1 medium-up-<%= [third_row.size, 3].min %> home-bullets">
<div class="row small-up-1 large-up-<%= [third_row.size, 6].min %> medium-up-<%= [third_row.size, 3].min %> home-bullets">
<% third_row.each do |image_path| %>
<div class="column">
<%= image_tag image_path %>
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/concerns/conferences_controller_override.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def collection
conferences
end

def promoted_conferences
@promoted_conferences ||= conferences.promoted
end

def custom_hashtags
@custom_hashtags ||= Rails.application.secrets.custom_conference_types.map { |item| item[:hashtag] }
end
Expand Down
2 changes: 2 additions & 0 deletions app/packs/stylesheets/capital_of_democracy.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@import "partials/variables";
@import "partials/basics";
@import "partials/header";
@import "partials/navbar";
@import "partials/hero";
@import "partials/footer";
@import "partials/stats";
Expand Down
3 changes: 2 additions & 1 deletion app/packs/stylesheets/partials/_active_processes_card.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#active-processes {
.card {
background-color: $grey-color;
background-color: transparent;
border: none;
}

.card-header {
Expand Down
6 changes: 6 additions & 0 deletions app/packs/stylesheets/partials/_basics.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
a {
color: $capitalitat-blue;
}
.button.secondary {
background-color: $capitalitat-blue;
}
7 changes: 7 additions & 0 deletions app/packs/stylesheets/partials/_conferences.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#highlighted_conferences {
background-color: #fff !important;
.card {
border: none;
}
}

@each $class, $color in $classes-colors {
.button.#{$class} {
@include button-styles($color);
Expand Down
7 changes: 7 additions & 0 deletions app/packs/stylesheets/partials/_footer.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
@media print, screen and (min-width: 64em) {
.main-footer__badge {
position: absolute;
top: -2rem;
}
}

.main-footer,
.mini-footer {
background-color: $capitalitat-violet !important;
Expand Down
41 changes: 23 additions & 18 deletions app/packs/stylesheets/partials/_html_block.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.promo-video {
background-color: $capitalitat-violet !important;
// background-color: $capitalitat-violet !important;
padding: 4rem 0;
@media print, screen and (max-width: 40em) {
padding: 0;
Expand Down Expand Up @@ -27,28 +27,33 @@
}
.home-bullets {
.column {
margin: 2rem 0;
margin: 0 0 2rem 0;
}
}
background-color: $capitalitat-violet !important;
.column img {
height: 70px;
}
.column {
@media print, screen and (max-width: 40em) {
margin-top: 2rem;
img {
height: 50px;
}
}
height: 30px;
}
.full-height {
.column {
padding-right: 2rem;
padding-left: 2rem;
img {
height: auto;
}
.big-logos {
.column img {
height: 50px;
}
}
// .column {
// @media print, screen and (max-width: 40em) {
// margin-top: 2rem;
// img {
// height: 50px;
// }
// }
// }
// .full-height {
// .column {
// padding-right: 2rem;
// padding-left: 2rem;
// img {
// height: auto;
// }
// }
// }
}
31 changes: 31 additions & 0 deletions app/packs/stylesheets/partials/_navbar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.main-nav__link a {
color: #fff;
}
.topbar__search {
button {
background: $capitalitat-blue;
}
.input-group-field {
border: 1px solid $capitalitat-violet !important;
}
}
.hide-for-medium {
.topbar__search {
.input-group-field {
border: none !important;
}
}
}
.topbar__search:not(:focus-within) button {
background-color: rgba(255, 255, 255, 0.02);
color: #fff;
filter: none;
}
.title-bar a:focus, .title-bar .button:focus, .title-bar .meeting-polls__button:focus {
outline-color: $capitalitat-violet;
}
@media print, screen and (min-width: 40em) {
.topbar__search:not(:focus-within) button {
background: $capitalitat-violet;
}
}
1 change: 1 addition & 0 deletions config/initializers/conferences_hacks.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

Rails.application.config.to_prepare do
Decidim::Conferences::ContentBlocks::HighlightedConferencesCell.prepend(Decidim::Conferences::ContentBlocks::HighlightedConferencesCellOverride)
Decidim::StatisticCell.include(Decidim::StatisticCellOverride)
Decidim::CardMCell.include(Decidim::ConferenceCellExtensions)
Decidim::Conferences::ConferenceMCell.include(Decidim::ConferenceCellExtensions)
Expand Down
4 changes: 4 additions & 0 deletions config/locales/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
ca:
decidim:
conferences:
pages:
home:
highlighted_conferences:
active_conferences: Actes destacats
custom_conference_types:
activity: Activitats Paral·leles
city: Actes de la ciutat
Expand Down
4 changes: 4 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
en:
decidim:
conferences:
pages:
home:
highlighted_conferences:
active_conferences: Highlighted acts
custom_conference_types:
activity: Parallel activities
city: City acts
Expand Down
4 changes: 4 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
es:
decidim:
conferences:
pages:
home:
highlighted_conferences:
active_conferences: Actos destacados
custom_conference_types:
activity: Actividades paralelas
city: Actos de la ciudad
Expand Down
3 changes: 2 additions & 1 deletion spec/lib/overrides_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
files: {
"/app/controllers/decidim/conferences/conferences_controller.rb" => "797899ada946b487a3c8c7312f0c14eb",
"/app/models/decidim/conference.rb" => "8d7b097f3dc4d626b6972f380332b713",
"/app/cells/decidim/conferences/conference_m_cell.rb" => "d2b5f21f279c9464230244dea2287098"
"/app/cells/decidim/conferences/conference_m_cell.rb" => "d2b5f21f279c9464230244dea2287098",
"/app/cells/decidim/conferences/content_blocks/highlighted_conferences_cell.rb" => "9107d774637aca2a4acfbe2c47426484"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions spec/system/conferences_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
it "shows the #{type} conference link and its content" do
expected_text = I18n.t("decidim.conferences.custom_conference_types.#{type}")

within "#conferences-grid" do
within "#conferences-filter" do
expect(page).to have_link(text: /#{expected_text}/i)
end

Expand All @@ -42,7 +42,7 @@
end

describe "Checking each conference type link" do
conference_types_local = %w(activity city international)
conference_types_local = %w(city international activity)

conference_types_local.each do |type|
it_behaves_like "checks the conference link", type
Expand Down

0 comments on commit 497f1ad

Please sign in to comment.