Navigation Menu

Skip to content

Commit

Permalink
upgrading to 0.9.x compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Kaplan committed Oct 6, 2014
1 parent cf8d0be commit d5df94c
Show file tree
Hide file tree
Showing 17 changed files with 271 additions and 64 deletions.
6 changes: 6 additions & 0 deletions example/.meteor/.finished-upgraders
@@ -0,0 +1,6 @@
# This file contains information which helps Meteor properly upgrade your
# app when you run 'meteor update'. You should check it into version control
# with your project.

notices-for-0.9.0
notices-for-0.9.1
1 change: 0 additions & 1 deletion example/.meteor/.gitignore
@@ -1,2 +1 @@
local
meteorite
7 changes: 7 additions & 0 deletions example/.meteor/.id
@@ -0,0 +1,7 @@
# This file contains a token that is unique to your project.
# Check it into your repository along with the rest of this directory.
# It can be used for purposes such as:
# - ensuring you don't accidentally deploy one app on top of another
# - providing package authors with aggregated statistics

92ot061m1xhfc1lp8rjj
1 change: 1 addition & 0 deletions example/.meteor/cordova-plugins
@@ -0,0 +1 @@

11 changes: 7 additions & 4 deletions example/.meteor/packages
Expand Up @@ -3,10 +3,13 @@
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

standard-app-packages
preserve-inputs
meteor-platform
autopublish
insecure
bootstrap
mrt:underscore-string-latest
coffeescript
minimongoid
accounts-ui
accounts-password
bootstrap
kaptron:minimongoid

2 changes: 1 addition & 1 deletion example/.meteor/release
@@ -1 +1 @@
0.6.5.1
METEOR@0.9.3.1
66 changes: 66 additions & 0 deletions example/.meteor/versions
@@ -0,0 +1,66 @@
accounts-base@1.1.1
accounts-password@1.0.2
accounts-ui-unstyled@1.1.2
accounts-ui@1.1.1
application-configuration@1.0.2
autopublish@1.0.0
autoupdate@1.1.1
base64@1.0.0
binary-heap@1.0.0
blaze-tools@1.0.0
blaze@2.0.1
boilerplate-generator@1.0.0
bootstrap@1.0.1
callback-hook@1.0.0
check@1.0.1
coffeescript@1.0.3
ctl-helper@1.0.3
ctl@1.0.1
ddp@1.0.9
deps@1.0.4
ejson@1.0.3
email@1.0.3
fastclick@1.0.0
follower-livedata@1.0.1
geojson-utils@1.0.0
html-tools@1.0.1
htmljs@1.0.1
http@1.0.6
id-map@1.0.0
insecure@1.0.0
jquery@1.0.0
json@1.0.0
kaptron:minimongoid@0.9.1
less@1.0.9
livedata@1.0.10
localstorage@1.0.0
logging@1.0.3
meteor-platform@1.1.1
meteor@1.1.1
minifiers@1.1.0
minimongo@1.0.3
mobile-status-bar@1.0.0
mongo@1.0.6
mrt:underscore-string-latest@2.3.3
npm-bcrypt@0.7.7
observe-sequence@1.0.2
ordered-dict@1.0.0
random@1.0.0
reactive-dict@1.0.3
reactive-var@1.0.2
reload@1.1.0
retry@1.0.0
routepolicy@1.0.1
service-configuration@1.0.1
session@1.0.2
sha@1.0.0
spacebars-compiler@1.0.2
spacebars@1.0.2
srp@1.0.0
templating@1.0.7
tracker@1.0.2
ui@1.0.3
underscore@1.0.0
url@1.0.0
webapp-hashing@1.0.0
webapp@1.1.2
File renamed without changes.
10 changes: 5 additions & 5 deletions example/minimongoid-example.html → example/example.html
Expand Up @@ -11,7 +11,7 @@

<!-- Main template -->
<template name="main">
{{#if currentUserId}}
{{#if currentUser}}
<ul class="nav nav-tabs" id="tabs">
<li class="active">
<a href="#recipes" data-toggle="tab">My Recipes</a>
Expand All @@ -23,7 +23,7 @@
<a href="#friends_recipes" data-toggle="tab">My Friends' Recipes</a>
</li>
<li style="float:right; margin-right: 100px;">
{{loginButtons}}
{{> loginButtons}}
</li>
</ul>

Expand All @@ -39,7 +39,7 @@
</div>
</div>
{{else}}
{{loginButtons}}
{{> loginButtons}}
{{/if}}
</template>

Expand Down Expand Up @@ -95,7 +95,7 @@ <h2>Choose your friends:</h2>
<h2>
{{name}}
{{#if myRecipe}}
<a class="del" href="#">&times;</a>
<a class="delete-recipe" href="#">&times;</a>
{{else}}
<span style="font-size:14px;">according to <em style="color:#188181">{{creator_name}}</em></span>
{{/if}}
Expand Down Expand Up @@ -128,7 +128,7 @@ <h4>Ingredients:</h4>
{{nice_quantity}} of {{name}}

{{#if myRecipe}}
&nbsp; <a class="del" href="#">&times;</a>
&nbsp; <a class="delete-ingredient" href="#">&times;</a>
{{/if}}
</li>
</template>
6 changes: 3 additions & 3 deletions example/minimongoid-example.js → example/example.js
Expand Up @@ -42,7 +42,7 @@ if (Meteor.isClient) {


Template.friends_recipes.recipes = function () {
var recipes = _.reduceRight(User.current().friends(), function(a, b) { return a.concat(b.recipes()); }, []);
var recipes = _.reduceRight(User.current().friends(), function(a, b) { return a.concat(b.recipes().toArray()); }, []);
return recipes;
};

Expand All @@ -58,7 +58,7 @@ if (Meteor.isClient) {
ingredients: ingredient
});
},
'click .del' : function(e, t) {
'click .delete-recipe' : function(e, t) {
e.preventDefault();
var recipe = this;
$(t.firstNode).fadeOut(function() {
Expand All @@ -68,7 +68,7 @@ if (Meteor.isClient) {
});

Template.ingredient.events({
'click .del' : function(e, t) {
'click .delete-ingredient' : function(e, t) {
e.preventDefault();
this.recipe.pull({
ingredients: {name: this.name}
Expand Down
2 changes: 1 addition & 1 deletion example/lib/models.coffee
Expand Up @@ -87,6 +87,6 @@ class @Ingredient extends Minimongoid
if @quantity == 1 then "#{@quantity} dash" else "#{@quantity} dashes"

myRecipe: ->
@recipe.myRecipe()
if @recipe then @recipe.myRecipe() else false


9 changes: 0 additions & 9 deletions example/smart.json

This file was deleted.

21 changes: 0 additions & 21 deletions example/smart.lock

This file was deleted.

10 changes: 5 additions & 5 deletions lib/minimongoid.coffee
Expand Up @@ -14,12 +14,12 @@ class @Minimongoid
else
@id = attr._id
@_id = @id
# set up errors var
@initAttrsAndRelations(attr, parent)

# this function sets up all of the attributes to be stored on the model as well as
# setting up the relation methods
initAttrsAndRelations: (attr = {}, parent = null) ->
# initialize relation arrays to be an empty array, if they don't exist
@initializeRelations(attr, parent) if @id

initializeRelations: (attr = {}, parent = null) ->
for habtm in @constructor.has_and_belongs_to_many
# e.g. matchup.game_ids = []
identifier = "#{_.singularize(habtm.name)}_ids"
Expand Down Expand Up @@ -274,7 +274,7 @@ class @Minimongoid
attr = @before_create(attr) if @before_create
doc = @init(attr)
doc = doc.save(attr)
doc.initializeRelations(attr)
doc.initAttrsAndRelations(attr)
if doc and @after_create
@after_create(doc)
else
Expand Down
9 changes: 6 additions & 3 deletions package.js
@@ -1,10 +1,13 @@
Package.describe({
summary: "Mongoid inspired model architecture"
summary: "Mongoid inspired model architecture",
version: "0.9.1",
git: "https://github.com/Exygy/minimongoid.git"
});

Package.on_use(function (api) {
api.versionsFrom("METEOR@0.9.0");
var both = ['client', 'server'];
api.use(['underscore', 'underscore-string-latest', 'coffeescript'], both);
api.use(['underscore', "mrt:underscore-string-latest@2.3.3", 'coffeescript'], both);
files = [
'lib/relation.coffee',
'lib/has_many_relation.coffee',
Expand All @@ -16,7 +19,7 @@ Package.on_use(function (api) {

Package.on_test(function (api) {
var both = ['client', 'server'];
api.use(['minimongoid', 'tinytest'], both);
api.use(["kaptron:minimongoid", 'tinytest'], both);
api.add_files('tests/models.coffee', both);
api.add_files('tests/server_tests.coffee', ['server']);
api.add_files('tests/model_tests.coffee', both);
Expand Down
11 changes: 0 additions & 11 deletions smart.json

This file was deleted.

0 comments on commit d5df94c

Please sign in to comment.