techvision/brails4

View on GitHub
app/views/contents/index.html.haml

Summary

Maintainability
Test Coverage
- content_for :panel do
  %section.panel{:id => "tabpanel1", :role => "application"}
    %header.panel-heading.tab-bg-dark-navy-blue
      %ul.nav.nav-tabs.nav-justified{:role => "tablist"}
        - ['summary', 'transcript', 'take_test'].each_with_index do |k, i|
          %li{class: i == 0 ? 'active' : '', :role => "tab", :id => "tab_#{i + 1}", "aria-controls" => "#{k}", "aria-selected" => i == 0 ? :true : :false}
            %a{"data-toggle" => "tab", :href => "##{k}"}= k.titleize
    .panel-body
      .tab-content.tasi-tab
        #summary.tab-pane.active{"aria-labeledby" => "tab_1", :role => "tabpanel"}
          = raw @content.summary
        #transcript.tab-pane{"aria-labeledby" => "tab_2", :role => "tabpanel"}
          = raw @content.transcript
        #take_test.tab-pane{"aria-labeledby" => "tab_3", :role => "tabpanel"}
          - if @topic.questions.count == 0
            %h3 No Questions Added
          - else
            - if @attempt.count == @topic.questions.count
              %h3 All Question solved
            - else
              = render partial: 'contents/question', locals: {attempt: @attempt, question: @attempt.question}

.topic
  .row
    .pull-right= link_to 'BACK', level_path(@topic.level), :class => 'btn btn-primary'
    .span8.offset2
      %h1.beta.topic-title
        = @topic.title
      - if @content.youtube_channel_url != "" 
        %hr
        %section.topic
          .row
            .ytplayerbox
              / specify 'normal' for YouTube VGA aspect ratio (480 x 360) and 'wide' for YouTube HD (640 x 360)
              %span.ytplayeraspect:.normal  
              / list video titles and identifiers here, playlist rendered only if more than one movie
              %span{class: "ytmovieurl:#{@content.youtube_channel_url.split('/').last}"}  
                = @content.title

      .row
        = yield :panel