Skip to content

Commit

Permalink
Backbone View Changes
Browse files Browse the repository at this point in the history
Backbone view changes. Manager and Tester should have some fixes
applied. Issue #8 and Issue #7
  • Loading branch information
MichaelJ2324 committed May 22, 2015
1 parent d7eac29 commit 5a0a868
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 45 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ fuel/vendor
fuel/core
fuel/packages
composer.phar
composer.lock
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $ git checkout [branch]

Ignore any local file permission changes
```
$ git config --global core.filemode false
$ git config --add core.filemode false
```

Add Upstream for easy fetch capabilities
Expand All @@ -46,8 +46,19 @@ $ vi fuel/app/config/install.php

Reset File Permissions
```
$ sudo chmod -R 775 ../UNBOXAPI
$ sudo chown -R www:www ../UNBOXAPI
$ sudo chmod -R 775 ../UNBOX_API
$ sudo chown -R www:www ../UNBOX_API
```

Don't track changes to db files
```
$ git update-index --assume-unchanged fuel/app/config/db.php
$ git update-index --assume-unchanged fuel/app/config/development/db.php
$ git update-index --assume-unchanged fuel/app/config/install.php
$ git update-index --assume-unchanged fuel/app/config/production/db.php
$ git update-index --assume-unchanged fuel/app/config/staging/db.php
$ git update-index --assume-unchanged fuel/app/config/test/db.php
$ git update-index --assume-unchanged fuel/app/config/unbox.php
```

Install and Seed Data
Expand Down
2 changes: 0 additions & 2 deletions fuel/app/modules/Manager/config/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
'enabled' => true,
'bootstrap' => array(
0 => 'HttpMethods',
1 => 'DataTypes',
2 => 'ApiTypes',
),
'default' => 'Entrypoints',
'login' => true,
Expand Down
110 changes: 70 additions & 40 deletions public/assets/js/unbox_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ UNBOXAPI.Views = {
},
initialize: function(options){
this.options = options || {};
this.globalTemplates = this.options.templates;
this.gTemplates = this.options.templates;
this.modules = this.options.modules;
this.metadata = this.options.metadata;
this.user = this.options.user;
Expand All @@ -398,7 +398,7 @@ UNBOXAPI.Views = {
},
buildLayout: function(){
this.panels = [];
var panel_template = this.globalTemplates.getTemplate("panel");
var panel_template = this.gTemplates.getTemplate("panel");
var panels = this.metadata.config.getValue("panels");
panels = (panels>3?3:panels);
for (var x=1; x<=panels; x++){
Expand All @@ -415,17 +415,18 @@ UNBOXAPI.Views = {
this.main = new UNBOXAPI.Views.Main({
el: $("#main"),
model: this.model,
template: this.globalTemplates.getTemplate("main")
template: this.gTemplates.getTemplate("main")
});
},
start: function(){
var models = this.metadata.config.getValue("bootstrap");
if (!(models==null||typeof models=='undefined')){
this.collections = {};
this.bootstrap(models,this.render)
}else{
//TODO: Removing Bootstrap until further review
//var models = this.metadata.config.getValue("bootstrap");
//if (!(models==null||typeof models=='undefined')){
// this.collections = {};
// this.bootstrap(models,this.render)
//}else{
this.render();
}
//}
},
bootstrap: function(models,callback){
var functions = [];
Expand Down Expand Up @@ -461,8 +462,6 @@ UNBOXAPI.Views = {
var pane = this.collection.getPanel(area);
}
view_options = view_options || {};
view_options.panel = pane;
view_options.layout = this.metadata;
pane.set({
content: new view(view_options)
});
Expand Down Expand Up @@ -818,7 +817,8 @@ UNBOXAPI.Views.Home = {
1,
UNBOXAPI.Views.Home.Login,
{
model: this.user
model: this.user,
template: this.metadata.templates.getTemplate("Login")
},
"open"
);
Expand All @@ -828,21 +828,26 @@ UNBOXAPI.Views.Home = {
1,
UNBOXAPI.Views.Home.Profile,
{
model: this.user
model: this.user,
templates: this.metadata.templates
},
"close"
);
this.setContent(
'main',
UNBOXAPI.Views.Home.Home
UNBOXAPI.Views.Home.Home,
{
templates: this.metadata.templates
}
);
},
register: function(){
this.setContent(
1,
UNBOXAPI.Views.Home.Register,
{
model: this.user
model: this.user,
template: this.metadata.templates.getTemplate("Register")
},
"open"
);
Expand All @@ -856,14 +861,12 @@ UNBOXAPI.Views.Home = {
},
initialize: function(options) {
this.options = options || {};
this.layout = this.options.layout || {};
this.panel = this.options.panel || {};
this.template = this.options.template;

this.model = this.model || new UNBOXAPI.Models.User;

this.username = null;
this.password = null;
this.template = this.layout.templates.getTemplate("Login");
_.bindAll(this,"login","updateModel","keyPressHandler");
},
render: function() {
Expand Down Expand Up @@ -903,10 +906,9 @@ UNBOXAPI.Views.Home = {
},
initialize: function(options) {
this.options = options || {};
this.layout = this.options.layout || {};
this.panel = this.options.panel || {};
this.template = this.options.template;

this.captcha = null;
this.template = this.layout.templates.getTemplate("Register");

_.bindAll(this,"submit","updateModel");
},
Expand Down Expand Up @@ -946,14 +948,22 @@ UNBOXAPI.Views.Home = {
Home: Backbone.View.extend({
initialize: function(options){
this.options = options || {};
this.templates = this.options.templates;
this.render();
},
render: function(){

}
}),
Profile: Backbone.View.extend({
initialize: function(options){
this.options = options || {};
this.template = this.options.template;
this.render();
},
render: function(){

}
})
}
UNBOXAPI.Views.Tester = {
Expand Down Expand Up @@ -1018,6 +1028,7 @@ UNBOXAPI.Views.Tester = {
UNBOXAPI.Views.Tester.EntrypointDetail.Panel,
{
model: this.models.entryPoint,
panel: this.collection.getPanel(2),
collection: this.collections.parameters,
token: this.models.token,
templates: this.metadata.templates
Expand Down Expand Up @@ -1337,9 +1348,9 @@ UNBOXAPI.Views.Tester = {
this.options = options || {};
this.panel = this.options.panel || {};
this.token = this.options.token || {};
this.layout = this.options.layout || {};
this.templates = this.options.templates || {};

this.template = this.layout.templates.getTemplate("Panel2");
this.template = this.templates.getTemplate("Panel2");

this.$ep_main = null;
this.$ep_action1 = null;
Expand Down Expand Up @@ -1369,19 +1380,19 @@ UNBOXAPI.Views.Tester = {
this.entryPointDetail = new UNBOXAPI.Views.Tester.EntrypointDetail.MainDetail({
el: this.$ep_main,
model: this.model,
template: this.layout.templates.getTemplate("EntrypointMain")
template: this.templates.getTemplate("EntrypointMain")
});
this.actionButtons= new UNBOXAPI.Views.Tester.ActionButtons({
el: this.$ep_action,
model: this.token,
collection: this.collection,
panelNumber: this.panel.get("number"),
template: this.layout.templates.getTemplate("EntrypointActions")
template: this.templates.getTemplate("EntrypointActions")
});
this.parameterPanel = new UNBOXAPI.Views.Tester.EntrypointDetail.Parameters({
el: this.$ep_parameters,
collection: this.collection,
template: this.layout.templates.getTemplate("EntrypointParameters")
template: this.templates.getTemplate("EntrypointParameters")
});
/*
this.examplePanel = new UNBOXAPI.Views.Tester.EntrypointDetail.Examples({
Expand All @@ -1397,9 +1408,13 @@ UNBOXAPI.Views.Tester = {
},
panelState: function(){
if (this.model.get('name')!==null&&this.model.get('name')!==""){
this.panel.trigger("open");
this.panel.set({
open: true
});
}else{
this.panel.trigger("close");
this.panel.set({
hidden: true
});
}
}
}),
Expand Down Expand Up @@ -1484,9 +1499,9 @@ UNBOXAPI.Views.Tester = {
this.options = options || {};
this.panel = this.options.panel || {};
this.token = this.options.token || {};
this.layout = this.options.layout || {};
this.templates = this.options.templates || {};

this.template = this.layout.templates.getTemplate("Panel3");
this.template = this.templates.getTemplate("Panel3");

this.$url_parameters = null;
this.$request_parameters = null;
Expand All @@ -1512,26 +1527,30 @@ UNBOXAPI.Views.Tester = {
this.urlParams = new UNBOXAPI.Views.Tester.Parameters.UrlParams({
el: this.$url_parameters,
collection: this.collection,
template: this.layout.templates.getTemplate("Parameters")
template: this.templates.getTemplate("Parameters")
});
this.requestParams = new UNBOXAPI.Views.Tester.Parameters.RequestParams({
el: this.$request_parameters,
collection: this.collection,
template: this.layout.templates.getTemplate("Parameters")
template: this.templates.getTemplate("Parameters")
});
this.actionButtons = new UNBOXAPI.Views.Tester.ActionButtons({
el: this.$actions,
model: this.token,
collection: this.collection,
panelNumber: this.panel.get("number"),
template: this.layout.templates.getTemplate("EntrypointActions")
template: this.templates.getTemplate("EntrypointActions")
});
},
panelState: function(){
if (this.collection.length>0){
this.panel.trigger("open");
this.panel.set({
open: true
});
}else{
this.panel.trigger("hide");
this.panel.set({
hidden: true
});
}
}
}),
Expand Down Expand Up @@ -1750,7 +1769,13 @@ UNBOXAPI.Views.Manager = {
UNBOXAPI.Views.Manager.Record.Panel,
{
modules: this.modules,
model: this.models.current
model: this.models.current,
<<<<<<< HEAD
templates: this.metadata.templates,
gTemplates: this.gTemplates
=======
templates: this.metadata.templates
>>>>>>> origin/master
},
'open'
);
Expand All @@ -1761,7 +1786,9 @@ UNBOXAPI.Views.Manager = {
UNBOXAPI.Views.Manager.Record.Panel,
{
related: true,
modules: this.modules
modules: this.modules,
model: this.models.current,
templates: this.metadata.templates
}
);
},
Expand Down Expand Up @@ -1794,14 +1821,17 @@ UNBOXAPI.Views.Manager = {
Record: {
Panel: Backbone.View.extend({
initialize: function(options){
console.dir(options);
this.options = options || {};
this.panel = this.options.panel || {};
this.templates = this.options.templates || {};
this.modules = this.options.modules || null;
this.templates = this.options.templates;
this.gTemplates = this.options.gTemplates;
this.modules = this.options.modules;
this.related = this.options.related || false;

this.module = this.modules.current.clone();
console.log(this.module);
this.module.templates = this.gTemplates;
this.module.setup();
this.number = this.panel.get('number');

this.relate = {};
Expand Down

0 comments on commit 5a0a868

Please sign in to comment.