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 @@
+