SumOfUs/Champaign

View on GitHub
app/views/pages/_edit_sidebar.slim

Summary

Maintainability
Test Coverage
.page-edit-bar
  .page-edit-bar__logo
  .scrollspy
    ul.page-edit-bar__step-list.nav
      li
        = link_to analytics_page_path(page)
          i.fa.fa-area-chart
          =  t('menu.statistics')
      li
        = link_to actions_page_path(page)
          i.fa.fa-list
          =  t('menu.actions')

  .page-edit-bar__save-box
    .page-edit-bar__toggle
      .page-edit-bar__toggle-title Autosave
      .page-edit-bar__toggle-btns.page-edit-bar__toggle-autosave data-autosave="#{!page.published?}"
        = render 'shared/binary_switch', checked: !page.published?
    .page-edit-bar__toggle
      = form_for page, url: api_page_path(page), remote: true, html: {class: 'activation-toggle'} do |ff|
        / we have nested page[page][active] to match the massive nested form submitted with the one-form
        = ff.fields_for :page do |f|
          = f.hidden_field :publish_status, class: 'activation-toggle-field', value: page.publish_status, "data-confirm-turning-off" => "Are you sure you want to unpublish this page? It will become inaccessible except to logged-in campaigners."
          .page-edit-bar__toggle-title Publish
          .page-edit-bar__toggle-btns
            = render 'shared/binary_switch', checked: page.published?, publish: true
    .page-edit-bar__last-saved
    .page-edit-bar__error-message
    .page-edit-bar__btn-holder.page-edit-bar__btn-holder--hidden
      button.page-edit-bar__save-button.btn.btn-primary
        | Save my work