Sha256: 2b29e4bae80d7852ebf89438f36e34992a2fcefe8a1fe33b8192e0c7645d45f0

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

#require "inc/utility"

module Generator 

  class JSSkin < HTMLSkin

    def initialize
      super( "js" )
    end

    def create( albums_dir, album )
      @albums_dir = albums_dir
      copy_skin_res( albums_dir )
      rec_albums( album )
    end

    def rec_albums( album )
      # outdir: where to write html files
      outdir = @albums_dir + File::Separator + "js"
      if album.reldir != "."
        outdir += File::Separator + album.reldir 
      end
      File.mkpath( outdir ) unless File.exist?( outdir )
      create_album_page( album, outdir )
      create_slideshow( album, outdir )
      # recurse on each subnode
      album.subalbums.each{ |subalbum| 
        rec_albums( subalbum )
      }
    end

    def create_slideshow( album, outdir )
      require "inc/generator/resource"
      require "inc/skins/#{skin_name}/slideshow_page"

      args = {
        :relroot => "../" * ( album.depth + 1 ),
        :resource => Resource.new,
        :album => album,
      }
      page = view_slideshow_page args
      outpath =  outdir + File::Separator + "slideshow.html"
      File.open( outpath , "w" ) { |f| 
        f.puts page
      }
    end
  end # JSTheme


end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gf-ralbum-0.0.2 lib/ralbum/skins/js/js_skin.rb
gf-ralbum-0.0.5 lib/ralbum/skins/js/js_skin.rb