These are chat archives for locomotivecms/v3

4th
Apr 2017
Nikolay Bonev
@DonKoko
Apr 04 08:46
@did I am using gem 'locomotivecms', '3.3.0.rc2' and the problem persists
Manu
@manuchap
Apr 04 08:56
I'm trying ruby 2.4.0 locally right now and will be pushing to heroku in a little while. Heroku's rubies are not listed in rbenv (2.3.4, 2.4.1) so I guess it'll be using 2.3.4 as explained here: https://devcenter.heroku.com/articles/ruby-support#ruby-versions
I let you know how it goes in a moment
Nikolay Bonev
@DonKoko
Apr 04 08:57
I am using 2.3.1
which is specifically defined in my gemfile
so I guess heroku will use that version
Manu
@manuchap
Apr 04 09:18
not too sure about that. see what heroku run ruby -vgives you
Nikolay Bonev
@DonKoko
Apr 04 09:23
yup
2.3.1
→ heroku run ruby -v
Running ruby -v on ⬢ whale-engine-two... up, run.9673 (Standard-1X)
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
Didier Lafforgue
@did
Apr 04 09:27
@DonKoko, the problem persists because you deleted your original theme assets and then re-pushed them with the incorrect mime-type.
so delete them again (that should be the last time) and re-deploy
Manu
@manuchap
Apr 04 09:27
Ok, my bad. I was using an env var for the ruby version which didn't work. Forcing it now (2.4.0) and pushing. Fingers crossed
Manu
@manuchap
Apr 04 09:41
Crashed :-)
[4] ! Unable to load application: NameError: uninitialized constant PlatformAPI::Moneta
bundler: failed to load command: puma (/app/vendor/bundle/ruby/2.4.0/bin/puma)
NameError: uninitialized constant PlatformAPI::Moneta
Nikolay Bonev
@DonKoko
Apr 04 09:43
I had that problem before as well
I use passenger tho
i just remember the error message
Manu
@manuchap
Apr 04 09:43
trying passenger
Nikolay Bonev
@DonKoko
Apr 04 09:44
for me performance with passenger is like 30-40% better
lower latencies and less ram usage
Manu
@manuchap
Apr 04 10:00
Crashed. I'm trying to figure out how to read passenger's logs
Didier Lafforgue
@did
Apr 04 10:46
I do recommend Passenger over Puma in production
Nikolay Bonev
@DonKoko
Apr 04 10:53
@did thats strange because I just tested it on a website that I didn't delete anything
will let you know if it happens again
Didier Lafforgue
@did
Apr 04 10:54
weird indeed. I had this exact same issue 2 weeks ago and my patch fixed it (at least for my sites).
Nikolay Bonev
@DonKoko
Apr 04 10:54
well i have a lot of sites so I can try with a different one later
Didier Lafforgue
@did
Apr 04 10:57
that’d be great. thanks!
Manu
@manuchap
Apr 04 10:58
could you share your procfile passenger line pls?
Nikolay Bonev
@DonKoko
Apr 04 10:58
yep
1 sec
Manu
@manuchap
Apr 04 11:40
do you know how to read passenger's log at heroku?
2017-04-04T11:31:20.041680+00:00 app[api]: Starting process with command `ruby -v` by user manuchap@gmail.com
2017-04-04T11:31:25.999764+00:00 heroku[run.7275]: Awaiting client
2017-04-04T11:31:26.045111+00:00 heroku[run.7275]: Starting process with command `ruby -v`
2017-04-04T11:31:26.245675+00:00 heroku[run.7275]: State changed from starting to up
2017-04-04T11:31:30.531557+00:00 heroku[run.7275]: Process exited with status 0
2017-04-04T11:31:30.546960+00:00 heroku[run.7275]: State changed from up to complete
2017-04-04T11:31:57.626427+00:00 app[web.1]: App 141 stdout: 
2017-04-04T11:32:02.053843+00:00 app[web.1]: App 141 stdout: [Locomotive] Heroku app detected
2017-04-04T11:32:02.445382+00:00 app[web.1]: App 141 stdout: 
2017-04-04T11:32:02.511411+00:00 app[web.1]: [ 2017-04-04 11:32:02.5112 69/7ffb851fd700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /app: An error occurred while starting up the preloader.
2017-04-04T11:32:02.511447+00:00 app[web.1]:   Error ID: 29b7fb2b
2017-04-04T11:32:02.511469+00:00 app[web.1]:   Error details saved to: /tmp/passenger-error.oUkIPV
2017-04-04T11:32:02.511491+00:00 app[web.1]:   Message from application: uninitialized constant PlatformAPI::Moneta (NameError)
2017-04-04T11:32:02.511512+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/platform-api-0.3.0/lib/platform-api/client.rb:77:in `default_options'
2017-04-04T11:32:02.511549+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/platform-api-0.3.0/lib/platform-api/client.rb:62:in `custom_options'
2017-04-04T11:32:02.511551+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/platform-api-0.3.0/lib/platform-api/client.rb:22:in `connect'
2017-04-04T11:32:02.511553+00:00 app[web.1]:   /app/config/initializers/heroku.rb:8:in `<top (required)>'
2017-04-04T11:32:02.511554+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/engine.rb:652:in `block in load_config_initializer'
2017-04-04T11:32:02.511564+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/notifications.rb:166:in `instrument'
2017-04-04T11:32:02.511571+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/engine.rb:651:in `load_config_initializer'
2017-04-04T11:32:02.511573+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
2017-04-04T11:32:02.511592+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/engine.rb:615:in `each'
2017-04-04T11:32:02.511593+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/engine.rb:615:in `block in <class:Engine>'
2017-04-04T11:32:02.511595+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/initializable.rb:30:in `instance_exec'
2017-04-04T11:32:02.511614+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/initializable.rb:30:in `run'
2017-04-04T11:32:02.511615+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
2017-04-04T11:32:02.511633+00:00 app[web.1]:   /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
2017-04-04T11:32:02.511633+00:00 app[web.1]:   /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
2017-04-04T11:32:02.511641+00:00 app[web.1]:   /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
2017-04-04T11:32:02.511643+00:00 app[web.1]:   /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
2017-04-04T11:32:02.511661+00:00 app[web.1]:   /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
2017-04-04T11:32:02.511662+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/initializable.rb:44:in `each'
2017-04-04T11:32:02.511670+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/initializable.rb:44:in `tsort_each_child'
2017-04-04T11:32:02.511677+00:00 app[web.1]:   /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:415:in `call'
2017-04-04T11:32:02.511679+00:00 app[web.1]:   /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
2017-04-04T11:32:02.511697+00:00 app[web.1]:   /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
2017-04-04T11:32:02.511698+00:00 app[web.1]:   /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each'
2017-04-04T11:32:02.511706+00:00 app[web.1]:   /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `call'
2017-04-04T11:32:02.511713+00:00 app[web.1]:   /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
2017-04-04T11:32:02.511715+00:00 app[web.1]:   /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
2017-04-04T11:32:02.511733+00:00 app[web.1]:   /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
2017-04-04T11:32:02.511734+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/initializable.rb:54:in `run_initializers'
2017-04-04T11:32:02.511743+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/application.rb:352:in `initialize!'
2017-04-04T11:32:02.511745+00:00 app[web.1]:   /app/config/environment.rb:5:in `<top (required)>'
2017-04-04T11:32:02.511773+00:00 app[web.1]:   config.ru:3:in `require'
2017-04-04T11:32:02.511774+00:00 app[web.1]:   config.ru:3:in `block in <main>'
2017-04-04T11:32:02.511782+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/builder.rb:55:in `instance_eval'
2017-04-04T11:32:02.511784+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/rack-1.6.5/lib/rack/builder.rb:55:in `initialize'
2017-04-04T11:32:02.511802+00:00 app[web.1]:   config.ru:1:in `new'
2017-04-04T11:32:02.511804+00:00 app[web.1]:   config.ru:1:in `<main>'
2017-04-04T11:32:02.511812+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/passenger-5.1.2/src/helper-scripts/rack-preloader.rb:110:in `eval'
2017-04-04T11:32:02.511813+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/passenger-5.1.2/src/helper-scripts/rack-preloader.rb:110:in `preload_app'
2017-04-04T11:32:02.511832+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/passenger-5.1.2/src/helper-scripts/rack-preloader.rb:156:in `<module:App>'
2017-04-04T11:32:02.511833+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/passenger-5.1.2/src/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
2017-04-04T11:32:02.511843+00:00 app[web.1]:   /app/vendor/bundle/ruby/2.4.0/gems/passenger-5.1.2/src/helper-scripts/rack-preloader.rb:29:in `<main>'
2017-04-04T11:32:02.511845+00:00 app[web.1]: 
2017-04-04T11:32:02.511847+00:00 app[web.1]: 
2017-04-04T11:32:02.517016+00:00 app[web.1]: [ 2017-04-04 11:32:02.5168 69/7ffb63fff700 age/Cor/Con/CheckoutSession.cpp:285 ]: [Client 3-1] Cannot checkout session because a spawning error occurred. The identifier of the error is 29b7fb2b. Please see earlier logs for details about the error.
2017-04-04T11:32:02.520079+00:00 heroku[router]: at=info method=GET path="/" host=manuchap.herokuapp.com request_id=2200da63-74f8-421c-a2c1-b575e7b8386a fwd="77.135.120.218" dyno=web.1 connect=0ms service=4949ms status=500 bytes=5151 protocol=https
Nikolay Bonev
@DonKoko
Apr 04 11:54
hmm
let me check
but man
i had the same error
let me try to remember how i fixed it
@manuchap can you send me your gemfile
i think i know what the issue is
Manu
@manuchap
Apr 04 11:56
source 'https://rubygems.org'
ruby '2.4.0'

# gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.2.5'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Puma as the app server
# gem 'puma'
gem 'passenger'

# Upload files to AWS S3
gem 'carrierwave-aws'

# DEV
# gem 'locomotivecms', '~> 3.3.0.rc1'
# gem 'locomotivecms_steam',  github: 'locomotivecms/steam', branch: 'master'

# GITHUB
# gem 'locomotivecms', github: 'locomotivecms/engine', ref: '34e6188'
# gem 'locomotivecms_steam', github: 'locomotivecms/steam', branch: 'master'

# STABLE
gem 'locomotivecms', '~> 3.3.0.rc2'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

group :production do
  gem 'rails_12factor'
end

gem 'platform-api', '~> 0.3.0'
gem 'rack-cors'
Nikolay Bonev
@DonKoko
Apr 04 11:57
yeah
i remember the problem
its your platform-api versions
you need to bump it up
i am personally using the latest one
here is my gemfile:
source 'https://rubygems.org'

if ENV['HEROKU_APP_NAME']
  ruby '2.3.1'
end

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.2.6'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Puma as the app server
# gem 'puma'

# Use Passenger as the app server
gem 'passenger', '>= 5.0.22'

# Upload files to AWS S3
gem 'carrierwave-aws'

# DEV
# gem 'locomotivecms', '~> 3.1.1'
# gem 'locomotivecms', github: 'locomotivecms/engine', ref: '8d091ff'
# gem 'locomotivecms_steam',  github: 'locomotivecms/steam', ref: '0681850'
#
# gem 'locomotivecms_steam', :git => 'https://github.com/locomotivecms/steam', ref: 'e624ab686'
# gem 'locomotivecms',       :git => 'https://github.com/locomotivecms/engine', ref: 'd5c959e'
# gem 'custom_fields',       :git => 'https://github.com/locomotivecms/custom_fields', ref: '4a612e5'
#

gem 'puma_worker_killer'

gem 'derailed', group: :development

# GITHUB
# gem 'locomotivecms', github: 'locomotivecms/engine', branch: 'master'
# gem 'locomotivecms_steam', github: 'locomotivecms/steam', branch: 'master'

# STABLE
gem 'locomotivecms', '3.3.0.rc2'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

group :production do
  gem 'rails_12factor'
end

gem 'platform-api'
Nikolay Bonev
@DonKoko
Apr 04 12:03
@did how is front-end search looking in the future plans for loco :)
I already spent so much time building searches using with_scope and actions that I could have probably built it for loco :)
Nikolay Bonev
@DonKoko
Apr 04 12:14
Did anyone already use this : new page property: display_settings. This allows to hide a page and its children from authors
I am trying to use it but I cant figure out the syntax and its not in the docs yet
Manu
@manuchap
Apr 04 12:21
@DonKoko thx a bunch. It's kinda working (I kept my gem file since yours didn't work locally (although I used ruby 2.4.0) and upped platform-api). Right now it's perfect locally but I have no assets at heroku although I recompiled them. Getting closer thx!!!!
btw I'm also trying to dev a search engine using filter js: https://github.com/manuchap/loco_templates/tree/filtered_lists
gotta move. I'll keep you posted
Nikolay Bonev
@DonKoko
Apr 04 12:24
@manuchap dont know about the assets. I remember I also had some issue with it but not sure if it was when changing the loco version or the server
as for the search, I already built it on 2 website, with searching though related content entries
it works, but its very ugly with lots of cases and and ifs
with so many files, and snippets and so on
I am still proud of it as its the best I could achieve but it can be better for sure
Nikolay Bonev
@DonKoko
Apr 04 12:31
@manuchap I now see you are doing it with a very different approach than mine. I like what you are doing. Would be great to know how it goes
Manu
@manuchap
Apr 04 12:36
Yeah it's not exactly a search engine and it's not optimized yet for big volumes but i'll be glad to show you around when I'm back (in an hour or two)
Nikolay Bonev
@DonKoko
Apr 04 12:37
okey okey
let me know when you are back
I am not sure if I would be available but I would love to hear more about it
superturbo
@superturbo
Apr 04 12:41
@DonKoko it's the same like content_types.
display_settings:
hidden: true
Nikolay Bonev
@DonKoko
Apr 04 12:43
@superturbo thanks man. :)

@did problem with

# Error description:
Resource invalid: source New file does not have the original extension

still happens to me

Nikolay Bonev
@DonKoko
Apr 04 13:34
I am getting an exception when executing an action
any ideas:
Screen Shot 2017-04-04 at 15.33.34.png
I cant see to figure it out
Nikolay Bonev
@DonKoko
Apr 04 13:53
super strange, i dont get how suddenly this error comes up :(
and sometimes it just give a white screen with the text: Incomplete response received from application
Nikolay Bonev
@DonKoko
Apr 04 14:26
my action is super simple and it creates the object in the DB, but whatever I put in the response page, it just fails
{% action "Create a subscription for an event" %}

  var params = getProp('params');

  var subscription = createEntry('subscriptions', { message: params.message,
                                                    member: params.member,
                                                    event: params.event });
  // if (subscription) {
  //   setProp('response', 'Gelukt!');
  //   setProp('explanation', 'Je bent succesvol aangemeld.');
  // } else {
  //   setProp('response', 'Oeps...');
  //   setProp('explanation', 'Er ging iets mis. Probeer het later nogmaals of neem contact met ons op.');
  // }

  redirectTo('evenement');
{% endaction %}
Nikolay Bonev
@DonKoko
Apr 04 15:25
k, I am totally baffled now. Even if I use a model form i get the white screen with Incomplete response received from application
this happens only with this content_type
Manu
@manuchap
Apr 04 16:02
I'm back - but completely lost; had a panic attack :-) I was close to solving the assets issue but the I broke everything so I rollback from heroku, ditched my local repo and cloned it again. Now heroku tells me I'm using puma (which is much faster than passenger although not locally) on ruby 2.2.2p95 even though my gem file and configs say passenger on 2.4.1
I don't have a clue but everything's back to functional.
Which might not be the state of me after I finish this drink...
Nikolay Bonev
@DonKoko
Apr 04 16:07
oh my god
so I am not the only one getting crazy today
Manu
@manuchap
Apr 04 16:07
nope
Nikolay Bonev
@DonKoko
Apr 04 16:08
I am seriously going to loose it soon
every single form works except this one
and this shitty ass error
Manu
@manuchap
Apr 04 16:10
Sometimes when sh... goes haywire I just kill the site and push it again...
Nikolay Bonev
@DonKoko
Apr 04 16:11
i would do the same but this is a website where i have a whole member login/edit/register system
with like 400 companies using it
very actively
I can only do it later and doing shit like this at night is even scarier
Manu
@manuchap
Apr 04 16:17
True. So far I dev with wagon push to a local clone before pushing to prod but none of the three steps give similar results so I'm considering a fourth step with a staging server on the prod side...
Nikolay Bonev
@DonKoko
Apr 04 16:19
yeah, that is the most legit way for testing tbh
Manu
@manuchap
Apr 04 16:40
about you action, I don't know if we should use single or double quotes everywhere or wether it makes a difference but I'd stick with one or the other for consistency. (or if we can use backticks ES6 style?)
Nikolay Bonev
@DonKoko
Apr 04 16:41
in my experience the single/double quotes doesn't matter anymore
and i am sure thats not the issue
i made a completely different form
using model_form and I still get the same error
no matter if I use ajax or html
I am sure its on engine level now
Nikolay Bonev
@DonKoko
Apr 04 16:48
seems like the engine goes into a loop when trying to create an entry and the whole app crashes
Manu
@manuchap
Apr 04 16:54
can you try this (stab in the dark):
  var params = getProp("params");

  var subscription = createEntry("subscriptions", "{ message: params.message }", "{ member: params.member }", "{ event: params.event }");
  // if (subscription) {
  //   setProp('response', 'Gelukt!');
  //   setProp('explanation', 'Je bent succesvol aangemeld.');
  // } else {
  //   setProp('response', 'Oeps...');
  //   setProp('explanation', 'Er ging iets mis. Probeer het later nogmaals of neem contact met ons op.');
  // }

  redirectTo("evenement");
Nikolay Bonev
@DonKoko
Apr 04 16:57
I can
Manu
@manuchap
Apr 04 16:58
It's a wild guess, I don't know the rest of your code and I'm getting fuzzy by the minute at this hour ;-)
Nikolay Bonev
@DonKoko
Apr 04 16:59
I am trying now with model_form html
it works
Manu
@manuchap
Apr 04 17:04
:-)
Nikolay Bonev
@DonKoko
Apr 04 17:06
so fcking wierd. I really think its something to do with json
Manu
@manuchap
Apr 04 17:07
Json prefers double quotes
Nikolay Bonev
@DonKoko
Apr 04 17:11
alright, good to know
Manu
@manuchap
Apr 04 17:11
especially when you have strings containing unescaped apostrophes (single quotes)
Nikolay Bonev
@DonKoko
Apr 04 17:12
i changed everything to double quotes, gonna test again with json this time
btw this is my form:
{% model_form "subscriptions", id: "eventSubscriptionForm", class: "text-left", json: true %}
{% csrf_param %}
.alert.alert-success{style: "display: none;"}
  %p
    %strong Gelukt!
    Je bent succesvol aangemeld.
.alert.alert-danger{style: "display: none;"}
  %p
    %strong Oeps...
    Er ging iets mis. Probeer het later nogmaals of neem contact met ons op!
%input{ type: "hidden", name: "content[event]", value: "{{ event._id }}", required: true }
%input{ type: "hidden", name: "content[member]", value: "{{ current_user._id }}", required: true }
.form-group.form-group-default.required
  %label Lid:
  %input{ type: "text", class: "form-control", style: "color: rgba(98, 98, 98, 1);", name: "member_name", value: "{{ current_user.company_name }}", required: true, disabled: true}

.form-group.form-group-default.required
  %label Bericht:
  %textarea{ type: "text", class: "form-control", name: "content[message]", required: true, rows: "10", style: "height: 200px;" }
    {{ params.message }}
%input{ type: "submit", class: "form-control", value: "Verstuur" }
{% endmodel_form %}
and js:
$(function() {
  $('#eventSubscriptionForm').on('submit', function(e) {
    e.preventDefault();
    var form = $(this);


    form.find('.alert-danger').hide();

    var payload = form.serialize();

    function showError() {
      form.find('.alert-danger').fadeIn();
    }

    var xhr = $.ajax({
      type: 'POST',
      url: form.attr('action'),
      data: payload,
      dataType: 'json'
    });

    xhr.done(function(d) {
      form.find('.alert-success').fadeIn();
      form.find('.form-group, .form-control').fadeOut();
    });

    xhr.fail(function(d) {
      showError();
    });
  });
});
Manu
@manuchap
Apr 04 17:19
Does it work with wagon too?
I disregarded the json param. Good to know
like to see haml :-) but I'm too lazy to use it all the time. Too much copy/paste :-)
Thx for sharing
Nikolay Bonev
@DonKoko
Apr 04 17:21
i love haml so much
well the same form basically i have on another website and it works like a charm
I have a suspicion why this was happening
and if I am right, I would feel like the biggest idiot ever
I doubt it but still gotta try
Nikolay Bonev
@DonKoko
Apr 04 17:32
man, i am so glad I didn't delete all assets in production as wel talked
my staging site got completely fucked when I did it
Manu
@manuchap
Apr 04 17:35
Cool! (yeah it was a last resort workaround :-/)
Nikolay Bonev
@DonKoko
Apr 04 17:45
yeah, well i realized that deploying broke my css files
[Error] Did not parse stylesheet at 'https://whale-engine.s3-eu-west-1.amazonaws.com/sites/5774da8e38abae03201d27ea/theme/stylesheets/plugins/font-awesome/css/font-awesome.css?1491327397' because non CSS MIME types are not allowed in strict mode.
[Error] Did not parse stylesheet at 'https://whale-engine.s3-eu-west-1.amazonaws.com/sites/5774da8e38abae03201d27ea/theme/stylesheets/plugins/bootstrap/css/bootstrap.min.css?1491327397' because non CSS MIME types are not allowed in strict mode.
Manu
@manuchap
Apr 04 17:53
Might be cors related?
Nikolay Bonev
@DonKoko
Apr 04 17:54
nope, havent change anything
as far as I remember new wagon/engine minifies assets
and i think something went wrong there
and that is what was breaking my form
or actually breaking my js file so the action didn't work
Didier Lafforgue
@did
Apr 04 17:58
hey @DonKoko
just saw your github issue
Manu
@manuchap
Apr 04 17:58
Do you have a domain on your staging site or is it blabla/preview? (I noticed the /preview didn't work with js)
Didier Lafforgue
@did
Apr 04 17:58
this looks like another issue to me
I’m curious. Did you try a curl -I <asset url> to see what the mime-type of your failed asset is?
Nikolay Bonev
@DonKoko
Apr 04 17:59
1 sec
Didier Lafforgue
@did
Apr 04 18:00
alright
Content-Type: text/x-csrc
this is not correct
Nikolay Bonev
@DonKoko
Apr 04 18:01
yep
Didier Lafforgue
@did
Apr 04 18:01
hmmm
Nikolay Bonev
@DonKoko
Apr 04 18:01
this is the default bootstrap css file
Didier Lafforgue
@did
Apr 04 18:01
it’s not related to Wagon
Nikolay Bonev
@DonKoko
Apr 04 18:01
havent made any changes to it
Didier Lafforgue
@did
Apr 04 18:02
the mime-types gem has been updated in 3.3.0
Nikolay Bonev
@DonKoko
Apr 04 18:02
i couldnt delete because I was getting the other error on the bootstrap.js file
Didier Lafforgue
@did
Apr 04 18:02
?!
Nikolay Bonev
@DonKoko
Apr 04 18:02
i couldnt push i mean
Didier Lafforgue
@did
Apr 04 18:02
you should be able to push it
Nikolay Bonev
@DonKoko
Apr 04 18:02
so i deleted all theme assets and deployed again
and when i did, i get this error
Didier Lafforgue
@did
Apr 04 18:03
could you try to push on locomotivecms.com please?
Nikolay Bonev
@DonKoko
Apr 04 18:03
I also tried with the non-minified version of the file, same result
Didier Lafforgue
@did
Apr 04 18:03
and if it causes the same error during the deployment, give me access to your Wagon git repository.
thanks!!!
this issue story lasts too long
(dinner time, will come back later)
Nikolay Bonev
@DonKoko
Apr 04 18:06
okey, i think i will also have to leave the office now before my brain leaks out from my ears
trying to deploy now
Manu
@manuchap
Apr 04 18:08
dinner time for me too. Bon appétit!
Nikolay Bonev
@DonKoko
Apr 04 18:08
Another question, i use this for my form
$(function() {
  $('#eventSubscriptionForm').on('submit', function(e) {
    e.preventDefault();
    var form = $(this);


    form.find('.alert-danger').hide();

    var payload = form.serialize();

    function showError() {
      form.find('.alert-danger').fadeIn();
    }

    var xhr = $.ajax({
      type: 'POST',
      url: form.attr('action'),
      data: payload,
      dataType: 'json'
    });

    xhr.done(function(d) {
      form.find('.alert-success').fadeIn();
      form.find('.form-group, .form-control').fadeOut();
    });

    xhr.fail(function(d) {
      showError();
    });
  });
});
it creates the object but returns fail
I will give you access to the repo right now
I added you to both the site repo and to our engine repo
Didier Lafforgue
@did
Apr 04 19:03
@DonKoko let’s see that tomorrow
Nikolay Bonev
@DonKoko
Apr 04 19:16
@did sounds good. I am also done for day. Enjoy your evening.
Didier Lafforgue
@did
Apr 04 19:17
you too!