mirror of https://github.com/docusealco/docuseal
Compare commits
28 Commits
9c700a3fb6
...
1f89accac3
| Author | SHA1 | Date |
|---|---|---|
|
|
1f89accac3 | 3 weeks ago |
|
|
9fcaef4cf7 | 3 weeks ago |
|
|
d5738a0631 | 3 weeks ago |
|
|
8bf7a1f95a | 3 weeks ago |
|
|
04cf36891e | 3 weeks ago |
|
|
b2d9948c30 | 3 weeks ago |
|
|
a2c9ac1707 | 3 weeks ago |
|
|
46a6bd0108 | 3 weeks ago |
|
|
5f069e7a40 | 3 weeks ago |
|
|
ff57e5c6ae | 3 weeks ago |
|
|
f65b6e2d76 | 3 weeks ago |
|
|
58fd180ae0 | 3 weeks ago |
|
|
cd6503c4c3 | 3 weeks ago |
|
|
e8b36c2b6d | 3 weeks ago |
|
|
51743f1359 | 3 weeks ago |
|
|
504c42646b | 3 weeks ago |
|
|
c61e84d1b4 | 3 weeks ago |
|
|
b8ab01c46c | 3 weeks ago |
|
|
9558060bde | 3 weeks ago |
|
|
0741c879f1 | 3 weeks ago |
|
|
2e6dd2867e | 3 weeks ago |
|
|
9f3fcccb61 | 4 weeks ago |
|
|
ae08d7abad | 4 weeks ago |
|
|
16808a7ec6 | 4 weeks ago |
|
|
b1dfcd6283 | 4 weeks ago |
|
|
369f4c0f08 | 4 weeks ago |
|
|
827de03579 | 4 weeks ago |
|
|
0c7f4e5b43 | 4 weeks ago |
@ -0,0 +1,27 @@
|
||||
import { target, targetable } from '@github/catalyst/lib/targetable'
|
||||
|
||||
export default targetable(class extends HTMLElement {
|
||||
static [target.static] = [
|
||||
'prompt',
|
||||
'processing',
|
||||
'logo'
|
||||
]
|
||||
|
||||
connectedCallback () {
|
||||
this.form.addEventListener('submit', this.onSubmit)
|
||||
}
|
||||
|
||||
disconnectedCallback () {
|
||||
this.form.removeEventListener('submit', this.onSubmit)
|
||||
}
|
||||
|
||||
onSubmit = () => {
|
||||
this.prompt.classList.add('hidden')
|
||||
this.processing.classList.remove('hidden')
|
||||
this.logo.classList.add('animate-bounce')
|
||||
}
|
||||
|
||||
get form () {
|
||||
return this.querySelector('form')
|
||||
}
|
||||
})
|
||||
@ -1,6 +1,6 @@
|
||||
<a target="_blank" href="<%= Docuseal::GITHUB_URL %>" rel="noopener noreferrer nofollow" class="relative flex items-center rounded-full px-2 py-0.5 text-xs leading-4 mt-1 text-base-content border border-base-300 tooltip tooltip-bottom" data-tip="Give a star on GitHub">
|
||||
<span class="flex items-center justify-between space-x-0.5 font-medium">
|
||||
<%= svg_icon('start', class: 'h-3 w-3') %>
|
||||
<span>16k</span>
|
||||
<span>17k</span>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@ -1 +1 @@
|
||||
<template-builder class="grid" data-editable="false" data-with-sign-yourself-button="<%= !@template.archived_at? %>" data-with-send-button="<%= !@template.archived_at? && can?(:create, @template.submissions.new(account: current_account)) %>" data-template="<%= @template_data %>"></template-builder>
|
||||
<template-builder class="grid" data-editable="false" data-with-sign-yourself-button="<%= !@template.archived_at? %>" data-with-send-button="<%= !@template.archived_at? && can?(:create, @template.submissions.new(account: current_account)) %>" data-template="<%= @template_data.to_json %>"></template-builder>
|
||||
|
||||
@ -1,18 +1,30 @@
|
||||
<div class="h-screen">
|
||||
<div
|
||||
class="text-center p-8 h-full flex items-center justify-center">
|
||||
<div>
|
||||
<%= render 'shared/logo', width: 50, height: 50, class: 'mx-auto animate-bounce' %>
|
||||
<span>
|
||||
<%= t('processing') %>...
|
||||
</span>
|
||||
<confirm-upload>
|
||||
<div class="h-screen">
|
||||
<div class="text-center p-8 h-full flex items-center justify-center">
|
||||
<div class="space-y-4">
|
||||
<div data-target="confirm-upload.logo" class="mx-auto">
|
||||
<%= render 'shared/logo', width: 50, height: 50, class: 'mx-auto' %>
|
||||
</div>
|
||||
<div data-target="confirm-upload.processing" class="hidden">
|
||||
<span><%= t('processing') %>...</span>
|
||||
</div>
|
||||
</div>
|
||||
<submit-form>
|
||||
<%= form_for '', url: templates_upload_path, method: :post, class: 'hidden' do %>
|
||||
<button type="submit"></button>
|
||||
<input name="url" value="<%= params[:url] %>">
|
||||
<input name="filename" value="<%= params[:filename] %>">
|
||||
<div data-target="confirm-upload.prompt">
|
||||
<p class="text-lg">
|
||||
<%= t('open_file_from') %>
|
||||
<a href="<%= params[:url] %>" target="_blank" class="link" rel="noopener noreferrer nofollow">
|
||||
<%= params[:filename].presence || params[:url] %>
|
||||
</a>
|
||||
</p>
|
||||
<div class="flex items-center justify-center gap-2 mt-4">
|
||||
<%= link_to t('cancel'), root_path, class: 'white-button w-44' %>
|
||||
<%= form_for '', url: templates_upload_path, method: :post do |f| %>
|
||||
<input type="hidden" name="url" value="<%= params[:url] %>">
|
||||
<input type="hidden" name="filename" value="<%= params[:filename] %>">
|
||||
<%= f.button button_title(title: t('open')), class: 'base-button w-44' %>
|
||||
<% end %>
|
||||
</submit-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</confirm-upload>
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe 'Templates Upload' do
|
||||
let!(:account) { create(:account) }
|
||||
let!(:user) { create(:user, account:) }
|
||||
|
||||
before do
|
||||
sign_in(user)
|
||||
end
|
||||
|
||||
context 'when url param is present' do
|
||||
let(:file_url) { 'https://example.com/document.pdf' }
|
||||
|
||||
before do
|
||||
stub_request(:get, file_url).to_return(
|
||||
body: Rails.root.join('spec/fixtures/sample-document.pdf').read,
|
||||
headers: { 'Content-Type' => 'application/pdf' }
|
||||
)
|
||||
end
|
||||
|
||||
it 'shows a confirm page and creates template on submit' do
|
||||
visit "/new?url=#{CGI.escape(file_url)}"
|
||||
|
||||
expect(page).to have_text('Open file from')
|
||||
expect(page).to have_link('example.com/document.pdf')
|
||||
|
||||
click_button 'Open'
|
||||
|
||||
expect(Template.last.name).to eq('document')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when url param is missing' do
|
||||
it 'redirects to root' do
|
||||
visit '/new'
|
||||
|
||||
expect(page).to have_current_path(root_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in new issue