diff --git a/app/javascript/application.js b/app/javascript/application.js index da94ac1f..104dd406 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -3,6 +3,7 @@ import { encodeMethodIntoRequestBody } from '@hotwired/turbo-rails/app/javascrip import { createApp, reactive } from 'vue' import TemplateBuilder from './template_builder/builder' +import './pdf_loader' import ToggleVisible from './elements/toggle_visible' import DisableHidden from './elements/disable_hidden' diff --git a/app/javascript/application.scss b/app/javascript/application.scss index 672e1b23..49efe35d 100644 --- a/app/javascript/application.scss +++ b/app/javascript/application.scss @@ -75,7 +75,7 @@ button[disabled] .enabled { @apply select base-input w-full font-normal; } -.bg-redact{ +.bg-redact { background: black; } @@ -109,7 +109,7 @@ button[disabled] .enabled { font: inherit; } -.autocomplete > div { +.autocomplete>div { @apply px-2 py-1 font-normal text-sm; } @@ -117,8 +117,8 @@ button[disabled] .enabled { background: #eee; } -.autocomplete > div:hover:not(.group), -.autocomplete > div.selected { +.autocomplete>div:hover:not(.group), +.autocomplete>div.selected { @apply bg-base-300; cursor: pointer; } @@ -129,3 +129,44 @@ button[disabled] .enabled { outline-offset: 3px; outline-color: hsl(var(--bc) / 0.2); } + +.my-display { + display: none; +} + +#loader { + background: rgba(0, 7, 14, 0.7); + text-align: center; + position: absolute; + top: 0em; + left: 0em; + padding: 20% 0px; + height: 100vh; + width: 100vw; + text-align: -webkit-center; +} + +.loader-animation { + width: 50px; + height: 50px; + border: 4px solid #fff; + border-top: 4px solid transparent; + border-radius: 50%; + animation: spin 1s linear infinite; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); +} + +@keyframes spin { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } +} + +.text-load { + color: #fff; + font-size: large; +} diff --git a/app/javascript/pdf_loader.js b/app/javascript/pdf_loader.js new file mode 100644 index 00000000..3dff5b13 --- /dev/null +++ b/app/javascript/pdf_loader.js @@ -0,0 +1,15 @@ +document.addEventListener("DOMContentLoaded", function () { + function showLoading() { + document.getElementById("loader").style.display = "block"; + } + var editTemplateLink = document.getElementById("edit-template-link"); + editTemplateLink.addEventListener("click", function (event) { + event.preventDefault(); + showLoading(); + + var template = this.getAttribute("data-template"); + setTimeout(function () { + window.location.href = template; + }, 3000); + }); +}); diff --git a/app/views/templates/_title.html.erb b/app/views/templates/_title.html.erb index 9aaffb01..7eb71c27 100644 --- a/app/views/templates/_title.html.erb +++ b/app/views/templates/_title.html.erb @@ -33,7 +33,7 @@ <% end %> <% end %> <% if !template.deleted_at? && can?(:update, template) %> - <%= link_to edit_template_path(template), class: 'btn btn-outline btn-sm', id: 'edit-template-link' do %> + <%= link_to edit_template_path(template), class: 'btn btn-outline btn-sm', id: 'edit-template-link', data: {template: edit_template_path(@template)} do %> <%= svg_icon('pencil', class: 'w-6 h-6') %> Edit @@ -41,26 +41,9 @@ <% end %> <% end %> - <% if template.deleted_at? && can?(:create, template) %> <%= button_to button_title(title: 'Restore', disabled_with: 'Restoring', icon: svg_icon('rotate', class: 'w-6 h-6')), template_restore_index_path(template), class: 'btn btn-outline btn-sm' %> <% end %> - - - + \ No newline at end of file diff --git a/app/views/templates/show.html.erb b/app/views/templates/show.html.erb index e61a479d..fba716b0 100644 --- a/app/views/templates/show.html.erb +++ b/app/views/templates/show.html.erb @@ -98,3 +98,8 @@ <% end %> + +
+
+
Loading...
+
\ No newline at end of file