Skip to content

Commit

Permalink
Fix for ENYO-720
Browse files Browse the repository at this point in the history
Added one-off .css for ProgressSample and additional examples of colored ProgressBars and Sliders
  • Loading branch information
sugardave committed Jul 29, 2012
1 parent c206ef1 commit 971e45e
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
6 changes: 6 additions & 0 deletions samples/ProgressSample.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.green {
background-color: #91BA07;
}
.red {
background-color: #C51616;
}
36 changes: 33 additions & 3 deletions samples/ProgressSample.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ enyo.kind({
components: [
{classes: "onyx-sample-divider", content: "Progress Bars"},
{kind: "onyx.ProgressBar", progress: 25},
{kind: "onyx.ProgressBar", animateStripes: false, progress: 25},
{kind: "onyx.ProgressBar", progress: 25, barClasses: "green"},
{kind: "onyx.ProgressBar", progress: 25, barClasses: "red"},
{kind: "onyx.ProgressBar", progress: 25, barClasses: "onyx-dark"},
{kind: "onyx.ProgressBar", animateStripes: false, barClasses: "onyx-light", progress: 50},
{kind: "onyx.ProgressBar", showStripes: false, progress: 75},
{tag: "br"},
Expand All @@ -23,8 +27,17 @@ enyo.kind({
{kind: "onyx.Button", content:"+", classes:"onyx-sample-spaced-button", ontap:"incValue"},
{tag: "br"},
{tag: "br"},
{kind: "onyx.Checkbox", name:"animateSetting", value:true},
{content:"Animated", classes:"enyo-inline onyx-sample-animate-label"}
{kind: "onyx.Checkbox", name:"animateSetting", checked:true},
{content:"Animated", classes:"enyo-inline onyx-sample-animate-label"},
{tag: "br"},
{tag: "br"},
{classes: "onyx-sample-divider", content: "Sliders"},
{kind: "onyx.Slider", min: 10, max: 50, value: 30},
{tag: "br"},
{kind: "onyx.Slider", lockBar: false, progress: 20, value: 75},
{tag: "br"},
{name: "progressSlider", kind: "onyx.Slider", lockBar: false, value: 75},
{kind: "onyx.Button", content: "Toggle Progress", ontap: "toggleProgress"}
],
changeValue: function(inSender, inEvent) {
for (var i in this.$) {
Expand All @@ -47,5 +60,22 @@ enyo.kind({
},
clearValue: function(inSender, inEvent) {
inSender.setProgress(0);
},
toggleProgress: function() {
this._progressing = !this._progressing;
this.nextProgress();
},
nextProgress: function() {
if (this._progressing) {
enyo.requestAnimationFrame(enyo.bind(this, function() {
this.incrementProgress();
setTimeout(enyo.bind(this, "nextProgress"), 500);
}), this.hasNode());
}
},
incrementProgress: function() {
var p = this.$.progressSlider;
var i = p.min + ((p.progress - p.min + 5) % (p.max - p.min + 1));
p.animateProgressTo(i);
}
});
});
1 change: 1 addition & 0 deletions samples/package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
enyo.depends(
"sample.css",
"DrawerSample.css",
"ProgressSample.css",
"ButtonGroupSample.js",
"ButtonSample.js",
"CheckboxSample.js",
Expand Down

0 comments on commit 971e45e

Please sign in to comment.