From a26589157ece158d0fa06ec2a90d49cb601972ff Mon Sep 17 00:00:00 2001 From: Thaum Date: Tue, 9 Dec 2014 13:42:05 +0000 Subject: [PATCH] Added more material design touch response, swipe pages, and began effects lists --- README.md | 11 + rpg-docs/.meteor/packages | 2 - rpg-docs/.meteor/versions | 2 - .../Character/SubSchemas/Effect/Effect.js | 4 +- rpg-docs/client/globalHelpers/session.js | 3 + rpg-docs/client/globalHelpers/signedString.js | 3 + .../client/views/character/Stats/stats.html | 132 ++++++--- .../client/views/character/Stats/stats.js | 91 ++++++ .../character/abilityCards/abilityCards.css | 1 + .../character/abilityCards/abilityCards.html | 6 + .../views/character/characterSheet.html | 17 +- .../client/views/character/characterSheet.js | 30 +- .../client/views/character/skills/skills.css | 5 + .../client/views/character/skills/skills.html | 1 + rpg-docs/client/views/index.html | 19 +- .../paperTemplates/clickCard/clickCard.html | 6 + .../paperTemplates/clickCard/clickCard.js | 8 + .../views/paperTemplates/ripple/ripple.css | 8 + .../views/paperTemplates/ripple/ripple.html | 7 + rpg-docs/lib/methods/updateEffect.js | 12 + rpg-docs/nohup.out | 10 + .../bower_components/swipe-pages/.bowerrc | 3 + .../swipe-pages/.gitattributes | 1 + .../bower_components/swipe-pages/.gitignore | 6 + .../bower_components/swipe-pages/README.md | 35 +++ .../bower_components/swipe-pages/bower.json | 16 + .../bower_components/swipe-pages/demo.html | 22 ++ .../bower_components/swipe-pages/index.html | 15 + .../swipe-pages/swipe-page.css | 15 + .../swipe-pages/swipe-page.html | 30 ++ .../swipe-pages/swipe-pages.css | 20 ++ .../swipe-pages/swipe-pages.html | 279 ++++++++++++++++++ .../swipe-detect/swipe-detect.html | 83 ++++++ 33 files changed, 840 insertions(+), 63 deletions(-) create mode 100644 rpg-docs/client/globalHelpers/session.js create mode 100644 rpg-docs/client/globalHelpers/signedString.js create mode 100644 rpg-docs/client/views/character/Stats/stats.js create mode 100644 rpg-docs/client/views/paperTemplates/clickCard/clickCard.html create mode 100644 rpg-docs/client/views/paperTemplates/clickCard/clickCard.js create mode 100644 rpg-docs/client/views/paperTemplates/ripple/ripple.css create mode 100644 rpg-docs/client/views/paperTemplates/ripple/ripple.html create mode 100644 rpg-docs/lib/methods/updateEffect.js create mode 100644 rpg-docs/public/bower_components/swipe-pages/.bowerrc create mode 100644 rpg-docs/public/bower_components/swipe-pages/.gitattributes create mode 100644 rpg-docs/public/bower_components/swipe-pages/.gitignore create mode 100644 rpg-docs/public/bower_components/swipe-pages/README.md create mode 100644 rpg-docs/public/bower_components/swipe-pages/bower.json create mode 100644 rpg-docs/public/bower_components/swipe-pages/demo.html create mode 100644 rpg-docs/public/bower_components/swipe-pages/index.html create mode 100644 rpg-docs/public/bower_components/swipe-pages/swipe-page.css create mode 100644 rpg-docs/public/bower_components/swipe-pages/swipe-page.html create mode 100644 rpg-docs/public/bower_components/swipe-pages/swipe-pages.css create mode 100644 rpg-docs/public/bower_components/swipe-pages/swipe-pages.html create mode 100644 rpg-docs/public/custom_components/swipe-detect/swipe-detect.html diff --git a/README.md b/README.md index 83d06065..4a9302cb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,14 @@ +TODO +==== + +Strip the core interaction out of swipe-pages to create an element that just listens to swipe events + +wishlist: + +* swipes are emitted as an event if possible +* swiping should translate the element +* it should bounce back to its resting position when released + Packages used ============= diff --git a/rpg-docs/.meteor/packages b/rpg-docs/.meteor/packages index 804fa513..061bf2a7 100644 --- a/rpg-docs/.meteor/packages +++ b/rpg-docs/.meteor/packages @@ -15,5 +15,3 @@ cw4gn3r:jquery-event-drag underscore aldeed:collection2 aldeed:autoform -multiply:iron-router-progress - diff --git a/rpg-docs/.meteor/versions b/rpg-docs/.meteor/versions index 31008504..14525024 100644 --- a/rpg-docs/.meteor/versions +++ b/rpg-docs/.meteor/versions @@ -14,7 +14,6 @@ blaze@2.0.3 boilerplate-generator@1.0.1 callback-hook@1.0.1 check@1.0.2 -coffeescript@1.0.4 ctl-helper@1.0.4 ctl@1.0.2 cw4gn3r:jquery-event-drag@2.2.0 @@ -54,7 +53,6 @@ mobile-status-bar@1.0.1 mongo-livedata@1.0.6 mongo@1.0.8 mrt:moment@2.6.0 -multiply:iron-router-progress@1.0.0 npm-bcrypt@0.7.7 observe-sequence@1.0.3 ordered-dict@1.0.1 diff --git a/rpg-docs/Model/Character/SubSchemas/Effect/Effect.js b/rpg-docs/Model/Character/SubSchemas/Effect/Effect.js index ecca972e..4a858dae 100644 --- a/rpg-docs/Model/Character/SubSchemas/Effect/Effect.js +++ b/rpg-docs/Model/Character/SubSchemas/Effect/Effect.js @@ -30,7 +30,7 @@ Schemas.Effect = new SimpleSchema({ //indicates what the effect originated from type: { type: String, - defaultValue: "default", - allowedValues: ["default", "inate", "class", "race", "feat", "equippedMagic", "equippedMundane", "external"] + defaultValue: "editable", + allowedValues: ["editable", "feat", "buff", "equipment", "inate"] } }); \ No newline at end of file diff --git a/rpg-docs/client/globalHelpers/session.js b/rpg-docs/client/globalHelpers/session.js new file mode 100644 index 00000000..3d01607c --- /dev/null +++ b/rpg-docs/client/globalHelpers/session.js @@ -0,0 +1,3 @@ +Template.registerHelper("session", function(key){ + return Session.get(key); +}); \ No newline at end of file diff --git a/rpg-docs/client/globalHelpers/signedString.js b/rpg-docs/client/globalHelpers/signedString.js new file mode 100644 index 00000000..f182353c --- /dev/null +++ b/rpg-docs/client/globalHelpers/signedString.js @@ -0,0 +1,3 @@ +Template.registerHelper("signedString", function(number){ + return number > 0? "+" + number : "" + number; +}); \ No newline at end of file diff --git a/rpg-docs/client/views/character/Stats/stats.html b/rpg-docs/client/views/character/Stats/stats.html index a91846da..d765894e 100644 --- a/rpg-docs/client/views/character/Stats/stats.html +++ b/rpg-docs/client/views/character/Stats/stats.html @@ -4,70 +4,72 @@ {{> abilityCards}}
- + {{#clickCard class="card" id="armor"}}

{{attributeValue "armor"}}

Armor

-
- + {{/clickCard}} + {{#clickCard class="card" id="initiative"}}

{{skillMod "initiative"}}

Initiative

-
- + {{/clickCard}} + {{#clickCard class="card" id="proficiencyBonus"}}

{{attributeValue "proficiencyBonus"}}

Proficiency Bonus

-
- + {{/clickCard}} + {{#clickCard class="card" id="speed"}}

{{attributeValue "speed"}}

Speed

-
- + {{/clickCard}} + {{#clickCard class="card" id="passivePerception"}}

{{passiveSkill "perception"}}

Passive Perception

-
- -

{{> hitDice hitDice="d6HitDice" d="6"}}

-

{{> hitDice hitDice="d8HitDice" d="8"}}

-

{{> hitDice hitDice="d10HitDice" d="10"}}

-

{{> hitDice hitDice="d12HitDice" d="12"}}

+ {{/clickCard}} + {{#clickCard class="card" id="hitDice"}} +

{{> hitDice hitDice="d6HitDice" d="6"}}

+

{{> hitDice hitDice="d8HitDice" d="8"}}

+

{{> hitDice hitDice="d10HitDice" d="10"}}

+

{{> hitDice hitDice="d12HitDice" d="12"}}

Hit Dice

-
+ {{/clickCard}} {{# if canCast}} - -

{{> spellSlots}}

-

Spell Slots

-
+ {{#clickCard class="card" id="spellSlots"}} +

{{> spellSlots}}

+

Spell Slots

+ {{/clickCard}} {{/if}} {{# if attributeBase "rages"}} - -

{{attributeValue "rages"}}

-

rages

-
+ {{#clickCard class="card" id="rages"}} +

{{attributeValue "rages"}}

+

rages

+ {{/clickCard}} {{/if}} {{# if attributeBase "sorceryPoints"}} - -

{{attributeValue "sorceryPoints"}}

-

Sorcery Points

-
+ {{#clickCard class="card" id="sorceryPoints"}} +

{{attributeValue "sorceryPoints"}}

+

Sorcery Points

+ {{/clickCard}} {{/if}} {{# if attributeBase "expertiseDice"}} - -

{{attributeValue "expertiseDice"}}

-

Expertise Dice

-
+ {{#clickCard class="card" id="expertiseDice"}} +

{{attributeValue "expertiseDice"}}

+

Expertise Dice

+ {{/clickCard}} {{/if}} {{# if attributeBase "superiorityDice"}} - -

{{attributeValue "superiorityDice"}}

-

Superiority Dice

-
+ {{#clickCard class="card" id="superiorityDice"}} +

{{attributeValue "superiorityDice"}}

+

Superiority Dice

+ {{/clickCard}} {{/if}}
+ {{> attributeDialog character=this}} + {{> skillDialog character=this}} @@ -82,3 +84,59 @@ {{attributeValue "level8SpellSlots"}} {{attributeValue "level9SpellSlots"}} + + + + + + diff --git a/rpg-docs/client/views/character/Stats/stats.js b/rpg-docs/client/views/character/Stats/stats.js new file mode 100644 index 00000000..4c264846 --- /dev/null +++ b/rpg-docs/client/views/character/Stats/stats.js @@ -0,0 +1,91 @@ +selectAttribute = function(name, title){ + Session.set("selectedAttribute", name); + Session.set("selectedAttributeTitle", title); + Session.set("editingEffect", null); + document.querySelector("#attributeDialog").toggle(); +}; + +selectSkill = function(name, title){ + Session.set("selectedSkill", name); + Session.set("selectedSkillTitle", title); + Session.set("editingEffect", null); + document.querySelector("#skillDialog").toggle(); +}; + +Template.stats.events({ + "click #armor": function(){ + console.log("clicked armor"); + selectAttribute("armor", "Armor") + } +}); + +Template.attributeDialog.helpers({ + attributeTitle: function(){ + return Session.get("selectedAttributeTitle"); + }, + attributeName: function(){ + return Session.get("selectedAttribute"); + }, + attribute: function(){ + return this.character.getField(Session.get("selectedAttribute")); + }, + effects: function(){ + var attribute = this.character.getField(Session.get("selectedAttribute")); + return _.groupBy(attribute.effects, "operation"); + }, + effectValue: function(){ + return evaluateEffect(Template.parentData(1).character._id, this); + } +}); + +Template.attributeEffect.helpers({ + editing: function(){ + return Session.get("editingEffect") === this._id; + }, + editable: function(){ + return this.type === "editable"; + }, + operation: function(){ + switch(this.operation){ + case "add": + return; + case "mul": + return Spacebars.SafeString("×"); + case "min": + return "min"; + case "max": + return "max"; + default: + return this.operation; + } + }, + signedEffectValue: function(){ + var value = evaluateEffect(Template.parentData(1).character._id, this); + return signedString(value); + } +}); + +Template.attributeEffect.events({ + "click .editButton": function(event){ + Session.set("editingEffect", this._id); + }, + "click #doneButton": function(event){ + var newEffect = {}; + //TODO setup the changed effect + var attribute = Session.get("selectedAttribute"); + var charId = Template.parentData(2)._id; + Meteor.call("updateEffect", charId, attribute, this._id, newEffect) + Session.set("editingEffect", null); + }, + "click #cancelButton": function(event){ + Session.set("editingEffect", null); + }, + "click #deleteButton": function(event){ + console.log("check that ", Template.parentData(2), "is a character"); + var attribute = Session.get("selectedAttribute"); + var pullObject = {}; + pullObject[attribute + ".effects"] = {_id: this._id}; + Characters.update(Template.parentData(2)._id, {$pull: pullObject}); + Session.set("editingEffect", null); + } +}); diff --git a/rpg-docs/client/views/character/abilityCards/abilityCards.css b/rpg-docs/client/views/character/abilityCards/abilityCards.css index 12af8054..6c6a9c2e 100644 --- a/rpg-docs/client/views/character/abilityCards/abilityCards.css +++ b/rpg-docs/client/views/character/abilityCards/abilityCards.css @@ -11,6 +11,7 @@ text-align: center; background-color: #D50000; padding: 16px; + position: relative; } .abilityFlex .card { diff --git a/rpg-docs/client/views/character/abilityCards/abilityCards.html b/rpg-docs/client/views/character/abilityCards/abilityCards.html index a2970246..b28de213 100644 --- a/rpg-docs/client/views/character/abilityCards/abilityCards.html +++ b/rpg-docs/client/views/character/abilityCards/abilityCards.html @@ -10,6 +10,7 @@