Skip to content

Commit

Permalink
Merge pull request danielstorey#6 from adamlesniak/master
Browse files Browse the repository at this point in the history
Add in ability to customize 'next' button
  • Loading branch information
danielstorey authored Feb 8, 2017
2 parents cb3de8e + f8995d3 commit 16137a3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ For core model attributes see [**core model attributes**](https://github.com/ada

**_component** (string): This value must be: `stacklist`.

**_items** (array): An array of text strings, each one representing one list item. Text may include html.
**_items** (array): Each item represents a sliding element.

>**description** (string): The main text for sliding item.
>**next** (string): This text becomes the 'next' button.
## Limitations

Expand Down
30 changes: 24 additions & 6 deletions example.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,29 @@
"displayTitle": "Stacklist",
"body": "",
"_items": [
"This component is useful for making boring text lists that little bit more interactive.",
"List items slide in from alternating sides.",
"There is no limit to the number of items you can have.",
"Although if you have too many it will be a bit boring.",
"At least now you get the gist of how this works.",
"That's pretty much it."
{
"body": "This component is useful for making boring text lists that little bit more interactive.",
"next": "Show me more!"
},
{
"body": "List items slide in from alternating sides.",
"next": "... and you can modify this text!"
},
{
"body": "There is no limit to the number of items you can have.",
"next": "It's localisation friendly"
},
{
"body": "Although if you have too many it will be a bit boring.",
"next": "... but you can customize it"
},
{
"body": "At least now you get the gist of how this works.",
"next": "I get 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("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

0 comments on commit 16137a3

Please sign in to comment.