diff --git a/Gemfile b/Gemfile index 6ae6886b..88336a1c 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem 'warden' gem 'devise', '= 1.1.3' gem 'mongoid', '2.0.0.beta.19' -gem 'bson_ext', '1.1.2' +gem 'bson_ext', '1.1.4' gem 'locomotive_mongoid_acts_as_tree', '0.1.5.1', :require => 'mongoid_acts_as_tree' gem 'will_paginate' @@ -30,14 +30,13 @@ gem 'RedCloth' gem 'delayed_job', '2.1.0.pre2' gem 'delayed_job_mongoid', '1.0.0.rc' gem 'rubyzip' +gem 'jammit-s3' # The rest of the dependencies are for use when in the locomotive dev environment group :development do - # Using mongrel instead of webrick (default server) - gem 'mongrel', ">= 1.2.0.pre2" - gem 'cgi_multipart_eof_fix' - gem 'fastthread' + # Using unicorn_rails instead of webrick (default server) + gem 'unicorn' end group :test, :development do diff --git a/Gemfile.lock b/Gemfile.lock index 5c53cbe2..eafb11d7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,8 @@ GIT remote: git://github.com/floehopper/mocha.git - revision: 89a334f490fc8e01d02e4a7c4ff0afbb323f0ef9 + revision: 80f28aa72397c814e26a1893b576e768287b3c59 specs: - mocha (0.9.9.20101022133622) + mocha (0.9.10.20101125155727) rake GIT @@ -19,41 +19,42 @@ GEM remote: http://rubygems.org/ specs: RedCloth (4.2.3) + ZenTest (4.4.2) abstract (1.0.0) - actionmailer (3.0.1) - actionpack (= 3.0.1) - mail (~> 2.2.5) + actionmailer (3.0.3) + actionpack (= 3.0.3) + mail (~> 2.2.9) actionmailer-with-request (0.1.1) - actionpack (3.0.1) - activemodel (= 3.0.1) - activesupport (= 3.0.1) + actionpack (3.0.3) + activemodel (= 3.0.3) + activesupport (= 3.0.3) builder (~> 2.1.2) erubis (~> 2.6.6) - i18n (~> 0.4.1) + i18n (~> 0.4) rack (~> 1.2.1) - rack-mount (~> 0.6.12) - rack-test (~> 0.5.4) + rack-mount (~> 0.6.13) + rack-test (~> 0.5.6) tzinfo (~> 0.3.23) - activemodel (3.0.1) - activesupport (= 3.0.1) + activemodel (3.0.3) + activesupport (= 3.0.3) builder (~> 2.1.2) - i18n (~> 0.4.1) - activerecord (3.0.1) - activemodel (= 3.0.1) - activesupport (= 3.0.1) - arel (~> 1.0.0) + i18n (~> 0.4) + activerecord (3.0.3) + activemodel (= 3.0.3) + activesupport (= 3.0.3) + arel (~> 2.0.2) tzinfo (~> 0.3.23) - activeresource (3.0.1) - activemodel (= 3.0.1) - activesupport (= 3.0.1) - activesupport (3.0.1) + activeresource (3.0.3) + activemodel (= 3.0.3) + activesupport (= 3.0.3) + activesupport (3.0.3) archive-tar-minitar (0.5.2) - arel (1.0.1) - activesupport (~> 3.0.0) - autotest (4.4.2) + arel (2.0.6) + autotest (4.4.6) + ZenTest (>= 4.4.1) bcrypt-ruby (2.1.2) - bson (1.1.2) - bson_ext (1.1.2) + bson (1.1.4) + bson_ext (1.1.4) builder (2.1.2) capybara (0.4.0) celerity (>= 0.7.9) @@ -64,12 +65,12 @@ GEM rack-test (>= 0.5.4) selenium-webdriver (>= 0.0.27) xpath (~> 0.1.2) - celerity (0.8.2) - cgi_multipart_eof_fix (2.5.0) - childprocess (0.1.3) + celerity (0.8.5) + childprocess (0.1.4) ffi (~> 0.6.3) - columnize (0.3.1) - configuration (1.1.0) + closure-compiler (0.3.3) + columnize (0.3.2) + configuration (1.2.0) crack (0.1.8) cucumber (0.8.5) builder (~> 2.1.2) @@ -84,7 +85,7 @@ GEM activesupport (>= 3.0.0) locomotive_carrierwave mongoid (>= 2.0.0.beta.18) - daemons (1.0.10) + daemons (1.1.0) database_cleaner (0.6.0) delayed_job (2.1.0.pre2) activesupport (~> 3.0) @@ -98,12 +99,11 @@ GEM diff-lcs (1.1.2) erubis (2.6.6) abstract (>= 1.0.0) - excon (0.2.4) + excon (0.3.3) factory_girl (1.3.2) factory_girl_rails (1.0) factory_girl (~> 1.3) rails (>= 3.0.0.beta4) - fastthread (1.0.7) ffi (0.6.3) rake (>= 0.8.7) fog (0.3.7) @@ -115,29 +115,36 @@ GEM net-ssh (~> 2.0.23) nokogiri (~> 1.4.3.1) ruby-hmac - formatador (0.0.15) - formtastic (1.1.0) - actionpack (>= 2.3.0) - activesupport (>= 2.3.0) + formatador (0.0.16) + formtastic (1.2.2) + actionpack (>= 2.3.7) + activesupport (>= 2.3.7) i18n (>= 0.4.0) - gem_plugin (0.2.3) gherkin (2.1.5) trollop (~> 1.16.2) growl-glue (1.0.7) haml (3.0.18) has_scope (0.5.0) - heroku (1.12.1) + heroku (1.14.8) json_pure (>= 1.2.0, < 1.5.0) launchy (~> 0.3.2) rest-client (>= 1.4.0, < 1.7.0) httparty (0.6.1) crack (= 0.1.8) - i18n (0.4.2) + i18n (0.5.0) inherited_resources (1.1.2) has_scope (~> 0.5.0) responders (~> 0.6.0) + jammit (0.5.4) + closure-compiler (>= 0.1.0) + yui-compressor (>= 0.9.1) + jammit-s3 (0.5.4.3) + jammit (>= 0.5.4) + mimemagic (>= 0.1.7) + s3 (>= 0.3.7) json (1.4.6) json_pure (1.4.6) + kgio (2.0.0) launchy (0.3.7) configuration (>= 0.0.5) rake (>= 0.8.1) @@ -150,12 +157,13 @@ GEM locomotive_mongoid_acts_as_tree (0.1.5.1) bson (>= 0.20.1) mongoid (<= 2.0.0.beta.19) - mail (2.2.9) + mail (2.2.12) activesupport (>= 2.3.6) - i18n (~> 0.4.1) + i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.16) + mimemagic (0.1.7) mimetype-fu (0.1.2) mongo (1.0.9) bson (>= 1.0.5) @@ -164,51 +172,50 @@ GEM mongo (= 1.0.9) tzinfo (~> 0.3.22) will_paginate (~> 3.0.pre) - mongrel (1.2.0.pre2) - daemons (~> 1.0.10) - gem_plugin (~> 0.2.3) net-ssh (2.0.23) nokogiri (1.4.3.1) polyglot (0.3.1) + proxies (0.2.1) rack (1.2.1) rack-mount (0.6.13) rack (>= 1.0.0) rack-test (0.5.6) rack (>= 1.0) - rails (3.0.1) - actionmailer (= 3.0.1) - actionpack (= 3.0.1) - activerecord (= 3.0.1) - activeresource (= 3.0.1) - activesupport (= 3.0.1) - bundler (~> 1.0.0) - railties (= 3.0.1) - railties (3.0.1) - actionpack (= 3.0.1) - activesupport (= 3.0.1) - rake (>= 0.8.4) - thor (~> 0.14.0) + rails (3.0.3) + actionmailer (= 3.0.3) + actionpack (= 3.0.3) + activerecord (= 3.0.3) + activeresource (= 3.0.3) + activesupport (= 3.0.3) + bundler (~> 1.0) + railties (= 3.0.3) + railties (3.0.3) + actionpack (= 3.0.3) + activesupport (= 3.0.3) + rake (>= 0.8.7) + thor (~> 0.14.4) rake (0.8.7) responders (0.6.2) rest-client (1.6.1) mime-types (>= 1.16) rmagick (2.12.2) - rspec (2.0.1) - rspec-core (~> 2.0.1) - rspec-expectations (~> 2.0.1) - rspec-mocks (~> 2.0.1) - rspec-core (2.0.1) - rspec-expectations (2.0.1) - diff-lcs (>= 1.1.2) - rspec-mocks (2.0.1) - rspec-core (~> 2.0.1) - rspec-expectations (~> 2.0.1) - rspec-rails (2.0.1) - rspec (~> 2.0.0) - ruby-debug (0.10.3) + rspec (2.3.0) + rspec-core (~> 2.3.0) + rspec-expectations (~> 2.3.0) + rspec-mocks (~> 2.3.0) + rspec-core (2.3.0) + rspec-expectations (2.3.0) + diff-lcs (~> 1.1.2) + rspec-mocks (2.3.0) + rspec-rails (2.3.0) + actionpack (~> 3.0) + activesupport (~> 3.0) + railties (~> 3.0) + rspec (~> 2.3.0) + ruby-debug (0.10.4) columnize (>= 0.1) - ruby-debug-base (~> 0.10.3.0) - ruby-debug-base (0.10.3) + ruby-debug-base (~> 0.10.4.0) + ruby-debug-base (0.10.4) linecache (>= 0.3) ruby-debug-base19 (0.11.24) columnize (>= 0.3.1) @@ -222,24 +229,30 @@ GEM ruby_core_source (0.1.4) archive-tar-minitar (>= 0.5.2) rubyzip (0.9.4) - selenium-webdriver (0.0.29) - childprocess (>= 0.0.7) + s3 (0.3.7) + proxies + selenium-webdriver (0.1.1) + childprocess (= 0.1.4) ffi (~> 0.6.3) json_pure rubyzip spork (0.8.4) term-ansicolor (1.0.5) - thor (0.14.4) - treetop (1.4.8) + thor (0.14.6) + treetop (1.4.9) polyglot (>= 0.3.1) trollop (1.16.2) tzinfo (0.3.23) + unicorn (3.1.0) + kgio (~> 2.0.0) + rack warden (0.10.7) rack (>= 1.0.0) will_paginate (3.0.pre2) xpath (0.1.2) nokogiri (~> 1.3) - yard (0.6.1) + yard (0.6.3) + yui-compressor (0.9.1) PLATFORMS ruby @@ -248,9 +261,8 @@ DEPENDENCIES RedCloth actionmailer-with-request autotest - bson_ext (= 1.1.2) + bson_ext (= 1.1.4) capybara - cgi_multipart_eof_fix cucumber (= 0.8.5) cucumber-rails custom_fields (= 1.0.0.beta2) @@ -259,7 +271,6 @@ DEPENDENCIES delayed_job_mongoid (= 1.0.0.rc) devise (= 1.1.3) factory_girl_rails - fastthread fog (= 0.3.7) formtastic (>= 1.1.0) growl-glue @@ -267,6 +278,7 @@ DEPENDENCIES heroku httparty (>= 0.6.1) inherited_resources (>= 1.1.2) + jammit-s3 launchy locomotive_carrierwave (= 0.5.0.1.beta2) locomotive_liquid (= 2.2.2) @@ -274,7 +286,6 @@ DEPENDENCIES mimetype-fu mocha! mongoid (= 2.0.0.beta.19) - mongrel (>= 1.2.0.pre2) pickle! rails (>= 3.0.0) rmagick (= 2.12.2) @@ -283,5 +294,6 @@ DEPENDENCIES ruby-debug19 rubyzip spork + unicorn warden will_paginate diff --git a/app/controllers/admin/current_sites_controller.rb b/app/controllers/admin/current_sites_controller.rb index e9bfc081..b02b5e1b 100644 --- a/app/controllers/admin/current_sites_controller.rb +++ b/app/controllers/admin/current_sites_controller.rb @@ -1,6 +1,8 @@ module Admin class CurrentSitesController < BaseController + defaults :instance_name => 'site' + sections 'settings', 'site' actions :edit, :update diff --git a/app/controllers/admin/sites_controller.rb b/app/controllers/admin/sites_controller.rb index c8df2c32..001758df 100644 --- a/app/controllers/admin/sites_controller.rb +++ b/app/controllers/admin/sites_controller.rb @@ -1,6 +1,8 @@ module Admin class SitesController < BaseController + defaults :instance_name => 'site' + sections 'settings' def create diff --git a/app/helpers/admin/assets_helper.rb b/app/helpers/admin/assets_helper.rb index 57e984e9..4db41082 100644 --- a/app/helpers/admin/assets_helper.rb +++ b/app/helpers/admin/assets_helper.rb @@ -12,10 +12,4 @@ module Admin::AssetsHelper asset.new_record? || asset.stylesheet? || asset.javascript? end - def image_picker_include_tags - html = javascript_include_tag 'admin/plugins/json2', 'admin/plugins/scrollTo', 'admin/plugins/codemirror/codemirror', 'admin/plugins/fancybox', 'admin/plugins/plupload/plupload.full', 'admin/plugins/imagepicker' - html += stylesheet_link_tag 'admin/plugins/fancybox', 'admin/fancybox_changes' - html - end - end diff --git a/app/models/site.rb b/app/models/site.rb index 326429cb..d076d6c1 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -40,6 +40,10 @@ class Site ## methods ## + def domains=(array) + array = [] if array.blank?; super(array) + end + def accounts Account.criteria.in(:_id => self.memberships.collect(&:account_id)) end diff --git a/app/views/admin/asset_collections/edit.html.haml b/app/views/admin/asset_collections/edit.html.haml index ed073cf2..f386ad3a 100644 --- a/app/views/admin/asset_collections/edit.html.haml +++ b/app/views/admin/asset_collections/edit.html.haml @@ -1,8 +1,8 @@ - title link_to(@asset_collection.name.blank? ? @asset_collection.name_was : @asset_collection.name, '#', :rel => 'asset_collection_name', :title => t('.ask_for_name'), :class => 'editable') - content_for :head do - = javascript_include_tag 'admin/plugins/fancybox', 'admin/asset_collections', 'admin/custom_fields' - = stylesheet_link_tag 'admin/plugins/fancybox', 'admin/fancybox_changes' + = include_javascripts :asset_collections + = include_stylesheets :fancybox - content_for :submenu do = render 'admin/shared/menu/assets' diff --git a/app/views/admin/asset_collections/new.html.haml b/app/views/admin/asset_collections/new.html.haml index 6949a475..d27e15b8 100644 --- a/app/views/admin/asset_collections/new.html.haml +++ b/app/views/admin/asset_collections/new.html.haml @@ -1,7 +1,7 @@ - title t('.title') - content_for :head do - = javascript_include_tag 'admin/asset_collections.js' + = include_javascripts :asset_collections - content_for :submenu do = render 'admin/shared/menu/assets' diff --git a/app/views/admin/assets/_form.html.haml b/app/views/admin/assets/_form.html.haml index 2521ef41..562eb5f8 100644 --- a/app/views/admin/assets/_form.html.haml +++ b/app/views/admin/assets/_form.html.haml @@ -1,6 +1,6 @@ - content_for :head do - = javascript_include_tag 'admin/plugins/tiny_mce/tinymce', 'admin/plugins/json2', 'admin/plugins/fancybox', 'admin/custom_fields/category', 'admin/assets' - = stylesheet_link_tag 'admin/plugins/fancybox', 'admin/box' + = include_javascripts :edit_custom_fields, :assets + = include_stylesheets :custom_fields = f.inputs :name => :information do = f.input :name diff --git a/app/views/admin/content_types/_form.html.haml b/app/views/admin/content_types/_form.html.haml index 81f70f52..47b1f709 100644 --- a/app/views/admin/content_types/_form.html.haml +++ b/app/views/admin/content_types/_form.html.haml @@ -1,6 +1,6 @@ - content_for :head do - = javascript_include_tag 'admin/plugins/fancybox', 'admin/custom_fields' - = stylesheet_link_tag 'admin/plugins/fancybox', 'admin/fancybox_changes' + = include_javascripts :custom_fields + = include_stylesheets :fancybox = f.inputs :name => :information do = f.input :name diff --git a/app/views/admin/content_types/new.html.haml b/app/views/admin/content_types/new.html.haml index 1d45711d..ede7b742 100644 --- a/app/views/admin/content_types/new.html.haml +++ b/app/views/admin/content_types/new.html.haml @@ -1,7 +1,7 @@ - title t('.title') - content_for :head do - = javascript_include_tag 'admin/content_types.js' + = include_javascripts :content_types - content_for :submenu do = render 'admin/shared/menu/contents' diff --git a/app/views/admin/contents/_form.html.haml b/app/views/admin/contents/_form.html.haml index 0b7fa8c6..d79bacaf 100644 --- a/app/views/admin/contents/_form.html.haml +++ b/app/views/admin/contents/_form.html.haml @@ -1,5 +1,5 @@ - content_for :head do - = javascript_include_tag 'admin/plugins/tiny_mce/tinymce', 'admin/plugins/json2', 'admin/plugins/fancybox', 'admin/custom_fields/category', 'admin/contents' - = stylesheet_link_tag 'admin/plugins/fancybox', 'admin/fancybox_changes' + = include_javascripts :edit_custom_fields, :contents + = include_stylesheets :fancybox = render 'admin/custom_fields/custom_form', :form => f, :title => :attributes, :parent => @content_type \ No newline at end of file diff --git a/app/views/admin/contents/index.html.haml b/app/views/admin/contents/index.html.haml index d4040374..4c666bc2 100644 --- a/app/views/admin/contents/index.html.haml +++ b/app/views/admin/contents/index.html.haml @@ -4,7 +4,7 @@ = render 'admin/shared/menu/contents' - content_for :head do - = javascript_include_tag 'admin/contents' + = include_javascripts :contents - content_for :buttons do = admin_button_tag :edit, edit_admin_content_type_url(@content_type), :class => 'edit' diff --git a/app/views/admin/current_sites/_form.html.haml b/app/views/admin/current_sites/_form.html.haml index 7f094e08..72d179c9 100644 --- a/app/views/admin/current_sites/_form.html.haml +++ b/app/views/admin/current_sites/_form.html.haml @@ -1,5 +1,5 @@ - content_for :head do - = javascript_include_tag 'admin/site' + = include_javascripts :site = f.foldable_inputs :name => :information, :style => "#{'display: none' unless @site.new_record?}" do = f.input :name, :required => false @@ -23,7 +23,7 @@ %li{ :class => "item added #{'last' if index == @site.domains.size - 1}"} %em http:// - = text_field_tag 'current_site[domains][]', name, :class => 'string label void domain' + = text_field_tag 'site[domains][]', name, :class => 'string label void domain'   = error_on_domain(@site, name) %span.actions diff --git a/app/views/admin/current_sites/edit.html.haml b/app/views/admin/current_sites/edit.html.haml index ee00d373..6445dbc8 100644 --- a/app/views/admin/current_sites/edit.html.haml +++ b/app/views/admin/current_sites/edit.html.haml @@ -9,7 +9,7 @@ %p!= t('.help') -= semantic_form_for @site, :as => :current_site, :url => admin_current_site_url, :html => { :class => 'save-with-shortcut' } do |f| += semantic_form_for @site, :url => admin_current_site_url, :html => { :class => 'save-with-shortcut' } do |f| = render 'form', :f => f diff --git a/app/views/admin/imports/show.html.haml b/app/views/admin/imports/show.html.haml index a7a76f67..b3d47aa3 100644 --- a/app/views/admin/imports/show.html.haml +++ b/app/views/admin/imports/show.html.haml @@ -1,5 +1,5 @@ - content_for :head do - = javascript_include_tag 'admin/plugins/json2', 'admin/plugins/smartupdater', 'admin/import' + = include_javascripts :import - title t('.title') diff --git a/app/views/admin/installation/step_1.html.haml b/app/views/admin/installation/step_1.html.haml index 779fe4d1..23c0d556 100644 --- a/app/views/admin/installation/step_1.html.haml +++ b/app/views/admin/installation/step_1.html.haml @@ -3,7 +3,8 @@ - title t('.title') -= stylesheet_link_tag 'admin/installation' +- content_for :head do + = include_stylesheets :installation .inner %p.explanations diff --git a/app/views/admin/installation/step_2.html.haml b/app/views/admin/installation/step_2.html.haml index e3fdbba0..9d1d453d 100644 --- a/app/views/admin/installation/step_2.html.haml +++ b/app/views/admin/installation/step_2.html.haml @@ -3,7 +3,8 @@ - title t('.title') -= stylesheet_link_tag 'admin/installation' +- content_for :head do + = include_stylesheets :installation - if @step_done.blank? = semantic_form_for(@account, :url => admin_installation_step_url(2)) do |f| diff --git a/app/views/admin/installation/step_3.html.haml b/app/views/admin/installation/step_3.html.haml index f35bc134..1245ef83 100644 --- a/app/views/admin/installation/step_3.html.haml +++ b/app/views/admin/installation/step_3.html.haml @@ -3,7 +3,8 @@ - title t('.title') -= stylesheet_link_tag 'admin/installation' +- content_for :head do + = include_stylesheets :installation = semantic_form_for(@site, :url => admin_installation_step_url(3), :html => { :multipart => true }) do |f| .inner diff --git a/app/views/admin/layouts/box.html.haml b/app/views/admin/layouts/box.html.haml index b24ed23d..f8729ca3 100644 --- a/app/views/admin/layouts/box.html.haml +++ b/app/views/admin/layouts/box.html.haml @@ -4,11 +4,11 @@ %head %title= yield(:head_title) || escape_once("#{Locomotive.config.name} — #{current_site.name}") - = javascript_include_tag 'admin/jquery' + = include_javascripts :box + = include_stylesheets :box, :media => 'screen' - = stylesheet_link_tag 'admin/blueprint/screen', 'admin/box', :media => 'screen', :cache => Rails.env.production? && !Locomotive.config.heroku / [if IE] - = stylesheet_link_tag('admin/blueprint/ie', :media => 'screen') + = include_stylesheets :ie, :media => 'screen' = yield :head diff --git a/app/views/admin/my_accounts/edit.html.haml b/app/views/admin/my_accounts/edit.html.haml index da09c507..9045864f 100644 --- a/app/views/admin/my_accounts/edit.html.haml +++ b/app/views/admin/my_accounts/edit.html.haml @@ -1,7 +1,7 @@ - title link_to(@account.name.blank? ? @account.name_was : @account.name, '#', :rel => 'my_account_name', :title => t('.ask_for_name'), :class => 'editable') - content_for :head do - = javascript_include_tag 'admin/account' + = include_javascripts :account - content_for :submenu do = render 'admin/shared/menu/settings' diff --git a/app/views/admin/pages/_form.html.haml b/app/views/admin/pages/_form.html.haml index 584e4499..5bacb3a2 100644 --- a/app/views/admin/pages/_form.html.haml +++ b/app/views/admin/pages/_form.html.haml @@ -1,7 +1,6 @@ - content_for :head do - = javascript_include_tag 'admin/plugins/tiny_mce/tinymce', 'admin/plugins/codemirror/codemirror', 'admin/pages', 'admin/editable_elements' - = stylesheet_link_tag 'admin/editable_elements' - = image_picker_include_tags + = include_javascripts :image_picker, :edit_page + = include_stylesheets :editable_elements, :fancybox = f.foldable_inputs :name => :information do diff --git a/app/views/admin/pages/index.html.haml b/app/views/admin/pages/index.html.haml index 120b933c..b8a3e626 100644 --- a/app/views/admin/pages/index.html.haml +++ b/app/views/admin/pages/index.html.haml @@ -1,7 +1,7 @@ - title t('.title') - content_for :head do - = javascript_include_tag 'admin/pages' + = include_javascripts :pages - content_for :submenu do = render 'admin/shared/menu/contents' diff --git a/app/views/admin/shared/_head.html.haml b/app/views/admin/shared/_head.html.haml index 37e51a4c..1155afd3 100644 --- a/app/views/admin/shared/_head.html.haml +++ b/app/views/admin/shared/_head.html.haml @@ -4,13 +4,12 @@ %meta{ :name => 'locale', :content => I18n.locale } -= stylesheet_link_tag 'admin/blueprint/screen', :media => 'screen' += include_javascripts :common + += include_stylesheets :common, :media => 'screen' + / [if IE] - = stylesheet_link_tag 'admin/blueprint/ie', :media => 'screen' - -= stylesheet_link_tag 'admin/layout', 'admin/jquery/ui', 'admin/plugins/toggle', 'admin/plugins/selectmenu', 'admin/menu', 'admin/plugins/toggle','admin/buttons', 'admin/formtastic', 'admin/formtastic_changes', 'admin/application', :media => 'screen', :cache => Rails.env.production? && !Locomotive.heroku? - -= javascript_include_tag 'admin/jquery', 'admin/jquery.ui', 'admin/rails', 'admin/utils', 'admin/plugins/subscribe', 'admin/plugins/shortcut', 'admin/plugins/toggle', 'admin/plugins/growl', 'admin/plugins/cookie', 'admin/plugins/selectmenu', 'admin/application', 'admin/locales/datepicker_fr', :cache => Rails.env.production? && !Locomotive.heroku? + = include_stylesheets :ie, :media => 'screen' %script{ :type => 'text/javascript' } = find_and_preserve(growl_message) diff --git a/app/views/admin/sites/_form.html.haml b/app/views/admin/sites/_form.html.haml index 8f1f86b3..e19a9bc3 100644 --- a/app/views/admin/sites/_form.html.haml +++ b/app/views/admin/sites/_form.html.haml @@ -1,5 +1,5 @@ - content_for :head do - = javascript_include_tag 'admin/site' + = include_javascripts :site = f.foldable_inputs :name => :information, :style => "#{'display: none' unless @site.new_record?}" do = f.input :name, :required => false diff --git a/app/views/admin/snippets/_form.html.haml b/app/views/admin/snippets/_form.html.haml index 887ff071..273938a7 100644 --- a/app/views/admin/snippets/_form.html.haml +++ b/app/views/admin/snippets/_form.html.haml @@ -1,6 +1,6 @@ - content_for :head do - = javascript_include_tag 'admin/plugins/codemirror/codemirror', 'admin/snippets.js' - = image_picker_include_tags + = include_javascripts :image_picker, :snippets + = include_stylesheets :fancybox = f.inputs :name => :information do = f.input :name diff --git a/app/views/admin/theme_assets/_form.html.haml b/app/views/admin/theme_assets/_form.html.haml index f26dff2d..ef6a803d 100644 --- a/app/views/admin/theme_assets/_form.html.haml +++ b/app/views/admin/theme_assets/_form.html.haml @@ -1,6 +1,6 @@ - content_for :head do - = javascript_include_tag 'admin/plugins/codemirror/codemirror', 'admin/theme_assets.js' - = image_picker_include_tags + = include_javascripts :image_picker, :theme_assets + = include_stylesheets :fancybox = f.hidden_field :performing_plain_text diff --git a/config/application.rb b/config/application.rb index 75741f29..faadc1a3 100644 --- a/config/application.rb +++ b/config/application.rb @@ -47,6 +47,6 @@ module Locomotive # Configure sensitive parameters which will be filtered from the log file. config.filter_parameters << :password - config.middleware.insert_after ::ActionDispatch::Static, '::Locomotive::Middlewares::Fonts', :path => %r{^/fonts} + config.middleware.insert_after Rack::Lock, '::Locomotive::Middlewares::Fonts', :path => %r{^/fonts} end end diff --git a/config/environments/production.rb b/config/environments/production.rb index 0b6c4f30..ec7ffd12 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -47,4 +47,12 @@ Locomotive::Application.configure do config.active_support.deprecation = :notify end -# TODO: Put your carrierwave config down here \ No newline at end of file +# TODO: Put your carrierwave config down here + +CarrierWave.configure do |config| + config.storage = :s3 + config.s3_access_key_id = 'AKIAIPXDQKLBLIOF34VA' + config.s3_secret_access_key = 'BjyBbrd4L2Q3cydeaqlKq6Il18IkHbvXV/NpqQJH' + config.s3_bucket = 'locomotivehosting' + config.s3_cname = 'cdn.locomotivehosting.com' +end \ No newline at end of file diff --git a/config/locales/admin_ui_en.yml b/config/locales/admin_ui_en.yml index a303c712..f9e14201 100644 --- a/config/locales/admin_ui_en.yml +++ b/config/locales/admin_ui_en.yml @@ -174,7 +174,7 @@ en: help: "You have the choice to either upload any file or to copy/paste a stylesheet or a javascript in plain text." edit: title: "Editing %{file}" - help: "This asset is accessible from the following url: %{url}" + help: "This asset is accessible from the following url: %{url}" form: picker_link: Insert a file into the code choose_file: Choose file diff --git a/config/locales/admin_ui_fr.yml b/config/locales/admin_ui_fr.yml index ebebc3c4..4d2b6211 100644 --- a/config/locales/admin_ui_fr.yml +++ b/config/locales/admin_ui_fr.yml @@ -174,7 +174,7 @@ fr: help: "Vous avez le choix de soit uploader n'importe quel fichier ou bien soit de copier/coller du code css ou javascript." edit: title: "Edition %{file}" - help: "Vous pouvez insérer le raccourci suivant dans vos feuilles de style: %{shortcut_url} OU utiliser directement l'url : %{url}" + help: "L'url du fichier est %{url}" form: choose_file: Choisir fichier choose_plain_text: Passer en mode texte diff --git a/config/mongoid.yml b/config/mongoid.yml index c4c29b91..cc850bec 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -17,8 +17,10 @@ test: # set these environment variables on your prod server production: <<: *defaults - host: <%= ENV['MONGOID_HOST'] %> - port: <%= ENV['MONGOID_PORT'] %> - username: <%= ENV['MONGOID_USERNAME'] %> - password: <%= ENV['MONGOID_PASSWORD'] %> - database: <%= ENV['MONGOID_DATABASE'] %> \ No newline at end of file + database: locomotive_dev + # <<: *defaults + # host: <%= ENV['MONGOID_HOST'] %> + # port: <%= ENV['MONGOID_PORT'] %> + # username: <%= ENV['MONGOID_USERNAME'] %> + # password: <%= ENV['MONGOID_PASSWORD'] %> + # database: <%= ENV['MONGOID_DATABASE'] %> \ No newline at end of file diff --git a/doc/TODO b/doc/TODO index f2b730cf..2d78675b 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,42 +1,43 @@ BOARD: +x jammit-s3: assets +- copy assets.yml config file when using it as gem +- import theme without delayed_job + +BACKLOG: + - inline editing (http://www.aloha-editor.com/wiki/index.php/Aloha_PHP_Example) - html view in the aloha popup - editable elements should wrap a tag: div, h1, ...etc (default span) - edit images (upload new ones, ...etc) => wait for aloha or send them an email ? - ruby 1.9.2 -- jammit: assets - refactor slugify method (use parameterize + create a module) +- validation for custom fields +- notify accounts when new instance of models (opt): none, one or many accounts. Used for contact form. - global regions: keyword in editable element (http://www.mongodb.org/display/DOCS/Updating) - write my first tutorial about locomotive - -BACKLOG: - -- notify accounts when new instance of models (opt): none, one or many accounts. Used for contact form. - new custom field types: - belongs_to => association -- cucumber features for admin pages -- validation for custom fields -- switch to list (theme assets / assets ?). delete all in once (with checkbox) or see details (updated_at, size, ...etc) +- cucumber features for admin pages (in progress) BUGS: - custom fields: accepts_nested_attributes weird behaviour when creating new content type + adding random fields NICE TO HAVE: -- import / export site +- export site - asset collections: custom resizing if image - super_finder - better icons for mime type - traffic statistics -- Worker => Heroku / S3 (not so sure finally) - asset picker (content instance) - page with regexp url ? - page redirection (option) - automatic update ! - page not found (front) => if logged in, link to create the page +- switch to list (theme assets / assets ?). delete all in once (with checkbox) or see details (updated_at, size, ...etc) DONE: @@ -168,3 +169,4 @@ x liquid: x filters x default_pagination: labels x [content types] the "display column" selector should not include file types +x Worker => Heroku / S3 (not so sure finally) \ No newline at end of file diff --git a/public/javascripts/admin/contents.js b/public/javascripts/admin/contents.js index 1a03a3c2..90e5cb1c 100644 --- a/public/javascripts/admin/contents.js +++ b/public/javascripts/admin/contents.js @@ -15,7 +15,9 @@ $(document).ready(function() { stop: function(event, ui) { updateContentsOrder(); } }); - $('textarea.html').tinymce(TinyMceDefaultSettings); + try { + $('textarea.html').tinymce(TinyMceDefaultSettings); + } catch (e) { /* tinymce not loaded */ } $.datepicker.setDefaults($.datepicker.regional[I18nLocale]); $('input[type=text].date').datepicker($.datepicker.regional[I18nLocale]); diff --git a/public/javascripts/admin/site.js b/public/javascripts/admin/site.js index 9fb667b8..16f0e388 100644 --- a/public/javascripts/admin/site.js +++ b/public/javascripts/admin/site.js @@ -17,12 +17,14 @@ $(document).ready(function() { var newRow = lastRow.clone(true).removeClass('template').addClass('added').insertBefore(lastRow); // should copy the value of the select box - var input_name = $('input#current_site_subdomain').attr('name').split('[')[0]; + var input_name = $('input#site_subdomain').attr('name').split('[')[0]; var input = newRow.find('input.label') .attr('name', input_name + '[domains][]'); if (lastRow.find('input.label').val() == '') input.val("undefined"); - // then reset the form + // then reset and clean the form + $('fieldset.editable-list input.empty-domains').remove(); + lastRow.find('input').val(defaultValue).addClass('void'); lastRow.find('select').val('input'); }); @@ -30,12 +32,16 @@ $(document).ready(function() { $('fieldset.editable-list li a.remove').click(function(e) { if (confirm($(this).attr('data-confirm'))) $(this).parents('li').remove(); + + if ($('fieldset.editable-list .item.added').size() == 0) + $('fieldset.editable-list').append(''); + e.preventDefault(); e.stopPropagation(); }); $.subscribe('form.saved.success', function(event, data) { - var value = $('#current_site_name').val(); + var value = $('#site_name').val(); $('#header h1 a.single').html(value); $('#header h1 a span.ui-selectmenu-status').html(value); $('#site-selector-menu li.ui-selectmenu-item-selected a').html(value); diff --git a/public/javascripts/admin/snippets.js b/public/javascripts/admin/snippets.js index 0e45354f..d77875a8 100644 --- a/public/javascripts/admin/snippets.js +++ b/public/javascripts/admin/snippets.js @@ -16,7 +16,7 @@ $(document).ready(function() { $('a#image-picker-link').imagepicker({ insertFn: function(link) { - return "{{ theme_images." + link.attr('data-slug') + " }}"; + return "{{ '" + link.attr('data-local-path') + "' | theme_image_url }}"; } }); }); diff --git a/public/stylesheets/admin/formtastic_changes.css b/public/stylesheets/admin/formtastic_changes.css index 7d254f7d..9dd1da15 100644 --- a/public/stylesheets/admin/formtastic_changes.css +++ b/public/stylesheets/admin/formtastic_changes.css @@ -175,7 +175,7 @@ form.formtastic div.actions p { } form.formtastic div.actions a { - color: #fff; + color: #fff !important; text-decoration: none; font-size: 0.8em; position: relative; diff --git a/public/stylesheets/admin/layout.css b/public/stylesheets/admin/layout.css index f667603e..9c801b07 100644 --- a/public/stylesheets/admin/layout.css +++ b/public/stylesheets/admin/layout.css @@ -105,6 +105,15 @@ body { font-size: 0.8em; } +#content div.inner p a { + color: #1F82BC; + text-decoration: none; +} + +#content div.inner p a:hover { + text-decoration: underline; +} + #content #local-actions-bar { position: absolute; top: 13px; diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 90f847e3..1850220c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -20,6 +20,7 @@ Rspec.configure do |config| DatabaseCleaner.strategy = :truncation DatabaseCleaner.orm = "mongoid" end + config.before(:each) do if self.described_class != Locomotive::Import::Job DatabaseCleaner.clean