Skip to content
Extraits de code Groupes Projets
Valider 9947a2ab rédigé par Raphael's avatar Raphael
Parcourir les fichiers

RS, DG; latest_status thing now works, started putting signup back in

parent a48fbaaf
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -19,7 +19,7 @@ class ApplicationController < ActionController::Base ...@@ -19,7 +19,7 @@ class ApplicationController < ActionController::Base
if current_user if current_user
@groups = current_user.groups @groups = current_user.groups
@friends = current_user.friends @friends = current_user.friends
@latest_status_message = StatusMessage.newest_for(current_user) @latest_status_message = StatusMessage.newest_for(current_user.person)
@group = params[:group] ? current_user.groups.first(:id => params[:group]) : current_user.groups.first @group = params[:group] ? current_user.groups.first(:id => params[:group]) : current_user.groups.first
end end
end end
......
...@@ -25,4 +25,20 @@ class UsersController < ApplicationController ...@@ -25,4 +25,20 @@ class UsersController < ApplicationController
render :action => 'edit' render :action => 'edit'
end end
end end
def create
@user = User.new(params[:user])
if @user.save!
flash[:notice] = "Successfully signed up."
redirect_to root_path
else
render :action => 'new'
end
end
def new
@user = User.new
end
end end
...@@ -23,6 +23,7 @@ module SocketsHelper ...@@ -23,6 +23,7 @@ module SocketsHelper
action_hash[:photo_hash] = object.thumb_hash action_hash[:photo_hash] = object.thumb_hash
elsif object.is_a? StatusMessage elsif object.is_a? StatusMessage
action_hash[:status_message_hash] = object.latest_hash action_hash[:status_message_hash] = object.latest_hash
action_hash[:status_message_hash][:mine?] = true if object.person.owner_id == uid
end end
action_hash.to_json action_hash.to_json
......
...@@ -22,7 +22,7 @@ class StatusMessage < Post ...@@ -22,7 +22,7 @@ class StatusMessage < Post
end end
def latest_hash def latest_hash
{:mine? => self.person == User.owner, :text => message} { :text => message}
end end
end end
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
function processStatusMessage(className, html, messageHash){ function processStatusMessage(className, html, messageHash){
processPost(className, html); processPost(className, html);
console.log(messageHash)
if(messageHash['mine?']){ if(messageHash['mine?']){
updateMyLatestStatus(messageHash); updateMyLatestStatus(messageHash);
} }
......
...@@ -52,9 +52,9 @@ ...@@ -52,9 +52,9 @@
= link_to current_user.real_name, root_path = link_to current_user.real_name, root_path
%span#latest_message %span#latest_message
= my_latest_message = my_latest_message
- unless @latest_status_message.nil? %span{:style => "font-size: small", :id => 'latest_message_time'}
%span{:style => "font-size: small", :id => 'latest_message_time'} - unless @latest_status_message.nil?
= " - #{how_long_ago @latest_status_message}" = "- #{how_long_ago @latest_status_message}"
%ul.nav %ul.nav
%li= link_to "home", root_path %li= link_to "home", root_path
......
...@@ -44,14 +44,8 @@ ...@@ -44,14 +44,8 @@
- flash.each do |name, msg| - flash.each do |name, msg|
= content_tag :div, msg, :id => "flash_#{name}" = content_tag :div, msg, :id => "flash_#{name}"
- if User.owner %div#huge_text
%div#huge_text diaspora
welcome back, = yield
%span
= User.owner.real_name.downcase = link_to "signup", "/signup"
= yield
-else
%div#huge_text
%span
you need to add a user first!
...@@ -12,21 +12,20 @@ Diaspora::Application.routes.draw do |map| ...@@ -12,21 +12,20 @@ Diaspora::Application.routes.draw do |map|
match "/images/files/*path" => "gridfs#serve" match "/images/files/*path" => "gridfs#serve"
match 'warzombie', :to => "dev_utilities#warzombie" match 'warzombie', :to => "dev_utilities#warzombie"
match 'zombiefriends', :to => "dev_utilities#zombiefriends" match 'zombiefriends', :to => "dev_utilities#zombiefriends"
match 'zombiefriendaccept', :to => "dev_utilities#zombiefriendaccept" match 'zombiefriendaccept', :to => "dev_utilities#zombiefriendaccept"
#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"}
match 'login', :to => 'devise/sessions#new', :as => "new_user_session" match 'login', :to => 'devise/sessions#new', :as => "new_user_session"
match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session" match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session"
#match 'signup', :to => 'devise/registrations#new', :as => "new_user_registration" match 'signup', :to => 'devise/registrations#new', :as => "new_user_registration"
resources :users
#public routes #public routes
match 'receive/users/:id', :to => 'publics#receive' match 'receive/users/:id', :to => 'publics#receive'
match '.well-known/host-meta',:to => 'publics#host_meta' match '.well-known/host-meta',:to => 'publics#host_meta'
match 'webfinger', :to => 'publics#webfinger' match 'webfinger', :to => 'publics#webfinger'
match 'hcard', :to => 'publics#hcard' match 'hcard', :to => 'publics#hcard'
......
$(document).ready( function() { $(document).ready( function() {
$("#publisher_content_pickers .status_message").click(selectPublisherTab); $("#publisher_content_pickers .status_message").click(selectPublisherTab);
$("#publisher_content_pickers .bookmark").click(selectPublisherTab); $("#publisher_content_pickers .bookmark").click(selectPublisherTab);
$("#publisher_content_pickers .blog").click(selectPublisherTab); $("#publisher_content_pickers .blog").click(selectPublisherTab);
$("#publisher_content_pickers .photo").click(selectPublisherTab); $("#publisher_content_pickers .photo").click(selectPublisherTab);
$("#new_status_message").submit(function() {
});
function selectPublisherTab(evt){ function selectPublisherTab(evt){
evt.preventDefault(); evt.preventDefault();
var form_id = "#new_" + this.className var form_id = "#new_" + this.className
if( $(form_id).css("display") == "none" ) { if( $(form_id).css("display") == "none" ) {
$("#publisher_content_pickers").children("li").removeClass("selected"); $("#publisher_content_pickers").children("li").removeClass("selected");
$("#publisher_form form").fadeOut(50); $("#publisher_form form").fadeOut(50);
$(this).toggleClass("selected"); $(this).toggleClass("selected");
$(form_id).delay(50).fadeIn(200); $(form_id).delay(50).fadeIn(200);
}
} }
}
}); });
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