WIP: Basic version of revamped enterprise index

This commit is contained in:
Rob Harrington
2015-06-04 13:52:41 +08:00
parent 02d3d34826
commit d5f9b40707

View File

@@ -10,47 +10,115 @@
= render :partial => 'spree/shared/error_messages', :locals => { :target => @enterprise_set }
-# For purposes of debugging bulk_update. See Admin/Enterprises#bulk_update.
- if flash[:action]
%p= flash[:action]
%div{ ng: { app: 'admin.enterprises', controller: 'enterprisesCtrl' } }
.row{ 'ng-hide' => '!loaded()' }
.controls{ :class => "sixteen columns alpha", :style => "margin-bottom: 15px;" }
.four.columns.alpha
%input{ :class => "fullwidth", :type => "text", :id => 'quick_search', 'ng-model' => 'quickSearch', :placeholder => 'Search By Name' }
.six.columns  
-# %div.ofn_drop_down{ 'ng-controller' => "DropDownCtrl", :id => "bulk_actions_dropdown", 'ofn-drop-down' => true }
-# %span{ :class => 'icon-check' }   Actions
-# %span{ 'ng-class' => "expanded && 'icon-caret-up' || !expanded && 'icon-caret-down'" }
-# %div.menu{ 'ng-show' => "expanded" }
-# %div.menu_item{ :class => "three columns alpha", 'ng-repeat' => "action in bulkActions", 'ng-click' => "selectedBulkAction.callback(filteredEnterprises)", 'ofn-close-on-click' => true }
-# %span{ :class => 'three columns omega' } {{action.name }}
.three.columns  
.three.columns.omega
%div.ofn_drop_down{ 'ng-controller' => "DropDownCtrl", :id => "columns_dropdown", 'ofn-drop-down' => true, :style => 'float:right;' }
%span{ :class => 'icon-reorder' }   Columns
%span{ 'ng-class' => "expanded && 'icon-caret-up' || !expanded && 'icon-caret-down'" }
%div.menu{ 'ng-show' => "expanded" }
%div.menu_item{ :class => "three columns alpha", 'ng-repeat' => "column in columns", 'ofn-toggle-column' => true }
%span{ :class => 'one column alpha', :style => 'text-align: center'} {{ column.visible && "✓" || !column.visible && " " }}
%span{ :class => 'two columns omega' } {{column.name }}
.row{ 'ng-if' => '!loaded()' }
.sixteen.columns.alpha#loading
%img.spinner{ src: "/assets/spinning-circles.svg" }
%h1 LOADING ENTERPRISES
.row{ :class => "sixteen columns alpha", 'ng-show' => 'loaded() && filteredEnterprises.length == 0'}
%h1#no_results No enterprises found.
= form_for @enterprise_set, url: main_app.bulk_update_admin_enterprises_path do |f|
%table#listing_enterprises.index
%colgroup
%col{style: "width: 25%;"}/
%col{style: "width: 15%;"}/
%col{style: "width: 5%;"}/
- if spree_current_user.admin?
%col{style: "width: 12%;"}/
- if spree_current_user.admin?
%col{style: "width: 18%;"}/
%col{style: "width: 25%;"}/
%thead
%tr{"data-hook" => "enterprises_header"}
%th Name
%th Role
- if spree_current_user.admin?
%th Sells
%th Visible?
- if spree_current_user.admin?
%th Owner
%th
%tbody
= f.fields_for :collection do |enterprise_form|
- enterprise = enterprise_form.object
%tr{class: "enterprise-#{enterprise.id}"}
%td= link_to enterprise.name, main_app.edit_admin_enterprise_path(enterprise)
%td
= enterprise_form.check_box :is_primary_producer
Producer
- if spree_current_user.admin?
%td= enterprise_form.select :sells, Enterprise::SELLS, {}, class: 'select2 fullwidth'
%td= enterprise_form.check_box :visible
- if spree_current_user.admin?
%td= enterprise_form.select :owner_id, enterprise.users.map{ |e| [ e.email, e.id ] }, {}, class: "select2 fullwidth"
%td{"data-hook" => "admin_users_index_row_actions"}
= render 'actions', enterprise: enterprise
- if @enterprises.empty?
%tr
%td{colspan: "4"}= t(:none)
= f.submit 'Update'
.row{ ng: { show: "loaded() && filteredEnterprises.length > 0" }, bindonce: true }
%form{ name: "enterprises" }
%table.index#enterprises
%col.name{ width: "25%"}
%col.type{ width: "25%"}
%col.status{ width: "25%"}
%col.manage{ width: "25%"}
-# %col.actions{ width: "10%"}
%thead
%tr{ ng: { controller: "ColumnsCtrl" } }
%th.name{ ng: { show: 'columns.name.visible' } }
Name
-# %a{ :href => '', ng: { click: "predicate = 'name'; reverse = !reverse" } } Name
%th.type{ ng: { show: 'columns.type.visible' } } Type
%th.status{ ng: { show: 'columns.status.visible' } } Status
%th.manage{ ng: { show: 'columns.manage.visible' } } Manage
-# %th.actions
-# Ask? 
-# %input{ :type => 'checkbox', 'ng-model' => "confirmDelete" }
%tr.enterprise{ :id => "e_{{enterprise.id}}", ng: { repeat: "enterprise in filteredEnterprises = ( allEnterprises | filter:{ name: quickSearch } )", class: { even: "'even'", odd: "'odd'"} } }
%td.name{ ng: { show: 'columns.name.visible' } }
%span{ bo: { bind: "enterprise.name" } }
%td.type{ ng: { show: 'columns.type.visible' } }
%a.button.fullwidth{ ng: { click: ""} }
%span{ bo: { bind: "enterprise.category" } }
%i.icon-arrow-down
%td.status{ ng: { show: 'columns.status.visible' } }
%a.button.fullwidth{ ng: { click: ""} }
Status
%i.icon-arrow-down
%td.manage{ ng: { show: 'columns.manage.visible' } }
%a.button.fullwidth{ href: '#' }
Manage
%i.icon-arrow-right
-# %td.actions
-# %a{ 'ng-click' => "deleteEnterprise(enterprise)", :class => "delete-enterprise icon-trash no-text" }
-# -# For purposes of debugging bulk_update. See Admin/Enterprises#bulk_update.
-# - if flash[:action]
-# %p= flash[:action]
-#
-# = form_for @enterprise_set, url: main_app.bulk_update_admin_enterprises_path do |f|
-# %table#listing_enterprises.index
-# %colgroup
-# %col{style: "width: 25%;"}/
-# %col{style: "width: 15%;"}/
-# %col{style: "width: 5%;"}/
-# - if spree_current_user.admin?
-# %col{style: "width: 12%;"}/
-# - if spree_current_user.admin?
-# %col{style: "width: 18%;"}/
-# %col{style: "width: 25%;"}/
-# %thead
-# %tr{"data-hook" => "enterprises_header"}
-# %th Name
-# %th Role
-# - if spree_current_user.admin?
-# %th Sells
-# %th Visible?
-# - if spree_current_user.admin?
-# %th Owner
-# %th
-# %tbody
-# = f.fields_for :collection do |enterprise_form|
-# - enterprise = enterprise_form.object
-# %tr{class: "enterprise-#{enterprise.id}"}
-# %td= link_to enterprise.name, main_app.edit_admin_enterprise_path(enterprise)
-# %td
-# = enterprise_form.check_box :is_primary_producer
-# Producer
-# - if spree_current_user.admin?
-# %td= enterprise_form.select :sells, Enterprise::SELLS, {}, class: 'select2 fullwidth'
-# %td= enterprise_form.check_box :visible
-# - if spree_current_user.admin?
-# %td= enterprise_form.select :owner_id, enterprise.users.map{ |e| [ e.email, e.id ] }, {}, class: "select2 fullwidth"
-# %td{"data-hook" => "admin_users_index_row_actions"}
-# = render 'actions', enterprise: enterprise
-# - if @enterprises.empty?
-# %tr
-# %td{colspan: "4"}= t(:none)
-# = f.submit 'Update'