Skip to content

Commit

Permalink
Merge pull request #1471 from /issues/1468@v2
Browse files Browse the repository at this point in the history
progressbar: assign 'val'  field to zero by default
  • Loading branch information
tadatuta committed Apr 23, 2015
2 parents 1e3d816 + 8427dfa commit fa17809
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions common.blocks/progressbar/progressbar.bemhtml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
block('progressbar')(

js()(function(){
return { val : this.ctx.val };
return { val : this.ctx.val || 0 };
}),

content()(
function() {
return {
elem : 'bar',
attrs : { style : 'width:' + this.ctx.val + '%' }
attrs : { style : 'width:' + (this.ctx.val || 0) + '%' }
};
},
match(function() { return typeof this.ctx.content !== 'undefined'; })(function() {
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/progressbar/progressbar.bh.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = function(bh) {

bh.match('progressbar', function(ctx, json) {
var val = json.val;
var val = json.val || 0;

ctx
.js({ val : val })
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/progressbar/progressbar.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The modifier gives the block a custom design.

Type: `Number`.

Specifies the status of the process progress (in percent relative to its parental block).
Specifies the status of the process progress (in percent relative to its parental block). By default process progress is equal to 0;

```js
{
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/progressbar/progressbar.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

Тип: `Number`.

Определяет степень выполнения процесса в процентах относительно родителя.
Определяет степень выполнения процесса в процентах относительно родителя. При отсутствии этого поля степень выполнения равна нулю.

```js
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
({
block : 'progressbar',
val : 24
block : 'progressbar'
})
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div class="progressbar i-bem" data-bem="{&quot;progressbar&quot;:{&quot;val&quot;:24}}"><div class="progressbar__bar" style="width:24%"></div></div>
<div class="progressbar i-bem" data-bem="{&quot;progressbar&quot;:{&quot;val&quot;:0}}"><div class="progressbar__bar" style="width:0%"></div></div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
({
block : 'progressbar',
val : 24
})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div class="progressbar i-bem" data-bem="{&quot;progressbar&quot;:{&quot;val&quot;:24}}"><div class="progressbar__bar" style="width:24%"></div></div>

0 comments on commit fa17809

Please sign in to comment.