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

This commit is contained in:
maxwell 2010-06-21 16:46:19 -07:00
parent a0417d13af
commit f696ffc3a6
17 changed files with 51 additions and 45 deletions

View file

@ -2,5 +2,4 @@ class ApplicationController < ActionController::Base
protect_from_forgery :except => :receive
layout 'application'
end

View file

@ -29,4 +29,7 @@ module ApplicationHelper
end
end
def mine?(post)
post.owner == User.first.email
end
end

View file

@ -2,7 +2,7 @@ module DashboardHelper
def type_partial(post)
class_name = post.class.name.to_s.underscore
"#{class_name.pluralize}/pane"
"#{class_name.pluralize}/#{class_name}"
end
end

View file

@ -0,0 +1,11 @@
%li.message{:class => ("mine" if mine?(post))}
%span.from
= link_to post.owner, "#"
%b wrote a new blog post
%br
%b= post.title
%br
= post.body
%div.time= link_to "#{time_ago_in_words(post.updated_at)} ago", blog_path(post)
- if mine?(post)
= link_to 'Destroy', blog_path(post), :confirm => 'Are you sure?', :method => :delete

View file

@ -1,11 +0,0 @@
%li.message
%span.from
= link_to post.owner, "#"
%b wrote a new blog post
%br
%b= post.title
%br
= post.body
%div.time
= "#{time_ago_in_words(post.updated_at)} ago"

View file

@ -2,4 +2,4 @@
%ul#stream
- for blog in @blogs
= render "pane", :post => blog
= render "blog", :post => blog

View file

@ -0,0 +1,11 @@
%li.message{:class => ("mine" if mine?(post))}
%span.from
= link_to post.owner, "#"
%b shared a link
%br
= post.title
= link_to post.link
%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

View file

@ -1,9 +0,0 @@
%li.message
%span.from
= link_to post.owner, "#"
%b shared a link
%br
= post.title
= link_to post.link
%div.time= "#{time_ago_in_words(post.updated_at)} ago"

View file

@ -2,4 +2,4 @@
%ul#stream
- for bookmark in @bookmarks
= render "pane", :post => bookmark
= render "bookmark", :post => bookmark

View file

@ -1,6 +1,5 @@
!!!
%html
%head
%title
= yield(:title) || "Untitled"
@ -11,7 +10,7 @@
= javascript_include_tag 'jquery142'
/= javascript_include_tag"http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"
= javascript_include_tag 'rails'
= javascript_include_tag 'socket'
= javascript_include_tag 'socket' if user_signed_in?
= csrf_meta_tag
= yield(:head)
@ -28,7 +27,6 @@
$(this).fadeTo(80, 1);
});
});
%body
%header

View file

@ -1,7 +0,0 @@
%li.message
%span.from
= link_to post.owner, "#"
= post.message
%div.time
= "#{time_ago_in_words(post.updated_at)} ago"

View file

@ -0,0 +1,11 @@
%li.message{:class => ("mine" if mine?(post))}
%span.from
= link_to post.owner, "#"
= post.message
%div.time
= "#{time_ago_in_words(post.updated_at)} ago"
- if mine?(post)
= link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete

View file

@ -1,5 +1,5 @@
%h1.big_text= link_to "new status message", new_status_message_path
%ul#stream
- for status_message in @status_messages
= render "pane", :post => status_message
= render "status_message", :post => status_message

View file

@ -7,16 +7,13 @@ module WebSocket
EM.next_tick {
EM.add_timer(0.1) do
#puts "channel set"
@channel = EM::Channel.new
end
EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 8080, :debug => true) do |ws|
ws.onopen {
sid = @channel.subscribe { |msg| ws.send msg }
#@channel.push "#{sid} connectdfged!"
puts @channel.inspect
ws.onmessage { |msg|
@channel.push "#{msg}"
}
@ -30,10 +27,7 @@ module WebSocket
}
#this should get folded into message queue i think?
def self.update_clients(json)
#EM.add_timer(5) do
#puts @channel
@channel.push json
#end
@channel.push(json) if @channel
end
end

View file

@ -3,7 +3,6 @@ Diaspora::Application.routes.draw do |map|
resources :bookmarks
resources :friends
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,
#non mutable stuff in anohter file

View file

@ -131,7 +131,8 @@ li.message {
line-height: 140%;
font-size: 120%;
font-family: "Lucida Grande";
color: #999999; }
color: #999999;
margin-bottom: 5px; }
li.message span.from {
color: black;
font-weight: bold;
@ -140,6 +141,9 @@ li.message {
color: #bababa;
font-size: 70%; }
.mine {
background-color: rgba(202, 237, 204, 0.5); }
h1 {
position: relative;
font-size: 24px;

View file

@ -158,6 +158,7 @@ li.message
:size 120%
:family 'Lucida Grande'
:color #999
:margin-bottom 5px
span.from
:color #000
@ -169,6 +170,8 @@ li.message
div.time
:color #bababa
:font-size 70%
.mine
:background-color rgba(202, 237, 204, 0.5)
h1
:position relative