From e935990120adfdd2d817c4f5e1a25e2a4fc97ccb Mon Sep 17 00:00:00 2001 From: ndxbxrme Date: Wed, 8 Jul 2015 20:50:58 +0100 Subject: [PATCH] removed collection2, more sensible sorting --- app/index.coffee | 1 - app/index.js | 1 - .../bootstrap/model/things(coffee).coffee | 20 +++-------- app/templates/bootstrap/model/things(js).js | 26 +++----------- .../server/startup/things.load(coffee).coffee | 33 ++++++------------ .../server/startup/things.load(js).js | 34 +++++++------------ .../material/model/things(coffee).coffee | 20 +++-------- app/templates/material/model/things(js).js | 26 +++----------- .../server/startup/things.load(coffee).coffee | 33 ++++++------------ .../server/startup/things.load(js).js | 34 +++++++------------ .../none/model/things(coffee).coffee | 20 +++-------- app/templates/none/model/things(js).js | 26 +++----------- .../server/startup/things.load(coffee).coffee | 33 ++++++------------ .../none/server/startup/things.load(js).js | 34 +++++++------------ .../purecss/model/things(coffee).coffee | 20 +++-------- app/templates/purecss/model/things(js).js | 26 +++----------- .../server/startup/things.load(coffee).coffee | 33 ++++++------------ .../purecss/server/startup/things.load(js).js | 34 +++++++------------ readme.md | 1 - 19 files changed, 132 insertions(+), 323 deletions(-) diff --git a/app/index.coffee b/app/index.coffee index 06e439c..35f4930 100644 --- a/app/index.coffee +++ b/app/index.coffee @@ -244,7 +244,6 @@ module.exports = yeoman.generators.Base.extend( meteorToAdd.push 'mquandalle:bower' if @filters.pagination meteorToAdd.push 'tmeasday:publish-counts' - meteorToAdd.push 'aldeed:collection2' meteorToAdd.push 'angularutils:pagination' angularModules.push 'angularUtils.directives.dirPagination' if @filters.auth diff --git a/app/index.js b/app/index.js index c04f4e5..bab6d89 100644 --- a/app/index.js +++ b/app/index.js @@ -243,7 +243,6 @@ } if (this.filters.pagination) { meteorToAdd.push('tmeasday:publish-counts'); - meteorToAdd.push('aldeed:collection2'); meteorToAdd.push('angularutils:pagination'); angularModules.push('angularUtils.directives.dirPagination'); } diff --git a/app/templates/bootstrap/model/things(coffee).coffee b/app/templates/bootstrap/model/things(coffee).coffee index eb60bdd..4930590 100644 --- a/app/templates/bootstrap/model/things(coffee).coffee +++ b/app/templates/bootstrap/model/things(coffee).coffee @@ -2,22 +2,12 @@ Things.allow insert: (userId, thing) -> + thing.createdAt = new Date() + thing.name_sort = thing.name.toLowerCase() true update: (userId, thing, fields, modifier) -> + thing.updatedAt = new Date() + thing.name_sort = thing.name.toLowerCase() true remove: (userId, thing) -> - true -<% if(pagination) { %> -Things.attachSchema new SimpleSchema - name: - type: String - label: 'name' - name_sort: - type: String - optional: true - autoValue: () -> - name = this.field('name') - if name.isSet - name.value.toLowerCase() - else - @unset()<% } %> \ No newline at end of file + true \ No newline at end of file diff --git a/app/templates/bootstrap/model/things(js).js b/app/templates/bootstrap/model/things(js).js index c938cdf..fe5dcaf 100644 --- a/app/templates/bootstrap/model/things(js).js +++ b/app/templates/bootstrap/model/things(js).js @@ -2,32 +2,16 @@ Things = new Mongo.Collection('things'); Things.allow({ insert: function(userId, thing) { + thing.createdAt = new Date(); + thing.name_sort = thing.name.toLowerCase(); return true; }, update: function(userId, thing, fields, modifier) { + thing.createdAt = new Date(); + thing.name_sort = thing.name.toLowerCase(); return true; }, remove: function(userId, thing) { return true; } -}); -<% if(pagination) { %> -Things.attachSchema(new SimpleSchema({ - name: { - type: String, - label: 'name' - }, - name_sort: { - type: String, - optional: true, - autoValue: function() { - var name = this.field('name'); - if(name.isSet) { - return name.value.toLowerCase(); - } - else { - return this.unset(); - } - } - } -}));<% } %> \ No newline at end of file +}); \ No newline at end of file diff --git a/app/templates/bootstrap/server/startup/things.load(coffee).coffee b/app/templates/bootstrap/server/startup/things.load(coffee).coffee index 07083f3..dd384f7 100644 --- a/app/templates/bootstrap/server/startup/things.load(coffee).coffee +++ b/app/templates/bootstrap/server/startup/things.load(coffee).coffee @@ -1,27 +1,16 @@ Meteor.startup -> if Things.find().count() == 0 things = [ - { - name: 'Data on the Wire' - } - { - name: 'One Language' - } - { - name: 'Database Everywhere' - } - { - name: 'Latency Compensation' - } - { - name: 'Full Stack Reactivity' - } - { - name: 'Embrace the Ecosystem' - } - { - name: 'Simplicity Equals Productivity' - } + 'Data on the Wire' + 'One Language' + 'Database Everywhere' + 'Latency Compensation' + 'Full Stack Reactivity' + 'Embrace the Ecosystem' + 'Simplicity Equals Productivity' ] things.forEach (thing) -> - Things.insert thing \ No newline at end of file + Things.insert + name: thing + name_sort: thing.toLowerCase() + createdAt: new Date() \ No newline at end of file diff --git a/app/templates/bootstrap/server/startup/things.load(js).js b/app/templates/bootstrap/server/startup/things.load(js).js index 89f6157..defee8b 100644 --- a/app/templates/bootstrap/server/startup/things.load(js).js +++ b/app/templates/bootstrap/server/startup/things.load(js).js @@ -1,30 +1,20 @@ Meteor.startup(function() { if(Things.find().count() === 0) { var things = [ - { - name: 'Data on the Wire' - }, - { - name: 'One Language' - }, - { - name: 'Database Everywhere' - }, - { - name: 'Latency Compensation' - }, - { - name: 'Full Stack Reactivity' - }, - { - name: 'Embrace the Ecosystem' - }, - { - name: 'Simplicity Equals Productivity' - } + 'Data on the Wire', + 'One Language', + 'Database Everywhere', + 'Latency Compensation', + 'Full Stack Reactivity', + 'Embrace the Ecosystem', + 'Simplicity Equals Productivity' ]; things.forEach(function(thing) { - Things.insert(thing); + Things.insert({ + name: thing, + name_sort: thing.toLowerCase(), + createdAt: new Date() + }); }); } }); \ No newline at end of file diff --git a/app/templates/material/model/things(coffee).coffee b/app/templates/material/model/things(coffee).coffee index eb60bdd..4930590 100644 --- a/app/templates/material/model/things(coffee).coffee +++ b/app/templates/material/model/things(coffee).coffee @@ -2,22 +2,12 @@ Things.allow insert: (userId, thing) -> + thing.createdAt = new Date() + thing.name_sort = thing.name.toLowerCase() true update: (userId, thing, fields, modifier) -> + thing.updatedAt = new Date() + thing.name_sort = thing.name.toLowerCase() true remove: (userId, thing) -> - true -<% if(pagination) { %> -Things.attachSchema new SimpleSchema - name: - type: String - label: 'name' - name_sort: - type: String - optional: true - autoValue: () -> - name = this.field('name') - if name.isSet - name.value.toLowerCase() - else - @unset()<% } %> \ No newline at end of file + true \ No newline at end of file diff --git a/app/templates/material/model/things(js).js b/app/templates/material/model/things(js).js index c938cdf..fe5dcaf 100644 --- a/app/templates/material/model/things(js).js +++ b/app/templates/material/model/things(js).js @@ -2,32 +2,16 @@ Things = new Mongo.Collection('things'); Things.allow({ insert: function(userId, thing) { + thing.createdAt = new Date(); + thing.name_sort = thing.name.toLowerCase(); return true; }, update: function(userId, thing, fields, modifier) { + thing.createdAt = new Date(); + thing.name_sort = thing.name.toLowerCase(); return true; }, remove: function(userId, thing) { return true; } -}); -<% if(pagination) { %> -Things.attachSchema(new SimpleSchema({ - name: { - type: String, - label: 'name' - }, - name_sort: { - type: String, - optional: true, - autoValue: function() { - var name = this.field('name'); - if(name.isSet) { - return name.value.toLowerCase(); - } - else { - return this.unset(); - } - } - } -}));<% } %> \ No newline at end of file +}); \ No newline at end of file diff --git a/app/templates/material/server/startup/things.load(coffee).coffee b/app/templates/material/server/startup/things.load(coffee).coffee index 07083f3..dd384f7 100644 --- a/app/templates/material/server/startup/things.load(coffee).coffee +++ b/app/templates/material/server/startup/things.load(coffee).coffee @@ -1,27 +1,16 @@ Meteor.startup -> if Things.find().count() == 0 things = [ - { - name: 'Data on the Wire' - } - { - name: 'One Language' - } - { - name: 'Database Everywhere' - } - { - name: 'Latency Compensation' - } - { - name: 'Full Stack Reactivity' - } - { - name: 'Embrace the Ecosystem' - } - { - name: 'Simplicity Equals Productivity' - } + 'Data on the Wire' + 'One Language' + 'Database Everywhere' + 'Latency Compensation' + 'Full Stack Reactivity' + 'Embrace the Ecosystem' + 'Simplicity Equals Productivity' ] things.forEach (thing) -> - Things.insert thing \ No newline at end of file + Things.insert + name: thing + name_sort: thing.toLowerCase() + createdAt: new Date() \ No newline at end of file diff --git a/app/templates/material/server/startup/things.load(js).js b/app/templates/material/server/startup/things.load(js).js index 89f6157..defee8b 100644 --- a/app/templates/material/server/startup/things.load(js).js +++ b/app/templates/material/server/startup/things.load(js).js @@ -1,30 +1,20 @@ Meteor.startup(function() { if(Things.find().count() === 0) { var things = [ - { - name: 'Data on the Wire' - }, - { - name: 'One Language' - }, - { - name: 'Database Everywhere' - }, - { - name: 'Latency Compensation' - }, - { - name: 'Full Stack Reactivity' - }, - { - name: 'Embrace the Ecosystem' - }, - { - name: 'Simplicity Equals Productivity' - } + 'Data on the Wire', + 'One Language', + 'Database Everywhere', + 'Latency Compensation', + 'Full Stack Reactivity', + 'Embrace the Ecosystem', + 'Simplicity Equals Productivity' ]; things.forEach(function(thing) { - Things.insert(thing); + Things.insert({ + name: thing, + name_sort: thing.toLowerCase(), + createdAt: new Date() + }); }); } }); \ No newline at end of file diff --git a/app/templates/none/model/things(coffee).coffee b/app/templates/none/model/things(coffee).coffee index eb60bdd..4930590 100644 --- a/app/templates/none/model/things(coffee).coffee +++ b/app/templates/none/model/things(coffee).coffee @@ -2,22 +2,12 @@ Things.allow insert: (userId, thing) -> + thing.createdAt = new Date() + thing.name_sort = thing.name.toLowerCase() true update: (userId, thing, fields, modifier) -> + thing.updatedAt = new Date() + thing.name_sort = thing.name.toLowerCase() true remove: (userId, thing) -> - true -<% if(pagination) { %> -Things.attachSchema new SimpleSchema - name: - type: String - label: 'name' - name_sort: - type: String - optional: true - autoValue: () -> - name = this.field('name') - if name.isSet - name.value.toLowerCase() - else - @unset()<% } %> \ No newline at end of file + true \ No newline at end of file diff --git a/app/templates/none/model/things(js).js b/app/templates/none/model/things(js).js index c938cdf..fe5dcaf 100644 --- a/app/templates/none/model/things(js).js +++ b/app/templates/none/model/things(js).js @@ -2,32 +2,16 @@ Things = new Mongo.Collection('things'); Things.allow({ insert: function(userId, thing) { + thing.createdAt = new Date(); + thing.name_sort = thing.name.toLowerCase(); return true; }, update: function(userId, thing, fields, modifier) { + thing.createdAt = new Date(); + thing.name_sort = thing.name.toLowerCase(); return true; }, remove: function(userId, thing) { return true; } -}); -<% if(pagination) { %> -Things.attachSchema(new SimpleSchema({ - name: { - type: String, - label: 'name' - }, - name_sort: { - type: String, - optional: true, - autoValue: function() { - var name = this.field('name'); - if(name.isSet) { - return name.value.toLowerCase(); - } - else { - return this.unset(); - } - } - } -}));<% } %> \ No newline at end of file +}); \ No newline at end of file diff --git a/app/templates/none/server/startup/things.load(coffee).coffee b/app/templates/none/server/startup/things.load(coffee).coffee index 07083f3..dd384f7 100644 --- a/app/templates/none/server/startup/things.load(coffee).coffee +++ b/app/templates/none/server/startup/things.load(coffee).coffee @@ -1,27 +1,16 @@ Meteor.startup -> if Things.find().count() == 0 things = [ - { - name: 'Data on the Wire' - } - { - name: 'One Language' - } - { - name: 'Database Everywhere' - } - { - name: 'Latency Compensation' - } - { - name: 'Full Stack Reactivity' - } - { - name: 'Embrace the Ecosystem' - } - { - name: 'Simplicity Equals Productivity' - } + 'Data on the Wire' + 'One Language' + 'Database Everywhere' + 'Latency Compensation' + 'Full Stack Reactivity' + 'Embrace the Ecosystem' + 'Simplicity Equals Productivity' ] things.forEach (thing) -> - Things.insert thing \ No newline at end of file + Things.insert + name: thing + name_sort: thing.toLowerCase() + createdAt: new Date() \ No newline at end of file diff --git a/app/templates/none/server/startup/things.load(js).js b/app/templates/none/server/startup/things.load(js).js index 89f6157..defee8b 100644 --- a/app/templates/none/server/startup/things.load(js).js +++ b/app/templates/none/server/startup/things.load(js).js @@ -1,30 +1,20 @@ Meteor.startup(function() { if(Things.find().count() === 0) { var things = [ - { - name: 'Data on the Wire' - }, - { - name: 'One Language' - }, - { - name: 'Database Everywhere' - }, - { - name: 'Latency Compensation' - }, - { - name: 'Full Stack Reactivity' - }, - { - name: 'Embrace the Ecosystem' - }, - { - name: 'Simplicity Equals Productivity' - } + 'Data on the Wire', + 'One Language', + 'Database Everywhere', + 'Latency Compensation', + 'Full Stack Reactivity', + 'Embrace the Ecosystem', + 'Simplicity Equals Productivity' ]; things.forEach(function(thing) { - Things.insert(thing); + Things.insert({ + name: thing, + name_sort: thing.toLowerCase(), + createdAt: new Date() + }); }); } }); \ No newline at end of file diff --git a/app/templates/purecss/model/things(coffee).coffee b/app/templates/purecss/model/things(coffee).coffee index eb60bdd..4930590 100644 --- a/app/templates/purecss/model/things(coffee).coffee +++ b/app/templates/purecss/model/things(coffee).coffee @@ -2,22 +2,12 @@ Things.allow insert: (userId, thing) -> + thing.createdAt = new Date() + thing.name_sort = thing.name.toLowerCase() true update: (userId, thing, fields, modifier) -> + thing.updatedAt = new Date() + thing.name_sort = thing.name.toLowerCase() true remove: (userId, thing) -> - true -<% if(pagination) { %> -Things.attachSchema new SimpleSchema - name: - type: String - label: 'name' - name_sort: - type: String - optional: true - autoValue: () -> - name = this.field('name') - if name.isSet - name.value.toLowerCase() - else - @unset()<% } %> \ No newline at end of file + true \ No newline at end of file diff --git a/app/templates/purecss/model/things(js).js b/app/templates/purecss/model/things(js).js index c938cdf..fe5dcaf 100644 --- a/app/templates/purecss/model/things(js).js +++ b/app/templates/purecss/model/things(js).js @@ -2,32 +2,16 @@ Things = new Mongo.Collection('things'); Things.allow({ insert: function(userId, thing) { + thing.createdAt = new Date(); + thing.name_sort = thing.name.toLowerCase(); return true; }, update: function(userId, thing, fields, modifier) { + thing.createdAt = new Date(); + thing.name_sort = thing.name.toLowerCase(); return true; }, remove: function(userId, thing) { return true; } -}); -<% if(pagination) { %> -Things.attachSchema(new SimpleSchema({ - name: { - type: String, - label: 'name' - }, - name_sort: { - type: String, - optional: true, - autoValue: function() { - var name = this.field('name'); - if(name.isSet) { - return name.value.toLowerCase(); - } - else { - return this.unset(); - } - } - } -}));<% } %> \ No newline at end of file +}); \ No newline at end of file diff --git a/app/templates/purecss/server/startup/things.load(coffee).coffee b/app/templates/purecss/server/startup/things.load(coffee).coffee index 07083f3..dd384f7 100644 --- a/app/templates/purecss/server/startup/things.load(coffee).coffee +++ b/app/templates/purecss/server/startup/things.load(coffee).coffee @@ -1,27 +1,16 @@ Meteor.startup -> if Things.find().count() == 0 things = [ - { - name: 'Data on the Wire' - } - { - name: 'One Language' - } - { - name: 'Database Everywhere' - } - { - name: 'Latency Compensation' - } - { - name: 'Full Stack Reactivity' - } - { - name: 'Embrace the Ecosystem' - } - { - name: 'Simplicity Equals Productivity' - } + 'Data on the Wire' + 'One Language' + 'Database Everywhere' + 'Latency Compensation' + 'Full Stack Reactivity' + 'Embrace the Ecosystem' + 'Simplicity Equals Productivity' ] things.forEach (thing) -> - Things.insert thing \ No newline at end of file + Things.insert + name: thing + name_sort: thing.toLowerCase() + createdAt: new Date() \ No newline at end of file diff --git a/app/templates/purecss/server/startup/things.load(js).js b/app/templates/purecss/server/startup/things.load(js).js index 89f6157..defee8b 100644 --- a/app/templates/purecss/server/startup/things.load(js).js +++ b/app/templates/purecss/server/startup/things.load(js).js @@ -1,30 +1,20 @@ Meteor.startup(function() { if(Things.find().count() === 0) { var things = [ - { - name: 'Data on the Wire' - }, - { - name: 'One Language' - }, - { - name: 'Database Everywhere' - }, - { - name: 'Latency Compensation' - }, - { - name: 'Full Stack Reactivity' - }, - { - name: 'Embrace the Ecosystem' - }, - { - name: 'Simplicity Equals Productivity' - } + 'Data on the Wire', + 'One Language', + 'Database Everywhere', + 'Latency Compensation', + 'Full Stack Reactivity', + 'Embrace the Ecosystem', + 'Simplicity Equals Productivity' ]; things.forEach(function(thing) { - Things.insert(thing); + Things.insert({ + name: thing, + name_sort: thing.toLowerCase(), + createdAt: new Date() + }); }); } }); \ No newline at end of file diff --git a/readme.md b/readme.md index 5874e7b..0302586 100644 --- a/readme.md +++ b/readme.md @@ -181,7 +181,6 @@ These packages are installed optionally depending on your configuration: * bootstrap' * angular-ui-bootstrap * publish-counts -* collection2 * pagination ## Configuration