diff --git a/app/components/follow_button_component.rb b/app/components/follow_button_component.rb index eb3f40344..e379883ee 100644 --- a/app/components/follow_button_component.rb +++ b/app/components/follow_button_component.rb @@ -10,6 +10,7 @@ def initialize(follower:, target:, name: nil) def before_render @i18n_key = @following ? ".unfollow" : ".follow" + @icon = @following ? "person-x-fill" : "person-plus-fill" if @signed_out @path = @target.is_a?(Federails::Actor) ? follow_remote_actor_path(@target) : @@ -28,7 +29,7 @@ def render? end erb_template <<-ERB - <%= button_to translate(@i18n_key, name: @name), @path, method: @method, class: "btn btn-primary" %> + <%= button_to safe_join([helpers.icon(@icon, ""), translate(@i18n_key, name: @name)], " "), @path, method: @method, class: "btn btn-primary" %> ERB private diff --git a/app/views/creators/show.html.erb b/app/views/creators/show.html.erb index 4c6af36dd..b31a2f7f1 100644 --- a/app/views/creators/show.html.erb +++ b/app/views/creators/show.html.erb @@ -1,14 +1,14 @@ <%= content_for :items do %>
-
+
<%= content_tag(:div, class: "text-center") do %> <%= content_tag(:h2) { @creator.name } %> -

@<%= @creator.actor.at_address if SiteSettings.federation_enabled? %>

+

@<%= @creator.actor.at_address if SiteSettings.federation_enabled? %>

<%= render FollowButtonComponent.new(follower: current_user, target: @creator) %> <% end %>
-
+
<%= content_tag(:p, class: "lead") { @creator.caption } if @creator.caption %> <%= content_tag(:p, class: "card-text") { markdownify @creator.notes } if @creator.notes %> <%= "#{policy_scope(Model).where(creator: @creator).count} #{Model.model_name.human count: policy_scope(Model).where(creator: @creator).count}" %> diff --git a/spec/components/follow_button_component_spec.rb b/spec/components/follow_button_component_spec.rb index 81a941601..051546068 100644 --- a/spec/components/follow_button_component_spec.rb +++ b/spec/components/follow_button_component_spec.rb @@ -22,7 +22,7 @@ end it "is labelled with the word Follow" do - expect(button).to include ">Follow" + expect(button).to include "Follow" end it "links to the create path for the target's follows resource" do # rubocop:todo RSpec/MultipleExpectations @@ -42,7 +42,7 @@ end it "is labelled with the word Unfollow" do - expect(button).to include ">Unfollow" + expect(button).to include "Unfollow" end it "links to the delete path for the target's follows resource" do # rubocop:todo RSpec/MultipleExpectations