Skip to content

Commit

Permalink
move edit and delete into a drop menu, and add report
Browse files Browse the repository at this point in the history
  • Loading branch information
Floppy committed Nov 29, 2024
1 parent 0da4438 commit 717b442
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions app/components/model_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@
<%= @model.name %>
</a>
<%= helpers.icon("explicit", Model.human_attribute_name(:sensitive)) if @model.sensitive %>
<span style="float: right"><%= helpers.status_badges(@model) %></span>
</div>
<div class='mt-2'>
<%= link_to t(".open_button.text"), @model, {class: "btn btn-primary btn-sm", "aria-label": translate(".open_button.label", name: @model.name)} %>
<%= link_to helpers.icon("pencil-fill", t(".edit_button.text")), edit_model_path(@model), {class: "btn btn-outline-secondary btn-sm", "aria-label": translate(".edit_button.label", name: @model.name)} if @can_edit %>
<%= link_to helpers.icon("trash", t(".delete_button.text")), model_path(@model), {method: :delete, class: "btn btn-outline-danger btn-sm", "aria-label": translate(".delete_button.label", name: @model.name), data: {confirm: translate("models.destroy.confirm")}} if @can_destroy %>
</div>
</div>
<div class="col-auto">
Expand All @@ -52,6 +46,24 @@
</small>
</div>
</div>
<div class="row">
<div class="col">
<%= link_to t(".open_button.text"), @model, {class: "btn btn-primary btn-sm", "aria-label": translate(".open_button.label", name: @model.name)} %>
<%= helpers.status_badges(@model) %>
<div class="float-end">
<div class="btn-group">
<a href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<%= helpers.icon "three-dots-vertical", t("general.menu") %>
</a>
<ul class="dropdown-menu dropdown-menu-end">
<li><%= link_to safe_join([helpers.icon("pencil-fill", t(".edit_button.text")), t(".edit_button.text")], " "), edit_model_path(@model), {class: "dropdown-item", "aria-label": translate(".edit_button.label", name: @model.name)} if @can_edit %></li>
<li><%= link_to safe_join([helpers.icon("trash", t(".delete_button.text")), t(".delete_button.text")], " "), model_path(@model), {method: :delete, class: "dropdown-item", data: {confirm: translate("models.destroy.confirm")}} if @can_destroy %></li>
<li><%= link_to safe_join([helpers.icon("flag", t("general.report", type: "")), t("general.report", type: "")], " "), new_model_report_path(@model), class: "dropdown-item" if SiteSettings.multiuser_enabled? %></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

0 comments on commit 717b442

Please sign in to comment.