Class: Writecast::Post_view

Inherits:
Base_view
  • Object
show all
Defined in:
lib/writecast/views/post.rb

Instance Method Summary collapse

Methods inherited from Base_view

#content, #render_body_top_inner, #render_footer, #render_head, #render_menu, #render_post_summary

Instance Method Details

#render_breadcrumbObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/writecast/views/post.rb', line 4

def render_breadcrumb
    day,month,year = @doc.time.day,@doc.time.month,@doc.time.year
    p do
        text SEPARATOR
        a year, :href => "/#{year}"
        text SEPARATOR
        a "%02d" % month, :href => "/#{year}/#{"%02d" % month}"
        text SEPARATOR + "#{day}" + SEPARATOR + @doc.title
    end
end

#render_content_innerObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/writecast/views/post.rb', line 15

def render_content_inner
    div(:id => 'meta') {p {text "last modified: #{@doc.time}"}}
    div :id => 'summary' do
        rawtext Kramdown::Document.new(@doc.summary, KRAMDOWN_OPTS).to_html
    end
    div :id => 'body' do
        rawtext Kramdown::Document.new(@doc.body, KRAMDOWN_OPTS).to_html
    end
    div :id => 'tags' do
        p do
            text 'tagged: '
            @doc.tags and @doc.tags.each do |tag|
                a tag, :href => "/tags/#{CGI.escape(tag)}"
                text ', ' if tag != @doc.tags.last
            end
        end
    end
    div :id => 'comments' do
        p 'comments:'
        p a 'show comment form', {:id => 'toggle_comment_form', :href => '#'}
        div :id => 'comment_form_wrapper', :style => 'display:none;' do
            form :id => 'comment_form', :action => "/comment", :method => "post" do
                label :id => 'name' do
                    text 'name'
                    input :type => 'text', :name => 'name', :class => 'required'
                end
                label :id => 'first_name' do
                    text 'first name'
                    input :type => 'text', :name => 'first_name'
                end
                label :id => 'email' do
                    text 'email'
                    input :type => 'text', :name => 'email', :class => 'required'
                end
                input :type => 'hidden', :name => 'file_path', :value => @doc.raw_file_path
                br
                label :id => 'comment' do
                    text 'comment'
                    textarea :name => 'comment', :class => 'required'
                end
                br
                input :id => 'reset', :type => "reset", :value => "clear form"
                input :id => 'submit', :type => "submit", :value => "send comment"
            end
        end
    end
end