Sha256: a9b123cbb6a47cc7b413f8896b7d8ff021e3f88179c1545376f9acbdb3bb9f3e
Contents?: true
Size: 1.49 KB
Versions: 2
Compression:
Stored size: 1.49 KB
Contents
module Netzke module Basepack # When mixed into a component with resizable layout (e.g. border layout), this module enables persistence for regions size and collapsed/expanded state. module ItemPersistence autoload :EventsPlugin, 'netzke/basepack/item_persistence/events_plugin' extend ActiveSupport::Concern included do # this plugins does the job of assigning resize/collapse events for the component plugin :events_plugin do |c| c.klass = EventsPlugin end # Added endpoints endpoint :region_resized do |params| state[:"#{params[:item]}_width"] = params[:width].to_i if params[:width] state[:"#{params[:item]}_height"] = params[:height].to_i if params[:height] end endpoint :region_collapsed do |params| state[:"#{params[:item]}_collapsed"] = true end endpoint :region_expanded do |params| state[:"#{params[:item]}_collapsed"] = false end end def extend_item(item) item = super item_id = item[:netzke_component] || item[:item_id] # identify regions by item_id if item_id item[:width] = state[:"#{item_id}_width"] if state[:"#{item_id}_width"] item[:height] = state[:"#{item_id}_height"] if state[:"#{item_id}_height"] if state[:"#{item_id}_collapsed"].present? item[:collapsed] = state[:"#{item_id}_collapsed"] end end item end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
netzke-basepack-6.5.0.0 | lib/netzke/basepack/item_persistence.rb |
netzke-basepack-6.5.0.0.rc2 | lib/netzke/basepack/item_persistence.rb |