projects
/
quanlib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add `arrived` attribute (file creation timestamp) to books table.
[quanlib.git]
/
page.rb
diff --git
a/page.rb
b/page.rb
index 2e5d73524c3fd9d0689b29576b93ab6560bd19b9..638f9ad1b7c064698c0078e9a34524c8a0ed3d58 100644
(file)
--- a/
page.rb
+++ b/
page.rb
@@
-1,10
+1,12
@@
-require '
store
'
+require '
fileutils
'
+require_relative 'store'
class Page
def initialize(store)
@back = nil
@forward = nil
class Page
def initialize(store)
@back = nil
@forward = nil
+ @index_file = 'index.html'
@output_dir = 'output'
@special = nil
@store = store
@output_dir = 'output'
@special = nil
@store = store
@@
-20,6
+22,10
@@
class Page
@forward = value
end
@forward = value
end
+ def index_file=(value)
+ @index_file = value
+ end
+
def navig_link(data)
if (nil == data)
return ''
def navig_link(data)
if (nil == data)
return ''
@@
-48,8
+54,10
@@
class Page
book = @store.load_book(id)
image = nil
if nil != book.cover
book = @store.load_book(id)
image = nil
if nil != book.cover
- @imageCount += 1
- (path, mimeType) = book.cover.write_image(@output_dir, 'image' + @imageCount.to_s)
+ #@imageCount += 1
+ #(path, mimeType) = book.cover.write_image(@output_dir, 'image' + @imageCount.to_s)
+ #image = '<img class="cover-thumb" src="' + path + '"/>'
+ path = book.cover.path
image = '<img class="cover-thumb" src="' + path + '"/>'
else
image = '(No cover image)'
image = '<img class="cover-thumb" src="' + path + '"/>'
else
image = '(No cover image)'
@@
-84,10
+92,10
@@
class Page
@imageCount = 0
if ! Dir.exist?(@output_dir)
@imageCount = 0
if ! Dir.exist?(@output_dir)
-
Dir.mkdir
(@output_dir)
+
FileUtils.mkdir_p
(@output_dir)
end
end
- open(@output_dir + '/
index.html'
, 'w') do |fd|
+ open(@output_dir + '/
' + @index_file
, 'w') do |fd|
fd.puts '<html>'
fd.puts ' <head>'
fd.puts ' <meta charset="utf-8"/>'
fd.puts '<html>'
fd.puts ' <head>'
fd.puts ' <meta charset="utf-8"/>'