Created
December 2, 2015 23:18
-
-
Save qrobin/34532af15e0494a02ccb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="addTour"> | |
<label class="control-label col-xs-4" for="tour-dropdown">Программа</label> | |
<div class="dropdown col-xs-8 form-group form-horisontal"> | |
<select class="form-control" id="tour-dropdown"> | |
<option value="a">A</option> | |
<option value="b">B</option> | |
<option value="c">C</option> | |
<option value="d">D</option> | |
<option value="e">E</option> | |
<option value="f">F</option> | |
<option value="g">G</option> | |
<option value="h">H</option> | |
</select> | |
</div> | |
{{#if a}} | |
<div class="container-fluid"> | |
<div class="row"> | |
<div class="col-sm-4"> | |
<form class='form-horizontal'> | |
<div class="form-group"> | |
{{> textfield label='город отправления' id='transfer-city-from'}} | |
{{> textfield label='район отправления' id='transfer-district-from'}} | |
{{> textfield label='город прибытия' id='transfer-city-to'}} | |
{{> textfield label='район прибытия' id='transfer-district-to'}} | |
{{> timepicker label='время отбытия' id='transfer-time-from'}} | |
{{> timepicker label='время прибытия' id='transfer-time-to'}} | |
{{> pricefield label='Цена за взрослого' id='adult-price'}} | |
{{> pricefield label='Цена за ребенка' id='child-price'}} | |
{{> pricefield label='Net за взрослого' id='adult-price-net'}} | |
{{> pricefield label='Net за ребенка' id='child-price-net'}} | |
{{> confirm add='новый трансфер'}} | |
</div> | |
</form> | |
</div> | |
</div> | |
</div> | |
{{/if}} | |
...and the other options - 'b', 'c' etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Template.addTour.onCreated( function () { | |
this.a = new ReactiveVar( false ); | |
this.b = new ReactiveVar( false ); | |
this.c = new ReactiveVar( false ); | |
this.d = new ReactiveVar( false ); | |
this.e = new ReactiveVar( false ); | |
this.f = new ReactiveVar( false ); | |
this.g = new ReactiveVar( false ); | |
this.h = new ReactiveVar( false ); | |
} ); | |
Template.addTour.helpers( { | |
a: function () { | |
return Template.instance().a.get(); | |
}, | |
b: function () { | |
return Template.instance().b.get(); | |
}, | |
c: function () { | |
return Template.instance().c.get(); | |
}, | |
d: function () { | |
return Template.instance().d.get(); | |
}, | |
e: function () { | |
return Template.instance().e.get(); | |
}, | |
f: function () { | |
return Template.instance().f.get(); | |
}, | |
g: function () { | |
return Template.instance().g.get(); | |
}, | |
h: function () { | |
return Template.instance().h.get(); | |
}, | |
} ); | |
Template.addTour.events( { | |
'change select': function ( event, template ) { | |
if ( $( event.target ).val() === "a" ) { | |
template.a.set( true ); | |
} else { | |
template.a.set( false ); | |
}; | |
if ( $( event.target ).val() === "b" ) { | |
template.b.set( true ); | |
} else { | |
template.b.set( false ); | |
}; | |
if ( $( event.target ).val() === "c" ) { | |
template.c.set( true ); | |
} else { | |
template.c.set( false ); | |
}; | |
if ( $( event.target ).val() === "d" ) { | |
template.d.set( true ); | |
} else { | |
template.d.set( false ); | |
}; | |
if ( $( event.target ).val() === "e" ) { | |
template.e.set( true ); | |
} else { | |
template.e.set( false ); | |
}; | |
if ( $( event.target ).val() === "f" ) { | |
template.f.set( true ); | |
} else { | |
template.f.set( false ); | |
}; | |
if ( $( event.target ).val() === "g" ) { | |
template.g.set( true ); | |
} else { | |
template.g.set( false ); | |
}; | |
if ( $( event.target ).val() === "h" ) { | |
template.h.set( true ); | |
} else { | |
template.h.set( false ); | |
}; | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment