Move Javascript to the asset pipeline
* Move all Diaspora-specific javascripts to app/assets/javascripts * Move all vendored javascripts to vendor/assets/javascripts * Add the appropriate Sprockets require directives to make sure everything gets included in the right order * Remove Jammit dependencies * Fix all templates that were using Jammit's include_javascripts helper * Add handlebars_assets gem for compiling Handlebars templates * Move all Handlebars templates to app/assets/templates and rename from .handlebars to .jst.hbs (this is to keep them in the same global JST namespace that they were in under Jammit) * Add public/assets to .gitignore since these files can and should be re-generated by Heroku or Capistrano during each deploy * Fix a few Handlebars templates that were looking for images in the wrong location (I'm sure there are others, but it's late) * Configure application.rb to precompile all javascript and css assets that were compiled by Jammit in the Rails 3.0 code
This commit is contained in:
parent
9dffb426d4
commit
1aa0b15c8c
175 changed files with 213 additions and 102 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -66,3 +66,7 @@ dump.rdb
|
|||
|
||||
#Rubinius's JIT
|
||||
*.rbc
|
||||
|
||||
# Ignore precompiled assets
|
||||
# Heroku or Capistrano can and should regenerate them on every deploy
|
||||
public/assets
|
||||
|
|
|
|||
3
Gemfile
3
Gemfile
|
|
@ -64,8 +64,6 @@ gem 'fastercsv', '1.5.4', :require => false
|
|||
gem 'mini_magick', '3.4'
|
||||
gem 'rest-client', '1.6.7'
|
||||
|
||||
gem 'jammit-s3'
|
||||
|
||||
# JSON and API
|
||||
|
||||
gem 'json'
|
||||
|
|
@ -113,6 +111,7 @@ group :assets do
|
|||
gem 'sass-rails'
|
||||
gem 'uglifier'
|
||||
end
|
||||
gem 'handlebars_assets'
|
||||
|
||||
gem 'jquery-rails'
|
||||
|
||||
|
|
|
|||
23
Gemfile.lock
23
Gemfile.lock
|
|
@ -37,10 +37,6 @@ GIT
|
|||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
POpen4 (0.1.4)
|
||||
Platform (>= 0.4.0)
|
||||
open4
|
||||
Platform (0.4.0)
|
||||
SystemTimer (1.2.3)
|
||||
actionmailer (3.1.4)
|
||||
actionpack (= 3.1.4)
|
||||
|
|
@ -188,6 +184,10 @@ GEM
|
|||
gherkin (2.9.1)
|
||||
json (>= 1.4.6)
|
||||
haml (3.1.4)
|
||||
handlebars_assets (0.4.1)
|
||||
execjs (>= 1.2.9)
|
||||
sprockets (>= 2.0.3)
|
||||
tilt
|
||||
hashie (1.2.0)
|
||||
heroku (2.23.0)
|
||||
launchy (>= 0.3.2)
|
||||
|
|
@ -209,12 +209,6 @@ GEM
|
|||
actionpack (~> 3.0)
|
||||
i18n-inflector (~> 2.6)
|
||||
railties (~> 3.0)
|
||||
jammit (0.6.5)
|
||||
yui-compressor (>= 0.9.3)
|
||||
jammit-s3 (0.6.0.2)
|
||||
jammit (>= 0.5.4)
|
||||
mimemagic (>= 0.1.7)
|
||||
s3 (>= 0.3.7)
|
||||
jasmine (1.1.2)
|
||||
jasmine-core (>= 1.1.0)
|
||||
rack (>= 1.1)
|
||||
|
|
@ -245,7 +239,6 @@ GEM
|
|||
treetop (~> 1.4.8)
|
||||
messagebus_ruby_api (1.0.3)
|
||||
mime-types (1.18)
|
||||
mimemagic (0.1.8)
|
||||
mini_magick (3.4)
|
||||
subexec (~> 0.2.1)
|
||||
mobile-fu (1.0.0)
|
||||
|
|
@ -295,14 +288,12 @@ GEM
|
|||
omniauth-oauth (~> 1.0)
|
||||
omniauth-twitter (0.0.8)
|
||||
omniauth-oauth (~> 1.0)
|
||||
open4 (1.3.0)
|
||||
orm_adapter (0.0.6)
|
||||
parallel (0.5.16)
|
||||
parallel_tests (0.7.2)
|
||||
parallel
|
||||
pg (0.13.2)
|
||||
polyglot (0.3.3)
|
||||
proxies (0.2.1)
|
||||
rack (1.3.6)
|
||||
rack-cache (1.2)
|
||||
rack (>= 0.4)
|
||||
|
|
@ -396,8 +387,6 @@ GEM
|
|||
ruby_core_source (0.1.5)
|
||||
archive-tar-minitar (>= 0.5.2)
|
||||
rubyzip (0.9.6.1)
|
||||
s3 (0.3.11)
|
||||
proxies (~> 0.2.0)
|
||||
sass (3.1.15)
|
||||
sass-rails (3.1.6)
|
||||
actionpack (~> 3.1.0)
|
||||
|
|
@ -460,8 +449,6 @@ GEM
|
|||
xpath (0.1.4)
|
||||
nokogiri (~> 1.3)
|
||||
yard (0.7.5)
|
||||
yui-compressor (0.9.6)
|
||||
POpen4 (>= 0.1.4)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
|
@ -497,11 +484,11 @@ DEPENDENCIES
|
|||
foreman (= 0.34.1)
|
||||
fuubar (= 0.0.6)
|
||||
haml
|
||||
handlebars_assets
|
||||
heroku
|
||||
heroku_san
|
||||
http_accept_language (~> 1.0.2)
|
||||
i18n-inflector-rails (~> 1.0)
|
||||
jammit-s3
|
||||
jasmine (~> 1.1.2)
|
||||
jquery-rails
|
||||
json
|
||||
|
|
|
|||
|
|
@ -1,3 +1,11 @@
|
|||
//= require_self
|
||||
//= require_tree ./helpers
|
||||
//= require ./router
|
||||
//= require ./views
|
||||
//= require_tree ./models
|
||||
//= require_tree ./pages
|
||||
//= require_tree ./collections
|
||||
//= require_tree ./views
|
||||
var app = {
|
||||
collections: {},
|
||||
models: {},
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
//= require ../collections/posts
|
||||
app.models.Stream = Backbone.Collection.extend({
|
||||
initialize : function(){
|
||||
this.posts = new app.collections.Posts([], this.postOptions());
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
//= require ./content_view
|
||||
app.views.Comment = app.views.Content.extend({
|
||||
|
||||
templateName: "comment",
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
//= require ./stream_object_view
|
||||
app.views.Content = app.views.StreamObject.extend({
|
||||
|
||||
events: {
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
//= require ./stream_object_view
|
||||
app.views.LikesInfo = app.views.StreamObject.extend({
|
||||
|
||||
templateName : "likes-info",
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
//= require ./stream_object_view
|
||||
app.views.Photo = app.views.StreamObject.extend({
|
||||
|
||||
templateName: "photo",
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
//= require ../feedback_view
|
||||
app.views.PostViewerFeedback = app.views.Feedback.extend({
|
||||
|
||||
id : "user-controls",
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
//= require ./stream_object_view
|
||||
app.views.Post = app.views.StreamObject.extend({
|
||||
presenter : function() {
|
||||
return _.extend(this.defaultPresenter(), {
|
||||
|
|
@ -41,4 +42,4 @@ app.views.Post.Legacy = app.views.Post.extend({
|
|||
initialize : function(options) {
|
||||
this.templateName = options.templateName || this.templateName
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
|
||||
function toggleAspectTitle(){
|
||||
$("#aspect_name_title").toggleClass('hidden');
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#aspect_nav.left_nav .all_aspects .sub_nav').sortable({
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
|
||||
var List = {
|
||||
initialize: function() {
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var Diaspora = {
|
||||
5
app/assets/javascripts/finder.js
Normal file
5
app/assets/javascripts/finder.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
//= require friend-finder
|
||||
8
app/assets/javascripts/home.js
Normal file
8
app/assets/javascripts/home.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
//= require publisher
|
||||
//= require jquery.textchange.min
|
||||
//= require aspect-edit-pane
|
||||
//= require fileuploader-custom
|
||||
|
|
@ -1,3 +1,2 @@
|
|||
document.createElement('header');
|
||||
document.createElement('footer');
|
||||
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
//= require jquery.autoSuggest.custom
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
jQuery.fn.center = function () {
|
||||
this.css("position","absolute");
|
||||
this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
|
||||
3
app/assets/javascripts/mailchimp.js
Normal file
3
app/assets/javascripts/mailchimp.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
//= require mailchimp/jquery.form
|
||||
//= require mailchimp/jquery.validate
|
||||
//= require mailchimp/jquery126.min
|
||||
37
app/assets/javascripts/main.js
Normal file
37
app/assets/javascripts/main.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
//= require rails.validations
|
||||
//= require jquery.hotkeys
|
||||
//= require jquery.autoresize
|
||||
//= require jquery-ui-1.8.9.custom.min
|
||||
//= require jquery.charcount
|
||||
//= require jquery.placeholder
|
||||
//= require timeago
|
||||
//= require facebox
|
||||
//= require underscore
|
||||
//= require jquery.events.input
|
||||
//= require jquery.elastic
|
||||
//= require jquery.mentionsInput
|
||||
//= require jquery.idle-timer
|
||||
//= require jquery.infinitescroll-custom
|
||||
//= require jquery.autocomplete-custom
|
||||
//= require keycodes
|
||||
//= require fileuploader-custom
|
||||
//= require backbone
|
||||
//= require handlebars-1.0.0.beta.6
|
||||
//= require markdown
|
||||
//= require app/app
|
||||
//= require diaspora
|
||||
//= require_tree ./helpers
|
||||
//= require_tree ./pages
|
||||
//= require_tree ./widgets
|
||||
//= require view
|
||||
//= require aspects-dropdown
|
||||
//= require contact-edit
|
||||
//= require contact-list
|
||||
//= require aspect-sorting
|
||||
//= require mentions
|
||||
//= require bootstrap/bootstrap-twipsy
|
||||
//= require bootstrap/bootstrap-popover
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
//= require jquery.charcount
|
||||
//= require mbp-helper
|
||||
$(document).ready(function(){
|
||||
|
||||
$('.shield a').click(function(){
|
||||
7
app/assets/javascripts/people.js
Normal file
7
app/assets/javascripts/people.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
//= require aspect-edit-pane
|
||||
//= require fileuploader-custom
|
||||
//= require jquery.autoSuggest.custom
|
||||
5
app/assets/javascripts/photos.js
Normal file
5
app/assets/javascripts/photos.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
//= require photo-show
|
||||
5
app/assets/javascripts/profile.js
Normal file
5
app/assets/javascripts/profile.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
//= require jquery.autoSuggest.custom
|
||||
5
app/assets/javascripts/templates.js
Normal file
5
app/assets/javascripts/templates.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
//= require_tree ../templates
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/* Copyright (c) 2010-2011, Diaspora Inc. This file is
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
* licensed under the Affero General Public License version 3 or later. See
|
||||
* the COPYRIGHT file.
|
||||
*/
|
||||
var View = {
|
||||
initialize: function() {
|
||||
/* Buttons */
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
@import 'vendor/bootstrap.css'
|
||||
@import 'vendor/bootstrap-responsive.css'
|
||||
@import 'vendor/bootstrap.css';
|
||||
@import 'vendor/bootstrap-responsive.css';
|
||||
@import "_mixins.css.scss";
|
||||
|
||||
$blue: #3f8fba;
|
||||
|
|
|
|||
4
app/assets/templates/all.js
Normal file
4
app/assets/templates/all.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// Workaround to keep "app/templates" out of the template names
|
||||
// All templates will remain in the JST namespace just as they were
|
||||
// when we were using Jammit
|
||||
//= require_tree .
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="comment">
|
||||
<div class="media">
|
||||
<span class="img">
|
||||
<img alt="Heart" src="{{imageUrl "heart.png"}}" />
|
||||
<img alt="Heart" src="{{imageUrl "icons/heart.png"}}" />
|
||||
</span>
|
||||
|
||||
<div class="bd">
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue