!!! %html{:lang => “en”}

%head
  %meta{:charset => "utf-8"}/
  %meta{:content => "IE=edge", "http-equiv" => "X-UA-Compatible"}/
  %meta{:content => "width=device-width, initial-scale=1", :name => "viewport"}/
  %meta{:content => "Cucumber Scenario Statistics", :name => "description"}/
  %meta{:content => "AlienFast", :name => "author"}/
  %title Cucumber Scenario Statistics
  / Bootstrap core CSS
  %link{:href => "http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css", :rel => "stylesheet"}/
  / Custom styles for this layout
  :css
    body {
        min-height: 2000px;
        padding-top: 70px;
    }
    td {
        white-space: nowrap;
        /*max-width: 100px;*/
    }
    tr td:first-child {
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 300px;
    }
  %link{:href => "https://raw.githack.com/drvic10k/bootstrap-sortable/master/Contents/bootstrap-sortable.css", :rel => "stylesheet"}/
  / HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries
  /[if lt IE 9]
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
%body
  / Fixed navbar
  .navbar.navbar-default.navbar-fixed-top{:role => "navigation"}
    .container
      .navbar-header
        %button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", :type => "button"}
          %span.sr-only Toggle navigation
          %span.icon-bar
          %span.icon-bar
          %span.icon-bar
        %a.navbar-brand{:href => "#"} cucumber_statistics
      .navbar-collapse.collapse
        %ul.nav.navbar-nav.navbar-right
          %li
            %a{:href => "https://github.com/alienfast/cucumber_statistics", :target => 'other'} Github
  / /.nav-collapse
  .container
    .navbar
      .tabbable
        %ul.nav.nav-tabs
          %li.active
            %a.content_tab{:href => "#steps_tab",:toggle=>"tab"}
              Steps
          %li
            %a.content_tab{:href => "#scenarios_tab", :toggle=>"tab"}
              Scenarios
          %li
            %a.content_tab{:href => "#features_tab", :toggle=>"tab"}
              Features
      .container
        .tab-content
          #steps_tab.tab-pane.active
            / Main component for a primary marketing message or call to action
            .jumbotron
              %h1 Cucumber step statistics
              %p ... allows you to easily identify long running steps.
            .alert.alert-info
              #{alert_info_text(overall_statistics)}
            %table.table.table-bordered.table-striped.sortable
              %thead
                %tr
                  %th Step
                  %th Fastest
                  %th Slowest
                  %th Variation
                  %th Variance
                  %th Std Deviation
                  %th Count
                  %th Average
                  %th{"data-defaultsort" => "desc"} Total
              %tbody
                - highest_average = step_statistics.highest_average
                - highest_total = step_statistics.highest_total
                - highest_variation = step_statistics.highest_variation
                - step_statistics.all.each do |step_results|
                  %tr
                    = name_td step_results
                    = time_td step_results, :fastest
                    = time_td step_results, :slowest
                    = time_td step_results, :variation, highest_variation
                    = time_td step_results, :variance
                    = time_td step_results, :standard_deviation
                    = count_td step_results, :count
                    = time_td step_results, :average, highest_average
                    = time_td step_results, :total, highest_total
          / /container
          #scenarios_tab.tab-pane
            / Main component for a primary marketing message or call to action
            .jumbotron
              %h1 Cucumber scenario statistics
              %p ... find those slow scenarios.
            .alert.alert-info
              #{alert_info_text(overall_statistics)}
            %table.table.table-bordered.table-striped.sortable
              %thead
                %tr
                  %th Scenario File
                  %th{"data-defaultsort" => "desc"} Time
              %tbody
                - scenario_statistics.all.each do |file_name, scenario_result|
                  %tr
                    = std_file_td file_name, scenario_result[:scenario_name]
                    = std_time_td scenario_result[:duration]
          / /container
          #features_tab.tab-pane
            / Main component for a primary marketing message or call to action
            .jumbotron
              %h1 Cucumber feature statistics
              %p ... find those slow features.
            .alert.alert-info
              #{alert_info_text(overall_statistics)}
            %table.table.table-bordered.table-striped.sortable
              %thead
                %tr
                  %th Feature File
                  %th{"data-defaultsort" => "desc"} Time
              %tbody
                - feature_statistics.all.each do |file_name, feature_result|
                  %tr
                    = std_file_td file_name, feature_result[:feature_name]
                    = std_time_td feature_result[:duration]
  / /container
  /  Bootstrap core JavaScript
  /  \==================================================
  / Placed at the end of the document so the pages load faster
  %script{:src => "https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"}
  %script{:src => "http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"}
  %script{:src => "https://raw.githack.com/drvic10k/bootstrap-sortable/master/Scripts/moment.min.js"}
  %script{:src => "https://raw.githack.com/drvic10k/bootstrap-sortable/master/Scripts/bootstrap-sortable.js"}
  :javascript
    // Initialise on DOM ready
    $(function() {
        $.bootstrapSortable(true, 'reversed');
    });
    $('a.content_tab').click(function (e) {
      e.preventDefault();
      $(e.target).tab('show');
    });