openfoodfoundation/openfoodnetwork

View on GitHub
app/assets/javascripts/templates/admin/columns_dropdown.html.haml

Summary

Maintainability
Test Coverage
.ofn-drop-down.ofn-drop-down-v2.right#columns-dropdown{ "ng-controller": 'ColumnsDropdownCtrl' }
  .ofn-drop-down-label
    = "  #{t('admin.columns')}".html_safe
    %span{ 'ng-class' => "expanded && 'icon-caret-up' || !expanded && 'icon-caret-down'" }
  %div.menu{ 'ng-show' => "expanded" }
    .menu_items
      .menu_item{ "ng-repeat": "column in columns", "ng-click": "toggle(column);" }
        %input{ type: "checkbox", "ng-checked": "column.visible" }
        %span
          {{ column.name }}
      %hr
      %div.menu_item.text-center
        %input.fullwidth.orange{ type: "button", "ng-value": "saved() ? 'Saved': 'Saving'", "ng-show": "saved() || saving", "ng-disabled": "saved()" }
        %input.fullwidth.red{ type: "button", value: t('admin.column_save_as_default').html_safe, "ng-show": "!saved() && !saving", "ng-click": "saveColumnPreferences(action)" }