Skip to content
Extraits de code Groupes Projets
Valider f696ffc3 rédigé par maxwell's avatar maxwell
Parcourir les fichiers

fixed up some views, but some stuff feels like it broke

parent a0417d13
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de avec 51 ajouts et 18 suppressions
...@@ -2,5 +2,4 @@ class ApplicationController < ActionController::Base ...@@ -2,5 +2,4 @@ class ApplicationController < ActionController::Base
protect_from_forgery :except => :receive protect_from_forgery :except => :receive
layout 'application' layout 'application'
end end
...@@ -29,4 +29,7 @@ module ApplicationHelper ...@@ -29,4 +29,7 @@ module ApplicationHelper
end end
end end
def mine?(post)
post.owner == User.first.email
end
end end
...@@ -2,7 +2,7 @@ module DashboardHelper ...@@ -2,7 +2,7 @@ module DashboardHelper
def type_partial(post) def type_partial(post)
class_name = post.class.name.to_s.underscore class_name = post.class.name.to_s.underscore
"#{class_name.pluralize}/pane" "#{class_name.pluralize}/#{class_name}"
end end
end end
%li.message %li.message{:class => ("mine" if mine?(post))}
%span.from %span.from
= link_to post.owner, "#" = link_to post.owner, "#"
%b wrote a new blog post %b wrote a new blog post
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
%b= post.title %b= post.title
%br %br
= post.body = post.body
%div.time %div.time= link_to "#{time_ago_in_words(post.updated_at)} ago", blog_path(post)
= "#{time_ago_in_words(post.updated_at)} ago" - if mine?(post)
= link_to 'Destroy', blog_path(post), :confirm => 'Are you sure?', :method => :delete
\ No newline at end of file
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
%ul#stream %ul#stream
- for blog in @blogs - for blog in @blogs
= render "pane", :post => blog = render "blog", :post => blog
%li.message %li.message{:class => ("mine" if mine?(post))}
%span.from %span.from
= link_to post.owner, "#" = link_to post.owner, "#"
%b shared a link %b shared a link
%br %br
= post.title = post.title
= link_to post.link = link_to post.link
%div.time= "#{time_ago_in_words(post.updated_at)} ago" %div.time= link_to "#{time_ago_in_words(post.updated_at)} ago", bookmark_path(post)
- if mine?(post)
= link_to 'Destroy', bookmark_path(post), :confirm => 'Are you sure?', :method => :delete
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
%ul#stream %ul#stream
- for bookmark in @bookmarks - for bookmark in @bookmarks
= render "pane", :post => bookmark = render "bookmark", :post => bookmark
!!! !!!
%html %html
%head %head
%title %title
= yield(:title) || "Untitled" = yield(:title) || "Untitled"
...@@ -11,7 +10,7 @@ ...@@ -11,7 +10,7 @@
= javascript_include_tag 'jquery142' = javascript_include_tag 'jquery142'
/= javascript_include_tag"http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" /= javascript_include_tag"http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"
= javascript_include_tag 'rails' = javascript_include_tag 'rails'
= javascript_include_tag 'socket' = javascript_include_tag 'socket' if user_signed_in?
= csrf_meta_tag = csrf_meta_tag
= yield(:head) = yield(:head)
...@@ -28,7 +27,6 @@ ...@@ -28,7 +27,6 @@
$(this).fadeTo(80, 1); $(this).fadeTo(80, 1);
}); });
}); });
%body %body
%header %header
......
%li.message %li.message{:class => ("mine" if mine?(post))}
%span.from %span.from
= link_to post.owner, "#" = link_to post.owner, "#"
= post.message = post.message
%div.time %div.time
= "#{time_ago_in_words(post.updated_at)} ago" = "#{time_ago_in_words(post.updated_at)} ago"
- if mine?(post)
= link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete
%h1.big_text= link_to "new status message", new_status_message_path %h1.big_text= link_to "new status message", new_status_message_path
%ul#stream %ul#stream
- for status_message in @status_messages - for status_message in @status_messages
= render "pane", :post => status_message = render "status_message", :post => status_message
...@@ -7,16 +7,13 @@ module WebSocket ...@@ -7,16 +7,13 @@ module WebSocket
EM.next_tick { EM.next_tick {
EM.add_timer(0.1) do EM.add_timer(0.1) do
#puts "channel set"
@channel = EM::Channel.new @channel = EM::Channel.new
end end
EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 8080, :debug => true) do |ws| EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 8080, :debug => true) do |ws|
ws.onopen { ws.onopen {
sid = @channel.subscribe { |msg| ws.send msg } sid = @channel.subscribe { |msg| ws.send msg }
#@channel.push "#{sid} connectdfged!"
puts @channel.inspect
ws.onmessage { |msg| ws.onmessage { |msg|
@channel.push "#{msg}" @channel.push "#{msg}"
} }
...@@ -30,10 +27,7 @@ module WebSocket ...@@ -30,10 +27,7 @@ module WebSocket
} }
#this should get folded into message queue i think? #this should get folded into message queue i think?
def self.update_clients(json) def self.update_clients(json)
#EM.add_timer(5) do @channel.push(json) if @channel
#puts @channel
@channel.push json
#end
end end
end end
...@@ -3,7 +3,6 @@ Diaspora::Application.routes.draw do |map| ...@@ -3,7 +3,6 @@ Diaspora::Application.routes.draw do |map|
resources :bookmarks resources :bookmarks
resources :friends resources :friends
resources :status_messages resources :status_messages
resources :status_messages
#routes for devise, not really sure you will need to mess with this in the future, lets put default, #routes for devise, not really sure you will need to mess with this in the future, lets put default,
#non mutable stuff in anohter file #non mutable stuff in anohter file
......
...@@ -131,7 +131,8 @@ li.message { ...@@ -131,7 +131,8 @@ li.message {
line-height: 140%; line-height: 140%;
font-size: 120%; font-size: 120%;
font-family: "Lucida Grande"; font-family: "Lucida Grande";
color: #999999; } color: #999999;
margin-bottom: 5px; }
li.message span.from { li.message span.from {
color: black; color: black;
font-weight: bold; font-weight: bold;
...@@ -140,6 +141,9 @@ li.message { ...@@ -140,6 +141,9 @@ li.message {
color: #bababa; color: #bababa;
font-size: 70%; } font-size: 70%; }
.mine {
background-color: rgba(202, 237, 204, 0.5); }
h1 { h1 {
position: relative; position: relative;
font-size: 24px; font-size: 24px;
......
...@@ -158,6 +158,7 @@ li.message ...@@ -158,6 +158,7 @@ li.message
:size 120% :size 120%
:family 'Lucida Grande' :family 'Lucida Grande'
:color #999 :color #999
:margin-bottom 5px
span.from span.from
:color #000 :color #000
...@@ -169,6 +170,8 @@ li.message ...@@ -169,6 +170,8 @@ li.message
div.time div.time
:color #bababa :color #bababa
:font-size 70% :font-size 70%
.mine
:background-color rgba(202, 237, 204, 0.5)
h1 h1
:position relative :position relative
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter