serialize current user json into body tag for now
This commit is contained in:
parent
19db5519c0
commit
176963fdad
6 changed files with 10 additions and 5 deletions
|
|
@ -11,7 +11,7 @@ class Aspect < ActiveRecord::Base
|
|||
has_many :aspect_visibilities
|
||||
has_many :posts, :through => :aspect_visibilities, :source => :shareable, :source_type => 'Post'
|
||||
has_many :photos, :through => :aspect_visibilities, :source => :shareable, :source_type => 'Photo'
|
||||
|
||||
|
||||
validates :name, :presence => true, :length => { :maximum => 20 }
|
||||
|
||||
validates_uniqueness_of :name, :scope => :user_id, :case_sensitive => false
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class Comment < ActiveRecord::Base
|
|||
t.add :id
|
||||
t.add :guid
|
||||
t.add :text
|
||||
t.add :author, :template => :post
|
||||
t.add :author
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class Person < ActiveRecord::Base
|
|||
|
||||
# NOTE API V1 to be extracted
|
||||
acts_as_api
|
||||
api_accessible :post do |t|
|
||||
api_accessible :backbone do |t|
|
||||
t.add :id
|
||||
t.add :name
|
||||
t.add lambda { |person|
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class Post < ActiveRecord::Base
|
|||
t.add :comments_count
|
||||
t.add :last_three_comments
|
||||
t.add :provider_display_name
|
||||
t.add :author, :template => :post
|
||||
t.add :author
|
||||
end
|
||||
|
||||
xml_attr :provider_display_name
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
- if @person
|
||||
%link{:rel => "alternate", :href => "#{@person.public_url}.atom", :type => "application/atom+xml", :title => "#{t('.public_feed', :name => @person.name)}"}
|
||||
|
||||
%body{:class => "#{yield(:body_class)}"}
|
||||
%body{:class => "#{yield(:body_class)}", 'data-current-user-metadata' => CGI::escape(current_user.person.as_api_response(:backbone).to_json) }
|
||||
|
||||
- unless @page == :logged_out
|
||||
- flash.each do |name, msg|
|
||||
|
|
|
|||
|
|
@ -2,5 +2,10 @@ var Post = Backbone.Model.extend({
|
|||
url: "/posts/:id",
|
||||
intTime: function(){
|
||||
return +new Date(this.get("created_at")) / 1000;
|
||||
},
|
||||
|
||||
// should be moved into the view or something?
|
||||
currentUserJSON: function(){
|
||||
return $.parseJSON(unescape($("body").data("current-user-metadata")));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue