Skip to content

Commit

Permalink
Add in backwards compatibility and default text for next button
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Lesniak committed Feb 8, 2017
1 parent 33fc759 commit f8995d3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
14 changes: 7 additions & 7 deletions example.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@
"body": "",
"_items": [
{
"description": "This component is useful for making boring text lists that little bit more interactive.",
"body": "This component is useful for making boring text lists that little bit more interactive.",
"next": "Show me more!"
},
{
"description": "List items slide in from alternating sides.",
"body": "List items slide in from alternating sides.",
"next": "... and you can modify this text!"
},
{
"description": "There is no limit to the number of items you can have.",
"body": "There is no limit to the number of items you can have.",
"next": "It's localisation friendly"
},
{
"description": "Although if you have too many it will be a bit boring.",
"body": "Although if you have too many it will be a bit boring.",
"next": "... but you can customize it"
},
{
"description": "At least now you get the gist of how this works.",
"body": "At least now you get the gist of how this works.",
"next": "I get it!"
},
{
"description": "That's pretty much it.",
"body": "That's pretty much it.",
"next": "Step 5"
}
}
]
}
4 changes: 3 additions & 1 deletion js/adapt-stacklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ define(function(require) {
setStage: function(stage) {
this.model.set("_stage", stage);

this.$(".stacklist-next").html(this.model.get("_items")[stage].next);
var nextButtonText = this.model.get("_items")[stage].next || "Next";
this.$(".stacklist-next").html(nextButtonText);

var $item = this.$(".stacklist-item").eq(stage);
$item.show();
var h = $item.outerHeight(true);
Expand Down
6 changes: 5 additions & 1 deletion templates/stacklist.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
<div class="stacklist-items">
{{#each _items}}
<div class="stacklist-item">
{{#if description}}{{{a11y_text description}}}{{/if}}
{{#if this.length}}
{{{a11y_text this}}}
{{else}}
{{{a11y_text body}}}
{{/if}}
</div>
{{/each}}
<div class="stacklist-button">
Expand Down

0 comments on commit f8995d3

Please sign in to comment.