Skip to content

Commit

Permalink
Merge pull request #804 from stopfstedt/throneteki-export
Browse files Browse the repository at this point in the history
Throneteki export
  • Loading branch information
stopfstedt authored Dec 17, 2021
2 parents b59b9d0 + 764d756 commit 68eccc3
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 0 deletions.
25 changes: 25 additions & 0 deletions assets/js/app.ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,24 @@
return lines;
}

function build_plotsanddrawdeckonly(deck) {
var lines = [];
var sortOrder = { "name": 1 };
var allCards = [
deck.get_plot_deck(sortOrder),
deck.get_characters(sortOrder),
deck.get_attachments(sortOrder),
deck.get_locations(sortOrder),
deck.get_events(sortOrder)
];
allCards.forEach(function(cards) {
cards.forEach(function(card) {
lines.push(card.indeck + "x " + card.name + " (" + card.pack_code + ")");
});
});
return lines;
}

/**
* called when the DOM is loaded
* @memberOf ui
Expand Down Expand Up @@ -187,6 +205,13 @@
$('#exportModal').modal('show');
};

ui.export_plotsanddrawdeckonly = function export_plotsanddrawdeckonly(deck) {
$('#export-deck').html(build_plotsanddrawdeckonly(deck).join("\n"));
$('#exportModal').modal('show');
};



/**
* builds selector component for restricted lists
* @memberOf ui
Expand Down
3 changes: 3 additions & 0 deletions assets/js/ui.decklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
case 'btn-export-agotcards':
ui.export_agotcards(app.deck);
break;
case 'btn-export-plotsanddrawdeckonly':
ui.export_plotsanddrawdeckonly(app.deck);
break;
}

event.preventDefault();
Expand Down
3 changes: 3 additions & 0 deletions assets/js/ui.deckview.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
case 'btn-export-agotcards':
ui.export_agotcards(app.deck);
break;
case 'btn-export-plotsanddrawdeckonly':
ui.export_plotsanddrawdeckonly(app.deck);
break;
}

if (action_id !== 'btn-publish' &&
Expand Down
1 change: 1 addition & 0 deletions templates/Builder/deckview.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
href="#">{{ 'decks.form.export.plaintext' | trans }}</a></li>
<li><a id="btn-export-markdown" href="#">{{ 'decks.form.export.markdown' | trans }}</a>
<li><a id="btn-export-agotcards" href="#">{{ 'decks.form.export.agotcards' | trans }}</a>
<li><a id="btn-export-plotsanddrawdeckonly" href="#">{{ 'decks.form.export.plotsanddrawdeckonly' | trans }}</a>
</li>
<li class="dropdown-header"><span
class="fas fa-file-download"></span> {{ 'forms.download' | trans }}</li>
Expand Down
1 change: 1 addition & 0 deletions templates/Decklist/toolbar.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<li><a id="btn-export-plaintext" href="#">{{ 'decks.form.export.plaintext' | trans }}</a></li>
<li><a id="btn-export-markdown" href="#">{{ 'decks.form.export.markdown' | trans }}</a></li>
<li><a id="btn-export-agotcards" href="#">{{ 'decks.form.export.agotcards' | trans }}</a></li>
<li><a id="btn-export-plotsanddrawdeckonly" href="#">{{ 'decks.form.export.plotsanddrawdeckonly' | trans }}</a></li>
<li class="dropdown-header"><span class="fas fa-file-download"></span> {{ 'forms.download' | trans }}</li>
<li><a href="#" id="btn-download-text">{{ 'decks.form.download.text' | trans }}</a></li>
<li><a href="#" id="btn-download-text-cycle">{{ 'decks.form.download.text_cycle' | trans }}</a></li>
Expand Down
1 change: 1 addition & 0 deletions translations/messages.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ decks:
agotcards: AGoT.cards
markdown: Markdown
plaintext: einfacher Text
plotsanddrawdeckonly: Nur Strategie- und Ziehkarten
sort:
by_cardnumber: nach Kartennummer
by_cost: nach Kosten/Goldwert
Expand Down
1 change: 1 addition & 0 deletions translations/messages.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ decks:
agotcards: AGoT.cards
markdown: Markdown
plaintext: Plain text
plotsanddrawdeckonly: Plots and draw deck only
sort:
by_cardnumber: by Card Number
by_cost: by Cost/Gold
Expand Down
1 change: 1 addition & 0 deletions translations/messages.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ decks:
agotcards: AGoT.cards
markdown: Markdown
plaintext: Texto sin formato
plotsanddrawdeckonly: Tramas y mazo de robo solamente
sort:
by_cardnumber: por número de carta
by_cost: por coste/oro
Expand Down

0 comments on commit 68eccc3

Please sign in to comment.