Skip to content
Snippets Groups Projects
Commit be961240 authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

position panel templating

parent 0ac16c40
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,7 @@ body {
}
.btn {
#controlPanel .btn {
padding: 5px 10px;
margin: 5px 10px;
}
......@@ -81,4 +81,13 @@ span.outgoing {
background-color: #fdfdfd;
display: inline-block;
font-size: 30px;
}
\ No newline at end of file
}
#positionPanel .btn-block {
margin-bottom: 15px;
}
#positionDataError{
font-size: 19px;
text-align: center;
padding-top: 20px;
}
X: <%= xAxis %><br/>
Y: <%= yAxis %><br/>
Z: <%= zAxis %><br/><br/>
A: <%= aAxis %><br/>
B: <%= bAxis %><br/>
C: <%= cAxis %><br/>
\ No newline at end of file
<div id="positionData">
</div><br/>
<a href="#" id="askForPosition" class="btn btn-block btn-lg btn-default">Refresh</a>
<a href="#" id="askForPosition" class="btn btn-block btn-lg btn-warning">Pause</a>
<a href="#" id="stopMachine" class="btn pull-right btn-block btn-lg btn-danger">Stop</a>
\ No newline at end of file
......@@ -3,7 +3,8 @@
*/
define(['jquery', 'underscore', 'backbone', 'text!PositionControlPanelView.html'], function($, _, Backbone, template){
define(['jquery', 'underscore', 'backbone', 'text!PositionControlPanelView.html', 'text!PositionDataView.html'],
function($, _, Backbone, template, positionTemplate){
return Backbone.View.extend({
......@@ -18,18 +19,26 @@ define(['jquery', 'underscore', 'backbone', 'text!PositionControlPanelView.html'
this.render();
},
_makeTemplateJSON: function(){
console.log(this.model);
_renderPositionData: function(){
var machineState = this.model.getMachineState();
if (machineState === null) return {};
return machineState.toJSON();
console.log(machineState);
if (machineState === null) {
$("#positionData").html("<div id='positionDataError'>no position data available</div>");
return;
}
$("#positionData").html(_.template(positionTemplate)(machineState.toJSON()));
},
_makeTemplateJSON: function(){
return {};
},
render: function(){
this.$el.html(this.template(this._makeTemplateJSON()));
this._renderPositionData();
},
template: _.template(template)
template: _.template(template),
});
......
X: <%= xAxis %><br/>
Y: <%= yAxis %><br/>
Z: <%= zAxis %><br/><br/>
A: <%= aAxis %><br/>
B: <%= bAxis %><br/>
C: <%= cAxis %><br/>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment