Merge pull request #57 from ENSL/master

Merge from Master
This commit is contained in:
simplefl 2015-09-18 17:06:13 +02:00
commit c5eadf9aac
6 changed files with 64 additions and 6 deletions

View file

@ -189,4 +189,12 @@ module ApplicationHelper
def latest_rules def latest_rules
article_path(Article::RULES) article_path(Article::RULES)
end end
def gathers_url
if Rails.env.production?
"http://gathers.ensl.org"
else
"http://gathers.staging.ensl.org"
end
end
end end

View file

@ -25,14 +25,19 @@
</ul> </ul>
</li> </li>
<li class="dropdown"> <li class="dropdown">
<%= active_link_to Gather.last, class: 'gathers' do %> <%= link_to gathers_url, class: 'gathers', target: "_blank" do %>
Gathers Gathers
<span class="count"><%= Gather.player_count_for_game('NS2') %>/<%= Gather::FULL %></span> <span class="count" id="gathercount"></span>
<% end %> <% end %>
<ul> <ul>
<li><%= link_to "Introduction", article_url(464) %></li> <li><%= link_to "Introduction", article_url(464) %></li>
<li><%= link_to "Archives", "/gathers/" %></li> <li><%= link_to "Archives", "/gathers/" %></li>
<li>
<%= active_link_to Gather.last, class: 'gathers' do %>
Fallback
<span class="count"><%= Gather.player_count_for_game('NS2') %>/<%= Gather::FULL %></span>
<% end %>
</li>
</ul> </ul>
</li> </li>
<li class="dropdown icon"> <li class="dropdown icon">
@ -73,3 +78,14 @@
</ul> </ul>
</div> </div>
</nav> </nav>
<script>
$(function () {
$.ajax({
datatype: "json",
url: "<%= gathers_url %>/gathers/current",
success: function (data) {
$("#gathercount").html(data.gatherers.length + "/12");
}
});
});
</script>

View file

@ -143,6 +143,10 @@
<% end %> <% end %>
</div> </div>
<h4 class="fancy add-top">
Gathers have moved to <%= link_to "gathers.ensl.org", gathers_url, target: "_blank" %>. This app is just a fallback in case something goes wrong
</h4>
<% if @gather and @gather.status != Gather::STATE_FINISHED %> <% if @gather and @gather.status != Gather::STATE_FINISHED %>
<div id="gather-info"> <div id="gather-info">
<div class="info"> <div class="info">

View file

@ -15,6 +15,9 @@
<%= link_to "Search for Steam Account" %> <%= link_to "Search for Steam Account" %>
</div> </div>
</dd> </dd>
<dt>Stream</dt>
<dd><%= @user.profile.stream.blank? ? "No Stream Provided" : @user.profile.stream %></dd>
</dd>
</dl> </dl>
<h4>Contact</h4> <h4>Contact</h4>

View file

@ -0,0 +1,28 @@
require "spec_helper"
feature "User Stream Information" do
let(:password) { "foobar" }
let!(:user) { create :user, raw_password: password }
feature "stream administration" do
scenario "user updates their stream" do
visit user_path(user)
expect(page).to have_content("No Stream Provided")
fill_login_form(user, password)
click_button submit(:user, :login)
visit edit_user_path(user)
stream_url = "twitch.tv/gold_n"
expect(page).to have_content("Stream")
fill_in "user_profile_attributes_stream", with: stream_url
click_button "Update Profile"
expect(page).to have_content(I18n.t(:users_update))
visit user_path(user)
expect(page).to have_content(stream_url)
end
end
def fill_login_form(user, password)
fill_in "login_username", with: user.username
fill_in "login_password", with: password
end
end

View file

@ -32,9 +32,8 @@ describe Topic do
it "returns 5 unique, most recently posted topics" do it "returns 5 unique, most recently posted topics" do
topics = [] topics = []
10.times do 10.times do
topic = create :topic topic = create :topic, first_post: "Foo"
topics << topic topics.push(topic)
3.times { create :post, topic: topic }
end end
recent_topics = Topic.recent_topics recent_topics = Topic.recent_topics
topics.last(5).each do |topic| topics.last(5).each do |topic|