Crabgrass modifications to add pads to each picture in gallery

The branch is in github.com/janaya/Crabgrass-Core/tree/p... (include the changes made for the etherpad-lite branch)

The code is based on the etherpad-lite branch github.com/janaya/Crabgrass-Core/tree/e... documented in Etherpad-lite integration in Crabgrass and include the modifications for adding tags to the pictures in github.com/janaya/Crabgrass-Core/tree/p... documented in Crabgrass modifications to add picture tagging.

The ideal would be to make any object (Pages and Assets) “paddable” using mixins.

The class Padded was created to have mixins in the classes with methods for using the Pad but it’s not currently used.

This code links Pad to Showings, thought to do it more generic is Asset that should be linked to Pad.

Here we just duplicate code developed to add pads to the Pages for pictures (Images).

Really dirty solution.

Files changed/added

app/controllers/assets_controller.rb
db/migrate/20120701204329_create_image_pa ds.rb
db/migrate/20120702001514_add_pad_to_show ing.rb
db/schema.rb
extensions/pages/gallery_page/app/controllers/gallery_image_controller.rb
extensions/pages/gallery_page/app/models/gallery.rb
extensions/pages/gallery_page/app/models/image_pad.rb
extensions/pages/gallery_page/app/models/showing.rb
extensions/pages/gallery_page/app/views/gallery_image/show.html.haml
extensions/pages/pad_page/app/controllers/pad_page_controller.rb
extensions/pages/pad_page/app/models/pad
page.rb
lib/crabgrass/page/padded.rb

Process followed

Model:

The code in lib/crabgrass/page/padded.rb is mainly a copy of

extensions/pages/pad_page/app/models/pad_page.rb

As it’s finally not used, it’s copied in

extensions/pages/gallery_page/app/controllers/gallery_image_controller.rb

Copied

extensions/pages/pad_page/app/models/pad.rb

into

extensions/pages/gallery_page/app/models/image_pad.rb

View:

The etherpad iframe that was in

extensions/pages/pad_page/app/views/pad_page/show.html.erb

is copied into

extensions/pages/gallery_page/app/views/gallery_image/_show.html.haml

The helper in

extensions/pages/pad_page/app/helpers/pad_page_helper.rb

is copied (renaming the methos) into

extensions/pages/gallery_page/app/controllers/gallery_image_controller.rb

Controller:

The PadPageController methods in

extensions/pages/pad_page/app/controllers/pad_page_controller.rb

are copied too into to GalleryImageController in

extensions/pages/gallery_page/app/controllers/gallery_image_controller.rb