Skip to content

Commit b768e36

Browse files
committed
Merge pull request #153 from bem/supportBemXjst4x
Support bem-xjst 4.x
2 parents e146b7c + 6fd1582 commit b768e36

14 files changed

+38
-34
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
block('checkbox-group')(
22

3-
match(this._form_field).def()(function() {
4-
var ctx = this.ctx;
3+
match(function() { return this._form_field; }).def()(function() {
4+
var ctx = this.ctx;
55

6-
ctx.name = ctx.name || this._form_field.name;
6+
ctx.name || (ctx.name = this._form_field.name);
77

8-
applyNext();
8+
return applyNext();
99
})
1010

1111
);
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
block('checkbox')(
22

3-
match(this._form_field).def()(function() {
3+
match(function() { return this._form_field; }).def()(function() {
44
var ctx = this.ctx;
55

6-
ctx.name = ctx.name || this._form_field.name;
6+
ctx.name || (ctx.name = this._form_field.name);
77

8-
applyNext();
8+
return applyNext();
99
})
1010

1111
);
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
block('form-field').match(this.ctx.mods.required)(
1+
block('form-field').match(function() { return this.ctx.mods.required; })(
22
mix()({ mods : { 'has-validation' : true } })
33
)

common.blocks/form-field/_type/form-field_type_hidden.bemhtml

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ block('form-field').mod('type', 'hidden')(
44
}),
55

66
content()(function() {
7+
var ctx = this.ctx;
8+
79
return [
810
{
911
tag : 'input',
1012
attrs : {
1113
type : 'hidden',
12-
name : this.ctx.name,
13-
id : this.ctx.id,
14-
value : this.ctx.val
14+
name : ctx.name,
15+
id : ctx.id,
16+
value : ctx.val
1517
}
1618
}
1719
];
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
block('form-field').match(this.ctx.mods.validate)(
1+
block('form-field').match(function() { return this.ctx.mods.validate; })(
22
mix()({ mods : { 'has-validation' : true } })
33
)

common.blocks/form-field/form-field.bemhtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ block('form-field')(
88

99
_form_field.mods.name = _form_field.name;
1010

11-
applyNext({ _form_field : _form_field });
11+
return applyNext({ _form_field : _form_field });
1212
})
1313

1414
);
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
block('form').mod('has-validation', true)(
22
attrs()(function() {
33
var attrs = applyNext();
4-
attrs['novalidate'] = true;
4+
attrs.novalidate = true;
55
return attrs;
66
})
77
);

common.blocks/form/form.bemhtml

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ block('form')(
55
js()(true),
66

77
attrs()(function() {
8+
var ctx = this.ctx;
9+
810
return {
9-
action : this.ctx.action,
10-
enctype : this.ctx.enctype,
11-
method : this.ctx.method
11+
action : ctx.action,
12+
enctype : ctx.enctype,
13+
method : ctx.method
1214
};
1315
})
1416

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
block('input').elem('control')(
22

3-
match(this._form_field).def()(function() {
3+
match(function() { return this._form_field; }).def()(function() {
44
this._input.id = this._input.id || this._form_field.id;
55
this._input.name = this._input.name || this._form_field.name;
66

7-
applyNext();
7+
return applyNext();
88
})
99
);

common.blocks/label/label.bemhtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ block('label')(
66
return { for : this.ctx.for };
77
}),
88

9-
match(this._form_field).attrs()(function() {
9+
match(function() { return this._form_field; }).attrs()(function() {
1010
return { for : this._form_field.id };
1111
})
1212

Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
block('radio-group')(
22

3-
match(this._form_field).def()(function() {
3+
match(function() { return this._form_field; }).def()(function() {
44
var ctx = this.ctx;
55

6-
ctx.name = ctx.name || this._form_field.name;
6+
ctx.name || (ctx.name = this._form_field.name);
77

8-
applyNext();
8+
return applyNext();
99
})
1010
);

common.blocks/radio/radio.bemhtml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
block('radio')(
22

3-
match(this._form_field).def()(function() {
3+
match(function() { return this._form_field; }).def()(function() {
44
var ctx = this.ctx;
55

6-
ctx.name = ctx.name || this._form_field.name;
6+
ctx.name || (ctx.name = this._form_field.name);
77

8-
applyNext();
8+
return applyNext();
99
})
1010

1111
);

common.blocks/select/select.bemhtml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
block('select')(
22

3-
match(this._form_field).def()(function() {
4-
var ctx = this.ctx;
3+
match(function() { return this._form_field; }).def()(function() {
4+
var ctx = this.ctx;
55

6-
ctx.name = ctx.name || this._form_field.name;
6+
ctx.name || (ctx.name = this._form_field.name);
77

8-
applyNext();
8+
return applyNext();
99
})
1010

1111
);
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
block('textarea')(
22

3-
match(this._form_field).def()(function() {
3+
match(function() { return this._form_field; }).def()(function() {
44
var ctx = this.ctx;
55

6-
ctx.id = ctx.id || this._form_field.id;
7-
ctx.name = ctx.name || this._form_field.name;
6+
ctx.id || (ctx.id = this._form_field.id);
7+
ctx.name || (ctx.name = this._form_field.name);
88

9-
applyNext();
9+
return applyNext();
1010
})
1111

1212
);

0 commit comments

Comments
 (0)