Skip to content

Commit d4e94ac

Browse files
authored
Merge from docusealco/wip
2 parents 13fa87c + 75bc789 commit d4e94ac

19 files changed

Lines changed: 279 additions & 160 deletions

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ ENV RAILS_ENV=production
4848
ENV BUNDLE_WITHOUT="development:test"
4949
ENV LD_PRELOAD=/lib/libgcompat.so.0
5050
ENV OPENSSL_CONF=/etc/openssl_legacy.cnf
51-
ENV VIPS_MAX_COORD=10000
51+
ENV VIPS_MAX_COORD=15000
5252

5353
WORKDIR /app
5454

@@ -80,7 +80,7 @@ COPY --chown=docuseal:docuseal ./log ./log
8080
COPY --chown=docuseal:docuseal ./lib ./lib
8181
COPY --chown=docuseal:docuseal ./public ./public
8282
COPY --chown=docuseal:docuseal ./tmp ./tmp
83-
COPY --chown=docuseal:docuseal LICENSE README.md Rakefile config.ru .version ./
83+
COPY --chown=docuseal:docuseal LICENSE LICENSE_ADDITIONAL_TERMS README.md Rakefile config.ru .version ./
8484
COPY --chown=docuseal:docuseal .version ./public/version
8585

8686
COPY --chown=docuseal:docuseal --from=download /fonts/GoNotoKurrent-Regular.ttf /fonts/GoNotoKurrent-Bold.ttf /fonts/DancingScript-Regular.otf /fonts/OFL.txt /fonts

LICENSE_ADDITIONAL_TERMS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Additional Terms
2+
3+
In accordance with Section 7(b) of the GNU Affero General Public License,
4+
a covered work must retain the original DocuSeal attribution in interactive
5+
user interfaces.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ At DocuSeal we have expertise and technologies to make documents creation, filli
9797

9898
## License
9999

100-
Distributed under the AGPLv3 License. See [LICENSE](https://github.com/docusealco/docuseal/blob/master/LICENSE) for more information.
101-
Unless otherwise noted, all files © 2023 DocuSeal LLC.
100+
Distributed under the AGPLv3 License with Section 7(b) Additional Terms. See [LICENSE](https://github.com/docusealco/docuseal/blob/master/LICENSE) and [LICENSE_ADDITIONAL_TERMS](https://github.com/docusealco/docuseal/blob/master/LICENSE_ADDITIONAL_TERMS) for more information.
101+
Unless otherwise noted, all files © 2023-2026 DocuSeal LLC.
102102

103103
## Tools
104104

app/controllers/submissions_export_controller.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ class SubmissionsExportController < ApplicationController
55
load_and_authorize_resource :submission, through: :template, parent: false, only: :index
66

77
def index
8-
submissions = @submissions.active
9-
.preload(submitters: { documents_attachments: :blob,
10-
attachments_attachments: :blob })
11-
.order(id: :asc)
8+
submissions = params[:archived] == 'true' ? @submissions.archived : @submissions.active
9+
10+
submissions = submissions.preload(submitters: { documents_attachments: :blob,
11+
attachments_attachments: :blob })
12+
.order(id: :asc)
1213

1314
submissions = Submissions.search(current_user, submissions, params[:q], search_values: true)
1415
submissions = Submissions::Filter.call(submissions, current_user, params)

app/controllers/submitters_autocomplete_controller.rb

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,34 @@ class SubmittersAutocompleteController < ApplicationController
77
LIMIT = 100
88

99
def index
10-
submitters = search_submitters(@submitters)
10+
field = SELECT_COLUMNS.find { |c| c == params[:field] }
11+
12+
submitters = search_submitters(@submitters, field)
1113

1214
arel_columns = SELECT_COLUMNS.map { |col| Submitter.arel_table[col] }
13-
values = submitters.limit(LIMIT).group(arel_columns).pluck(arel_columns)
15+
16+
values =
17+
if field
18+
max_ids = submitters.group(field).limit(LIMIT).select(Submitter.arel_table[:id].maximum)
19+
20+
submitters.where(id: max_ids).order(id: :desc).pluck(arel_columns)
21+
else
22+
submitters.limit(LIMIT).group(arel_columns).pluck(arel_columns)
23+
end
1424

1525
attrs = values.map { |row| SELECT_COLUMNS.zip(row).to_h }
16-
attrs = attrs.uniq { |e| e[params[:field]] } if params[:field].present?
1726

1827
render json: attrs
1928
end
2029

2130
private
2231

23-
def search_submitters(submitters)
24-
if SELECT_COLUMNS.include?(params[:field])
32+
def search_submitters(submitters, field)
33+
if field
2534
if Docuseal.fulltext_search?
26-
Submitters.fulltext_search_field(current_user, submitters, params[:q], params[:field])
35+
Submitters.fulltext_search_field(current_user, submitters, params[:q], field)
2736
else
28-
column = Submitter.arel_table[params[:field].to_sym]
37+
column = Submitter.arel_table[field.to_sym]
2938

3039
term = "#{params[:q].downcase}%"
3140

app/controllers/templates_clone_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def create
2121

2222
authorize!(:create, @template)
2323

24-
if params[:account_id].present? && true_ability.authorize!(:manage, Account.find(params[:account_id]))
24+
if params[:account_id].present? && true_ability.can?(:manage, Account.find(params[:account_id]))
2525
@template.account_id = params[:account_id]
2626
@template.author = true_user if true_user.account_id == @template.account_id
2727
@template.folder = @template.account.default_template_folder if @template.account_id != current_account.id

app/javascript/application.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,15 @@ safeRegisterElement('template-builder', class extends HTMLElement {
155155

156156
this.appElem.classList.add('md:h-screen')
157157

158+
const template = reactive(JSON.parse(this.dataset.template))
159+
158160
this.app = createApp(TemplateBuilder, {
159-
template: reactive(JSON.parse(this.dataset.template)),
161+
template,
160162
customFields: reactive(JSON.parse(this.dataset.customFields || '[]')),
161163
backgroundColor: '#faf7f5',
162164
locale: this.dataset.locale,
163165
withPhone: this.dataset.withPhone === 'true',
166+
withPrefillable: template.fields?.some((f) => f.prefillable),
164167
withVerification: ['true', 'false'].includes(this.dataset.withVerification) ? this.dataset.withVerification === 'true' : null,
165168
withKba: ['true', 'false'].includes(this.dataset.withKba) ? this.dataset.withKba === 'true' : null,
166169
withLogo: this.dataset.withLogo !== 'false',

app/javascript/elements/markdown_editor.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,11 @@ function loadTiptap () {
3636
}
3737

3838
class LinkTooltip {
39-
constructor (container, editor) {
39+
constructor (container, editor, templateEl) {
4040
this.container = container
4141
this.editor = editor
4242

43-
const template = document.createElement('template')
44-
45-
template.innerHTML = container.dataset.linkTooltipHtml
46-
47-
this.tooltip = template.content.firstElementChild
43+
this.tooltip = templateEl.content.firstElementChild.cloneNode(true)
4844

4945
this.input = this.tooltip.querySelector('input')
5046
this.saveButton = this.tooltip.querySelector('[data-role="link-save"]')
@@ -140,7 +136,8 @@ export default actionable(targetable(class extends HTMLElement {
140136
'boldButton',
141137
'italicButton',
142138
'underlineButton',
143-
'linkButton'
139+
'linkButton',
140+
'linkTooltipTemplate'
144141
]
145142

146143
async connectedCallback () {
@@ -256,7 +253,7 @@ export default actionable(targetable(class extends HTMLElement {
256253
}
257254
})
258255

259-
this.linkTooltip = new LinkTooltip(this, this.editor)
256+
this.linkTooltip = new LinkTooltip(this, this.editor, this.linkTooltipTemplate)
260257
}
261258

262259
adjustShortcutsForPlatform () {

app/javascript/template_builder/builder.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,11 @@ export default {
720720
required: false,
721721
default: false
722722
},
723+
withPrefillable: {
724+
type: Boolean,
725+
required: false,
726+
default: false
727+
},
723728
customFields: {
724729
type: Array,
725730
required: false,
@@ -948,13 +953,6 @@ export default {
948953
!submitter.email
949954
})
950955
},
951-
withPrefillable () {
952-
if (this.template.fields) {
953-
return this.template.fields.some((f) => f.prefillable)
954-
} else {
955-
return false
956-
}
957-
},
958956
isInlineSize () {
959957
return CSS.supports('container-type: size')
960958
},

app/javascript/template_builder/field.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<div
33
class="list-field group"
4+
:class="`list-field-${field.type}`"
45
>
56
<div
67
class="border border-base-300 rounded relative group fields-list-item"

0 commit comments

Comments
 (0)