From e8e920ee50f6818fa793b1ece366012dca6305bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 6 Jan 2021 19:36:06 +0100 Subject: [PATCH] Rename Widgets components to Widget So naming is consistent with the way Admin::Widget controllers are named. --- app/components/sdg/goals/show_component.html.erb | 4 ++-- .../feeds/debate_component.html.erb | 0 .../feeds/debate_component.rb | 2 +- .../feeds/feed_component.html.erb | 0 .../{widgets => widget}/feeds/feed_component.rb | 8 ++++---- .../feeds/participation_component.html.erb | 2 +- .../feeds/participation_component.rb | 2 +- .../feeds/process_component.html.erb | 0 .../feeds/process_component.rb | 2 +- .../feeds/proposal_component.html.erb | 0 .../feeds/proposal_component.rb | 2 +- app/views/welcome/_feeds.html.erb | 2 +- app/views/welcome/_processes.html.erb | 2 +- .../feeds/feed_component_spec.rb | 16 ++++++++-------- 14 files changed, 21 insertions(+), 21 deletions(-) rename app/components/{widgets => widget}/feeds/debate_component.html.erb (100%) rename app/components/{widgets => widget}/feeds/debate_component.rb (56%) rename app/components/{widgets => widget}/feeds/feed_component.html.erb (100%) rename app/components/{widgets => widget}/feeds/feed_component.rb (72%) rename app/components/{widgets => widget}/feeds/participation_component.html.erb (75%) rename app/components/{widgets => widget}/feeds/participation_component.rb (76%) rename app/components/{widgets => widget}/feeds/process_component.html.erb (100%) rename app/components/{widgets => widget}/feeds/process_component.rb (57%) rename app/components/{widgets => widget}/feeds/proposal_component.html.erb (100%) rename app/components/{widgets => widget}/feeds/proposal_component.rb (58%) rename spec/components/{widgets => widget}/feeds/feed_component_spec.rb (74%) diff --git a/app/components/sdg/goals/show_component.html.erb b/app/components/sdg/goals/show_component.html.erb index 788e1319a..44dfebc21 100644 --- a/app/components/sdg/goals/show_component.html.erb +++ b/app/components/sdg/goals/show_component.html.erb @@ -9,11 +9,11 @@ - <%= render Widgets::Feeds::ParticipationComponent.new(feeds) %> + <%= render Widget::Feeds::ParticipationComponent.new(feeds) %> <% if processes_feed %>
- <%= render Widgets::Feeds::FeedComponent.new(processes_feed) %> + <%= render Widget::Feeds::FeedComponent.new(processes_feed) %>
<% end %> diff --git a/app/components/widgets/feeds/debate_component.html.erb b/app/components/widget/feeds/debate_component.html.erb similarity index 100% rename from app/components/widgets/feeds/debate_component.html.erb rename to app/components/widget/feeds/debate_component.html.erb diff --git a/app/components/widgets/feeds/debate_component.rb b/app/components/widget/feeds/debate_component.rb similarity index 56% rename from app/components/widgets/feeds/debate_component.rb rename to app/components/widget/feeds/debate_component.rb index 28d726811..908348c56 100644 --- a/app/components/widgets/feeds/debate_component.rb +++ b/app/components/widget/feeds/debate_component.rb @@ -1,4 +1,4 @@ -class Widgets::Feeds::DebateComponent < ApplicationComponent +class Widget::Feeds::DebateComponent < ApplicationComponent attr_reader :debate def initialize(debate) diff --git a/app/components/widgets/feeds/feed_component.html.erb b/app/components/widget/feeds/feed_component.html.erb similarity index 100% rename from app/components/widgets/feeds/feed_component.html.erb rename to app/components/widget/feeds/feed_component.html.erb diff --git a/app/components/widgets/feeds/feed_component.rb b/app/components/widget/feeds/feed_component.rb similarity index 72% rename from app/components/widgets/feeds/feed_component.rb rename to app/components/widget/feeds/feed_component.rb index cf476382a..847202350 100644 --- a/app/components/widgets/feeds/feed_component.rb +++ b/app/components/widget/feeds/feed_component.rb @@ -1,4 +1,4 @@ -class Widgets::Feeds::FeedComponent < ApplicationComponent +class Widget::Feeds::FeedComponent < ApplicationComponent attr_reader :feed delegate :kind, to: :feed @@ -15,11 +15,11 @@ class Widgets::Feeds::FeedComponent < ApplicationComponent def item_component_class case kind when "proposals" - Widgets::Feeds::ProposalComponent + Widget::Feeds::ProposalComponent when "debates" - Widgets::Feeds::DebateComponent + Widget::Feeds::DebateComponent when "processes" - Widgets::Feeds::ProcessComponent + Widget::Feeds::ProcessComponent end end diff --git a/app/components/widgets/feeds/participation_component.html.erb b/app/components/widget/feeds/participation_component.html.erb similarity index 75% rename from app/components/widgets/feeds/participation_component.html.erb rename to app/components/widget/feeds/participation_component.html.erb index f19bd0e4f..e20bd6f34 100644 --- a/app/components/widgets/feeds/participation_component.html.erb +++ b/app/components/widget/feeds/participation_component.html.erb @@ -1,7 +1,7 @@
<% feeds.each do |feed| %> <% if feed_proposals?(feed) || feed_debates?(feed) %> - <%= render Widgets::Feeds::FeedComponent.new(feed) %> + <%= render Widget::Feeds::FeedComponent.new(feed) %> <% end %> <% end %>
diff --git a/app/components/widgets/feeds/participation_component.rb b/app/components/widget/feeds/participation_component.rb similarity index 76% rename from app/components/widgets/feeds/participation_component.rb rename to app/components/widget/feeds/participation_component.rb index f90b731c3..995e7bea0 100644 --- a/app/components/widgets/feeds/participation_component.rb +++ b/app/components/widget/feeds/participation_component.rb @@ -1,4 +1,4 @@ -class Widgets::Feeds::ParticipationComponent < ApplicationComponent +class Widget::Feeds::ParticipationComponent < ApplicationComponent attr_reader :feeds def initialize(feeds) diff --git a/app/components/widgets/feeds/process_component.html.erb b/app/components/widget/feeds/process_component.html.erb similarity index 100% rename from app/components/widgets/feeds/process_component.html.erb rename to app/components/widget/feeds/process_component.html.erb diff --git a/app/components/widgets/feeds/process_component.rb b/app/components/widget/feeds/process_component.rb similarity index 57% rename from app/components/widgets/feeds/process_component.rb rename to app/components/widget/feeds/process_component.rb index 5d9f79f0f..ab8065663 100644 --- a/app/components/widgets/feeds/process_component.rb +++ b/app/components/widget/feeds/process_component.rb @@ -1,4 +1,4 @@ -class Widgets::Feeds::ProcessComponent < ApplicationComponent +class Widget::Feeds::ProcessComponent < ApplicationComponent attr_reader :process def initialize(process) diff --git a/app/components/widgets/feeds/proposal_component.html.erb b/app/components/widget/feeds/proposal_component.html.erb similarity index 100% rename from app/components/widgets/feeds/proposal_component.html.erb rename to app/components/widget/feeds/proposal_component.html.erb diff --git a/app/components/widgets/feeds/proposal_component.rb b/app/components/widget/feeds/proposal_component.rb similarity index 58% rename from app/components/widgets/feeds/proposal_component.rb rename to app/components/widget/feeds/proposal_component.rb index 243bb0649..cbb6ae39b 100644 --- a/app/components/widgets/feeds/proposal_component.rb +++ b/app/components/widget/feeds/proposal_component.rb @@ -1,4 +1,4 @@ -class Widgets::Feeds::ProposalComponent < ApplicationComponent +class Widget::Feeds::ProposalComponent < ApplicationComponent attr_reader :proposal def initialize(proposal) diff --git a/app/views/welcome/_feeds.html.erb b/app/views/welcome/_feeds.html.erb index e200d2c42..acd2f3e1f 100644 --- a/app/views/welcome/_feeds.html.erb +++ b/app/views/welcome/_feeds.html.erb @@ -1 +1 @@ -<%= render Widgets::Feeds::ParticipationComponent.new(@feeds) %> +<%= render Widget::Feeds::ParticipationComponent.new(@feeds) %> diff --git a/app/views/welcome/_processes.html.erb b/app/views/welcome/_processes.html.erb index d6d3ee1ae..f4afb8bbf 100644 --- a/app/views/welcome/_processes.html.erb +++ b/app/views/welcome/_processes.html.erb @@ -1,7 +1,7 @@
<% @feeds.each do |feed| %> <% if feed_processes?(feed) %> - <%= render Widgets::Feeds::FeedComponent.new(feed) %> + <%= render Widget::Feeds::FeedComponent.new(feed) %> <% end %> <% end %>
diff --git a/spec/components/widgets/feeds/feed_component_spec.rb b/spec/components/widget/feeds/feed_component_spec.rb similarity index 74% rename from spec/components/widgets/feeds/feed_component_spec.rb rename to spec/components/widget/feeds/feed_component_spec.rb index 2e0d990e9..6eed7ef2a 100644 --- a/spec/components/widgets/feeds/feed_component_spec.rb +++ b/spec/components/widget/feeds/feed_component_spec.rb @@ -1,9 +1,9 @@ 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 feed = double(kind: "debates", items: []) - component = Widgets::Feeds::FeedComponent.new(feed) + component = Widget::Feeds::FeedComponent.new(feed) render_inline component @@ -15,7 +15,7 @@ describe Widgets::Feeds::FeedComponent, type: :component do let(:feed) { Widget::Feed.new(kind: "debates") } 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 @@ -23,7 +23,7 @@ describe Widgets::Feeds::FeedComponent, type: :component do end 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 @@ -35,7 +35,7 @@ describe Widgets::Feeds::FeedComponent, type: :component do let(:feed) { Widget::Feed.new(kind: "proposals") } 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 @@ -43,7 +43,7 @@ describe Widgets::Feeds::FeedComponent, type: :component do end 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 @@ -55,7 +55,7 @@ describe Widgets::Feeds::FeedComponent, type: :component do let(:feed) { Widget::Feed.new(kind: "processes") } 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 @@ -63,7 +63,7 @@ describe Widgets::Feeds::FeedComponent, type: :component do end 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