A bit of consolidation required

Getting pictures working turned into a much harder process than i thought. Before i put movies in, i think i need to do a little bit of tidying and general improvement. Such as (still to do are in red)

  • add textilize functionality to the relevant displays
    • done
    • Discovered that textilize(blah) automatically puts the output in a <p> element which i didn’t want. Fortunately there’s a textilize_without_paragraph() method as well. Sweet.
  • add some half decent styles and make the various view components use them appropriately
    • list page- looks ok
    • show page – article list is nasty.
    • Story and link titles should use the same style, now called “title_list
    • summaries and comment bodies should use the same style, “summary_list”
    • any “added by fredd 2 minutes ago” bit should now use “poster_name”
    • titles on pages now use”title_show”
    • summaries on pages now use “summary_show”
    • added classes “tags_show” and “body_show” for any tags and bodies
    • put options links (such as “back”, or “go to list”) in style ‘option_link’
    • made sure that list headers like Comments etc use style ‘list_header’
    • Generally put everything in an appropriate style. The styles themselves could still do with a bit of work.
  • make an edit story page that isn’t fugly.
    • It looks a bit nicer. Made it less table-y and more list-y. Made show_story page nicer as well, including only showing tags, summary, body, pictures or movies if there are any of them actually there.
  • add some more links – eg if you are the user who added a story you can move from show_story to edit_story
  • also some more ‘back’ links (and fix them- eg’back’ on the add_link form takes you to the list.)
    • can use existing save_page partial and session[:return_to] for this.
    • Actually, i shouldn’t as the log in and out uses that already so there’ll be crossover confusion between logging in and out and moving around.
  • do some controller refactoring, for the sake of the urls (and general cohesion) – there shouldn’t be a NewspipeController for example, otherwise the url will be http://www.newspipe.com/newspipe which looks a bit wrong. Should split the current controller actions up into ArticleController, StoryController, LinkController, CommentController, PictureController. Maybe eclipse can help with this?
    • Eclipse can help a bit with a global search and replace – this is very useful for dealing with partials.  Doing that at the moment – putting partials in the appropriate view classes.
    • OK – that took ages.  Here goes.
      • The stylesheets aren’t being picked up.
        • Ah – it’s not using the layouts, that’s why.
      • Spotted a couple of error, to do with calling methods (probably calling the wrong controller)…ah, i see what it is: tricky!  The ‘list_story’ partial, even though it lives in the story view folder, is calling the show method for ‘article’, because the partial is inside the article view when it is listed.  I’m going to go through all the partials and make them specify a controller.
      • Couple of other things.  Think it’s all sorted out now.
      • Also noticed that the title code was broken – did a big set of nested case statements which analyse controller_name and action_name.
  • change what happens if someone adds an article that is already an article or a link: in both cases the story should have 1 point added to its score and the user notified either that ‘a link has been converted into an article’ or ‘the article is already present, you have added to its score’.
  • put in some handling code for going back to ‘show’ pages for things that have been deleted – “if @picture = nil” etc
    • This requires some exception handling – about time that i did this in rails!
  • make pictures act as a link to the show picture page
  • If someone deletes a picture, we need to delete the file as well.

Aside – a note on automatically getting the method that called the current method (useful for going back):

You can use caller inside the method, or perhaps params[:action].I wouldn't do it that way though. Just allow the method to take aparameterspecifiying if that extra bit of code should be run.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s