Comments
-
Greg Hurrell
Ok, on thinking about this for a while the design I currently have in mind is as follows:
First up, we'll be adding a
Page
model. Products will "have many" pages. (In reality we're talking about an "index" page, "buy" page, "download" page, "FAQ/Support" page and little else.)The
Page
model is really just a simple container for arbitrary HTML data. It will "belong to" the parentProduct
model. One page for each product will have it'sdefault
attribute set, indicating that it should be shown when no other page is specifically requested (ie. this is the "index" page).The content will be arbitrary HTML, and possibly inline JavaScript if required to implement effects (the classic "lightbox" effect, but without the black background). Content will be basically static, infrequently updated, so the pain of pasting into a browser won't have to be suffered too often. In the event that dynamic content be needed I could consider using ERB instead of pure HTML, but we'll cross that bridge when and if we come to it.
I'll need to think about how to preview this stuff because ideally I'll want to do at least the initial mockups as static HTML pages.
I'll have special CSS in a
products.css
file that is included for all actions in theProductsController
. The HTML should be very clean (headings, paragraphs, lists,img
tags), with maximum use of CSS so that the visuals can be easily controlled for all products at once.A common JavaScript page,
products.js
may also be included if the need arises (lightbox functions etc).Images, at least for now, will be manually uploaded to a static assets directory. Later could consider adding an interface for it.
The
Product
model will have two more fields added,header
andfooter
, containing arbitrary HTML to be shown above and below each page.Design principles:
- pages should be attractive
- pages should be short
Some notes on what this isn't:
- we store stuff in the database rather than as templates in the application source code because we don't want to have to do deployments just to update the product pages
- we store stuff in the database rather than as files on disk because we want this to be editable from anywhere without the use of an SFTP client
-
Greg Hurrell
Thinking more about the idea of running the HTML through ERB first (seeing as the pages will be cached and speed is not an issue), was trying to think of use cases.
About the nicest used for this would be to be able to use
[[wiki link markup]]
like this:... with <%= "[[Mac OS X]]".w %> or above ...
But that would actually work because all wikitext output is wrapped, at least, in
<p></p>
(or similar block-level) tags:... with <p><a href="/wiki/Mac_OS_X">Mac OS X</a></p> or above ...
So for inline styling it simply wouldn't work and it's debatable that typing ERB tags and the wikitext markup would be much easier than just typing the HTML in the first place.
A more tempting use case is for using path helpers:
... more information in <%= link_to 'the forums', forums_path %>.
Instead of typing:
... more information in <a href="/forums">the forums</a>.
Although that too, isn't all that convincing.
One place where wikitext markup would work would be when using it for entire paragraphs:
... and all that. <%= %q{This is a slab of [[wikitext]] which can have [/forums links] and all kinds of other stuff in it.}.w%> And by the way ...
But even that is not all that convincing.
-
Greg Hurrell
Thinking about how I am going to do the routing here.
With the standard products resource which "has many" pages, you wind up with URLs like:
-
/products/foo
(to show product "foo") -
/products/foo/pages/welcome
(to show the "welcome" page of product "foo")
But I think I'd prefer to have URLs like:
-
/products/foo/welcome
(to show the "welcome" page for "foo")
As far as I know I can't do this using the standard RESTful
:has_many
helper inconfig/routes.rb
.Might have to add a separate route like:
map.product_pages '/products/:product_id/:page_id', :controller => 'products', :action => 'show', :protocol => 'https'
(Note that I could let this be handled by the
PagesController
, but to the user the page content looks embedded in the product pages and doesn't actually look like a separate resource at all, so that's why we let this be handled by theProductsController
.)Not sure if it will work, but that's the general idea.
-
-
Greg Hurrell
Ok, the backend for this is basically down now.
I can view products, create, edit, delete pages etc. Now I just need to start porting over the content from the old site.
-
Greg Hurrell
This is a blocker for ticket #1314.
-
Greg Hurrell
This is pretty much done and deployed now. It's been in use with the new Synergy product pages for some time, and it has worked out quite well. Will mark as closed.
-
Greg Hurrell
Status changed:
- From: new
- To: closed
Add a comment
Comments are now closed for this issue.