Permalink
Browse files

Merge branch 'master' into feature-per-site-asset-host

  • Loading branch information...
interhive committed Jun 22, 2017
2 parents 176b921 + 3ef3e14 commit 73f7a41f66b7042800964aac6f5aa3eefd6d938e
View
@@ -18,13 +18,13 @@ end
group :development do
# gem 'custom_fields', path: '../gems/custom_fields' # for Developers
# gem 'custom_fields', github: 'locomotivecms/custom_fields', ref: '4a612e5'
gem 'custom_fields', github: 'locomotivecms/custom_fields', ref: '27f1d62'
# gem 'locomotivecms_common', path: '../gems/common', require: false
# gem 'locomotivecms_common', github: 'locomotivecms/common', ref: '257047b', require: false
# gem 'locomotivecms_steam', path: '../gems/steam', require: false
# gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: 'e624ab686', require: false
gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: '0cf606c', require: false
# gem 'locomotive_liquid', path: '../gems/liquid' # for Developers
# gem 'locomotivecms_solid', path: '../gems/solid' # for Developers
View
@@ -4,10 +4,54 @@ GIT
specs:
database_cleaner (1.5.3)
GIT
remote: git://github.com/locomotivecms/custom_fields.git
revision: 27f1d621afc894002693de78f0165c0631119194
ref: 27f1d62
specs:
custom_fields (2.8.0)
activesupport (~> 4.2.7)
bcrypt (~> 3.1.11)
carrierwave-mongoid (~> 0.10.0)
monetize (~> 1.6.0)
mongoid (~> 5.2.0)
GIT
remote: git://github.com/locomotivecms/steam.git
revision: 0cf606c56f52dac2587e5890ada904256c6a7c40
ref: 0cf606c
specs:
locomotivecms_steam (1.3.0.rc2)
RedCloth (~> 4.3.2)
autoprefixer-rails (~> 6.7.2)
bcrypt (~> 3.1.11)
chronic (~> 0.10.2)
coffee-script (~> 2.4.1)
compass (~> 1.0.3)
dragonfly (~> 1.1.1)
duktape (~> 1.6.1.0)
httparty (~> 0.14.0)
kramdown (~> 1.13.2)
locomotivecms-solid (~> 4.0.1)
locomotivecms_common (~> 0.2.0)
mime-types (~> 3.1.0)
mimetype-fu (~> 0.1.2)
moneta (~> 1.0.0)
morphine (~> 0.1.1)
nokogiri (~> 1.7.0.1)
pony (~> 1.11)
rack-cache (~> 1.7.0)
rack-rewrite (~> 1.5.1)
rack_csrf (~> 2.6.0)
sanitize (~> 4.4.0)
sass (~> 3.4.23)
sprockets (~> 3.7.1)
uglifier (~> 3.1.6)
PATH
remote: .
specs:
locomotivecms (3.3.0.rc2)
locomotivecms (3.3.0.rc3)
actionmailer-with-request (~> 0.4.0)
autoprefixer-rails (~> 6.7.2)
bazaar (~> 0.0.2)
@@ -28,7 +72,7 @@ PATH
jquery-ui-rails (~> 5.0.3)
json-schema (~> 2.8.0)
kaminari (~> 0.17.0)
locomotivecms_steam (~> 1.3.0.rc1)
locomotivecms_steam (~> 1.3.0.rc2)
mongo_session_store-rails4 (~> 6.0.0)
mongoid (~> 5.2.0)
mongoid-tree (~> 2.1.0)
@@ -88,7 +132,7 @@ GEM
public_suffix (~> 2.0, >= 2.0.2)
arel (6.0.4)
attr_extras (4.4.0)
autoprefixer-rails (6.7.7.1)
autoprefixer-rails (6.7.7.2)
execjs
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
@@ -177,12 +221,6 @@ GEM
cucumber-core (1.5.0)
gherkin (~> 4.0)
cucumber-wire (0.0.1)
custom_fields (2.8.0)
activesupport (~> 4.2.7)
bcrypt (~> 3.1.11)
carrierwave-mongoid (~> 0.10.0)
monetize (~> 1.6.0)
mongoid (~> 5.2.0)
debug_inspector (0.0.2)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
@@ -197,7 +235,7 @@ GEM
devise (>= 2.1.0)
diff-lcs (1.3)
docile (1.1.5)
dragonfly (1.1.1)
dragonfly (1.1.3)
addressable (~> 2.3)
multi_json (~> 1.0)
rack (>= 1.3)
@@ -228,8 +266,8 @@ GEM
font-awesome-sass (4.7.0)
sass (>= 3.2)
gherkin (4.0.0)
globalid (0.3.7)
activesupport (>= 4.1.0)
globalid (0.4.0)
activesupport (>= 4.2.0)
grape (0.12.0)
activesupport
builder
@@ -287,32 +325,6 @@ GEM
attr_extras (~> 4.4.0)
colorize
stringex (~> 2.6.0)
locomotivecms_steam (1.3.0.rc1)
RedCloth (~> 4.3.2)
autoprefixer-rails (~> 6.7.2)
bcrypt (~> 3.1.11)
chronic (~> 0.10.2)
coffee-script (~> 2.4.1)
compass (~> 1.0.3)
dragonfly (~> 1.1.1)
duktape (~> 1.6.1.0)
httparty (~> 0.14.0)
kramdown (~> 1.13.2)
locomotivecms-solid (~> 4.0.1)
locomotivecms_common (~> 0.2.0)
mime-types (~> 3.1.0)
mimetype-fu (~> 0.1.2)
moneta (~> 1.0.0)
morphine (~> 0.1.1)
nokogiri (~> 1.7.0.1)
pony (~> 1.11)
rack-cache (~> 1.7.0)
rack-rewrite (~> 1.5.1)
rack_csrf (~> 2.6.0)
sanitize (~> 4.4.0)
sass (~> 3.4.23)
sprockets (~> 3.7.1)
uglifier (~> 3.1.6)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
@@ -328,14 +340,13 @@ GEM
moneta (1.0.0)
monetize (1.6.0)
money (~> 6.8)
money (6.8.2)
money (6.9.0)
i18n (>= 0.6.4, < 0.9)
sixarm_ruby_unaccent (>= 1.1.1, < 2)
mongo (2.4.1)
mongo (2.4.2)
bson (>= 4.2.1, < 5.0.0)
mongo_session_store-rails4 (6.0.0)
actionpack (>= 3.1)
mongoid (5.2.0)
mongoid (5.2.1)
activemodel (~> 4.0)
mongo (>= 2.4.1, < 3.0.0)
origin (~> 2.3)
@@ -351,10 +362,10 @@ GEM
multi_xml (0.6.0)
nokogiri (1.7.0.1)
mini_portile2 (~> 2.1.0)
nokogumbo (1.4.10)
nokogumbo (1.4.13)
nokogiri
nprogress-rails (0.1.6.8)
origin (2.3.0)
origin (2.3.1)
orm_adapter (0.5.0)
pickle (0.5.1)
cucumber (>= 0.8)
@@ -415,8 +426,8 @@ GEM
thor (>= 0.18.1, < 2.0)
rake (12.0.0)
rb-fsevent (0.9.8)
rb-inotify (0.9.8)
ffi (>= 0.5.0)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
responders (2.3.0)
railties (>= 4.2.0, < 5.1)
rspec (3.5.0)
@@ -466,9 +477,8 @@ GEM
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
sixarm_ruby_unaccent (1.1.1)
slim (3.0.7)
temple (~> 0.7.6)
slim (3.0.8)
temple (>= 0.7.6, < 0.9)
tilt (>= 1.3.3, < 2.1)
slop (3.6.0)
sprockets (3.7.1)
@@ -479,7 +489,7 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
stringex (2.6.1)
temple (0.7.7)
temple (0.8.0)
term-ansicolor (1.4.0)
tins (~> 1.0)
terminal-table (1.7.3)
@@ -517,6 +527,7 @@ DEPENDENCIES
capybara-webkit (~> 1.12.0)
coffee-rails (~> 4.1.0)
coveralls (~> 0.8.19)
custom_fields!
database_cleaner!
email_spec
factory_girl_rails
@@ -525,6 +536,7 @@ DEPENDENCIES
i18n-tasks (~> 0.8.7)
json_spec (~> 1.1.4)
locomotivecms!
locomotivecms_steam!
pickle
pry
pry-byebug
@@ -7,7 +7,7 @@ class SiteEntity < BaseEntity
expose :name, :handle, :seo_title, :meta_keywords, :meta_description,
:robots_txt, :cache_enabled, :private_access
expose :locales, :domains, :asset_host
expose :locales, :domains, :asset_host, :url_redirections
expose :memberships, using: MembershipEntity
@@ -41,7 +41,7 @@ def method_missing(name, *args, &block)
if respond_to?(:"set_#{field.type}")
public_send(:"set_#{field.type}", field, args.first)
else
dynamic_attributes[field.name.to_sym] = args.first
dynamic_attributes[getter_name(name).to_sym] = args.first
end
else
super
@@ -54,14 +54,19 @@ def serializable_hash
private
def getter_name(name)
name.to_s.gsub(/=\z/, '')
end
def find_field(name)
_name = name.to_s.gsub(/=$/, '')
dynamic_setters[_name]
dynamic_setters[getter_name(name)]
end
def dynamic_setters
@dynamic_setters ||= self.content_type.entries_custom_fields.inject({}) do |hash, field|
case field.type.to_sym
when :password
hash[field.name] = hash["#{field.name}_confirmation"] = field
when :file
hash[field.name] = hash["remote_#{field.name}_url"] = hash["remove_#{field.name}"] = field
when :belongs_to
@@ -4,7 +4,7 @@ module Forms
class SiteForm < BaseForm
attrs :name, :handle, :robots_txt, :locales, :domains, :timezone, :picture, :cache_enabled, :private_access, :password, :metafields_schema, :metafields, :metafields_ui, :asset_host
attrs :name, :handle, :robots_txt, :locales, :domains, :url_redirections, :timezone, :picture, :cache_enabled, :private_access, :password, :metafields_schema, :metafields, :metafields_ui, :asset_host
attrs :seo_title, :meta_keywords, :meta_description, localized: true
# Make sure locales and domains are in arrays.
@@ -27,7 +27,6 @@ def service
present current_site, with: entity_klass
end
desc 'Update current site'
params do
requires :site, type: Hash do
@@ -39,6 +38,7 @@ def service
optional :robots_txt
optional :locales, type: Array
optional :domains, type: Array
optional :url_redirections, type: Array
optional :timezone
optional :picture
optional :metafields_schema
@@ -4,14 +4,16 @@ module Middlewares
class WysihtmlCss
GOOGLE_AMP_PATH = '_amp'
def initialize(app, opts = {})
@app = app
end
def call(env)
status, headers, response = @app.call(env)
if content?(env['steam.page'], response)
if content?(env['steam.page'], env['steam.path'], response)
url = ::ActionController::Base.helpers.stylesheet_path('locomotive/wysihtml5_editor')
html = %(<link rel="stylesheet" type="text/css" href="#{url}">)
response.first.gsub!('</head>', %(#{html}</head>))
@@ -22,8 +24,11 @@ def call(env)
protected
def content?(page, response)
page && !page.redirect && page.response_type == 'text/html' && response.first
def content?(page, path, response)
!path.starts_with?(GOOGLE_AMP_PATH + '/') &&
!page.redirect &&
page.response_type == 'text/html' &&
response.first
end
end
@@ -2,5 +2,5 @@
# MAJOR.MINOR.PATCH format.
# 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0
module Locomotive #:nodoc
VERSION = '3.3.0.rc2'
VERSION = '3.3.0.rc3'
end
View
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
s.add_dependency 'mongo_session_store-rails4', '~> 6.0.0'
s.add_dependency 'custom_fields', '~> 2.8.0'
s.add_dependency 'locomotivecms_steam', '~> 1.3.0.rc1'
s.add_dependency 'locomotivecms_steam', '~> 1.3.0.rc2'
s.add_dependency 'slim', '~> 3.0.7'
s.add_dependency 'simple_form', '~> 3.4.0'
@@ -40,7 +40,7 @@
subject { middleware.send(:cache_key, steam_env) }
it { expect(subject).to eq '6f10bd02e43a99e1bef1223da0e266ec' }
it { expect(subject).to eq 'e86d1e803b59f9eeeca84cce457808e3' }
end
@@ -3,10 +3,11 @@
describe Locomotive::Steam::Middlewares::WysihtmlCss do
let(:url) { 'http://example.com/' }
let(:path) { 'index' }
let(:html) { 'Hello world' }
let(:page) { nil }
let(:app) { ->(env) { [200, env, [html]] } }
let(:env) { env_for(url).tap { |e| e['steam.page'] = page } }
let(:env) { env_for(url).tap { |e| e['steam.page'] = page; e['steam.path'] = path } }
let(:middleware) { described_class.new(app) }
subject { middleware.call(env).last.first }
@@ -35,6 +36,14 @@
it { is_expected.to match(%r(<html><head><link rel="stylesheet" type="text/css" href="/assets/locomotive/wysihtml5_editor-[^.]+.css"></head><body></body></html>)) }
context 'Google AMP page' do
let(:path) { '_amp/simple' }
it { is_expected.to eq('<html><head></head><body></body></html>') }
end
end
end
Oops, something went wrong.

0 comments on commit 73f7a41

Please sign in to comment.