Sha256: 15628d95224ce9c20003679e275634167ba9ddafa598fab4db87586cf8a7a1f9

Contents?: true

Size: 1.17 KB

Versions: 20

Compression:

Stored size: 1.17 KB

Contents

class Marty::Grid < ::Netzke::Grid::Base

  extend ::Marty::Permissions

  has_marty_permissions read: :any

  def configure_form_window(c)
    super
    # Fix Add in form/Edit in form modal popup width
    # Netzke 0.10.1 defaults width to 80% of screen which is too wide
    # for a form where the fields are stacked top to bottom
    # Netzke 0.8.4 defaulted width to 400px - let's make it a bit wider
    c.width = 475
  end

  client_class do |c|
    # For some reason the grid update function was removed in Netzke
    # 0.10.1.  So, add it here.
    c.cm_update = l(<<-JS)
    function() {
      this.store.load();
    }
    JS

  end

  def class_can?(op)
    self.class.can_perform_action?(op)
  end

  def configure(c)
    super

    c.permissions = {
      create:      class_can?(:create),
      read:        class_can?(:read),
      update:      class_can?(:update),
      delete:      class_can?(:delete)
    }
    c.editing                = :both
    c.store_config           = {page_size: 30}
  end

  def has_search_action?
    false
  end

  def get_json_sorter(json_col, field)
    lambda do |r, dir|
      r.order("#{json_col} ->> '#{field}' " + dir.to_s)
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
marty-1.0.23 app/components/marty/grid.rb
marty-1.0.22 app/components/marty/grid.rb
marty-1.0.20 app/components/marty/grid.rb
marty-1.0.19 app/components/marty/grid.rb
marty-1.0.18 app/components/marty/grid.rb
marty-1.0.17 app/components/marty/grid.rb
marty-1.0.15 app/components/marty/grid.rb
marty-1.0.14 app/components/marty/grid.rb
marty-1.0.13 app/components/marty/grid.rb
marty-1.0.12 app/components/marty/grid.rb
marty-1.0.11 app/components/marty/grid.rb
marty-1.0.10 app/components/marty/grid.rb
marty-1.0.9 app/components/marty/grid.rb
marty-1.0.8 app/components/marty/grid.rb
marty-1.0.7 app/components/marty/grid.rb
marty-1.0.6 app/components/marty/grid.rb
marty-1.0.5 app/components/marty/grid.rb
marty-1.0.4 app/components/marty/grid.rb
marty-1.0.3 app/components/marty/grid.rb
marty-1.0.1 app/components/marty/grid.rb