Objective button Resolves #168

This commit is contained in:
Peter Cottle 2014-05-07 18:34:15 -07:00
parent e0516e3f5c
commit 5d05103afb
4 changed files with 32 additions and 5 deletions

View file

@ -53,6 +53,7 @@ var Level = Sandbox.extend({
this.on('toggleGoal', this.toggleGoal); this.on('toggleGoal', this.toggleGoal);
this.on('minimizeCanvas', this.minimizeGoal); this.on('minimizeCanvas', this.minimizeGoal);
this.on('resizeCanvas', this.resizeGoal); this.on('resizeCanvas', this.resizeGoal);
this.on('toggleObjective', this.toggleObjective);
Level.__super__.initialize.apply(this, [options]); Level.__super__.initialize.apply(this, [options]);
this.startOffCommand(); this.startOffCommand();
@ -92,8 +93,6 @@ var Level = Sandbox.extend({
return; return;
} }
debugger;
console.log(intl.getStartDialog(levelObj));
var dialog = $.extend({}, intl.getStartDialog(levelObj)); var dialog = $.extend({}, intl.getStartDialog(levelObj));
// grab the last slide only // grab the last slide only
dialog.childViews = dialog.childViews.slice(-1); dialog.childViews = dialog.childViews.slice(-1);
@ -268,6 +267,13 @@ var Level = Sandbox.extend({
}); });
}, },
toggleObjective: function() {
Main.getEventBaton().trigger(
'commandSubmitted',
'objective'
);
},
toggleGoal: function () { toggleGoal: function () {
if (this.goalCanvasHolder && this.goalCanvasHolder.inDom) { if (this.goalCanvasHolder && this.goalCanvasHolder.inDom) {
this.hideGoal(); this.hideGoal();

View file

@ -567,11 +567,15 @@ var LevelToolbar = BaseView.extend({
this.render(); this.render();
this.$goalButton = this.$el.find('#show-goal'); this.$goalButton = this.$el.find('#show-goal');
this.$objectiveButton = this.$el.find('#show-objective');
var parent = this.parent; var parent = this.parent;
this.$goalButton.on('click', function () { this.$goalButton.on('click', function () {
parent.trigger('toggleGoal'); parent.trigger('toggleGoal');
}); });
this.$objectiveButton.on('click', function() {
parent.trigger('toggleObjective');
});
if (!options.wait) { if (!options.wait) {
process.nextTick(_.bind(this.show, this)); process.nextTick(_.bind(this.show, this));

View file

@ -329,6 +329,7 @@ div.toolbar.level-toolbar {
border-radius: 0; border-radius: 0;
height: inherit; height: inherit;
font-size: 12px; font-size: 12px;
position: relative;
} }
div.toolbar.level-toolbar button { div.toolbar.level-toolbar button {
@ -359,6 +360,17 @@ div.toolbar div.showGoalWrapper {
margin-left: 6px; margin-left: 6px;
} }
div.toolbar div.showObjectiveWrapper {
float: right;
margin-right: 6px;
}
div.toolbar div.buttonsWrapper {
position: absolute;
width: 100%;
top: 10px;
}
div.toolbar div.levelNameWrapper { div.toolbar div.levelNameWrapper {
text-align: center; text-align: center;
position: relative; position: relative;

View file

@ -144,9 +144,6 @@
<script type="text/html" id="level-toolbar-template"> <script type="text/html" id="level-toolbar-template">
<div class="toolbar level-toolbar box vertical center transitionAll hidden"> <div class="toolbar level-toolbar box vertical center transitionAll hidden">
<div class="clearfix"> <div class="clearfix">
<div class="showGoalWrapper">
<button id="show-goal" type="button">Show Goal</button>
</div>
<div class="levelNameWrapper"> <div class="levelNameWrapper">
<i class="icon-bolt"></i> <i class="icon-bolt"></i>
Level Level
@ -155,6 +152,14 @@
</span> </span>
</div> </div>
</div> </div>
<div class="buttonsWrapper">
<div class="showGoalWrapper">
<button id="show-goal" type="button">Show Goal</button>
</div>
<div class="showObjectiveWrapper">
<button id="show-objective" type="button">Objective</button>
</div>
</div>
</div> </div>
</script> </script>