upgrade and force html responses

This commit is contained in:
2016-06-02 20:09:51 +02:00
parent 7dc12ca3e8
commit cb77ce5921
5 changed files with 132 additions and 126 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ group :assets do
gem 'coffee-script'
#gem 'therubyracer', :platforms => :ruby
#gem 'less-rails'
gem 'foundation-rails'
gem 'foundation-rails', '~> 5.5'
gem 'ace-rails-ap'
gem "jquery-rails"
gem 'font-awesome-rails'
+109 -103
View File
@@ -13,7 +13,7 @@ GIT
GIT
remote: git://github.com/bterkuile/simply_stored.git
revision: 0941952120c7fbb3c7a38486cd26d9380fb657aa
revision: 95e045e1ed073090505596d74c6f1d3f39ef4729
specs:
simply_stored (1.0.0)
activesupport
@@ -38,50 +38,51 @@ PATH
GEM
remote: http://rubygems.org/
specs:
ace-rails-ap (4.0.0)
actionmailer (4.2.4)
actionpack (= 4.2.4)
actionview (= 4.2.4)
activejob (= 4.2.4)
ace-rails-ap (4.0.2)
actionmailer (4.2.6)
actionpack (= 4.2.6)
actionview (= 4.2.6)
activejob (= 4.2.6)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.4)
actionview (= 4.2.4)
activesupport (= 4.2.4)
actionpack (4.2.6)
actionview (= 4.2.6)
activesupport (= 4.2.6)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.4)
activesupport (= 4.2.4)
actionview (4.2.6)
activesupport (= 4.2.6)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.4)
activesupport (= 4.2.4)
activejob (4.2.6)
activesupport (= 4.2.6)
globalid (>= 0.3.0)
activemodel (4.2.4)
activesupport (= 4.2.4)
activemodel (4.2.6)
activesupport (= 4.2.6)
builder (~> 3.1)
activerecord (4.2.4)
activemodel (= 4.2.4)
activesupport (= 4.2.4)
activerecord (4.2.6)
activemodel (= 4.2.6)
activesupport (= 4.2.6)
arel (~> 6.0)
activesupport (4.2.4)
activesupport (4.2.6)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.3.8)
addressable (2.4.0)
arel (6.0.3)
bcrypt (3.1.10)
bourbon (4.2.5)
bcrypt (3.1.11)
bourbon (4.2.7)
sass (~> 3.4)
thor (~> 0.19)
builder (3.2.2)
capybara (2.5.0)
capybara (2.7.1)
addressable
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
@@ -90,54 +91,55 @@ GEM
climate_control (0.0.3)
activesupport (>= 3.0)
cliver (0.3.2)
cocaine (0.5.7)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.0)
coderay (1.1.1)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.9.1.1)
couch_potato (1.4.0)
activemodel
couchrest (~> 1.2.0)
coffee-script-source (1.10.0)
concurrent-ruby (1.0.2)
couch_potato (1.7.0)
activemodel (~> 4.0)
couchrest (~> 2.0.0.rc3)
json (~> 1.6)
couchrest (1.2.1)
couchrest (2.0.0.rc3)
httpclient (~> 2.7)
mime-types (>= 1.15)
multi_json (~> 1.7, ~> 1.0)
rest-client (~> 1.8.0)
multi_json (~> 1.7)
daemons (1.2.3)
devise (3.5.2)
devise (4.1.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
railties (>= 4.1.0, < 5.1)
responders
thread_safe (~> 0.1)
warden (~> 1.2.3)
diff-lcs (1.2.5)
domain_name (0.5.24)
domain_name (0.5.20160310)
unf (>= 0.0.5, < 1.0.0)
email_validator (1.6.0)
activemodel
erubis (2.7.0)
eventmachine (1.0.8)
execjs (2.6.0)
factory_girl (4.5.0)
eventmachine (1.2.0.1)
execjs (2.7.0)
factory_girl (4.7.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.5.0)
factory_girl (~> 4.5.0)
factory_girl_rails (4.7.0)
factory_girl (~> 4.7.0)
railties (>= 3.0.0)
font-awesome-rails (4.4.0.0)
railties (>= 3.2, < 5.0)
foundation-rails (5.5.2.1)
font-awesome-rails (4.6.3.0)
railties (>= 3.2, < 5.1)
foundation-rails (5.5.3.2)
railties (>= 3.1.0)
sass (>= 3.3.0, < 3.5)
globalid (0.3.6)
activesupport (>= 4.1.0)
http-cookie (1.0.2)
domain_name (~> 0.5)
httpclient (2.8.0)
i18n (0.7.0)
jquery-rails (4.0.5)
rails-dom-testing (~> 1.0)
jquery-rails (4.1.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
@@ -145,18 +147,18 @@ GEM
addressable (~> 2.3)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mail (2.6.4)
mime-types (>= 1.16, < 4)
method_source (0.8.2)
mime-types (2.6.2)
mime-types (2.99.2)
mimemagic (0.3.0)
mini_portile (0.6.2)
minitest (5.8.1)
multi_json (1.11.2)
netrc (0.10.3)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
paperclip (4.3.1)
mini_portile2 (2.0.0)
minitest (5.9.0)
multi_json (1.12.1)
netrc (0.11.0)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
paperclip (4.3.6)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
cocaine (~> 0.5.5)
@@ -164,12 +166,12 @@ GEM
mimemagic (= 0.3.0)
pickadate-rails (3.5.6.0)
railties (>= 3.1.0)
poltergeist (1.7.0)
poltergeist (1.9.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
pry (0.10.2)
pry (0.10.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
@@ -178,16 +180,16 @@ GEM
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.4)
actionmailer (= 4.2.4)
actionpack (= 4.2.4)
actionview (= 4.2.4)
activejob (= 4.2.4)
activemodel (= 4.2.4)
activerecord (= 4.2.4)
activesupport (= 4.2.4)
rails (4.2.6)
actionmailer (= 4.2.6)
actionpack (= 4.2.6)
actionview (= 4.2.6)
activejob (= 4.2.6)
activemodel (= 4.2.6)
activerecord (= 4.2.6)
activesupport (= 4.2.6)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.4)
railties (= 4.2.6)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
@@ -195,49 +197,49 @@ GEM
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (4.2.4)
actionpack (= 4.2.4)
activesupport (= 4.2.4)
railties (4.2.6)
actionpack (= 4.2.6)
activesupport (= 4.2.6)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
responders (2.1.0)
railties (>= 4.2.0, < 5)
rake (11.1.2)
responders (2.2.0)
railties (>= 4.2.0, < 5.1)
rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rspec-core (3.3.2)
rspec-support (~> 3.3.0)
rspec-expectations (3.3.1)
rspec-core (3.4.4)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.3.0)
rspec-support (~> 3.4.0)
rspec-its (1.2.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-mocks (3.3.2)
rspec-mocks (3.4.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.3.0)
rspec-rails (3.3.3)
rspec-support (~> 3.4.0)
rspec-rails (3.4.2)
actionpack (>= 3.0, < 4.3)
activesupport (>= 3.0, < 4.3)
railties (>= 3.0, < 4.3)
rspec-core (~> 3.3.0)
rspec-expectations (~> 3.3.0)
rspec-mocks (~> 3.3.0)
rspec-support (~> 3.3.0)
rspec-support (3.3.0)
sass (3.4.18)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
sass (3.4.22)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
slim (3.0.6)
temple (~> 0.7.3)
slim (3.0.7)
temple (~> 0.7.6)
tilt (>= 1.3.3, < 2.1)
slim-rails (3.0.1)
actionmailer (>= 3.1, < 5.0)
@@ -246,30 +248,31 @@ GEM
railties (>= 3.1, < 5.0)
slim (~> 3.0)
slop (3.6.0)
sprockets (3.3.5)
sprockets (3.6.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (2.3.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
temple (0.7.6)
thin (1.6.4)
sprockets-rails (3.0.4)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
temple (0.7.7)
thin (1.7.0)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (~> 1.0)
rack (>= 1, < 3)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.1)
tinymce-rails (4.2.5)
tilt (2.0.4)
tinymce-rails (4.3.12)
railties (>= 3.1.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
warden (1.2.3)
unf_ext (0.0.7.2)
warden (1.2.6)
rack (>= 1.0)
websocket-driver (0.6.2)
websocket-driver (0.6.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
xpath (2.0.0)
@@ -289,7 +292,7 @@ DEPENDENCIES
email_validator
factory_girl_rails
font-awesome-rails
foundation-rails
foundation-rails (~> 5.5)
jquery-rails
launchy
orm_adapter!
@@ -305,3 +308,6 @@ DEPENDENCIES
slim-rails
thin
tinymce-rails
BUNDLED WITH
1.12.3
+1 -1
View File
@@ -1 +1 @@
=raw @page.body
== @page.body
+4 -4
View File
@@ -6,7 +6,7 @@ module Cmtool
page_name = "home"
@page = find_page(page_name)
@sub_pages = @page.children.select{|child| child.in_menu.present? }
render :template => "pages/#{page_name}", :layout => @page.layout.presence || ::Page.layouts.first.to_s
render template: "pages/#{page_name}", layout: @page.layout.presence || ::Page.layouts.first.to_s, formats: [:html]
end
# General catcher for pages
@@ -17,10 +17,10 @@ module Cmtool
@sub_pages = [@page] + @page.children.select{|child| child.in_menu.present? }
template = "pages/#{@page.name}"
if template_exists?(template)
render :template => template, :layout => @page.layout.presence || ::Page.layouts.first
render template: template, formats: [:html], layout: @page.layout.presence || ::Page.layouts.first
return
else
render :layout => @page.layout.presence || ::Page.layouts.first
render formats: [:html], layout: @page.layout.presence || ::Page.layouts.first
end
end
@@ -51,7 +51,7 @@ module Cmtool
private
def find_page(name)
::Page.find_by_name_and_locale(name, I18n.locale.to_s) || ::Page.new(:name => name, locale: I18n.locale.to_s)
::Page.find_by_name_and_locale(name, I18n.locale.to_s) || ::Page.new(name: name, locale: I18n.locale.to_s)
end
end
end
@@ -35,7 +35,7 @@ describe Cmtool::NewsletterSubscriptionsController, type: :controller do
describe "GET show" do
it "assigns the requested newsletter_subscription as @newsletter_subscription" do
newsletter_subscription = create :newsletter_subscription
get :show, :id => newsletter_subscription.id
get :show, id: newsletter_subscription.id
assigns(:newsletter_subscription).should eq(newsletter_subscription)
end
end
@@ -50,7 +50,7 @@ describe Cmtool::NewsletterSubscriptionsController, type: :controller do
describe "GET edit" do
it "assigns the requested newsletter_subscription as @newsletter_subscription" do
newsletter_subscription = create :newsletter_subscription
get :edit, :id => newsletter_subscription.id
get :edit, id: newsletter_subscription.id
assigns(:newsletter_subscription).should eq(newsletter_subscription)
end
end
@@ -59,18 +59,18 @@ describe Cmtool::NewsletterSubscriptionsController, type: :controller do
describe "with valid params" do
it "creates a new Cmtool::NewsletterSubscription" do
expect {
post :create, :newsletter_subscription => build(:newsletter_subscription).attributes
post :create, newsletter_subscription: build(:newsletter_subscription).attributes
}.to change(Cmtool::NewsletterSubscription, :count).by(1)
end
it "assigns a newly created newsletter_subscription as @newsletter_subscription" do
post :create, :newsletter_subscription => build(:newsletter_subscription).attributes
post :create, newsletter_subscription: build(:newsletter_subscription).attributes
assigns(:newsletter_subscription).should be_a(Cmtool::NewsletterSubscription)
assigns(:newsletter_subscription).should be_persisted
end
it "redirects to the newsletter_subscriptions newsletter_subscription" do
post :create, :newsletter_subscription => build(:newsletter_subscription).attributes
post :create, newsletter_subscription: build(:newsletter_subscription).attributes
response.should redirect_to(Cmtool::NewsletterSubscription.last)
end
end
@@ -79,14 +79,14 @@ describe Cmtool::NewsletterSubscriptionsController, type: :controller do
it "assigns a newly created but unsaved newsletter_subscription as @newsletter_subscription" do
# Trigger the behavior that occurs when invalid params are submitted
allow_any_instance_of( Cmtool::NewsletterSubscription ).to receive(:save).and_return(false)
post :create, :newsletter_subscription => {email: ''}
post :create, newsletter_subscription: {email: ''}
assigns(:newsletter_subscription).should be_a_new(Cmtool::NewsletterSubscription)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
allow_any_instance_of( Cmtool::NewsletterSubscription ).to receive(:save).and_return(false)
post :create, :newsletter_subscription => {email: ''}
post :create, newsletter_subscription: {email: ''}
response.should render_template("new")
end
end
@@ -100,19 +100,19 @@ describe Cmtool::NewsletterSubscriptionsController, type: :controller do
# specifies that the Cmtool::NewsletterSubscription created on the previous line
# receives the :update_attributes message with whatever params are
# submitted in the request.
Cmtool::NewsletterSubscription.any_instance.should_receive(:update_attributes).with({'email' => 'test44@cmtool.nl'})
put :update, :id => newsletter_subscription.id, :newsletter_subscription => {'email' => 'test44@cmtool.nl'}
Cmtool::NewsletterSubscription.any_instance.should_receive(:update_attributes).with('email' => 'test44@cmtool.nl')
put :update, id: newsletter_subscription.id, newsletter_subscription: {'email' => 'test44@cmtool.nl'}
end
it "assigns the requested newsletter_subscription as @newsletter_subscription" do
newsletter_subscription = create(:newsletter_subscription)
put :update, :id => newsletter_subscription.id, :newsletter_subscription => newsletter_subscription.attributes
assigns(:newsletter_subscription).should eq(newsletter_subscription)
put :update, id: newsletter_subscription.id, newsletter_subscription: newsletter_subscription.attributes
assigns(:newsletter_subscription).id.should eq newsletter_subscription.id
end
it "redirects to the newsletter_subscription" do
newsletter_subscription = create(:newsletter_subscription)
put :update, :id => newsletter_subscription.id, :newsletter_subscription => newsletter_subscription.attributes
put :update, id: newsletter_subscription.id, newsletter_subscription: newsletter_subscription.attributes
response.should redirect_to(newsletter_subscription)
end
end
@@ -122,7 +122,7 @@ describe Cmtool::NewsletterSubscriptionsController, type: :controller do
newsletter_subscription = create(:newsletter_subscription)
# Trigger the behavior that occurs when invalid params are submitted
Cmtool::NewsletterSubscription.any_instance.stub(:save).and_return(false)
put :update, :id => newsletter_subscription.id, :newsletter_subscription => {email: ''}
put :update, id: newsletter_subscription.id, newsletter_subscription: {email: ''}
assigns(:newsletter_subscription).should eq(newsletter_subscription)
end
@@ -130,7 +130,7 @@ describe Cmtool::NewsletterSubscriptionsController, type: :controller do
newsletter_subscription = create(:newsletter_subscription)
# Trigger the behavior that occurs when invalid params are submitted
Cmtool::NewsletterSubscription.any_instance.stub(:save).and_return(false)
put :update, :id => newsletter_subscription.id, :newsletter_subscription => {email: ''}
put :update, id: newsletter_subscription.id, newsletter_subscription: {email: ''}
response.should render_template("edit")
end
end
@@ -141,20 +141,20 @@ describe Cmtool::NewsletterSubscriptionsController, type: :controller do
@request.env['HTTP_REFERER'] = newsletter_subscriptions_path
newsletter_subscription = create(:newsletter_subscription)
expect {
delete :destroy, :id => newsletter_subscription.id
delete :destroy, id: newsletter_subscription.id
}.to change(Cmtool::NewsletterSubscription, :count).by(-1)
end
it "redirects to the newsletter_subscriptions list" do
@request.env['HTTP_REFERER'] = newsletter_subscriptions_path
newsletter_subscription = create(:newsletter_subscription)
delete :destroy, :id => newsletter_subscription.id
delete :destroy, id: newsletter_subscription.id
response.should redirect_to(newsletter_subscriptions_path)
end
it "redirects to the newsletter_subscriptions list when called from edit page" do
newsletter_subscription = create(:newsletter_subscription)
@request.env['HTTP_REFERER'] = edit_newsletter_subscription_path(newsletter_subscription)
delete :destroy, :id => newsletter_subscription.id
delete :destroy, id: newsletter_subscription.id
response.should redirect_to(newsletter_subscriptions_path)
end
end