Open eqmx opened 10 years ago
@eqmx I'm testing a Rails4 branch as we speak. Comments from you would be helpful, and then we can pull back to @konung
https://github.com/kastman/comfy_imprint/tree/rails4
You can use this branch by listing comfy-imprint in your gemfile like:
gem 'comfy_imprint', :github => 'kastman/comfy_imprint', :branch => 'rails4'
I added following in gem file and did bundle update/bundle install it worked fine. gem 'comfy_imprint', :github => 'kastman/comfy_imprint', :branch => 'rails4'
when I do migrations "comfy_imprint:install:migrations" I get following error comfy_imprint:install:migrations: command not found
I tried setting up path export PATH=$PATH:/usr/local/git/bin/ but still getting same error. Sorry, I am new to rails!
I appreciate your help Kastman! Thanks!
You're almost there - that's a rake command like the migration right below it:
rake comfy_imprint:install:migrations
rake db:migrate
I updated it in the readme in my repo. Goood luck!
Thanks that worked; however, copied "mount ComfyImprint::Engine, at: "/contact-us"" to routes.rb,
ran this command $rake comfy_imprint:install:copy_initializer
and started rails server but not able to pull-up localhost:3000/contact-us gives following error
Page Not Found at: "contact-us"
Hmm, sounds like you're doing everything right. Can you send the output of rake routes
? At the top you should see:
Prefix Verb URI Pattern Controller#Action
comfy_imprint /contact-us ComfyImprint::Engine
and at the bottom you should see something like:
Routes for ComfyImprint::Engine:
contacts GET /contacts(.:format) comfy_imprint/contacts#index
POST /contacts(.:format) comfy_imprint/contacts#create
new_contact GET /contacts/new(.:format) comfy_imprint/contacts#new
thank_you GET /thank_you(.:format) comfy_imprint/contacts#thank_you
root GET / comfy_imprint/contacts#new
I doubt it, but maybe there's a typo in your route? Or it could possibly have to do with the order of the routes? I have mine at the very top of routes.rb, above root and comfy_route and verified that it's working for me with 'localhost:3000/contact-us'
It's been a while since I did focused Rails work so I'm sorry if my help are just guesses at this point!
Thanks for the quick reply, I am now able to see contact-us form. I had my mount ComfyImprint::Engine, at: "/contact-us" after other routes I had to move it at the top. Is there a way to modify form using admin panel in comfy other than /config/initializers/comfy_imprint.rb?
Glad it's working for you. You can do basic customization in config/initializers/comfy_imprint.rb
- things like the config.sections_to_display
and config.attributes_to_display
let you disable, say, a phone number entry field (or change the order that attributes are displayed). The form is rendered using the simple_form gem, which does a pretty good job of semantically labeling the fields and giving you good css class hooks, so between the config and some basic css rules you might be able to get all the customization that you want. This is generally considered the preferred method and will be the most flexible if you later update the imprint gem, for example.
However, this is often not enough. Luckily, comfy_imprint is a rails engine and you can override any of the views (well, there are only two, new and thank_you). Practically, this involves adding erb or haml files in the main app's tree that mirrors the layout of the engine. So, you'd want to add an overriding view in app/views/comfy_imprint/contacts/new.html.erb
of the main app. Here's a stripped down version of the one I ended up using, with some content for simple_form and bootstrap: https://gist.github.com/kastman/8425640
Hope that helps, Erik
Ouuuch! To quote my fav character....
Mmmmm This is embarrassing guys, apparently all of notifications from this conversation were going into SPAM folder. I just noticed 5 stars on the projects. Really sorry.
Anyways I haven't done any CMS works since I setup this gem, so I didn't try this with CMS & Rails 4. I'll gladly pull in any requests if you choose too send me one, and will push updated gem to rubygems.org. Nick
Hey Nick,
I haven't made any changes since January, but it's also been working in a very low-traffic production site since then without any problems. I don't even remember what I was waiting for for the PR, but I'll send one now. Feel free to comment and I'll make any fixes you think are appropriate - really the only concern would be possibly changing some of the dependencies within the engine (I think simpleform 2->3, if I recall?)
Take a look and see what you think. Best, Erik
If would be great if it can work with new CMS that is in Rails4.
Thanks!