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

Rearrange layout of creator profile #3008

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/components/follow_button_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) :
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions app/views/creators/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<%= content_for :items do %>
<div class="card mb-3">
<div class="card-body row">
<div class="col col-md-3">
<div class="col col-auto">
<%= content_tag(:div, class: "text-center") do %>
<%= content_tag(:h2) { @creator.name } %>
<p><small>@<%= @creator.actor.at_address if SiteSettings.federation_enabled? %></small></p>
<p><small class="text-secondary">@<%= @creator.actor.at_address if SiteSettings.federation_enabled? %></small></p>
<%= render FollowButtonComponent.new(follower: current_user, target: @creator) %>
<% end %>
</div>
<div class="col col-md-9">
<div class="col">
<%= 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}" %>
Expand Down
4 changes: 2 additions & 2 deletions spec/components/follow_button_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading