-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3002 from manyfold3d/creator-profile
Creator profile
- Loading branch information
Showing
49 changed files
with
183 additions
and
475 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module ModelListable | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
include TagListable | ||
include Filterable | ||
end | ||
|
||
private | ||
|
||
def prepare_model_list | ||
# Work out policies for showing buttons up front | ||
@can_destroy = policy(Model).destroy? | ||
@can_edit = policy(Model).edit? | ||
|
||
# Ordering | ||
@models = case session["order"] | ||
when "recent" | ||
@models.order(created_at: :desc) | ||
else | ||
@models.order(name_lower: :asc) | ||
end | ||
|
||
@tags, @unrelated_tag_count = generate_tag_list(@models, @filter_tags) | ||
@tags, @kv_tags = split_key_value_tags(@tags) | ||
|
||
if helpers.pagination_settings["models"] | ||
page = params[:page] || 1 | ||
@models = @models.page(page).per(helpers.pagination_settings["per_page"]) | ||
end | ||
|
||
# Load extra data | ||
@models = @models.includes [:library, :model_files, :preview_file, :creator, :collection] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +0,0 @@ | ||
<div class="col-9"> | ||
<div class="row row-cols-2 align-items-baseline"> | ||
<% if !current_page?(root_path) %> | ||
<div class="ms-auto col col-auto mt-2 mb-2"> | ||
<%= link_to icon("book", t(".sort.name")), @filters.merge(order: "name"), class: "btn #{(session["order"] == "name") ? "btn-secondary" : "btn-outline-secondary"} btn-sm" %> | ||
<%= link_to icon("clock", t(".sort.time")), @filters.merge(order: "recent"), class: "btn #{(session["order"] == "recent") ? "btn-secondary" : "btn-outline-secondary"} btn-sm" %> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div class="float-end mb-3"> | ||
<%= link_to icon("book", t(".sort.name")), @filters.merge(order: "name"), class: "btn #{(session["order"] == "name") ? "btn-secondary" : "btn-outline-secondary"} btn-sm" %> | ||
<%= link_to icon("clock", t(".sort.time")), @filters.merge(order: "recent"), class: "btn #{(session["order"] == "recent") ? "btn-secondary" : "btn-outline-secondary"} btn-sm" %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<%= content_for :items do %> | ||
<div class="card mb-3"> | ||
<div class="card-body row"> | ||
<div class="col col-md-3"> | ||
<%= content_tag(:div, class: "text-center") do %> | ||
<%= content_tag(:h2) { @creator.name } %> | ||
<p><small>@<%= @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"> | ||
<%= 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}" %> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> | ||
<% content_for :actions do %> | ||
<%= link_to safe_join([icon("pencil", t(".edit")), t(".edit")], " "), edit_creator_path(@creator), class: "btn btn-primary" if policy(@creator).edit? %> | ||
<% end %> | ||
<%= render "models/list" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<% content_for :items do %> | ||
<% if @models.empty? %> | ||
<div class="alert alert-info"> | ||
<%= icon "person-arms-up", "" %> | ||
<%= t(".no_results_html") %> | ||
</div> | ||
<% else %> | ||
<div class="skip-link-container"> | ||
<div class="clearfix"> | ||
<%= skip_link "sidebar", t(".skip_models") %> | ||
<%= render "order_buttons" %> | ||
<% if pagination_settings["models"] %> | ||
<%= paginate @models %> | ||
<% end %> | ||
</div> | ||
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 mb-4"> | ||
<%= render ModelComponent.with_collection(@models, can_edit: @can_edit, can_destroy: @can_destroy) %> | ||
</div> | ||
<% if pagination_settings["models"] %> | ||
<%= paginate @models %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<% content_for :actions do %> | ||
<%= link_to t(".bulk_edit"), edit_models_path(@filters.merge(@additional_filters)), class: "btn btn-secondary" if policy(:model).edit? %> | ||
<% if @collection %> | ||
<%= render FollowButtonComponent.new(follower: current_user, target: @collection, name: @collection.name) %> | ||
<% end %> | ||
<% end %> | ||
<% content_for :sidebar do %> | ||
<%= render "filters_card" %> | ||
<%= render "tags_card" %> | ||
<% end %> |
Oops, something went wrong.