Merge branch 'master' of github.com:diaspora/diaspora_rails
Conflicts: public/stylesheets/sass/application.sass
This commit is contained in:
commit
01f048b0a6
26 changed files with 162 additions and 23 deletions
1
Gemfile
1
Gemfile
|
|
@ -20,6 +20,7 @@ gem 'em-http-request',:git => 'git://github.com/igrigorik/em-http-request.git',
|
||||||
gem 'addressable', :require => "addressable/uri"
|
gem 'addressable', :require => "addressable/uri"
|
||||||
gem 'em-websocket'
|
gem 'em-websocket'
|
||||||
gem 'thin'
|
gem 'thin'
|
||||||
|
gem 'will_paginate', '3.0.pre'
|
||||||
|
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ class BlogsController < ApplicationController
|
||||||
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@blogs = Blog.sort(:created_at.desc).all
|
@blogs = Blog.paginate :page => params[:page], :order => 'created_at DESC'
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ class BookmarksController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@bookmark = Bookmark.new
|
@bookmark = Bookmark.new
|
||||||
@bookmarks = Bookmark.sort(:created_at.desc).all
|
@bookmarks = Bookmark.paginate :page => params[:page], :order => 'created_at DESC'
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ class DashboardController < ApplicationController
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@posts = Post.sort(:created_at.desc).all
|
@posts = Post.paginate :page => params[:page], :order => 'created_at DESC'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ class FriendsController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@friends = Friend.all
|
@friends = Friend.paginate :page => params[:page], :order => 'created_at DESC'
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ class StatusMessagesController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@status_messages = StatusMessage.sort(:created_at.desc).all
|
@status_messages = StatusMessage.paginate :page => params[:page], :order => 'created_at DESC'
|
||||||
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
class UsersController < ApplicationController
|
class UsersController < ApplicationController
|
||||||
|
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@users = User.sort(:created_at.desc).all
|
@users = User.sort(:created_at.desc).all
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,10 @@ class Post
|
||||||
many :comments, :class_name => 'Comment', :foreign_key => :post_id
|
many :comments, :class_name => 'Comment', :foreign_key => :post_id
|
||||||
belongs_to :person, :class_name => 'Person'
|
belongs_to :person, :class_name => 'Person'
|
||||||
|
|
||||||
|
|
||||||
|
cattr_reader :per_page
|
||||||
|
@@per_page = 10
|
||||||
|
|
||||||
timestamps!
|
timestamps!
|
||||||
|
|
||||||
after_save :send_to_view
|
after_save :send_to_view
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,11 @@
|
||||||
%span.from
|
%span.from
|
||||||
= link_to_person post.person
|
= link_to_person post.person
|
||||||
%b wrote a new blog post
|
%b wrote a new blog post
|
||||||
|
- if mine?(post)
|
||||||
|
.destroy_link
|
||||||
|
= link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete
|
||||||
%br
|
%br
|
||||||
%b= post.title
|
%b= post.title
|
||||||
%br
|
%br
|
||||||
= raw post.body
|
= raw post.body
|
||||||
%div.time= link_to "#{time_ago_in_words(post.updated_at)} ago", blog_path(post)
|
%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
|
|
||||||
|
|
|
||||||
|
|
@ -3,3 +3,5 @@
|
||||||
%ul#stream
|
%ul#stream
|
||||||
- for blog in @blogs
|
- for blog in @blogs
|
||||||
= render "blog", :post => blog
|
= render "blog", :post => blog
|
||||||
|
#pagination
|
||||||
|
= will_paginate @blogs
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,13 @@
|
||||||
%span.from
|
%span.from
|
||||||
= link_to_person post.person
|
= link_to_person post.person
|
||||||
%b shared a link
|
%b shared a link
|
||||||
|
- if mine?(post)
|
||||||
|
.destroy_link
|
||||||
|
= link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete
|
||||||
%br
|
%br
|
||||||
= post.title
|
= post.title
|
||||||
|
|
||||||
%a{:href => "#{post.link}"}
|
%a{:href => "#{post.link}"}
|
||||||
= post.link
|
= post.link
|
||||||
%div.time= link_to "#{time_ago_in_words(post.updated_at)} ago", bookmark_path(post)
|
%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
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,3 +3,5 @@
|
||||||
%ul#stream
|
%ul#stream
|
||||||
- for bookmark in @bookmarks
|
- for bookmark in @bookmarks
|
||||||
= render "bookmark", :post => bookmark
|
= render "bookmark", :post => bookmark
|
||||||
|
#pagination
|
||||||
|
= will_paginate @bookmarks
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
= form_tag("/comments", :remote => true, :class =>"new_comment", :id => "new_comment-#{post.id}") do
|
= form_tag("/comments", :remote => true, :class =>"new_comment", :id => "new_comment-#{post.id}") do
|
||||||
%p
|
%p
|
||||||
= text_field_tag "comment_text", 'dislike!', :size => 30, :name => 'comment[text]'
|
= text_field_tag "comment_text", 'leave a comment', :size => 30, :name => 'comment[text]'
|
||||||
= hidden_field_tag "comment_post_id", "#{post.id}", :name => "comment[post_id]"
|
= hidden_field_tag "comment_post_id", "#{post.id}", :name => "comment[post_id]"
|
||||||
= submit_tag 'comment', :id => "comment_submit_#{post.id}", :name => "commit"
|
= submit_tag 'comment', :id => "comment_submit_#{post.id}", :name => "commit"
|
||||||
|
|
|
||||||
|
|
@ -3,3 +3,5 @@
|
||||||
%ul#stream
|
%ul#stream
|
||||||
- for post in @posts
|
- for post in @posts
|
||||||
= render type_partial(post), :post => post
|
= render type_partial(post), :post => post
|
||||||
|
#pagination
|
||||||
|
= will_paginate @posts
|
||||||
|
|
@ -14,3 +14,6 @@
|
||||||
%td= link_to 'Destroy', friend, :confirm => 'Are you sure?', :method => :delete
|
%td= link_to 'Destroy', friend, :confirm => 'Are you sure?', :method => :delete
|
||||||
|
|
||||||
%p= link_to "New Friend", new_friend_path
|
%p= link_to "New Friend", new_friend_path
|
||||||
|
|
||||||
|
#pagination
|
||||||
|
= will_paginate @friends
|
||||||
|
|
|
||||||
27
app/views/layouts/session_wall.html.haml
Normal file
27
app/views/layouts/session_wall.html.haml
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
!!!
|
||||||
|
%html
|
||||||
|
%head
|
||||||
|
%title
|
||||||
|
= "diaspora"
|
||||||
|
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
|
||||||
|
%meta{"http-equiv"=> "X-UA-Compatible", :content =>"chrome=1" }
|
||||||
|
|
||||||
|
= stylesheet_link_tag "blueprint/screen", :media => 'screen'
|
||||||
|
= stylesheet_link_tag "sessions"
|
||||||
|
/= javascript_include_tag"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
|
||||||
|
= javascript_include_tag 'jquery142'
|
||||||
|
|
||||||
|
= csrf_meta_tag
|
||||||
|
= yield(:head)
|
||||||
|
|
||||||
|
%body
|
||||||
|
.container
|
||||||
|
- flash.each do |name, msg|
|
||||||
|
= content_tag :div, msg, :id => "flash_#{name}"
|
||||||
|
|
||||||
|
%div#huge_text
|
||||||
|
welcome back,
|
||||||
|
%span
|
||||||
|
= User.first.real_name.downcase
|
||||||
|
|
||||||
|
= yield
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
%span.from
|
%span.from
|
||||||
= link_to_person post.person
|
= link_to_person post.person
|
||||||
= post.message
|
= post.message
|
||||||
|
|
||||||
|
- if mine?(post)
|
||||||
|
.destroy_link
|
||||||
|
= link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete
|
||||||
|
|
||||||
%div.time
|
%div.time
|
||||||
= link_to(how_long_ago(post), status_message_path(post))
|
= link_to(how_long_ago(post), status_message_path(post))
|
||||||
= render "comments/comments", :post => post
|
= render "comments/comments", :post => post
|
||||||
- if mine?(post)
|
|
||||||
= link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,6 @@
|
||||||
|
|
||||||
- for status_message in @status_messages
|
- for status_message in @status_messages
|
||||||
= render "status_message", :post => status_message
|
= render "status_message", :post => status_message
|
||||||
|
#pagination
|
||||||
|
= will_paginate @status_messages
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,14 @@ module WebSocket
|
||||||
EM.add_timer(0.1) do
|
EM.add_timer(0.1) do
|
||||||
@channel = EM::Channel.new
|
@channel = EM::Channel.new
|
||||||
puts @channel.inspect
|
puts @channel.inspect
|
||||||
|
|
||||||
|
#this should really be a controller
|
||||||
@view = ActionView::Base.new(ActionController::Base.view_paths, {})
|
@view = ActionView::Base.new(ActionController::Base.view_paths, {})
|
||||||
|
|
||||||
class << @view
|
class << @view
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
include Rails.application.routes.url_helpers
|
include Rails.application.routes.url_helpers
|
||||||
include ActionController::RequestForgeryProtection::ClassMethods
|
include ActionController::RequestForgeryProtection::ClassMethods
|
||||||
include ActionView::Helpers::FormTagHelper
|
|
||||||
include ActionView::Helpers::UrlHelper
|
|
||||||
def protect_against_forgery?
|
def protect_against_forgery?
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ Diaspora::Application.routes.draw do |map|
|
||||||
resources :comments
|
resources :comments
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#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
|
||||||
devise_for :users, :path_names => {:sign_up => "signup", :sign_in => "login", :sign_out => "logout"}
|
devise_for :users, :path_names => {:sign_up => "signup", :sign_in => "login", :sign_out => "logout"}
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,12 @@ $(document).ready(function(){
|
||||||
|
|
||||||
$('#bookmark_link').click(clearForm);
|
$('#bookmark_link').click(clearForm);
|
||||||
$('#debug_more').hide();
|
$('#debug_more').hide();
|
||||||
|
$(":text").click(clearForm);
|
||||||
|
|
||||||
function clearForm(){
|
function clearForm(){
|
||||||
|
var text = $(this).text()
|
||||||
$(this).val("");
|
$(this).val("");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#debug_info').click(function() {
|
$('#debug_info').click(function() {
|
||||||
|
|
|
||||||
|
|
@ -203,3 +203,12 @@ ul.comment_set {
|
||||||
|
|
||||||
img#profile_picture {
|
img#profile_picture {
|
||||||
width: 100%; }
|
width: 100%; }
|
||||||
|
|
||||||
|
.pagination a {
|
||||||
|
padding: 3px; }
|
||||||
|
|
||||||
|
.destroy_link {
|
||||||
|
float: right; }
|
||||||
|
|
||||||
|
#debug_info {
|
||||||
|
margin-top: 20px; }
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,12 @@ ul.comment_set
|
||||||
img#profile_picture
|
img#profile_picture
|
||||||
:width 100%
|
:width 100%
|
||||||
|
|
||||||
|
.pagination
|
||||||
|
a
|
||||||
|
:padding 3px
|
||||||
|
|
||||||
|
.destroy_link
|
||||||
|
:float right
|
||||||
|
|
||||||
|
#debug_info
|
||||||
|
:margin-top 20px
|
||||||
|
|
|
||||||
34
public/stylesheets/sass/sessions.sass
Normal file
34
public/stylesheets/sass/sessions.sass
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
body
|
||||||
|
:padding 2em
|
||||||
|
|
||||||
|
#huge_text
|
||||||
|
:margin
|
||||||
|
:top 10%
|
||||||
|
:display inline block
|
||||||
|
:font
|
||||||
|
:size 40px
|
||||||
|
:weight bold
|
||||||
|
:line-height 120px
|
||||||
|
:letter
|
||||||
|
:spacing -2px
|
||||||
|
:color #eaeaea
|
||||||
|
:text-shadow 0 1px 1px #999
|
||||||
|
|
||||||
|
span
|
||||||
|
:display inline
|
||||||
|
:color #666
|
||||||
|
|
||||||
|
input
|
||||||
|
:font
|
||||||
|
:size 30px
|
||||||
|
:text
|
||||||
|
:align center
|
||||||
|
:width 300px
|
||||||
|
:margin
|
||||||
|
:bottom 0
|
||||||
|
:top 0
|
||||||
|
|
||||||
|
.container
|
||||||
|
:top 30%
|
||||||
|
:text
|
||||||
|
:align center
|
||||||
26
public/stylesheets/sessions.css
Normal file
26
public/stylesheets/sessions.css
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
body {
|
||||||
|
padding: 2em; }
|
||||||
|
|
||||||
|
#huge_text {
|
||||||
|
margin-top: 10%;
|
||||||
|
display: inline block;
|
||||||
|
font-size: 40px;
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 120px;
|
||||||
|
letter-spacing: -2px;
|
||||||
|
color: #eaeaea;
|
||||||
|
text-shadow: 0 1px 1px #999999; }
|
||||||
|
#huge_text span {
|
||||||
|
display: inline;
|
||||||
|
color: #666666; }
|
||||||
|
|
||||||
|
input {
|
||||||
|
font-size: 30px;
|
||||||
|
text-align: center;
|
||||||
|
width: 300px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
margin-top: 0; }
|
||||||
|
|
||||||
|
.container {
|
||||||
|
top: 30%;
|
||||||
|
text-align: center; }
|
||||||
19
spec/lib/web_socket_spec.rb
Normal file
19
spec/lib/web_socket_spec.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
require File.dirname(__FILE__) + '/../spec_helper'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
describe WebSocket do
|
||||||
|
it 'should prepare a view along with an objects class in json' do
|
||||||
|
|
||||||
|
EventMachine.run {
|
||||||
|
include WebSocket
|
||||||
|
user = Factory.create(:user)
|
||||||
|
post = Factory.create(:status_message)
|
||||||
|
|
||||||
|
json = WebSocket.view_hash(post)
|
||||||
|
json.should include post.message
|
||||||
|
|
||||||
|
EventMachine.stop
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue