Rails: a good way to modify simple static pages? - ruby-on-rails

Is there a way to allow admins to modify the content of simple static pages?
I know I can create a "Pages" model with attributes like "Title", "Content", "Images" etc, and make administrators modify them. But is there a gem for such a thing?

I found a different kind of solution which offered me a more completed way in modifying static pages.
Since pages could be different than simple text I used Mercury editor. Watch the demo in the page. There is a good railscast about that but don't follow it too strictly since something is changed in the new versions(for example the update method is saveUrl while in the cast is called saveURL).
Watch out!: the github project is this, there is another one on github but it didn't work for me.
Hope this will help somebody.

Copycopter was created for this sort of thing. Watch the railscast.

Related

Dynamic forms in rails

So I'm creating a simple application. I have a 'Games' database table and a 'Rules' database table. Each game can have many rules. I want to present a form like this:
Game Title:
Game Description:
Rule #1:
(Click to add another rule)
So the user can click a button to add another text field for additional rules. What is the best way of going about this? Are there form helpers? Any way to return an array of rules? I'm somewhat new to Rails, and my googling didn't provide much help. I may just be being ignorant, but any help would be greatly appreciated!
What you are looking for are called "dynamic forms" and the answer to your question is in the following Railscasts episode.
http://railscasts.com/episodes/403-dynamic-forms
https://github.com/railscasts/403-dynamic-forms
Its kinda late but i hope it helps someone else.
This is old but should be identical to what you are trying to do at the core.
http://railscasts.com/episodes/75-complex-forms-part-3
Just think of Project and Tasks to your Game and Rules.
Use javascript. This would help
http://railscasts.com/episodes/197-nested-model-form-part-2
You'll likely want to use a "game" form with nested "rules" forms. This would be a lengthy answer if I put all the code needed but visiting these should help you right along:
http://railscasts.com/episodes/196-nested-model-form-part-1
http://railscasts.com/episodes/197-nested-model-form-part-2

Ruby on Rails customer-facing formbuilder?

I have a customer that wants to build their own questionnaires. Something like WuFoo (www.wufoo.com) but more secure and contained within the app.
I've looked at Smerf (http://github.com/springbok/smerf) which provides the yaml-to-form conversion, but I'd like something the user can use to create their own forms.
I would look at using active_scaffold. The main version has not been updated for Rails 3, but a fork at the location below has. I think it would work well for your purpose, you just need a way to grab the data and feed it in. Here is a demo of what it looks like when it is running:
https://github.com/vhochstein/active_scaffold
Here is a demo at the top of the page:
http://demo.activescaffold.com/roles
You could always embed Google Forms. Might be easier than reinventing the wheel. Unless you have some specific use case this doesn't cover?
If you are not adverse to going the Javascript route the then you might consider one of the many framework plugins like the JQuery Form Builder. From a usability perspective it seems to me that any good solution is going to involve some Javascript. There should be no reason why this approach wouldn't integrate well into a Rails backend
You might want to check out this one. Dynamic Forms
I too am looking for something very similar. What solution did you come up with?

Which CMS features do you need in Rails?

I am going to write a ContentManagementSystem for RubyOnRails for administration of static pages.
Which features do you prefer to appear in this CMS?
What do you think might be helpful for daily work?
Best regards
Just a good read on Rails & CMS
The Ruby on Rails CMS dillema
something like an drag & drop Template builder.
Userstory :
Create new Page
Take some boxes from the sidebar and put it on an empty page
click the box
add content , pictures etc. to this box
save & publish
.. yeah i want something like this :-) inspired by Wordpress Widget Management.
Look around for existing Rails CMSs likes Radiant, BrowserCms,
Also study Drupal, Wordpress and Joomla in php, they seem to be doing pretty great as CMS's and are awesome at that.
A Django-like in feature but Rails-ish in nature Admin interface. That is the talk of the town these days..
Did you try: http://shane-hippo.blogspot.com/2009/08/hor-experiment-2.html
This experiment shows how you can set up your own application within 15 minutes, with Hippo on Rails.

Rails, One Model, Many Screens

I have a model with many fields (nearly 40). The client wants the fields divided among multiple screens. The model also has a few has_manys that should look like they are part of the same model.
How can one divide the model, and what are the tradeoffs among the ways to do it?
I see a couple of possibilities:
1) Use JavaScript to show and hide parts of the form. I think I can make that one work.
2) Use forms that submit to different actions. Can form_for be used with appropriate options?
I'm looking for other ideas too.
Check out acts as state machine. You can use this to create wizards and whatnot.
Having reread your question, I think Javascript is really what you're looking for. Check out jQuery UI, they've got a tab component that will probably help.
I would check out the ActsAsWizard plugin. Makes doing a wizard like this extremely simple.
Check out the readme it is excellent.

Designing Web Sites with Ruby on Rails

I'm just learning Ruby on Rails. I've read a few books, I've watched lots of Railscasts, I've looked at some examples.
However, when working on my first serious project with Rails, I've gotten hung up on how to properly implement some very basic web site features that most tutorials I've seen lack.
For instance: Navigation menus. Lots of tutorials on how to make a static one, but what about dynamic? If I want to make a navigation bar that's different across pages, how would I go about doing that?
I think that the best way to learn things like this is by seeing example code. Are there any good open sourced sites in RoR? Any example code that I can check out?
I guess my question really results to using MVC. The basic idea is really basic, and I understand that. But it seems that most applications have each part completely separate from each other... what if I want to, say, combine data from two models to display on the same page? To take the example I posed, if I have a NavModel and a PageModel, can my PageController access both models? I guess I'd assumed that a PageController can only access a PageModel, and none other. All examples I've seen seem to operate this way...is that a faulty assumption?
Or am I totally missing the point, and is that 'doing it wrong?'
Open Source Rails is a repository of sites implemented in rails.
Which books have you read? I think a better understanding of MVC and Rails would help you more in the long run than sample code, which you may be tempted to copy without understanding.
The problem you're describing isn't really different from finding and displaying any kind of data, which I'm sure you've seen covered in snippets on blogs, etc. (using partials and/or layouts is maybe the only difference).
If you haven't read them already, you should try Agile Web Development with Rails and The Rails Way.
There are also several books that take you through building a sample application that include commentary to make sure you understand what you're doing.
This might help: Dynamic navigation menu using Menuitem model
Your controller can access any of your models, so if PageController needs to access your NavModel that's fine. I think typically the Nav controller or helper would contain the methods necessary to prepare the navigation view, but without knowing the details of your project I can't say for sure - if you think it's part of the Page logic, then put it there.
You may also be interested in this "What goes where" question.
Heres a howto on highlighting the current menu item in the page you are on
http://snippets.dzone.com/posts/show/2016

Resources