File: view.xhtml

package info (click to toggle)
ruby-ramaze 2012.12.08-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,060 kB
  • ctags: 1,200
  • sloc: ruby: 10,446; makefile: 8
file content (68 lines) | stat: -rw-r--r-- 1,453 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
62
63
64
65
66
67
68
<article>
    <header>
        <h1>
            #{@post.title}
        </h1>
        <p>
            Created at <time pubdate="pubdate"
            datetime="#{@created_at}">#{@created_at}</time> and written by
            #{@post.user.username}
        </p>
    </header>

    #{RDiscount.new(@post.body).to_html}

    <?r if logged_in? ?>
    <p>
        #{Posts.a('Edit', :edit, @post.id)}
        | #{Posts.a('Delete', :delete, @post.id)}
    </p>
    <?r end ?>
</article>

<div id="comments">
    <h2>Comments</h2>

    <?r if !@post.comments.empty? ?>

    <?r @post.comments.each do |comment| ?>
    <article>
        <header>
            <h1>#{comment.username}</h1>

            <p class="meta">
                <time pubdate="pubdate"
                datetime="#{comment.created_at.strftime('%Y-%m-%d')}">
                    #{comment.created_at.strftime('%Y-%m-%d')}
                </time>
            </p>
        </header>

        <p>#{comment.comment}</p>
    </article>
    <?r end ?>

    <?r else ?>

    <p>No comments have been added yet.</p>

    <?r end ?>

    <h2>Add Comment</h2>

    #{form_for(
      @new_comment,
      :method => :post,
      :action => Posts.r(:add_comment)
    ) do |f|
      f.input_hidden(:post_id, @post.id)

      unless logged_in?
        f.input_text('Username', :username)
      end

      f.textarea('Comment', :comment, :rows => 7, :cols => 60)

      f.input_submit('Submit')
    end}
</div>