techvision/brails4

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

Summary

Maintainability
Test Coverage
- model_class = Level
.page-header
  %h1=t '.title', :default => @level.name.titleize
  
%p
  %strong= model_class.human_attribute_name(:name) + ':'
  %br
  = @level.name

%p
  %strong= model_class.human_attribute_name(:seq_number) + ':'
  %br
  = @level.seq_number

.form-actions
  = link_to t('.back', :default => t("helpers.links.back")), admin_levels_path, :class => 'btn'
  = link_to t('.edit', :default => t("helpers.links.edit")), edit_admin_level_path(@level), :class => 'btn'
  = link_to t('.destroy', :default => t("helpers.links.destroy")), admin_level_path(@level), :method => "delete", :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-danger'

%h3 Topics

%table.table.table-striped
  %thead
    %tr
      %th= Topic.human_attribute_name(:title)
      %th= Topic.human_attribute_name(:seq_number)
      %th=t '.actions', :default => t("helpers.actions")
  %tbody
    - @topics.each do |topic|
      %tr
        %td= link_to topic.title, admin_topic_path(topic)
        %td= topic.seq_number
        %td
          = link_to t('.edit', :default => t("helpers.links.edit")), edit_admin_topic_path(topic), :class => 'btn btn-mini'
          = link_to t('.destroy', :default => t("helpers.links.destroy")), admin_topic_path(topic), :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_level_topic_path(@level), :class => 'btn btn-primary'


%h3 Bonus 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)
      %th=t '.actions', :default => t("helpers.actions")
  %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_level_question_path(@level), :class => 'btn btn-primary'