Skip to content
This repository has been archived by the owner on Jan 8, 2019. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Cosmo committed Oct 20, 2012
1 parent 506fbc4 commit 27fd255
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 29 deletions.
Binary file modified app/assets/images/ui/video.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/controllers/logs_controller.rb
Expand Up @@ -29,7 +29,7 @@ def create
end
if @log.save
logger.info "awesome, #{current_user.email} tagged a video at #{@log.at}"
Pusher['presence-chat'].trigger('comment', { :body => @log.body, :user_id => @log.user_id, :short_time => @log.at.strftime("%H:%M"), :name => @log.user.name })
Pusher['comments'].trigger('comment', { :body => @log.body, :user_id => @log.user_id, :short_time => @log.at.strftime("%H:%M"), :name => @log.user.name })
end
redirect_to logs_path
else
Expand Down
37 changes: 19 additions & 18 deletions app/views/chat/index.html.erb
@@ -1,35 +1,32 @@
<script type="text/javascript">
Pusher.log = function(message) {
if (window.console && window.console.log) window.console.log(message);
};

$(function() {
// Set focus on message field
$("#log_body").focus();

var socket = new Pusher('9b398a15a5cdeb082e7d');
var channel = socket.subscribe('presence-chat');
var socket = new Pusher('9b398a15a5cdeb082e7d');
var presence_channel = socket.subscribe('presence-channel');
var channel = socket.subscribe('comments');

channel.bind('pusher:subscription_succeeded', function(members) {
console.log("subscribed!")
update_member_count(members.count);
presence_channel.bind('pusher:subscription_succeeded', function(members) {
update_member_count(presence_channel.members.count);
members.each(function(member) {
add_member(member.id, member.info);
});
});

channel.bind('pusher:member_added', function(member) {
console.log("added!")
presence_channel.bind('pusher:member_added', function(member) {
add_member(member.id, member.info);
update_member_count(presence_channel.members.count);
});

channel.bind('pusher:member_removed', function(member) {
console.log("removed!")
presence_channel.bind('pusher:member_removed', function(member) {
remove_member(member.id);
update_member_count(presence_channel.members.count);
});

channel.bind('comment', function(data) {
console.log(data.user_name);
$("<p>["+data.short_time+"] "+data.name+": "+data.body+"</p>").appendTo("#chat");
console.log("hi!");
$("<p>["+data.short_time+"] "+data.name+": "+data.body+"</p>").appendTo("#debug_window");
$("#new_log").reset();
$("#log_body").focus();
});
Expand All @@ -45,15 +42,19 @@
}

function remove_member(member_id) {
console.log("removing: " + member_id)
console.log("removing!!." + $("member_id_" + member_id))
$("#member_id_" + member_id).remove();
}

function push_comment() {

}
</script>

<div style="background-color: white">

<div id="chat">

<h2>Realtime debug:</h2>
<div id="debug_window">
</div>

<%= form_for Log.new, :remote => true do |f| %>
Expand Down
21 changes: 11 additions & 10 deletions app/views/home/index.html.erb
Expand Up @@ -2,11 +2,9 @@
<div id="prev" class="sidebar">
<a href="#" class="sidebar-video">
<div class="sidebar-title">Sendung verpasst?</div>
<%= image_tag @schedule_previous["VDO"] ? @schedule_previous["VDO"]["VTU"]["IUR"] : "", :size => "176x117" %>
<%= image_tag @schedule_previous["VDO"] ? @schedule_previous["VDO"]["VTU"]["IUR"] : "ui/default.png", :size => "176x117" %>
<h3><%= @schedule_previous["TIT"] %></h3>
<% if @schedule_previous["AP7"] %>
<%= link_to "Arte+7", @schedule_previous["VDO"]["VTR"] %>
<% end %>
Ende: <%= @schedule_now["BAT"] ? "#{@schedule_now["BAT"]} Uhr" : "" %>
</a>
</div>

Expand All @@ -19,27 +17,30 @@
</div>
<div id="current-video">
<div id="teaser-button">
<%= image_tag @schedule_now["VDO"] ? @schedule_now["VDO"]["VTU"]["IUR"] : "", :size => "260x160" %>
<%= image_tag @schedule_now["VDO"] ? @schedule_now["VDO"]["VTU"]["IUR"] : "ui/default.png", :size => "260x160" %>
</div>
<div id="description">
<div id="nowon">Jetzt läuft:</div>
<h1><%= @schedule_now["DSS"] ? @schedule_now["DSS"] : @schedule_now["DTE"] %></h1>
<h1><%= @schedule_now["TIT"] %></h1>
<h2>
20:15 - 22:15 Uhr
<%= @schedule_now["BAT"] ? @schedule_now["BAT"] : "" %> - <%= @schedule_next["BAT"] ? "#{@schedule_next["BAT"]} Uhr" : "" %>
</h2>
<p>
Die Produkte der Firma Apple, seien es Computer oder Telefone, vermitteln den Käufern beziehungsweise Nutzern eine bestimmte Lebensart und die Zugehörigkeit zu einer besonderen - oft auch als elitär bezeichneten - Gruppe der Gesellschaft, die äußerst anziehend wirkt.
<%= @schedule_now["DSS"] ? @schedule_now["DSS"] : @schedule_now["DTE"] %>
</p>
</div>
</div>
<div id="comment-timeline">
<%= image_tag("ui/comment-stamps.png") %>
</div>
</div>

<div id="next" class="sidebar">
<a href="#" class="sidebar-video">
<div class="sidebar-title">Nächste Sendung:</div>
<%= image_tag(@schedule_next["VDO"] ? @schedule_next["VDO"]["VTU"]["IUR"] : "", :size => "176x117") %>
<%= image_tag @schedule_next["VDO"] ? @schedule_next["VDO"]["VTU"]["IUR"] : "ui/default.png", :size => "176x117" %>
<h3><%= @schedule_next["TIT"] %></h3>
<%= @schedule_next["BAT"] ? "#{@schedule_next["BAT"]} Uhr" : "" %>
Beginn: <%= @schedule_next["BAT"] ? "#{@schedule_next["BAT"]} Uhr" : "" %>
</a>
</div>
</div>

0 comments on commit 27fd255

Please sign in to comment.