Method: TDiary::TDiaryPreview#initialize

Defined in:
lib/tdiary/admin.rb

#initialize(cgi, rhtm, conf) ⇒ TDiaryPreview

Returns a new instance of TDiaryPreview.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/tdiary/admin.rb', line 71

def initialize( cgi, rhtm, conf )
  super

  @title = @cgi.params['title'][0]
  @body = @cgi.params['body'][0]
  @title = @conf.to_native( @title )
  @body = @conf.to_native( @body )
  @old_date = @cgi.params['old'][0]
  @hide = @cgi.params['hide'][0] == 'true' ? true : false

  @io.transaction( @date ) do |diaries|
    @diaries = diaries
    diary = @diaries[@date.strftime( '%Y%m%d' )]
    @conf.style = diary.style if diary
    @diary = @io.diary_factory( @date, @title, @body, @conf.style )
    @diary.show( ! @hide )
    DIRTY_NONE
  end
end