Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f2fc00c
added ability to determine if a deck is standard or not
SirZach Nov 9, 2014
12f4cac
add some styling for standard decks
SirZach Nov 9, 2014
694e4e5
woops, that isStandard check was a little too lenient
SirZach Nov 9, 2014
e1dfc9b
adding in search capabilities - untested
SirZach Nov 9, 2014
a9eb657
use the mtgjson site for production api set calls
SirZach Nov 9, 2014
0160dbc
upgrading to ember 1.8.1. no more metamorph tags!
SirZach Nov 10, 2014
4d34f51
adding em.c and artifact filters
Nov 14, 2014
243b2f3
remove console logging
Nov 14, 2014
ee28981
adding in travis + working on filtering via set
Nov 18, 2014
3a0811d
travis fix
Nov 18, 2014
a250aa9
adding bower powers
Nov 18, 2014
66bb1fa
more travis ci fix
Nov 18, 2014
0c679c2
skipping a test for now to get it running
SirZach Nov 18, 2014
2fd0ee5
Merge branch 'master' of github.com:thomasjmwb/bbbbbbbbbbbbbbb
SirZach Nov 18, 2014
4c23213
commenting out test to get travis happy:
SirZach Nov 18, 2014
7e3f98d
yaml fix, again
Nov 18, 2014
04e2196
Merge branch 'master' of github.com:thomasjmwb/bbbbbbbbbbbbbbb
Nov 18, 2014
da9c771
adding a github link for people to get to the repo and add issues
SirZach Nov 23, 2014
aa3d40a
adding the famous travis ci building image to the readme
SirZach Nov 23, 2014
8bcdc10
adding stuff for bootstrap modal via bower, also testing out legalities
thomasjmwb Nov 26, 2014
4ff370c
removing shit that dont work
thomasjmwb Nov 26, 2014
807cfa9
updating the set list for standard sets
SirZach Nov 26, 2014
e1d85ab
Merge branch 'master' of github.com:thomasjmwb/bbbbbbbbbbbbbbb
SirZach Nov 26, 2014
d7b2997
added better deck classification to make use of the card api instead …
SirZach Dec 1, 2014
f14f741
upgraded and removed ember-data. also added ember-inflector since tha…
SirZach Dec 16, 2014
c368fb9
ok, we also need ember-inflector from bower
SirZach Dec 16, 2014
3837709
upgrading to ember-cli 0.1.5
SirZach Jan 3, 2015
e5c57bc
modals are kind of restored and new super cute loading gif
SirZach Feb 1, 2015
4586228
can successfully close modals
SirZach Feb 1, 2015
40d1852
getting rid of stupid security content policy warnings :)
SirZach Feb 1, 2015
c9167b0
the export deck modal working again
SirZach Feb 3, 2015
50d9eb2
fully restored all the modal functionality
SirZach Feb 3, 2015
9c66b50
jshint error
SirZach Feb 3, 2015
3069b28
upgraded to ember-cli 0.1.12
SirZach Feb 7, 2015
384a7b2
upgraded to ember 1.9.1
SirZach Feb 7, 2015
cdc160f
upgraded to ember 1.10
SirZach Feb 8, 2015
f2ab201
use a local image for development
SirZach Feb 8, 2015
43a95a9
relocating the cards template to a partial to be used anywhere
SirZach Feb 8, 2015
aeccce4
removing users from the url and added a cards route
SirZach Feb 8, 2015
484faec
componentizing the add card to deck and the card
SirZach Feb 8, 2015
d584c23
show a message if they search by a card name that doesnt exist in the…
SirZach Feb 8, 2015
4865da3
fixed failing unit test
SirZach Feb 8, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ indent_size = 2
indent_style = space
indent_size = 2

[*.md]
[*.{diff,md}]
trim_trailing_whitespace = false
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
/libpeerconnection.log
npm-debug.log
testem.log
.idea/
.idea
7 changes: 3 additions & 4 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
"predef": [
"document",
"window",
"-Promise",
"Bootstrap"
"-Promise"
],
"browser" : true,
"boss" : true,
"browser": true,
"boss": true,
"curly": true,
"debug": false,
"devel": true,
Expand Down
16 changes: 15 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
language: node_js

sudo: false
Expand All @@ -7,10 +6,25 @@ cache:
directories:
- node_modules

before_install:
- "npm config set spin false"
- "npm install -g npm@^2"

install:
- npm install -g bower
- npm install
- bower install

script:
- npm test

node_js:
- "0.10"

deploy:
provider: heroku
api_key:
secure: Bt7t26dMCqf7yXZPWZd/e6hz6N9Fxg83A34lC7sNTaLvIKnM+g54MHjOlIpnZ9LmN3S7/icg/X+twk2ebWPlc7THUWAaBkU5YjXpyNf9UhG30UG7Ihjgcbhn/Qh/Px8NQX5OFIUHTVoLdJGOj68/Czv+jHwpmFQHDoB1xCY2paE=
app: webatrice
on:
repo: thomasjmwb/bbbbbbbbbbbbbbb
8 changes: 0 additions & 8 deletions Brocfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
var EmberApp = require('ember-cli/lib/broccoli/ember-app');

var app = new EmberApp({
'ember-cli-bootstrap': {
'importBootstrapCSS': false
},
vendorFiles: {
'handlebars.js': {
production: 'bower_components/handlebars/handlebars.js'
}
}
});

// Use `app.import` to add additional libraries to the generated
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@

This README outlines the details of collaborating on this Ember application.

A short introduction of this app could easily go here.
Webatrice is a web application aspiring to be part of the desktop application called Cockatrice. To read more about Cockatrice, go to https://github.com/Cockatrice/Cockatrice.

## Prerequisites

You will need the following things properly installed on your computer.

* [Git](http://git-scm.com/)
* [Node.js](http://nodejs.org/) (with NPM)
* [Bower](http://bower.io/)
* [Ember CLI](http://www.ember-cli.com/)
* [PhantomJS](http://phantomjs.org/)
* [Node.js](http://nodejs.org/) (with NPM) and [Bower](http://bower.io/)

## Installation
Expand All @@ -21,7 +25,7 @@ You will need the following things properly installed on your computer.
## Running / Development

* `ember server`
* Visit your app at http://localhost:4200.
* Visit your app at [http://localhost:4200](http://localhost:4200).

### Code Generators

Expand All @@ -34,6 +38,8 @@ Make use of the many generators for code, try `ember help generate` for more det

### Building

[![Build Status](https://travis-ci.org/thomasjmwb/bbbbbbbbbbbbbbb.svg?branch=master)](https://travis-ci.org/thomasjmwb/bbbbbbbbbbbbbbb)

* `ember build` (development)
* `ember build --environment production` (production)

Expand All @@ -43,8 +49,8 @@ Specify what it takes to deploy your app.

## Further Reading / Useful Links

* ember: http://emberjs.com/
* ember-cli: http://www.ember-cli.com/
* [ember.js](http://emberjs.com/)
* [ember-cli](http://www.ember-cli.com/)
* Development Browser Extensions
* [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
* [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)
Expand Down
98 changes: 98 additions & 0 deletions app/components/x-card-deck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import Ember from 'ember';

var basicLands = ['Plains', 'Island', 'Swamp', 'Mountain', 'Forest', 'Snow-Covered Plains',
'Snow-Covered Island', 'Snow-Covered Swamp', 'Snow-Covered Mountain', 'Snow-Covered Forest'];

export default Ember.Component.extend({
classNames: ['row'],

/** @property {Boolean} - can this card be added to the main deck being built */
canAddToDeck: function () {
var cardsInDeck = this.get('deck.cards'),
cardsInSideboard = this.get('deck.sideboard'),
currentCardName = this.get('card.name');

if (basicLands.contains(currentCardName)) {
return true;
}

return cardsInDeck.filterBy('name', currentCardName).length +
cardsInSideboard.filterBy('name', currentCardName).length < 4;
}.property('deck.cards.@each', 'deck.sideboard.@each', 'card'),

/** @property {Boolean} - is this card not allowed to go in the main deck */
cannotAddToDeck: Ember.computed.not('canAddToDeck'),

/** @property {Boolean} - can this card be removed from the main deck */
canRemoveFromMainDeck: function () {
var currentCardName = this.get('card.name');

return this.get('deck.cards').filterBy('name', currentCardName).length;
}.property('deck.cards.@each', 'deck'),

/** @property {Boolean} - is this card allowed to be removed from the main deck */
cannotRemoveFromMainDeck: Ember.computed.not('canRemoveFromMainDeck'),

/** @property {Boolean} - can this card be removed from the side deck */
canRemoveFromSideDeck: function () {
var currentCardName = this.get('card.name');

return this.get('deck.sideboard').filterBy('name', currentCardName).length;
}.property('deck.sideboard.@each'),

/** @property {Boolean} - can this card be removed from the side deck */
cannotRemoveFromSideDeck: Ember.computed.not('canRemoveFromSideDeck'),

/** @propert {Boolean} - can this card be removed from any deck */
cannotRemoveFromAnyDeck: Ember.computed.and('cannotRemoveFromMainDeck', 'cannotRemoveFromSideDeck'),

actions: {
addToMain: function (card) {
this.get('deck.cards').pushObject(card);
},

addToSide: function (card) {
this.get('deck.sideboard').pushObject(card);
},

removeAllFromMain: function (card) {
this.get('deck.cards').removeObject(card);
},

removeOneFromMain: function (card) {
var cards = this.get('deck.cards'),
cardName = card.get('name'),
i = 0,
index;

cards.forEach(function (c) {
if (c.get('name') === cardName) {
index = i;
}
i++;
});

cards.removeAt(index);
},

removeAllFromSide: function (card) {
this.get('deck.sideboard').removeObject(card);
},

removeOneFromSide: function (card) {
var cards = this.get('deck.sideboard'),
cardName = card.get('name'),
i = 0,
index;

cards.forEach(function (c) {
if (c.get('name') === cardName) {
index = i;
}
i++;
});

cards.removeAt(index);
}
}
});
9 changes: 9 additions & 0 deletions app/components/x-modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Ember from 'ember';

export default Ember.Component.extend({
actions: {
close: function () {
return this.sendAction();
}
}
});
47 changes: 0 additions & 47 deletions app/controllers/card.js

This file was deleted.

34 changes: 29 additions & 5 deletions app/controllers/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export default Ember.ArrayController.extend(filterableMixin, {
{
label: 'Card Types',
propertyName: 'mainType',
values: ['Creature', 'Enchantment', 'Land', 'Instant', 'Sorcery'],
possibleValues: ['Creature', 'Enchantment', 'Land', 'Instant', 'Sorcery'],
valuesDisplay: ['Creature', 'Enchantment', 'Land', 'Instant', 'Sorcery'],
values: ['Creature', 'Enchantment', 'Land', 'Instant', 'Sorcery', 'Artifact'],
possibleValues: ['Creature', 'Enchantment', 'Land', 'Instant', 'Sorcery', 'Artifact'],
valuesDisplay: ['Creature', 'Enchantment', 'Land', 'Instant', 'Sorcery', 'Artifact'],
and: false
},
{
Expand All @@ -19,6 +19,14 @@ export default Ember.ArrayController.extend(filterableMixin, {
possibleValues: [ 'Black', 'Blue', 'Green', 'Red', 'White'],
valuesDisplay: [ 'Black', 'Blue', 'Green', 'Red', 'White'],
and: false
},
{
label: 'Legalities',
propertyName: 'legal',
values: [ 'isStandard', 'isModern', 'isLegacy', 'isVintage'],
possibleValues: [ 'isStandard', 'isModern', 'isLegacy', 'isVintage'],
valuesDisplay: [ 'Standard', 'Modern', 'Legacy', 'Vintage'],
and: false
}
// {
// label: 'Format',
Expand All @@ -40,6 +48,22 @@ export default Ember.ArrayController.extend(filterableMixin, {
// }
],
displayCards: function () {
return this.get('arrangedContent').slice(0, 100);
}.property('arrangedContent')
return this.get('searchedContent').slice(0, 100);
}.property('searchedContent'),

searchedContent: function () {
var searchTerm = this.get('searchTerm'),
arrangedContent = this.get('arrangedContent');

if (!searchTerm) {
return arrangedContent;
}

return arrangedContent.filter(function (c) {
return c.name.toLowerCase().indexOf(searchTerm.toLowerCase()) > -1;
});
}.property('arrangedContent', 'searchTerm'),

/** @property {String} the current search term */
searchTerm: ''
});
6 changes: 5 additions & 1 deletion app/controllers/deck/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export default Ember.ObjectController.extend({

doNotShowTypes: [],

displayCards: Ember.computed.alias('controllers.cards.displayCards'),

searchTerm: Ember.computed.alias('controllers.cards.searchTerm'),

canShowMainDeck: function () {
return !this.get('doNotShowTypes').contains('mainDeck');
}.property('doNotShowTypes.@each'),
Expand Down Expand Up @@ -34,4 +38,4 @@ export default Ember.ObjectController.extend({
}
}
}
});
});
9 changes: 9 additions & 0 deletions app/controllers/deck/export-modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Ember from 'ember';

export default Ember.ObjectController.extend({
actions: {
close: function() {
return this.send('closeModal');
}
}
});
7 changes: 2 additions & 5 deletions app/controllers/decks.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import Ember from 'ember';

export default Ember.ArrayController.extend({
importModalButtons: [
Ember.Object.create({title: 'Import', clicked: 'importDeck'}),
Ember.Object.create({title: 'Cancel', dismiss: 'modal'})
]
});

});
20 changes: 20 additions & 0 deletions app/controllers/decks/import-deck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Ember from 'ember';
import Deck from 'webatrice/models/deck';

export default Ember.ObjectController.extend({
needs: ['cards'],

actions: {
close: function() {
return this.send('closeModal');
},

importDeck: function () {
var cards = this.get('controllers.cards.model'),
deck = Deck.createDeck(this.get('importContents'), cards);

this.send('closeModal');
this.transitionToRoute('deck.build', deck);
}
}
});
Loading