Module: Crm::WarehousesHelper
- Defined in:
- app/helpers/crm/warehouses_helper.rb
Overview
View helper: warehouses.
Instance Method Summary collapse
- #warehouse_stock_status_label(order) ⇒ Object
-
#warehouse_tab_id ⇒ Object
Returns the tab id for the currently rendering warehouse tab action, so workflow links can preserve the active tab in their return_path.
Instance Method Details
#warehouse_stock_status_label(order) ⇒ Object
4 5 6 7 8 |
# File 'app/helpers/crm/warehouses_helper.rb', line 4 def warehouse_stock_status_label(order) s = order.stock_status style = s == :ok ? 'success' : 'warning' content_tag(:span, s, class: "badge bg-#{style}", style: 'font-size: 1em') end |
#warehouse_tab_id ⇒ Object
Returns the tab id for the currently rendering warehouse tab action,
so workflow links can preserve the active tab in their return_path.
The warehouse dashboard tabs are member actions named tab_<id>
(for example tab_at_warehouse, tab_picking, tab_held_orders).
turbo_tabs reads ?tab=<id> from the URL and tab_panel uses the same
param to render the matching frame on first paint. Without this,
redirects back to /warehouses/:id land without ?tab= and the user
is dropped onto whatever tab happens to be first.
19 20 21 22 23 |
# File 'app/helpers/crm/warehouses_helper.rb', line 19 def warehouse_tab_id return nil unless action_name.to_s.start_with?('tab_') action_name.to_s.sub(/\Atab_/, '') end |