Skip to content

Instantly share code, notes, and snippets.

View panchew's full-sized avatar

Francisco Guzmán panchew

View GitHub Profile
$.each box, (key, value) ->
# Insert a container with a 'Click to sign' button that replaces the signature (mobile devices)
mobileSignatureContainer = '<div id="mobile-signature-container">'
mobileSignatureContainer += '<img id="signature_img_' + $(value).data('component-id') + '" class="signature-img" data-component-id="'
mobileSignatureContainer += $(value).data('component-id') + '"><br/>'
mobileSignatureContainer += '<a href="#" id="sign_button_' + $(value).data('component-id') + '" class="btn btn-info btn-xs mobile-sign-button" '
mobileSignatureContainer += 'data-component-id="' + $(value).data('component-id') + '">Click to sign</a>'
mobileSignatureContainer += '</div>'
$(value).parent().before(mobileSignatureContainer)
@panchew
panchew / _form.html.erb
Created June 23, 2023 17:27
For HelloText
<%= form_with(model: section, url: url, local: true, class: 'form', id: 'product_section_form') do |f| %>
<% if section.errors.any? %>
<div id="error_explanation">
<h3><%= pluralize(section.errors.count, "error") %> prohibited this product section from being saved:</h3>
<ul>
<% section.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>