add the ability to clone a template

This commit is contained in:
Alex Turchyn
2023-06-18 16:26:51 +00:00
parent 02fee9f885
commit 866bf7291d
6 changed files with 77 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" class="<%= local_assigns[:class] %>" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z" />
<path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2" />
</svg>

After

Width:  |  Height:  |  Size: 450 B

+5
View File
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" class="<%= local_assigns[:class] %>" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M4 20h4l10.5 -10.5a1.5 1.5 0 0 0 -4 -4l-10.5 10.5v4" />
<path d="M13.5 6.5l4 4" />
</svg>

After

Width:  |  Height:  |  Size: 378 B

+17 -4
View File
@@ -1,9 +1,22 @@
<div class="card card-compact bg-primary mb-12 md:card-normal">
<div class="card-body">
<h2 class="card-title text-4xl flex justify-between">
<%= @template.name %>
<%= link_to 'Edit', template_path(@template), class: 'btn btn-outline btn-sm' %>
</h2>
<div class="grid md:grid-cols-2 gap-4 md:flex md:justify-between">
<h2 class="card-title text-4xl ">
<%= @template.name %>
</h2>
<div class="flex md:justify-between space-x-2">
<%= link_to new_template_path(base_template_id: @template.id), class: 'btn btn-outline btn-sm', data: { turbo_frame: :modal } do %>
<%= svg_icon('copy', class: 'w-6 h-6') %>
<span>Clone</span>
<% end %>
<%= link_to template_path(@template), class: 'btn btn-outline btn-sm' do %>
<span class="flex items-center justify-center space-x-2">
<%= svg_icon('pencil', class: 'w-6 h-6') %>
<span>Edit</span>
</span>
<% end %>
</div>
</div>
<% if @template.submitters.size == 1 %>
<div class="join w-full">
<buttun class="btn bg-neutral btn-disabled text-white join-item">
+3
View File
@@ -1,5 +1,8 @@
<%= render 'shared/turbo_modal', title: 'New Template' do %>
<%= form_for @template, data: { turbo_frame: :_top } do |f| %>
<% if @base_template %>
<%= hidden_field_tag :base_template_id, @base_template.id %>
<% end %>
<div class="form-control my-6">
<%= f.text_field :name, required: true, placeholder: 'Template Name', class: 'base-input' %>
</div>