Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to v5 #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ For core model attributes see [**core model attributes**](https://github.com/ada
No known limitations

----------------------------
**Version number:** 4.0.0
**Framework versions:** >=4
**Version number:** 5.0.0
**Framework versions:** >=5
**Author / maintainer:** Dan Storey
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "adapt-stacklist",
"description": "Items fly in one at a time, alternating from left to right, when the learner clicks a button. Demo available.",
"version": "4.0.0",
"framework": ">=4",
"version": "5.0.1",
"framework": ">=5",
"displayName": "Stack List",
"component": "stacklist",
"main": "/js/adapt-stacklist.js",
Expand Down
24 changes: 12 additions & 12 deletions js/adapt-stacklist.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
define(function(require) {

var ComponentView = require('coreViews/componentView');
var Adapt = require('coreJS/adapt');
define([
'core/js/adapt',
'coreViews/componentView'
], function(Adapt, ComponentView) {

var StackList = ComponentView.extend({

TRANSITION_TIME: 250,

events: {
"click .stacklist-next": "nextItem"
"click .stacklist__next": "nextItem"
},

preRender: function() {
Expand All @@ -18,8 +18,8 @@ define(function(require) {
},

postRender: function() {
this.$items = this.$(".stacklist-item");
this.$button = this.$('.stacklist-button');
this.$items = this.$(".stacklist__item");
this.$button = this.$('.stacklist__button');

if (!this.model.get("_isComplete") || this.model.get("_isResetOnRevisit")) {
this.setupListItems();
Expand Down Expand Up @@ -85,7 +85,7 @@ define(function(require) {

var items = this.model.get("_items");
var isComplete = this.model.get("_items").length - 1 === stage;
var $item = this.$(".stacklist-item").eq(stage);
var $item = this.$(".stacklist__item").eq(stage);

$item.removeClass("visibility-hidden");

Expand All @@ -112,13 +112,13 @@ define(function(require) {
},

updateButton: function(text, offset, ariaLabel) {
this.$(".stacklist-button").css({ top: "+=" + offset });
this.$(".stacklist__button").css({ top: "+=" + offset });

if (text === '') { // On last item we do not want to update text (it's most important when stack-list has only one item)
return;
}

var $button = this.$(".stacklist-next");
var $button = this.$(".stacklist__next");
$button.blur();
setTimeout(function() {
$button.html(text);
Expand All @@ -127,8 +127,8 @@ define(function(require) {
},

onComplete: function() {
var $buttonDiv = this.$(".stacklist-button");
var $button = this.$(".stacklist-next");
var $buttonDiv = this.$(".stacklist__button");
var $button = this.$(".stacklist__next");
$buttonDiv.css({ opacity: 0 });

setTimeout(function() {
Expand Down
74 changes: 40 additions & 34 deletions less/stacklist.less
Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
.stacklist-items {
position: relative;
margin-bottom: -@item-margin;
}

.stacklist-item {
position: relative;
padding: 20px;
margin-bottom: @item-margin;
background-color: @primary-color;
color: @primary-color-inverted;

&.show {
position: static !important;
}
}

.stacklist-button {
display: none;
position: absolute;
top: 0;
height: 53px;
width: 100%;
text-align: center;
-webkit-transition: 0.25s;
-moz-transition: 0.25s;
-ms-transition: 0.25s;
-o-transition: 0.25s;
transition: 0.25s;

button {
min-width: 200px;
}
}
.stacklist {

&__items {
position: relative;
margin-bottom: -@item-margin;
}

&__item {
position: relative;
padding: @item-padding;
margin-bottom: @item-margin / 2;
background-color: @item-color;
color: @font-color-inverted;

&.show {
position: static !important;
}
}

&__button {
display: none;
position: absolute;
top: 0;
height: 53px;
//width: 100%;
text-align: center;
-webkit-transition: 0.25s;
-moz-transition: 0.25s;
-ms-transition: 0.25s;
-o-transition: 0.25s;
transition: 0.25s;

button {
//min-width: 200px;
line-height: unset;
background-color: @item-color;
color: @font-color-inverted;
}
}
}
14 changes: 7 additions & 7 deletions templates/stacklist.hbs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<div class="stacklist-inner component-inner">
<div class="stacklist__inner component__inner">
{{> component this}}

<div class="stacklist-widget component-widget">
<div class="stacklist-items">
<div class="stacklist-items-inner">
<div class="stacklist__widget component__widget">
<div class="stacklist__items">
<div class="stacklist__items-inner">
{{#each _items}}
<div class="stacklist-item">
<div class="stacklist__item">
{{#if this.length}}
{{{a11y_text this}}}
{{else}}
{{{a11y_text body}}}
{{/if}}
</div>
{{/each}}
<div class="stacklist-button">
<button class="stacklist-next" aria-label="{{{_button.startText}}}, {{{_button.ariaLabel}}}">{{{_button.startText}}}</button>
<div class="stacklist__button">
<button class="stacklist__next" aria-label="{{{_button.startText}}}, {{{_button.ariaLabel}}}">{{{_button.startText}}}</button>
</div>
</div>
</div>
Expand Down