diff --git a/Mongoman/Gemfile b/Mongoman/Gemfile index 317a512..9f06c0b 100644 --- a/Mongoman/Gemfile +++ b/Mongoman/Gemfile @@ -52,5 +52,7 @@ gem 'genghisapp' gem 'bson_ext' +gem 'multi_json', '1.7.8' + gem 'jquery-ui-rails' diff --git a/Mongoman/app/assets/javascripts/controllers/start_controller.js b/Mongoman/app/assets/javascripts/controllers/start_controller.js index 118f27b..66230fc 100644 --- a/Mongoman/app/assets/javascripts/controllers/start_controller.js +++ b/Mongoman/app/assets/javascripts/controllers/start_controller.js @@ -1,15 +1,10 @@ Mongoman.StartController = Ember.ArrayController.extend({ - content: null, - isVisible: true, + content: null, + isLoaded: Ember.computed.alias('content.length'), - update: function() { - this.set('content',this.get('content')); - if (this.get('content')) { - this.set('content.isLoaded', true); - } - }.observes('content'), actions: { + addDatabase: function() { var self = this; $("#newdb-create" ).dialog({ @@ -22,12 +17,10 @@ Mongoman.StartController = Ember.ArrayController.extend({ var newDbName = self.get('content.newDbName') var url = '/databases?' Mongoman.PostRequest.post(url, {dbname: newDbName}, 'POST') - $(this).dialog("close") - self.set('content.isLoaded', false); - //self.set('content', Mongoman.Request.find("/databases",'databases')) + $(this).dialog("close") }, Cancel: function() { - $(this).dialog("close") + $(this).dialog("close") } } }); @@ -38,4 +31,4 @@ Mongoman.StartController = Ember.ArrayController.extend({ -}) \ No newline at end of file +}) diff --git a/Mongoman/app/assets/javascripts/models/request.js b/Mongoman/app/assets/javascripts/models/request.js index a4422dd..78b5df8 100644 --- a/Mongoman/app/assets/javascripts/models/request.js +++ b/Mongoman/app/assets/javascripts/models/request.js @@ -4,7 +4,7 @@ Mongoman.Request = Ember.Object.extend({ Mongoman.Request.reopenClass({ - find: function makePromise(url) { + find: function getData(url) { var promise = new Ember.RSVP.Promise(function(resolve, reject) { Ember.$.ajax({ dataType: "json", diff --git a/Mongoman/app/assets/javascripts/routes/app_router.js b/Mongoman/app/assets/javascripts/routes/app_router.js index a2862c7..2c12906 100644 --- a/Mongoman/app/assets/javascripts/routes/app_router.js +++ b/Mongoman/app/assets/javascripts/routes/app_router.js @@ -1,5 +1,5 @@ Mongoman.Router.map(function() { - + this.route('start', {path: '/'}); this.route('about', {path: '/about'}); this.route('collections',{path: '/collections/:name'}); @@ -8,5 +8,5 @@ Mongoman.Router.map(function() { - -}); \ No newline at end of file + +}); diff --git a/Mongoman/app/assets/javascripts/routes/collections_route.js b/Mongoman/app/assets/javascripts/routes/collections_route.js index 73c118d..944aa09 100644 --- a/Mongoman/app/assets/javascripts/routes/collections_route.js +++ b/Mongoman/app/assets/javascripts/routes/collections_route.js @@ -9,18 +9,16 @@ Mongoman.CollectionsRoute = Ember.Route.extend({ setupController: function(controller,model) { controller.set('content', model.collections) - controller.set('content.isLoaded',false) controller.set('content.count', model.count) - controller.set('content.isLoaded',true) }, - renderTemplate: function() { + /*renderTemplate: function() { this.render('collections', {outlet: "main" , into:"application"}) - }, + },*/ deactivate:function() { var controller = this.controllerFor('collections') controller.set('content', null); } - }) +}) diff --git a/Mongoman/app/assets/javascripts/routes/start_route.js b/Mongoman/app/assets/javascripts/routes/start_route.js index def03e0..c037dec 100644 --- a/Mongoman/app/assets/javascripts/routes/start_route.js +++ b/Mongoman/app/assets/javascripts/routes/start_route.js @@ -1,22 +1,20 @@ Mongoman.StartRoute = Ember.Route.extend({ - init: function() { - this._super(); - window.history.pushState("", "",'/#/'); - }, + init: function() { + this._super(); + window.history.pushState("", "",'/#/'); + }, - model: function() { - return Mongoman.Request.find("/databases?") - }, + model: function() { + return Mongoman.Request.find("/databases?") + }, - renderTemplate: function() { - this.render('databases'); - }, + renderTemplate: function() { + this.render('databases'); + }, - setupController: function(controller,model) { - controller.set('content', model.databases) - controller.set('content.count', model.count) - controller.set('content.isLoaded',false) - controller.set('content.isLoaded',true) - } + setupController: function(controller,model) { + controller.set('content', model.databases) + controller.set('content.count', model.count) + } }); diff --git a/Mongoman/app/assets/javascripts/templates/collections.handlebars b/Mongoman/app/assets/javascripts/templates/collections.handlebars index 726253d..40043d6 100644 --- a/Mongoman/app/assets/javascripts/templates/collections.handlebars +++ b/Mongoman/app/assets/javascripts/templates/collections.handlebars @@ -4,24 +4,27 @@ Databases
- {{database_name}} + {{#linkTo 'collections' database.name}}{{database_name}}{{/linkTo}} - {{#if content.isLoaded}} + {{#if isLoaded}} - + + {{#each stats}} - - - - + + + + + {{/each}}
Collection Name
Collection Name Documents Avg Document Size Size Indexes
{{sanitize undefined this.stats.ns}} - {{this.stats.count}}{{truncate this.stats.avgObjSize}} bytes{{this.stats.size}}{{this.stats.nindexes}}
+ {{sanitize undefined this.stats.ns}} + {{stats.count}}{{truncate stats.avgObjSize}} bytes{{stats.size}} bytes{{stats.nindexes}}
@@ -33,4 +36,4 @@ \ No newline at end of file + diff --git a/Mongoman/app/assets/javascripts/templates/databases.handlebars b/Mongoman/app/assets/javascripts/templates/databases.handlebars index 7066959..1fe07b2 100644 --- a/Mongoman/app/assets/javascripts/templates/databases.handlebars +++ b/Mongoman/app/assets/javascripts/templates/databases.handlebars @@ -5,7 +5,7 @@ - {{#if content.isLoaded}} + {{#if isLoaded}} @@ -14,10 +14,11 @@ {{#each content}} - - - + + + + + {{/each}}
Database NameIndexes
{{this.name}} - {{this.collection_count}}{{this.size}}{{this.indexes}}
{{#linkTo 'collections' this.name class="table-links"}}{{this.name}}{{/linkTo}}{{this.collection_count}}{{this.size}}{{this.indexes}}
@@ -27,4 +28,4 @@ {{/if}} \ No newline at end of file + diff --git a/Mongoman/app/assets/javascripts/templates/documents.handlebars b/Mongoman/app/assets/javascripts/templates/documents.handlebars index 3c69a6b..81f2390 100644 --- a/Mongoman/app/assets/javascripts/templates/documents.handlebars +++ b/Mongoman/app/assets/javascripts/templates/documents.handlebars @@ -4,7 +4,7 @@
{{database_name}}
{{collection_name}} - {{#if controller.isLoaded}} + {{#if isLoaded}}