Rename Widgets components to Widget

So naming is consistent with the way Admin::Widget controllers are
named.
This commit is contained in:
Javi Martín
2021-01-06 19:36:06 +01:00
parent 52d71b8432
commit e8e920ee50
14 changed files with 21 additions and 21 deletions

View File

@@ -9,11 +9,11 @@
</header> </header>
</article> </article>
<%= render Widgets::Feeds::ParticipationComponent.new(feeds) %> <%= render Widget::Feeds::ParticipationComponent.new(feeds) %>
<% if processes_feed %> <% if processes_feed %>
<div class="feeds-list"> <div class="feeds-list">
<%= render Widgets::Feeds::FeedComponent.new(processes_feed) %> <%= render Widget::Feeds::FeedComponent.new(processes_feed) %>
</div> </div>
<% end %> <% end %>
</div> </div>

View File

@@ -1,4 +1,4 @@
class Widgets::Feeds::DebateComponent < ApplicationComponent class Widget::Feeds::DebateComponent < ApplicationComponent
attr_reader :debate attr_reader :debate
def initialize(debate) def initialize(debate)

View File

@@ -1,4 +1,4 @@
class Widgets::Feeds::FeedComponent < ApplicationComponent class Widget::Feeds::FeedComponent < ApplicationComponent
attr_reader :feed attr_reader :feed
delegate :kind, to: :feed delegate :kind, to: :feed
@@ -15,11 +15,11 @@ class Widgets::Feeds::FeedComponent < ApplicationComponent
def item_component_class def item_component_class
case kind case kind
when "proposals" when "proposals"
Widgets::Feeds::ProposalComponent Widget::Feeds::ProposalComponent
when "debates" when "debates"
Widgets::Feeds::DebateComponent Widget::Feeds::DebateComponent
when "processes" when "processes"
Widgets::Feeds::ProcessComponent Widget::Feeds::ProcessComponent
end end
end end

View File

@@ -1,7 +1,7 @@
<div class="row margin-bottom feeds-list feeds-participation"> <div class="row margin-bottom feeds-list feeds-participation">
<% feeds.each do |feed| %> <% feeds.each do |feed| %>
<% if feed_proposals?(feed) || feed_debates?(feed) %> <% if feed_proposals?(feed) || feed_debates?(feed) %>
<%= render Widgets::Feeds::FeedComponent.new(feed) %> <%= render Widget::Feeds::FeedComponent.new(feed) %>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>

View File

@@ -1,4 +1,4 @@
class Widgets::Feeds::ParticipationComponent < ApplicationComponent class Widget::Feeds::ParticipationComponent < ApplicationComponent
attr_reader :feeds attr_reader :feeds
def initialize(feeds) def initialize(feeds)

View File

@@ -1,4 +1,4 @@
class Widgets::Feeds::ProcessComponent < ApplicationComponent class Widget::Feeds::ProcessComponent < ApplicationComponent
attr_reader :process attr_reader :process
def initialize(process) def initialize(process)

View File

@@ -1,4 +1,4 @@
class Widgets::Feeds::ProposalComponent < ApplicationComponent class Widget::Feeds::ProposalComponent < ApplicationComponent
attr_reader :proposal attr_reader :proposal
def initialize(proposal) def initialize(proposal)

View File

@@ -1 +1 @@
<%= render Widgets::Feeds::ParticipationComponent.new(@feeds) %> <%= render Widget::Feeds::ParticipationComponent.new(@feeds) %>

View File

@@ -1,7 +1,7 @@
<div class="feeds-list"> <div class="feeds-list">
<% @feeds.each do |feed| %> <% @feeds.each do |feed| %>
<% if feed_processes?(feed) %> <% if feed_processes?(feed) %>
<%= render Widgets::Feeds::FeedComponent.new(feed) %> <%= render Widget::Feeds::FeedComponent.new(feed) %>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>

View File

@@ -1,9 +1,9 @@
require "rails_helper" require "rails_helper"
describe Widgets::Feeds::FeedComponent, type: :component do describe Widget::Feeds::FeedComponent, type: :component do
it "renders a message when there are no items" do it "renders a message when there are no items" do
feed = double(kind: "debates", items: []) feed = double(kind: "debates", items: [])
component = Widgets::Feeds::FeedComponent.new(feed) component = Widget::Feeds::FeedComponent.new(feed)
render_inline component render_inline component
@@ -15,7 +15,7 @@ describe Widgets::Feeds::FeedComponent, type: :component do
let(:feed) { Widget::Feed.new(kind: "debates") } let(:feed) { Widget::Feed.new(kind: "debates") }
it "points to the debates path for homepage debates feeds" do it "points to the debates path for homepage debates feeds" do
component = Widgets::Feeds::FeedComponent.new(feed) component = Widget::Feeds::FeedComponent.new(feed)
render_inline component render_inline component
@@ -23,7 +23,7 @@ describe Widgets::Feeds::FeedComponent, type: :component do
end end
it "points to the debates filtered by goal for goal feeds" do it "points to the debates filtered by goal for goal feeds" do
component = Widgets::Feeds::FeedComponent.new(SDG::Widget::Feed.new(feed, SDG::Goal[6])) component = Widget::Feeds::FeedComponent.new(SDG::Widget::Feed.new(feed, SDG::Goal[6]))
render_inline component render_inline component
@@ -35,7 +35,7 @@ describe Widgets::Feeds::FeedComponent, type: :component do
let(:feed) { Widget::Feed.new(kind: "proposals") } let(:feed) { Widget::Feed.new(kind: "proposals") }
it "points to the proposals path for homepage proposals feeds" do it "points to the proposals path for homepage proposals feeds" do
component = Widgets::Feeds::FeedComponent.new(feed) component = Widget::Feeds::FeedComponent.new(feed)
render_inline component render_inline component
@@ -43,7 +43,7 @@ describe Widgets::Feeds::FeedComponent, type: :component do
end end
it "points to the proposals filtered by goal for goal feeds" do it "points to the proposals filtered by goal for goal feeds" do
component = Widgets::Feeds::FeedComponent.new(SDG::Widget::Feed.new(feed, SDG::Goal[6])) component = Widget::Feeds::FeedComponent.new(SDG::Widget::Feed.new(feed, SDG::Goal[6]))
render_inline component render_inline component
@@ -55,7 +55,7 @@ describe Widgets::Feeds::FeedComponent, type: :component do
let(:feed) { Widget::Feed.new(kind: "processes") } let(:feed) { Widget::Feed.new(kind: "processes") }
it "points to the legislation processes path for homepage processes feeds" do it "points to the legislation processes path for homepage processes feeds" do
component = Widgets::Feeds::FeedComponent.new(feed) component = Widget::Feeds::FeedComponent.new(feed)
render_inline component render_inline component
@@ -63,7 +63,7 @@ describe Widgets::Feeds::FeedComponent, type: :component do
end end
it "points to the legislation processes path for goal processes feeds" do it "points to the legislation processes path for goal processes feeds" do
component = Widgets::Feeds::FeedComponent.new(SDG::Widget::Feed.new(feed, SDG::Goal[6])) component = Widget::Feeds::FeedComponent.new(SDG::Widget::Feed.new(feed, SDG::Goal[6]))
render_inline component render_inline component