Viewing Topic Train BBCode Editor

Arcath
Avatarpic-l
Admin
Posts: 20
My latest project is the TrainBBCode Editor. It is an editor for my TrainBBCode gem that allows new users who have never used bbcode before to make nicely formatted posts, whilst still allowing the users who have mastered bbcode to type it them selves.

I left the ability to type in your own bbcode intact for a couple of reasons:
  1. If a user has never seen that the site uses BBCode then when they go to a machine without Javascript enabled they will be faced with a white box and no hope to format.
  2. My friend always moans when I take away his ability to write the code himeslf



So the problem then became "How do you un-obtrusively add a preview of the content without having the developer modify loads of files?"

My Solution to this was to have a generator make a tbbce_controller with an index.js.erb view.

When the user presses the preview button the contents of the text area is sent to this view. This view then parses the bbcode and places the output into the div that holds the preview.




My Blog