allow to disable stamp logo
This commit is contained in:
@@ -202,7 +202,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<li
|
<li
|
||||||
v-if="field.type != 'phone'"
|
v-if="field.type != 'phone' && field.type != 'stamp'"
|
||||||
@click.stop
|
@click.stop
|
||||||
>
|
>
|
||||||
<label class="cursor-pointer py-1.5">
|
<label class="cursor-pointer py-1.5">
|
||||||
@@ -215,6 +215,20 @@
|
|||||||
<span class="label-text">{{ t('required') }}</span>
|
<span class="label-text">{{ t('required') }}</span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
|
<li
|
||||||
|
v-if="field.type == 'stamp'"
|
||||||
|
@click.stop
|
||||||
|
>
|
||||||
|
<label class="cursor-pointer py-1.5">
|
||||||
|
<input
|
||||||
|
:checked="field.preferences?.with_logo != false"
|
||||||
|
type="checkbox"
|
||||||
|
class="toggle toggle-xs"
|
||||||
|
@change="[field.preferences ||= {}, field.preferences.with_logo = field.preferences.with_logo == false, save()]"
|
||||||
|
>
|
||||||
|
<span class="label-text">{{ t('with_logo') }}</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
<li
|
<li
|
||||||
v-if="field.type == 'checkbox'"
|
v-if="field.type == 'checkbox'"
|
||||||
@click.stop
|
@click.stop
|
||||||
@@ -257,8 +271,13 @@
|
|||||||
<span class="label-text">{{ t('read_only') }}</span>
|
<span class="label-text">{{ t('read_only') }}</span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<hr class="pb-0.5 mt-0.5">
|
<hr
|
||||||
<li>
|
v-if="field.type != 'stamp'"
|
||||||
|
class="pb-0.5 mt-0.5"
|
||||||
|
>
|
||||||
|
<li
|
||||||
|
v-if="field.type != 'stamp'"
|
||||||
|
>
|
||||||
<label
|
<label
|
||||||
class="label-text cursor-pointer text-center w-full flex items-center"
|
class="label-text cursor-pointer text-center w-full flex items-center"
|
||||||
@click="isShowDescriptionModal = !isShowDescriptionModal"
|
@click="isShowDescriptionModal = !isShowDescriptionModal"
|
||||||
@@ -271,7 +290,9 @@
|
|||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li
|
||||||
|
v-if="field.type != 'stamp'"
|
||||||
|
>
|
||||||
<label
|
<label
|
||||||
class="label-text cursor-pointer text-center w-full flex items-center"
|
class="label-text cursor-pointer text-center w-full flex items-center"
|
||||||
@click="isShowConditionsModal = !isShowConditionsModal"
|
@click="isShowConditionsModal = !isShowConditionsModal"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const en = {
|
const en = {
|
||||||
description: 'Description',
|
description: 'Description',
|
||||||
display_title: 'Display title',
|
display_title: 'Display title',
|
||||||
|
with_logo: 'With logo',
|
||||||
unchecked: 'Unchecked',
|
unchecked: 'Unchecked',
|
||||||
equal: 'Equal',
|
equal: 'Equal',
|
||||||
not_equal: 'Not equal',
|
not_equal: 'Not equal',
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ module Submitters
|
|||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
def call(submitter)
|
def call(submitter, with_logo: true)
|
||||||
image = generate_stamp_image(submitter)
|
image = generate_stamp_image(submitter, with_logo:)
|
||||||
|
|
||||||
image_data = image.write_to_buffer('.png')
|
image_data = image.write_to_buffer('.png')
|
||||||
|
|
||||||
@@ -30,8 +30,13 @@ module Submitters
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_stamp_image(submitter)
|
def generate_stamp_image(submitter, with_logo: true)
|
||||||
logo = Vips::Image.new_from_buffer(load_logo(submitter).read, '')
|
logo =
|
||||||
|
if with_logo
|
||||||
|
Vips::Image.new_from_buffer(load_logo(submitter).read, '')
|
||||||
|
else
|
||||||
|
Vips::Image.new_from_buffer(TRANSPARENT_PIXEL, '').resize(WIDTH)
|
||||||
|
end
|
||||||
|
|
||||||
logo = logo.resize([WIDTH / logo.width.to_f, HEIGHT / logo.height.to_f].min)
|
logo = logo.resize([WIDTH / logo.width.to_f, HEIGHT / logo.height.to_f].min)
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,9 @@ module Submitters
|
|||||||
next if field['submitter_uuid'] != submitter.uuid
|
next if field['submitter_uuid'] != submitter.uuid
|
||||||
|
|
||||||
if field['type'] == 'stamp'
|
if field['type'] == 'stamp'
|
||||||
acc[field['uuid']] ||= Submitters::CreateStampAttachment.call(submitter).uuid
|
acc[field['uuid']] ||=
|
||||||
|
Submitters::CreateStampAttachment.call(submitter,
|
||||||
|
with_logo: field.dig('preferences', 'with_logo') != false).uuid
|
||||||
|
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user