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

Add SDG view with related content #4292

Merged
merged 15 commits into from
Dec 28, 2020
Merged
Prev Previous commit
Next Next commit
Simplify debates and proposals feed layout
Using the `:only-child` selector we can adjust widths with CSS and don't
have to rely on methods calculating which features are available.
  • Loading branch information
javierm committed Dec 27, 2020
commit 98aea588e559d78e0dc8589ca325367fca6822fc
20 changes: 20 additions & 0 deletions app/assets/stylesheets/widgets/feeds/participation.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.feeds-participation {

.feed-debates,
.feed-proposals {
@include grid-col;
margin-top: $line-height;
}

.feed-proposals:not(:only-child) {
@include breakpoint(medium) {
width: 2 * 100% / 3;
}
}

.feed-debates:not(:only-child) {
@include breakpoint(medium) {
width: 1 * 100% / 3;
}
}
}
3 changes: 1 addition & 2 deletions app/components/widgets/feeds/debates_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<div id="feed_debates" class="small-12 column margin-top
<%= "medium-4" if feed_debates_and_proposals_enabled? %>">
<div id="feed_debates" class="feed-debates">
<div class="feed-content" data-equalizer-watch>
<h3 class="title"><%= t("welcome.feed.most_active.#{feed.kind}") %></h3>

Expand Down
1 change: 0 additions & 1 deletion app/components/widgets/feeds/debates_component.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Widgets::Feeds::DebatesComponent < ApplicationComponent
include FeedsHelper
attr_reader :feed

def initialize(feed)
Expand Down
3 changes: 1 addition & 2 deletions app/components/widgets/feeds/proposals_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<div id="feed_proposals" class="feed-proposals small-12 column margin-top
<%= "medium-8" if feed_debates_and_proposals_enabled? %>">
<div id="feed_proposals" class="feed-proposals">
<div class="feed-content" data-equalizer-watch>
<h3 class="title"><%= t("welcome.feed.most_active.#{feed.kind}") %></h3>

Expand Down
1 change: 0 additions & 1 deletion app/components/widgets/feeds/proposals_component.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class Widgets::Feeds::ProposalsComponent < ApplicationComponent
include FeedsHelper
attr_reader :feed

def initialize(feed)
Expand Down
12 changes: 0 additions & 12 deletions app/helpers/feeds_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,7 @@ def feed_processes?(feed)
feed.kind == "processes"
end

def feed_debates_enabled?
Setting["homepage.widgets.feeds.debates"].present?
end

def feed_proposals_enabled?
Setting["homepage.widgets.feeds.proposals"].present?
end

def feed_processes_enabled?
Setting["homepage.widgets.feeds.processes"].present?
end

def feed_debates_and_proposals_enabled?
feed_debates_enabled? && feed_proposals_enabled?
end
end
3 changes: 0 additions & 3 deletions spec/system/admin/homepage/homepage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@
expect(page).to have_content "Most active debates"
expect(page).to have_css(".debate", count: 3)
end

expect(page).to have_css("#feed_proposals.medium-8")
expect(page).to have_css("#feed_debates.medium-4")
end

scenario "Processes", :js do
Expand Down