From 42276a73c8f228922e3310febfde514455b83e9f Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Thu, 29 Dec 2011 14:15:09 -0500 Subject: [PATCH] remove old stream initialization from js pages; remove websocket js code from the layout; rename templates to have a .jst extension (JavaScriptTemplate?) --- app/views/layouts/application.html.haml | 4 ++ app/views/templates/_templates.haml | 41 ++++++------------- ...s-photo.ujs => activity_streams_photo.jst} | 0 .../templates/{comment.ujs => comment.jst} | 0 ...{comment_stream.ujs => comment_stream.jst} | 0 .../templates/{feedback.ujs => feedback.jst} | 0 .../templates/{header.ujs => header.jst} | 0 .../{likes_info.ujs => likes_info.jst} | 0 .../templates/{reshare.ujs => reshare.jst} | 0 .../{static_text.ujs => static_text.jst} | 0 ...{status_message.ujs => status_message.jst} | 0 ...{stream_element.ujs => stream_element.jst} | 0 config/assets.yml | 6 +-- public/javascripts/pages/aspects-index.js | 2 - .../javascripts/pages/comment-stream-index.js | 3 -- public/javascripts/pages/contacts-index.js | 1 - public/javascripts/pages/like-stream-index.js | 3 -- public/javascripts/pages/posts-index.js | 3 -- 18 files changed, 19 insertions(+), 44 deletions(-) rename app/views/templates/{activity-streams-photo.ujs => activity_streams_photo.jst} (100%) rename app/views/templates/{comment.ujs => comment.jst} (100%) rename app/views/templates/{comment_stream.ujs => comment_stream.jst} (100%) rename app/views/templates/{feedback.ujs => feedback.jst} (100%) rename app/views/templates/{header.ujs => header.jst} (100%) rename app/views/templates/{likes_info.ujs => likes_info.jst} (100%) rename app/views/templates/{reshare.ujs => reshare.jst} (100%) rename app/views/templates/{static_text.ujs => static_text.jst} (100%) rename app/views/templates/{status_message.ujs => status_message.jst} (100%) rename app/views/templates/{stream_element.ujs => stream_element.jst} (100%) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index afd83b8b5..7a3a18498 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -61,6 +61,10 @@ - unless @landing_page = include_javascripts :main :javascript + Diaspora.I18n.loadLocale(#{get_javascript_strings_for(I18n.locale).to_json}, "#{I18n.locale}"); + Diaspora.Page = "#{params[:controller].camelcase}#{params[:action].camelcase}"; + + - if current_user app.user({ current_user: #{current_user.person.as_api_response(:backbone).to_json} }); diff --git a/app/views/templates/_templates.haml b/app/views/templates/_templates.haml index 848b28618..00064d3f8 100644 --- a/app/views/templates/_templates.haml +++ b/app/views/templates/_templates.haml @@ -2,33 +2,16 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. -%script{:id => "header-template", :type => 'text/template'} - != File.read("#{Rails.root}/app/views/templates/header.ujs") - -%script{:id => "feedback-template", :type => 'text/template'} - != File.read("#{Rails.root}/app/views/templates/feedback.ujs") - -%script{:id => "static-text-template", :type => 'text/template'} - != File.read("#{Rails.root}/app/views/templates/static_text.ujs") - -%script{:id => "stream-element-template", :type => 'text/template'} - != File.read("#{Rails.root}/app/views/templates/stream_element.ujs") - -%script{:id => "comment-template", :type => 'text/template'} - != File.read("#{Rails.root}/app/views/templates/comment.ujs") - -%script{:id => "comment-stream-template", :type => 'text/template'} - != File.read("#{Rails.root}/app/views/templates/comment_stream.ujs") - -%script{:id => "status-message-template", :type => 'text/template'} - != File.read("#{Rails.root}/app/views/templates/status_message.ujs") - -%script{:id => "reshare-template", :type => 'text/template'} - != File.read("#{Rails.root}/app/views/templates/reshare.ujs") - -%script{:id => "activity-streams-photo-template", :type => 'text/template'} - != File.read("#{Rails.root}/app/views/templates/activity-streams-photo.ujs") - -%script{:id => "likes-info-template", :type => 'text/template'} - != File.read("#{Rails.root}/app/views/templates/likes_info.ujs") +- ["header", + "feedback", + "static_text", + "stream_element", + "comment_stream", + "comment", + "status_message", + "activity_streams_photo", + "reshare", + "likes_info"].each do |template_name| + %script{:id => "#{template_name.gsub("_","-")}-template", :type => 'text/template'} + != File.read("#{Rails.root}/app/views/templates/#{template_name}.jst") diff --git a/app/views/templates/activity-streams-photo.ujs b/app/views/templates/activity_streams_photo.jst similarity index 100% rename from app/views/templates/activity-streams-photo.ujs rename to app/views/templates/activity_streams_photo.jst diff --git a/app/views/templates/comment.ujs b/app/views/templates/comment.jst similarity index 100% rename from app/views/templates/comment.ujs rename to app/views/templates/comment.jst diff --git a/app/views/templates/comment_stream.ujs b/app/views/templates/comment_stream.jst similarity index 100% rename from app/views/templates/comment_stream.ujs rename to app/views/templates/comment_stream.jst diff --git a/app/views/templates/feedback.ujs b/app/views/templates/feedback.jst similarity index 100% rename from app/views/templates/feedback.ujs rename to app/views/templates/feedback.jst diff --git a/app/views/templates/header.ujs b/app/views/templates/header.jst similarity index 100% rename from app/views/templates/header.ujs rename to app/views/templates/header.jst diff --git a/app/views/templates/likes_info.ujs b/app/views/templates/likes_info.jst similarity index 100% rename from app/views/templates/likes_info.ujs rename to app/views/templates/likes_info.jst diff --git a/app/views/templates/reshare.ujs b/app/views/templates/reshare.jst similarity index 100% rename from app/views/templates/reshare.ujs rename to app/views/templates/reshare.jst diff --git a/app/views/templates/static_text.ujs b/app/views/templates/static_text.jst similarity index 100% rename from app/views/templates/static_text.ujs rename to app/views/templates/static_text.jst diff --git a/app/views/templates/status_message.ujs b/app/views/templates/status_message.jst similarity index 100% rename from app/views/templates/status_message.ujs rename to app/views/templates/status_message.jst diff --git a/app/views/templates/stream_element.ujs b/app/views/templates/stream_element.jst similarity index 100% rename from app/views/templates/stream_element.ujs rename to app/views/templates/stream_element.jst diff --git a/config/assets.yml b/config/assets.yml index 5baa8f0db..51b6a9920 100644 --- a/config/assets.yml +++ b/config/assets.yml @@ -5,9 +5,9 @@ gzip_assets: off javascripts: flash_socket: - - public/javascripts/vendor/FABridge.js - - public/javascripts/vendor/swfobject.js - - public/javascripts/vendor/web_socket.js + #- public/javascripts/vendor/FABridge.js + #- public/javascripts/vendor/swfobject.js + #- public/javascripts/vendor/web_socket.js jquery: - public/javascripts/vendor/jquery-1.7.1.min.js diff --git a/public/javascripts/pages/aspects-index.js b/public/javascripts/pages/aspects-index.js index 5b4b605fd..c25257759 100644 --- a/public/javascripts/pages/aspects-index.js +++ b/public/javascripts/pages/aspects-index.js @@ -3,7 +3,5 @@ Diaspora.Pages.AspectsIndex = function() { this.subscribe("page/ready", function(evt, document) { self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav")); - self.stream = self.instantiate("Stream", document.find("#aspect_stream_container")); - self.infiniteScroll = self.instantiate("InfiniteScroll"); }); }; diff --git a/public/javascripts/pages/comment-stream-index.js b/public/javascripts/pages/comment-stream-index.js index b637f0bf5..df368289b 100644 --- a/public/javascripts/pages/comment-stream-index.js +++ b/public/javascripts/pages/comment-stream-index.js @@ -2,10 +2,7 @@ Diaspora.Pages.CommentStreamIndex = function() { var self = this; this.subscribe("page/ready", function(evt, document) { - self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav")); - self.stream = self.instantiate("Stream", document.find("#aspect_stream_container")); - self.infiniteScroll = self.instantiate("InfiniteScroll"); }); }; diff --git a/public/javascripts/pages/contacts-index.js b/public/javascripts/pages/contacts-index.js index e036172a3..0e915097a 100644 --- a/public/javascripts/pages/contacts-index.js +++ b/public/javascripts/pages/contacts-index.js @@ -3,7 +3,6 @@ Diaspora.Pages.ContactsIndex = function() { this.subscribe("page/ready", function(evt, document) { self.infiniteScroll = self.instantiate("InfiniteScroll"); - $('.conversation_button').twipsy({position: 'below'}); }); }; diff --git a/public/javascripts/pages/like-stream-index.js b/public/javascripts/pages/like-stream-index.js index 6c63b58f5..382f11000 100644 --- a/public/javascripts/pages/like-stream-index.js +++ b/public/javascripts/pages/like-stream-index.js @@ -2,9 +2,6 @@ Diaspora.Pages.LikeStreamIndex = function() { var self = this; this.subscribe("page/ready", function(evt, document) { - self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav")); - self.stream = self.instantiate("Stream", document.find("#aspect_stream_container")); - self.infiniteScroll = self.instantiate("InfiniteScroll"); }); }; diff --git a/public/javascripts/pages/posts-index.js b/public/javascripts/pages/posts-index.js index 90b8ca09a..c6e1b3165 100644 --- a/public/javascripts/pages/posts-index.js +++ b/public/javascripts/pages/posts-index.js @@ -2,9 +2,6 @@ Diaspora.Pages.PostsIndex = function() { var self = this; this.subscribe("page/ready", function(evt, document) { - self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav")); - self.stream = self.instantiate("Stream", document.find("#aspect_stream_container")); - self.infiniteScroll = self.instantiate("InfiniteScroll"); }); };