fixed up some views, but some stuff feels like it broke
This commit is contained in:
parent
a0417d13af
commit
f696ffc3a6
17 changed files with 51 additions and 45 deletions
|
|
@ -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
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def mine?(post)
|
||||||
|
post.owner == User.first.email
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
11
app/views/blogs/_blog.html.haml
Normal file
11
app/views/blogs/_blog.html.haml
Normal 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
|
||||||
|
|
@ -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"
|
|
||||||
|
|
||||||
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
%ul#stream
|
%ul#stream
|
||||||
- for blog in @blogs
|
- for blog in @blogs
|
||||||
= render "pane", :post => blog
|
= render "blog", :post => blog
|
||||||
|
|
|
||||||
11
app/views/bookmarks/_bookmark.html.haml
Normal file
11
app/views/bookmarks/_bookmark.html.haml
Normal 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
|
||||||
|
|
||||||
|
|
@ -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"
|
|
||||||
|
|
||||||
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
%ul#stream
|
%ul#stream
|
||||||
- for bookmark in @bookmarks
|
- for bookmark in @bookmarks
|
||||||
= render "pane", :post => bookmark
|
= render "bookmark", :post => bookmark
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
!!!
|
!!!
|
||||||
%html
|
%html
|
||||||
|
|
||||||
%head
|
%head
|
||||||
%title
|
%title
|
||||||
= yield(:title) || "Untitled"
|
= yield(:title) || "Untitled"
|
||||||
|
|
@ -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 @@
|
||||||
$(this).fadeTo(80, 1);
|
$(this).fadeTo(80, 1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
%body
|
%body
|
||||||
%header
|
%header
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
%li.message
|
|
||||||
%span.from
|
|
||||||
= link_to post.owner, "#"
|
|
||||||
= post.message
|
|
||||||
%div.time
|
|
||||||
= "#{time_ago_in_words(post.updated_at)} ago"
|
|
||||||
|
|
||||||
11
app/views/status_messages/_status_message.html.haml
Normal file
11
app/views/status_messages/_status_message.html.haml
Normal 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
%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
|
||||||
|
|
||||||
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
|
||||||
}
|
}
|
||||||
#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|
|
||||||
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 {
|
||||||
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 {
|
||||||
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
|
||||||
: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
|
||||||
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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue