techvision/brails4

View on GitHub
app/views/admin/contents/show.html.haml

Summary

Maintainability
Test Coverage
- model_class = Content
.page-header
  %h1=t '.title', :default => model_class.model_name.human.titleize

%p
  %strong= model_class.human_attribute_name(:title) + ':'
  %br
  = @content.title
%p
  %strong= model_class.human_attribute_name(:transcript) + ':'
  %br
  = @content.transcript
%p
  %strong= model_class.human_attribute_name(:summary) + ':'
  %br
  = @content.summary
%p
  %strong= model_class.human_attribute_name(:youtube_channel_url) + ':'
  %br
  = @content.youtube_channel_url

.form-actions
  = link_to t('.back', :default => t("helpers.links.back")), admin_topic_path(@content.topic_id), :class => 'btn'
  = link_to t('.edit', :default => t("helpers.links.edit")), edit_admin_content_path(@content), :class => 'btn'
  = link_to t('.destroy', :default => t("helpers.links.destroy")), admin_content_path(@content), :method => "delete", :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-danger'

%h3 Questions

%table.table.table-striped
  %thead
    %tr
      %th= Question.human_attribute_name(:id)
      %th= Question.human_attribute_name(:title)
      %th= Question.human_attribute_name(:difficulty)
  %tbody
    - @questions.each do |question|
      %tr
        %td= link_to question.id, admin_question_path(question)
        %td= question.title
        %td= question.difficulty
        %td
          = link_to t('.edit', :default => t("helpers.links.edit")), edit_admin_question_path(question), :class => 'btn btn-mini'
          = link_to t('.destroy', :default => t("helpers.links.destroy")), admin_question_path(question), :method => :delete, :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-mini btn-danger'
          
= link_to t('.new', :default => t("helpers.links.new")), new_admin_content_question_path(@content), :class => 'btn btn-primary'