mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-25 03:50:53 +00:00
more progress on this
This commit is contained in:
parent
4742be0ea5
commit
945061e812
35 changed files with 13156 additions and 8 deletions
3
Gemfile
3
Gemfile
|
@ -41,9 +41,10 @@ gem 'neat', '~> 1.6.0'
|
|||
gem 'haml', '~> 4.0.5'
|
||||
gem 'rails_autolink', '~> 1.1.5'
|
||||
|
||||
gem 'active_model_serializers'
|
||||
gem 'ember-source', '~> 1.8.0.beta.4'
|
||||
gem 'ember-data-source', '~> 1.0.0.beta.10'
|
||||
gem 'ember-rails', '~> 0.15.0'
|
||||
gem 'es5-shim-rails', '~> 4.0.1'
|
||||
|
||||
group :assets do
|
||||
gem 'uglifier', '~> 2.5.0'
|
||||
|
|
|
@ -126,6 +126,9 @@ GEM
|
|||
ember-source (1.8.0.beta.4)
|
||||
handlebars-source (~> 1.0)
|
||||
erubis (2.7.0)
|
||||
es5-shim-rails (4.0.1)
|
||||
actionpack (>= 3.1)
|
||||
railties (>= 3.1)
|
||||
exceptional (2.0.33)
|
||||
rack
|
||||
execjs (2.2.1)
|
||||
|
@ -277,6 +280,7 @@ PLATFORMS
|
|||
|
||||
DEPENDENCIES
|
||||
active_link_to (~> 1.0.2)
|
||||
active_model_serializers
|
||||
annotate (~> 2.6.2)
|
||||
bbcoder (~> 1.0.1)
|
||||
better_errors (~> 1.1.0)
|
||||
|
@ -296,9 +300,9 @@ DEPENDENCIES
|
|||
database_cleaner (~> 1.2.0)
|
||||
dotenv-rails (~> 0.10.0)
|
||||
dynamic_form (~> 1.1.4)
|
||||
ember-data-source (~> 1.0.0.beta.10)
|
||||
ember-rails (~> 0.15.0)
|
||||
ember-source (~> 1.8.0.beta.4)
|
||||
es5-shim-rails (~> 4.0.1)
|
||||
exceptional (~> 2.0.33)
|
||||
factory_girl_rails (~> 4.4.1)
|
||||
faraday (~> 0.9.0)
|
||||
|
|
|
@ -1 +1,45 @@
|
|||
window.ENSL = Ember.Application.Create();
|
||||
/**
|
||||
* app.js is for the ember specific application
|
||||
*/
|
||||
|
||||
//= require jquery
|
||||
//= require handlebars
|
||||
//= require ember
|
||||
//= require es5-shim/es5-shim
|
||||
//= require es5-shim/es5-sham
|
||||
//= require ember-data-local
|
||||
//= require_self
|
||||
|
||||
//= require router
|
||||
//= require helpers
|
||||
//= require_directory ./routes
|
||||
//= require_directory ./controllers
|
||||
//= require_directory ./models
|
||||
//= require_tree ./templates
|
||||
|
||||
window.ENSL = Ember.Application.create({
|
||||
rootElement: '#content'
|
||||
});
|
||||
|
||||
ENSL.ApplicationAdapter = DS.ActiveModelAdapter.extend({
|
||||
});
|
||||
|
||||
ENSL.Router.reopen({
|
||||
location: 'history'
|
||||
});
|
||||
|
||||
ENSL.ApplicationRoute = Ember.Route.extend({
|
||||
});
|
||||
|
||||
ENSL.FullLayoutView = Ember.View.extend({
|
||||
layoutName: 'layouts/full'
|
||||
});
|
||||
|
||||
ENSL.FullLayoutRoute = Ember.Route.extend({
|
||||
renderTemplate: function(controller, model) {
|
||||
this.render(this.templateName, {
|
||||
view: 'full_layout',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
0
app/assets/javascripts/controllers/gather_controller.js
Normal file
0
app/assets/javascripts/controllers/gather_controller.js
Normal file
12745
app/assets/javascripts/ember-data-local.js
Normal file
12745
app/assets/javascripts/ember-data-local.js
Normal file
File diff suppressed because it is too large
Load diff
12
app/assets/javascripts/helpers.js
Normal file
12
app/assets/javascripts/helpers.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
Ember.Handlebars.helper('flag', function(country) {
|
||||
if (country) {
|
||||
return new Ember.Handlebars.SafeString('<img src="/assets/flags/' + country + '.png" class="flag" />');
|
||||
}
|
||||
return new Ember.Handlebars.SafeString('<img src="/assets/flags/EU.png" class="flag" />');
|
||||
});
|
||||
|
||||
Ember.Handlebars.helper('votingBar', function(name, current, total) {
|
||||
var bar = '<div class="voting-bar"><div class="label">' + name + '</div>';
|
||||
bar += '<div class="vote-progress"><div style="width: ' + Math.round(current/total*100) + '%"></div></div></div>';
|
||||
return new Ember.Handlebars.SafeString(bar);
|
||||
});
|
3
app/assets/javascripts/models/category.js
Normal file
3
app/assets/javascripts/models/category.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
ENSL.Category = DS.Model.extend({
|
||||
name: DS.attr()
|
||||
});
|
12
app/assets/javascripts/models/gather.js
Normal file
12
app/assets/javascripts/models/gather.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
ENSL.Gather = DS.Model.extend({
|
||||
status: DS.attr(),
|
||||
votes: DS.attr(),
|
||||
turn: DS.attr(),
|
||||
lastpick1: DS.attr(),
|
||||
lastpick2: DS.attr(),
|
||||
|
||||
category: DS.belongsTo('category'),
|
||||
gatherers: DS.hasMany('gatherer'),
|
||||
gatherServers: DS.hasMany('gatherServer'),
|
||||
gatherMaps: DS.hasMany('gatherMap')
|
||||
});
|
5
app/assets/javascripts/models/gatherMap.js
Normal file
5
app/assets/javascripts/models/gatherMap.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
ENSL.GatherMap = DS.Model.extend({
|
||||
votes: DS.attr('number', { defaultValue: 0 }),
|
||||
|
||||
map: DS.belongsTo('map')
|
||||
});
|
5
app/assets/javascripts/models/gatherServer.js
Normal file
5
app/assets/javascripts/models/gatherServer.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
ENSL.GatherServer = DS.Model.extend({
|
||||
votes: DS.attr('number', { defaultValue: 0 }),
|
||||
|
||||
server: DS.belongsTo('server')
|
||||
});
|
3
app/assets/javascripts/models/gatherer.js
Normal file
3
app/assets/javascripts/models/gatherer.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
ENSL.Gatherer = DS.Model.extend({
|
||||
user: DS.belongsTo('user')
|
||||
});
|
3
app/assets/javascripts/models/map.js
Normal file
3
app/assets/javascripts/models/map.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
ENSL.Map = DS.Model.extend({
|
||||
name: DS.attr()
|
||||
});
|
3
app/assets/javascripts/models/server.js
Normal file
3
app/assets/javascripts/models/server.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
ENSL.Server = DS.Model.extend({
|
||||
name: DS.attr()
|
||||
});
|
4
app/assets/javascripts/models/user.js
Normal file
4
app/assets/javascripts/models/user.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
ENSL.User = DS.Model.extend({
|
||||
username: DS.attr(),
|
||||
country: DS.attr()
|
||||
});
|
4
app/assets/javascripts/router.js
Normal file
4
app/assets/javascripts/router.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
ENSL.Router.map(function() {
|
||||
// this.resource('gathers');
|
||||
this.resource('gather', { path: '/gathers/:gather_id' });
|
||||
});
|
7
app/assets/javascripts/routes/gather.js
Normal file
7
app/assets/javascripts/routes/gather.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
ENSL.GatherRoute = ENSL.FullLayoutRoute.extend({
|
||||
templateName: 'gathers/gather',
|
||||
|
||||
model: function(params) {
|
||||
return this.store.find('gather', params.gather_id);
|
||||
},
|
||||
});
|
3
app/assets/javascripts/routes/gathers.js
Normal file
3
app/assets/javascripts/routes/gathers.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
ENSL.GathersRoute = Ember.Route.extend({
|
||||
|
||||
});
|
31
app/assets/javascripts/templates/_footer.hbs
Normal file
31
app/assets/javascripts/templates/_footer.hbs
Normal file
|
@ -0,0 +1,31 @@
|
|||
<footer class="footer">
|
||||
<div class="content wrapper">
|
||||
<div class="footer-links">
|
||||
{{!--
|
||||
<ul>
|
||||
<li><h3><%= link_to "Contests", controller: "contests", action: "current" %></h3></li>
|
||||
<li><%= link_to "Current", "/contests/current" %></li>
|
||||
<li><%= link_to "NS2 History", "/contests/historical/NS2" %></li>
|
||||
<li><%= link_to "NS1 History", "/contests/historical/NS1" %></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><h3><%= link_to "Gathers", Gather.last %></h3></li>
|
||||
<li><%= link_to "Introduction", article_url(464) %></li>
|
||||
<li><%= link_to "Archives", "/gathers/" %></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><h3><%= link_to "Articles", articles_url %></h3></li>
|
||||
<li><%= link_to "Articles", articles_url %></li>
|
||||
<li><%= link_to "NS Movies", movies_url %></li>
|
||||
<li><%= link_to "Files", directory_url(Directory::ROOT) %></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><h3><%= link_to "Forums", forums_url %></h3></li>
|
||||
<li><%= link_to "Index", forums_url %></li>
|
||||
<li><%= link_to "Rules", "/topics/12" %></li>
|
||||
</ul>
|
||||
--}}
|
||||
</div>
|
||||
<p>© {{!-- <%= Time.zone.now.year %> --}} NSL</p>
|
||||
</div>
|
||||
</footer>
|
15
app/assets/javascripts/templates/_header.hbs
Normal file
15
app/assets/javascripts/templates/_header.hbs
Normal file
|
@ -0,0 +1,15 @@
|
|||
<header>
|
||||
<div class="banner <%= 'authenticated' if cuser %>">
|
||||
<div class="wrapper">
|
||||
<div id="authentication" class="{{!-- <%= 'admin' if cuser && cuser.admin? %> --}}">
|
||||
{{!--
|
||||
<% if cuser %>
|
||||
<%= render partial: "widgets/logged" %>
|
||||
<% else %>
|
||||
<%= render partial: "widgets/login" %>
|
||||
<% end %>
|
||||
--}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
71
app/assets/javascripts/templates/_navigation.hbs
Normal file
71
app/assets/javascripts/templates/_navigation.hbs
Normal file
|
@ -0,0 +1,71 @@
|
|||
<nav id="menu">
|
||||
<div class="wrapper">
|
||||
<div id="logo">
|
||||
<%= link_to image_tag("themes/#{active_theme}/logo.png"), root_path %>
|
||||
</div>
|
||||
<ul class="navigation">
|
||||
<li class="icon">
|
||||
<%= active_link_to root_path, active: ["articles", "news_index"], class: 'news' do %>
|
||||
News
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="dropdown icon">
|
||||
<%= active_link_to({ controller: "contests", action: "current" }, class: 'contests') do %>
|
||||
Contests
|
||||
<% end %>
|
||||
<ul>
|
||||
<li><%= link_to "Rules", latest_rules %></li>
|
||||
<li><%= link_to "Historical", "/contests" %></li>
|
||||
<li><%= link_to "NS1 History", "/contests/historical/NS1" %></li>
|
||||
<li><%= link_to "NS2 History", "/contests/historical/NS2" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<%= active_link_to Gather.last, class: 'gathers' do %>
|
||||
Gathers
|
||||
<span class="count"><%= Gather.player_count_for_game('NS2') %>/<%= Gather::FULL %></span>
|
||||
<% end %>
|
||||
|
||||
<ul>
|
||||
<li><%= link_to "Introduction", article_url(464) %></li>
|
||||
<li><%= link_to "Archives", "/gathers/" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown icon">
|
||||
<%= active_link_to articles_path, class: 'articles' do %>
|
||||
Articles
|
||||
<% end %>
|
||||
<ul>
|
||||
<li><%= link_to "Hall of Fame", article_url(Article::HOF) %></li>
|
||||
<li><%= link_to "History", article_url(Article::HISTORY) %></li>
|
||||
<li><%= link_to "Movies", movies_url %></li>
|
||||
<li><%= link_to "Files", directory_url(Directory::ROOT) %></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown icon">
|
||||
<%= active_link_to forums_path, active: [["forums", "topics"]], class: 'forums' do %>
|
||||
Forums
|
||||
<% end %>
|
||||
<ul>
|
||||
<li><%= link_to "Index", forums_path %></li>
|
||||
<li><%= link_to "Rules", "/topics/12" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="icon">
|
||||
<%= active_link_to({ controller: "teams", action: :index }, class: 'teams') do %>
|
||||
Teams
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="dropdown icon">
|
||||
<%= active_link_to({ controller: "users", action: :index }, class: 'users') do %>
|
||||
Users
|
||||
<% end %>
|
||||
<ul>
|
||||
<li><%= link_to "Staff", controller: "about", action: "staff" %></li>
|
||||
<li><%= link_to "Bans", bans_url %></li>
|
||||
<li><%= link_to "Contact", new_issue_path %></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
58
app/assets/javascripts/templates/gathers/gather.hbs
Normal file
58
app/assets/javascripts/templates/gathers/gather.hbs
Normal file
|
@ -0,0 +1,58 @@
|
|||
<div id="gather">
|
||||
<h1 class="fancy">
|
||||
<span>
|
||||
{{#link-to 'gather' gather}}{{category.name}} Gather{{/link-to}}
|
||||
</span>
|
||||
</h1>
|
||||
|
||||
<div id="gather-area">
|
||||
<div class="gather-columns">
|
||||
|
||||
<div class="data players">
|
||||
<div class="contents">
|
||||
<h4>Players</h4>
|
||||
<ul id="gatherers">
|
||||
{{#each gatherers}}
|
||||
<li>
|
||||
{{flag user.country}}
|
||||
{{user.username}}
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gather-content">
|
||||
<div class="voting">
|
||||
<div class="data servers">
|
||||
<div class="contents">
|
||||
<h4>Servers</h4>
|
||||
<ul class="votes">
|
||||
{{#each gatherServers}}
|
||||
<li>{{votingBar server.name votes 12}}</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="data maps">
|
||||
<div class="contents">
|
||||
<h4>Maps</h4>
|
||||
<ul class="votes">
|
||||
{{#each gatherMaps}}
|
||||
<li>{{votingBar map.name votes 12}}</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="data chat">
|
||||
<div class="contents">
|
||||
<h4>Chat</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
2
app/assets/javascripts/templates/layouts/full.hbs
Normal file
2
app/assets/javascripts/templates/layouts/full.hbs
Normal file
|
@ -0,0 +1,2 @@
|
|||
{{!-- This is a placeholder for when we start doing layout in ember rather than rails --}}
|
||||
{{yield}}
|
|
@ -118,7 +118,6 @@
|
|||
}
|
||||
|
||||
.data {
|
||||
@include span-columns(4);
|
||||
@include pad;
|
||||
border-radius: $column-border-width + $column-border-radius;
|
||||
padding-bottom: 20px;
|
||||
|
@ -144,6 +143,8 @@
|
|||
}
|
||||
|
||||
.players {
|
||||
@include span-columns(4);
|
||||
height: 600px;
|
||||
|
||||
.captain {
|
||||
color: $gold;
|
||||
|
@ -155,6 +156,49 @@
|
|||
padding: 0 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.gather-content {
|
||||
@include span-columns(8);
|
||||
|
||||
.voting {
|
||||
@include span-columns(12);
|
||||
|
||||
.data {
|
||||
@include span-columns(6);
|
||||
height: 350px;
|
||||
}
|
||||
|
||||
.voting-bar {
|
||||
@include span-columns(12);
|
||||
height: 20px;
|
||||
font-size: 0.9em;
|
||||
|
||||
.label {
|
||||
@include span-columns(4);
|
||||
}
|
||||
|
||||
.vote-progress {
|
||||
@include span-columns(8);
|
||||
height: 18px;
|
||||
position: relative;
|
||||
background: #555;
|
||||
padding: 2px;
|
||||
|
||||
div {
|
||||
height: 14px;
|
||||
min-width: 1%;
|
||||
position: absolute;
|
||||
background: #ff000e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.chat {
|
||||
@include span-columns(12);
|
||||
height: 250px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#gather-stats {
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
class GathersController < ApplicationController
|
||||
before_filter :get_gather, except: [:latest, :index, :create]
|
||||
respond_to :html, :js
|
||||
respond_to :html, :js, :json
|
||||
|
||||
def index
|
||||
@gathers = Gather.ordered.limit(50).all
|
||||
end
|
||||
|
||||
def show
|
||||
render layout: 'full'
|
||||
respond_to do |format|
|
||||
format.html { render "layouts/ember", layout: false }
|
||||
format.json { render json: @gather }
|
||||
end
|
||||
end
|
||||
|
||||
def latest
|
||||
|
|
4
app/serializers/application_serializer.rb
Normal file
4
app/serializers/application_serializer.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
class ApplicationSerializer < ActiveModel::Serializer
|
||||
embed :ids, :include => true
|
||||
attributes :id
|
||||
end
|
3
app/serializers/category_serializer.rb
Normal file
3
app/serializers/category_serializer.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class CategorySerializer < ApplicationSerializer
|
||||
attributes :id, :name
|
||||
end
|
5
app/serializers/gather_map_serializer.rb
Normal file
5
app/serializers/gather_map_serializer.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class GatherMapSerializer < ApplicationSerializer
|
||||
attributes :id, :votes
|
||||
|
||||
has_one :map
|
||||
end
|
8
app/serializers/gather_serializer.rb
Normal file
8
app/serializers/gather_serializer.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
class GatherSerializer < ApplicationSerializer
|
||||
attributes :id, :status, :votes, :turn, :lastpick1, :lastpick2
|
||||
|
||||
has_one :category
|
||||
has_many :gatherers
|
||||
has_many :gather_servers
|
||||
has_many :gather_maps
|
||||
end
|
5
app/serializers/gather_server_serializer.rb
Normal file
5
app/serializers/gather_server_serializer.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class GatherServerSerializer < ApplicationSerializer
|
||||
attributes :id, :votes
|
||||
|
||||
has_one :server
|
||||
end
|
5
app/serializers/gatherer_serializer.rb
Normal file
5
app/serializers/gatherer_serializer.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class GathererSerializer < ApplicationSerializer
|
||||
attributes :id
|
||||
|
||||
has_one :user
|
||||
end
|
3
app/serializers/map_serializer.rb
Normal file
3
app/serializers/map_serializer.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class MapSerializer < ApplicationSerializer
|
||||
attributes :id, :name
|
||||
end
|
3
app/serializers/server_serializer.rb
Normal file
3
app/serializers/server_serializer.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class ServerSerializer < ApplicationSerializer
|
||||
attributes :id, :name
|
||||
end
|
3
app/serializers/user_serializer.rb
Normal file
3
app/serializers/user_serializer.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class UserSerializer < ApplicationSerializer
|
||||
attributes :id, :username, :country
|
||||
end
|
|
@ -98,11 +98,11 @@ class GoogleCalendar
|
|||
end
|
||||
|
||||
def start
|
||||
Time.use_zone(@timezone_offset) { Time.zone.parse(@entry["start"]["dateTime"]) }
|
||||
Time.use_zone(@timezone_offset) { Time.zone.parse(@entry["start"]["date"]) }
|
||||
end
|
||||
|
||||
def end
|
||||
Time.use_zone(@timezone_offset) { Time.zone.parse(@entry["end"]["dateTime"]) }
|
||||
Time.use_zone(@timezone_offset) { Time.zone.parse(@entry["end"]["date"]) }
|
||||
end
|
||||
|
||||
def formatted_summary
|
||||
|
|
27
app/views/layouts/ember.html.erb
Normal file
27
app/views/layouts/ember.html.erb
Normal file
|
@ -0,0 +1,27 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title><%= full_title(yield(:title)) %></title>
|
||||
<meta charset="utf-8">
|
||||
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<%= favicon_link_tag 'shared/favicon.ico' %>
|
||||
<%= theme_stylesheet_link_tag %>
|
||||
<%= csrf_meta_tag %>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<%= render partial: "header" %>
|
||||
<%= render partial: "navigation" %>
|
||||
<div class="body wrapper">
|
||||
<div id="content" class="full">
|
||||
<%= render partial: "messages" %>
|
||||
<%= yield %>
|
||||
</div>
|
||||
</div>
|
||||
<%= render partial: "footer" %>
|
||||
</div>
|
||||
|
||||
<%= javascript_include_tag 'app' %>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue