Class: TDiary::TDiaryPreview

Inherits:
TDiaryAdmin show all
Defined in:
lib/tdiary/admin.rb

Overview

class TDiaryPreview preview diary

Constant Summary

Constants inherited from TDiaryBase

TDiary::TDiaryBase::DIRTY_COMMENT, TDiary::TDiaryBase::DIRTY_DIARY, TDiary::TDiaryBase::DIRTY_NONE, TDiary::TDiaryBase::DIRTY_REFERER

Instance Attribute Summary

Attributes inherited from TDiaryBase

#cgi, #conf, #cookies, #date, #diaries, #ignore_parser_cache, #request, #rhtml

Instance Method Summary collapse

Methods inherited from TDiaryAuthorOnlyBase

csrf_fetch_verdict, csrf_origin_of, #csrf_protection_get_is_okay, csrf_provenance_ok?, csrf_referer_allowed?

Methods inherited from TDiaryBase

#[], #calendar, #last_modified

Methods included from ViewHelper

#base_url, #bot?

Constructor Details

#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 = @request.param('title')
  @body = @request.param('body')
  @title = @conf.to_native( @title )
  @body = @conf.to_native( @body )
  @old_date = @request.param('old')
  @hide = @request.param('hide') == '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

Instance Method Details

#eval_rhtml(prefix = '') ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
# File 'lib/tdiary/admin.rb', line 91

def eval_rhtml( prefix = '' )
  begin
    @show_result = true
    r = do_eval_rhtml( prefix )
  rescue PluginError, SyntaxError, ArgumentError
    @exception = $!.dup
    @show_result = false
    r = super
  end
  r
end