Permalink
Browse files

merging master

  • Loading branch information...
aserafin committed Jan 3, 2014
2 parents 2307e0a + 896d09b commit ecb002183480ac0ff53eac9897761e3ee97693b2
View
@@ -44,6 +44,7 @@ group :production do
end
gem 'angularjs-rails'
+gem 'angularjs-rails-resource'
gem 'select2-rails'
gem 'inherited_resources'
gem 'active_model_serializers'
View
@@ -29,6 +29,7 @@ GEM
tzinfo (~> 0.3.37)
addressable (2.3.5)
angularjs-rails (1.2.6)
+ angularjs-rails-resource (0.2.5)
api_matchers (0.4.0)
activesupport (>= 3.2.5)
nokogiri (>= 1.5.2)
@@ -264,6 +265,7 @@ PLATFORMS
DEPENDENCIES
active_model_serializers
angularjs-rails
+ angularjs-rails-resource
api_matchers
bootstrap-sass (~> 3.0.3.0)
coffee-rails (~> 4.0.0)
@@ -1 +1,25 @@
-var myAppModule = angular.module('MyApp', ['ui.select2']);
+var myAppModule = angular.module('MyApp', ['ui.select2','rails'])
+
+ .factory('Book', ['railsResourceFactory', function (railsResourceFactory) {
+ return railsResourceFactory({
+ url: '/books',
+ name: 'book'
+ });
+ }])
+
+ .factory('Player', ['railsResourceFactory', function (railsResourceFactory) {
+ return railsResourceFactory({
+ url: '/players',
+ name: 'book'
+ });
+ }])
+
+ .controller('PlayersCtrl', ['Player','$scope', function(Player,$scope) {
+ $scope.select2options = {
+ 'multiple': true
+ };
+ Player.query().then(function(data){
+ $scope.players = data;
+ });
+
+ }]);
@@ -13,6 +13,7 @@
//= require jquery
//= require jquery_ujs
//= require angular
+//= require angularjs/rails/resource
//= require select2
//= require lib/angular-ui/select2
//= require app
@@ -2,6 +2,7 @@ class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
helper_method :current_player
+ respond_to :html, :json
private
def authenticate_player!
@@ -0,0 +1,2 @@
+class MatchesController < ApplicationController
+end
@@ -0,0 +1,2 @@
+class PlayersController < InheritedResources::Base
+end
@@ -0,0 +1,2 @@
+module MatchesHelper
+end
@@ -0,0 +1,2 @@
+module PlayersHelper
+end
@@ -0,0 +1,4 @@
+class PlayerSerializer < ActiveModel::Serializer
+ self.root = false
+ attributes :id, :email, :avatar_url, :name
+end
@@ -0,0 +1,9 @@
+section(ng-controller="PlayersCtrl")
+
+ select(name='home' ui-select2="select2options" ng-model="home" multiple)
+ option(ng-repeat="player in players" value="{{player.id}}")
+ | {{player.name}}
+
+ select(name='away' ui-select2="select2options" ng-model="away" multiple)
+ option(ng-repeat="player in players" value="{{player.id}}")
+ | {{player.name}}
@@ -1,4 +1,3 @@
-
header.navbar.navbar-inverse.navbar-fixed-top
.container
h1.logo
@@ -19,12 +18,6 @@ header.navbar.navbar-inverse.navbar-fixed-top
- else
= link_to "Login", "/auth/google", class: 'btn btn-primary'
-- unless current_player.present?
- select(name='home' ui-select2="" ng-model="home" multi)
- = options_for_select( [1,2,3,4,5] )
-
- select(name='away' ui-select2="" ng-model="away" multi)
- = options_for_select( [1,2,3,4,5] )
section.table-responsive.standings
@@ -40,7 +33,7 @@ section.table-responsive.standings
tr
td.rank= idx + 1
td.avatar
- = image_tag player.avatar_url, size: '32'
+ = image_tag rating.player.avatar_url, size: '32'
td.playername
= rating.player.name
br
@@ -27,6 +27,8 @@
# number of complex assets.
config.assets.debug = true
+ config.action_mailer.delivery_method = :letter_opener
+
config.paperclip_defaults = {
storage: :fog,
fog_credentials: {
@@ -1,2 +1,2 @@
+ActiveModel::ArraySerializer.root = false
ActiveModel::Serializer.root = false
-ActiveModel::ArraySerializer.root = false
View
@@ -5,4 +5,7 @@
match "/sign_in" => "welcome#sign_in", via: [:get]
match "/sign_out" => "sessions#destroy", :as => :sign_out, via: [:get, :post]
match "/auth/google/callback" => "sessions#create", via: [:get, :post]
+
+ resources :matches, except: [:delete]
+ resources :players, only: [:index, :show]
end
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe MatchesController do
+
+end
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe PlayersController do
+
+end
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+# Specs in this file have access to a helper object that includes
+# the MatchesHelper. For example:
+#
+# describe MatchesHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+describe MatchesHelper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+# Specs in this file have access to a helper object that includes
+# the PlayersHelper. For example:
+#
+# describe PlayersHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+describe PlayersHelper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end

0 comments on commit ecb0021

Please sign in to comment.