zuzak/gov.zk

View on GitHub
views/books/shortlist-ballot.pug

Summary

Maintainability
Test Coverage
//- vim:ft=jade
extends ../skeleton
block title
  title #{__('shortlist-ballot-heading')}
block breadcrumb
  li
    a(href=__('/book-club')) #{__('book-club')}
  li
    a(href=__('/book-club/short-list')) #{__('short-list')}
block css
  link(rel='stylesheet', href='/shortlist.css')
block content
  - i = 0
  for book in books
    if ++i == 1
      - title = book.title
      - author = book.author
      if book.upstream
        - title = book.upstream.title
        - author = book.upstream.authors.join(' & ')
      .grid-row
        .column-full
          h1.heading-xlarge Shortlisting
          h2.heading-large
            .font-medium.progress #{__('shortlist-ballot-progress', {'count': total - books.length + 1, total: total})}
            .title #{title}
      .grid-row
        .column-two-thirds
          .grid-row
            if book.upstream
              .column-two-thirds
                  p.lede
                    span a #{book.upstream.printType.toLowerCase()}  by 
                    span.author #{author}
                  if book.upstream.description
                    p
                      blockquote #{book.upstream.description}
                  if book.difficult
                    p.panel #{__('book-difficult')}
              .column-one-third.sidebar
                if book.upstream.imageLinks
                  img(src=book.upstream.imageLinks.thumbnail.replace('http://','//'))
                if book.upstream.previewLink
                  p
                    a(href=book.upstream.previewLink) #{__('book-preview')}
            else
              .column-two-thirds
                p.lede
                  span by 
                  span.author #{author}
                p.notice
                  i.icon.icon-important
                  strong #{__('book-noinfo')}

          form(method='POST').ballot
            input(type='hidden',name='author',value=book.author)
            input(type='hidden',name='title',value=book.title)
            h3.heading-small #{__('shortlist-ballot-wanttoread')}
            fieldset(required)
              .multiple-choice
                input#choice1(type='radio',name='verdict',value='yes')
                label(for='choice1') #{__('shortlist-ballot-wanttoread-yes', {title})}
              .multiple-choice
                input#choice2(type='radio',name='verdict',value='no')
                label(for='choice2') #{__('shortlist-ballot-wanttoread-no', {title})}
            h3.heading-small #{__('shortlist-ballot-alreadyread', {title})}
            fieldset
              .multiple-choice
                input#cb1(type='checkbox',name='alreadyRead')
                label(for='cb1') #{__('shortlist-ballot-alreadyread-box', {title})}
              .multiple-choice
                input#cb2(type='checkbox',name='haveCopy')
                label(for='cb2') #{__('shortlist-ballot-havecopy-box', {title})}
            p.submit
              input(type='submit',value=__('shortlist-ballot-submit', {user: req.user})).button
        if book.upstream
          .column-one-third
            .grid-row
              table
                if book.isbn
                  tr
                    th
                      abbr(title=__('book-isbn')) #{__('book-isbn-abbrev')}
                    td #{book.isbn}
                if book.upstream.publishedDate
                  tr
                    th #{__('book-publishedDate')}
                    td #{book.upstream.publishedDate}
                if book.upstream.publisher
                  tr
                    th #{__('book-publisher')}
                    td #{book.upstream.publisher}
                if book.upstream.pageCount
                  tr
                    th #{__('book-pagecount')}
                    td #{book.upstream.pageCount}
                if book.upstream.categories
                  tr(rowspan=book.upstream.categories.length)
                  - j = 0
                  for category in book.upstream.categories
                    - j++
                    if j !== 0
                      th #{__('book-categories')}
                    td #{category}
                if book.upstream.language
                  tr
                    th #{__('book-language')}
                    td #{__('book-language-'+book.upstream.language)}
                if book.upstream.maturityRating
                  tr
                    th #{__('book-maturity-rating')}
                    td #{__('book-maturity-rating-'+book.upstream.maturityRating.replace('_', '-').toLowerCase())}
                if book.longlistedBy
                  tr
                    th #{__('book-longlisted-by')}
                    td #{book.longlistedBy}