zuzak/gov.zk

View on GitHub
views/books/admin.pug

Summary

Maintainability
Test Coverage
//- vim:ft=jade
extends ../skeleton
block title
  title GOV.ZK Admin
block breadcrumb
  li
    a(href=__('/book-club')) #{__('book-club')}
  li
    a(href=__('/book-club/admin')) #{__('administration')}
block css
  link(rel='stylesheet', href='/index.css')
block content
  pre.code #{JSON.stringify(state)}
  .grid-row
    .column-two-thirds
      h1.heading-large #{__('administration')}

      h2.heading-medium #{__('admin-state')}
      form(method='POST')
        h3.heading-small #{__('admin-permissions')}
        fieldset
          .multiple-choice
            if state.allowVoting
              input#choice4(type='checkbox', name='allowVoting', checked)
            else
              input#choice4(type='checkbox', name='allowVoting')
            label(for='choice4') #{__('admin-permissions-allowvoting')}
          .multiple-choice
            if state.addToLonglist
              input#choice5(type='checkbox', name='addToLonglist', checked)
            else
              input#choice5(type='checkbox', name='addToLonglist')
            label(for='choice5') #{__('admin-permissions-addtolonglist')}
        h3.heading-small #{__('admin-advertising')}
        fieldset(required)
          .multiple-choice
            if state.advertise == 'LONGLIST'
              input#choice1(type='radio',name='advertise',value='LONGLIST', checked)
            else
              input#choice1(type='radio',name='advertise',value='LONGLIST')
            label(for='choice1') #{__('admin-advertising-longlist')}
          .multiple-choice
            if state.advertise == 'SHORTLIST'
              input#choice2(type='radio',name='advertise',value='SHORTLIST', checked)
            else
              input#choice2(type='radio',name='advertise',value='SHORTLIST')
            label(for='choice2') #{__('admin-advertising-shortlist')}
          .multiple-choice
            if state.advertise == 'READING_LIST'
              input#choice3(type='radio',name='advertise',value='READING_LIST', checked)
            else
              input#choice3(type='radio',name='advertise',value='READING_LIST')
            label(for='choice3') #{__('admin-advertising-readinglist')}
              if state == 'READING_LIST'
                span  (active)
        p.submit
          input(type='submit',value=__('admin-advertising-submit'),name='changeState').button
  .grid-row
    .column-full
      h2.heading-medium #{__('admin-bookstates')}
      table
        thead
          tr
            th #{__('admin-book')}
            th #{__('admin-author')}
            th #{__('admin-approvals')}
            th #{__('admin-actions')}
        for book in books
          tr
            td
              a(href='/book-club/book/'+book.isbn) #{book.title}
            td #{book.author}
            if book.approve
              td.numeric #{book.approve.length}
            else
              td.numeric —
            td
              if !book.readingList
                form(method='POST')
                  input(type='hidden',name='title',value=book.title)
                  input(type='hidden',name='author',value=book.author)
                  input(type='hidden',name='isbn',value=book.isbn)
                  input(type='submit',name='readingList',value=__('admin-addtoreadinglist')).button