Skip to content

Commit

Permalink
displays card model on click
Browse files Browse the repository at this point in the history
Before, when a card name link was clicked, a list of all the card data would be displayed at the top. However, now that there is a card model directive, upon clicking the card name link, a card model directive is loaded which displays all the information about the card in card form.
  • Loading branch information
sirpython committed Aug 23, 2015
1 parent 412466d commit 50d8de5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
18 changes: 5 additions & 13 deletions src/deck_builder/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function DeckbuilderController(CardshifterServerAPI, $scope, $rootScope, $locati
$scope.maxCards = 0;
$scope.minCards = 0;
$scope.currentDeck = {};
$scope.cardInfo = {};
$scope.cardInfo = null;
$scope.currentDeckName = "untitled";
$scope.savedDecks = [];
$scope.doneLoading = false;
Expand Down Expand Up @@ -102,22 +102,14 @@ function DeckbuilderController(CardshifterServerAPI, $scope, $rootScope, $locati
* available cards table has been clicked.
*
* Once this function is called, it loads $scope.cardInfo
* with the most important properties of the card. Then,
* the HTML will take care of not showing the card information
* that is "undefined", as not all cards have the same properties.
* with the card object associated with the link that was
* clicked and will simply stick it into a card directive
* which is displayed at the top of the screen.
*
* TODO: Dynamically load $scope.cardInfo with card properties. #60
*/
$scope.showDetails = function(card) {
var props = card.properties;
$scope.cardInfo = {
name: props.name,
flavor: props.flavor,
type: props.creatureType,
health: props.HEALTH,
attack: props.ATTACK,
sickness: props.SICKNESS
};
$scope.cardInfo = card;
};

/**
Expand Down
4 changes: 1 addition & 3 deletions src/deck_builder/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ <h2>{{getTotalSelected()}} / {{maxCards}}</h2>
TODO: Add more fields of card information to be shown.
-->
<ul>
<li data-ng-repeat="(name, value) in cardInfo" data-ng-show="value">
<b>{{name}}</b>: {{value}}
</li>
<card card-info="cardInfo" ng-show="cardInfo"></card>
</ul>

<!-- LIST OF ALL CARDS - Displays one full row below for every card -->
Expand Down

1 comment on commit 50d8de5

@Zomis
Copy link
Member

@Zomis Zomis commented on 50d8de5 Aug 23, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this deals with #60 as well, good good

Please sign in to comment.