Skip to content

Commit

Permalink
Add title on day/month/year, for #2221
Browse files Browse the repository at this point in the history
  • Loading branch information
avernet committed Nov 5, 2015
1 parent 1230ae9 commit 47b9c41
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 61 deletions.
68 changes: 12 additions & 56 deletions src/resources-packaged/xbl/orbeon/dropdown-date/dropdown-date.xbl
Expand Up @@ -101,56 +101,6 @@
<days/>
</xf:instance>

<xf:instance id="orbeon-resources" xxf:readonly="true">
<resources>
<resource xml:lang="en">
<year>Year</year>
<month>Month</month>
<day>Day</day>
</resource>
<resource xml:lang="es">
<year>Año</year>
<month>Mes</month>
<day>Día</day>
</resource>
<resource xml:lang="fi">
<year>Vuosi</year>
<month>Kuukausi</month>
<day>Päivä</day>
</resource>
<resource xml:lang="fr">
<year>Année</year>
<month>Mois</month>
<day>Jour</day>
</resource>
<resource xml:lang="it">
<year>Anno</year>
<month>Mese</month>
<day>Giorno</day>
</resource>
<resource xml:lang="de">
<year>Jahr</year>
<month>Monat</month>
<day>Tag</day>
</resource>
<resource xml:lang="sv">
<year>År</year>
<month>Månad</month>
<day>Dag</day>
</resource>
<resource xml:lang="nl">
<year>Jaar</year>
<month>Maand</month>
<day>Dag</day>
</resource>
<resource xml:lang="pt">
<year>Ano</year>
<month>Mês</month>
<day>Dia</day>
</resource>
</resources>
</xf:instance>

<!-- Initialize itemsets upon initialization -->
<xf:action ev:event="xforms-model-construct-done">
<xf:var name="start-year" value="saxon:evaluate(xxf:property('oxf.xforms.xbl.fr.dropdown-date.start-year'))" as="xs:integer"/>
Expand Down Expand Up @@ -210,29 +160,35 @@
<!-- Don't show fields at all in static readonly mode -->
<!-- NOTE: navindex is copied to first field, but need one for second field too! -->
<xf:var name="month-first" value="starts-with(xxf:property('oxf.xforms.format.input.date'), '[M]')"/>
<xf:select1 ref="if ($month-first) then month else day" id="select1">
<xf:var name="ref-1" value="if ($month-first) then month else day "/>
<xf:var name="ref-2" value="if ($month-first) then day else month"/>
<xf:var name="label-1" value="xxf:r(concat('components.date-time.', if ($month-first) then 'month' else 'day' ), '|fr-fr-resources|')"/>
<xf:var name="label-2" value="xxf:r(concat('components.date-time.', if ($month-first) then 'day' else 'month'), '|fr-fr-resources|')"/>
<xf:var name="label-3" value="xxf:r('components.date-time.year', '|fr-fr-resources|')"/>

<xf:select1 ref="$ref-1" id="select1" xxf:title="{$label-1}">
<xf:item>
<xf:label value="if ($month-first) then xxf:r('month') else xxf:r('day')"/>
<xf:label value="$label-1"/>
<xf:value/>
</xf:item>
<xf:itemset ref="if ($month-first) then instance('months-itemset')/month else instance('days-itemset')/day">
<xf:label ref="."/>
<xf:value ref="."/>
</xf:itemset>
</xf:select1>
<xf:select1 ref="if ($month-first) then day else month">
<xf:select1 ref="$ref-2" xxf:title="{$label-2}">
<xf:item>
<xf:label value="if ($month-first) then xxf:r('day') else xxf:r('month')"/>
<xf:label value="$label-2"/>
<xf:value/>
</xf:item>
<xf:itemset ref="if ($month-first) then instance('days-itemset')/day else instance('months-itemset')/month">
<xf:label ref="."/>
<xf:value ref="."/>
</xf:itemset>
</xf:select1>
<xf:select1 ref="year" xbl:attr="navindex navindex=tabindex">
<xf:select1 ref="year" xxf:title="{$label-3}" xbl:attr="navindex navindex=tabindex">
<xf:item>
<xf:label value="xxf:r('year')"/>
<xf:label value="$label-3"/>
<xf:value/>
</xf:item>
<xf:itemset ref="instance('years-itemset')/year">
Expand Down
17 changes: 12 additions & 5 deletions src/resources-packaged/xbl/orbeon/fields-date/fields-date.xbl
Expand Up @@ -124,13 +124,20 @@

<xf:group class="fr-component-group">

<!-- Don't show fields at all in static readonly mode -->
<xf:group ref=".[not(is-readonly = 'true' and property('xxf:readonly-appearance') = 'static')]">
<!-- Don't show fields at all in static readonly mode -->
<!-- NOTE: navindex is copied to first field, but need one for second field too! -->

<xf:var name="month-first" value="starts-with(xxf:property('oxf.xforms.format.input.date'), '[M]')"/>
<xf:input ref="if ($month-first) then month else day" class="fr-width-2digits" xbl:attr="navindex navindex=tabindex" id="input"/>
<xf:input ref="if ($month-first) then day else month" class="fr-width-2digits"/>
<xf:input ref="year" class="fr-width-4digits"/>
<xf:var name="ref-1" value="if ($month-first) then month else day "/>
<xf:var name="ref-2" value="if ($month-first) then day else month"/>
<xf:var name="title-1" value="xxf:r(concat('components.date-time.', if ($month-first) then 'month' else 'day' ), '|fr-fr-resources|')"/>
<xf:var name="title-2" value="xxf:r(concat('components.date-time.', if ($month-first) then 'day' else 'month'), '|fr-fr-resources|')"/>
<xf:var name="title-3" value="xxf:r('components.date-time.year', '|fr-fr-resources|')"/>

<!-- navindex is copied to first field, but need one for second field too! -->
<xf:input ref="$ref-1" xxf:title="{$title-1}" class="fr-width-2digits" xbl:attr="navindex navindex=tabindex" id="input"/>
<xf:input ref="$ref-2" xxf:title="{$title-2}" class="fr-width-2digits"/>
<xf:input ref="year" xxf:title="{$title-3}" class="fr-width-4digits"/>
</xf:group>

<!-- React to update to local values -->
Expand Down
55 changes: 55 additions & 0 deletions src/resources/apps/fr/i18n/resources.xml
Expand Up @@ -89,6 +89,11 @@
<remove>Remove</remove>
<menu>Menu</menu>
</grid>
<date-time>
<year>Year</year>
<month>Month</month>
<day>Day</day>
</date-time>
</components>
<untitled-form>Untitled Form</untitled-form>
<errors>
Expand Down Expand Up @@ -381,6 +386,11 @@
<remove>Supprimer</remove>
<menu>Menu</menu>
</grid>
<date-time>
<year>Année</year>
<month>Mois</month>
<day>Jour</day>
</date-time>
</components>
<untitled-form>Formulaire sans titre</untitled-form>
<errors>
Expand Down Expand Up @@ -677,6 +687,11 @@
<remove>Remover</remove>
<menu todo="true">Menu</menu>
</grid>
<date-time>
<year>Año</year>
<month>Mes</month>
<day>Día</day>
</date-time>
</components>
<untitled-form>Formulario sin Título</untitled-form>
<errors>
Expand Down Expand Up @@ -959,6 +974,11 @@
<remove todo="true">[Remove]</remove>
<menu todo="true">Menu</menu>
</grid>
<date-time>
<year todo="true">Year</year>
<month todo="true">Month</month>
<day todo="true">Day</day>
</date-time>
</components>
<untitled-form todo="true">[Untitled Form]</untitled-form>
<errors>
Expand Down Expand Up @@ -1240,6 +1260,11 @@
<remove todo="true">[Remove]</remove>
<menu todo="true">Menu</menu>
</grid>
<date-time>
<year todo="true">Year</year>
<month todo="true">Month</month>
<day todo="true">Day</day>
</date-time>
</components>
<untitled-form todo="true">[Untitled Form]</untitled-form>
<errors>
Expand Down Expand Up @@ -1518,6 +1543,11 @@
<remove>Rimuovi</remove>
<menu todo="true">Menu</menu>
</grid>
<date-time>
<year>Anno</year>
<month>Mese</month>
<day>Giorno</day>
</date-time>
</components>
<untitled-form>Modulo senza nome</untitled-form>
<errors>
Expand Down Expand Up @@ -1809,6 +1839,11 @@
<remove>Löschen</remove>
<menu todo="true">Menu</menu>
</grid>
<date-time>
<year>Jahr</year>
<month>Monat</month>
<day>Tag</day>
</date-time>
</components>
<untitled-form>Formular ohne Namen</untitled-form>
<errors>
Expand Down Expand Up @@ -2100,6 +2135,11 @@
<remove>Poista</remove>
<menu todo="true">Menu</menu>
</grid>
<date-time>
<year>Vuosi</year>
<month>Kuukausi</month>
<day>Päivä</day>
</date-time>
</components>
<untitled-form>Nimetön lomake</untitled-form>
<errors>
Expand Down Expand Up @@ -2391,6 +2431,11 @@
<remove>Ta bort</remove>
<menu>Meny</menu>
</grid>
<date-time>
<year>År</year>
<month>Månad</month>
<day>Dag</day>
</date-time>
</components>
<untitled-form>Formulär utan titel</untitled-form>
<errors>
Expand Down Expand Up @@ -2682,6 +2727,11 @@
<remove>Verwijderen</remove>
<menu todo="true">Menu</menu>
</grid>
<date-time>
<year>Jaar</year>
<month>Maand</month>
<day>Dag</day>
</date-time>
</components>
<untitled-form>Naamloos form</untitled-form>
<errors>
Expand Down Expand Up @@ -2973,6 +3023,11 @@
<remove>Remove</remove>
<menu todo="true">Menu</menu>
</grid>
<date-time>
<year>Ano</year>
<month>Mês</month>
<day>Dia</day>
</date-time>
</components>
<untitled-form>Formulário sem título</untitled-form>
<errors>
Expand Down

0 comments on commit 47b9c41

Please sign in to comment.