make locomotive work with bushido + refactor some portions of code (routing constraints, ...etc) + fix broken tests
This commit is contained in:
parent
09bd73c7ac
commit
b58e49fce2
3
Gemfile
3
Gemfile
@ -23,8 +23,7 @@ gem 'locomotive_carrierwave', '0.5.0.1.beta3', :require => 'carrierwave'
|
|||||||
gem 'custom_fields', '1.0.0.beta.9'
|
gem 'custom_fields', '1.0.0.beta.9'
|
||||||
gem 'fog', '0.3.7'
|
gem 'fog', '0.3.7'
|
||||||
gem 'mimetype-fu'
|
gem 'mimetype-fu'
|
||||||
gem 'actionmailer-with-request', :git => 'git://github.com/weppos/actionmailer_with_request.git'
|
gem 'actionmailer_with_request', :git => 'git://github.com/weppos/actionmailer_with_request.git' #, :require => 'actionmailer_with_request'
|
||||||
#:git => 'git://github.com/eric1234/actionmailer_with_request.git'
|
|
||||||
gem 'heroku', '1.19.1' # '1.18.2'
|
gem 'heroku', '1.19.1' # '1.18.2'
|
||||||
gem 'bushido'
|
gem 'bushido'
|
||||||
gem 'httparty', '>= 0.6.1'
|
gem 'httparty', '>= 0.6.1'
|
||||||
|
68
Gemfile.lock
68
Gemfile.lock
@ -6,9 +6,9 @@ GIT
|
|||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/weppos/actionmailer_with_request.git
|
remote: git://github.com/weppos/actionmailer_with_request.git
|
||||||
revision: c1f18f4541554367fe5910fc1bc8caecd7d09682
|
revision: 93aac62e8551405c966d0f7876bbb534ce472c17
|
||||||
specs:
|
specs:
|
||||||
actionmailer-with-request (0.3.0)
|
actionmailer_with_request (0.3.0)
|
||||||
rails (>= 3)
|
rails (>= 3)
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
@ -29,12 +29,12 @@ GEM
|
|||||||
SystemTimer (1.2.3)
|
SystemTimer (1.2.3)
|
||||||
ZenTest (4.5.0)
|
ZenTest (4.5.0)
|
||||||
abstract (1.0.0)
|
abstract (1.0.0)
|
||||||
actionmailer (3.0.6)
|
actionmailer (3.0.7)
|
||||||
actionpack (= 3.0.6)
|
actionpack (= 3.0.7)
|
||||||
mail (~> 2.2.15)
|
mail (~> 2.2.15)
|
||||||
actionpack (3.0.6)
|
actionpack (3.0.7)
|
||||||
activemodel (= 3.0.6)
|
activemodel (= 3.0.7)
|
||||||
activesupport (= 3.0.6)
|
activesupport (= 3.0.7)
|
||||||
builder (~> 2.1.2)
|
builder (~> 2.1.2)
|
||||||
erubis (~> 2.6.6)
|
erubis (~> 2.6.6)
|
||||||
i18n (~> 0.5.0)
|
i18n (~> 0.5.0)
|
||||||
@ -42,19 +42,19 @@ GEM
|
|||||||
rack-mount (~> 0.6.14)
|
rack-mount (~> 0.6.14)
|
||||||
rack-test (~> 0.5.7)
|
rack-test (~> 0.5.7)
|
||||||
tzinfo (~> 0.3.23)
|
tzinfo (~> 0.3.23)
|
||||||
activemodel (3.0.6)
|
activemodel (3.0.7)
|
||||||
activesupport (= 3.0.6)
|
activesupport (= 3.0.7)
|
||||||
builder (~> 2.1.2)
|
builder (~> 2.1.2)
|
||||||
i18n (~> 0.5.0)
|
i18n (~> 0.5.0)
|
||||||
activerecord (3.0.6)
|
activerecord (3.0.7)
|
||||||
activemodel (= 3.0.6)
|
activemodel (= 3.0.7)
|
||||||
activesupport (= 3.0.6)
|
activesupport (= 3.0.7)
|
||||||
arel (~> 2.0.2)
|
arel (~> 2.0.2)
|
||||||
tzinfo (~> 0.3.23)
|
tzinfo (~> 0.3.23)
|
||||||
activeresource (3.0.6)
|
activeresource (3.0.7)
|
||||||
activemodel (= 3.0.6)
|
activemodel (= 3.0.7)
|
||||||
activesupport (= 3.0.6)
|
activesupport (= 3.0.7)
|
||||||
activesupport (3.0.6)
|
activesupport (3.0.7)
|
||||||
archive-tar-minitar (0.5.2)
|
archive-tar-minitar (0.5.2)
|
||||||
arel (2.0.9)
|
arel (2.0.9)
|
||||||
autotest (4.4.6)
|
autotest (4.4.6)
|
||||||
@ -96,8 +96,8 @@ GEM
|
|||||||
activesupport (>= 3.0.4)
|
activesupport (>= 3.0.4)
|
||||||
locomotive_carrierwave
|
locomotive_carrierwave
|
||||||
mongoid (~> 2.0.0.rc.7)
|
mongoid (~> 2.0.0.rc.7)
|
||||||
daemons (1.1.2)
|
daemons (1.1.3)
|
||||||
database_cleaner (0.6.6)
|
database_cleaner (0.6.7)
|
||||||
delayed_job (2.1.4)
|
delayed_job (2.1.4)
|
||||||
activesupport (~> 3.0)
|
activesupport (~> 3.0)
|
||||||
daemons
|
daemons
|
||||||
@ -110,7 +110,7 @@ GEM
|
|||||||
diff-lcs (1.1.2)
|
diff-lcs (1.1.2)
|
||||||
erubis (2.6.6)
|
erubis (2.6.6)
|
||||||
abstract (>= 1.0.0)
|
abstract (>= 1.0.0)
|
||||||
excon (0.6.1)
|
excon (0.6.2)
|
||||||
factory_girl (1.3.3)
|
factory_girl (1.3.3)
|
||||||
factory_girl_rails (1.0.1)
|
factory_girl_rails (1.0.1)
|
||||||
factory_girl (~> 1.3)
|
factory_girl (~> 1.3)
|
||||||
@ -141,7 +141,7 @@ GEM
|
|||||||
launchy (~> 0.3.2)
|
launchy (~> 0.3.2)
|
||||||
rest-client (>= 1.4.0, < 1.7.0)
|
rest-client (>= 1.4.0, < 1.7.0)
|
||||||
highline (1.6.1)
|
highline (1.6.1)
|
||||||
httparty (0.7.4)
|
httparty (0.7.7)
|
||||||
crack (= 0.1.8)
|
crack (= 0.1.8)
|
||||||
i18n (0.5.0)
|
i18n (0.5.0)
|
||||||
inherited_resources (1.1.2)
|
inherited_resources (1.1.2)
|
||||||
@ -168,7 +168,7 @@ GEM
|
|||||||
locomotive_liquid (2.2.2)
|
locomotive_liquid (2.2.2)
|
||||||
locomotive_mongoid_acts_as_tree (0.1.5.5)
|
locomotive_mongoid_acts_as_tree (0.1.5.5)
|
||||||
mongoid (~> 2.0.0.rc.7)
|
mongoid (~> 2.0.0.rc.7)
|
||||||
mail (2.2.15)
|
mail (2.2.17)
|
||||||
activesupport (>= 2.3.6)
|
activesupport (>= 2.3.6)
|
||||||
i18n (>= 0.4.0)
|
i18n (>= 0.4.0)
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
@ -196,17 +196,17 @@ GEM
|
|||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
rack-test (0.5.7)
|
rack-test (0.5.7)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (3.0.6)
|
rails (3.0.7)
|
||||||
actionmailer (= 3.0.6)
|
actionmailer (= 3.0.7)
|
||||||
actionpack (= 3.0.6)
|
actionpack (= 3.0.7)
|
||||||
activerecord (= 3.0.6)
|
activerecord (= 3.0.7)
|
||||||
activeresource (= 3.0.6)
|
activeresource (= 3.0.7)
|
||||||
activesupport (= 3.0.6)
|
activesupport (= 3.0.7)
|
||||||
bundler (~> 1.0)
|
bundler (~> 1.0)
|
||||||
railties (= 3.0.6)
|
railties (= 3.0.7)
|
||||||
railties (3.0.6)
|
railties (3.0.7)
|
||||||
actionpack (= 3.0.6)
|
actionpack (= 3.0.7)
|
||||||
activesupport (= 3.0.6)
|
activesupport (= 3.0.7)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (~> 0.14.4)
|
thor (~> 0.14.4)
|
||||||
rake (0.8.7)
|
rake (0.8.7)
|
||||||
@ -246,7 +246,7 @@ GEM
|
|||||||
rubyzip (0.9.4)
|
rubyzip (0.9.4)
|
||||||
s3 (0.3.8)
|
s3 (0.3.8)
|
||||||
proxies (~> 0.2.0)
|
proxies (~> 0.2.0)
|
||||||
selenium-webdriver (0.1.4)
|
selenium-webdriver (0.2.0)
|
||||||
childprocess (>= 0.1.7)
|
childprocess (>= 0.1.7)
|
||||||
ffi (>= 1.0.7)
|
ffi (>= 1.0.7)
|
||||||
json_pure
|
json_pure
|
||||||
@ -258,7 +258,7 @@ GEM
|
|||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
trollop (1.16.2)
|
trollop (1.16.2)
|
||||||
tzinfo (0.3.26)
|
tzinfo (0.3.26)
|
||||||
unicorn (3.5.0)
|
unicorn (3.6.0)
|
||||||
kgio (~> 2.3)
|
kgio (~> 2.3)
|
||||||
rack
|
rack
|
||||||
warden (0.10.7)
|
warden (0.10.7)
|
||||||
@ -274,7 +274,7 @@ DEPENDENCIES
|
|||||||
RedCloth (= 4.2.7)
|
RedCloth (= 4.2.7)
|
||||||
SystemTimer
|
SystemTimer
|
||||||
ZenTest
|
ZenTest
|
||||||
actionmailer-with-request!
|
actionmailer_with_request!
|
||||||
autotest
|
autotest
|
||||||
bson_ext (~> 1.3.0)
|
bson_ext (~> 1.3.0)
|
||||||
bushido
|
bushido
|
||||||
|
@ -13,7 +13,7 @@ module Admin
|
|||||||
|
|
||||||
before_filter :set_locale
|
before_filter :set_locale
|
||||||
|
|
||||||
helper_method :sections
|
helper_method :sections, :current_site_url, :site_url, :page_url
|
||||||
|
|
||||||
# https://rails.lighthouseapp.com/projects/8994/tickets/1905-apphelpers-within-plugin-not-being-mixed-in
|
# https://rails.lighthouseapp.com/projects/8994/tickets/1905-apphelpers-within-plugin-not-being-mixed-in
|
||||||
Dir[File.dirname(__FILE__) + "/../../helpers/**/*_helper.rb"].each do |file|
|
Dir[File.dirname(__FILE__) + "/../../helpers/**/*_helper.rb"].each do |file|
|
||||||
@ -52,5 +52,31 @@ module Admin
|
|||||||
I18n.locale = current_admin.locale rescue Locomotive.config.default_locale
|
I18n.locale = current_admin.locale rescue Locomotive.config.default_locale
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# ___ site/page urls builder ___
|
||||||
|
|
||||||
|
def current_site_url
|
||||||
|
request.protocol + request.host_with_port
|
||||||
|
end
|
||||||
|
|
||||||
|
def site_url(site, options = {})
|
||||||
|
options = { :fullpath => true, :protocol => true }.merge(options)
|
||||||
|
|
||||||
|
url = "#{site.subdomain}.#{Locomotive.config.domain}"
|
||||||
|
url += ":#{request.port}" if request.port != 80
|
||||||
|
|
||||||
|
url = File.join(url, request.fullpath) if options[:fullpath]
|
||||||
|
url = "http://#{url}" if options[:protocol]
|
||||||
|
url
|
||||||
|
end
|
||||||
|
|
||||||
|
def page_url(page, options = {})
|
||||||
|
if content = options.delete(:content)
|
||||||
|
File.join(current_site_url, page.fullpath.gsub('content_type_template', ''), content._slug)
|
||||||
|
else
|
||||||
|
File.join(current_site_url, page.fullpath)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -22,10 +22,10 @@ module Admin
|
|||||||
end
|
end
|
||||||
|
|
||||||
def new_host_if_subdomain_changed
|
def new_host_if_subdomain_changed
|
||||||
if !Locomotive.config.multi_sites? || @site.domains.include?(request.host)
|
if !Locomotive.config.manage_subdomain? || @site.domains.include?(request.host)
|
||||||
{}
|
{}
|
||||||
else
|
else
|
||||||
{ :host => "#{@site.subdomain}.#{Locomotive.config.default_domain}:#{request.port}" }
|
{ :host => site_url(@site, { :fullpath => false, :protocol => false }) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ module Admin
|
|||||||
|
|
||||||
redirect_to last_url
|
redirect_to last_url
|
||||||
else
|
else
|
||||||
|
logger.error "Unable to create the first website: #{@site.errors.inspect}"
|
||||||
render 'step_2'
|
render 'step_2'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -35,7 +35,7 @@ module Admin
|
|||||||
def get_path
|
def get_path
|
||||||
page = current_site.pages.build(:parent => current_site.pages.find(params[:parent_id]), :slug => params[:slug].slugify)
|
page = current_site.pages.build(:parent => current_site.pages.find(params[:parent_id]), :slug => params[:slug].slugify)
|
||||||
|
|
||||||
render :json => { :url => page.url, :slug => page.slug }
|
render :json => { :url => page_url(page), :slug => page.slug }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -15,5 +15,9 @@ module Admin
|
|||||||
admin_pages_url
|
admin_pages_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def after_sign_out_path_for(resource)
|
||||||
|
request.protocol + request.host_with_port
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
module Admin
|
module Admin
|
||||||
class SitemapsController < ActionController::Base
|
class SitemapsController < BaseController
|
||||||
|
|
||||||
include Locomotive::Routing::SiteDispatcher
|
skip_before_filter :authenticate_admin!, :validate_site_membership, :set_locale
|
||||||
|
|
||||||
before_filter :require_site
|
before_filter :require_site
|
||||||
|
|
||||||
respond_to :xml
|
respond_to :xml
|
||||||
|
|
||||||
helper 'admin/pages'
|
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@pages = current_site.pages.published
|
@pages = current_site.pages.published
|
||||||
end
|
end
|
||||||
|
@ -1,23 +1,5 @@
|
|||||||
module Admin::PagesHelper
|
module Admin::PagesHelper
|
||||||
|
|
||||||
def page_main_url(page, options = {})
|
|
||||||
if options[:host]
|
|
||||||
url = "http://#{request.host}"
|
|
||||||
elsif page.site.domains.empty?
|
|
||||||
url = main_site_url(page.site)
|
|
||||||
else
|
|
||||||
url = "http://#{current_site.domains.first}"
|
|
||||||
end
|
|
||||||
|
|
||||||
url += ":#{request.port}" if request.port != 80
|
|
||||||
|
|
||||||
if content = options.delete(:content)
|
|
||||||
File.join(url, page.fullpath.gsub('content_type_template', ''), content._slug)
|
|
||||||
else
|
|
||||||
File.join(url, page.fullpath)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def parent_pages_options
|
def parent_pages_options
|
||||||
roots = current_site.pages.roots.where(:slug.ne => '404').and(:_id.ne => @page.id)
|
roots = current_site.pages.roots.where(:slug.ne => '404').and(:_id.ne => @page.id)
|
||||||
|
|
||||||
|
@ -6,18 +6,6 @@ module Admin::SitesHelper
|
|||||||
domain
|
domain
|
||||||
end
|
end
|
||||||
|
|
||||||
def main_site_url(site = current_site, options = {})
|
|
||||||
# TODO: to be refactored
|
|
||||||
if multi_sites?
|
|
||||||
url = "http://#{site.subdomain}.#{Locomotive.config.domain}"
|
|
||||||
url += ":#{request.port}" if request.port != 80
|
|
||||||
else
|
|
||||||
url = "#{request.protocol}#{request.host_with_port}"
|
|
||||||
end
|
|
||||||
url = File.join(url, request.fullpath) if options.has_key?(:uri) && options[:uri]
|
|
||||||
url
|
|
||||||
end
|
|
||||||
|
|
||||||
def error_on_domain(site, name)
|
def error_on_domain(site, name)
|
||||||
if (error = (site.errors[:domains] || []).detect { |n| n.include?(name) })
|
if (error = (site.errors[:domains] || []).detect { |n| n.include?(name) })
|
||||||
content_tag(:span, error, :class => 'inline-errors')
|
content_tag(:span, error, :class => 'inline-errors')
|
||||||
|
@ -74,10 +74,6 @@ class Page
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def url
|
|
||||||
"http://#{self.site.domains.first}/#{self.fullpath}.html"
|
|
||||||
end
|
|
||||||
|
|
||||||
def with_cache?
|
def with_cache?
|
||||||
self.cache_strategy != 'none'
|
self.cache_strategy != 'none'
|
||||||
end
|
end
|
||||||
|
@ -8,10 +8,6 @@ class AssetUploader < CarrierWave::Uploader::Base
|
|||||||
self.build_store_dir('sites', model.collection.site_id, 'assets', model.id)
|
self.build_store_dir('sites', model.collection.site_id, 'assets', model.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# def cache_dir
|
|
||||||
# "#{Rails.root}/tmp/uploads"
|
|
||||||
# end
|
|
||||||
|
|
||||||
version :thumb, :if => :image? do
|
version :thumb, :if => :image? do
|
||||||
process :resize_to_fill => [50, 50]
|
process :resize_to_fill => [50, 50]
|
||||||
process :convert => 'png'
|
process :convert => 'png'
|
||||||
|
@ -2,16 +2,12 @@ class ThemeUploader < ::CarrierWave::Uploader::Base
|
|||||||
|
|
||||||
def store_dir
|
def store_dir
|
||||||
if Locomotive.config.delayed_job
|
if Locomotive.config.delayed_job
|
||||||
self.build_store_dir('sites', model.id, 'tmp', 'themes')
|
self.build_store_dir('sites', model.id.to_s, 'tmp', 'themes')
|
||||||
else
|
else
|
||||||
"#{Rails.root}/tmp/themes"
|
"#{Rails.root}/tmp/themes"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# def cache_dir
|
|
||||||
# "#{Rails.root}/tmp/uploads"
|
|
||||||
# end
|
|
||||||
|
|
||||||
def extension_white_list
|
def extension_white_list
|
||||||
%w(zip)
|
%w(zip)
|
||||||
end
|
end
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
= semantic_form_for(@site, :url => admin_installation_step_url(2), :html => { :multipart => true }) do |f|
|
= semantic_form_for(@site, :url => admin_installation_step_url(2), :html => { :multipart => true }) do |f|
|
||||||
.inner
|
.inner
|
||||||
|
|
||||||
%p.explanations
|
%p.explanations
|
||||||
!= t('.explanations')
|
!= t('.explanations')
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
= f.foldable_inputs :name => :sites, :class => 'sites off' do
|
= f.foldable_inputs :name => :sites, :class => 'sites off' do
|
||||||
- @account.sites.each do |site|
|
- @account.sites.each do |site|
|
||||||
%li{ :class => 'item' }
|
%li{ :class => 'item' }
|
||||||
%strong= link_to site.name, main_site_url(site, :uri => true)
|
%strong= link_to site.name, site_url(site)
|
||||||
%em= site.domains.join(', ')
|
%em= site.domains.join(', ')
|
||||||
|
|
||||||
- if admin_on?(site) && site != current_site
|
- if admin_on?(site) && site != current_site
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
- if not @page.index? and not @page.not_found?
|
- if not @page.index? and not @page.not_found?
|
||||||
= f.input :parent_id, :as => :select, :collection => parent_pages_options, :include_blank => false
|
= f.input :parent_id, :as => :select, :collection => parent_pages_options, :include_blank => false
|
||||||
|
|
||||||
= f.input :slug, :required => false, :hint => @page.slug.blank? ? ' ' : @page.url, :input_html => { :data_url => get_path_admin_pages_url, :disabled => @page.index? || @page.not_found? }, :wrapper_html => { :style => "#{'display: none' if @page.templatized?}; height: 50px" }
|
= f.input :slug, :required => false, :hint => @page.slug.blank? ? ' ' : page_url(@page), :input_html => { :data_url => get_path_admin_pages_url, :disabled => @page.index? || @page.not_found? }, :wrapper_html => { :style => "#{'display: none' if @page.templatized?}; height: 50px" }
|
||||||
|
|
||||||
|
|
||||||
= f.foldable_inputs :name => :advanced_options do
|
= f.foldable_inputs :name => :advanced_options do
|
||||||
|
@ -9,6 +9,6 @@
|
|||||||
#global-actions-bar
|
#global-actions-bar
|
||||||
!= t('.welcome', :name => link_to(current_admin.name, edit_admin_my_account_url))
|
!= t('.welcome', :name => link_to(current_admin.name, edit_admin_my_account_url))
|
||||||
%span= '|'
|
%span= '|'
|
||||||
= link_to t('.see'), main_site_url
|
= link_to t('.see'), current_site_url
|
||||||
%span= '|'
|
%span= '|'
|
||||||
= link_to t('.logout'), destroy_admin_session_url, :confirm => t('admin.messages.confirm')
|
= link_to t('.logout'), destroy_admin_session_url, :confirm => t('admin.messages.confirm')
|
@ -2,7 +2,7 @@ xml.instruct!
|
|||||||
xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
|
xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
|
||||||
|
|
||||||
xml.url do
|
xml.url do
|
||||||
xml.loc "http://#{request.host}#{":#{request.port}" if request.port != 80}"
|
xml.loc current_site_url
|
||||||
xml.priority 1.0
|
xml.priority 1.0
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -12,14 +12,14 @@ xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
|
|||||||
|
|
||||||
page.content_type.contents.visible.each do |c|
|
page.content_type.contents.visible.each do |c|
|
||||||
xml.url do
|
xml.url do
|
||||||
xml.loc page_main_url(page, { :content => c, :host => true })
|
xml.loc page_url(page, { :content => c, :host => true })
|
||||||
xml.lastmod c.updated_at.to_date.to_s('%Y-%m-%d')
|
xml.lastmod c.updated_at.to_date.to_s('%Y-%m-%d')
|
||||||
xml.priority 0.9
|
xml.priority 0.9
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
xml.url do
|
xml.url do
|
||||||
xml.loc page_main_url(page, { :host => true })
|
xml.loc page_url(page, { :host => true })
|
||||||
xml.lastmod page.updated_at.to_date.to_s('%Y-%m-%d')
|
xml.lastmod page.updated_at.to_date.to_s('%Y-%m-%d')
|
||||||
xml.priority 0.9
|
xml.priority 0.9
|
||||||
end
|
end
|
||||||
|
@ -20,7 +20,7 @@ CarrierWave.configure do |config|
|
|||||||
when :production
|
when :production
|
||||||
if Locomotive.bushido?
|
if Locomotive.bushido?
|
||||||
config.storage = :file
|
config.storage = :file
|
||||||
config.root = File.join(Rails.root, 'public', 'store')
|
config.root = File.join(Rails.root, 'public')
|
||||||
config.store_dir = 'store'
|
config.store_dir = 'store'
|
||||||
else
|
else
|
||||||
config.storage = :s3
|
config.storage = :s3
|
||||||
|
@ -7,16 +7,16 @@ Locomotive.configure do |config|
|
|||||||
# your own domain name (ex: locomotivehosting.com).
|
# your own domain name (ex: locomotivehosting.com).
|
||||||
#
|
#
|
||||||
# Ex:
|
# Ex:
|
||||||
# config.multi_sites do |multi_sites|
|
config.multi_sites do |multi_sites|
|
||||||
# # each new website you add will have a default entry based on a subdomain
|
# each new website you add will have a default entry based on a subdomain
|
||||||
# # and the multi_site_domain value (ex: website_1.locomotivehosting.com).
|
# and the multi_site_domain value (ex: website_1.locomotivehosting.com).
|
||||||
# multi_sites.domain = 'example.com' #'myhostingplatform.com'
|
multi_sites.domain = 'example.com' #'myhostingplatform.com'
|
||||||
#
|
|
||||||
# # define the reserved subdomains
|
# define the reserved subdomains
|
||||||
# # Ex:
|
# Ex:
|
||||||
# multi_sites.reserved_subdomains = %w(www admin email blog webmail mail support help site sites)
|
multi_sites.reserved_subdomains = %w(www admin email blog webmail mail support help site sites)
|
||||||
# end
|
end
|
||||||
config.multi_sites = false
|
# config.multi_sites = false
|
||||||
|
|
||||||
# configure the hosting target for the production environment. Locomotive can be installed in:
|
# configure the hosting target for the production environment. Locomotive can be installed in:
|
||||||
# - your own server
|
# - your own server
|
||||||
@ -44,7 +44,7 @@ Locomotive.configure do |config|
|
|||||||
config.delayed_job = false
|
config.delayed_job = false
|
||||||
|
|
||||||
# configure how many items we display in sub menu in the "Contents" section.
|
# configure how many items we display in sub menu in the "Contents" section.
|
||||||
config.lastest_items_nb = 5
|
# config.lastest_items_nb = 5
|
||||||
|
|
||||||
# default locale (for now, only en, de, fr and pt-BR are supported)
|
# default locale (for now, only en, de, fr and pt-BR are supported)
|
||||||
config.default_locale = :en
|
config.default_locale = :en
|
||||||
@ -60,4 +60,4 @@ Locomotive.configure do |config|
|
|||||||
# config.mailer_sender = 'support'
|
# config.mailer_sender = 'support'
|
||||||
# # => 'support@heroku.com' (Heroku), 'support@bushi.do' (Bushido), 'support@example.com' (Dev) or 'support@<your_hosting_platform>' (Multi-sites)
|
# # => 'support@heroku.com' (Heroku), 'support@bushi.do' (Bushido), 'support@example.com' (Dev) or 'support@<your_hosting_platform>' (Multi-sites)
|
||||||
config.mailer_sender = 'support'
|
config.mailer_sender = 'support'
|
||||||
end unless Locomotive.engine?
|
end unless Locomotive.engine? || Rails.env.test?
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
# Locomotive::Application.routes.draw do |map|
|
# Locomotive::Application.routes.draw do |map|
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
constraints(Locomotive::Routing::DefaultConstraint) do
|
|
||||||
root :to => 'admin/sessions#new'
|
|
||||||
end
|
|
||||||
|
|
||||||
# admin authentication
|
# admin authentication
|
||||||
devise_for :admin, :class_name => 'Account', :controllers => { :sessions => 'admin/sessions', :passwords => 'admin/passwords' }
|
devise_for :admin, :class_name => 'Account', :controllers => { :sessions => 'admin/sessions', :passwords => 'admin/passwords' }
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ Locomotive.configure do |config|
|
|||||||
config.delayed_job = false
|
config.delayed_job = false
|
||||||
|
|
||||||
# configure how many items we display in sub menu in the "Contents" section.
|
# configure how many items we display in sub menu in the "Contents" section.
|
||||||
config.lastest_items_nb = 5
|
# config.lastest_items_nb = 5
|
||||||
|
|
||||||
# default locale (for now, only en, de, fr and pt-BR are supported)
|
# default locale (for now, only en, de, fr and pt-BR are supported)
|
||||||
config.default_locale = :en
|
config.default_locale = :en
|
||||||
|
@ -37,15 +37,13 @@ module CarrierWave
|
|||||||
|
|
||||||
class Base
|
class Base
|
||||||
|
|
||||||
# alias :super_store_dir :store_dir
|
|
||||||
|
|
||||||
def build_store_dir(*args)
|
def build_store_dir(*args)
|
||||||
default_dir = self.class.store_dir
|
default_dir = self.class.store_dir
|
||||||
|
|
||||||
if default_dir.blank? || default_dir == 'uploads'
|
if default_dir.blank? || default_dir == 'uploads'
|
||||||
File.join(args)
|
File.join(args.map(&:to_s))
|
||||||
else
|
else
|
||||||
File.join([default_dir] + args)
|
File.join([default_dir] + args.map(&:to_s))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -15,7 +15,8 @@ module Locomotive
|
|||||||
:default_locale => :en,
|
:default_locale => :en,
|
||||||
:mailer_sender => 'support', #support@example.com'
|
:mailer_sender => 'support', #support@example.com'
|
||||||
:manage_subdomain => false,
|
:manage_subdomain => false,
|
||||||
:manage_manage_domains => false
|
:manage_manage_domains => false,
|
||||||
|
:lastest_items_nb => 5
|
||||||
}
|
}
|
||||||
|
|
||||||
cattr_accessor :settings
|
cattr_accessor :settings
|
||||||
|
@ -41,7 +41,7 @@ module Locomotive
|
|||||||
def add_bushido_domain(name)
|
def add_bushido_domain(name)
|
||||||
Locomotive.logger "[add bushido domain] #{name}"
|
Locomotive.logger "[add bushido domain] #{name}"
|
||||||
::Bushido::App.add_domain(name)
|
::Bushido::App.add_domain(name)
|
||||||
|
|
||||||
if ::Bushido::Command.last_command_successful?
|
if ::Bushido::Command.last_command_successful?
|
||||||
self.bushido_domains << name
|
self.bushido_domains << name
|
||||||
end
|
end
|
||||||
@ -50,7 +50,7 @@ module Locomotive
|
|||||||
def remove_bushido_domain(name)
|
def remove_bushido_domain(name)
|
||||||
Locomotive.logger "[remove bushido domain] #{name}"
|
Locomotive.logger "[remove bushido domain] #{name}"
|
||||||
::Bushido::App.remove_domain(name)
|
::Bushido::App.remove_domain(name)
|
||||||
|
|
||||||
if ::Bushido::Command.last_command_successful?
|
if ::Bushido::Command.last_command_successful?
|
||||||
self.bushido_domains.delete(name)
|
self.bushido_domains.delete(name)
|
||||||
end
|
end
|
||||||
|
@ -31,10 +31,12 @@ module Locomotive
|
|||||||
|
|
||||||
def add_subdomain_to_domains_with_bushido
|
def add_subdomain_to_domains_with_bushido
|
||||||
unless self.domains_change.nil?
|
unless self.domains_change.nil?
|
||||||
|
old_full_subdomain = "#{self.subdomain_was}.#{Locomotive.config.domain}"
|
||||||
full_subdomain = "#{self.subdomain}.#{Locomotive.config.domain}"
|
full_subdomain = "#{self.subdomain}.#{Locomotive.config.domain}"
|
||||||
|
|
||||||
@bushido_domains_change = {
|
@bushido_domains_change = {
|
||||||
:added => self.domains_change.last - self.domains_change.first - [full_subdomain],
|
:added => self.domains_change.last - self.domains_change.first - [old_full_subdomain] - [full_subdomain],
|
||||||
:removed => self.domains_change.first - self.domains_change.last - [full_subdomain]
|
:removed => self.domains_change.first - self.domains_change.last - [old_full_subdomain] - [full_subdomain]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -80,6 +80,11 @@ module Locomotive
|
|||||||
when 'file' then self.open_sample_asset(value)
|
when 'file' then self.open_sample_asset(value)
|
||||||
when 'boolean' then Boolean.set(value)
|
when 'boolean' then Boolean.set(value)
|
||||||
when 'date' then Date.parse(value)
|
when 'date' then Date.parse(value)
|
||||||
|
when 'category'
|
||||||
|
if field.category_items.detect { |item| item.name == value }.nil?
|
||||||
|
field.category_items.build :name => value
|
||||||
|
end
|
||||||
|
value
|
||||||
else
|
else
|
||||||
value
|
value
|
||||||
end)
|
end)
|
||||||
|
@ -79,6 +79,7 @@ module Mongoid #:nodoc:
|
|||||||
# limit for embedded collections ?
|
# limit for embedded collections ?
|
||||||
if limits && limits.size > 0
|
if limits && limits.size > 0
|
||||||
limits.each do |field, limit|
|
limits.each do |field, limit|
|
||||||
|
next if limit.blank?
|
||||||
options[:fields][field] = { '$slice' => limit }
|
options[:fields][field] = { '$slice' => limit }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -44,11 +44,11 @@ describe Locomotive::Liquid::Filters::Html do
|
|||||||
javascript_tag('/trash/main.js').should == result
|
javascript_tag('/trash/main.js').should == result
|
||||||
javascript_tag('/trash/main').should == result
|
javascript_tag('/trash/main').should == result
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return an image tag for a given theme file without parameters' do
|
it 'should return an image tag for a given theme file without parameters' do
|
||||||
theme_image_tag('foo.jpg').should == "<img src=\"/sites/000000000000000000000042/theme/images/foo.jpg\" />"
|
theme_image_tag('foo.jpg').should == "<img src=\"/sites/000000000000000000000042/theme/images/foo.jpg\" />"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return an image tag for a given theme file with size' do
|
it 'should return an image tag for a given theme file with size' do
|
||||||
theme_image_tag('foo.jpg', 'width:100', 'height:100').should == "<img src=\"/sites/000000000000000000000042/theme/images/foo.jpg\" height=\"100\" width=\"100\" />"
|
theme_image_tag('foo.jpg', 'width:100', 'height:100').should == "<img src=\"/sites/000000000000000000000042/theme/images/foo.jpg\" height=\"100\" width=\"100\" />"
|
||||||
end
|
end
|
||||||
|
@ -145,18 +145,6 @@ describe Page do
|
|||||||
archives.children.last.children.first.depth.should == 3
|
archives.children.last.children.first.depth.should == 3
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should generate a path / url from parents' do
|
|
||||||
@home.fullpath.should == 'index'
|
|
||||||
@home.url.should == 'http://acme.example.com/index.html'
|
|
||||||
|
|
||||||
@child_1.fullpath.should == 'foo'
|
|
||||||
@child_1.url.should == 'http://acme.example.com/foo.html'
|
|
||||||
|
|
||||||
nested_page = Factory(:page, :title => 'Sub sub page 1', :slug => 'bar', :parent => @child_1, :site => @home.site)
|
|
||||||
nested_page.fullpath.should == 'foo/bar'
|
|
||||||
nested_page.url.should == 'http://acme.example.com/foo/bar.html'
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should destroy descendants as well' do
|
it 'should destroy descendants as well' do
|
||||||
Factory(:page, :title => 'Sub Subpage 1', :slug => 'bar', :parent_id => @child_1._id, :site => @home.site)
|
Factory(:page, :title => 'Sub Subpage 1', :slug => 'bar', :parent_id => @child_1._id, :site => @home.site)
|
||||||
@child_1.destroy
|
@child_1.destroy
|
||||||
|
@ -2,7 +2,7 @@ require 'carrierwave/test/matchers'
|
|||||||
|
|
||||||
CarrierWave.configure do |config|
|
CarrierWave.configure do |config|
|
||||||
config.storage = :file
|
config.storage = :file
|
||||||
config.store_dir = "spec/tmp/uploads"
|
# config.store_dir = "spec/tmp/uploads"
|
||||||
config.cache_dir = "spec/tmp/cache"
|
config.cache_dir = "spec/tmp/cache"
|
||||||
config.root = File.join(Rails.root, 'spec', 'tmp')
|
config.root = File.join(Rails.root, 'spec', 'tmp')
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user