94 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			94 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
css:
 | 
						|
  @media (max-width: 800px) {
 | 
						|
    a.btn { display: none; }
 | 
						|
    .col-5 { display: none; }
 | 
						|
    .col-6 { width: 100% !important; display: block !important; }
 | 
						|
    .small-screen-image { display: block !important; }
 | 
						|
    .container { margin-top: 2rem !important; }
 | 
						|
  }
 | 
						|
 | 
						|
- if @contest.puzzles.size <= 1
 | 
						|
  .row.small-screen-image style="display: none"
 | 
						|
    - @contest.puzzles.each do |puzzle|
 | 
						|
      .d-flex.flex-column.justify-content-center.mb-5
 | 
						|
        = image_tag(puzzle.image, style: "max-height: 200px; object-fit: contain") if puzzle.image.attached?
 | 
						|
        .mt-2.fs-6 style="text-align: center"
 | 
						|
          => "#{puzzle.name} -"
 | 
						|
          = "#{puzzle.brand} #{puzzle.pieces}p"
 | 
						|
 | 
						|
  = render "category_selector"
 | 
						|
 | 
						|
  .row
 | 
						|
    .col-6.d-flex.flex-column style="height: calc(100vh - 180px)"
 | 
						|
      .d-flex.flex-column style="overflow-y: auto"
 | 
						|
        table.table.table-striped.table-hover
 | 
						|
          thead
 | 
						|
            tr
 | 
						|
              th
 | 
						|
                = t("helpers.rank")
 | 
						|
              th
 | 
						|
                = t("activerecord.attributes.contestant.name")
 | 
						|
              - if @contest.puzzles.size > 1
 | 
						|
                th
 | 
						|
                  = t("activerecord.attributes.contestant.completions")
 | 
						|
              th style="width: 170px"
 | 
						|
                = t("activerecord.attributes.contestant.display_time")
 | 
						|
          tbody
 | 
						|
            - @contestants.each_with_index do |contestant, index|
 | 
						|
              tr scope="row"
 | 
						|
                td
 | 
						|
                  = index + 1
 | 
						|
                td
 | 
						|
                  = contestant.name
 | 
						|
                - if @contest.puzzles.size > 1
 | 
						|
                  td
 | 
						|
                    = contestant.completions.where(remaining_pieces: nil).length
 | 
						|
                td style="position: relative"
 | 
						|
                  - if index > 0 && contestant.time_seconds > 0 && contestant.completions.where(remaining_pieces: nil).size > 0
 | 
						|
                    .relative-time style="position:absolute; margin: 1px 0 0 64px; font-size: 14px; color: grey"
 | 
						|
                      |> +
 | 
						|
                      = display_time(contestant.time_seconds - @contestants[index - 1].time_seconds)
 | 
						|
                  = contestant.completions.size > 0 && contestant.completions[-1].remaining_pieces ? "#{contestant.completions.map{|completion| completion.puzzle.pieces}.sum - contestant.completions[-1].remaining_pieces}p" : contestant.display_time
 | 
						|
    .col-1
 | 
						|
    .col-5
 | 
						|
      - @contest.puzzles.each do |puzzle|
 | 
						|
        = image_tag(puzzle.image, class: "img-fluid ms-3 me-3") if puzzle.image.attached?
 | 
						|
        .mt-3.fs-4 style="margin-left: 15px"
 | 
						|
          = puzzle.name
 | 
						|
        .fs-6 style="margin-left: 15px"
 | 
						|
          b
 | 
						|
            = "#{puzzle.brand} - #{puzzle.pieces}p"
 | 
						|
 | 
						|
- else
 | 
						|
  .d-flex.flex-column style="height: calc(100vh - 180px)"
 | 
						|
    .d-flex.flex-row.justify-content-center.mb-5
 | 
						|
      - @contest.puzzles.each do |puzzle|
 | 
						|
        = image_tag(puzzle.image, class: "img-fluid ms-3 me-3", style: "max-height: 220px") if puzzle.image.attached?
 | 
						|
 | 
						|
    = render "category_selector"
 | 
						|
 | 
						|
    .d-flex.flex-column style="overflow-y: auto"
 | 
						|
      table.table.table-striped.table-hover
 | 
						|
        thead
 | 
						|
          tr
 | 
						|
            th scope="col"
 | 
						|
              = t("helpers.rank")
 | 
						|
            th scope="col"
 | 
						|
              = t("activerecord.attributes.contestant.name")
 | 
						|
            - if @contest.puzzles.size > 1
 | 
						|
              th scope="col"
 | 
						|
                = t("activerecord.attributes.contestant.completions")
 | 
						|
            th scope="col"
 | 
						|
              = t("activerecord.attributes.contestant.display_time")
 | 
						|
        tbody
 | 
						|
          - @contestants.each_with_index do |contestant, index|
 | 
						|
            tr scope="row"
 | 
						|
              td
 | 
						|
                = index + 1
 | 
						|
              td
 | 
						|
                = contestant.name
 | 
						|
              - if @contest.puzzles.size > 1
 | 
						|
                td
 | 
						|
                  = contestant.completions.where(remaining_pieces: nil).length
 | 
						|
              td
 | 
						|
                = contestant.completions.size > 0 && contestant.completions[-1].remaining_pieces ? "#{contestant.completions.map{|completion| completion.puzzle.pieces}.sum - contestant.completions[-1].remaining_pieces}p" : contestant.display_time |