Skip to content

Commit

Permalink
For #1410: progress on MVF
Browse files Browse the repository at this point in the history
- retrieve data for cards
- XBL components for cards
- i18n
- remove old page and images
- configuration property
- try new images for quick links
  • Loading branch information
ebruchez committed Nov 29, 2022
1 parent fce9847 commit e0c8f9b
Show file tree
Hide file tree
Showing 23 changed files with 639 additions and 206 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,31 @@
//
//@import (reference) "form-runner-common";

html {
font-size: 13px; // Bootstrap 5 keeps the 16px browser default
}

body.orbeon {
padding-top: 52px;
}

.orbeon {
.card-footer .xforms-label {
margin-right: .2rem;
font-weight: bold;
&:after {
content: ":"
}
}

// 2022-11-28: This will not work with Firefox yet but it's cosmetic
.list-group-item:has(+ .xforms-repeat-begin-end) {
border-bottom: none;
}

.card-img-top {
border-top: 40px solid transparent;
border-right: 40px solid transparent;
border-left: 40px solid transparent;
}
}
22 changes: 14 additions & 8 deletions form-runner/jvm/src/main/resources/apps/fr/home/home.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
for $offset in frf:defaultTimezoneToOffsetString()
return xs:dayTimeDuration($offset)"/>

<xf:var
name="link-to-tokens"
value="xxf:split(xxf:property('oxf.fr.home.table.link-to'))"/>

<xf:action event="xforms-model-construct-done">

<!-- Initialize remote servers information only if user is logged in and has at least one matching role -->
Expand Down Expand Up @@ -971,12 +975,12 @@
<xh:th/>
<xh:th><xf:output value="$fr-resources/home/titles/status"/></xh:th>
</xf:group>
<xh:th><xf:output value="$fr-resources/home/titles/last-modified"/></xh:th>
<xh:th><xf:output value="$fr-resources/home/titles/modified"/></xh:th>
<xf:group ref=".[$remote-successful]">
<xf:group ref=".[$show-permissions]">
<xh:th><xf:output value="$fr-resources/home/titles/status"/></xh:th>
</xf:group>
<xh:th><xf:output value="$fr-resources/home/titles/last-modified"/></xh:th>
<xh:th><xf:output value="$fr-resources/home/titles/modified"/></xh:th>
</xf:group>
<xh:th><xf:output value="$fr-resources/home/titles/app"/></xh:th>
<xh:th><xf:output value="$fr-resources/home/titles/form"/></xh:th>
Expand All @@ -999,16 +1003,18 @@
<xf:var name="remote-available" value="frf:isRemoteAvailable(.)"/>
<xf:var name="remote-unavailable" value="frf:isRemoteUnavailable(.)"/>
<xf:var name="ops" value="xxf:split(@operations)"/>
<xf:var name="can-navigate-summary" value="$local-available and $ops = ('*', 'update', 'read', 'delete')"/>
<xf:var name="can-navigate-new" value="$local-available and $ops = ('*', 'create')"/>
<xf:var name="form-version" value="(form-version/string(), '1')[1]"/>

<xf:var
name="link-to"
value="xxf:split(xxf:property('oxf.fr.home.table.link-to'))[
(. = 'summary' and $can-navigate-summary) or
(. = 'new' and $can-navigate-new)
][1]"/>
value="
let $can-navigate-summary := $local-available and $ops = ('*', 'update', 'read', 'delete'),
$can-navigate-new := $local-available and $ops = ('*', 'create')
return
$link-to-tokens[
(. = 'summary' and $can-navigate-summary) or
(. = 'new' and $can-navigate-new)
][1]"/>

<xf:var
name="link"
Expand Down
256 changes: 232 additions & 24 deletions form-runner/jvm/src/main/resources/apps/fr/i18n/resources.xml

Large diffs are not rendered by default.

363 changes: 262 additions & 101 deletions form-runner/jvm/src/main/resources/apps/fr/landing/landing.xhtml

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions form-runner/jvm/src/main/resources/apps/fr/page-flow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,6 @@
<!-- ==== Pages ================================================================================================ -->

<!-- NOTE: Put those here as some URLs starting with /fr/service or /fr/page can erroneously match on those -->
<page path="/fr/landing" model="landing/landing.xhtml" view="html-view.xpl" default-submission="request-parameters.xml">
<setvalue ref="/*/app">*</setvalue>
<setvalue ref="/*/form">*</setvalue>
<setvalue ref="/*/mode">landing</setvalue>
</page>

<!-- Landing page -->
<page path="/fr/" model="landing/landing.xhtml" view="html-view.xpl" default-submission="request-parameters.xml">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@
</xf:group>
<xf:group ref="''[$show-last-modified]">
<xh:th>
<xf:output value="$fr-resources/summary/titles/last-modified"/>
<xf:output value="$fr-resources/summary/titles/modified"/>
</xh:th>
</xf:group>
<xf:group ref="''[$show-created-by]">
Expand Down
54 changes: 54 additions & 0 deletions form-runner/jvm/src/main/resources/xbl/orbeon/card/card.xbl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<xbl:xbl xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner">

<xbl:binding
id="fr-card"
element="fr|card"
xxbl:mode="lhha custom-lhha binding"
class="p-2"
>
<xbl:template
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xxbl:transform="oxf:unsafe-xslt"
>
<xh:div class="card h-100" xsl:version="2.0">

<xf:var name="binding" value="xxf:binding('fr-card')"/>
<xf:select ref="xf:element('_')" appearance="xxf:internal" id="hidden-select">
<xbl:content includes=":root > xf|itemset, :root > xf|item, :root > xf|choices"/>
</xf:select>
<xf:var name="items" value="xxf:itemset('hidden-select', 'xml')//item"/>

<xh:h5 class="card-title card-header"><xf:output value="xxf:label('fr-card')"/></xh:h5>
<xh:div class="card-body">
<xbl:content includes=":root > fr|card-body > *"/>
</xh:div>
<xh:ul class="list-group list-group-flush">
<xf:repeat ref="$items/value/string()">
<xf:var name="value" value="."/>
<xf:var name="label" value="$items[value = $value]/label/string()"/>
<xf:var name="hint" value="$items[value = $value]/hint/string()"/>
<xh:li class="list-group-item text-truncate">
<xh:a href="{{$value}}"><xf:output value="$label"/></xh:a>
<xh:br/>
<xf:output value="$hint"/>
</xh:li>
</xf:repeat>
</xh:ul>
<xsl:if test="exists(/*/fr:card-footer)">
<xh:div class="card-footer">
<xh:small class="text-muted">
<xbl:content includes=":root > fr|card-footer > *"/>
</xh:small>
</xh:div>
</xsl:if>
</xh:div>
</xbl:template>
</xbl:binding>
</xbl:xbl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<xbl:xbl xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner">

<xbl:binding
id="fr-link-card"
element="fr|link-card"
xxbl:mode="lhha custom-lhha binding"
class="p-2"
>
<xbl:template
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xxbl:transform="oxf:unsafe-xslt"
>
<xh:div class="card h-100" xsl:version="2.0">
<xh:h5 class="card-title card-header"><xf:output value="xxf:label('fr-link-card')"/></xh:h5>
<xh:img src="{/*/@img-src}" class="card-img-top" alt="{{xxf:label('fr-link-card')}}"/>

<xsl:if test="exists(/*/fr:card-body)">
<xh:div class="card-body">
<xbl:content includes=":root > fr|card-body > *"/>
</xh:div>
</xsl:if>

<xh:div class="card-body text-center">
<xh:a href="{/*/@href}" class="btn btn-light stretched-link">
<xf:output value="xxf:label('fr-link-card')"/>
</xh:a>
</xh:div>

<xsl:if test="exists(/*/fr:card-footer)">
<xh:div class="card-footer">
<xh:small class="text-muted">
<xbl:content includes=":root > fr|card-footer > *"/>
</xh:small>
</xh:div>
</xsl:if>
</xh:div>
</xbl:template>
</xbl:binding>
</xbl:xbl>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<examples title="Creating forms by writing XForms by hand"
xmlns:xh="http://www.w3.org/1999/xhtml">
<banner>
The examples below have been created by writing XForms by hand. If you are not a developer, instead, you might
be more interested in <xh:a href="./">creating forms with Form Builder</xh:a>.
The examples below have been created by writing XForms by hand. For Orbeon Form Runner,
see <xh:a href="/fr/">Form Runner</xh:a>.
</banner>
<example title="Espresso Order" href="/xforms-espresso/" img="/home/images/xforms-espresso-small.jpg" size="4"
source="http://www.flickr.com/photos/kubina/1469914113/">
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
-->
<controller xmlns="http://www.orbeon.com/oxf/controller" matcher="regexp">

<!-- Support "/home/" as well as "/" for portlets -->
<page path="/(home/)?" model="examples-form-runner.xml" view="view.xpl"/>
<page path="/home/xforms" model="examples-xforms.xml" view="view.xpl"/>
<page path="/home/xforms" model="examples-xforms.xml" view="view.xpl"/>

<epilogue url="oxf:/config/epilogue.xpl"/>
</controller>
2 changes: 2 additions & 0 deletions src/main/resources/config/properties-form-runner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,8 @@
<!-- Service processes -->
<property as="xs:string" name="oxf.fr.service.duplicate.transform.*.*" value=""/>

<property as="xs:string" name="oxf.fr.landing.cards" value="published-forms form-builder-forms demo-forms quick-links"/>

<property as="xs:integer" name="oxf.fr.home.page-size" value="20"/>
<property as="xs:string" name="oxf.fr.home.table.link-to" value="summary new"/>

Expand Down

0 comments on commit e0c8f9b

Please sign in to comment.