Fixed stuff, enabled character deletion
This commit is contained in:
@@ -5,3 +5,4 @@
|
||||
notices-for-0.9.0
|
||||
notices-for-0.9.1
|
||||
0.9.4-platform-file
|
||||
notices-for-facebook-graph-api-2
|
||||
|
||||
@@ -14,7 +14,6 @@ reactive-var
|
||||
underscore
|
||||
aldeed:collection2
|
||||
differential:vulcanize
|
||||
msavin:mongol
|
||||
matb33:collection-hooks
|
||||
zimme:collection-softremovable
|
||||
momentjs:moment
|
||||
|
||||
@@ -1 +1 @@
|
||||
METEOR@1.0.4.2
|
||||
METEOR@1.0.5
|
||||
|
||||
@@ -4,10 +4,8 @@ accounts-ui@1.1.5
|
||||
accounts-ui-unstyled@1.1.7
|
||||
aldeed:collection2@2.3.2
|
||||
aldeed:simple-schema@1.3.0
|
||||
aldeed:template-extension@3.4.3
|
||||
amplify@1.0.0
|
||||
autoupdate@1.2.0
|
||||
babrahams:editable-json@0.3.11
|
||||
base64@1.0.3
|
||||
binary-heap@1.0.3
|
||||
blaze@2.1.0
|
||||
@@ -16,8 +14,7 @@ boilerplate-generator@1.0.3
|
||||
callback-hook@1.0.3
|
||||
check@1.0.5
|
||||
coffeescript@1.0.6
|
||||
dburles:collection-helpers@1.0.2
|
||||
dburles:mongo-collection-instances@0.3.3
|
||||
dburles:collection-helpers@1.0.3
|
||||
ddp@1.1.0
|
||||
deps@1.0.7
|
||||
differential:vulcanize@0.0.3
|
||||
@@ -25,7 +22,6 @@ ejson@1.0.6
|
||||
email@1.0.6
|
||||
fastclick@1.0.3
|
||||
geojson-utils@1.0.3
|
||||
gwendall:session-json@0.1.7
|
||||
html-tools@1.0.4
|
||||
htmljs@1.0.4
|
||||
http@1.1.0
|
||||
@@ -41,7 +37,6 @@ iron:router@1.0.7
|
||||
iron:url@1.0.7
|
||||
jquery@1.11.3_2
|
||||
json@1.0.3
|
||||
lai:collection-extensions@0.1.3
|
||||
launch-screen@1.0.2
|
||||
less@1.0.13
|
||||
livedata@1.0.13
|
||||
@@ -50,14 +45,12 @@ logging@1.0.7
|
||||
matb33:collection-hooks@0.7.11
|
||||
meteor@1.1.5
|
||||
meteor-platform@1.2.2
|
||||
meteortoys:toykit@0.2.1
|
||||
mike:mocha@0.5.2
|
||||
minifiers@1.1.4
|
||||
minimongo@1.0.7
|
||||
mobile-status-bar@1.0.3
|
||||
momentjs:moment@2.9.0
|
||||
mongo@1.1.0
|
||||
msavin:mongol@1.0.5
|
||||
npm-bcrypt@0.7.8_1
|
||||
observe-sequence@1.0.5
|
||||
ordered-dict@1.0.3
|
||||
|
||||
35
rpg-docs/Model/Users/Users.js
Normal file
35
rpg-docs/Model/Users/Users.js
Normal file
@@ -0,0 +1,35 @@
|
||||
Schema = {};
|
||||
|
||||
Schema.User = new SimpleSchema({
|
||||
username: {
|
||||
type: String,
|
||||
regEx: /^[a-z0-9A-Z_]{3,15}$/
|
||||
},
|
||||
emails: {
|
||||
type: [Object],
|
||||
// this must be optional if you also use other login services like facebook,
|
||||
// but if you use only accounts-password, then it can be required
|
||||
optional: true
|
||||
},
|
||||
"emails.$.address": {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Email
|
||||
},
|
||||
"emails.$.verified": {
|
||||
type: Boolean
|
||||
},
|
||||
createdAt: {
|
||||
type: Date
|
||||
},
|
||||
services: {
|
||||
type: Object,
|
||||
optional: true,
|
||||
blackbox: true
|
||||
},
|
||||
roles: {
|
||||
type: [String],
|
||||
optional: true
|
||||
}
|
||||
});
|
||||
|
||||
Meteor.users.attachSchema(Schema.User);
|
||||
@@ -29,7 +29,7 @@
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.red-button {
|
||||
html /deep/ .red-button {
|
||||
background: #d23f31;
|
||||
color: #fff;
|
||||
margin-top: 16px;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<template name="characterSettings">
|
||||
|
||||
</template>
|
||||
@@ -0,0 +1,3 @@
|
||||
Template.characterSettings.events({
|
||||
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
<template name="deleteCharacterConfirmation">
|
||||
<div>
|
||||
Deleting a character cannot be undone.<br>
|
||||
To continue type "{{name}}" into the box below.<br>
|
||||
<paper-input id="nameInput" label="type the characters's name here" style="width: 100%;"></paper-input><br>
|
||||
<paper-button id="deleteButton" style={{getStyle}} disabled={{cantDelete}}>Delete Character</paper-button>
|
||||
</div>
|
||||
<paper-button id="cancelButton" affirmative> Cancel </paper-button>
|
||||
</template>
|
||||
@@ -0,0 +1,26 @@
|
||||
Template.deleteCharacterConfirmation.onCreated(function(){
|
||||
this.canDelete = new ReactiveVar(false);
|
||||
});
|
||||
|
||||
Template.deleteCharacterConfirmation.helpers({
|
||||
cantDelete: function(){
|
||||
return !Template.instance().canDelete.get();
|
||||
},
|
||||
getStyle: function(){
|
||||
if(Template.instance().canDelete.get()) return "background: #d23f31; color: white;";
|
||||
}
|
||||
});
|
||||
|
||||
Template.deleteCharacterConfirmation.events({
|
||||
"change #nameInput, input #nameInput": function(event, instance){
|
||||
var canDel = instance.find("#nameInput").value === this.name;
|
||||
instance.canDelete.set(canDel);
|
||||
},
|
||||
"tap #deleteButton": function(event, instance){
|
||||
if(instance.find("#nameInput").value === this.name){
|
||||
GlobalUI.closeDialog();
|
||||
Router.go("/");
|
||||
Characters.remove(this._id);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -8,6 +8,15 @@
|
||||
<div>
|
||||
{{> colorDropdown}}
|
||||
</div>
|
||||
<paper-menu-button>
|
||||
<paper-icon-button icon="menu" noink></paper-icon-button>
|
||||
<paper-dropdown class="dropdown" halign="right">
|
||||
<core-menu class="menu" style="color: black; color: rgba(0,0,0,0.87);">
|
||||
<paper-item id="deleteCharacter"><core-icon icon="delete"></core-icon>Delete</paper-item>
|
||||
<paper-item id="shareCharacter"><core-icon icon="social:share"></core-icon>Share</paper-item>
|
||||
</core-menu>
|
||||
</paper-dropdown>
|
||||
</paper-menu-button>
|
||||
<div class="bottom fit" horizontal layout>
|
||||
<paper-tabs flex horizontal center layout id="characterSheetTabs" selected={{selectedTab}} class="{{colorClass}}">
|
||||
<paper-tab name="stats">Stats</paper-tab>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Template.characterSheet.created = function(){
|
||||
Session.setDefault(this.data._id + ".selectedTab", "stats");
|
||||
}
|
||||
};
|
||||
|
||||
var setTab = function(charId, tab){
|
||||
return Session.set(charId + ".selectedTab", tab);
|
||||
@@ -26,4 +26,11 @@ Template.characterSheet.events({
|
||||
"color-change": function(event, instance){
|
||||
Characters.update(this._id, {$set: {color: event.color}});
|
||||
},
|
||||
"tap #deleteCharacter": function(event, instance){
|
||||
GlobalUI.showDialog({
|
||||
heading: "Delete " + this.name,
|
||||
data: this,
|
||||
template: "deleteCharacterConfirmation",
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
{{#each attuned}}
|
||||
{{>inventoryItem}}
|
||||
{{/each}}
|
||||
<div class="list-subhead" layout horizontal center>{{name}}</div>
|
||||
{{#if attuned.count}}<div class="list-subhead" layout horizontal center>Equipment</div>{{/if}}
|
||||
{{#each equipment}}
|
||||
{{>inventoryItem}}
|
||||
{{/each}}
|
||||
|
||||
@@ -5,4 +5,6 @@
|
||||
.characterCard{
|
||||
width: 272px;
|
||||
margin: 4px;
|
||||
min-width: 272px;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
<div class="scroll-y" fit>
|
||||
{{#if currentUser}}
|
||||
{{#if characters.count}}
|
||||
<div layout horizontal class="characterCards">
|
||||
<div layout horizontal wrap class="characterCards">
|
||||
{{# each characters}}
|
||||
{{#with characterDetails}}
|
||||
{{#containerCardHelper this}}{{alignment}} {{gender}} {{race}}{{/containerCardHelper}}
|
||||
{{/with}}
|
||||
{{/each}}
|
||||
{{> gridPadding class="characterCard" num=12}}
|
||||
</div>
|
||||
{{> gridPadding class="characterCard" num=12}}
|
||||
{{else}}
|
||||
<div layout vertical center center-justified>
|
||||
<div>You don't seem to have any characters :(</div>
|
||||
|
||||
@@ -10,14 +10,9 @@ Template.characterList.helpers({
|
||||
|
||||
Template.characterList.events({
|
||||
"tap .characterCard": function(event, instance){
|
||||
console.log(this);
|
||||
Router.go("characterSheet", {_id: this._id});
|
||||
},
|
||||
"tap .addCharacter": function (event, template) {
|
||||
Characters.insert({owner: Meteor.userId()});
|
||||
},
|
||||
"tap #deleteChar": function(event, template){
|
||||
console.log("deleting", this);
|
||||
Characters.remove(this._id);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
<core-drawer-panel>
|
||||
<core-header-panel drawer navigation flex mode="seamed" class="white">
|
||||
{{> loginButtons}}
|
||||
<core-menu theme="core-light-theme">
|
||||
<paper-item id="charactersMenuButton">Characters</paper-item>
|
||||
</core-menu>
|
||||
<paper-item id="charactersMenuButton">Characters</paper-item>
|
||||
</core-header-panel>
|
||||
<core-animated-pages main
|
||||
navigation
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<template name="/signIn">
|
||||
<template name="signIn">
|
||||
<div id="accountSummary" class="padded white-text">
|
||||
{{#if loggingIn}}
|
||||
<paper-spinner active alt="Signing In"></paper-spinner>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
var childSchema = new SimpleSchema({
|
||||
parent: { type: Object },
|
||||
'parent.collection': { type: String },
|
||||
'parent.id': { type: String, regEx: SimpleSchema.RegEx.Id }
|
||||
'parent.id': { type: String, regEx: SimpleSchema.RegEx.Id },
|
||||
'removedWithParent': { type: Boolean, defaultValue: false},
|
||||
});
|
||||
|
||||
var joinWithDefaultKeys = function(keys){
|
||||
@@ -11,7 +12,8 @@ var joinWithDefaultKeys = function(keys){
|
||||
'removedAt',
|
||||
'removedBy',
|
||||
'restoredAt',
|
||||
'restoredBy'
|
||||
'restoredBy',
|
||||
'removedWith',
|
||||
];
|
||||
return _.union(keys, defaultKeys);
|
||||
};
|
||||
@@ -54,7 +56,7 @@ makeChild = function(collection, inheritedKeys){
|
||||
return getParent(this);
|
||||
},
|
||||
getParentCollection: function(){
|
||||
return Meteor.isClient?
|
||||
return Meteor.isClient?
|
||||
window[this.parent.collection] : global[this.parent.collection];
|
||||
}
|
||||
});
|
||||
@@ -64,6 +66,13 @@ makeChild = function(collection, inheritedKeys){
|
||||
inheritParentProperties(doc, collection);
|
||||
});
|
||||
|
||||
collection.before.update(function(userId, doc, fieldNames, modifier, options){
|
||||
//if we are restoring this asset, unmark that it was removed with its parent, we no longer care
|
||||
if( modifier && modifier.$set && modifier.$set.removed === false ){
|
||||
modifier.$set.removedWithParent = false;
|
||||
}
|
||||
});
|
||||
|
||||
collection.after.update(function (userId, doc, fieldNames, modifier, options) {
|
||||
if(modifier && modifier.$set){
|
||||
//when we change parents, inherit its properties
|
||||
@@ -113,6 +122,7 @@ Meteor.methods({
|
||||
check(parent, {_id: String, charId: String});
|
||||
check(modifier, Object);
|
||||
checkPermission(this.userId, parent.charId);
|
||||
var selector = {'parent.id': parent._id};
|
||||
_.each(childCollections, function(collection){
|
||||
var thisModifier;
|
||||
if(limitToInheritance){
|
||||
@@ -121,7 +131,16 @@ Meteor.methods({
|
||||
thisModifier = _.clone(modifier);
|
||||
}
|
||||
if(_.isEmpty(thisModifier)) return;
|
||||
collection.update( {'parent.id': parent._id}, thisModifier, {multi: true, removed: true});
|
||||
if(modifier.$set){
|
||||
if(modifier.$set.removed === true){
|
||||
//note that this item is inheriting a soft removal
|
||||
modifier.$set.removedWithParent = true;
|
||||
} else if (modifier.$set.removed === false){
|
||||
//only ressurect children who inherited a soft removal
|
||||
selector = selector.removedWithParent = true;
|
||||
}
|
||||
}
|
||||
collection.update( selector, thisModifier, {multi: true, removed: true});
|
||||
});
|
||||
},
|
||||
removeChildren: function (parent) {
|
||||
|
||||
Reference in New Issue
Block a user