Permalink
Browse files

Merge branch 'master' of github.com:elpassion/elranks

  • Loading branch information...
2 parents 5d9aeac + db41446 commit 5a9807cd9b0b309104238a6f10fe7e22a16e0caa @aserafin aserafin committed Jan 3, 2014
View
@@ -22,3 +22,4 @@
.idea/
/config/application.yml
+/public/teams/*
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -10,16 +10,42 @@ var myAppModule = angular.module('MyApp', ['ui.select2','rails'])
.factory('Player', ['railsResourceFactory', function (railsResourceFactory) {
return railsResourceFactory({
url: '/players',
- name: 'book'
+ name: 'player'
});
}])
- .controller('PlayersCtrl', ['Player','$scope', function(Player,$scope) {
+ .factory('Team', ['railsResourceFactory', function (railsResourceFactory) {
+ return railsResourceFactory({
+ url: '/teams',
+ name: 'team'
+ });
+ }])
+
+ .controller('PlayersCtrl', ['Player','Team','$scope', function(Player,Team,$scope) {
+ $scope.home = { score: 0 };
+ $scope.away = { score: 0 };
+
+ $scope.save = function() {
+ console.log($scope.home, $scope.away);
+ };
+
$scope.select2options = {
'multiple': true
};
+
Player.query().then(function(data){
$scope.players = data;
});
+ Team.query().then(function(data){
+ $scope.teams = data;
+ });
+ $scope.logoUrl = function(team_id){
+ if (!$scope.teams) return;
+ if (!team_id) return;
+
+ var flag = $scope.teams.filter(function(el) { return el.id == team_id; })[0];
+
+ return flag.logoUrl;
+ };
}]);
@@ -29,8 +29,8 @@ tbody {
width: 15px;
height: 15px;
position: absolute;
- left: 5px;
- top: 35%;
+ left: 10px;
+ top: 33%;
display: none;
background: transparent url('stars.png') top left no-repeat;
}
@@ -72,14 +72,18 @@ td.playername {
}
h1 {
- margin-top: 10px;
- margin-bottom: 0;
+
}
.logo {
+ margin-top: 10px;
+ margin-bottom: 0;
+
float: left;
color: #fff;
text-indent: -9999em;
+
+ display: block;
width: 103px;
height: 31px;
background: transparent image-url('logo.png') top left no-repeat;
@@ -89,6 +93,7 @@ h1 {
font-size: 1.15em;
float: right;
margin-top: 10px;
+
.caret {
margin-left: 5px;
@@ -98,25 +103,134 @@ h1 {
margin-right: 5px;
}
+ button {
+ line-height: 27px;
+ }
+
.dropdown-toggle, .dropdown-menu {
background: #252525;
color: #fff;
border: 0;
a {
color: #fff;
+ margin: 0 5px;
+
}
}
}
-.standings {
- padding-top: 60px;
- width: 800px;
+.actions, .standings, .bottom {
+ width: 900px;
margin: 0 auto;
clear: both;
+}
+
+.actions {
+ clear: both;
+ padding-top: 70px;
+
+
+ .newmatch {
+ margin-bottom: 25px;
+ }
+
+ .btn {
+ background-color: #299d4d;
+ color: #fff;
+ }
+}
+
+.bottom {
+ margin-bottom: 50px;
+}
+
+.standings {
+
+
+ td.change {
+ .icon {
+ display: block;
+ width: 16px;
+ height: 16px;
+ background: transparent image-url('changes.png') 0 -45px no-repeat;
+ }
+
+
+ &.rank_up .icon {
+ background-position: 0 0;
+ }
+ &.rank_down .icon {
+ background-position: 0 -20px;
+ }
+ }
+
+ .matches, .wins, .losts, .draws, .rating {
+ text-align: center;
+
+ }
+
+}
+
+
+
+
+.recentlyplayed, .topmatches {
+
+ .table-container {
+ max-height: 250px;
+ height: auto;
+ overflow-y: scroll;
+ }
+
+
+ table {
+ border: 1px solid #eee;
+ border-radius: 5px;
+ height: 100%;
+
+ td {
+ vertical-align: top !important;
+ height: 20px;
+ }
+
+ tr:hover td {
+ background-color: #F9F9FF;
+ cursor: pointer;
+ }
+ }
+
+ h3 {
+ font-size: 1.1em;
+ color: #6d6d6d;
+ text-transform: uppercase;
+ display: block;
+
+
+ }
+
+ .score {
+ text-align: center;
+ }
+
+ .competitor {
+ color: #299d4d;
+ font-weight: bold;
+
+ &:last-child {
+ text-align: right;
+ }
+
+ }
+
+ float: left;
+ width: 440px;
+ &:first-child {
+ margin-right: 20px;
+ }
}
@@ -1,3 +1,3 @@
class TeamSerializer < ActiveModel::Serializer
- attributes :id, :logo_url
-end
+ attributes :id, :logo_url, :name
+end
@@ -1,9 +1,41 @@
-section(ng-controller="PlayersCtrl")
+table(ng-controller="PlayersCtrl" width="100%" border=1)
+ tr
+ td(width="25%")
+ img(ng-src="{{logoUrl(home.team.id)}}" ng-show="home.team.id")
+ td(width="25%")
+ input(type='number' ng-model="home.score")
+ td(width="25%")
+ input(type='number' ng-model="away.score")
+ td(width="25%")
+ img(ng-src="{{logoUrl(away.team.id)}}" ng-show="away.team.id")
- select(name='home' ui-select2="select2options" ng-model="home" multiple)
- option(ng-repeat="player in players" value="{{player.id}}")
- | {{player.name}}
+ tr
+ td(colspan=2)
+ select(name='home' ui-select2="select2options" ng-model="home.team.id" required)
+ option(ng-repeat="team in teams" value="{{team.id}}")
+ | {{team.name}}
+ td(colspan=2)
+ select(name='home' ui-select2="select2options" ng-model="away.team.id" required)
+ option(ng-repeat="team in teams" value="{{team.id}}")
+ | {{team.name}}
- select(name='away' ui-select2="select2options" ng-model="away" multiple)
- option(ng-repeat="player in players" value="{{player.id}}")
- | {{player.name}}
+ tr
+ td(colspan=2)
+ select(name='home' ui-select2="select2options" ng-model="home.player_ids" multiple required)
+ option(ng-repeat="player in players" value="{{player.id}}")
+ | {{player.name}}
+
+ td(colspan=2)
+ select(name='away' ui-select2="select2options" ng-model="away.player_ids" multiple required)
+ option(ng-repeat="player in players" value="{{player.id}}")
+ | {{player.name}}
+
+ tr
+ td(colspan=4)
+ a(ng-click="save()" class="btn btn-large btn-success block") save
+
+ tr
+ td
+ | {{ home | json }}
+ td
+ | {{ away | json }}
Oops, something went wrong.

0 comments on commit 5a9807c

Please sign in to comment.