intale/ruby-blog

View on GitHub
app/views/administration/posts/show.html.haml

Summary

Maintainability
Test Coverage
.block
  .secondary-navigation
    %ul.wat-cf
      %li.first= link_to "List", administration_posts_path
      %li= link_to "New", new_administration_post_path
      %li.active= link_to "Show", administration_post_path(@post)
  .content
    %h2.title
      = @post.subject
    .inner
      .table
        .group
          Содержание поста:
          %div{:style => "border: 1px dashed #576C82;"}
            =raw truncate_html(@post)
          %p
            Количество символов на главное странице:
            =@post.truncate_character
          %p
            Created at:
            = l(@post.created_at,:format => :long)
          %p
            Author:
            = @post.admin.nick
          %p
            Статус:
            = @post.status ? "Disabled" : "Enabled"          
        = link_to image_tag("web-app-theme/icons/application_edit.png", :alt => "#{t("web-app-theme.edit", :default=> "Edit")}") + " " + t("web-app-theme.edit", :default=> "Edit"), edit_administration_post_path, :class => "button"
        %br>

    .inner
      = link_to "New comment", new_administration_post_comment_path(@post)
      %table.table
        %tr
          %th.first Comments
          %th.last  
        - @post.comments.each do |comment|
          %tr{:class => cycle("odd", "even")}
            %td= comment.content
            %td.last.show-comments
              %p
                %strong
                  ID:
                = comment.id
              %p
                %strong
                  Author:
                = comment.author
              %p
                %strong
                  Created at:
                = l(comment.created_at,:format => :long)
              %p
                %strong
                  Updated at:
                = l(comment.updated_at,:format => :long)
              %p
                \#{link_to "#{t("web-app-theme.edit", :default => "Edit")}", edit_administration_comment_path(comment)}
                |
                \#{link_to "#{t("web-app-theme.delete", :default => "Delete")}", administration_comment_path(comment), :method => :delete, :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}"}
      = link_to "New comment", new_administration_post_comment_path(@post)
- content_for :sidebar, render(:partial => 'sidebar', :locals => {:post => @post})