Commit 31d33054 authored by maxwell's avatar maxwell

added jammit, now js and css compress for production

parent 3db8da99
......@@ -14,6 +14,7 @@ public/stylesheets/ui.css
# Uploded files and local files
public/uploads/*
public/assets/*
public/source.tar*
tmp/**/*
db/*.sqlite3
......
......@@ -46,7 +46,7 @@ gem 'carrierwave', :git => 'git://github.com/rsofaer/carrierwave.git' , :branch
gem 'mini_magick'
gem 'aws'
gem 'fastercsv', :require => false
gem 'jammit'
group :test, :development do
gem 'factory_girl_rails'
gem 'ruby-debug19' if RUBY_VERSION.include? "1.9"
......
......@@ -141,6 +141,7 @@ GEM
uuidtools
childprocess (0.1.4)
ffi (~> 0.6.3)
closure-compiler (0.3.3)
columnize (0.3.2)
configuration (1.1.0)
crack (0.1.8)
......@@ -188,6 +189,9 @@ GEM
httparty (0.6.1)
crack (= 0.1.8)
i18n (0.4.2)
jammit (0.5.4)
closure-compiler (>= 0.1.0)
yui-compressor (>= 0.9.1)
json (1.4.6)
json_pure (1.4.6)
launchy (0.3.7)
......@@ -345,6 +349,7 @@ GEM
crack (>= 0.1.7)
will_paginate (3.0.pre2)
xml-simple (1.0.12)
yui-compressor (0.9.1)
PLATFORMS
ruby
......@@ -369,6 +374,7 @@ DEPENDENCIES
fastercsv
haml
http_accept_language!
jammit
jasmine!
json
launchy
......
......@@ -5,6 +5,10 @@
module ApplicationHelper
@@youtube_title_cache = Hash.new("no-title")
def modern_browser?
false
end
def current_aspect?(aspect)
!@aspect.is_a?(Symbol) && @aspect.id == aspect.id
end
......
......@@ -3,8 +3,7 @@
-# the COPYRIGHT file.
- content_for :head do
= javascript_include_tag 'aspect-edit.js'
= javascript_include_tag 'vendor/jquery-ui-1.8.6.custom.min'
= include_javascripts :aspects
#section_header
%h2=t('.manage_aspects')
......
......@@ -2,7 +2,6 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
= javascript_include_tag 'vendor/FABridge', 'vendor/swfobject', 'vendor/web_socket'
:javascript
WebSocket.__swfLocation = "#{javascript_path 'vendor/WebSocketMain.swf'}";
$(document).ready(function(){
......
......@@ -9,29 +9,20 @@
= "#{current_user.real_name} | diaspora" if current_user
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
= stylesheet_link_tag "blueprint/screen", :media => 'screen'
= stylesheet_link_tag "blueprint/print", :media => 'print'
= include_stylesheets :default, :media => 'all'
= stylesheet_link_tag "application", "ui"
= stylesheet_link_tag "vendor/jquery.fancybox-1.3.1"
= stylesheet_link_tag "vendor/fileuploader"
= stylesheet_link_tag "vendor/tipsy"
- if current_user
%link{:rel => "alternate", :href => "#{current_user.public_url}", :type => "application/atom+xml", :title => "Public Diaspora Feed for #{current_user.real_name}"}
/= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
= javascript_include_tag 'vendor/jquery144.min', 'rails'
= javascript_include_tag 'vendor/jquery.infieldlabel'
= javascript_include_tag 'vendor/jquery.tipsy'
= javascript_include_tag 'vendor/fancybox/jquery.fancybox-1.3.1.pack'
= javascript_include_tag 'vendor/fileuploader'
= javascript_include_tag 'view', 'image-picker', 'stream'
= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"
= include_javascripts :main
- if current_user
= include_javascripts :flash_socket unless modern_browser?
= render 'js/websocket_js'
= csrf_meta_tag
......
javascripts:
flash_socket:
- public/javascripts/vendor/FABridge.js
- public/javascripts/vendor/swfobject.js
- public/javascripts/vendor/web_socket.js
main:
- public/javascripts/rails.js
- public/javascripts/vendor/jquery.infieldlabel.js
- public/javascripts/vendor/jquery.tipsy.js
- public/javascripts/vendor/fancybox/jquery.fancybox-1.3.1.pack.js
- public/javascripts/vendor/fileuploader.js
- public/javascripts/vendor/jquery_mobile_a2.min.js
- public/javascripts/view.js
- public/javascripts/image-picker.js
- public/javascripts/stream.js
mobile:
- public/javascripts/vendor/jquery-ui-1.8.6.custom.min.js
- public/javascripts/vendor/jquery_mobile_a2.min.js
photo:
- public/javascripts/photo.js
- public/javascripts/image-picker.js
aspects:
- public/javascripts/vendor/jquery-ui-1.8.6.custom.min.js
- public/javascripts/aspect-edit.js
stylesheets:
default:
- public/stylesheets/application.css
- public/stylesheets/ui.css
- public/stylesheets/vendor/jquery.fancybox-1.3.1.css
- public/stylesheets/vendor/fileuploader.css
- public/stylesheets/vendor/tipsy.css
/* Copyright (c) 2010, Diaspora Inc. This file is
* licensed under the Affero General Public License version 3 or later. See
* the COPYRIGHT file.
*/
var Publisher = {
initialize: function() {
$("ul .person").draggable({
revert: true,
start: AspectEdit.startDrag,
drag: AspectEdit.duringDrag,
stop: AspectEdit.stopDrag
});
$(".aspect ul.dropzone").droppable({
hoverClass: 'active',
drop: AspectEdit.onDropMove
});
$(".delete").live("click", AspectEdit.deletePerson);
$(".aspect h3").live('focus', AspectEdit.changeName);
},
startDrag: function() {
AspectEdit.animateImage($(this).children("img").first());
$(".draggable_info").fadeIn(100);
},
animateImage: function(image) {
image.animate({'height':80, 'width':80, 'opacity':0.8}, 200);
image.tipsy("hide");
},
duringDrag: function(event, ui) {
$(this).children("img").tipsy("hide"); //ensure this is hidden
},
stopDrag: function(event, ui) {
$(this).children("img").animate({'height':70, 'width':70, 'opacity':1}, 200);
$(".draggable_info").fadeOut(100);
},
onDropMove: function(event, ui) {
var dropzone = $(this);
var person = ui.draggable;
if (person.hasClass('request')) {
$.ajax({
type: "DELETE",
url: "/requests/" + person.attr('data-guid'),
data: {"accept" : true, "aspect_id" : dropzone.attr('data-aspect_id') },
success: function(data) {
AspectEdit.decrementRequestsCounter();
person.removeClass('request');
}
});
}
if (dropzone.attr('data-aspect_id') != person.attr('data-aspect_id')) {
$.ajax({
url: "/aspects/move_contact/",
data: {"person_id" : person.attr('data-guid'),
"from" : person.attr('data-aspect_id'),
"to" : { "to" : dropzone.attr('data-aspect_id') }},
success: function(data) {
person.attr('data-aspect_id', dropzone.attr('data-aspect_id'));
}});
}
dropzone.closest("ul").append(person);
},
deletePersonFromAspect: function(person) {
var person_id = person.attr('data-guid');
if( $(".person[data-guid='"+ person_id +"']").length == 1) {
alert("You can not remove the person from the last aspect");
} else {
if (!person.hasClass('request')) {
$.ajax({
type: "POST",
url: "/aspects/remove_from_aspect",
data:{
'person_id' : person_id,
'aspect_id' : person.attr('data-aspect_id') }
});
}
person.fadeOut(400, function() {
person.remove();
});
}
},
changeName: function() {
var $this = $(this);
var id = $this.closest("li.aspect").attr("data-guid");
var link = "/aspects/" + id;
$this.keypress(function(e) {
if (e.which == 13) {
e.preventDefault();
$this.blur();
//save changes
$.ajax({
type: "PUT",
url: link,
data: {"aspect" : {"name" : $this.text() }}
});
}
//update all other aspect links
$this.keyup(function(e) {
$("#aspect_nav a[href='" + link + "']").text($this.text());
});
});
},
deletePerson: function() {
var person = $(this).closest("li.person");
if (person.hasClass('request')) {
if (confirm("Ignore request?")) {
var request_id = person.attr("data-guid");
$.ajax({
type: "DELETE",
url: "/requests/" + request_id,
success: function () {
AspectEdit.decrementRequestsCounter();
}
});
}
} else {
if (confirm("Also remove this person from all aspects?")) {
var person_id = $(this).closest("li.person").attr('data-guid');
$.ajax({
type: "DELETE",
url: "/people/" + person_id,
success: function() {
$(".person[data-guid='"+ person_id +"']").fadeOut(200);
}
});
} else {
AspectEdit.deletePersonFromAspect(person);
}
}
},
decrementRequestsCounter: function() {
var $new_requests = $(".new_requests");
var request_html = $new_requests.html();
var old_request_count = request_html.match(/\d+/);
if (old_request_count == 1) {
$new_requests.html(
request_html.replace(/ \(\d+\)/, '')
);
} else {
$new_requests.html(
request_html.replace(/\d+/, old_request_count - 1)
);
}
}
};
$(document).ready(Publisher.initialize);
......@@ -41,8 +41,14 @@ def process_message
end
end
def package_js
require 'jammit'
Jammit.package!
end
begin
EM.run {
package_js
Diaspora::WebSocket.initialize_channels
socket_params = { :host => APP_CONFIG[:socket_host],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment