Skip to content

Commit

Permalink
Configurable separator
Browse files Browse the repository at this point in the history
  • Loading branch information
dlubitz committed Jun 26, 2023
1 parent 74aa9ee commit 13d9bcb
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 2 deletions.
30 changes: 30 additions & 0 deletions Migrations/ContentRepository/Version20230626175747.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
up:
comments: 'Migrate separator to old default'
migration:
-
filters:
-
type: 'NodeType'
settings:
nodeType: 'VIVOMEDIA.CountUp:CountUp'
transformations:
-
type: 'AddNewProperty'
settings:
newPropertyName: 'separator'
value: ','

down:
comments: 'Revert coloring bright to white'
migration:
-
filters:
-
type: 'NodeType'
settings:
nodeType: 'VIVOMEDIA.CountUp:CountUp'
transformations:
-
type: 'RemoveProperty'
settings:
property: 'separator'
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,11 @@
reloadIfChanged: true
inspector:
group: content
separator:
type: string
defaultValue: ''
ui:
label: i18n
reloadIfChanged: true
inspector:
group: content
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ You can use the NodeType `VIVOMEDIA.CountUp:CountUp` to add the CountUp function
The AFX component `VIVOMEDIA.CountUp:CountUpComponent` allows you to integrate the CountUp functionality to your own packages.



# Upgrade from 1.0
As the thousend separator default `,` has been removed and made configurable, you need to run the node migration if you want to keep the `,` as separator.
```
# Migrate 1000000 => 1,000,000
./flow node:migrate 20230626175747
```
# Screenshots
Expand Down
2 changes: 2 additions & 0 deletions Resources/Private/Fusion/Components/CountUp.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ prototype(VIVOMEDIA.CountUp:CountUpComponent) < prototype(Neos.Fusion:Component)
start = ${0}
end = ${0}
duration = ${0}
separator = ${','}

renderer = afx`
<span
Expand All @@ -17,6 +18,7 @@ prototype(VIVOMEDIA.CountUp:CountUpComponent) < prototype(Neos.Fusion:Component)
data-prefix={props.prefix}
data-suffix={props.suffix}
data-duration={props.duration}
data-separator={props.separator}
>{props.prefix}{props.end}{props.suffix}</span>
`
}
1 change: 1 addition & 0 deletions Resources/Private/Fusion/NodeTypes/CountUp.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ prototype(VIVOMEDIA.CountUp:CountUp) < prototype(Neos.Neos:ContentComponent) {
duration={q(node).property('duration')}
prefix={q(node).property('prefix')}
suffix={q(node).property('suffix')}
separator={q(node).property('separator')}
/>
<Neos.Neos:Editable property="text" />
</div>
Expand Down
4 changes: 4 additions & 0 deletions Resources/Private/Translations/de/NodeTypes/CountUp.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
<source>Suffix</source>
<target xml:lang="de" state="translated">Suffix</target>
</trans-unit>
<trans-unit id="properties.separator" xml:space="preserve">
<source>Separator</source>
<target xml:lang="de" state="translated">Tausendertrenner</target>
</trans-unit>
</body>
</file>
</xliff>
3 changes: 3 additions & 0 deletions Resources/Private/Translations/en/NodeTypes/CountUp.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<trans-unit id="properties.suffix" xml:space="preserve">
<source>Suffix</source>
</trans-unit>
<trans-unit id="properties.separator" xml:space="preserve">
<source>Separator</source>
</trans-unit>
</body>
</file>
</xliff>
3 changes: 2 additions & 1 deletion Resources/Public/JavaScript/countUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ $( document ).ready(function() {
startVal: $el.data('start'),
prefix: $el.data('prefix'),
suffix: $el.data('suffix'),
duration: $el.data('duration') ? $el.data('duration') / 1000 : 2
duration: $el.data('duration') ? $el.data('duration') / 1000 : 2,
separator: $el.data('separator') ? $el.data('separator') : ''
});
$(el).addClass('started').css('visibility', 'visible');
demo.start();
Expand Down

0 comments on commit 13d9bcb

Please sign in to comment.