Skip to content

Commit

Permalink
A lot of code cleanup and slimming down. Being more ember-ish. Made
Browse files Browse the repository at this point in the history
pages look good.
  • Loading branch information
hrishikeshs committed Feb 5, 2014
1 parent 204367d commit 78588ad
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 85 deletions.
2 changes: 2 additions & 0 deletions Mongoman/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,7 @@ gem 'genghisapp'

gem 'bson_ext'

gem 'multi_json', '1.7.8'

gem 'jquery-ui-rails'

19 changes: 6 additions & 13 deletions Mongoman/app/assets/javascripts/controllers/start_controller.js
Original file line number Diff line number Diff line change
@@ -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({
Expand All @@ -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")
}
}
});
Expand All @@ -38,4 +31,4 @@ Mongoman.StartController = Ember.ArrayController.extend({



})
})
2 changes: 1 addition & 1 deletion Mongoman/app/assets/javascripts/models/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions Mongoman/app/assets/javascripts/routes/app_router.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Mongoman.Router.map(function() {

this.route('start', {path: '/'});
this.route('about', {path: '/about'});
this.route('collections',{path: '/collections/:name'});
Expand All @@ -8,5 +8,5 @@ Mongoman.Router.map(function() {



});

});
8 changes: 3 additions & 5 deletions Mongoman/app/assets/javascripts/routes/collections_route.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

})
})
30 changes: 14 additions & 16 deletions Mongoman/app/assets/javascripts/routes/start_route.js
Original file line number Diff line number Diff line change
@@ -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)
}

});
21 changes: 12 additions & 9 deletions Mongoman/app/assets/javascripts/templates/collections.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,27 @@
<a href="#/">Databases</a>
<button class="new-button" {{action 'addCollection'}}>+ New Collection</button>
<div class="arrow-right"></div>
<a href="#/collections/{{unbound collection_name}}">{{database_name}}</a>
{{#linkTo 'collections' database.name}}{{database_name}}{{/linkTo}}
</div>
<div style="display:none;" id="newcollection-create">Enter the Collection name:<br /><br />
{{input valueBinding="content.newCollection" size="30"}}</div>
{{#if content.isLoaded}}
{{#if isLoaded}}
<table class="mainpage-table">
<tr class="mainpage-table-row"><th>Collection Name</th>
<tr class="mainpage-table-row">
<th>Collection Name</th>
<th>Documents</th>
<th>Avg Document Size</th>
<th>Size</th>
<th>Indexes</th>
</tr>
{{#each stats}}
<tr class="mainpage-table-row"><td><a href="#/documents/{{unbound getdbName this.stats.ns}}/{{unbound sanitize undefined this.stats.ns}}" class="table-links">{{sanitize undefined this.stats.ns}}</a>
<td>{{this.stats.count}}</td>
<td>{{truncate this.stats.avgObjSize}} bytes</td>
<td>{{this.stats.size}}</td>
<td>{{this.stats.nindexes}}</td>
<tr class="mainpage-table-row">
<td>
<a href="#/documents/{{unbound getdbName this.stats.ns}}/{{unbound sanitize undefined stats.ns}}" class="table-links">{{sanitize undefined this.stats.ns}}</a>
<td>{{stats.count}}</td>
<td>{{truncate stats.avgObjSize}} bytes</td>
<td>{{stats.size}} bytes</td>
<td>{{stats.nindexes}}</td>
</tr>
{{/each}}
</table>
Expand All @@ -33,4 +36,4 @@
<div id="placeholder-confirm-drop-db" style="display:none;"> Honestly ? </div>
</div>
<div class="footer">
</div>
</div>
13 changes: 7 additions & 6 deletions Mongoman/app/assets/javascripts/templates/databases.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
<div style="display:none;" id="newdb-create">Enter the Database name:<br /><br />
{{input valueBinding="content.newDbName" size="30"}}</div>
{{#if content.isLoaded}}
{{#if isLoaded}}
<table class="mainpage-table">
<tr class="mainpage-table-row">
<th>Database Name</th>
Expand All @@ -14,10 +14,11 @@
<th>Indexes</th>
</tr>
{{#each content}}
<tr class="mainpage-table-row"><td><a href = '#/collections/{{unbound this.name}}' class="table-links">{{this.name}}</a>
<td>{{this.collection_count}}</td>
<td>{{this.size}}</td>
<td>{{this.indexes}}</td>
<tr class="mainpage-table-row">
<td>{{#linkTo 'collections' this.name class="table-links"}}{{this.name}}{{/linkTo}}</td>
<td>{{this.collection_count}}</td>
<td>{{this.size}}</td>
<td>{{this.indexes}}</td>
</tr>
{{/each}}
</table>
Expand All @@ -27,4 +28,4 @@
{{/if}}
</div>
<div class="footer">
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<button class="new-button" {{action 'addDocument'}}>+ New Document</button>
<div class="arrow-right"></div>
<a href="#/collections/{{unbound database_name}}">{{database_name}}</a><div class="arrow-right"></div>{{collection_name}}</div>
{{#if controller.isLoaded}}
{{#if isLoaded}}
<ul>
<li class="inline-search-box">
<form {{action search on="submit"}} class="inline-form-search-box" title="syntax is: field:value, separate nested fields by a dot. For ObjectIds, just copy paste the id and hit return.">
Expand Down
4 changes: 4 additions & 0 deletions Mongoman/app/assets/stylesheets/_pages/documents.css
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,17 @@
border-radius: 3px;
border: 1px solid #ccc;
box-shadow: 1px 1px 0 #fff;
font: 16px arial,sans-serif;
color: #222;
}

.documents-search-box:focus {
overflow: hidden;
z-index: 40;
position: relative;
min-width: 35%;
font: 16px arial,sans-serif;
color: #222;
}

/*Styles for pagination to display correctly*/
Expand Down
10 changes: 7 additions & 3 deletions Mongoman/app/assets/stylesheets/_pages/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
.fluid-container{
min-width: 1000px;
width: 102%;
font-family: helvetica;
max-height: 50px;
height: 50px;
overflow: hidden;
Expand Down Expand Up @@ -55,8 +56,11 @@
}

.main-body{
margin-left: 60px;
margin-right: 70px;
margin-top: 80px;
width: 87%;
display: list-item;
list-style-type: none;
margin-left: 7.5%;
margin-top: 80px;
margin-top: 80px;
}

19 changes: 13 additions & 6 deletions Mongoman/app/assets/stylesheets/_pages/mainpage.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ display: block;
font-family: helvetica, sans-serif;
white-space: pre;
margin: 1em 0px;
font-family: helvetica;
}

.notice-div {
Expand All @@ -16,6 +17,7 @@ margin: 1em 0px;
.mainpage-table {
width: 87%;
background-color: #fafafa;
border-collapse: collapse !important;
margin-top: 5px;
border-radius: 3px;
border-collapse:separate;
Expand All @@ -26,11 +28,16 @@ margin: 1em 0px;
.mainpage-table-row {
text-align: justify;
background-color: #fafafa;
border-bottom: 2px solid blue !important;
font-family: helvetica;
}

.table-links {
color: #0E7B9C !important;
color: #4183c4 !important;
}

td, th {
padding: 7px 3px;
border-top: 1px solid #eee;
}

.list-heading{
Expand All @@ -46,7 +53,7 @@ margin: 1em 0px;
color: black;
line-height: 1.375;
text-decoration: none;
text-indent: 3px;
text-indent: 3px;
font-weight: 3em;
margin-left: 38px;
height: 30px;
Expand All @@ -61,7 +68,7 @@ margin: 1em 0px;

}

.arrow-right {
.arrow-right {
border-color: rgba(212,228,239,1) blue rgba(223, 235, 243, 1) gray;
border-style: solid;
border-width: 6px 0px 6px 6px;
Expand All @@ -86,7 +93,7 @@ margin: 1em 0px;
line-height: 34px;
max-width: 900px;
font-family: helvetica;
text-align: justify;
text-align: justify;
color: #444;

}
}
Loading

0 comments on commit 78588ad

Please sign in to comment.