From 35a40b3624106c6674def553b21f944f4229d424 Mon Sep 17 00:00:00 2001 From: devfake Date: Thu, 25 Jun 2015 19:07:52 +0200 Subject: [PATCH] choose leader view --- .../deck-builder/components/deck-builder.js | 21 ++++++++++----- .../deck-builder/components/show-leaders.js | 25 +++++++++++++++++ .../deck-builder/views/deck-builder.html | 6 +++-- .../deck-builder/views/show-leaders.html | 12 +++++++++ site/client/assets/sass/_modal.scss | 11 ++++++++ site/client/assets/sass/_shame_cards.scss | 27 ++++++++++++++++--- 6 files changed, 90 insertions(+), 12 deletions(-) create mode 100644 site/client/app/modules/deck-builder/components/show-leaders.js create mode 100644 site/client/app/modules/deck-builder/views/show-leaders.html diff --git a/site/client/app/modules/deck-builder/components/deck-builder.js b/site/client/app/modules/deck-builder/components/deck-builder.js index 61cd6e4..2f52725 100644 --- a/site/client/app/modules/deck-builder/components/deck-builder.js +++ b/site/client/app/modules/deck-builder/components/deck-builder.js @@ -10,13 +10,19 @@ module.exports = { cards: [], deck: [], - leaders: [], - leader: null, + allLeaders: [], + myLeaders: [], - factionFilter: 'northern_realm' + factionFilter: 'northern_realm', + + modalLeader: false } }, + components: { + showleaders: require('./show-leaders') + }, + ready: function() { this.initCards(); this.initDeck(); @@ -51,7 +57,7 @@ module.exports = { this.cards = $.map(cards, (n) => { if(n.type != 3) return n; - this.leaders.push(n); + this.allLeaders.push(n); }); }, @@ -64,9 +70,12 @@ module.exports = { } }, - // test - removeCard: function(el) { + showLeaders: function(currentLeader) { + this.myLeaders = $.map(this.allLeaders, (item) => { + if(item.faction == this.factionFilter) return item; + }); + this.modalLeader = true; } } }; \ No newline at end of file diff --git a/site/client/app/modules/deck-builder/components/show-leaders.js b/site/client/app/modules/deck-builder/components/show-leaders.js new file mode 100644 index 0000000..001c14b --- /dev/null +++ b/site/client/app/modules/deck-builder/components/show-leaders.js @@ -0,0 +1,25 @@ +module.exports = { + + template: require('./../views/show-leaders.html'), + + inherit: true, + + methods: { + closeLeaders(e) { + if(e == 'close' || e.target.className == 'modal active' ) { + this.modalLeader = false; + } + }, + + chooseLeader(card) { + // todo: make own leader variable + for(var item in this.deck) { + if(this.deck[item].type == 3) { + this.deck.$set(item, card); + } + } + + this.closeLeaders('close'); + } + } +}; \ No newline at end of file diff --git a/site/client/app/modules/deck-builder/views/deck-builder.html b/site/client/app/modules/deck-builder/views/deck-builder.html index 6d130b6..6faeb00 100644 --- a/site/client/app/modules/deck-builder/views/deck-builder.html +++ b/site/client/app/modules/deck-builder/views/deck-builder.html @@ -1,3 +1,5 @@ + +
Northern Realm @@ -35,8 +37,8 @@
LEADER -
-
1x
+
+
diff --git a/site/client/app/modules/deck-builder/views/show-leaders.html b/site/client/app/modules/deck-builder/views/show-leaders.html new file mode 100644 index 0000000..44e1622 --- /dev/null +++ b/site/client/app/modules/deck-builder/views/show-leaders.html @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/site/client/assets/sass/_modal.scss b/site/client/assets/sass/_modal.scss index 6beff83..7c2dfd7 100644 --- a/site/client/assets/sass/_modal.scss +++ b/site/client/assets/sass/_modal.scss @@ -9,6 +9,17 @@ text-align: center; } +.wrap-modal-leaders { + margin: 14vh auto; + max-width: 750px; + + @include transition(); + + .active & { + margin: 15vh auto; + } +} + .modal { position: fixed; width: 100%; diff --git a/site/client/assets/sass/_shame_cards.scss b/site/client/assets/sass/_shame_cards.scss index 6bd0b15..849f330 100644 --- a/site/client/assets/sass/_shame_cards.scss +++ b/site/client/assets/sass/_shame_cards.scss @@ -10,6 +10,14 @@ height: 132px; } +.card-wrap-big .card-img { + background-size: 150px 284px !important; + width: 150px !important; + height: 284px !important; + top: 4px; + left: 4px; +} + .card, .card-small-small { float: left; @@ -136,10 +144,10 @@ background-size: 800% 800%; position: absolute; z-index: 20; - top: 10px; - left: 10px; - width: calc(100% - 10px); - height: calc(100% - 5px); + top: 6px; + left: 6px; + width: calc(100% - 4px); + height: calc(100% - 4px); border-radius: 12px; opacity: 0; cursor: pointer; @@ -180,6 +188,17 @@ } +.card-wrap-big { + width: 158px; + height: 292px; + transition: all 0.2s ease-in-out 0s; + margin: 0 0 0 20px; +} + + .card-wrap-big:hover { + //transform: scale(1.1,1.1) !important; + } + .card-wrap-small { float: left; width: 74px;