mirror of https://github.com/docusealco/docuseal
				
				
				
			
						commit
						4f94858901
					
				| @ -0,0 +1,17 @@ | |||||||
|  | export default class extends HTMLElement { | ||||||
|  |   connectedCallback () { | ||||||
|  |     this.querySelectorAll('input[type="checkbox"]').forEach(checkbox => { | ||||||
|  |       checkbox.addEventListener('change', this.handleChange) | ||||||
|  |     }) | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   handleChange = () => { | ||||||
|  |     if (this.checkedCount !== 0) { | ||||||
|  |       this.closest('form')?.requestSubmit() | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   get checkedCount () { | ||||||
|  |     return this.querySelectorAll('input[type="checkbox"]:checked').length | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -1,28 +1,31 @@ | |||||||
| <% content_for(:html_title, "#{@template.name} | DocuSeal") %> | <% content_for(:html_title, "#{@template.name} | DocuSeal") %> | ||||||
| <% content_for(:html_description, t('share_link_is_currently_disabled')) %> | <% I18n.with_locale(@template.account.locale) do %> | ||||||
| <div class="max-w-md mx-auto px-2 mt-12 mb-4"> |   <% content_for(:html_description, t('share_link_is_currently_disabled')) %> | ||||||
|   <div class="space-y-6 mx-auto"> | <% end %> | ||||||
|     <div class="space-y-6"> | <div class="max-w-md space-y-6 mx-auto px-2 mt-12 mb-4"> | ||||||
|       <div class="text-center w-full space-y-6"> |   <div class="text-center w-full space-y-6"> | ||||||
|         <%= render 'banner' %> |     <%= render 'banner' %> | ||||||
|         <p class="text-xl font-semibold text-center"> |     <p class="text-xl font-semibold text-center"> | ||||||
|           <%= t('share_link_is_currently_disabled') %> |       <%= t('share_link_is_currently_disabled') %> | ||||||
|         </p> |     </p> | ||||||
|  |   </div> | ||||||
|  |   <div class="flex items-center bg-base-200 rounded-xl p-4 mb-4"> | ||||||
|  |     <div class="flex items-center"> | ||||||
|  |       <div class="mr-3"> | ||||||
|  |         <%= svg_icon('writing_sign', class: 'w-10 h-10') %> | ||||||
|       </div> |       </div> | ||||||
|       <div class="flex items-center bg-base-200 rounded-xl p-4 mb-4"> |       <div> | ||||||
|         <div class="flex items-center"> |         <p class="text-lg font-bold mb-1"><%= @template.name %></p> | ||||||
|           <div class="mr-3"> |         <% if @template.archived_at? %> | ||||||
|             <%= svg_icon('writing_sign', class: 'w-10 h-10') %> |           <p dir="auto" class="text-sm"><%= t('form_has_been_deleted_by_html', name: @template.account.name) %></p> | ||||||
|           </div> |         <% end %> | ||||||
|           <div> |  | ||||||
|             <p class="text-lg font-bold mb-1"><%= @template.name %></p> |  | ||||||
|             <% if @template.archived_at? %> |  | ||||||
|               <p dir="auto" class="text-sm"><%= t('form_has_been_deleted_by_html', name: @template.account.name) %></p> |  | ||||||
|             <% end %> |  | ||||||
|           </div> |  | ||||||
|         </div> |  | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
|   </div> |   </div> | ||||||
|  |   <% if can?(:update, @template) %> | ||||||
|  |     <toggle-submit class="block"> | ||||||
|  |       <%= button_to button_title(title: t('enable_shared_link'), icon: svg_icon('lock_open', class: 'w-6 h-6')), template_share_link_path(@template), params: { template: { shared_link: true }, redir: start_form_path(slug: @template.slug) }, method: :post, class: 'white-button w-full' %> | ||||||
|  |     </toggle-submit> | ||||||
|  |   <% end %> | ||||||
| </div> | </div> | ||||||
| <%= render 'shared/attribution', link_path: '/start', account: @template.account %> | <%= render 'shared/attribution', link_path: '/start', account: @template.account %> | ||||||
|  | |||||||
| @ -0,0 +1,87 @@ | |||||||
|  | <% close_on_submit = local_assigns.fetch(:close_on_submit, true) %> | ||||||
|  | <%= form_for template, url: template_recipients_path(template), method: :post, html: { autocomplete: 'off', class: 'mt-1', id: :submitters_form }, data: { close_on_submit: } do |f| %> | ||||||
|  |   <% unless close_on_submit %> | ||||||
|  |     <toggle-on-submit data-element-id="form_saved_alert"></toggle-on-submit> | ||||||
|  |   <% end %> | ||||||
|  |   <div class="space-y-3 divide-y"> | ||||||
|  |     <% template.submitters.each_with_index do |submitter, index| %> | ||||||
|  |       <div class="<%= 'pt-3' if index.positive? %>"> | ||||||
|  |         <%= f.fields_for :submitters, item = Struct.new(:name, :uuid, :is_requester, :email, :invite_by_uuid, :optional_invite_by_uuid, :linked_to_uuid, :option).new(*submitter.values_at('name', 'uuid', 'is_requester', 'email', 'invite_by_uuid', 'optional_invite_by_uuid', 'linked_to_uuid')), index: do |ff| %> | ||||||
|  |           <% item.option = item.is_requester.present? ? 'is_requester' : (item.email.present? ? 'email' : (item.linked_to_uuid.present? ? "linked_to_#{item.linked_to_uuid}" : (item.invite_by_uuid.present? ? "invite_by_#{item.invite_by_uuid}" : (item.optional_invite_by_uuid.present? ? "optional_invite_by_#{item.optional_invite_by_uuid}" : '')))) %> | ||||||
|  |           <%= ff.hidden_field :uuid %> | ||||||
|  |           <div class="form-control"> | ||||||
|  |             <%= ff.text_field :name, class: 'w-full outline-none border-transparent focus:border-transparent focus:ring-0 bg-base-100 px-1 peer mb-2', autocomplete: 'off', placeholder: "#{index + 1}#{(index + 1).ordinal} Party", required: true %> | ||||||
|  |             <% if template.submitters.size == 2 %> | ||||||
|  |               <%= tag.input name: ff.field_name(:email), value: ff.object.email, type: :email, class: 'base-input', multiple: true, autocomplete: 'off', placeholder: t('default_email'), disabled: ff.object.is_requester || ff.object.invite_by_uuid.present? || ff.object.optional_invite_by_uuid.present?, id: field_uuid = SecureRandom.uuid %> | ||||||
|  |             <% else %> | ||||||
|  |               <toggle-attribute data-target-id="<%= email_field_uuid = SecureRandom.uuid %>" data-class-name="hidden" data-value="email"> | ||||||
|  |                 <%= ff.select :option, [[t('not_specified'), 'not_set'], (local_assigns[:with_submission_requester] != false ? [t('submission_requester'), 'is_requester'] : nil), [t('specified_email'), 'email'], *(template.submitters - [submitter]).flat_map { |e| [[t('invite_by_name', name: e['name']), "invite_by_#{e['uuid']}"], [t('invite_by_name', name: e['name']) + " (#{t(:optional).capitalize})", "optional_invite_by_#{e['uuid']}"]] }, *(template.submitters - [submitter]).map { |e| [t('same_as_name', name: e['name']), "linked_to_#{e['uuid']}"] }].compact, {}, class: 'base-select mb-3' %> | ||||||
|  |               </toggle-attribute> | ||||||
|  |               <%= tag.input name: ff.field_name(:email), type: :email, value: ff.object.email, multiple: true, class: "base-input #{'hidden' if item.option != 'email'}", autocomplete: 'off', placeholder: t('default_email'), id: email_field_uuid %> | ||||||
|  |             <% end %> | ||||||
|  |           </div> | ||||||
|  |           <% if template.submitters.size == 2 %> | ||||||
|  |             <checkbox-group class="mt-3 flex items-center space-x-4"> | ||||||
|  |               <% if local_assigns[:with_submission_requester] != false %> | ||||||
|  |                 <label class="flex items-center space-x-2 cursor-pointer"> | ||||||
|  |                   <toggle-attribute data-target-id="<%= field_uuid %>" class="flex" data-attribute="disabled"> | ||||||
|  |                     <%= ff.check_box :is_requester, class: 'base-checkbox' %> | ||||||
|  |                   </toggle-attribute> | ||||||
|  |                   <span class="select-none"> | ||||||
|  |                     <%= t('submission_requester') %> | ||||||
|  |                   </span> | ||||||
|  |                 </label> | ||||||
|  |               <% end %> | ||||||
|  |               <% if index == 1 %> | ||||||
|  |                 <label class="flex items-center space-x-2 cursor-pointer"> | ||||||
|  |                   <toggle-attribute data-target-id="<%= field_uuid %>" class="flex" data-attribute="disabled"> | ||||||
|  |                     <indeterminate-checkbox data-indeterminate="<%= ff.object.optional_invite_by_uuid.present? %>" data-show-indeterminate-id="invite_optional" data-name="<%= ff.field_name(:invite_by_uuid) %>" data-indeterminate-name="<%= ff.field_name(:optional_invite_by_uuid) %>" class="flex"> | ||||||
|  |                       <%= ff.check_box ff.object.optional_invite_by_uuid.present? ? :optional_invite_by_uuid : :invite_by_uuid, { class: 'base-checkbox' }, template.submitters.first['uuid'], '' %> | ||||||
|  |                     </indeterminate-checkbox> | ||||||
|  |                   </toggle-attribute> | ||||||
|  |                   <span class="select-none"> | ||||||
|  |                     <%= t('invite_by_name', name: template.submitters.first['name']) %> <span id="invite_optional" class="<%= 'hidden' if ff.object.optional_invite_by_uuid.blank? %>">(<%= t(:optional).capitalize %>)</span> | ||||||
|  |                   </span> | ||||||
|  |                 </label> | ||||||
|  |               <% end %> | ||||||
|  |             </checkbox-group> | ||||||
|  |           <% end %> | ||||||
|  |         <% end %> | ||||||
|  |       </div> | ||||||
|  |     <% end %> | ||||||
|  |   </div> | ||||||
|  | <% end %> | ||||||
|  | <% if local_assigns[:with_toggles] != false %> | ||||||
|  |   <% unless current_account.account_configs.exists?(key: AccountConfig::ENFORCE_SIGNING_ORDER_KEY, value: true) %> | ||||||
|  |     <%= form_for template, url: template_preferences_path(template), method: :post, html: { autocomplete: 'off', class: 'mt-2' }, data: { close_on_submit: false } do |f| %> | ||||||
|  |       <div class="flex items-center pt-4 mt-4 justify-between border-t w-full"> | ||||||
|  |         <span> | ||||||
|  |           <%= t('enforce_recipients_order') %> | ||||||
|  |         </span> | ||||||
|  |         <%= f.fields_for :preferences, Struct.new(:submitters_order).new(template.preferences['submitters_order']) do |ff| %> | ||||||
|  |           <%= ff.check_box :submitters_order, { class: 'toggle', onchange: 'this.form.requestSubmit()' }, 'preserved', '' %> | ||||||
|  |         <% end %> | ||||||
|  |       </div> | ||||||
|  |     <% end %> | ||||||
|  |   <% end %> | ||||||
|  |   <% if can?(:manage, :personalization_advanced) %> | ||||||
|  |     <%= form_for template, url: template_preferences_path(template), method: :post, html: { autocomplete: 'off', class: 'mt-2' }, data: { close_on_submit: false } do |f| %> | ||||||
|  |       <div class="flex items-center mt-4 justify-between w-full"> | ||||||
|  |         <span> | ||||||
|  |           <%= t('ensure_unique_recipients') %> | ||||||
|  |         </span> | ||||||
|  |         <%= f.fields_for :preferences, Struct.new(:validate_unique_submitters).new(template.preferences['validate_unique_submitters']) do |ff| %> | ||||||
|  |           <%= ff.check_box :validate_unique_submitters, { class: 'toggle', onchange: 'this.form.requestSubmit()' }, 'true', '' %> | ||||||
|  |         <% end %> | ||||||
|  |       </div> | ||||||
|  |     <% end %> | ||||||
|  |   <% end %> | ||||||
|  | <% end %> | ||||||
|  | <div class="form-control mt-5"> | ||||||
|  |   <%= button_tag button_title(title: t('save'), disabled_with: t('updating')), class: 'base-button', form: :submitters_form %> | ||||||
|  |   <% unless close_on_submit %> | ||||||
|  |     <div class="flex justify-center"> | ||||||
|  |       <span id="form_saved_alert" class="text-sm invisible font-normal mt-0.5"><%= t('changes_have_been_saved') %></span> | ||||||
|  |     </div> | ||||||
|  |   <% end %> | ||||||
|  | </div> | ||||||
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								| @ -0,0 +1,15 @@ | |||||||
|  | # frozen_string_literal: true | ||||||
|  | 
 | ||||||
|  | module ImageUtils | ||||||
|  |   module_function | ||||||
|  | 
 | ||||||
|  |   def blank?(image) | ||||||
|  |     min = (0...image.bands).map { |i| image.stats.getpoint(0, i)[0] } | ||||||
|  |     max = (0...image.bands).map { |i| image.stats.getpoint(1, i)[0] } | ||||||
|  | 
 | ||||||
|  |     return true if min.all?(255) && max.all?(255) | ||||||
|  |     return true if min.all?(0) && max.all?(0) | ||||||
|  | 
 | ||||||
|  |     false | ||||||
|  |   end | ||||||
|  | end | ||||||
					Loading…
					
					
				
		Reference in new issue