Compare commits
43 Commits
2.0-beta.2
...
2.0-beta.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f97592ed3 | ||
|
|
562991216f | ||
|
|
109b89022e | ||
|
|
d4ca07ce9c | ||
|
|
885607f685 | ||
|
|
81460f8835 | ||
|
|
cce5f9b926 | ||
|
|
7d3a51de9d | ||
|
|
fc774fcc5e | ||
|
|
0f37a49b95 | ||
|
|
9814e20091 | ||
|
|
d89cb77040 | ||
|
|
8590d29abf | ||
|
|
9298754dc9 | ||
|
|
e2d6d40bb3 | ||
|
|
152677b023 | ||
|
|
838e2ed35f | ||
|
|
60ae1ef604 | ||
|
|
ecfe5f1360 | ||
|
|
292d3c3f37 | ||
|
|
3c26bb2fc6 | ||
|
|
ada1355c29 | ||
|
|
2662af8ea2 | ||
|
|
26b68dccef | ||
|
|
0717f8e8d7 | ||
|
|
5cf0330e03 | ||
|
|
1978a2e4c7 | ||
|
|
5a2e500348 | ||
|
|
7d4356592a | ||
|
|
2c448d1748 | ||
|
|
4f96d817d5 | ||
|
|
f9998eabc4 | ||
|
|
623cff584c | ||
|
|
aa34508cb3 | ||
|
|
6678bc1cea | ||
|
|
0324b9f7c3 | ||
|
|
ccac142ec6 | ||
|
|
fe3fa56541 | ||
|
|
480da6fc7d | ||
|
|
6ffb48b7b6 | ||
|
|
82150df5e0 | ||
|
|
9a120a6e9a | ||
|
|
f385c2857e |
@@ -3,50 +3,44 @@
|
|||||||
# 'meteor add' and 'meteor remove' will edit this file for you,
|
# 'meteor add' and 'meteor remove' will edit this file for you,
|
||||||
# but you can also edit it by hand.
|
# but you can also edit it by hand.
|
||||||
|
|
||||||
accounts-password@1.6.2
|
accounts-password@1.7.0
|
||||||
accounts-ui@1.3.1
|
|
||||||
random@1.2.0
|
random@1.2.0
|
||||||
dburles:collection-helpers
|
dburles:collection-helpers
|
||||||
reactive-var@1.0.11
|
reactive-var@1.0.11
|
||||||
underscore@1.0.10
|
underscore@1.0.10
|
||||||
momentjs:moment
|
momentjs:moment
|
||||||
dburles:mongo-collection-instances
|
dburles:mongo-collection-instances
|
||||||
percolate:migrations
|
|
||||||
accounts-google@1.3.3
|
accounts-google@1.3.3
|
||||||
email@2.0.0
|
email@2.0.0
|
||||||
meteorhacks:subs-manager
|
meteorhacks:subs-manager
|
||||||
chuangbo:marked
|
chuangbo:marked
|
||||||
meteor-base@1.4.0
|
meteor-base@1.4.0
|
||||||
mobile-experience@1.1.0
|
mobile-experience@1.1.0
|
||||||
mongo@1.10.0
|
mongo@1.10.1
|
||||||
session@1.2.0
|
session@1.2.0
|
||||||
jquery@1.11.10
|
|
||||||
tracker@1.2.0
|
tracker@1.2.0
|
||||||
logging@1.1.20
|
logging@1.2.0
|
||||||
reload@1.3.0
|
reload@1.3.1
|
||||||
ejson@1.1.1
|
ejson@1.1.1
|
||||||
check@1.3.1
|
check@1.3.1
|
||||||
standard-minifier-js@2.6.0
|
standard-minifier-js@2.6.0
|
||||||
shell-server@0.5.0
|
shell-server@0.5.0
|
||||||
seba:minifiers-autoprefixer
|
|
||||||
templates:array
|
templates:array
|
||||||
ecmascript@0.14.3
|
ecmascript@0.15.0
|
||||||
es5-shim@4.8.0
|
es5-shim@4.8.0
|
||||||
reactive-dict@1.3.0
|
reactive-dict@1.3.0
|
||||||
percolate:synced-cron
|
percolate:synced-cron
|
||||||
ongoworks:speakingurl
|
ongoworks:speakingurl
|
||||||
service-configuration@1.0.11
|
service-configuration@1.0.11
|
||||||
google-config-ui@1.0.1
|
dynamic-import@0.6.0
|
||||||
dynamic-import@0.5.2
|
|
||||||
ddp-rate-limiter@1.0.9
|
ddp-rate-limiter@1.0.9
|
||||||
rate-limit@1.0.9
|
rate-limit@1.0.9
|
||||||
meteortesting:mocha
|
|
||||||
mdg:validated-method
|
mdg:validated-method
|
||||||
akryum:vue-router2
|
akryum:vue-router2
|
||||||
static-html
|
static-html
|
||||||
aldeed:collection2@3.0.0
|
aldeed:collection2@3.0.0
|
||||||
aldeed:schema-index
|
aldeed:schema-index
|
||||||
akryum:vue-component
|
zer0th:meteor-vuetify-loader
|
||||||
accounts-patreon
|
accounts-patreon
|
||||||
bozhao:link-accounts
|
bozhao:link-accounts
|
||||||
peerlibrary:reactive-publish
|
peerlibrary:reactive-publish
|
||||||
@@ -54,3 +48,6 @@ simple:rest
|
|||||||
simple:rest-method-mixin
|
simple:rest-method-mixin
|
||||||
mikowals:batch-insert
|
mikowals:batch-insert
|
||||||
peerlibrary:subscription-data
|
peerlibrary:subscription-data
|
||||||
|
seba:minifiers-autoprefixer
|
||||||
|
akryum:vue-component
|
||||||
|
akryum:vue-sass
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
METEOR@1.11.1
|
METEOR@2.1
|
||||||
|
|||||||
@@ -1,27 +1,25 @@
|
|||||||
accounts-base@1.7.0
|
accounts-base@1.8.0
|
||||||
accounts-google@1.3.3
|
accounts-google@1.3.3
|
||||||
accounts-oauth@1.2.0
|
accounts-oauth@1.2.0
|
||||||
accounts-password@1.6.2
|
accounts-password@1.7.0
|
||||||
accounts-patreon@0.1.0
|
accounts-patreon@0.1.0
|
||||||
accounts-ui@1.3.1
|
|
||||||
accounts-ui-unstyled@1.4.2
|
|
||||||
akryum:npm-check@0.1.2
|
akryum:npm-check@0.1.2
|
||||||
akryum:vue-component@0.15.2
|
akryum:vue-component@0.15.2
|
||||||
akryum:vue-component-dev-client@0.4.7
|
akryum:vue-component-dev-client@0.4.7
|
||||||
akryum:vue-component-dev-server@0.1.4
|
akryum:vue-component-dev-server@0.1.4
|
||||||
akryum:vue-router2@0.2.3
|
akryum:vue-router2@0.2.3
|
||||||
|
akryum:vue-sass@0.1.2
|
||||||
aldeed:collection2@3.2.1
|
aldeed:collection2@3.2.1
|
||||||
aldeed:schema-index@3.0.0
|
aldeed:schema-index@3.0.0
|
||||||
allow-deny@1.1.0
|
allow-deny@1.1.0
|
||||||
autoupdate@1.6.0
|
autoupdate@1.7.0
|
||||||
babel-compiler@7.5.3
|
babel-compiler@7.6.0
|
||||||
babel-runtime@1.5.0
|
babel-runtime@1.5.0
|
||||||
base64@1.0.12
|
base64@1.0.12
|
||||||
binary-heap@1.0.11
|
binary-heap@1.0.11
|
||||||
blaze@2.3.4
|
|
||||||
blaze-tools@1.0.10
|
blaze-tools@1.0.10
|
||||||
boilerplate-generator@1.7.1
|
boilerplate-generator@1.7.1
|
||||||
bozhao:link-accounts@2.2.1
|
bozhao:link-accounts@2.3.2
|
||||||
caching-compiler@1.2.2
|
caching-compiler@1.2.2
|
||||||
caching-html-compiler@1.1.3
|
caching-html-compiler@1.1.3
|
||||||
callback-hook@1.3.0
|
callback-hook@1.3.0
|
||||||
@@ -32,14 +30,14 @@ coffeescript-compiler@2.4.1
|
|||||||
dburles:collection-helpers@1.1.0
|
dburles:collection-helpers@1.1.0
|
||||||
dburles:mongo-collection-instances@0.3.5
|
dburles:mongo-collection-instances@0.3.5
|
||||||
ddp@1.4.0
|
ddp@1.4.0
|
||||||
ddp-client@2.3.3
|
ddp-client@2.4.0
|
||||||
ddp-common@1.4.0
|
ddp-common@1.4.0
|
||||||
ddp-rate-limiter@1.0.9
|
ddp-rate-limiter@1.0.9
|
||||||
ddp-server@2.3.2
|
ddp-server@2.3.2
|
||||||
deps@1.0.12
|
deps@1.0.12
|
||||||
diff-sequence@1.1.1
|
diff-sequence@1.1.1
|
||||||
dynamic-import@0.5.3
|
dynamic-import@0.6.0
|
||||||
ecmascript@0.14.3
|
ecmascript@0.15.0
|
||||||
ecmascript-runtime@0.7.0
|
ecmascript-runtime@0.7.0
|
||||||
ecmascript-runtime-client@0.11.0
|
ecmascript-runtime-client@0.11.0
|
||||||
ecmascript-runtime-server@0.10.0
|
ecmascript-runtime-server@0.10.0
|
||||||
@@ -48,49 +46,40 @@ email@2.0.0
|
|||||||
es5-shim@4.8.0
|
es5-shim@4.8.0
|
||||||
fetch@0.1.1
|
fetch@0.1.1
|
||||||
geojson-utils@1.0.10
|
geojson-utils@1.0.10
|
||||||
google-config-ui@1.0.1
|
|
||||||
google-oauth@1.3.0
|
google-oauth@1.3.0
|
||||||
hot-code-push@1.0.4
|
hot-code-push@1.0.4
|
||||||
html-tools@1.0.11
|
html-tools@1.0.11
|
||||||
htmljs@1.0.11
|
htmljs@1.0.11
|
||||||
http@1.4.2
|
http@1.4.3
|
||||||
id-map@1.1.0
|
id-map@1.1.0
|
||||||
inter-process-messaging@0.1.1
|
inter-process-messaging@0.1.1
|
||||||
jquery@1.11.11
|
|
||||||
lai:collection-extensions@0.2.1_1
|
lai:collection-extensions@0.2.1_1
|
||||||
launch-screen@1.2.0
|
launch-screen@1.2.0
|
||||||
less@2.8.0
|
|
||||||
livedata@1.0.18
|
livedata@1.0.18
|
||||||
lmieulet:meteor-coverage@1.1.4
|
|
||||||
localstorage@1.2.0
|
localstorage@1.2.0
|
||||||
logging@1.1.20
|
logging@1.2.0
|
||||||
mdg:validated-method@1.2.0
|
mdg:validated-method@1.2.0
|
||||||
meteor@1.9.3
|
meteor@1.9.3
|
||||||
meteor-base@1.4.0
|
meteor-base@1.4.0
|
||||||
meteorhacks:picker@1.0.3
|
|
||||||
meteorhacks:subs-manager@1.6.4
|
meteorhacks:subs-manager@1.6.4
|
||||||
meteortesting:browser-tests@1.3.4
|
|
||||||
meteortesting:mocha@1.1.5
|
|
||||||
meteortesting:mocha-core@7.0.1
|
|
||||||
mikowals:batch-insert@1.2.0
|
mikowals:batch-insert@1.2.0
|
||||||
minifier-css@1.5.3
|
minifier-css@1.5.3
|
||||||
minifier-js@2.6.0
|
minifier-js@2.6.0
|
||||||
minimongo@1.6.0
|
minimongo@1.6.1
|
||||||
mobile-experience@1.1.0
|
mobile-experience@1.1.0
|
||||||
mobile-status-bar@1.1.0
|
mobile-status-bar@1.1.0
|
||||||
modern-browsers@0.1.5
|
modern-browsers@0.1.5
|
||||||
modules@0.15.0
|
modules@0.16.0
|
||||||
modules-runtime@0.12.0
|
modules-runtime@0.12.0
|
||||||
momentjs:moment@2.29.1
|
momentjs:moment@2.29.1
|
||||||
mongo@1.10.0
|
mongo@1.10.1
|
||||||
mongo-decimal@0.1.1
|
mongo-decimal@0.1.2
|
||||||
mongo-dev-server@1.1.0
|
mongo-dev-server@1.1.0
|
||||||
mongo-id@1.0.7
|
mongo-id@1.0.7
|
||||||
npm-bcrypt@0.9.3
|
npm-bcrypt@0.9.3
|
||||||
npm-mongo@3.8.1
|
npm-mongo@3.8.1
|
||||||
oauth@1.3.2
|
oauth@1.3.2
|
||||||
oauth2@1.3.0
|
oauth2@1.3.0
|
||||||
observe-sequence@1.0.16
|
|
||||||
ongoworks:speakingurl@9.0.0
|
ongoworks:speakingurl@9.0.0
|
||||||
ordered-dict@1.1.0
|
ordered-dict@1.1.0
|
||||||
patreon-oauth@0.1.0
|
patreon-oauth@0.1.0
|
||||||
@@ -104,18 +93,18 @@ peerlibrary:reactive-mongo@0.4.0
|
|||||||
peerlibrary:reactive-publish@0.10.0
|
peerlibrary:reactive-publish@0.10.0
|
||||||
peerlibrary:server-autorun@0.8.0
|
peerlibrary:server-autorun@0.8.0
|
||||||
peerlibrary:subscription-data@0.8.0
|
peerlibrary:subscription-data@0.8.0
|
||||||
percolate:migrations@0.9.8
|
|
||||||
percolate:synced-cron@1.3.2
|
percolate:synced-cron@1.3.2
|
||||||
promise@0.11.2
|
promise@0.11.2
|
||||||
raix:eventemitter@0.1.3
|
raix:eventemitter@1.0.0
|
||||||
random@1.2.0
|
random@1.2.0
|
||||||
rate-limit@1.0.9
|
rate-limit@1.0.9
|
||||||
|
react-fast-refresh@0.1.0
|
||||||
reactive-dict@1.3.0
|
reactive-dict@1.3.0
|
||||||
reactive-var@1.0.11
|
reactive-var@1.0.11
|
||||||
reload@1.3.0
|
reload@1.3.1
|
||||||
retry@1.1.0
|
retry@1.1.0
|
||||||
routepolicy@1.1.0
|
routepolicy@1.1.0
|
||||||
seba:minifiers-autoprefixer@1.2.1
|
seba:minifiers-autoprefixer@2.0.1
|
||||||
service-configuration@1.0.11
|
service-configuration@1.0.11
|
||||||
session@1.2.0
|
session@1.2.0
|
||||||
sha@1.0.9
|
sha@1.0.9
|
||||||
@@ -124,19 +113,16 @@ simple:json-routes@2.1.0
|
|||||||
simple:rest@1.1.1
|
simple:rest@1.1.1
|
||||||
simple:rest-method-mixin@1.0.1
|
simple:rest-method-mixin@1.0.1
|
||||||
socket-stream-client@0.3.1
|
socket-stream-client@0.3.1
|
||||||
spacebars@1.0.15
|
|
||||||
spacebars-compiler@1.1.3
|
spacebars-compiler@1.1.3
|
||||||
srp@1.1.0
|
srp@1.1.0
|
||||||
standard-minifier-js@2.6.0
|
standard-minifier-js@2.6.0
|
||||||
static-html@1.2.2
|
static-html@1.2.2
|
||||||
templates:array@1.0.3
|
templates:array@1.0.3
|
||||||
templating@1.3.2
|
|
||||||
templating-compiler@1.3.3
|
|
||||||
templating-runtime@1.3.2
|
|
||||||
templating-tools@1.1.2
|
templating-tools@1.1.2
|
||||||
tmeasday:check-npm-versions@0.3.2
|
tmeasday:check-npm-versions@0.3.2
|
||||||
tracker@1.2.0
|
tracker@1.2.0
|
||||||
underscore@1.0.10
|
underscore@1.0.10
|
||||||
url@1.3.1
|
url@1.3.1
|
||||||
webapp@1.9.1
|
webapp@1.10.0
|
||||||
webapp-hashing@1.0.9
|
webapp-hashing@1.1.0
|
||||||
|
zer0th:meteor-vuetify-loader@0.1.30
|
||||||
|
|||||||
@@ -35,6 +35,16 @@ let CreatureSettingsSchema = new SimpleSchema({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
|
// Show the tree tab
|
||||||
|
showTreeTab: {
|
||||||
|
type: Boolean,
|
||||||
|
optional: true,
|
||||||
|
},
|
||||||
|
// Hide the spells tab
|
||||||
|
hideSpellsTab: {
|
||||||
|
type: Boolean,
|
||||||
|
optional: true,
|
||||||
|
},
|
||||||
// How much each hitDice resets on a long rest
|
// How much each hitDice resets on a long rest
|
||||||
hitDiceResetMultiplier: {
|
hitDiceResetMultiplier: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import embedInlineCalculations from '/imports/api/creature/computation/afterComp
|
|||||||
export default function applyAction({prop, log}){
|
export default function applyAction({prop, log}){
|
||||||
let content = { name: prop.name };
|
let content = { name: prop.name };
|
||||||
if (prop.summary){
|
if (prop.summary){
|
||||||
content.description = embedInlineCalculations(
|
content.value = embedInlineCalculations(
|
||||||
prop.summary, prop.summaryCalculations
|
prop.summary, prop.summaryCalculations
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default function applyAdjustment({
|
|||||||
context.errors.forEach(e => {
|
context.errors.forEach(e => {
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: 'Attribute damage error',
|
name: 'Attribute damage error',
|
||||||
error: e.message || e.toString(),
|
value: e.message || e.toString(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (damageTargets) {
|
if (damageTargets) {
|
||||||
@@ -41,15 +41,15 @@ export default function applyAdjustment({
|
|||||||
});
|
});
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: 'Attribute damage',
|
name: 'Attribute damage',
|
||||||
resultPrefix: `${prop.stat} ${prop.operation === 'set' ? 'set to' : ''}`,
|
value: `${prop.stat}${prop.operation === 'set' ? ' set to' : ''}` +
|
||||||
result: `${result.isNumber ? -result.value : result.toString()}`,
|
` ${result.isNumber ? -result.value : result.toString()}`,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: 'Attribute damage',
|
name: 'Attribute damage',
|
||||||
resultPrefix: `${prop.stat} ${prop.operation === 'set' ? 'set to' : ''}`,
|
value: `${prop.stat}${prop.operation === 'set' ? ' set to' : ''}` +
|
||||||
result: `${result.isNumber ? -result.value : result.toString()}`,
|
` ${result.isNumber ? -result.value : result.toString()}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ export default function applyAttack({
|
|||||||
|
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: criticalHit ? 'Critical Hit!' : 'To Hit',
|
name: criticalHit ? 'Critical Hit!' : 'To Hit',
|
||||||
resultPrefix: `1d20 [${value}] + ${prop.rollBonusResult} = `,
|
value: `1d20 [${value}] + ${prop.rollBonusResult} = ` + result,
|
||||||
result,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,15 +42,15 @@ export default function applyDamage({
|
|||||||
if (result.constructor.name === 'ErrorNode'){
|
if (result.constructor.name === 'ErrorNode'){
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: 'Damage error',
|
name: 'Damage error',
|
||||||
error: result.toString(),
|
value: result.toString(),
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Memoise the damage suffix for the log
|
// Memoise the damage suffix for the log
|
||||||
let suffix = (criticalHit ? ' critical ' : '') +
|
let suffix = (criticalHit ? ' critical ' : ' ') +
|
||||||
prop.damageType +
|
prop.damageType +
|
||||||
(prop.damageType !== 'healing' ? ' damage': '');
|
(prop.damageType !== ' healing ' ? ' damage ': '');
|
||||||
|
|
||||||
if (damageTargets && damageTargets.length) {
|
if (damageTargets && damageTargets.length) {
|
||||||
// Iterate through all the targets
|
// Iterate through all the targets
|
||||||
@@ -69,7 +69,7 @@ export default function applyDamage({
|
|||||||
if (result.constructor.name === 'ErrorNode' || !result.isNumber){
|
if (result.constructor.name === 'ErrorNode' || !result.isNumber){
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: 'Damage error',
|
name: 'Damage error',
|
||||||
error: result.toString(),
|
value: result.toString(),
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -86,26 +86,21 @@ export default function applyDamage({
|
|||||||
// Target is same as self, log damage as such
|
// Target is same as self, log damage as such
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name,
|
name,
|
||||||
result: damageDealt,
|
value: damageDealt + suffix + ' to self',
|
||||||
details: suffix + ' to self',
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name,
|
name,
|
||||||
resultPrefix: 'Dealt ',
|
value: 'Dealt ' + damageDealt + suffix + ` ${target.name && ' to '}${target.name}`,
|
||||||
result: damageDealt,
|
|
||||||
details: suffix + `${target.name && ' to '}${target.name}`,
|
|
||||||
});
|
});
|
||||||
// Log the damage received on that creature's log as well
|
// Log the damage received on that creature's log as well
|
||||||
insertCreatureLog.call({
|
insertCreatureLog.call({
|
||||||
log: {
|
log: {
|
||||||
|
creatureId: target._id,
|
||||||
content: [{
|
content: [{
|
||||||
name,
|
name,
|
||||||
resultPrefix: 'Recieved ',
|
value: 'Recieved ' + damageDealt + suffix,
|
||||||
result: damageDealt,
|
|
||||||
details: suffix,
|
|
||||||
}],
|
}],
|
||||||
creatureId: target._id,
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -114,8 +109,7 @@ export default function applyDamage({
|
|||||||
// There are no targets, just log the result
|
// There are no targets, just log the result
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: prop.damageType === 'healing' ? 'Healing' : 'Damage',
|
name: prop.damageType === 'healing' ? 'Healing' : 'Damage',
|
||||||
result: result.toString(),
|
value: result.toString() + suffix,
|
||||||
details: suffix,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ export default function applyRoll({
|
|||||||
}
|
}
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: prop.name,
|
name: prop.name,
|
||||||
resultPrefix: prop.variableName + ' = ' + prop.roll + ' = ',
|
value: prop.variableName + ' = ' + prop.roll + ' = ' + result.toString(),
|
||||||
result: result.toString(),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ export default function applySave({
|
|||||||
let dc = result.value;
|
let dc = result.value;
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: prop.name,
|
name: prop.name,
|
||||||
resultPrefix: ' DC ',
|
value: ' DC ' + result.toString(),
|
||||||
result: result.toString(),
|
|
||||||
});
|
});
|
||||||
if (prop.target === 'self'){
|
if (prop.target === 'self'){
|
||||||
let save = CreaturesProperties.findOne({
|
let save = CreaturesProperties.findOne({
|
||||||
@@ -36,7 +35,8 @@ export default function applySave({
|
|||||||
});
|
});
|
||||||
if (!save){
|
if (!save){
|
||||||
log.content.push({
|
log.content.push({
|
||||||
error: 'No saving throw found: ' + prop.stat,
|
name: 'Saving throw error',
|
||||||
|
value: 'No saving throw found: ' + prop.stat,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -60,9 +60,7 @@ export default function applySave({
|
|||||||
let saveSuccess = result >= dc;
|
let saveSuccess = result >= dc;
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: 'Save',
|
name: 'Save',
|
||||||
resultPrefix,
|
value: resultPrefix + result + (saveSuccess ? 'Passed' : 'Failed')
|
||||||
result,
|
|
||||||
details: saveSuccess ? 'Passed' : 'Failed'
|
|
||||||
});
|
});
|
||||||
return !saveSuccess;
|
return !saveSuccess;
|
||||||
} else {
|
} else {
|
||||||
@@ -71,7 +69,8 @@ export default function applySave({
|
|||||||
}
|
}
|
||||||
} catch (e){
|
} catch (e){
|
||||||
log.content.push({
|
log.content.push({
|
||||||
error: e.toString(),
|
name: 'Save error',
|
||||||
|
value: e.toString(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,14 +21,13 @@ export default function applyToggle({
|
|||||||
if (result.constructor.name === 'ErrorNode') {
|
if (result.constructor.name === 'ErrorNode') {
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: 'Toggle error',
|
name: 'Toggle error',
|
||||||
error: result.toString(),
|
value: result.toString(),
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: prop.name || 'Toggle',
|
name: prop.name || 'Toggle',
|
||||||
resultPrefix: prop.condition + ' = ',
|
value: prop.condition + ' = ' + result.toString(),
|
||||||
result: result.toString(),
|
|
||||||
});
|
});
|
||||||
return !!result.value;
|
return !!result.value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ const castSpellWithSlot = new ValidatedMethod({
|
|||||||
action: spell,
|
action: spell,
|
||||||
context: {slotLevel},
|
context: {slotLevel},
|
||||||
creature,
|
creature,
|
||||||
targets: [target],
|
targets: target ? [target] : [],
|
||||||
method: this,
|
method: this,
|
||||||
});
|
});
|
||||||
// Note this only recomputes the top-level creature, not the nearest one
|
// Note this only recomputes the top-level creature, not the nearest one
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export default function spendResources({prop, log}){
|
|||||||
});
|
});
|
||||||
log.content.push({
|
log.content.push({
|
||||||
name: 'Uses left',
|
name: 'Uses left',
|
||||||
result: prop.usesResult - (prop.usesUsed || 0) - 1,
|
value: prop.usesResult - (prop.usesUsed || 0) - 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,10 +84,10 @@ export default function spendResources({prop, log}){
|
|||||||
// Log all the spending
|
// Log all the spending
|
||||||
if (gainLog.length) log.content.push({
|
if (gainLog.length) log.content.push({
|
||||||
name: 'Gained',
|
name: 'Gained',
|
||||||
description: gainLog.join('\n'),
|
value: gainLog.join('\n'),
|
||||||
});
|
});
|
||||||
if (spendLog.length) log.content.push({
|
if (spendLog.length) log.content.push({
|
||||||
name: 'Spent',
|
name: 'Spent',
|
||||||
description: spendLog.join('\n'),
|
value: spendLog.join('\n'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import computeInlineCalculations from '/imports/api/creature/computation/engine/
|
|||||||
import computeConstant from '/imports/api/creature/computation/engine/computeConstant.js';
|
import computeConstant from '/imports/api/creature/computation/engine/computeConstant.js';
|
||||||
|
|
||||||
export default function computeMemo(memo){
|
export default function computeMemo(memo){
|
||||||
|
// Compute level
|
||||||
|
computeLevels(memo);
|
||||||
// Compute all constants that could be used
|
// Compute all constants that could be used
|
||||||
forOwn(memo.constantsById, constant => {
|
forOwn(memo.constantsById, constant => {
|
||||||
computeConstant (constant, memo);
|
computeConstant (constant, memo);
|
||||||
});
|
});
|
||||||
// Compute level
|
|
||||||
computeLevels(memo);
|
|
||||||
// Compute all stats, even if they are overriden
|
// Compute all stats, even if they are overriden
|
||||||
forOwn(memo.statsById, stat => {
|
forOwn(memo.statsById, stat => {
|
||||||
computeStat (stat, memo);
|
computeStat (stat, memo);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import '//imports/api/creature/creatureProperties/methods/adjustQuantity.js';
|
import '/imports/api/creature/creatureProperties/methods/adjustQuantity.js';
|
||||||
import '/imports/api/creature/creatureProperties/methods/damagePropertiesByName.js';
|
import '/imports/api/creature/creatureProperties/methods/damagePropertiesByName.js';
|
||||||
import '/imports/api/creature/creatureProperties/methods/damageProperty.js';
|
import '/imports/api/creature/creatureProperties/methods/damageProperty.js';
|
||||||
import '/imports/api/creature/creatureProperties/methods/dealDamage.js';
|
import '/imports/api/creature/creatureProperties/methods/dealDamage.js';
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { reorderDocs } from '/imports/api/parenting/order.js';
|
|||||||
import recomputeInactiveProperties from '/imports/api/creature/denormalise/recomputeInactiveProperties.js';
|
import recomputeInactiveProperties from '/imports/api/creature/denormalise/recomputeInactiveProperties.js';
|
||||||
import { recomputeCreatureByDoc } from '/imports/api/creature/computation/methods/recomputeCreature.js';
|
import { recomputeCreatureByDoc } from '/imports/api/creature/computation/methods/recomputeCreature.js';
|
||||||
import recomputeInventory from '/imports/api/creature/denormalise/recomputeInventory.js';
|
import recomputeInventory from '/imports/api/creature/denormalise/recomputeInventory.js';
|
||||||
|
import { getAncestry } from '/imports/api/parenting/parenting.js';
|
||||||
|
|
||||||
const insertProperty = new ValidatedMethod({
|
const insertProperty = new ValidatedMethod({
|
||||||
name: 'creatureProperties.insert',
|
name: 'creatureProperties.insert',
|
||||||
@@ -16,9 +17,24 @@ const insertProperty = new ValidatedMethod({
|
|||||||
numRequests: 5,
|
numRequests: 5,
|
||||||
timeInterval: 5000,
|
timeInterval: 5000,
|
||||||
},
|
},
|
||||||
run({creatureProperty}) {
|
run({creatureProperty, parentRef}) {
|
||||||
let rootCreature = getRootCreatureAncestor(creatureProperty);
|
// get the new ancestry for the properties
|
||||||
|
let {parentDoc, ancestors} = getAncestry({parentRef});
|
||||||
|
|
||||||
|
// Check permission to edit
|
||||||
|
let rootCreature;
|
||||||
|
if (parentRef.collection === 'creatures'){
|
||||||
|
rootCreature = parentDoc;
|
||||||
|
} else if (parentRef.collection === 'creatureProperties'){
|
||||||
|
rootCreature = getRootCreatureAncestor(parentDoc);
|
||||||
|
} else {
|
||||||
|
throw `${parentRef.collection} is not a valid parent collection`
|
||||||
|
}
|
||||||
assertEditPermission(rootCreature, this.userId);
|
assertEditPermission(rootCreature, this.userId);
|
||||||
|
|
||||||
|
creatureProperty.parent = parentRef;
|
||||||
|
creatureProperty.ancestors = ancestors;
|
||||||
|
|
||||||
return insertPropertyWork({
|
return insertPropertyWork({
|
||||||
property: creatureProperty,
|
property: creatureProperty,
|
||||||
creature: rootCreature,
|
creature: rootCreature,
|
||||||
|
|||||||
@@ -27,13 +27,17 @@ const insertPropertyFromLibraryNode = new ValidatedMethod({
|
|||||||
parentRef: {
|
parentRef: {
|
||||||
type: RefSchema,
|
type: RefSchema,
|
||||||
},
|
},
|
||||||
|
order: {
|
||||||
|
type: Number,
|
||||||
|
optional: true,
|
||||||
|
},
|
||||||
}).validator(),
|
}).validator(),
|
||||||
mixins: [RateLimiterMixin],
|
mixins: [RateLimiterMixin],
|
||||||
rateLimit: {
|
rateLimit: {
|
||||||
numRequests: 5,
|
numRequests: 5,
|
||||||
timeInterval: 5000,
|
timeInterval: 5000,
|
||||||
},
|
},
|
||||||
run({nodeId, parentRef}) {
|
run({nodeId, parentRef, order}) {
|
||||||
// get the new ancestry for the properties
|
// get the new ancestry for the properties
|
||||||
let {parentDoc, ancestors} = getAncestry({parentRef});
|
let {parentDoc, ancestors} = getAncestry({parentRef});
|
||||||
|
|
||||||
@@ -79,10 +83,14 @@ const insertPropertyFromLibraryNode = new ValidatedMethod({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Order the root node
|
// Order the root node
|
||||||
setDocToLastOrder({
|
if (order === undefined){
|
||||||
collection: CreatureProperties,
|
setDocToLastOrder({
|
||||||
doc: node,
|
collection: CreatureProperties,
|
||||||
});
|
doc: node,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
node.order = order;
|
||||||
|
}
|
||||||
|
|
||||||
// Insert the creature properties
|
// Insert the creature properties
|
||||||
CreatureProperties.batchInsert(nodes);
|
CreatureProperties.batchInsert(nodes);
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ function removeOldLogs(creatureId){
|
|||||||
sort: {date: -1},
|
sort: {date: -1},
|
||||||
skip: PER_CREATURE_LOG_LIMIT,
|
skip: PER_CREATURE_LOG_LIMIT,
|
||||||
});
|
});
|
||||||
|
if (!firstExpiredLog) return;
|
||||||
// Remove all logs older than the one over the limit
|
// Remove all logs older than the one over the limit
|
||||||
CreatureLogs.remove({
|
CreatureLogs.remove({
|
||||||
creatureId,
|
creatureId,
|
||||||
@@ -69,32 +70,10 @@ function logToMessageData(log){
|
|||||||
let embed = {
|
let embed = {
|
||||||
fields: [],
|
fields: [],
|
||||||
};
|
};
|
||||||
log.content.forEach(c => {
|
log.content.forEach(field => {
|
||||||
let field = {};
|
if (!field.name) field.name = '\u200b';
|
||||||
let descriptionField = {};
|
if (!field.value) field.value = '\u200b';
|
||||||
if (c.name) field.name = c.name;
|
embed.fields.push(field);
|
||||||
let valueArray = [];
|
|
||||||
if (c.error) valueArray.push(`*${c.error}*`);
|
|
||||||
if (c.resultPrefix) valueArray.push(`${c.resultPrefix}`);
|
|
||||||
if (c.result) valueArray.push(`\`${c.result}\``);
|
|
||||||
if (c.details) valueArray.push(c.details);
|
|
||||||
if (valueArray.length) field.value = valueArray.join(' ');
|
|
||||||
if (c.description){
|
|
||||||
if (!field.value){
|
|
||||||
field.value = c.description;
|
|
||||||
} else {
|
|
||||||
descriptionField.value = c.description;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (field.name || field.value){
|
|
||||||
if (!field.name) field.name = '\u200b';
|
|
||||||
if (!field.value) field.value = '\u200b';
|
|
||||||
embed.fields.push(field);
|
|
||||||
}
|
|
||||||
if (descriptionField.value){
|
|
||||||
descriptionField.name = '\u200b';
|
|
||||||
embed.fields.push(descriptionField);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return { embeds: [embed] };
|
return { embeds: [embed] };
|
||||||
}
|
}
|
||||||
@@ -109,7 +88,7 @@ function logWebhook({log, creature}){
|
|||||||
}
|
}
|
||||||
|
|
||||||
const insertCreatureLog = new ValidatedMethod({
|
const insertCreatureLog = new ValidatedMethod({
|
||||||
name: 'creatureLogs.methods.insertCreatureLog',
|
name: 'creatureLogs.methods.insert',
|
||||||
mixins: [RateLimiterMixin],
|
mixins: [RateLimiterMixin],
|
||||||
rateLimit: {
|
rateLimit: {
|
||||||
numRequests: 5,
|
numRequests: 5,
|
||||||
@@ -138,7 +117,7 @@ const insertCreatureLog = new ValidatedMethod({
|
|||||||
export function insertCreatureLogWork({log, creature, method}){
|
export function insertCreatureLogWork({log, creature, method}){
|
||||||
// Build the new log
|
// Build the new log
|
||||||
if (typeof log === 'string'){
|
if (typeof log === 'string'){
|
||||||
log = {text: log};
|
log = {content: [{value: log}]};
|
||||||
}
|
}
|
||||||
log.date = new Date();
|
log.date = new Date();
|
||||||
// Insert it
|
// Insert it
|
||||||
@@ -190,30 +169,30 @@ const logRoll = new ValidatedMethod({
|
|||||||
parsedResult = parse(roll);
|
parsedResult = parse(roll);
|
||||||
} catch (e){
|
} catch (e){
|
||||||
let error = prettifyParseError(e);
|
let error = prettifyParseError(e);
|
||||||
logContent.push({error});
|
logContent.push({name: 'Parse Error', value: error});
|
||||||
}
|
}
|
||||||
if (parsedResult) try {
|
if (parsedResult) try {
|
||||||
let rollContext = new CompilationContext();
|
let rollContext = new CompilationContext();
|
||||||
let compiled = parsedResult.compile(creature.variables, rollContext);
|
let compiled = parsedResult.compile(creature.variables, rollContext);
|
||||||
let compiledString = compiled.toString();
|
let compiledString = compiled.toString();
|
||||||
if (!equalIgnoringWhitespace(compiledString, roll)) logContent.push({
|
if (!equalIgnoringWhitespace(compiledString, roll)) logContent.push({
|
||||||
details: roll
|
value: roll
|
||||||
});
|
});
|
||||||
logContent.push({
|
logContent.push({
|
||||||
details: compiledString
|
value: compiledString
|
||||||
});
|
});
|
||||||
let rolled = compiled.roll(creature.variables, rollContext);
|
let rolled = compiled.roll(creature.variables, rollContext);
|
||||||
let rolledString = rolled.toString();
|
let rolledString = rolled.toString();
|
||||||
if (rolledString !== compiledString) logContent.push({
|
if (rolledString !== compiledString) logContent.push({
|
||||||
result: rolled.toString()
|
value: rolled.toString()
|
||||||
});
|
});
|
||||||
let result = rolled.reduce(creature.variables, rollContext);
|
let result = rolled.reduce(creature.variables, rollContext);
|
||||||
let resultString = result.toString();
|
let resultString = result.toString();
|
||||||
if (resultString !== rolledString) logContent.push({
|
if (resultString !== rolledString) logContent.push({
|
||||||
result: resultString
|
value: resultString
|
||||||
});
|
});
|
||||||
} catch (e){
|
} catch (e){
|
||||||
logContent = [{error: 'Calculation error'}];
|
logContent = [{name: 'Calculation error'}];
|
||||||
}
|
}
|
||||||
const log = {
|
const log = {
|
||||||
content: logContent,
|
content: logContent,
|
||||||
|
|||||||
@@ -3,31 +3,14 @@ import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
|||||||
import RollDetailsSchema from '/imports/api/properties/subSchemas/RollDetailsSchema.js';
|
import RollDetailsSchema from '/imports/api/properties/subSchemas/RollDetailsSchema.js';
|
||||||
|
|
||||||
let LogContentSchema = new SimpleSchema({
|
let LogContentSchema = new SimpleSchema({
|
||||||
|
// The name of the field, included in discord webhook message
|
||||||
name: {
|
name: {
|
||||||
type: String,
|
type: String,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
error: {
|
// The details of the field, included in discord webhook message
|
||||||
type: String,
|
// Markdown support
|
||||||
optional: true,
|
value: {
|
||||||
},
|
|
||||||
resultPrefix: {
|
|
||||||
type: String,
|
|
||||||
optional: true,
|
|
||||||
},
|
|
||||||
result: {
|
|
||||||
type: String,
|
|
||||||
optional: true,
|
|
||||||
},
|
|
||||||
expandedResult: {
|
|
||||||
type: String,
|
|
||||||
optional: true,
|
|
||||||
},
|
|
||||||
details: {
|
|
||||||
type: String,
|
|
||||||
optional: true,
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
type: String,
|
type: String,
|
||||||
optional: true,
|
optional: true,
|
||||||
},
|
},
|
||||||
|
|||||||
12
app/imports/api/creature/v1Migration/migrateCharacter.js
Normal file
12
app/imports/api/creature/v1Migration/migrateCharacter.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { fetch } from 'meteor/fetch'
|
||||||
|
|
||||||
|
export default function importCharacter(url){
|
||||||
|
// Using v1's JSON API to fetch the character data in a usable format
|
||||||
|
// url -> https://dicecloud.com/character/<id>/json?key=<key>
|
||||||
|
fetch(url)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
let character = data.characters[0];
|
||||||
|
console.log(character.name + ' fetched successfuly')
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ import { assertEditPermission } from '/imports/api/sharing/sharingPermissions.js
|
|||||||
import { softRemove } from '/imports/api/parenting/softRemove.js';
|
import { softRemove } from '/imports/api/parenting/softRemove.js';
|
||||||
import SoftRemovableSchema from '/imports/api/parenting/SoftRemovableSchema.js';
|
import SoftRemovableSchema from '/imports/api/parenting/SoftRemovableSchema.js';
|
||||||
import { storedIconsSchema } from '/imports/api/icons/Icons.js';
|
import { storedIconsSchema } from '/imports/api/icons/Icons.js';
|
||||||
|
import '/imports/api/library/methods/index.js';
|
||||||
|
|
||||||
let LibraryNodes = new Mongo.Collection('libraryNodes');
|
let LibraryNodes = new Mongo.Collection('libraryNodes');
|
||||||
|
|
||||||
@@ -79,27 +80,6 @@ const insertNode = new ValidatedMethod({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const duplicateNode = new ValidatedMethod({
|
|
||||||
name: 'libraryNodes.duplicate',
|
|
||||||
validate: new SimpleSchema({
|
|
||||||
_id: {
|
|
||||||
type: String,
|
|
||||||
regEx: SimpleSchema.RegEx.Id,
|
|
||||||
}
|
|
||||||
}).validator(),
|
|
||||||
mixins: [RateLimiterMixin],
|
|
||||||
rateLimit: {
|
|
||||||
numRequests: 5,
|
|
||||||
timeInterval: 5000,
|
|
||||||
},
|
|
||||||
run({_id}) {
|
|
||||||
let libraryNode = LibraryNodes.findOne(_id);
|
|
||||||
assertNodeEditPermission(libraryNode, this.userId);
|
|
||||||
delete libraryNode._id;
|
|
||||||
return LibraryNodes.insert(libraryNode);
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const updateLibraryNode = new ValidatedMethod({
|
const updateLibraryNode = new ValidatedMethod({
|
||||||
name: 'libraryNodes.update',
|
name: 'libraryNodes.update',
|
||||||
validate({_id, path}){
|
validate({_id, path}){
|
||||||
@@ -195,7 +175,6 @@ export default LibraryNodes;
|
|||||||
export {
|
export {
|
||||||
LibraryNodeSchema,
|
LibraryNodeSchema,
|
||||||
insertNode,
|
insertNode,
|
||||||
duplicateNode,
|
|
||||||
updateLibraryNode,
|
updateLibraryNode,
|
||||||
pullFromLibraryNode,
|
pullFromLibraryNode,
|
||||||
pushToLibraryNode,
|
pushToLibraryNode,
|
||||||
|
|||||||
85
app/imports/api/library/methods/duplicateLibraryNode.js
Normal file
85
app/imports/api/library/methods/duplicateLibraryNode.js
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
import { ValidatedMethod } from 'meteor/mdg:validated-method';
|
||||||
|
import SimpleSchema from 'simpl-schema';
|
||||||
|
import { RateLimiterMixin } from 'ddp-rate-limiter-mixin';
|
||||||
|
import LibraryNodes from '/imports/api/library/LibraryNodes.js';
|
||||||
|
import { assertDocEditPermission } from '/imports/api/sharing/sharingPermissions.js';
|
||||||
|
import {
|
||||||
|
setLineageOfDocs,
|
||||||
|
renewDocIds
|
||||||
|
} from '/imports/api/parenting/parenting.js';
|
||||||
|
import { reorderDocs } from '/imports/api/parenting/order.js';
|
||||||
|
|
||||||
|
var snackbar;
|
||||||
|
if (Meteor.isClient){
|
||||||
|
snackbar = require(
|
||||||
|
'/imports/ui/components/snackbars/SnackbarQueue.js'
|
||||||
|
).snackbar
|
||||||
|
}
|
||||||
|
|
||||||
|
const DUPLICATE_CHILDREN_LIMIT = 50;
|
||||||
|
|
||||||
|
const duplicateLibraryNode = new ValidatedMethod({
|
||||||
|
name: 'libraryNodes.duplicate',
|
||||||
|
validate: new SimpleSchema({
|
||||||
|
_id: {
|
||||||
|
type: String,
|
||||||
|
regEx: SimpleSchema.RegEx.Id,
|
||||||
|
}
|
||||||
|
}).validator(),
|
||||||
|
mixins: [RateLimiterMixin],
|
||||||
|
rateLimit: {
|
||||||
|
numRequests: 5,
|
||||||
|
timeInterval: 5000,
|
||||||
|
},
|
||||||
|
run({_id}) {
|
||||||
|
let libraryNode = LibraryNodes.findOne(_id);
|
||||||
|
assertDocEditPermission(libraryNode, this.userId);
|
||||||
|
let libraryNodeId = Random.id();
|
||||||
|
libraryNode._id = libraryNodeId;
|
||||||
|
|
||||||
|
let nodes = LibraryNodes.find({
|
||||||
|
'ancestors.id': _id,
|
||||||
|
removed: {$ne: true},
|
||||||
|
}, {
|
||||||
|
limit: DUPLICATE_CHILDREN_LIMIT + 1,
|
||||||
|
sort: {order: 1},
|
||||||
|
}).fetch();
|
||||||
|
|
||||||
|
if (nodes.length > DUPLICATE_CHILDREN_LIMIT){
|
||||||
|
nodes.pop();
|
||||||
|
if (Meteor.isClient){
|
||||||
|
snackbar({
|
||||||
|
text: `Only the first ${DUPLICATE_CHILDREN_LIMIT} children were duplicated`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// re-map all the ancestors
|
||||||
|
setLineageOfDocs({
|
||||||
|
docArray: nodes,
|
||||||
|
newAncestry : [
|
||||||
|
...libraryNode.ancestors,
|
||||||
|
{id: libraryNodeId, collection: 'libraryNodes'}
|
||||||
|
],
|
||||||
|
oldParent : {id: _id, collection: 'libraryNodes'},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Give the docs new IDs without breaking internal references
|
||||||
|
renewDocIds({docArray: nodes});
|
||||||
|
|
||||||
|
// Order the root node
|
||||||
|
libraryNode.order += 0.5;
|
||||||
|
|
||||||
|
LibraryNodes.batchInsert([libraryNode, ...nodes]);
|
||||||
|
|
||||||
|
// Tree structure changed by inserts, reorder the tree
|
||||||
|
reorderDocs({
|
||||||
|
collection: LibraryNodes,
|
||||||
|
ancestorId: libraryNode.ancestors[0].id,
|
||||||
|
});
|
||||||
|
|
||||||
|
return libraryNodeId;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default duplicateLibraryNode;
|
||||||
1
app/imports/api/library/methods/index.js
Normal file
1
app/imports/api/library/methods/index.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
import '/imports/api/library/methods/duplicateLibraryNode.js';
|
||||||
@@ -53,6 +53,10 @@ export default class OperatorNode extends ParseNode {
|
|||||||
}
|
}
|
||||||
toString(){
|
toString(){
|
||||||
let {left, right, operator} = this;
|
let {left, right, operator} = this;
|
||||||
|
// special case of adding a negative number
|
||||||
|
if (operator === '+' && right.isNumber && right.value < 0){
|
||||||
|
return `${left.toString()} - ${-right.value}`
|
||||||
|
}
|
||||||
return `${left.toString()} ${operator} ${right.toString()}`;
|
return `${left.toString()} ${operator} ${right.toString()}`;
|
||||||
}
|
}
|
||||||
traverse(fn){
|
traverse(fn){
|
||||||
|
|||||||
6
app/imports/server/config/SyncedCronConfig.js
Normal file
6
app/imports/server/config/SyncedCronConfig.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import { SyncedCron } from 'meteor/percolate:synced-cron';
|
||||||
|
|
||||||
|
SyncedCron.config({
|
||||||
|
// Log job run details to console
|
||||||
|
log: false,
|
||||||
|
});
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import valueToCoins from '/imports/ui/utility/valueToCoins.js';
|
import valueToCoins from '/imports/ui/utility/valueToCoins.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -3,19 +3,19 @@
|
|||||||
v-model="opened"
|
v-model="opened"
|
||||||
:close-on-content-click="false"
|
:close-on-content-click="false"
|
||||||
transition="slide-y-transition"
|
transition="slide-y-transition"
|
||||||
lazy
|
|
||||||
left
|
left
|
||||||
>
|
>
|
||||||
<v-btn
|
<template #activator="{ on }">
|
||||||
slot="activator"
|
<v-btn
|
||||||
icon
|
icon
|
||||||
>
|
v-on="on"
|
||||||
<v-icon>format_paint</v-icon>
|
>
|
||||||
</v-btn>
|
<v-icon>format_paint</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
<v-card class="overflow-hidden">
|
<v-card class="overflow-hidden">
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-layout
|
<v-layout
|
||||||
row
|
|
||||||
wrap
|
wrap
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -72,14 +72,14 @@
|
|||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
@click="$emit('input')"
|
@click="$emit('input')"
|
||||||
>
|
>
|
||||||
Clear
|
Clear
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
@click="opened = false"
|
@click="opened = false"
|
||||||
>
|
>
|
||||||
Done
|
Done
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
</v-menu>
|
</v-menu>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
||||||
import vuetifyColors from 'vuetify/es5/util/colors';
|
import vuetifyColors from 'vuetify/es5/util/colors';
|
||||||
import { kebabToCamelCase, camelToKebabCase } from '/imports/ui/utility/swapCase.js';
|
import { kebabToCamelCase, camelToKebabCase } from '/imports/ui/utility/swapCase.js';
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
wideColumns: Boolean,
|
wideColumns: Boolean,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
</v-menu>
|
</v-menu>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import IncrementMenu from '/imports/ui/components/IncrementMenu.vue';
|
import IncrementMenu from '/imports/ui/components/IncrementMenu.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-layout
|
<v-layout
|
||||||
row
|
|
||||||
align-center
|
align-center
|
||||||
justify-center
|
justify-center
|
||||||
class="increment-menu"
|
class="increment-menu"
|
||||||
@@ -44,9 +43,9 @@
|
|||||||
<v-btn
|
<v-btn
|
||||||
:small="!flat"
|
:small="!flat"
|
||||||
:fab="!flat"
|
:fab="!flat"
|
||||||
:flat="flat"
|
:text="flat"
|
||||||
:icon="flat"
|
:icon="flat"
|
||||||
class="filled"
|
class="mx-2 filled"
|
||||||
@click="commitEdit"
|
@click="commitEdit"
|
||||||
>
|
>
|
||||||
<v-icon>done</v-icon>
|
<v-icon>done</v-icon>
|
||||||
@@ -54,9 +53,9 @@
|
|||||||
<v-btn
|
<v-btn
|
||||||
:small="!flat"
|
:small="!flat"
|
||||||
:fab="!flat"
|
:fab="!flat"
|
||||||
:flat="flat"
|
:text="flat"
|
||||||
:icon="flat"
|
:icon="flat"
|
||||||
class="mx-0 filled"
|
class="filled"
|
||||||
@click="cancelEdit"
|
@click="cancelEdit"
|
||||||
>
|
>
|
||||||
<v-icon>close</v-icon>
|
<v-icon>close</v-icon>
|
||||||
@@ -65,7 +64,7 @@
|
|||||||
</v-layout>
|
</v-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
export default {
|
export default {
|
||||||
inject: {
|
inject: {
|
||||||
context: { default: {} }
|
context: { default: {} }
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
</v-btn>
|
</v-btn>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
/*
|
/*
|
||||||
* Because speed dials only work well with v-btn's as children, this hacky
|
* Because speed dials only work well with v-btn's as children, this hacky
|
||||||
* component creates a v-btn with a label.
|
* component creates a v-btn with a label.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import marked from 'marked';
|
import marked from 'marked';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<template lang="html">
|
<template lang="html">
|
||||||
<v-card
|
<v-card
|
||||||
:hover="hasClickListener"
|
:hover="hasClickListener"
|
||||||
:elevation="hovering ? 8 : undefined"
|
|
||||||
class="toolbar-card"
|
class="toolbar-card"
|
||||||
@click="$emit('click')"
|
:class="hovering ? 'elevation-8': ''"
|
||||||
|
@click.native="$emit('click')"
|
||||||
>
|
>
|
||||||
<v-toolbar
|
<v-toolbar
|
||||||
flat
|
flat
|
||||||
@@ -23,14 +23,16 @@
|
|||||||
</v-card>
|
</v-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
||||||
|
import getThemeColor from '/imports/ui/utility/getThemeColor.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
color: {
|
color: {
|
||||||
type: String,
|
type: String,
|
||||||
default(){
|
default(){
|
||||||
return this.$vuetify.theme.secondary;
|
return getThemeColor('secondary');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -62,4 +64,7 @@
|
|||||||
.toolbar-card .v-toolbar__title {
|
.toolbar-card .v-toolbar__title {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
.toolbar-card {
|
||||||
|
transition: box-shadow .4s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template lang="html">
|
<template lang="html">
|
||||||
<div
|
<div
|
||||||
class="layout row"
|
class="layout"
|
||||||
style="height: 100%;"
|
style="height: 100%;"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
export default {
|
export default {
|
||||||
computed:{
|
computed:{
|
||||||
computedTreeStyle(){
|
computedTreeStyle(){
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import MarkdownText from '/imports/ui/components/MarkdownText.vue';
|
import MarkdownText from '/imports/ui/components/MarkdownText.vue';
|
||||||
import embedInlineCalculations from '/imports/api/creature/computation/afterComputation/embedInlineCalculations.js';
|
import embedInlineCalculations from '/imports/api/creature/computation/afterComputation/embedInlineCalculations.js';
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
:loading="loading"
|
:loading="loading"
|
||||||
:error-messages="errors"
|
:error-messages="errors"
|
||||||
:disabled="isDisabled"
|
:disabled="isDisabled"
|
||||||
box
|
filled
|
||||||
v-on="on"
|
v-on="on"
|
||||||
@focus="focused = true"
|
@focus="focused = true"
|
||||||
@blur="focused = false"
|
@blur="focused = false"
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
</v-menu>
|
</v-menu>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
||||||
import { format } from 'date-fns';
|
import { format } from 'date-fns';
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,12 @@
|
|||||||
<v-menu
|
<v-menu
|
||||||
v-model="menu"
|
v-model="menu"
|
||||||
:close-on-content-click="false"
|
:close-on-content-click="false"
|
||||||
lazy
|
|
||||||
transition="slide-y-transition"
|
transition="slide-y-transition"
|
||||||
min-width="290px"
|
min-width="290px"
|
||||||
style="overflow-y: auto;"
|
style="overflow-y: auto;"
|
||||||
>
|
>
|
||||||
<template #activator="{ on }">
|
<template #activator="{ on }">
|
||||||
<div class="layout row align-center">
|
<div class="layout align-center">
|
||||||
<v-label>{{ label }}</v-label>
|
<v-label>{{ label }}</v-label>
|
||||||
<v-btn
|
<v-btn
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
@@ -32,7 +31,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<div class="layout row">
|
<div class="layout">
|
||||||
<text-field
|
<text-field
|
||||||
ref="iconSearchField"
|
ref="iconSearchField"
|
||||||
label="Search icons"
|
label="Search icons"
|
||||||
@@ -51,7 +50,6 @@
|
|||||||
</v-btn>
|
</v-btn>
|
||||||
</div>
|
</div>
|
||||||
<v-layout
|
<v-layout
|
||||||
row
|
|
||||||
wrap
|
wrap
|
||||||
style="max-height: 400px; overflow-y: auto;"
|
style="max-height: 400px; overflow-y: auto;"
|
||||||
>
|
>
|
||||||
@@ -78,7 +76,7 @@
|
|||||||
</v-menu>
|
</v-menu>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import SvgIcon from '/imports/ui/components/global/SvgIcon.vue';
|
import SvgIcon from '/imports/ui/components/global/SvgIcon.vue';
|
||||||
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
||||||
import { findIcons } from '/imports/api/icons/Icons.js';
|
import { findIcons } from '/imports/api/icons/Icons.js';
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
:menu-props="{auto: true, lazy: true}"
|
:menu-props="{auto: true, lazy: true}"
|
||||||
:search-input.sync="searchInput"
|
:search-input.sync="searchInput"
|
||||||
:disabled="isDisabled"
|
:disabled="isDisabled"
|
||||||
box
|
filled
|
||||||
@change="customChange"
|
@change="customChange"
|
||||||
@focus="focused = true"
|
@focus="focused = true"
|
||||||
@blur="focused = false"
|
@blur="focused = false"
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
</v-combobox>
|
</v-combobox>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
:value="safeValue"
|
:value="safeValue"
|
||||||
:menu-props="{auto: true, lazy: true}"
|
:menu-props="{auto: true, lazy: true}"
|
||||||
:disabled="isDisabled"
|
:disabled="isDisabled"
|
||||||
box
|
filled
|
||||||
@change="change"
|
@change="change"
|
||||||
@focus="focused = true"
|
@focus="focused = true"
|
||||||
@blur="focused = false"
|
@blur="focused = false"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
</v-select>
|
</v-select>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
</i>
|
</i>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
const SIZE_MAP = {
|
const SIZE_MAP = {
|
||||||
xSmall: '12px',
|
xSmall: '12px',
|
||||||
small: '16px',
|
small: '16px',
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
:value="safeValue"
|
:value="safeValue"
|
||||||
:disabled="isDisabled"
|
:disabled="isDisabled"
|
||||||
:auto-grow="autoGrow"
|
:auto-grow="autoGrow"
|
||||||
box
|
filled
|
||||||
@input="input"
|
@input="input"
|
||||||
@focus="focused = true"
|
@focus="focused = true"
|
||||||
@blur="focused = false"
|
@blur="focused = false"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
:error-messages="errors"
|
:error-messages="errors"
|
||||||
:value="safeValue"
|
:value="safeValue"
|
||||||
:disabled="isDisabled"
|
:disabled="isDisabled"
|
||||||
:box="!regular"
|
:filled="!regular"
|
||||||
@input="input"
|
@input="input"
|
||||||
@focus="focused = true"
|
@focus="focused = true"
|
||||||
@blur="focused = false"
|
@blur="focused = false"
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
import SmartInput from '/imports/ui/components/global/SmartInputMixin.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -47,45 +47,45 @@
|
|||||||
</v-btn>
|
</v-btn>
|
||||||
</template>
|
</template>
|
||||||
<v-list>
|
<v-list>
|
||||||
<v-list-tile
|
<v-list-item
|
||||||
v-if="$listeners && $listeners.duplicate"
|
v-if="$listeners && $listeners.duplicate"
|
||||||
@click="$emit('duplicate')"
|
@click="$emit('duplicate')"
|
||||||
>
|
>
|
||||||
<v-list-tile-content>
|
<v-list-item-content>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
Duplicate
|
Duplicate
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile-content>
|
</v-list-item-content>
|
||||||
<v-list-tile-action>
|
<v-list-item-action>
|
||||||
<v-icon>file_copy</v-icon>
|
<v-icon>file_copy</v-icon>
|
||||||
</v-list-tile-action>
|
</v-list-item-action>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
<v-list-tile
|
<v-list-item
|
||||||
v-if="$listeners && $listeners.move"
|
v-if="$listeners && $listeners.move"
|
||||||
@click="$emit('move')"
|
@click="$emit('move')"
|
||||||
>
|
>
|
||||||
<v-list-tile-content>
|
<v-list-item-content>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
Move
|
Move
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile-content>
|
</v-list-item-content>
|
||||||
<v-list-tile-action>
|
<v-list-item-action>
|
||||||
<v-icon>send</v-icon>
|
<v-icon>send</v-icon>
|
||||||
</v-list-tile-action>
|
</v-list-item-action>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
<v-list-tile
|
<v-list-item
|
||||||
v-if="$listeners && $listeners.remove"
|
v-if="$listeners && $listeners.remove"
|
||||||
@click="$emit('remove')"
|
@click="$emit('remove')"
|
||||||
>
|
>
|
||||||
<v-list-tile-content>
|
<v-list-item-content>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
Delete
|
Delete
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile-content>
|
</v-list-item-content>
|
||||||
<v-list-tile-action>
|
<v-list-item-action>
|
||||||
<v-icon>delete</v-icon>
|
<v-icon>delete</v-icon>
|
||||||
</v-list-tile-action>
|
</v-list-item-action>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
</v-menu>
|
</v-menu>
|
||||||
</v-layout>
|
</v-layout>
|
||||||
@@ -118,11 +118,12 @@
|
|||||||
</v-toolbar>
|
</v-toolbar>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
||||||
import PropertyIcon from '/imports/ui/properties/shared/PropertyIcon.vue';
|
import PropertyIcon from '/imports/ui/properties/shared/PropertyIcon.vue';
|
||||||
import { getPropertyName } from '/imports/constants/PROPERTIES.js';
|
import { getPropertyName } from '/imports/constants/PROPERTIES.js';
|
||||||
import ColorPicker from '/imports/ui/components/ColorPicker.vue';
|
import ColorPicker from '/imports/ui/components/ColorPicker.vue';
|
||||||
|
import getThemeColor from '/imports/ui/utility/getThemeColor.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -142,7 +143,7 @@ export default {
|
|||||||
return isDarkColor(this.color);
|
return isDarkColor(this.color);
|
||||||
},
|
},
|
||||||
color(){
|
color(){
|
||||||
return this.model && this.model.color || this.$vuetify.theme.secondary;
|
return this.model && this.model.color || getThemeColor('secondary');
|
||||||
},
|
},
|
||||||
title(){
|
title(){
|
||||||
let model = this.model;
|
let model = this.model;
|
||||||
|
|||||||
@@ -2,22 +2,22 @@
|
|||||||
<v-card>
|
<v-card>
|
||||||
<template v-if="!result">
|
<template v-if="!result">
|
||||||
<v-btn-toggle v-model="advantage">
|
<v-btn-toggle v-model="advantage">
|
||||||
<v-btn flat>
|
<v-btn text>
|
||||||
Advantage
|
Advantage
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn flat>
|
<v-btn text>
|
||||||
Disadvantage
|
Disadvantage
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-btn-toggle>
|
</v-btn-toggle>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<div class="layout row justify-center align-center">
|
<div class="layout justify-center align-center">
|
||||||
<v-btn
|
<v-btn
|
||||||
large
|
large
|
||||||
fab
|
fab
|
||||||
outline
|
outlined
|
||||||
@click="makeRoll"
|
@click="makeRoll"
|
||||||
>
|
>
|
||||||
<div class="display-1">
|
<div class="text-h4">
|
||||||
{{ numberToSignedString(bonus) }}
|
{{ numberToSignedString(bonus) }}
|
||||||
</div>
|
</div>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div>
|
<div>
|
||||||
<div class="title">
|
<div class="text-h6">
|
||||||
<span
|
<span
|
||||||
v-for="(roll, index) of rolls"
|
v-for="(roll, index) of rolls"
|
||||||
:key="index"
|
:key="index"
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
{{ numberToSignedString(bonus) }}
|
{{ numberToSignedString(bonus) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="display-1">
|
<div class="text-h4">
|
||||||
{{ result }}
|
{{ result }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
</v-card>
|
</v-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import numberToSignedString from '/imports/ui/utility/numberToSignedString.js';
|
import numberToSignedString from '/imports/ui/utility/numberToSignedString.js';
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
|||||||
16
app/imports/ui/components/snackbars/SnackbarQueue.js
Normal file
16
app/imports/ui/components/snackbars/SnackbarQueue.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// Modified from https://gitlab.com/tozd/vue/snackbar-que
|
||||||
|
import Vue from 'vue';
|
||||||
|
|
||||||
|
const globalState = Vue.observable({queue: []});
|
||||||
|
let lastSnackbarId = 0;
|
||||||
|
|
||||||
|
function snackbar(data) {
|
||||||
|
globalState.queue.push({
|
||||||
|
data,
|
||||||
|
id: ++lastSnackbarId,
|
||||||
|
enqueuedAt: new Date(),
|
||||||
|
shown: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export {snackbar, globalState}
|
||||||
128
app/imports/ui/components/snackbars/SnackbarQueue.vue
Normal file
128
app/imports/ui/components/snackbars/SnackbarQueue.vue
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
<template lang="html">
|
||||||
|
<v-snackbar
|
||||||
|
bottom
|
||||||
|
left
|
||||||
|
v-bind="$attrs"
|
||||||
|
:value="isShown"
|
||||||
|
:timeout="timeout"
|
||||||
|
@input="value => isShown = value"
|
||||||
|
>
|
||||||
|
<div class="layout align-center">
|
||||||
|
<template v-if="snackbar && snackbar.data">
|
||||||
|
<div v-if="snackbar.data.text">
|
||||||
|
{{ snackbar.data.text }}
|
||||||
|
</div>
|
||||||
|
<template v-else-if="snackbar.data.content">
|
||||||
|
<log-content :model="snackbar.data.content" />
|
||||||
|
</template>
|
||||||
|
<v-spacer />
|
||||||
|
<v-btn
|
||||||
|
v-if="snackbar.data.callback"
|
||||||
|
color="primary"
|
||||||
|
text
|
||||||
|
@click="closeSnackbar(); snackbar.data.callback()"
|
||||||
|
>
|
||||||
|
{{ snackbar.data.callbackName }}
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<template #action="{ attrs }">
|
||||||
|
<v-btn
|
||||||
|
icon
|
||||||
|
v-bind="attrs"
|
||||||
|
@click="closeSnackbar"
|
||||||
|
>
|
||||||
|
<v-icon>close</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
</v-snackbar>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="js">
|
||||||
|
// Modified from https://gitlab.com/tozd/vue/snackbar-queue
|
||||||
|
import { globalState } from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
||||||
|
import LogContent from '/imports/ui/log/LogContent.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
LogContent,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
timeout: {
|
||||||
|
type: Number,
|
||||||
|
default: 6000,
|
||||||
|
},
|
||||||
|
pause: {
|
||||||
|
type: Number,
|
||||||
|
default: 300,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isShown: false,
|
||||||
|
snackbar: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
isShown(newValue) {
|
||||||
|
if (newValue === false && this.snackbar) {
|
||||||
|
const snackbarIndex = globalState.queue.findIndex((element) => element.id === this.snackbar.id);
|
||||||
|
if (snackbarIndex > -1) {
|
||||||
|
globalState.queue.splice(snackbarIndex, 1);
|
||||||
|
}
|
||||||
|
this.snackbar = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.handle = null;
|
||||||
|
this.unwait = null;
|
||||||
|
this.showNextSnackbar();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
clearSnackbarState() {
|
||||||
|
if (this.handle) {
|
||||||
|
clearTimeout(this.handle);
|
||||||
|
this.handle = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.unwait) {
|
||||||
|
this.unwait();
|
||||||
|
this.unwait = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
showNextSnackbar() {
|
||||||
|
this.clearSnackbarState();
|
||||||
|
|
||||||
|
// Wait for the first next snackbar to be available.
|
||||||
|
this.unwait = this.$wait(function () {
|
||||||
|
// Snackbars are enqueued from oldest to newest and "find" searches array elements in
|
||||||
|
// same order as well, so the first one which matches is also the oldest one.
|
||||||
|
return globalState.queue.find((element) => element.shown === false);
|
||||||
|
}, function (snackbar) {
|
||||||
|
this.unwait = null;
|
||||||
|
|
||||||
|
snackbar.shown = true;
|
||||||
|
|
||||||
|
this.snackbar = snackbar;
|
||||||
|
this.isShown = true;
|
||||||
|
|
||||||
|
this.handle = setTimeout(() => {
|
||||||
|
this.handle = null;
|
||||||
|
|
||||||
|
this.showNextSnackbar();
|
||||||
|
}, this.timeout + this.pause);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
closeSnackbar() {
|
||||||
|
this.clearSnackbarState();
|
||||||
|
|
||||||
|
this.isShown = false;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
this.showNextSnackbar();
|
||||||
|
}, this.pause);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
<template lang="html">
|
|
||||||
<v-snackbar
|
|
||||||
v-if="snackbar"
|
|
||||||
:key="snackbar.text"
|
|
||||||
auto-height
|
|
||||||
bottom
|
|
||||||
:value="true"
|
|
||||||
:timeout="0"
|
|
||||||
>
|
|
||||||
{{ snackbar.text }}
|
|
||||||
<v-btn
|
|
||||||
v-if="snackbar.callback"
|
|
||||||
class="primary--text"
|
|
||||||
flat
|
|
||||||
icon
|
|
||||||
@click="doCallback"
|
|
||||||
>
|
|
||||||
{{ snackbar.callbackName }}
|
|
||||||
</v-btn>
|
|
||||||
<v-btn
|
|
||||||
v-if="snackbar.showCloseButton"
|
|
||||||
flat
|
|
||||||
icon
|
|
||||||
@click="$store.dispatch('closeSnackbar')"
|
|
||||||
>
|
|
||||||
<v-icon>close</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</v-snackbar>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
computed: {
|
|
||||||
snackbar(){
|
|
||||||
return this.$store.state.snackbars.snackbars[0];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
doCallback(){
|
|
||||||
this.snackbar.callback();
|
|
||||||
this.$store.dispatch('closeSnackbar')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="css" scoped>
|
|
||||||
</style>
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
const snackbarStore = {
|
|
||||||
state: {
|
|
||||||
snackbars: [],
|
|
||||||
snackbarTimout: undefined,
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
addSnackbar(state, value){
|
|
||||||
state.snackbars.push(value)
|
|
||||||
},
|
|
||||||
closeCurrentSnackbar (state){
|
|
||||||
state.snackbars.shift();
|
|
||||||
},
|
|
||||||
cancelSnackbarTimeout (state){
|
|
||||||
if(state.snackbarTimout){
|
|
||||||
clearTimeout(state.snackbarTimout);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setSnackbarTimout(state, value){
|
|
||||||
state.snackbarTimout = value;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
snackbar({dispatch, commit}, value){
|
|
||||||
// value = {
|
|
||||||
// text,
|
|
||||||
// showCloseButton,
|
|
||||||
// callback,
|
|
||||||
// callbackName
|
|
||||||
// }
|
|
||||||
commit('addSnackbar', value);
|
|
||||||
commit('setSnackbarTimout', setTimeout(() => {
|
|
||||||
dispatch('closeSnackbar');
|
|
||||||
}, 5000));
|
|
||||||
},
|
|
||||||
closeSnackbar({dispatch, commit, state}){
|
|
||||||
commit('closeCurrentSnackbar');
|
|
||||||
commit('cancelSnackbarTimeout');
|
|
||||||
if (state.snackbars.length){
|
|
||||||
commit('setSnackbarTimout', setTimeout(() => {
|
|
||||||
dispatch('closeSnackbar');
|
|
||||||
}, 5000));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default snackbarStore;
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
:data-id="`tree-node-${node._id}`"
|
:data-id="`tree-node-${node._id}`"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="layout row align-center justify-start tree-node-title"
|
class="layout align-center justify-start tree-node-title"
|
||||||
style="cursor: pointer;"
|
style="cursor: pointer;"
|
||||||
:class="selected && 'primary--text'"
|
:class="selected && 'primary--text'"
|
||||||
@click.stop="$emit('selected', node._id)"
|
@click.stop="$emit('selected', node._id)"
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
</v-icon>
|
</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<div
|
<div
|
||||||
class="layout row align-center justify-start pr-1"
|
class="layout align-center justify-start pr-1"
|
||||||
style="flex-grow: 0;"
|
style="flex-grow: 0;"
|
||||||
>
|
>
|
||||||
<v-icon
|
<v-icon
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
</v-sheet>
|
</v-sheet>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
/**
|
/**
|
||||||
* TreeNode's are list item views of character properties. Every property which
|
* TreeNode's are list item views of character properties. Every property which
|
||||||
* can belong to the character is shown in the tree view of the character
|
* can belong to the character is shown in the tree view of the character
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
}},
|
}},
|
||||||
computed: {
|
computed: {
|
||||||
hasChildren(){
|
hasChildren(){
|
||||||
return this.children && this.children.length || this.lazy && !this.expanded;
|
return this.children && !!this.children.length || this.lazy && !this.expanded;
|
||||||
},
|
},
|
||||||
showExpanded(){
|
showExpanded(){
|
||||||
return this.expanded && (this.organize || this.hasChildren)
|
return this.expanded && (this.organize || this.hasChildren)
|
||||||
@@ -159,9 +159,15 @@
|
|||||||
transition: none !important;
|
transition: none !important;
|
||||||
}
|
}
|
||||||
.theme--light .tree-node-title:hover {
|
.theme--light .tree-node-title:hover {
|
||||||
background: rgba(0,0,0,.04);
|
background-color: rgba(0,0,0,.04);
|
||||||
}
|
}
|
||||||
.dummy-node {
|
.theme--dark .tree-node-title:hover {
|
||||||
|
background-color: rgba(255,255,255,.04);
|
||||||
|
}
|
||||||
|
.tree-node-title{
|
||||||
|
transition: background ease 0.3s, color ease 0.15s;
|
||||||
|
}
|
||||||
|
.tree-node-title, .dummy-node {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
</draggable>
|
</draggable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import draggable from 'vuedraggable';
|
import draggable from 'vuedraggable';
|
||||||
import TreeNode from '/imports/ui/components/tree/TreeNode.vue';
|
import TreeNode from '/imports/ui/components/tree/TreeNode.vue';
|
||||||
import { isParentAllowed } from '/imports/api/parenting/parenting.js';
|
import { isParentAllowed } from '/imports/api/parenting/parenting.js';
|
||||||
|
|||||||
@@ -39,6 +39,28 @@
|
|||||||
:input-value="model.settings.hideUnusedStats"
|
:input-value="model.settings.hideUnusedStats"
|
||||||
@change="value => $emit('change', {path: ['settings','hideUnusedStats'], value: !!value})"
|
@change="value => $emit('change', {path: ['settings','hideUnusedStats'], value: !!value})"
|
||||||
/>
|
/>
|
||||||
|
<v-switch
|
||||||
|
label="Show spells tab"
|
||||||
|
:input-value="!model.settings.hideSpellsTab"
|
||||||
|
@change="value => {
|
||||||
|
$emit('change', {path: ['settings','hideSpellsTab'], value: !value});
|
||||||
|
$store.commit(
|
||||||
|
'setTabForCharacterSheet',
|
||||||
|
{id: model._id, tab: 0}
|
||||||
|
);
|
||||||
|
}"
|
||||||
|
/>
|
||||||
|
<v-switch
|
||||||
|
label="Show tree tab"
|
||||||
|
:input-value="model.settings.showTreeTab"
|
||||||
|
@change="value => {
|
||||||
|
$emit('change', {path: ['settings','showTreeTab'], value: !!value});
|
||||||
|
$store.commit(
|
||||||
|
'setTabForCharacterSheet',
|
||||||
|
{id: model._id, tab: 0}
|
||||||
|
);
|
||||||
|
}"
|
||||||
|
/>
|
||||||
<text-field
|
<text-field
|
||||||
label="Hit Dice reset multiplier"
|
label="Hit Dice reset multiplier"
|
||||||
hint="What fraction of your hit dice are reset every long rest"
|
hint="What fraction of your hit dice are reset every long rest"
|
||||||
@@ -82,7 +104,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import FormSection, {FormSections} from '/imports/ui/properties/forms/shared/FormSection.vue';
|
import FormSection, {FormSections} from '/imports/ui/properties/forms/shared/FormSection.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<v-spacer slot="actions" />
|
<v-spacer slot="actions" />
|
||||||
<v-btn
|
<v-btn
|
||||||
slot="actions"
|
slot="actions"
|
||||||
flat
|
text
|
||||||
@click="$store.dispatch('popDialogStack')"
|
@click="$store.dispatch('popDialogStack')"
|
||||||
>
|
>
|
||||||
Done
|
Done
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import Creatures from '/imports/api/creature/Creatures.js';
|
import Creatures from '/imports/api/creature/Creatures.js';
|
||||||
import {updateCreature} from '/imports/api/creature/Creatures.js';
|
import {updateCreature} from '/imports/api/creature/Creatures.js';
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
lang="html"
|
lang="html"
|
||||||
functional
|
functional
|
||||||
>
|
>
|
||||||
<v-list-tile v-bind="$attrs">
|
<v-list-item v-bind="$attrs">
|
||||||
<v-list-tile-avatar :color="model.color || 'grey'">
|
<v-list-item-avatar :color="model.color || 'grey'">
|
||||||
<img
|
<img
|
||||||
v-if="model.avatarPicture"
|
v-if="model.avatarPicture"
|
||||||
:src="model.avatarPicture"
|
:src="model.avatarPicture"
|
||||||
@@ -12,25 +12,25 @@
|
|||||||
<template v-else>
|
<template v-else>
|
||||||
{{ model.initial }}
|
{{ model.initial }}
|
||||||
</template>
|
</template>
|
||||||
</v-list-tile-avatar>
|
</v-list-item-avatar>
|
||||||
<v-list-tile-content>
|
<v-list-item-content>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
{{ model.name }}
|
{{ model.name }}
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
<v-list-tile-sub-title>
|
<v-list-item-subtitle>
|
||||||
{{ model.alignment }} {{ model.gender }} {{ model.race }}
|
{{ model.alignment }} {{ model.gender }} {{ model.race }}
|
||||||
</v-list-tile-sub-title>
|
</v-list-item-subtitle>
|
||||||
</v-list-tile-content>
|
</v-list-item-content>
|
||||||
<v-list-tile-action v-if="selection">
|
<v-list-item-action v-if="selection">
|
||||||
<v-checkbox
|
<v-checkbox
|
||||||
:input-value="selected && selected.has(model._id)"
|
:input-value="selected && selected.has(model._id)"
|
||||||
@change="$emit('select')"
|
@change="$emit('select')"
|
||||||
/>
|
/>
|
||||||
</v-list-tile-action>
|
</v-list-item-action>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script lang="js">
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
model: {
|
model: {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<v-btn
|
<v-btn
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:disabled="context.editPermission === false"
|
:disabled="context.editPermission === false"
|
||||||
outline
|
outlined
|
||||||
style="width: 160px;"
|
style="width: 160px;"
|
||||||
@click="rest"
|
@click="rest"
|
||||||
>
|
>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
</v-btn>
|
</v-btn>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import restCreature from '/imports/api/creature/restCreature.js';
|
import restCreature from '/imports/api/creature/restCreature.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -52,7 +52,6 @@
|
|||||||
label="Race"
|
label="Race"
|
||||||
/>
|
/>
|
||||||
<v-layout
|
<v-layout
|
||||||
row
|
|
||||||
justify-center
|
justify-center
|
||||||
align-center
|
align-center
|
||||||
>
|
>
|
||||||
@@ -225,20 +224,19 @@
|
|||||||
:items="hitDiceItems"
|
:items="hitDiceItems"
|
||||||
label="Hit Dice"
|
label="Hit Dice"
|
||||||
/>
|
/>
|
||||||
</v-text-field>
|
|
||||||
</v-stepper-content>
|
</v-stepper-content>
|
||||||
</v-stepper-items>
|
</v-stepper-items>
|
||||||
</v-stepper>
|
</v-stepper>
|
||||||
<template slot="actions">
|
<template slot="actions">
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
@click="$emit('pop')"
|
@click="$emit('pop')"
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn
|
<v-btn
|
||||||
v-if="step > 1"
|
v-if="step > 1"
|
||||||
flat
|
text
|
||||||
@click="step--"
|
@click="step--"
|
||||||
>
|
>
|
||||||
Back
|
Back
|
||||||
@@ -262,7 +260,7 @@
|
|||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
const getCost = function(score){
|
const getCost = function(score){
|
||||||
const costs = {
|
const costs = {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<v-spacer slot="actions" />
|
<v-spacer slot="actions" />
|
||||||
<v-btn
|
<v-btn
|
||||||
slot="actions"
|
slot="actions"
|
||||||
flat
|
text
|
||||||
@click="$store.dispatch('popDialogStack')"
|
@click="$store.dispatch('popDialogStack')"
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import Creatures from '/imports/api/creature/Creatures.js';
|
import Creatures from '/imports/api/creature/Creatures.js';
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
import removeCreature from '/imports/api/creature/removeCreature.js';
|
import removeCreature from '/imports/api/creature/removeCreature.js';
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
>
|
>
|
||||||
<v-tabs-items
|
<v-tabs-items
|
||||||
:value="$store.getters.tabById($route.params.id)"
|
:value="$store.getters.tabById($route.params.id)"
|
||||||
|
class="card-background"
|
||||||
@change="e => $store.commit(
|
@change="e => $store.commit(
|
||||||
'setTabForCharacterSheet',
|
'setTabForCharacterSheet',
|
||||||
{id: $route.params.id, tab: e}
|
{id: $route.params.id, tab: e}
|
||||||
@@ -50,13 +51,13 @@
|
|||||||
<v-tab-item>
|
<v-tab-item>
|
||||||
<inventory-tab :creature-id="creatureId" />
|
<inventory-tab :creature-id="creatureId" />
|
||||||
</v-tab-item>
|
</v-tab-item>
|
||||||
<v-tab-item>
|
<v-tab-item v-show="!creature.settings.hideSpellsTab">
|
||||||
<spells-tab :creature-id="creatureId" />
|
<spells-tab :creature-id="creatureId" />
|
||||||
</v-tab-item>
|
</v-tab-item>
|
||||||
<v-tab-item>
|
<v-tab-item>
|
||||||
<character-tab :creature-id="creatureId" />
|
<character-tab :creature-id="creatureId" />
|
||||||
</v-tab-item>
|
</v-tab-item>
|
||||||
<v-tab-item>
|
<v-tab-item v-if="creature.settings.showTreeTab">
|
||||||
<tree-tab :creature-id="creatureId" />
|
<tree-tab :creature-id="creatureId" />
|
||||||
</v-tab-item>
|
</v-tab-item>
|
||||||
</v-tabs-items>
|
</v-tabs-items>
|
||||||
@@ -65,7 +66,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
//TODO add a "no character found" screen if shown on a false address
|
//TODO add a "no character found" screen if shown on a false address
|
||||||
// or on a character the user does not have permission to view
|
// or on a character the user does not have permission to view
|
||||||
import Creatures from '/imports/api/creature/Creatures.js';
|
import Creatures from '/imports/api/creature/Creatures.js';
|
||||||
@@ -77,6 +78,7 @@
|
|||||||
import TreeTab from '/imports/ui/creature/character/characterSheetTabs/TreeTab.vue';
|
import TreeTab from '/imports/ui/creature/character/characterSheetTabs/TreeTab.vue';
|
||||||
import { assertEditPermission } from '/imports/api/creature/creaturePermissions.js';
|
import { assertEditPermission } from '/imports/api/creature/creaturePermissions.js';
|
||||||
import CreatureLogs from '/imports/api/creature/log/CreatureLogs.js';
|
import CreatureLogs from '/imports/api/creature/log/CreatureLogs.js';
|
||||||
|
import { snackbar } from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -118,13 +120,10 @@
|
|||||||
this.logObserver = CreatureLogs.find({
|
this.logObserver = CreatureLogs.find({
|
||||||
creatureId: this.creatureId,
|
creatureId: this.creatureId,
|
||||||
}).observe({
|
}).observe({
|
||||||
added(doc){
|
added({content}){
|
||||||
if (!that.$subReady.singleCharacter) return;
|
if (!that.$subReady.singleCharacter) return;
|
||||||
if (that.$store.state.rightDrawer) return;
|
if (that.$store.state.rightDrawer) return;
|
||||||
that.$store.dispatch('snackbar', {
|
snackbar({content});
|
||||||
text: doc.name,
|
|
||||||
showCloseButton: true,
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template lang="html">
|
<template lang="html">
|
||||||
<v-speed-dial
|
<v-speed-dial
|
||||||
v-if="speedDials && speedDials.length"
|
v-if="speedDials"
|
||||||
v-model="fab"
|
v-model="fab"
|
||||||
direction="bottom"
|
direction="bottom"
|
||||||
>
|
>
|
||||||
@@ -10,10 +10,19 @@
|
|||||||
color="primary"
|
color="primary"
|
||||||
fab
|
fab
|
||||||
data-id="insert-creature-property-fab"
|
data-id="insert-creature-property-fab"
|
||||||
|
class="insert-creature-property-fab"
|
||||||
small
|
small
|
||||||
>
|
>
|
||||||
<v-icon>add</v-icon>
|
<transition
|
||||||
<v-icon>close</v-icon>
|
name="fab-rotate"
|
||||||
|
>
|
||||||
|
<v-icon
|
||||||
|
style="transition: transform 0.2s ease-in-out"
|
||||||
|
:style="fab && 'transform: rotate(45deg)'"
|
||||||
|
>
|
||||||
|
add
|
||||||
|
</v-icon>
|
||||||
|
</transition>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -27,15 +36,83 @@
|
|||||||
:disabled="!editPermission"
|
:disabled="!editPermission"
|
||||||
@click="insertPropertyOfType(type)"
|
@click="insertPropertyOfType(type)"
|
||||||
/>
|
/>
|
||||||
|
<template v-if="tabNumber === 5">
|
||||||
|
<labeled-fab
|
||||||
|
key="property"
|
||||||
|
color="primary"
|
||||||
|
data-id="insert-creature-property-btn"
|
||||||
|
label="New Property"
|
||||||
|
icon="create"
|
||||||
|
:disabled="!editPermission"
|
||||||
|
@click="insertTreeProperty"
|
||||||
|
/>
|
||||||
|
<labeled-fab
|
||||||
|
key="property"
|
||||||
|
color="primary"
|
||||||
|
data-id="insert-creature-property-from-library-btn"
|
||||||
|
label="Property From Library"
|
||||||
|
icon="book"
|
||||||
|
:disabled="!editPermission"
|
||||||
|
@click="propertyFromLibrary"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
</v-speed-dial>
|
</v-speed-dial>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import LabeledFab from '/imports/ui/components/LabeledFab.vue';
|
import LabeledFab from '/imports/ui/components/LabeledFab.vue';
|
||||||
import { setDocToLastOrder } from '/imports/api/parenting/order.js';
|
import { getHighestOrder } from '/imports/api/parenting/order.js';
|
||||||
import insertProperty from '/imports/api/creature/creatureProperties/methods/insertProperty.js';
|
import insertProperty from '/imports/api/creature/creatureProperties/methods/insertProperty.js';
|
||||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||||
import PROPERTIES from '/imports/constants/PROPERTIES.js';
|
import PROPERTIES from '/imports/constants/PROPERTIES.js';
|
||||||
|
import insertPropertyFromLibraryNode from '/imports/api/creature/creatureProperties/methods/insertPropertyFromLibraryNode.js';
|
||||||
|
|
||||||
|
function getParentAndOrderFromSelectedTreeNode(creatureId){
|
||||||
|
// find the parent based on the currently selected property
|
||||||
|
let el = document.querySelector('.tree-tab .tree-node-title.primary--text');
|
||||||
|
let selectedComponent = el && el.parentElement.__vue__.$parent;
|
||||||
|
let parentRef, order;
|
||||||
|
if (selectedComponent){
|
||||||
|
if (selectedComponent.showExpanded){
|
||||||
|
parentRef = {
|
||||||
|
id: selectedComponent.node._id,
|
||||||
|
collection: 'creatureProperties',
|
||||||
|
};
|
||||||
|
order = getHighestOrder({
|
||||||
|
collection: CreatureProperties,
|
||||||
|
ancestorId: parentRef.id,
|
||||||
|
}) + 0.5;
|
||||||
|
} else {
|
||||||
|
parentRef = selectedComponent.node.parent;
|
||||||
|
order = selectedComponent.node.order + 0.5;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
parentRef = {collection: 'creatures', id: creatureId};
|
||||||
|
order = getHighestOrder({
|
||||||
|
collection: CreatureProperties,
|
||||||
|
ancestorId: parentRef.id,
|
||||||
|
}) + 0.5;
|
||||||
|
}
|
||||||
|
return {parentRef, order}
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideFab(){
|
||||||
|
let fab = document.querySelector('.insert-creature-property-fab');
|
||||||
|
if (fab) fab.style.opacity = '0';
|
||||||
|
return fab;
|
||||||
|
}
|
||||||
|
|
||||||
|
function revealFab(fab){
|
||||||
|
if (!fab) return;
|
||||||
|
// Bring back the fab with scale up animation
|
||||||
|
fab.style.transition = 'none';
|
||||||
|
fab.style.opacity = '';
|
||||||
|
fab.style.transform = 'scale(0)';
|
||||||
|
setTimeout(()=> {
|
||||||
|
fab.style.transform = '';
|
||||||
|
fab.style.transition = '';
|
||||||
|
}, 400);
|
||||||
|
}
|
||||||
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
'stats',
|
'stats',
|
||||||
@@ -72,6 +149,7 @@
|
|||||||
'inventory': ['item', 'container'],
|
'inventory': ['item', 'container'],
|
||||||
'spells': ['spellList', 'spell'],
|
'spells': ['spellList', 'spell'],
|
||||||
'character': ['note'],
|
'character': ['note'],
|
||||||
|
'tree': [],
|
||||||
};},
|
};},
|
||||||
properties(){
|
properties(){
|
||||||
return PROPERTIES;
|
return PROPERTIES;
|
||||||
@@ -79,7 +157,10 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
insertPropertyOfType(type){
|
insertPropertyOfType(type){
|
||||||
let that = this;
|
let creatureId = this.creatureId;
|
||||||
|
let fab = hideFab();
|
||||||
|
|
||||||
|
// Open the dialog to insert the property
|
||||||
this.$store.commit('pushDialogStack', {
|
this.$store.commit('pushDialogStack', {
|
||||||
component: 'creature-property-creation-dialog',
|
component: 'creature-property-creation-dialog',
|
||||||
elementId: 'insert-creature-property-type-' + type,
|
elementId: 'insert-creature-property-type-' + type,
|
||||||
@@ -87,18 +168,68 @@
|
|||||||
forcedType: type,
|
forcedType: type,
|
||||||
},
|
},
|
||||||
callback(creatureProperty){
|
callback(creatureProperty){
|
||||||
if (!creatureProperty) return;
|
if (!creatureProperty) return 'insert-creature-property-fab';
|
||||||
creatureProperty.parent = {collection: 'creatures', id: that.creatureId};
|
revealFab(fab);
|
||||||
creatureProperty.ancestors = [ {collection: 'creatures', id: that.creatureId}];
|
|
||||||
setDocToLastOrder({collection: CreatureProperties, doc: creatureProperty});
|
// Insert the property
|
||||||
let id = insertProperty.call({creatureProperty});
|
creatureProperty.order = getHighestOrder({
|
||||||
|
collection: CreatureProperties,
|
||||||
|
ancestorId: creatureId
|
||||||
|
}) + 1;
|
||||||
|
let id = insertProperty.call({
|
||||||
|
creatureProperty,
|
||||||
|
parentRef: {collection: 'creatures', id: creatureId},
|
||||||
|
});
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
insertTreeProperty(){
|
||||||
|
let creatureId = this.creatureId;
|
||||||
|
let fab = hideFab();
|
||||||
|
// Open the dialog to insert the property
|
||||||
|
this.$store.commit('pushDialogStack', {
|
||||||
|
component: 'creature-property-creation-dialog',
|
||||||
|
elementId: 'insert-creature-property-btn',
|
||||||
|
callback(creatureProperty){
|
||||||
|
if (!creatureProperty) return 'insert-creature-property-fab';
|
||||||
|
revealFab(fab);
|
||||||
|
|
||||||
|
// Get order and parent
|
||||||
|
let {parentRef, order } = getParentAndOrderFromSelectedTreeNode(creatureId);
|
||||||
|
creatureProperty.order = order;
|
||||||
|
|
||||||
|
// Insert the property
|
||||||
|
let id = insertProperty.call({creatureProperty, parentRef});
|
||||||
|
return `tree-node-${id}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
propertyFromLibrary(){
|
||||||
|
let creatureId = this.creatureId;
|
||||||
|
let fab = hideFab();
|
||||||
|
|
||||||
|
this.$store.commit('pushDialogStack', {
|
||||||
|
component: 'creature-property-from-library-dialog',
|
||||||
|
elementId: 'insert-creature-property-from-library-btn',
|
||||||
|
callback(libraryNode){
|
||||||
|
if (!libraryNode) return;
|
||||||
|
revealFab(fab);
|
||||||
|
|
||||||
|
let nodeId = libraryNode._id;
|
||||||
|
let {parentRef, order } = getParentAndOrderFromSelectedTreeNode(creatureId);
|
||||||
|
|
||||||
|
let id = insertPropertyFromLibraryNode.call({nodeId, parentRef, order});
|
||||||
|
return `tree-node-${id}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="css" scoped>
|
<style lang="css" scoped>
|
||||||
|
.insert-creature-property-fab {
|
||||||
|
transition: transform 0.07s cubic-bezier(0.5, 0.2, 0.8, 0.4) 0s;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</v-navigation-drawer>
|
</v-navigation-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import CharacterLog from '/imports/ui/log/CharacterLog.vue';
|
import CharacterLog from '/imports/ui/log/CharacterLog.vue';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|||||||
@@ -1,30 +1,31 @@
|
|||||||
<template lang="html">
|
<template lang="html">
|
||||||
<v-toolbar
|
<v-app-bar
|
||||||
app
|
app
|
||||||
class="character-sheet-toolbar"
|
class="character-sheet-toolbar"
|
||||||
:color="toolbarColor"
|
:color="toolbarColor"
|
||||||
:dark="isDark"
|
:dark="isDark"
|
||||||
:light="!isDark"
|
:light="!isDark"
|
||||||
|
clipped-right
|
||||||
extended
|
extended
|
||||||
tabs
|
tabs
|
||||||
dense
|
dense
|
||||||
>
|
>
|
||||||
<v-toolbar-side-icon @click="toggleDrawer" />
|
<v-app-bar-nav-icon @click="toggleDrawer" />
|
||||||
<v-toolbar-title>
|
<v-fade-transition
|
||||||
<v-fade-transition
|
mode="out-in"
|
||||||
mode="out-in"
|
>
|
||||||
>
|
<v-app-bar-title :key="$store.state.pageTitle">
|
||||||
<div :key="$store.state.pageTitle">
|
<div>
|
||||||
{{ $store.state.pageTitle }}
|
{{ $store.state.pageTitle }}
|
||||||
</div>
|
</div>
|
||||||
</v-fade-transition>
|
</v-app-bar-title>
|
||||||
</v-toolbar-title>
|
</v-fade-transition>
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-fade-transition
|
<v-fade-transition
|
||||||
mode="out-in"
|
mode="out-in"
|
||||||
>
|
>
|
||||||
<div :key="$route.meta.title">
|
<div :key="$route.meta.title">
|
||||||
<v-toolbar-items v-if="creature">
|
<template v-if="creature">
|
||||||
<v-menu
|
<v-menu
|
||||||
bottom
|
bottom
|
||||||
left
|
left
|
||||||
@@ -40,32 +41,32 @@
|
|||||||
</v-btn>
|
</v-btn>
|
||||||
</template>
|
</template>
|
||||||
<v-list v-if="editPermission">
|
<v-list v-if="editPermission">
|
||||||
<v-list-tile @click="deleteCharacter">
|
<v-list-item @click="deleteCharacter">
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
<v-icon>delete</v-icon> Delete
|
<v-icon>delete</v-icon> Delete
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
<v-list-tile @click="showCharacterForm">
|
<v-list-item @click="showCharacterForm">
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
<v-icon>create</v-icon> Edit details
|
<v-icon>create</v-icon> Edit details
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
<v-list-tile @click="showShareDialog">
|
<v-list-item @click="showShareDialog">
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
<v-icon>share</v-icon> Sharing
|
<v-icon>share</v-icon> Sharing
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
<v-list v-else>
|
<v-list v-else>
|
||||||
<v-list-tile @click="unshareWithMe">
|
<v-list-item @click="unshareWithMe">
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
<v-icon>delete</v-icon> Unshare with me
|
<v-icon>delete</v-icon> Unshare with me
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
</v-menu>
|
</v-menu>
|
||||||
<v-toolbar-side-icon @click="toggleRightDrawer" />
|
<v-app-bar-nav-icon @click="toggleRightDrawer" />
|
||||||
</v-toolbar-items>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</v-fade-transition>
|
</v-fade-transition>
|
||||||
<v-fade-transition
|
<v-fade-transition
|
||||||
@@ -74,16 +75,18 @@
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
:key="$route.meta.title"
|
:key="$route.meta.title"
|
||||||
class="layout row"
|
class="layout"
|
||||||
>
|
>
|
||||||
<v-tabs
|
<v-tabs
|
||||||
v-if="creature"
|
v-if="creature && creature.settings"
|
||||||
class="flex"
|
class="flex"
|
||||||
style="min-width: 0"
|
style="min-width: 0"
|
||||||
centered
|
centered
|
||||||
grow
|
grow
|
||||||
max="100px"
|
max="100px"
|
||||||
|
:color="$vuetify.theme.themes.dark.primary"
|
||||||
:value="$store.getters.tabById($route.params.id)"
|
:value="$store.getters.tabById($route.params.id)"
|
||||||
|
:background-color="toolbarColor"
|
||||||
@change="e => $store.commit(
|
@change="e => $store.commit(
|
||||||
'setTabForCharacterSheet',
|
'setTabForCharacterSheet',
|
||||||
{id: $route.params.id, tab: e}
|
{id: $route.params.id, tab: e}
|
||||||
@@ -98,13 +101,13 @@
|
|||||||
<v-tab>
|
<v-tab>
|
||||||
Inventory
|
Inventory
|
||||||
</v-tab>
|
</v-tab>
|
||||||
<v-tab>
|
<v-tab v-show="!creature.settings.hideSpellsTab">
|
||||||
Spells
|
Spells
|
||||||
</v-tab>
|
</v-tab>
|
||||||
<v-tab>
|
<v-tab>
|
||||||
Character
|
Character
|
||||||
</v-tab>
|
</v-tab>
|
||||||
<v-tab>
|
<v-tab v-if="creature.settings.showTreeTab">
|
||||||
Tree
|
Tree
|
||||||
</v-tab>
|
</v-tab>
|
||||||
</v-tabs>
|
</v-tabs>
|
||||||
@@ -115,18 +118,18 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</v-fade-transition>
|
</v-fade-transition>
|
||||||
</v-toolbar>
|
</v-app-bar>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import Creatures from '/imports/api/creature/Creatures.js';
|
import Creatures from '/imports/api/creature/Creatures.js';
|
||||||
import removeCreature from '/imports/api/creature/removeCreature.js';
|
import removeCreature from '/imports/api/creature/removeCreature.js';
|
||||||
import { mapMutations } from 'vuex';
|
import { mapMutations } from 'vuex';
|
||||||
import { theme } from '/imports/ui/theme.js';
|
|
||||||
import { assertEditPermission } from '/imports/api/creature/creaturePermissions.js';
|
import { assertEditPermission } from '/imports/api/creature/creaturePermissions.js';
|
||||||
import { updateUserSharePermissions } from '/imports/api/sharing/sharing.js';
|
import { updateUserSharePermissions } from '/imports/api/sharing/sharing.js';
|
||||||
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
||||||
import CharacterSheetFab from '/imports/ui/creature/character/CharacterSheetFab.vue';
|
import CharacterSheetFab from '/imports/ui/creature/character/CharacterSheetFab.vue';
|
||||||
|
import getThemeColor from '/imports/ui/utility/getThemeColor.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
inject: {
|
inject: {
|
||||||
@@ -135,9 +138,6 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
CharacterSheetFab,
|
CharacterSheetFab,
|
||||||
},
|
},
|
||||||
data(){return {
|
|
||||||
theme,
|
|
||||||
}},
|
|
||||||
computed: {
|
computed: {
|
||||||
creatureId(){
|
creatureId(){
|
||||||
return this.$route.params.id;
|
return this.$route.params.id;
|
||||||
@@ -146,7 +146,7 @@ export default {
|
|||||||
if (this.creature && this.creature.color){
|
if (this.creature && this.creature.color){
|
||||||
return this.creature.color;
|
return this.creature.color;
|
||||||
} else {
|
} else {
|
||||||
return this.$vuetify.theme.secondary;
|
return getThemeColor('secondary');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isDark(){
|
isDark(){
|
||||||
@@ -247,6 +247,7 @@ export default {
|
|||||||
}
|
}
|
||||||
.character-sheet-fab {
|
.character-sheet-fab {
|
||||||
bottom: -24px;
|
bottom: -24px;
|
||||||
margin-right: -8px;
|
right: 8px;
|
||||||
|
margin-left: 16px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="mini-character-sheet" />
|
<div class="mini-character-sheet" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
export default {
|
export default {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
v-if="creature.picture"
|
v-if="creature.picture"
|
||||||
:src="creature.picture"
|
:src="creature.picture"
|
||||||
/>
|
/>
|
||||||
<v-card-title class="title">
|
<v-card-title class="text-h6">
|
||||||
{{ creature.name }}
|
{{ creature.name }}
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
@@ -37,22 +37,22 @@
|
|||||||
<v-card class="class-details">
|
<v-card class="class-details">
|
||||||
<v-card-title
|
<v-card-title
|
||||||
v-if="creature.variables.level"
|
v-if="creature.variables.level"
|
||||||
class="title"
|
class="text-h6"
|
||||||
>
|
>
|
||||||
Level {{ creature.variables.level.value }}
|
Level {{ creature.variables.level.value }}
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
<v-list two-line>
|
<v-list two-line>
|
||||||
<v-list-tile>
|
<v-list-item>
|
||||||
<v-list-tile-content>
|
<v-list-item-content>
|
||||||
<v-list-tile-title
|
<v-list-item-title
|
||||||
v-if="
|
v-if="
|
||||||
creature.variables.milestoneLevels &&
|
creature.variables.milestoneLevels &&
|
||||||
creature.variables.milestoneLevels.value
|
creature.variables.milestoneLevels.value
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ creature.variables.milestoneLevels.value }} Milestone levels
|
{{ creature.variables.milestoneLevels.value }} Milestone levels
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
<v-list-tile-title
|
<v-list-item-title
|
||||||
v-if="
|
v-if="
|
||||||
!(creature.variables.milestoneLevels &&
|
!(creature.variables.milestoneLevels &&
|
||||||
creature.variables.milestoneLevels.value) ||
|
creature.variables.milestoneLevels.value) ||
|
||||||
@@ -65,42 +65,40 @@
|
|||||||
creature.variables.xp.value ||
|
creature.variables.xp.value ||
|
||||||
0
|
0
|
||||||
}} XP
|
}} XP
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile-content>
|
</v-list-item-content>
|
||||||
<v-list-tile-action>
|
<v-list-item-action>
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
|
||||||
icon
|
icon
|
||||||
data-id="experience-info-button"
|
data-id="experience-info-button"
|
||||||
@click="showExperienceList"
|
@click="showExperienceList"
|
||||||
>
|
>
|
||||||
<v-icon>info</v-icon>
|
<v-icon>info</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-list-tile-action>
|
</v-list-item-action>
|
||||||
<v-list-tile-action>
|
<v-list-item-action>
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
|
||||||
icon
|
icon
|
||||||
data-id="experience-add-button"
|
data-id="experience-add-button"
|
||||||
@click="addExperience"
|
@click="addExperience"
|
||||||
>
|
>
|
||||||
<v-icon>add</v-icon>
|
<v-icon>add</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-list-tile-action>
|
</v-list-item-action>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
<v-list-tile
|
<v-list-item
|
||||||
v-for="classLevel in highestClassLevels"
|
v-for="classLevel in highestClassLevels"
|
||||||
:key="classLevel._id"
|
:key="classLevel._id"
|
||||||
>
|
>
|
||||||
<v-list-tile-content>
|
<v-list-item-content>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
{{ classLevel.name }}
|
{{ classLevel.name }}
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile-content>
|
</v-list-item-content>
|
||||||
<v-list-tile-avatar>
|
<v-list-item-avatar>
|
||||||
{{ classLevel.level }}
|
{{ classLevel.level }}
|
||||||
</v-list-tile-avatar>
|
</v-list-item-avatar>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
</v-card>
|
</v-card>
|
||||||
</div>
|
</div>
|
||||||
@@ -116,7 +114,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import Creatures from '/imports/api/creature/Creatures.js';
|
import Creatures from '/imports/api/creature/Creatures.js';
|
||||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||||
import ColumnLayout from '/imports/ui/components/ColumnLayout.vue';
|
import ColumnLayout from '/imports/ui/components/ColumnLayout.vue';
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||||
import ColumnLayout from '/imports/ui/components/ColumnLayout.vue';
|
import ColumnLayout from '/imports/ui/components/ColumnLayout.vue';
|
||||||
import FeatureCard from '/imports/ui/properties/components/features/FeatureCard.vue';
|
import FeatureCard from '/imports/ui/properties/components/features/FeatureCard.vue';
|
||||||
|
|||||||
@@ -4,53 +4,53 @@
|
|||||||
<div>
|
<div>
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-list>
|
<v-list>
|
||||||
<v-list-tile>
|
<v-list-item>
|
||||||
<v-list-tile-avatar>
|
<v-list-item-avatar>
|
||||||
<v-icon>$vuetify.icons.injustice</v-icon>
|
<v-icon>$vuetify.icons.injustice</v-icon>
|
||||||
</v-list-tile-avatar>
|
</v-list-item-avatar>
|
||||||
<v-list-tile-content>
|
<v-list-item-content>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
Weight Carried
|
Weight Carried
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile-content>
|
</v-list-item-content>
|
||||||
<v-list-tile-action>
|
<v-list-item-action>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
{{ creature.denormalizedStats.weightCarried || 0 }} lb
|
{{ creature.denormalizedStats.weightCarried || 0 }} lb
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile-action>
|
</v-list-item-action>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
<v-list-tile>
|
<v-list-item>
|
||||||
<v-list-tile-avatar>
|
<v-list-item-avatar>
|
||||||
<v-icon>$vuetify.icons.cash</v-icon>
|
<v-icon>$vuetify.icons.cash</v-icon>
|
||||||
</v-list-tile-avatar>
|
</v-list-item-avatar>
|
||||||
<v-list-tile-content>
|
<v-list-item-content>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
Net worth
|
Net worth
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile-content>
|
</v-list-item-content>
|
||||||
<v-list-tile-action>
|
<v-list-item-action>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
<coin-value
|
<coin-value
|
||||||
:value="creature.denormalizedStats.valueTotal || 0"
|
:value="creature.denormalizedStats.valueTotal || 0"
|
||||||
/>
|
/>
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile-action>
|
</v-list-item-action>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
<v-list-tile v-if="creature.denormalizedStats.itemsAttuned">
|
<v-list-item v-if="creature.denormalizedStats.itemsAttuned">
|
||||||
<v-list-tile-avatar>
|
<v-list-item-avatar>
|
||||||
<v-icon>$vuetify.icons.spell</v-icon>
|
<v-icon>$vuetify.icons.spell</v-icon>
|
||||||
</v-list-tile-avatar>
|
</v-list-item-avatar>
|
||||||
<v-list-tile-content>
|
<v-list-item-content>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
Items attuned
|
Items attuned
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile-content>
|
</v-list-item-content>
|
||||||
<v-list-tile-action>
|
<v-list-item-action>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
{{ creature.denormalizedStats.itemsAttuned }}
|
{{ creature.denormalizedStats.itemsAttuned }}
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile-action>
|
</v-list-item-action>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
</v-card>
|
</v-card>
|
||||||
</div>
|
</div>
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||||
import Creatures from '/imports/api/creature/Creatures.js';
|
import Creatures from '/imports/api/creature/Creatures.js';
|
||||||
import ColumnLayout from '/imports/ui/components/ColumnLayout.vue';
|
import ColumnLayout from '/imports/ui/components/ColumnLayout.vue';
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import ColumnLayout from '/imports/ui/components/ColumnLayout.vue';
|
import ColumnLayout from '/imports/ui/components/ColumnLayout.vue';
|
||||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||||
import SpellListCard from '/imports/ui/properties/components/spells/SpellListCard.vue';
|
import SpellListCard from '/imports/ui/properties/components/spells/SpellListCard.vue';
|
||||||
|
|||||||
@@ -11,10 +11,12 @@
|
|||||||
<rest-button
|
<rest-button
|
||||||
:creature-id="creatureId"
|
:creature-id="creatureId"
|
||||||
type="shortRest"
|
type="shortRest"
|
||||||
|
class="ma-1"
|
||||||
/>
|
/>
|
||||||
<rest-button
|
<rest-button
|
||||||
:creature-id="creatureId"
|
:creature-id="creatureId"
|
||||||
type="longRest"
|
type="longRest"
|
||||||
|
class="ma-1"
|
||||||
/>
|
/>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
</v-card>
|
</v-card>
|
||||||
@@ -27,27 +29,26 @@
|
|||||||
<v-card>
|
<v-card>
|
||||||
<v-list>
|
<v-list>
|
||||||
<v-subheader>Buffs and conditions</v-subheader>
|
<v-subheader>Buffs and conditions</v-subheader>
|
||||||
<v-list-tile
|
<v-list-item
|
||||||
v-for="buff in appliedBuffs"
|
v-for="buff in appliedBuffs"
|
||||||
:key="buff._id"
|
:key="buff._id"
|
||||||
:data-id="buff._id"
|
:data-id="buff._id"
|
||||||
@click="clickProperty({_id: buff._id})"
|
@click="clickProperty({_id: buff._id})"
|
||||||
>
|
>
|
||||||
<v-list-tile-content>
|
<v-list-item-content>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
{{ buff.name }}
|
{{ buff.name }}
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile-content>
|
</v-list-item-content>
|
||||||
<v-list-tile-action>
|
<v-list-item-action>
|
||||||
<v-btn
|
<v-btn
|
||||||
icon
|
icon
|
||||||
flat
|
|
||||||
@click.stop="softRemove(buff._id)"
|
@click.stop="softRemove(buff._id)"
|
||||||
>
|
>
|
||||||
<v-icon>delete</v-icon>
|
<v-icon>delete</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-list-tile-action>
|
</v-list-item-action>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
</v-card>
|
</v-card>
|
||||||
</div>
|
</div>
|
||||||
@@ -318,7 +319,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import Creatures from '/imports/api/creature/Creatures.js';
|
import Creatures from '/imports/api/creature/Creatures.js';
|
||||||
import softRemoveProperty from '/imports/api/creature/creatureProperties/methods/softRemoveProperty.js';
|
import softRemoveProperty from '/imports/api/creature/creatureProperties/methods/softRemoveProperty.js';
|
||||||
import damageProperty from '/imports/api/creature/creatureProperties/methods/damageProperty.js';
|
import damageProperty from '/imports/api/creature/creatureProperties/methods/damageProperty.js';
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
<v-toolbar
|
<v-toolbar
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
|
style="flex-grow: 0;"
|
||||||
>
|
>
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-switch
|
<v-switch
|
||||||
@@ -56,49 +57,15 @@
|
|||||||
</template>
|
</template>
|
||||||
</tree-detail-layout>
|
</tree-detail-layout>
|
||||||
</v-card>
|
</v-card>
|
||||||
<v-speed-dial
|
|
||||||
v-model="fab"
|
|
||||||
fixed
|
|
||||||
bottom="bottom"
|
|
||||||
right="right"
|
|
||||||
>
|
|
||||||
<template #activator>
|
|
||||||
<v-btn
|
|
||||||
v-model="fab"
|
|
||||||
color="primary"
|
|
||||||
fab
|
|
||||||
data-id="insert-creature-property-fab"
|
|
||||||
>
|
|
||||||
<v-icon>add</v-icon>
|
|
||||||
<v-icon>close</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</template>
|
|
||||||
<labeled-fab
|
|
||||||
color="primary"
|
|
||||||
label="Property from library"
|
|
||||||
icon="book"
|
|
||||||
@click="propertyFromLibrary"
|
|
||||||
/>
|
|
||||||
<labeled-fab
|
|
||||||
color="primary"
|
|
||||||
label="New property"
|
|
||||||
icon="edit"
|
|
||||||
@click="insertCreatureProperty"
|
|
||||||
/>
|
|
||||||
</v-speed-dial>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import TreeDetailLayout from '/imports/ui/components/TreeDetailLayout.vue';
|
import TreeDetailLayout from '/imports/ui/components/TreeDetailLayout.vue';
|
||||||
import CreaturePropertiesTree from '/imports/ui/creature/creatureProperties/CreaturePropertiesTree.vue';
|
import CreaturePropertiesTree from '/imports/ui/creature/creatureProperties/CreaturePropertiesTree.vue';
|
||||||
import CreaturePropertyDialog from '/imports/ui/creature/creatureProperties/CreaturePropertyDialog.vue';
|
import CreaturePropertyDialog from '/imports/ui/creature/creatureProperties/CreaturePropertyDialog.vue';
|
||||||
import LabeledFab from '/imports/ui/components/LabeledFab.vue';
|
|
||||||
|
|
||||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||||
import insertPropertyFromLibraryNode from '/imports/api/creature/creatureProperties/methods/insertPropertyFromLibraryNode.js';
|
|
||||||
import insertProperty from '/imports/api/creature/creatureProperties/methods/insertProperty.js';
|
|
||||||
import { setDocToLastOrder } from '/imports/api/parenting/order.js';
|
|
||||||
import { getPropertyName } from '/imports/constants/PROPERTIES.js';
|
import { getPropertyName } from '/imports/constants/PROPERTIES.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -106,7 +73,6 @@
|
|||||||
TreeDetailLayout,
|
TreeDetailLayout,
|
||||||
CreaturePropertiesTree,
|
CreaturePropertiesTree,
|
||||||
CreaturePropertyDialog,
|
CreaturePropertyDialog,
|
||||||
LabeledFab,
|
|
||||||
},
|
},
|
||||||
inject: {
|
inject: {
|
||||||
context: { default: {} }
|
context: { default: {} }
|
||||||
@@ -195,36 +161,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
insertCreatureProperty(){
|
|
||||||
let that = this;
|
|
||||||
this.$store.commit('pushDialogStack', {
|
|
||||||
component: 'creature-property-creation-dialog',
|
|
||||||
elementId: 'insert-creature-property-fab',
|
|
||||||
callback(creatureProperty){
|
|
||||||
if (!creatureProperty) return;
|
|
||||||
creatureProperty.parent = {collection: 'creatures', id: that.creatureId};
|
|
||||||
creatureProperty.ancestors = [ {collection: 'creatures', id: that.creatureId}];
|
|
||||||
setDocToLastOrder({collection: CreatureProperties, doc: creatureProperty});
|
|
||||||
let id = insertProperty.call({creatureProperty});
|
|
||||||
return `tree-node-${id}`;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
propertyFromLibrary(){
|
|
||||||
let that = this;
|
|
||||||
this.$store.commit('pushDialogStack', {
|
|
||||||
component: 'creature-property-from-library-dialog',
|
|
||||||
elementId: 'insert-creature-property-fab',
|
|
||||||
callback(libraryNode){
|
|
||||||
if (!libraryNode) return;
|
|
||||||
let id = insertPropertyFromLibraryNode.call({
|
|
||||||
nodeId: libraryNode._id,
|
|
||||||
parentRef: {collection: 'creatures', id: that.creatureId},
|
|
||||||
});
|
|
||||||
return `tree-node-${id}`;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
editCreatureProperty(){
|
editCreatureProperty(){
|
||||||
this.$store.commit('pushDialogStack', {
|
this.$store.commit('pushDialogStack', {
|
||||||
component: 'creature-property-dialog',
|
component: 'creature-property-dialog',
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||||
import { nodesToTree } from '/imports/api/parenting/parenting.js'
|
import { nodesToTree } from '/imports/api/parenting/parenting.js'
|
||||||
import TreeNodeList from '/imports/ui/components/tree/TreeNodeList.vue';
|
import TreeNodeList from '/imports/ui/components/tree/TreeNodeList.vue';
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
</selectable-property-dialog>
|
</selectable-property-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import SelectablePropertyDialog from '/imports/ui/properties/shared/SelectablePropertyDialog.vue';
|
import SelectablePropertyDialog from '/imports/ui/properties/shared/SelectablePropertyDialog.vue';
|
||||||
import CreaturePropertyInsertForm from '/imports/ui/creature/creatureProperties/CreaturePropertyInsertForm.vue';
|
import CreaturePropertyInsertForm from '/imports/ui/creature/creatureProperties/CreaturePropertyInsertForm.vue';
|
||||||
import { getPropertyName } from '/imports/constants/PROPERTIES.js';
|
import { getPropertyName } from '/imports/constants/PROPERTIES.js';
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
:model="model"
|
:model="model"
|
||||||
:editing="editing"
|
:editing="editing"
|
||||||
:flat="flat"
|
:flat="flat"
|
||||||
|
style="flex-grow: 0;"
|
||||||
@duplicate="duplicate"
|
@duplicate="duplicate"
|
||||||
@remove="remove"
|
@remove="remove"
|
||||||
@toggle-editing="editing = !editing"
|
@toggle-editing="editing = !editing"
|
||||||
@@ -18,6 +19,7 @@
|
|||||||
<component
|
<component
|
||||||
:is="model.type + 'Form'"
|
:is="model.type + 'Form'"
|
||||||
v-if="editing"
|
v-if="editing"
|
||||||
|
:key="_id"
|
||||||
class="creature-property-form"
|
class="creature-property-form"
|
||||||
:model="model"
|
:model="model"
|
||||||
@change="change"
|
@change="change"
|
||||||
@@ -27,6 +29,7 @@
|
|||||||
<component
|
<component
|
||||||
:is="model.type + 'Viewer'"
|
:is="model.type + 'Viewer'"
|
||||||
v-else-if="!editing && $options.components[model.type + 'Viewer']"
|
v-else-if="!editing && $options.components[model.type + 'Viewer']"
|
||||||
|
:key="_id"
|
||||||
class="creature-property-viewer"
|
class="creature-property-viewer"
|
||||||
:model="model"
|
:model="model"
|
||||||
/>
|
/>
|
||||||
@@ -46,10 +49,10 @@
|
|||||||
<div
|
<div
|
||||||
v-if="!embedded"
|
v-if="!embedded"
|
||||||
slot="actions"
|
slot="actions"
|
||||||
class="layout row justify-end"
|
class="layout justify-end"
|
||||||
>
|
>
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
@click="$store.dispatch('popDialogStack')"
|
@click="$store.dispatch('popDialogStack')"
|
||||||
>
|
>
|
||||||
Done
|
Done
|
||||||
@@ -58,7 +61,7 @@
|
|||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||||
import damageProperty from '/imports/api/creature/creatureProperties/methods/damageProperty.js';
|
import damageProperty from '/imports/api/creature/creatureProperties/methods/damageProperty.js';
|
||||||
import pushToProperty from '/imports/api/creature/creatureProperties/methods/pushToProperty.js';
|
import pushToProperty from '/imports/api/creature/creatureProperties/methods/pushToProperty.js';
|
||||||
@@ -79,6 +82,7 @@ import getPropertyTitle from '/imports/ui/properties/shared/getPropertyTitle.js'
|
|||||||
import { assertEditPermission } from '/imports/api/creature/creaturePermissions.js';
|
import { assertEditPermission } from '/imports/api/creature/creaturePermissions.js';
|
||||||
import { get, findLast } from 'lodash';
|
import { get, findLast } from 'lodash';
|
||||||
import equipItem from '/imports/api/creature/creatureProperties/methods/equipItem.js';
|
import equipItem from '/imports/api/creature/creatureProperties/methods/equipItem.js';
|
||||||
|
import { snackbar } from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
||||||
|
|
||||||
let formIndex = {};
|
let formIndex = {};
|
||||||
for (let key in propertyFormIndex){
|
for (let key in propertyFormIndex){
|
||||||
@@ -106,10 +110,13 @@ export default {
|
|||||||
},
|
},
|
||||||
data(){ return {
|
data(){ return {
|
||||||
editing: !!this.startInEditTab,
|
editing: !!this.startInEditTab,
|
||||||
|
// CurrentId lags behind Id by one tick so that events fired by destroying
|
||||||
|
// forms keyed to the old ID are applied before the new ID overwrites it
|
||||||
|
currentId: undefined,
|
||||||
}},
|
}},
|
||||||
meteor: {
|
meteor: {
|
||||||
model(){
|
model(){
|
||||||
return CreatureProperties.findOne(this._id);
|
return CreatureProperties.findOne(this.currentId);
|
||||||
},
|
},
|
||||||
editPermission(){
|
editPermission(){
|
||||||
try {
|
try {
|
||||||
@@ -134,6 +141,16 @@ export default {
|
|||||||
return this.creature && this.creature._id;
|
return this.creature && this.creature._id;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
_id: {
|
||||||
|
immediate: true,
|
||||||
|
handler(newId){
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.currentId = newId;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
reactiveProvide: {
|
reactiveProvide: {
|
||||||
name: 'context',
|
name: 'context',
|
||||||
include: ['creatureId', 'editPermission'],
|
include: ['creatureId', 'editPermission'],
|
||||||
@@ -141,7 +158,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
getPropertyName,
|
getPropertyName,
|
||||||
duplicate(){
|
duplicate(){
|
||||||
duplicateProperty.call({_id: this._id}, (error) => {
|
duplicateProperty.call({_id: this.currentId}, (error) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
@@ -154,25 +171,25 @@ export default {
|
|||||||
},
|
},
|
||||||
change({path, value, ack}){
|
change({path, value, ack}){
|
||||||
if (path && path[0] === 'equipped'){
|
if (path && path[0] === 'equipped'){
|
||||||
equipItem.call({_id: this._id, equipped: value}, (error) =>{
|
equipItem.call({_id: this.currentId, equipped: value}, (error) =>{
|
||||||
if (error) console.warn(error);
|
if (error) console.warn(error);
|
||||||
ack && ack(error && error.reason || error);
|
ack && ack(error && error.reason || error);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
updateCreatureProperty.call({_id: this._id, path, value}, (error) =>{
|
updateCreatureProperty.call({_id: this.currentId, path, value}, (error) =>{
|
||||||
if (error) console.warn(error);
|
if (error) console.warn(error);
|
||||||
ack && ack(error && error.reason || error);
|
ack && ack(error && error.reason || error);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
damage({operation, value, ack}){
|
damage({operation, value, ack}){
|
||||||
damageProperty.call({_id: this._id, operation, value}, (error) =>{
|
damageProperty.call({_id: this.currentId, operation, value}, (error) =>{
|
||||||
if (error) console.warn(error);
|
if (error) console.warn(error);
|
||||||
ack && ack(error && error.reason || error);
|
ack && ack(error && error.reason || error);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
push({path, value, ack}){
|
push({path, value, ack}){
|
||||||
pushToProperty.call({_id: this._id, path, value}, (error) =>{
|
pushToProperty.call({_id: this.currentId, path, value}, (error) =>{
|
||||||
if (error) console.warn(error);
|
if (error) console.warn(error);
|
||||||
ack && ack(error && error.reason || error);
|
ack && ack(error && error.reason || error);
|
||||||
});
|
});
|
||||||
@@ -180,20 +197,20 @@ export default {
|
|||||||
pull({path, ack}){
|
pull({path, ack}){
|
||||||
let itemId = get(this.model, path)._id;
|
let itemId = get(this.model, path)._id;
|
||||||
path.pop();
|
path.pop();
|
||||||
pullFromProperty.call({_id: this._id, path, itemId}, (error) =>{
|
pullFromProperty.call({_id: this.currentId, path, itemId}, (error) =>{
|
||||||
if (error) console.warn(error);
|
if (error) console.warn(error);
|
||||||
ack && ack(error && error.reason || error);
|
ack && ack(error && error.reason || error);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
remove(){
|
remove(){
|
||||||
const _id = this._id;
|
const _id = this.currentId;
|
||||||
softRemoveProperty.call({_id});
|
softRemoveProperty.call({_id});
|
||||||
if (this.embedded){
|
if (this.embedded){
|
||||||
this.$emit('removed');
|
this.$emit('removed');
|
||||||
} else {
|
} else {
|
||||||
this.$store.dispatch('popDialogStack');
|
this.$store.dispatch('popDialogStack');
|
||||||
}
|
}
|
||||||
this.$store.dispatch('snackbar', {
|
snackbar({
|
||||||
text: `Deleted ${getPropertyTitle(this.model)}`,
|
text: `Deleted ${getPropertyTitle(this.model)}`,
|
||||||
callbackName: 'undo',
|
callbackName: 'undo',
|
||||||
callback(){
|
callback(){
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<template slot="actions">
|
<template slot="actions">
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="$store.dispatch('popDialogStack', node)"
|
@click="$store.dispatch('popDialogStack', node)"
|
||||||
>
|
>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
import LibraryAndNode from '/imports/ui/library/LibraryAndNode.vue';
|
import LibraryAndNode from '/imports/ui/library/LibraryAndNode.vue';
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -25,10 +25,10 @@
|
|||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
slot="actions"
|
slot="actions"
|
||||||
class="layout row justify-end"
|
class="layout justify-end"
|
||||||
>
|
>
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
:disabled="!valid"
|
:disabled="!valid"
|
||||||
@click="$store.dispatch('popDialogStack', model)"
|
@click="$store.dispatch('popDialogStack', model)"
|
||||||
>
|
>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import propertySchemasIndex from '/imports/api/properties/propertySchemasIndex.js';
|
import propertySchemasIndex from '/imports/api/properties/propertySchemasIndex.js';
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
import propertyFormIndex from '/imports/ui/properties/forms/shared/propertyFormIndex.js';
|
import propertyFormIndex from '/imports/ui/properties/forms/shared/propertyFormIndex.js';
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
v-if="milestone"
|
v-if="milestone"
|
||||||
label="Levels"
|
label="Levels"
|
||||||
type="number"
|
type="number"
|
||||||
class="base-value-field text-xs-center large-format no-flex"
|
class="base-value-field text-center large-format no-flex"
|
||||||
:value="model.levels"
|
:value="model.levels"
|
||||||
:error-messages="errors.levels"
|
:error-messages="errors.levels"
|
||||||
@change="change('levels', ...arguments)"
|
@change="change('levels', ...arguments)"
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<text-field
|
<text-field
|
||||||
v-else
|
v-else
|
||||||
type="number"
|
type="number"
|
||||||
class="base-value-field text-xs-center large-format no-flex"
|
class="base-value-field text-center large-format no-flex"
|
||||||
suffix="XP"
|
suffix="XP"
|
||||||
autofocus
|
autofocus
|
||||||
:value="model.xp"
|
:value="model.xp"
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import propertyFormMixin from '/imports/ui/properties/forms/shared/propertyFormMixin.js';
|
import propertyFormMixin from '/imports/ui/properties/forms/shared/propertyFormMixin.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -13,10 +13,10 @@
|
|||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
slot="actions"
|
slot="actions"
|
||||||
class="layout row justify-end"
|
class="layout justify-end"
|
||||||
>
|
>
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
:disabled="!valid"
|
:disabled="!valid"
|
||||||
@click="insertExperience"
|
@click="insertExperience"
|
||||||
>
|
>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
import ExperienceForm from '/imports/ui/creature/experiences/ExperienceForm.vue';
|
import ExperienceForm from '/imports/ui/creature/experiences/ExperienceForm.vue';
|
||||||
import { ExperienceSchema, insertExperience } from '/imports/api/creature/experience/Experiences.js';
|
import { ExperienceSchema, insertExperience } from '/imports/api/creature/experience/Experiences.js';
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn
|
<v-btn
|
||||||
icon
|
icon
|
||||||
flat
|
|
||||||
data-id="experience-add-button"
|
data-id="experience-add-button"
|
||||||
@click="addExperience"
|
@click="addExperience"
|
||||||
>
|
>
|
||||||
@@ -15,7 +14,6 @@
|
|||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn
|
<v-btn
|
||||||
icon
|
icon
|
||||||
flat
|
|
||||||
@click="recompute"
|
@click="recompute"
|
||||||
>
|
>
|
||||||
<v-icon>refresh</v-icon>
|
<v-icon>refresh</v-icon>
|
||||||
@@ -34,10 +32,10 @@
|
|||||||
v-else-if="experiences.length === 0"
|
v-else-if="experiences.length === 0"
|
||||||
class="layout column align-center justify-center fill-height"
|
class="layout column align-center justify-center fill-height"
|
||||||
>
|
>
|
||||||
<v-icon style="font-size: 240px; width: 240px; height: 240px;">
|
<v-icon class="big-icon">
|
||||||
$vuetify.icons.baby_face
|
$vuetify.icons.baby_face
|
||||||
</v-icon>
|
</v-icon>
|
||||||
<p class="headline">
|
<p class="text-h5">
|
||||||
No experiences
|
No experiences
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -46,32 +44,32 @@
|
|||||||
group
|
group
|
||||||
mode="out"
|
mode="out"
|
||||||
>
|
>
|
||||||
<v-list-tile
|
<v-list-item
|
||||||
v-for="experience in experiences"
|
v-for="experience in experiences"
|
||||||
:key="experience._id"
|
:key="experience._id"
|
||||||
:data-id="experience._id"
|
:data-id="experience._id"
|
||||||
>
|
>
|
||||||
<v-list-tile-action class="mr-3">
|
<v-list-item-action class="mr-3">
|
||||||
<v-list-tile-action-text>
|
<v-list-item-action-text>
|
||||||
{{ formatDate(experience.date) }}
|
{{ formatDate(experience.date) }}
|
||||||
</v-list-tile-action-text>
|
</v-list-item-action-text>
|
||||||
</v-list-tile-action>
|
</v-list-item-action>
|
||||||
<v-list-tile-content>
|
<v-list-item-content>
|
||||||
<template v-if="experience.name">
|
<template v-if="experience.name">
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
{{ experience.name }}
|
{{ experience.name }}
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
<v-list-tile-sub-title>
|
<v-list-item-subtitle>
|
||||||
{{ xpText(experience) }}
|
{{ xpText(experience) }}
|
||||||
</v-list-tile-sub-title>
|
</v-list-item-subtitle>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
{{ xpText(experience) }}
|
{{ xpText(experience) }}
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</template>
|
</template>
|
||||||
</v-list-tile-content>
|
</v-list-item-content>
|
||||||
<v-list-tile-action>
|
<v-list-item-action>
|
||||||
<v-btn
|
<v-btn
|
||||||
icon
|
icon
|
||||||
flat
|
flat
|
||||||
@@ -80,14 +78,14 @@
|
|||||||
>
|
>
|
||||||
<v-icon>delete</v-icon>
|
<v-icon>delete</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-list-tile-action>
|
</v-list-item-action>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
</v-slide-x-transition>
|
</v-slide-x-transition>
|
||||||
</v-list>
|
</v-list>
|
||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import { format } from 'date-fns';
|
import { format } from 'date-fns';
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
import Experiences, { removeExperience, recomputeExperiences } from '/imports/api/creature/experience/Experiences.js';
|
import Experiences, { removeExperience, recomputeExperiences } from '/imports/api/creature/experience/Experiences.js';
|
||||||
@@ -170,5 +168,9 @@ export default {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="css" scoped>
|
<style lang="css">
|
||||||
|
.big-icon, .big-icon * {
|
||||||
|
width: 240px !important;
|
||||||
|
height: 240px !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import Creatures from '/imports/api/creature/Creatures.js';
|
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
import Slots from '/imports/ui/creature/slots/Slots.vue'
|
import Slots from '/imports/ui/creature/slots/Slots.vue'
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<v-fade-transition mode="out-in">
|
<v-fade-transition mode="out-in">
|
||||||
<div v-if="libraryNodes && libraryNodes.length">
|
<div v-if="libraryNodes && libraryNodes.length">
|
||||||
<section
|
<section
|
||||||
class="layout row wrap justify-between"
|
class="layout wrap justify-between"
|
||||||
>
|
>
|
||||||
<v-card
|
<v-card
|
||||||
v-for="node in libraryNodes"
|
v-for="node in libraryNodes"
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
/>
|
/>
|
||||||
<v-card-title primary-title>
|
<v-card-title primary-title>
|
||||||
<tree-node-view
|
<tree-node-view
|
||||||
class="mr-2 title mb-0"
|
class="mr-2 text-h6 mb-0"
|
||||||
:class="{'theme--dark': node._id === (selectedNode && selectedNode._id)}"
|
:class="{'theme--dark': node._id === (selectedNode && selectedNode._id)}"
|
||||||
:hide-icon="node.picture"
|
:hide-icon="node.picture"
|
||||||
:model="node"
|
:model="node"
|
||||||
@@ -63,16 +63,17 @@
|
|||||||
</v-card-text>
|
</v-card-text>
|
||||||
</v-card>
|
</v-card>
|
||||||
</section>
|
</section>
|
||||||
<div class="layout row justify-center align-stretch">
|
</div>
|
||||||
<v-btn
|
<div
|
||||||
v-if="currentLimit < countAll"
|
v-else-if="countAll"
|
||||||
:loading="!$subReady.slotFillers"
|
class="ma-4"
|
||||||
class="primary"
|
>
|
||||||
@click="loadMore"
|
<h4 v-if="numFiltered">
|
||||||
>
|
Requirements of {{ numFiltered }} library properties were not met.
|
||||||
Load More
|
</h4>
|
||||||
</v-btn>
|
<h4 v-else>
|
||||||
</div>
|
Nothing suitable was found in your libraries.
|
||||||
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else-if="$subReady.slotFillers"
|
v-else-if="$subReady.slotFillers"
|
||||||
@@ -117,17 +118,31 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</v-fade-transition>
|
</v-fade-transition>
|
||||||
|
<v-fade-transition mode="out-in">
|
||||||
|
<div
|
||||||
|
v-if="currentLimit < countAll"
|
||||||
|
class="layout justify-center align-stretch"
|
||||||
|
>
|
||||||
|
<v-btn
|
||||||
|
:loading="!$subReady.slotFillers"
|
||||||
|
class="primary"
|
||||||
|
@click="loadMore"
|
||||||
|
>
|
||||||
|
Load More
|
||||||
|
</v-btn>
|
||||||
|
</div>
|
||||||
|
</v-fade-transition>
|
||||||
</div>
|
</div>
|
||||||
<template slot="actions">
|
<template slot="actions">
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
@click="$store.dispatch('popDialogStack')"
|
@click="$store.dispatch('popDialogStack')"
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
:disabled="!selectedNode"
|
:disabled="!selectedNode"
|
||||||
@click="insert"
|
@click="insert"
|
||||||
>
|
>
|
||||||
@@ -137,7 +152,7 @@
|
|||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import Creatures from '/imports/api/creature/Creatures.js';
|
import Creatures from '/imports/api/creature/Creatures.js';
|
||||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||||
import LibraryNodes from '/imports/api/library/LibraryNodes.js';
|
import LibraryNodes from '/imports/api/library/LibraryNodes.js';
|
||||||
@@ -167,6 +182,7 @@ export default {
|
|||||||
data(){return {
|
data(){return {
|
||||||
selectedNode: undefined,
|
selectedNode: undefined,
|
||||||
searchValue: undefined,
|
searchValue: undefined,
|
||||||
|
numFiltered: 0,
|
||||||
}},
|
}},
|
||||||
computed: {
|
computed: {
|
||||||
slotPropertyTypeName(){
|
slotPropertyTypeName(){
|
||||||
@@ -216,7 +232,7 @@ export default {
|
|||||||
return Creatures.findOne(this.creatureId);
|
return Creatures.findOne(this.creatureId);
|
||||||
},
|
},
|
||||||
currentLimit(){
|
currentLimit(){
|
||||||
return this._subs['slotFillers'].data('limit') || 16;
|
return this._subs['slotFillers'].data('limit') || 20;
|
||||||
},
|
},
|
||||||
countAll(){
|
countAll(){
|
||||||
return this._subs['slotFillers'].data('countAll');
|
return this._subs['slotFillers'].data('countAll');
|
||||||
@@ -239,6 +255,7 @@ export default {
|
|||||||
let nodes = LibraryNodes.find(filter, {
|
let nodes = LibraryNodes.find(filter, {
|
||||||
sort: {name: 1, order: 1}
|
sort: {name: 1, order: 1}
|
||||||
}).fetch();
|
}).fetch();
|
||||||
|
let totalNodes = nodes.length;
|
||||||
// Filter out slotFillers whose condition isn't met or are too big to fit
|
// Filter out slotFillers whose condition isn't met or are too big to fit
|
||||||
// the quantity to fill
|
// the quantity to fill
|
||||||
nodes = nodes.filter(node => {
|
nodes = nodes.filter(node => {
|
||||||
@@ -259,7 +276,7 @@ export default {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
// Filter out slotFillers whose
|
this.numFiltered = totalNodes - nodes.length;
|
||||||
if (nodes.length === 1) this.selectedNode = nodes[0];
|
if (nodes.length === 1) this.selectedNode = nodes[0];
|
||||||
return nodes;
|
return nodes;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
:key="slot._id"
|
:key="slot._id"
|
||||||
class="slot"
|
class="slot"
|
||||||
>
|
>
|
||||||
<h3 class="layout row align-center">
|
<h3 class="layout align-center">
|
||||||
{{ slot.name }}
|
{{ slot.name }}
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<span v-if="slot.quantityExpectedResult > 1">
|
<span v-if="slot.quantityExpectedResult > 1">
|
||||||
@@ -13,29 +13,28 @@
|
|||||||
</span>
|
</span>
|
||||||
</h3>
|
</h3>
|
||||||
<v-list v-if="slot.children.length">
|
<v-list v-if="slot.children.length">
|
||||||
<v-list-tile
|
<v-list-item
|
||||||
v-for="child in slot.children"
|
v-for="child in slot.children"
|
||||||
:key="child._id"
|
:key="child._id"
|
||||||
:data-id="`slot-child-${child._id}`"
|
:data-id="`slot-child-${child._id}`"
|
||||||
@click="clickSlotChild(child)"
|
@click="clickSlotChild(child)"
|
||||||
>
|
>
|
||||||
<v-list-tile-content>
|
<v-list-item-content>
|
||||||
<tree-node-view
|
<tree-node-view
|
||||||
class="slotChild"
|
class="slotChild"
|
||||||
:model="child"
|
:model="child"
|
||||||
/>
|
/>
|
||||||
</v-list-tile-content>
|
</v-list-item-content>
|
||||||
<v-list-tile-action>
|
<v-list-item-action>
|
||||||
<v-btn
|
<v-btn
|
||||||
icon
|
icon
|
||||||
flat
|
|
||||||
small
|
small
|
||||||
@click.stop="remove(child)"
|
@click.stop="remove(child)"
|
||||||
>
|
>
|
||||||
<v-icon>delete</v-icon>
|
<v-icon>delete</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-list-tile-action>
|
</v-list-item-action>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
<v-btn
|
<v-btn
|
||||||
v-if="!slot.quantityExpectedResult || slot.spaceLeft"
|
v-if="!slot.quantityExpectedResult || slot.spaceLeft"
|
||||||
@@ -51,13 +50,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties.js';
|
||||||
import TreeNodeView from '/imports/ui/properties/treeNodeViews/TreeNodeView.vue';
|
import TreeNodeView from '/imports/ui/properties/treeNodeViews/TreeNodeView.vue';
|
||||||
import softRemoveProperty from '/imports/api/creature/creatureProperties/methods/softRemoveProperty.js';
|
import softRemoveProperty from '/imports/api/creature/creatureProperties/methods/softRemoveProperty.js';
|
||||||
import restoreProperty from '/imports/api/creature/creatureProperties/methods/restoreProperty.js';
|
import restoreProperty from '/imports/api/creature/creatureProperties/methods/restoreProperty.js';
|
||||||
import getPropertyTitle from '/imports/ui/properties/shared/getPropertyTitle.js';
|
import getPropertyTitle from '/imports/ui/properties/shared/getPropertyTitle.js';
|
||||||
import insertPropertyFromLibraryNode from '/imports/api/creature/creatureProperties/methods/insertPropertyFromLibraryNode.js';
|
import insertPropertyFromLibraryNode from '/imports/api/creature/creatureProperties/methods/insertPropertyFromLibraryNode.js';
|
||||||
|
import { snackbar } from '/imports/ui/components/snackbars/SnackbarQueue.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -105,7 +105,7 @@ export default {
|
|||||||
},
|
},
|
||||||
remove(model){
|
remove(model){
|
||||||
softRemoveProperty.call({_id: model._id});
|
softRemoveProperty.call({_id: model._id});
|
||||||
this.$store.dispatch('snackbar', {
|
snackbar({
|
||||||
text: `Deleted ${getPropertyTitle(model)}`,
|
text: `Deleted ${getPropertyTitle(model)}`,
|
||||||
callbackName: 'undo',
|
callbackName: 'undo',
|
||||||
callback(){
|
callback(){
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
v-if="name"
|
v-if="name"
|
||||||
v-model="inputName"
|
v-model="inputName"
|
||||||
/>
|
/>
|
||||||
<div class="layout row justify-center">
|
<div class="layout justify-center">
|
||||||
<v-btn
|
<v-btn
|
||||||
v-show="nameMatch"
|
v-show="nameMatch"
|
||||||
class="primary"
|
class="primary"
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
<v-spacer slot="actions" />
|
<v-spacer slot="actions" />
|
||||||
<v-btn
|
<v-btn
|
||||||
slot="actions"
|
slot="actions"
|
||||||
flat
|
text
|
||||||
@click="$store.dispatch('popDialogStack')"
|
@click="$store.dispatch('popDialogStack')"
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
>
|
>
|
||||||
<v-btn
|
<v-btn
|
||||||
icon
|
icon
|
||||||
flat
|
|
||||||
@click="back"
|
@click="back"
|
||||||
>
|
>
|
||||||
<v-icon>arrow_back</v-icon>
|
<v-icon>arrow_back</v-icon>
|
||||||
@@ -44,7 +43,8 @@
|
|||||||
</v-layout>
|
</v-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
|
import getThemeColor from '/imports/ui/utility/getThemeColor.js';
|
||||||
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
return isDarkColor(this.computedColor);
|
return isDarkColor(this.computedColor);
|
||||||
},
|
},
|
||||||
computedColor(){
|
computedColor(){
|
||||||
return this.color || this.$vuetify.theme.secondary;
|
return this.color || getThemeColor('secondary');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -41,16 +41,20 @@
|
|||||||
</v-layout>
|
</v-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import '/imports/ui/dialogStack/dialogStackWindowEvents.js';
|
import '/imports/ui/dialogStack/dialogStackWindowEvents.js';
|
||||||
import mockElement from '/imports/ui/dialogStack/mockElement.js';
|
import mockElement from '/imports/ui/dialogStack/mockElement.js';
|
||||||
import DialogComponentIndex from '/imports/ui/dialogStack/DialogComponentIndex.js';
|
import DialogComponentIndex from '/imports/ui/dialogStack/DialogComponentIndex.js';
|
||||||
|
import { VLayout } from 'vuetify/lib'
|
||||||
|
|
||||||
const OFFSET = 16;
|
const OFFSET = 16;
|
||||||
const MOCK_DURATION = 400; // Keep in sync with css transition of .dialog
|
const MOCK_DURATION = 400; // Keep in sync with css transition of .dialog
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: DialogComponentIndex,
|
components: {
|
||||||
|
VLayout,
|
||||||
|
...DialogComponentIndex,
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
dialogs(){
|
dialogs(){
|
||||||
return this.$store.state.dialogStack.dialogs;
|
return this.$store.state.dialogStack.dialogs;
|
||||||
@@ -162,7 +166,7 @@
|
|||||||
let source = this.getTopElementByDataId(elementId);
|
let source = this.getTopElementByDataId(elementId);
|
||||||
if (!source){
|
if (!source){
|
||||||
console.warn(`Can't find source for ${elementId}`);
|
console.warn(`Can't find source for ${elementId}`);
|
||||||
this.hiddenElement.style.opacity = null;
|
if (this.hiddenElement) this.hiddenElement.style.opacity = null;
|
||||||
done();
|
done();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -209,7 +213,7 @@
|
|||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: rgba(0, 0, 0, 0.4);
|
background-color: rgba(0, 0, 0, 0.4);
|
||||||
z-index: 4;
|
z-index: 6;
|
||||||
pointer-events: initial;
|
pointer-events: initial;
|
||||||
}
|
}
|
||||||
.backdrop-fade-enter-active, .backdrop-fade-leave-active {
|
.backdrop-fade-enter-active, .backdrop-fade-leave-active {
|
||||||
@@ -225,7 +229,7 @@
|
|||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
z-index: 4;
|
z-index: 6;
|
||||||
}
|
}
|
||||||
.dialog-sizer {
|
.dialog-sizer {
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -235,7 +239,7 @@
|
|||||||
height: 80%;
|
height: 80%;
|
||||||
height: calc(100% - 64px);
|
height: calc(100% - 64px);
|
||||||
max-height: 800px;
|
max-height: 800px;
|
||||||
z-index: 5;
|
z-index: 7;
|
||||||
flex: initial;
|
flex: initial;
|
||||||
}
|
}
|
||||||
/* sm */
|
/* sm */
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import store from "/imports/ui/vuexStore.js";
|
import store from '/imports/ui/vuexStore.js';
|
||||||
|
|
||||||
if (window){
|
if (window){
|
||||||
window.onpopstate = function(event){
|
window.onpopstate = function(event){
|
||||||
let state = event.state;
|
let state = event.state;
|
||||||
let numDialogs = store.state.dialogStack.dialogs.length;
|
let numDialogs = store.state.dialogStack.dialogs.length;
|
||||||
if (_.isFinite(state.openDialogs) && numDialogs > state.openDialogs){
|
if (_.isFinite(state.openDialogs) && numDialogs > state.openDialogs){
|
||||||
store.commit("popDialogStackMutation", store.state.dialogStack.currentResult);
|
store.commit('popDialogStackMutation', store.state.dialogStack.currentResult);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import functions from '/imports/parser/functions.js';
|
import functions from '/imports/parser/functions.js';
|
||||||
export default {
|
export default {
|
||||||
computed:{
|
computed:{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import {importIcons, importIconMetadata} from '/imports/ui/icons/importIcons.js';
|
import {importIcons, importIconMetadata} from '/imports/ui/icons/importIcons.js';
|
||||||
import IconPicker from '/imports/ui/components/global/IconPicker.vue';
|
import IconPicker from '/imports/ui/components/global/IconPicker.vue';
|
||||||
import UploadButton from 'vuetify-upload-button';
|
import UploadButton from 'vuetify-upload-button';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import SvgIcon from '/imports/ui/components/global/SvgIcon.vue'
|
import SvgIcon from '/imports/ui/components/global/SvgIcon.vue'
|
||||||
import SVG_ICONS from '/imports/constants/SVG_ICONS.js';
|
import SVG_ICONS from '/imports/constants/SVG_ICONS.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-app
|
<v-app>
|
||||||
:dark="darkMode"
|
|
||||||
:light="!darkMode"
|
|
||||||
>
|
|
||||||
<v-navigation-drawer
|
<v-navigation-drawer
|
||||||
v-model="drawer"
|
v-model="drawer"
|
||||||
app
|
app
|
||||||
@@ -12,7 +9,7 @@
|
|||||||
<router-view
|
<router-view
|
||||||
name="toolbar"
|
name="toolbar"
|
||||||
/>
|
/>
|
||||||
<v-toolbar
|
<v-app-bar
|
||||||
v-if="!$route.matched[0] || !$route.matched[0].components.toolbar"
|
v-if="!$route.matched[0] || !$route.matched[0].components.toolbar"
|
||||||
app
|
app
|
||||||
color="secondary"
|
color="secondary"
|
||||||
@@ -20,7 +17,7 @@
|
|||||||
tabs
|
tabs
|
||||||
dense
|
dense
|
||||||
>
|
>
|
||||||
<v-toolbar-side-icon @click="toggleDrawer" />
|
<v-app-bar-nav-icon @click="toggleDrawer" />
|
||||||
<v-toolbar-title>
|
<v-toolbar-title>
|
||||||
<v-fade-transition
|
<v-fade-transition
|
||||||
mode="out-in"
|
mode="out-in"
|
||||||
@@ -53,35 +50,34 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</v-fade-transition>
|
</v-fade-transition>
|
||||||
</v-toolbar>
|
</v-app-bar>
|
||||||
<v-content>
|
<v-main>
|
||||||
<v-fade-transition
|
<v-fade-transition
|
||||||
mode="out-in"
|
mode="out-in"
|
||||||
>
|
>
|
||||||
<router-view />
|
<router-view />
|
||||||
</v-fade-transition>
|
</v-fade-transition>
|
||||||
</v-content>
|
</v-main>
|
||||||
<router-view
|
<router-view
|
||||||
name="rightDrawer"
|
name="rightDrawer"
|
||||||
/>
|
/>
|
||||||
<dialog-stack />
|
<dialog-stack />
|
||||||
<snackbars />
|
<snackbar-queue />
|
||||||
</v-app>
|
</v-app>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import '/imports/api/users/Users.js';
|
import '/imports/api/users/Users.js';
|
||||||
import Sidebar from '/imports/ui/layouts/Sidebar.vue';
|
import Sidebar from '/imports/ui/layouts/Sidebar.vue';
|
||||||
import DialogStack from '/imports/ui/dialogStack/DialogStack.vue';
|
import DialogStack from '/imports/ui/dialogStack/DialogStack.vue';
|
||||||
import { theme, darkTheme } from '/imports/ui/theme.js';
|
|
||||||
import { mapMutations } from 'vuex';
|
import { mapMutations } from 'vuex';
|
||||||
import Snackbars from '/imports/ui/components/snackbars/Snackbars.vue';
|
import SnackbarQueue from '/imports/ui/components/snackbars/SnackbarQueue.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Sidebar,
|
Sidebar,
|
||||||
DialogStack,
|
DialogStack,
|
||||||
Snackbars,
|
SnackbarQueue,
|
||||||
},
|
},
|
||||||
data(){return {
|
data(){return {
|
||||||
name: 'Home',
|
name: 'Home',
|
||||||
@@ -107,10 +103,9 @@
|
|||||||
darkMode: {
|
darkMode: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler(newDarkModeValue){
|
handler(newDarkModeValue){
|
||||||
let newTheme = newDarkModeValue ? darkTheme : theme;
|
if (typeof newDarkModeValue === 'boolean'){
|
||||||
for (let key in newTheme){
|
this.$vuetify.theme.dark = newDarkModeValue;
|
||||||
this.$vuetify.theme[key] = newTheme[key];
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'$route' (to) {
|
'$route' (to) {
|
||||||
|
|||||||
@@ -2,62 +2,64 @@
|
|||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<v-layout
|
<v-layout
|
||||||
v-if="!signedIn"
|
v-if="!signedIn"
|
||||||
row
|
|
||||||
justify-center
|
justify-center
|
||||||
>
|
>
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
to="/sign-in"
|
to="/sign-in"
|
||||||
>
|
>
|
||||||
Sign in
|
Sign in
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-layout>
|
</v-layout>
|
||||||
<v-list>
|
<v-list>
|
||||||
<v-list-tile v-if="signedIn">
|
<v-list-item v-if="signedIn">
|
||||||
<v-list-tile-content>
|
<v-list-item-content>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
{{ userName }}
|
{{ userName }}
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile-content>
|
</v-list-item-content>
|
||||||
<v-list-tile-action>
|
<v-list-item-action>
|
||||||
<v-tooltip bottom>
|
<v-tooltip bottom>
|
||||||
<v-btn
|
<template
|
||||||
slot="activator"
|
#activator="{ on }"
|
||||||
flat
|
|
||||||
icon
|
|
||||||
to="/account"
|
|
||||||
>
|
>
|
||||||
<v-icon>settings</v-icon>
|
<v-btn
|
||||||
</v-btn>
|
icon
|
||||||
|
to="/account"
|
||||||
|
v-on="on"
|
||||||
|
>
|
||||||
|
<v-icon>settings</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
<span>Account Settings</span>
|
<span>Account Settings</span>
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
</v-list-tile-action>
|
</v-list-item-action>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
|
|
||||||
<v-list-tile
|
<v-list-item
|
||||||
v-for="(link, i) in links"
|
v-for="(link, i) in links"
|
||||||
:key="i"
|
:key="i"
|
||||||
:to="link.to"
|
:to="link.to"
|
||||||
:href="link.href"
|
:href="link.href"
|
||||||
>
|
>
|
||||||
<v-list-tile-action>
|
<v-list-item-action>
|
||||||
<v-icon>{{ link.icon }}</v-icon>
|
<v-icon>{{ link.icon }}</v-icon>
|
||||||
</v-list-tile-action>
|
</v-list-item-action>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
{{ link.title }}
|
{{ link.title }}
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
<v-divider />
|
<v-divider />
|
||||||
</v-list>
|
</v-list>
|
||||||
<v-list
|
<v-list
|
||||||
avatar
|
avatar
|
||||||
>
|
>
|
||||||
<v-list-tile
|
<v-list-item
|
||||||
v-for="character in CreaturesWithNoParty"
|
v-for="character in CreaturesWithNoParty"
|
||||||
:key="character._id"
|
:key="character._id"
|
||||||
:to="character.url"
|
:to="character.url"
|
||||||
>
|
>
|
||||||
<v-list-tile-avatar :color="character.color || 'grey'">
|
<v-list-item-avatar :color="character.color || 'grey'">
|
||||||
<img
|
<img
|
||||||
v-if="character.avatarPicture"
|
v-if="character.avatarPicture"
|
||||||
:src="character.avatarPicture"
|
:src="character.avatarPicture"
|
||||||
@@ -66,26 +68,26 @@
|
|||||||
<template v-else>
|
<template v-else>
|
||||||
{{ character.initial }}
|
{{ character.initial }}
|
||||||
</template>
|
</template>
|
||||||
</v-list-tile-avatar>
|
</v-list-item-avatar>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
{{ character.name }}
|
{{ character.name }}
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
<v-list-group
|
<v-list-group
|
||||||
v-for="party in parties"
|
v-for="party in parties"
|
||||||
:key="party._id"
|
:key="party._id"
|
||||||
>
|
>
|
||||||
<v-list-tile slot="activator">
|
<v-list-item slot="activator">
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
{{ party.name }}
|
{{ party.name }}
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
<v-list-tile
|
<v-list-item
|
||||||
v-for="character in characterDocs"
|
v-for="character in characterDocs"
|
||||||
:key="character._id"
|
:key="character._id"
|
||||||
:to="character.url"
|
:to="character.url"
|
||||||
>
|
>
|
||||||
<v-list-tile-avatar :color="character.color || 'grey'">
|
<v-list-item-avatar :color="character.color || 'grey'">
|
||||||
<img
|
<img
|
||||||
v-if="character.avatarPicture"
|
v-if="character.avatarPicture"
|
||||||
:src="character.avatarPicture"
|
:src="character.avatarPicture"
|
||||||
@@ -94,17 +96,17 @@
|
|||||||
<template v-else>
|
<template v-else>
|
||||||
{{ character.initial }}
|
{{ character.initial }}
|
||||||
</template>
|
</template>
|
||||||
</v-list-tile-avatar>
|
</v-list-item-avatar>
|
||||||
<v-list-tile-title>
|
<v-list-item-title>
|
||||||
{{ character.name }}
|
{{ character.name }}
|
||||||
</v-list-tile-title>
|
</v-list-item-title>
|
||||||
</v-list-tile>
|
</v-list-item>
|
||||||
</v-list-group>
|
</v-list-group>
|
||||||
</v-list>
|
</v-list>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import Creatures from '/imports/api/creature/Creatures.js';
|
import Creatures from '/imports/api/creature/Creatures.js';
|
||||||
import Parties from '/imports/api/creature/Parties.js';
|
import Parties from '/imports/api/creature/Parties.js';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
functional
|
functional
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="pa-4 layout column align-center"
|
class="pa-4 layout column align-center card-background"
|
||||||
style="height: calc(100vh - 96px); display: flex;"
|
style="height: calc(100vh - 96px); display: flex;"
|
||||||
>
|
>
|
||||||
<v-card
|
<v-card
|
||||||
@@ -13,3 +13,7 @@
|
|||||||
</v-card>
|
</v-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script lang="js">
|
||||||
|
export default {}
|
||||||
|
</script>
|
||||||
|
|||||||
100
app/imports/ui/library/InsertLibraryNodeButton.vue
Normal file
100
app/imports/ui/library/InsertLibraryNodeButton.vue
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
<template lang="html">
|
||||||
|
<v-btn
|
||||||
|
:fab="fab"
|
||||||
|
:outlined="!fab"
|
||||||
|
small
|
||||||
|
color="primary"
|
||||||
|
data-id="insert-library-node-button"
|
||||||
|
@click="insertLibraryNode"
|
||||||
|
>
|
||||||
|
<v-icon>add</v-icon>
|
||||||
|
<slot />
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="js">
|
||||||
|
import { getAncestry } from '/imports/api/parenting/parenting.js';
|
||||||
|
import { setDocToLastOrder } from '/imports/api/parenting/order.js';
|
||||||
|
import LibraryNodes, { insertNode } from '/imports/api/library/LibraryNodes.js';
|
||||||
|
import { getUserTier } from '/imports/api/users/patreon/tiers.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
libraryId: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
selectedNodeId: {
|
||||||
|
type: String,
|
||||||
|
default: undefined,
|
||||||
|
},
|
||||||
|
fab: Boolean,
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
insertLibraryNode(){
|
||||||
|
let libraryId = this.libraryId;
|
||||||
|
|
||||||
|
// Check tier has paid benefits
|
||||||
|
let tier = getUserTier(Meteor.userId());
|
||||||
|
if (!(tier && tier.paidBenefits)){
|
||||||
|
this.$store.commit('pushDialogStack', {
|
||||||
|
component: 'tier-too-low-dialog',
|
||||||
|
elementId: 'insert-library-node-button',
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get ancestry reference
|
||||||
|
let order, parentRef;
|
||||||
|
let selectedComponent = document.querySelector(
|
||||||
|
`[data-id="tree-node-${this.selectedNodeId}"]`
|
||||||
|
);
|
||||||
|
if (selectedComponent){
|
||||||
|
let vueInstance = selectedComponent.__vue__.$parent;
|
||||||
|
if (vueInstance.showExpanded){
|
||||||
|
parentRef = {
|
||||||
|
id: this.selectedNodeId,
|
||||||
|
collection: 'libraryNodes',
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
parentRef = vueInstance.node.parent;
|
||||||
|
order = vueInstance.node.order + 0.5;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
parentRef = {
|
||||||
|
id: libraryId,
|
||||||
|
collection: 'libraries',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
let {ancestors} = getAncestry({parentRef});
|
||||||
|
|
||||||
|
// Insert form dialog
|
||||||
|
let that = this;
|
||||||
|
this.$store.commit('pushDialogStack', {
|
||||||
|
component: 'library-node-creation-dialog',
|
||||||
|
elementId: 'insert-library-node-button',
|
||||||
|
callback(libraryNode){
|
||||||
|
if (!libraryNode) return;
|
||||||
|
|
||||||
|
// Set ancestry and order
|
||||||
|
libraryNode.parent = parentRef;
|
||||||
|
libraryNode.ancestors = ancestors;
|
||||||
|
if (order){
|
||||||
|
libraryNode.order = order;
|
||||||
|
} else {
|
||||||
|
setDocToLastOrder({collection: LibraryNodes, doc: libraryNode});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert doc
|
||||||
|
let libraryNodeId = insertNode.call(libraryNode);
|
||||||
|
that.$emit('selected', libraryNodeId);
|
||||||
|
return `tree-node-${libraryNodeId}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="css" scoped>
|
||||||
|
</style>
|
||||||
@@ -25,10 +25,18 @@
|
|||||||
class="mx-3"
|
class="mx-3"
|
||||||
style="flex-grow: 0; height: 32px;"
|
style="flex-grow: 0; height: 32px;"
|
||||||
/>
|
/>
|
||||||
|
<insert-library-node-button
|
||||||
|
v-if="libraryId"
|
||||||
|
style="bottom: -32px"
|
||||||
|
fab
|
||||||
|
:library-id="libraryId"
|
||||||
|
:selected-node-id="selected"
|
||||||
|
@selected="id => {if ($vuetify.breakpoint.mdAndUp) selected = id}"
|
||||||
|
/>
|
||||||
</v-toolbar>
|
</v-toolbar>
|
||||||
<div
|
<div
|
||||||
v-if="libraryId"
|
v-if="libraryId"
|
||||||
style="width: 100%; height: 100%; overflow: auto;"
|
style="width: 100%; height: 100%; overflow: auto; padding: 12px;"
|
||||||
>
|
>
|
||||||
<library-contents-container
|
<library-contents-container
|
||||||
:library-id="libraryId"
|
:library-id="libraryId"
|
||||||
@@ -43,7 +51,7 @@
|
|||||||
edit-mode
|
edit-mode
|
||||||
:organize-mode="organize"
|
:organize-mode="organize"
|
||||||
:selected-node-id="selected"
|
:selected-node-id="selected"
|
||||||
style="overflow-y: auto;"
|
style="overflow-y: auto; padding: 12px;"
|
||||||
@selected="clickNode"
|
@selected="clickNode"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -56,21 +64,24 @@
|
|||||||
:_id="selected"
|
:_id="selected"
|
||||||
embedded
|
embedded
|
||||||
@removed="selected = undefined"
|
@removed="selected = undefined"
|
||||||
|
@duplicated="id => {if ($vuetify.breakpoint.mdAndUp) selected = id}"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</tree-detail-layout>
|
</tree-detail-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import TreeDetailLayout from '/imports/ui/components/TreeDetailLayout.vue';
|
import TreeDetailLayout from '/imports/ui/components/TreeDetailLayout.vue';
|
||||||
import LibraryBrowser from '/imports/ui/library/LibraryBrowser.vue';
|
import LibraryBrowser from '/imports/ui/library/LibraryBrowser.vue';
|
||||||
import LibraryNodeDialog from '/imports/ui/library/LibraryNodeDialog.vue';
|
import LibraryNodeDialog from '/imports/ui/library/LibraryNodeDialog.vue';
|
||||||
import LibraryNodes from '/imports/api/library/LibraryNodes.js';
|
import LibraryNodes from '/imports/api/library/LibraryNodes.js';
|
||||||
import Libraries from '/imports/api/library/Libraries.js';
|
import Libraries from '/imports/api/library/Libraries.js';
|
||||||
import LibraryContentsContainer from '/imports/ui/library/LibraryContentsContainer.vue';
|
import LibraryContentsContainer from '/imports/ui/library/LibraryContentsContainer.vue';
|
||||||
|
import InsertLibraryNodeButton from '/imports/ui/library/InsertLibraryNodeButton.vue';
|
||||||
import { getPropertyName } from '/imports/constants/PROPERTIES.js';
|
import { getPropertyName } from '/imports/constants/PROPERTIES.js';
|
||||||
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
import isDarkColor from '/imports/ui/utility/isDarkColor.js';
|
||||||
import { assertEditPermission } from '/imports/api/sharing/sharingPermissions.js';
|
import { assertEditPermission } from '/imports/api/sharing/sharingPermissions.js';
|
||||||
|
import getThemeColor from '/imports/ui/utility/getThemeColor.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -78,6 +89,7 @@ export default {
|
|||||||
LibraryBrowser,
|
LibraryBrowser,
|
||||||
LibraryNodeDialog,
|
LibraryNodeDialog,
|
||||||
LibraryContentsContainer,
|
LibraryContentsContainer,
|
||||||
|
InsertLibraryNodeButton,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
selection: Boolean,
|
selection: Boolean,
|
||||||
@@ -94,7 +106,7 @@ export default {
|
|||||||
isToolbarDark(){
|
isToolbarDark(){
|
||||||
return isDarkColor(
|
return isDarkColor(
|
||||||
this.selectedNode && this.selectedNode.color ||
|
this.selectedNode && this.selectedNode.color ||
|
||||||
this.$vuetify.theme.secondary
|
getThemeColor('secondary')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,65 +1,61 @@
|
|||||||
<template lang="html">
|
<template lang="html">
|
||||||
<div
|
<div
|
||||||
|
class="library-browser"
|
||||||
style="
|
style="
|
||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<v-expansion-panel
|
<v-expansion-panels
|
||||||
style="box-shadow: none;"
|
v-model="expandedLibrary"
|
||||||
expand
|
accordian
|
||||||
|
flat
|
||||||
|
multiple
|
||||||
>
|
>
|
||||||
<v-expansion-panel-content
|
<v-expansion-panel
|
||||||
v-for="(library, index) in libraries"
|
v-for="library in libraries"
|
||||||
:key="library._id"
|
:key="library._id"
|
||||||
v-model="expandedLibrary[index]"
|
|
||||||
lazy
|
|
||||||
:data-id="library._id"
|
:data-id="library._id"
|
||||||
>
|
>
|
||||||
<template #header>
|
<v-expansion-panel-header>
|
||||||
<div class="title">
|
<div class="text-h6">
|
||||||
{{ library.name }}
|
{{ library.name }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</v-expansion-panel-header>
|
||||||
<v-card flat>
|
<v-expansion-panel-content>
|
||||||
|
<v-layout
|
||||||
|
justify-space-around
|
||||||
|
class="ma-2"
|
||||||
|
>
|
||||||
|
<insert-library-node-button
|
||||||
|
:library-id="library._id"
|
||||||
|
:selected-node-id="selectedNodeId"
|
||||||
|
@selected="e => $emit('selected', e)"
|
||||||
|
/>
|
||||||
|
<v-btn
|
||||||
|
color="primary"
|
||||||
|
outlined
|
||||||
|
small
|
||||||
|
@click="$router.push(`/library/${library._id}`)"
|
||||||
|
>
|
||||||
|
<v-icon>arrow_forward</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</v-layout>
|
||||||
<library-contents-container
|
<library-contents-container
|
||||||
:library-id="library._id"
|
:library-id="library._id"
|
||||||
:organize-mode="organizeMode && editPermission(library)"
|
:organize-mode="organizeMode && editPermission(library)"
|
||||||
:edit-mode="editMode"
|
:edit-mode="editMode"
|
||||||
:selected-node-id="selectedNodeId"
|
:selected-node-id="selectedNodeId"
|
||||||
:should-subscribe="expandedLibrary[index]"
|
should-subscribe
|
||||||
@selected="e => $emit('selected', e)"
|
@selected="e => $emit('selected', e)"
|
||||||
/>
|
/>
|
||||||
<v-card-actions>
|
</v-expansion-panel-content>
|
||||||
<v-btn
|
</v-expansion-panel>
|
||||||
flat
|
</v-expansion-panels>
|
||||||
small
|
|
||||||
style="background-color: inherit; margin-top: 0;"
|
|
||||||
:disabled="!editPermission(library)"
|
|
||||||
:data-id="`insert-node-${library._id}`"
|
|
||||||
@click="insertLibraryNode(library._id)"
|
|
||||||
>
|
|
||||||
<v-icon>add</v-icon>
|
|
||||||
New property
|
|
||||||
</v-btn>
|
|
||||||
<v-spacer />
|
|
||||||
<v-btn
|
|
||||||
flat
|
|
||||||
small
|
|
||||||
icon
|
|
||||||
:disabled="!editPermission(library)"
|
|
||||||
@click="$router.push(`/library/${library._id}`)"
|
|
||||||
>
|
|
||||||
<v-icon>arrow_forward</v-icon>
|
|
||||||
</v-btn>
|
|
||||||
</v-card-actions>
|
|
||||||
</v-card>
|
|
||||||
</v-expansion-panel-content>
|
|
||||||
</v-expansion-panel>
|
|
||||||
<v-btn
|
<v-btn
|
||||||
v-show="noLibrariesExpanded"
|
v-show="noLibrariesExpanded"
|
||||||
v-if="editMode"
|
v-if="editMode"
|
||||||
flat
|
text
|
||||||
color="primary"
|
color="primary"
|
||||||
style="background-color: inherit;"
|
style="background-color: inherit;"
|
||||||
data-id="insert-library-button"
|
data-id="insert-library-button"
|
||||||
@@ -71,18 +67,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import LibraryContentsContainer from '/imports/ui/library/LibraryContentsContainer.vue';
|
import LibraryContentsContainer from '/imports/ui/library/LibraryContentsContainer.vue';
|
||||||
import { setDocToLastOrder } from '/imports/api/parenting/order.js';
|
|
||||||
import LibraryNodes, { insertNode } from '/imports/api/library/LibraryNodes.js';
|
|
||||||
import Libraries, { insertLibrary } from '/imports/api/library/Libraries.js';
|
import Libraries, { insertLibrary } from '/imports/api/library/Libraries.js';
|
||||||
import { getUserTier } from '/imports/api/users/patreon/tiers.js';
|
import { getUserTier } from '/imports/api/users/patreon/tiers.js';
|
||||||
import { assertEditPermission } from '/imports/api/sharing/sharingPermissions.js';
|
import { assertEditPermission } from '/imports/api/sharing/sharingPermissions.js';
|
||||||
import { getAncestry } from '/imports/api/parenting/parenting.js';
|
import InsertLibraryNodeButton from '/imports/ui/library/InsertLibraryNodeButton.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
LibraryContentsContainer,
|
LibraryContentsContainer,
|
||||||
|
InsertLibraryNodeButton,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
organizeMode: Boolean,
|
organizeMode: Boolean,
|
||||||
@@ -98,12 +93,7 @@ export default {
|
|||||||
};},
|
};},
|
||||||
computed: {
|
computed: {
|
||||||
noLibrariesExpanded(){
|
noLibrariesExpanded(){
|
||||||
if (!this.expandedLibrary) return true;
|
return !this.expandedLibrary || this.expandedLibrary.length === 0;
|
||||||
let noneExpanded = true;
|
|
||||||
this.expandedLibrary.forEach(lib => {
|
|
||||||
if(lib) noneExpanded = false;
|
|
||||||
});
|
|
||||||
return noneExpanded;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
meteor: {
|
meteor: {
|
||||||
@@ -155,37 +145,12 @@ export default {
|
|||||||
data: {_id},
|
data: {_id},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
insertLibraryNode(libraryId){
|
|
||||||
if (this.paidBenefits){
|
|
||||||
let parentRef;
|
|
||||||
if (this.organizeMode && this.selectedNodeId){
|
|
||||||
parentRef = {collection: 'libraryNodes', id: this.selectedNodeId}
|
|
||||||
} else {
|
|
||||||
parentRef = {collection: 'libraries', id: libraryId};
|
|
||||||
}
|
|
||||||
let {ancestors} = getAncestry({parentRef});
|
|
||||||
this.$store.commit('pushDialogStack', {
|
|
||||||
component: 'library-node-creation-dialog',
|
|
||||||
elementId: `insert-node-${libraryId}`,
|
|
||||||
callback(libraryNode){
|
|
||||||
if (!libraryNode) return;
|
|
||||||
libraryNode.parent = parentRef;
|
|
||||||
libraryNode.ancestors = ancestors;
|
|
||||||
setDocToLastOrder({collection: LibraryNodes, doc: libraryNode});
|
|
||||||
let libraryNodeId = insertNode.call(libraryNode);
|
|
||||||
return `tree-node-${libraryNodeId}`;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.$store.commit('pushDialogStack', {
|
|
||||||
component: 'tier-too-low-dialog',
|
|
||||||
elementId: `insert-node-${libraryId}`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="css" scoped>
|
<style lang="css">
|
||||||
|
.library-browser .v-expansion-panel-content__wrap, .library-browser .v-expansion-panel-header {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
/>
|
/>
|
||||||
<v-layout
|
<v-layout
|
||||||
v-else
|
v-else
|
||||||
row
|
|
||||||
align-center
|
align-center
|
||||||
justify-center
|
justify-center
|
||||||
style="width: 100%;"
|
style="width: 100%;"
|
||||||
@@ -27,7 +26,7 @@
|
|||||||
</v-fade-transition>
|
</v-fade-transition>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import Libraries from '/imports/api/library/Libraries.js';
|
import Libraries from '/imports/api/library/Libraries.js';
|
||||||
import LibraryNodes from '/imports/api/library/LibraryNodes.js';
|
import LibraryNodes from '/imports/api/library/LibraryNodes.js';
|
||||||
import { nodesToTree } from '/imports/api/parenting/parenting.js'
|
import { nodesToTree } from '/imports/api/parenting/parenting.js'
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<template slot="actions">
|
<template slot="actions">
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
:disabled="!valid"
|
:disabled="!valid"
|
||||||
@click="$store.dispatch('popDialogStack', library)"
|
@click="$store.dispatch('popDialogStack', library)"
|
||||||
>
|
>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
</v-toolbar-title>
|
</v-toolbar-title>
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
|
||||||
icon
|
icon
|
||||||
data-id="share-library-button"
|
data-id="share-library-button"
|
||||||
@click="share"
|
@click="share"
|
||||||
@@ -14,7 +13,6 @@
|
|||||||
<v-icon>share</v-icon>
|
<v-icon>share</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
|
||||||
icon
|
icon
|
||||||
data-id="delete-library-button"
|
data-id="delete-library-button"
|
||||||
@click="remove"
|
@click="remove"
|
||||||
@@ -32,7 +30,7 @@
|
|||||||
<template slot="actions">
|
<template slot="actions">
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
data-id="delete-library-button"
|
data-id="delete-library-button"
|
||||||
@click="$store.dispatch('popDialogStack')"
|
@click="$store.dispatch('popDialogStack')"
|
||||||
>
|
>
|
||||||
@@ -42,7 +40,7 @@
|
|||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
import Libraries, { updateLibraryName, removeLibrary } from '/imports/api/library/Libraries.js';
|
import Libraries, { updateLibraryName, removeLibrary } from '/imports/api/library/Libraries.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
<template lang="html">
|
<template lang="html">
|
||||||
<selectable-property-dialog v-model="type">
|
<selectable-property-dialog v-model="type">
|
||||||
<library-node-insert-form
|
<library-node-insert-form
|
||||||
:type="type"
|
:type="type"
|
||||||
:property-name="getPropertyName(type)"
|
:property-name="getPropertyName(type)"
|
||||||
@back="type = undefined"
|
@back="type = undefined"
|
||||||
/>
|
/>
|
||||||
</selectable-property-dialog>
|
</selectable-property-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import SelectablePropertyDialog from '/imports/ui/properties/shared/SelectablePropertyDialog.vue';
|
import SelectablePropertyDialog from '/imports/ui/properties/shared/SelectablePropertyDialog.vue';
|
||||||
import LibraryNodeInsertForm from '/imports/ui/library/LibraryNodeInsertForm.vue';
|
import LibraryNodeInsertForm from '/imports/ui/library/LibraryNodeInsertForm.vue';
|
||||||
import { getPropertyName } from '/imports/constants/PROPERTIES.js';
|
import { getPropertyName } from '/imports/constants/PROPERTIES.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() { return {
|
|
||||||
type: undefined,
|
|
||||||
};},
|
|
||||||
components: {
|
components: {
|
||||||
SelectablePropertyDialog,
|
SelectablePropertyDialog,
|
||||||
LibraryNodeInsertForm,
|
LibraryNodeInsertForm,
|
||||||
},
|
},
|
||||||
|
data() { return {
|
||||||
|
type: undefined,
|
||||||
|
};},
|
||||||
methods: {
|
methods: {
|
||||||
getPropertyName,
|
getPropertyName,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<component
|
<component
|
||||||
:is="model.type + 'Form'"
|
:is="model.type + 'Form'"
|
||||||
v-if="editing"
|
v-if="editing"
|
||||||
|
:key="_id"
|
||||||
class="library-node-form"
|
class="library-node-form"
|
||||||
:model="model"
|
:model="model"
|
||||||
@change="change"
|
@change="change"
|
||||||
@@ -28,6 +29,7 @@
|
|||||||
<component
|
<component
|
||||||
:is="model.type + 'Viewer'"
|
:is="model.type + 'Viewer'"
|
||||||
v-else-if="!editing && $options.components[model.type + 'Viewer']"
|
v-else-if="!editing && $options.components[model.type + 'Viewer']"
|
||||||
|
:key="_id"
|
||||||
class="creature-property-viewer"
|
class="creature-property-viewer"
|
||||||
:model="model"
|
:model="model"
|
||||||
/>
|
/>
|
||||||
@@ -39,18 +41,18 @@
|
|||||||
<div
|
<div
|
||||||
v-if="!embedded"
|
v-if="!embedded"
|
||||||
slot="actions"
|
slot="actions"
|
||||||
class="layout row justify-end"
|
class="layout justify-end"
|
||||||
>
|
>
|
||||||
<template v-if="selection">
|
<template v-if="selection">
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
@click="$store.dispatch('popDialogStack', false)"
|
@click="$store.dispatch('popDialogStack', false)"
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
@click="$store.dispatch('popDialogStack', true)"
|
@click="$store.dispatch('popDialogStack', true)"
|
||||||
>
|
>
|
||||||
Select
|
Select
|
||||||
@@ -58,7 +60,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<v-btn
|
<v-btn
|
||||||
v-else
|
v-else
|
||||||
flat
|
text
|
||||||
@click="$store.dispatch('popDialogStack')"
|
@click="$store.dispatch('popDialogStack')"
|
||||||
>
|
>
|
||||||
Done
|
Done
|
||||||
@@ -67,14 +69,14 @@
|
|||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import LibraryNodes, {
|
import LibraryNodes, {
|
||||||
duplicateNode,
|
|
||||||
updateLibraryNode,
|
updateLibraryNode,
|
||||||
pushToLibraryNode,
|
pushToLibraryNode,
|
||||||
pullFromLibraryNode,
|
pullFromLibraryNode,
|
||||||
softRemoveLibraryNode,
|
softRemoveLibraryNode,
|
||||||
} from '/imports/api/library/LibraryNodes.js';
|
} from '/imports/api/library/LibraryNodes.js';
|
||||||
|
import duplicateLibraryNode from '/imports/api/library/methods/duplicateLibraryNode.js';
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
import PropertyToolbar from '/imports/ui/components/propertyToolbar.vue';
|
import PropertyToolbar from '/imports/ui/components/propertyToolbar.vue';
|
||||||
import { getPropertyName } from '/imports/constants/PROPERTIES.js';
|
import { getPropertyName } from '/imports/constants/PROPERTIES.js';
|
||||||
@@ -115,10 +117,23 @@
|
|||||||
},
|
},
|
||||||
data(){return {
|
data(){return {
|
||||||
editing: !!this.startInEditTab,
|
editing: !!this.startInEditTab,
|
||||||
|
// CurrentId lags behind Id by one tick so that events fired by destroying
|
||||||
|
// forms keyed to the old ID are applied before the new ID overwrites it
|
||||||
|
currentId: undefined,
|
||||||
}},
|
}},
|
||||||
|
watch: {
|
||||||
|
_id: {
|
||||||
|
immediate: true,
|
||||||
|
handler(newId){
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.currentId = newId;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
meteor: {
|
meteor: {
|
||||||
model(){
|
model(){
|
||||||
return LibraryNodes.findOne(this._id);
|
return LibraryNodes.findOne(this.currentId);
|
||||||
},
|
},
|
||||||
editPermission(){
|
editPermission(){
|
||||||
try {
|
try {
|
||||||
@@ -132,10 +147,12 @@
|
|||||||
methods: {
|
methods: {
|
||||||
getPropertyName,
|
getPropertyName,
|
||||||
duplicate(){
|
duplicate(){
|
||||||
duplicateNode.call({_id: this._id}, (error) => {
|
duplicateLibraryNode.call({
|
||||||
console.error(error);
|
_id: this.currentId
|
||||||
|
}, (error, duplicateId) => {
|
||||||
|
if (error) console.error(error);
|
||||||
if (this.embedded){
|
if (this.embedded){
|
||||||
this.$emit('duplicated');
|
this.$emit('duplicated', duplicateId);
|
||||||
} else {
|
} else {
|
||||||
this.$store.dispatch('popDialogStack');
|
this.$store.dispatch('popDialogStack');
|
||||||
}
|
}
|
||||||
@@ -165,7 +182,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
change({path, value, ack}){
|
change({path, value, ack}){
|
||||||
updateLibraryNode.call({_id: this._id, path, value}, (error) =>{
|
updateLibraryNode.call({_id: this.currentId, path, value}, (error) =>{
|
||||||
if (ack){
|
if (ack){
|
||||||
ack(error && error.reason || error);
|
ack(error && error.reason || error);
|
||||||
} else if (error){
|
} else if (error){
|
||||||
@@ -174,7 +191,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
push({path, value, ack}){
|
push({path, value, ack}){
|
||||||
pushToLibraryNode.call({_id: this._id, path, value}, (error) =>{
|
pushToLibraryNode.call({_id: this.currentId, path, value}, (error) =>{
|
||||||
if (ack){
|
if (ack){
|
||||||
ack(error && error.reason || error);
|
ack(error && error.reason || error);
|
||||||
} else if (error){
|
} else if (error){
|
||||||
@@ -185,7 +202,7 @@
|
|||||||
pull({path, ack}){
|
pull({path, ack}){
|
||||||
let itemId = get(this.model, path)._id;
|
let itemId = get(this.model, path)._id;
|
||||||
path.pop();
|
path.pop();
|
||||||
pullFromLibraryNode.call({_id: this._id, path, itemId}, (error) =>{
|
pullFromLibraryNode.call({_id: this.currentId, path, itemId}, (error) =>{
|
||||||
if (ack){
|
if (ack){
|
||||||
ack(error && error.reason || error);
|
ack(error && error.reason || error);
|
||||||
} else if (error){
|
} else if (error){
|
||||||
@@ -194,7 +211,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
remove(){
|
remove(){
|
||||||
softRemoveLibraryNode.call({_id: this._id});
|
softRemoveLibraryNode.call({_id: this.currentId});
|
||||||
if (this.embedded){
|
if (this.embedded){
|
||||||
this.$emit('removed');
|
this.$emit('removed');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -25,10 +25,10 @@
|
|||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
slot="actions"
|
slot="actions"
|
||||||
class="layout row justify-end"
|
class="layout justify-end"
|
||||||
>
|
>
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
:disabled="!valid"
|
:disabled="!valid"
|
||||||
@click="$store.dispatch('popDialogStack', model)"
|
@click="$store.dispatch('popDialogStack', model)"
|
||||||
>
|
>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
import propertyFormIndex from '/imports/ui/properties/forms/shared/propertyFormIndex.js';
|
import propertyFormIndex from '/imports/ui/properties/forms/shared/propertyFormIndex.js';
|
||||||
import schemaFormMixin from '/imports/ui/properties/forms/shared/schemaFormMixin.js';
|
import schemaFormMixin from '/imports/ui/properties/forms/shared/schemaFormMixin.js';
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<template slot="actions">
|
<template slot="actions">
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn
|
<v-btn
|
||||||
flat
|
text
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="$store.dispatch('popDialogStack', node._id)"
|
@click="$store.dispatch('popDialogStack', node._id)"
|
||||||
>
|
>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
</dialog-base>
|
</dialog-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="js">
|
||||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||||
import LibraryAndNode from '/imports/ui/library/LibraryAndNode.vue';
|
import LibraryAndNode from '/imports/ui/library/LibraryAndNode.vue';
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user