adjust dashboard templates style

This commit is contained in:
Alex Turchyn
2023-06-28 00:22:34 +03:00
parent 897df83633
commit 9c9c1ad6f0
14 changed files with 166 additions and 150 deletions
+25 -11
View File
@@ -1,4 +1,4 @@
<%- if @templates.any? %>
<% if @templates.any? %>
<div class="flex justify-between mb-4">
<h1 class="text-4xl font-bold">Templates</h1>
<%= link_to new_template_path, class: 'btn btn-primary btn-md gap-2', data: { turbo_frame: :modal } do %>
@@ -8,24 +8,38 @@
</div>
<div class="grid gap-4 md:grid-cols-3">
<% @templates.each do |template| %>
<div class="card bg-base-300">
<div class="card-body">
<h2 class="card-title flex justify-between">
<%= link_to template.name, template_submissions_path(template) %>
<%= link_to 'Edit', template_path(template), class: 'btn btn-outline btn-xs' %>
</h2>
<div >
<p class="text-sm opacity-70 mb-1">Created by <%= template.author.full_name %></p>
<p class="flex items-center gap-1 text-xs opacity-50">
<div class="h-36 relative group">
<a href="<%= template_path(template) %>" class="flex h-full flex-col justify-between rounded-2xl pt-6 px-7 w-full bg-base-200 peer">
<div class="pb-4 text-xl font-semibold" style="overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;">
<%= template.name %>
</div>
<div class="pb-6 pt-1" >
<p class="flex items-center space-x-1 text-xs text-base-content/60">
<%= svg_icon('user', class: 'w-4 h-4') %>
<span><%= template.author.full_name %></span>
</p>
<p class="flex items-center space-x-1 text-xs text-base-content/60">
<%= svg_icon('calendar', class: 'w-4 h-4') %>
<span><%= l(template.created_at, format: :long) %></span>
</p>
</div>
</a>
<div class="absolute top-0 bottom-0 w-0 pt-7 space-y-1.5 hidden group-hover:block" style="right: 40px">
<a href="<%= edit_template_path(template) %>" class="btn btn-xs btn-outline bg-base-200 btn-circle">
<%= svg_icon('pencil', class: 'w-4 h-4') %>
</a>
<a href="<%= new_template_path(base_template_id: template.id) %>" data-turbo-frame="modal" class="btn btn-xs btn-outline bg-base-200 btn-circle">
<%= svg_icon('copy', class: 'w-4 h-4') %>
</a>
<%= button_to template_path(template), data: { turbo_confirm: 'Are you sure?' }, method: :delete, class: "btn btn-xs btn-outline bg-base-200 btn-circle" do %>
<%= svg_icon('trash', class: 'w-4 h-4 enabled') %>
<%= svg_icon('loader', class: 'w-4 h-4 animate-spin disabled') %>
<% end %>
</div>
</div>
<% end %>
</div>
<%= render 'shared/pagination', pagy: @pagy %>
<%= render 'shared/pagination', pagy: @pagy, items_name: 'Templates' %>
<% else %>
<div class="card bg-base-200 h-96 mb-2">
<div class="card-body text-center">