Skip to content

Commit

Permalink
For #6518: form templates UI and selection
Browse files Browse the repository at this point in the history
  • Loading branch information
ebruchez committed Sep 26, 2024
1 parent 3456f63 commit b030062
Show file tree
Hide file tree
Showing 11 changed files with 654 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,65 @@ body.orbeon {
width: 1010px; // larger so that tab titles in French, in particular, fit
max-width: none;

.fb-settings-mode-new, .fb-settings-mode-app-form {
.nav-tabs {
display: none;
}
.tab-content {
border-top: 1px solid #ddd;
border-radius: @baseBorderRadius; // nicer when there are no tabs (arguably in all cases)
}
}

.fb-dialog-form-settings-fields {

div.fb-template-cards { // try to make stronger
display: flex;
flex-wrap: wrap;
gap: 1em;
min-height: 190px;
max-height: 390px;
overflow-y: scroll;
padding: 5px; // so that selection outline/shadow is not clipped
justify-content: space-evenly;

& > span {
display: none;
}

.fb-template-card {
width: 150px;
height: 170px;
display: flex;
flex-direction: column;
white-space: nowrap;
border: 1px solid #ddd;
padding: .5em;
border-radius: 10px;
row-gap: 2px;

&.xforms-repeat-selected-item-1 {
border-color: @focusBorderColor;
.focusDecorations();
}

.fb-template-title {
overflow-x: hidden;
text-overflow: ellipsis;
//text-decoration: underline;
text-align: center;
min-height: 2em;
border-bottom: 2px solid #ddd;
}
.fb-template-screenshot {
img {
margin: 0;
}
}
}
}
}

.popover.xforms-help-popover {
// Override `white-space: pre-wrap` which we set by default following
// https://github.com/orbeon/orbeon-forms/issues/1618. That works for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -737,11 +737,27 @@
event('control-settings-elems')[exists(@*)]
)"/>

<!-- Load a specific form template to get started -->
<xf:send
if="event('mode') = 'new' and xxf:non-blank(event('template-url'))"
submission="fr-get-document-submission">
<xf:property name="data-or-draft" value="'data'"/>
<xf:property name="document-url" value="event('template-url')"/>
<xf:property name="for" value="'load-template'" xxf:tunnel="true"/>
</xf:send>

</xf:action>
<!-- Continuation of `fr-get-document-submission` after success loading the form template -->
<xf:action
observer="fr-get-document-submission"
event="xforms-submit-done"
if="event('for') = 'load-template'">
<xf:dispatch name="fb-data-ready" targetid="fr-form-model"/>
</xf:action>
<!-- Update app/form name if changed -->
<xf:action
event="fb-update-metadata"
if="bind('application-name-bind') != event('app') or bind('form-name-bind') != event('form')">
if="event('mode') = 'new' or bind('application-name-bind') != event('app') or bind('form-name-bind') != event('form')">

<!-- Copy data to main instance -->
<xf:setvalue ref="bind('application-name-bind')" value="event('app')"/>
Expand All @@ -752,21 +768,28 @@
<xf:property name="deannotate" value="true()"/>
</xf:dispatch>
</xf:action>
<!-- "Save as" -->
<!-- *After* app/form name change, continue the process in `app-form` mode -->
<xf:action
event="fb-update-metadata"
if="event('mode') = 'save-as'">
<!-- Create new document id -->
<xf:setvalue
ref="xxf:instance('fr-parameters-instance')/document"
value="secure:randomHexId()"/>
<!-- Actually save -->
<xf:action type="xpath">
fbf:saveAs(
fr:document-id()
)
</xf:action>
if="event('mode') = 'app-form'"
type="xpath">
fr:run-process('oxf.fr.detail.process', 'resume')
</xf:action>
<!-- "Save as" -->
<!-- <xf:action-->
<!-- event="fb-update-metadata"-->
<!-- if="event('mode') = 'save-as'">-->
<!-- &lt;!&ndash; Create new document id &ndash;&gt;-->
<!-- <xf:setvalue-->
<!-- ref="xxf:instance('fr-parameters-instance')/document"-->
<!-- value="secure:randomHexId()"/>-->
<!-- &lt;!&ndash; Actually save &ndash;&gt;-->
<!-- <xf:action type="xpath">-->
<!-- fbf:saveAs(-->
<!-- fr:document-id()-->
<!-- )-->
<!-- </xf:action>-->
<!-- </xf:action>-->
</fb:dialog-form-settings>

<fb:dialog-email-settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
<!-- Mode = "new": just annotate template -->
<xf:action ev:event="fb-data-ready" if="$mode = 'new'">

<!-- <xf:message>xxx data ready for new</xf:message>-->

<!-- Point to template -->
<xf:var name="template" value="instance('fr-form-instance')"/>

Expand Down
Loading

0 comments on commit b030062

Please sign in to comment.