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

menu starting to come in through require

parent 713eb30f
Branches
No related tags found
No related merge requests found
...@@ -5,13 +5,10 @@ ...@@ -5,13 +5,10 @@
<title></title> <title></title>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--<script src="dependencies/analytics.js"></script>-->
<!--flatUI bootstrap theme--> <!--flatUI bootstrap theme-->
<link href="js/dependencies/flatUI/css/vendor/bootstrap.min.css" rel="stylesheet"><!-- Loading Bootstrap --> <link href="js/dependencies/flatUI/css/vendor/bootstrap.min.css" rel="stylesheet"><!-- Loading Bootstrap -->
<link href="js/dependencies/flatUI/css/flat-ui.css" rel="stylesheet"><!-- Loading Flat UI --> <link href="js/dependencies/flatUI/css/flat-ui.css" rel="stylesheet"><!-- Loading Flat UI -->
<!--<script src="dependencies/flatUI/js/flat-ui.js"></script>-->
<!--<script src="dependencies/flatUI/js/vendor/video.js"></script>-->
<!--bootstrap slider--> <!--bootstrap slider-->
<link href="js/dependencies/bootstrap-slider/bootstrap-slider.css" rel="stylesheet"> <link href="js/dependencies/bootstrap-slider/bootstrap-slider.css" rel="stylesheet">
......
...@@ -9,6 +9,7 @@ requirejs.config({ ...@@ -9,6 +9,7 @@ requirejs.config({
jquery: 'dependencies/jquery-2.1.3', jquery: 'dependencies/jquery-2.1.3',
underscore: 'dependencies/underscore', underscore: 'dependencies/underscore',
backbone: 'dependencies/backbone', backbone: 'dependencies/backbone',
flatUI: 'dependencies/flatUI/js/flat-ui',
fileSaverLib: 'dependencies/loaders/FileSaver.min', fileSaverLib: 'dependencies/loaders/FileSaver.min',
//three //three
...@@ -21,12 +22,12 @@ requirejs.config({ ...@@ -21,12 +22,12 @@ requirejs.config({
plist: 'models/PList', plist: 'models/PList',
appState: 'models/AppState', appState: 'models/AppState',
lattice: 'lattice/Lattice', lattice: 'lattice/Lattice',
fileSaver: 'models/FileSaver' fileSaver: 'models/FileSaver',
//views
//UI //UI
menuWrapper: 'menus/MenuWrapperView',
menuParent: 'menus/MenuParentView',
latticeMenu: 'menus/LatticeMenuView'
}, },
shim: { shim: {
three: { three: {
...@@ -38,12 +39,15 @@ requirejs.config({ ...@@ -38,12 +39,15 @@ requirejs.config({
}, },
fileSaverLib: { fileSaverLib: {
exports: 'saveAs' exports: 'saveAs'
},
flatUI: {
deps: ['jquery']
} }
} }
}); });
requirejs(['fileSaver', 'analytics'], function(fileSaver) { requirejs(['menuWrapper', 'analytics', 'flatUI'], function(menuWrapper) {
console.log(fileSaver); console.log(menuWrapper);
}); });
......
...@@ -2,10 +2,9 @@ ...@@ -2,10 +2,9 @@
* Created by aghassaei on 1/26/15. * Created by aghassaei on 1/26/15.
*/ */
define(['menuParent', 'lattice', 'plist'], function(MenuParentView, lattice, plist){
LatticeMenuView = Backbone.View.extend({ var LatticeMenuView = MenuParentView.extend({
el: "#menuContent",
events: { events: {
}, },
...@@ -15,14 +14,14 @@ LatticeMenuView = Backbone.View.extend({ ...@@ -15,14 +14,14 @@ LatticeMenuView = Backbone.View.extend({
_.bindAll(this, "render"); _.bindAll(this, "render");
//bind events //bind events
this.listenTo(globals.lattice, "change", this.render); this.listenTo(lattice, "change", this.render);
}, },
render: function(){ render: function(){
if (this.model.changedAttributes()["currentNav"]) return; if (this.model.changedAttributes()["currentNav"]) return;
if (this.model.get("currentTab") != "lattice") return; if (this.model.get("currentTab") != "lattice") return;
if ($("input[type=text]").is(":focus")) return; if ($("input[type=text]").is(":focus")) return;
this.$el.html(this.template(_.extend(globals.lattice.toJSON(), globals.plist))); this.$el.html(this.template(_.extend(lattice.toJSON(), plist)));
}, },
template: _.template('\ template: _.template('\
...@@ -65,6 +64,10 @@ LatticeMenuView = Backbone.View.extend({ ...@@ -65,6 +64,10 @@ LatticeMenuView = Backbone.View.extend({
}); });
return LatticeMenuView;
});
//Cell Separation <% if (connectionType != "freeformFace"){ %>(xy, z): &nbsp;&nbsp;<input data-type="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control numberInput cellSeparation" type="text">\ //Cell Separation <% if (connectionType != "freeformFace"){ %>(xy, z): &nbsp;&nbsp;<input data-type="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control numberInput cellSeparation" type="text">\
//&nbsp;<input data-type="z" value="<%= cellSeparation.z %>" placeholder="Z" class="form-control numberInput cellSeparation" type="text">\ //&nbsp;<input data-type="z" value="<%= cellSeparation.z %>" placeholder="Z" class="form-control numberInput cellSeparation" type="text">\
//<% } else { %>( radial ): &nbsp;&nbsp;<input data-type="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control numberInput cellSeparation" type="text"><% } %>\ //<% } else { %>( radial ): &nbsp;&nbsp;<input data-type="xy" value="<%= cellSeparation.xy %>" placeholder="XY" class="form-control numberInput cellSeparation" type="text"><% } %>\
......
/**
* Created by aghassaei on 6/2/15.
*/
define(['backbone'], function(Backbone){
var MenuParentView = Backbone.View.extend({
el: "#menuContent",
destroy: function(){
}
});
return MenuParentView;
});
\ No newline at end of file
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
*/ */
MenuWrapper = Backbone.View.extend({ define(['jquery', 'backbone', 'appState', 'lattice', 'plist'], function($, Backbone, appState, lattice, plist){
var MenuWrapper = Backbone.View.extend({
el: "#menuWrapper", el: "#menuWrapper",
...@@ -24,7 +26,7 @@ MenuWrapper = Backbone.View.extend({ ...@@ -24,7 +26,7 @@ MenuWrapper = Backbone.View.extend({
//bind events //bind events
this.listenTo(this.model, "change:currentNav", this.render); this.listenTo(this.model, "change:currentNav", this.render);
this.listenTo(globals.lattice, "change:cellType change:connectionType", this._populateAndShow); this.listenTo(lattice, "change:cellType change:connectionType", this._populateAndShow);
this.listenTo(this.model, "change:currentTab", this._updateCurrentTab); this.listenTo(this.model, "change:currentTab", this._updateCurrentTab);
this.listenTo(this.model, "change:menuIsVisible", this._setVisibility); this.listenTo(this.model, "change:menuIsVisible", this._setVisibility);
...@@ -121,13 +123,13 @@ MenuWrapper = Backbone.View.extend({ ...@@ -121,13 +123,13 @@ MenuWrapper = Backbone.View.extend({
_clearCells: function(e){ _clearCells: function(e){
e.preventDefault(); e.preventDefault();
globals.lattice.clearCells(); lattice.clearCells();
}, },
_getPropertyOwner: function($target){ _getPropertyOwner: function($target){
if ($target.hasClass("lattice")) return globals.lattice; if ($target.hasClass("lattice")) return lattice;
if ($target.hasClass("assembler")) return globals.cam; if ($target.hasClass("assembler")) return globals.cam;
if ($target.hasClass("appState")) return globals.appState; if ($target.hasClass("appState")) return this.model;
console.warn("no owner found for " + $target); console.warn("no owner found for " + $target);
return null; return null;
}, },
...@@ -157,46 +159,12 @@ MenuWrapper = Backbone.View.extend({ ...@@ -157,46 +159,12 @@ MenuWrapper = Backbone.View.extend({
_renderTab: function(tabName){ _renderTab: function(tabName){
if (!tabName || !_.isString(tabName)) tabName = this.model.get("currentTab"); if (!tabName || !_.isString(tabName)) tabName = this.model.get("currentTab");
if (tabName == "lattice"){ if (this.menu) this.menu.destroy();
if (!this.latticeMenu) this.latticeMenu = new LatticeMenuView({model:this.model}); var self = this;
this.latticeMenu.render(); require([tabName + "Menu"], function(MenuView){
} else if (tabName == "import"){ self.menu = new MenuView({model:self.model});
if (!this.importMenu) this.importMenu = new ImportMenuView({model:this.model}); self.menu.render();
this.importMenu.render(); });
} else if (tabName == "sketch"){
if (!this.sketchMenu) this.sketchMenu = new SketchMenuView({model:this.model});
this.sketchMenu.render();
} else if (tabName == "part"){
if (!this.partMenu) this.partMenu = new PartMenuView({model:this.model});
this.partMenu.render();
} else if (tabName == "script"){
if (!this.scriptMenu) this.scriptMenu = new ScriptMenuView({model:this.model});
this.scriptMenu.render();
} else if (tabName == "physics"){
if (!this.physicsMenu) this.physicsMenu = new PhysicsMenuView({model:this.model});
this.physicsMenu.render();
} else if (tabName == "material"){
if (!this.materialMenu) this.materialMenu = new MaterialMenuView({model:this.model});
this.materialMenu.render();
} else if (tabName == "optimize"){
if (!this.optimizeMenu) this.optimizeMenu = new OptimizationMenuView({model:this.model});
this.optimizeMenu.render();
} else if (tabName == "assembler"){
if (!this.assemblerMenu) this.assemblerMenu = new AssemblerMenuView({model:this.model});
this.assemblerMenu.render();
} else if (tabName == "cam"){
if (!this.camMenu) this.camMenu = new CamMenuView({model:this.model});
this.camMenu.render();
} else if (tabName == "animate"){
if (!this.animationMenu) this.animationMenu = new AnimationMenuView({model:this.model});
this.animationMenu.render();
} else if (tabName == "send"){
if (!this.sendMenu) this.sendMenu = new SendMenuView({model:this.model});
this.sendMenu.render();
} else {
console.warn("no tab initialized!");
$("#menuContent").html('Coming Soon.');//clear out content from menu
}
}, },
render: function(){ render: function(){
...@@ -208,7 +176,7 @@ MenuWrapper = Backbone.View.extend({ ...@@ -208,7 +176,7 @@ MenuWrapper = Backbone.View.extend({
}, },
_populateAndShow: function(){ _populateAndShow: function(){
$("#menuHeader").html(this.template(_.extend(this.model.toJSON(), globals.lattice.toJSON(), globals.plist))); $("#menuHeader").html(this.template(_.extend(this.model.toJSON(), lattice.toJSON(), plist)));
this._updateCurrentTab(); this._updateCurrentTab();
this._show(); this._show();
}, },
...@@ -240,3 +208,6 @@ MenuWrapper = Backbone.View.extend({ ...@@ -240,3 +208,6 @@ MenuWrapper = Backbone.View.extend({
</ul>\ </ul>\
') ')
}); });
return new MenuWrapper({model:appState});
});
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment