Sha256: 998c62b898bf47fcd60b9826dfb7d2029fc4040b4f0d5601d999a51a22683c6c

Contents?: true

Size: 1.26 KB

Versions: 30

Compression:

Stored size: 1.26 KB

Contents

module Marty::Extras::Misc
  MM_OPTIONS = {
    editor_config: {
      trigger_action: :all,
      xtype: :combo,
      store: (1..12).map {|x| [x, "%02d" % x]},
      # FIXME: for some reason, with Netzke 0.8.2, the label show
      # up in the grid editor.  This hack seems to fix the
      # problem.  However, the label in the add-in-form now looks
      # weird.
      label_align: :top,
    },
    renderer: "function(v){return ('0' + v).slice (-2);}",
    # FIXME: a little bogus since this is computed statically.  lambda
    # didn't work.
    default_value: Date.today.month
  }
  def self.numberfield_cfg(decimal_places)
    {
      format: "0." + "0"*decimal_places,
      xtype: 'numbercolumn',
      editor_config: { hide_trigger: true,
                       decimal_precision: decimal_places },
      field_config: { decimal_precision: decimal_places,
                      xtype: :numberfield,
                      hide_trigger: true,
                      key_nav_enabled: false,
                      mouse_wheel_enabled: false }
    }
  end

  def sep
    { xtype: 'tbseparator' }
  end

  def icon_hack(name)
    # There's a Netzke bug whereby, using an icon name in a hash
    # doesn't generate a proper URL.
    "#{Netzke::Core.ext_uri}/../icons/#{name}.png"
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
marty-2.5.2 app/components/marty/extras/misc.rb
marty-2.5.1 app/components/marty/extras/misc.rb
marty-2.5.0 app/components/marty/extras/misc.rb
marty-2.4.9 app/components/marty/extras/misc.rb
marty-2.4.8 app/components/marty/extras/misc.rb
marty-2.4.7 app/components/marty/extras/misc.rb
marty-2.4.6 app/components/marty/extras/misc.rb
marty-2.4.5 app/components/marty/extras/misc.rb
marty-2.4.4 app/components/marty/extras/misc.rb
marty-2.4.3 app/components/marty/extras/misc.rb
marty-2.4.2 app/components/marty/extras/misc.rb
marty-2.4.1 app/components/marty/extras/misc.rb
marty-2.4.0 app/components/marty/extras/misc.rb
marty-2.3.15 app/components/marty/extras/misc.rb
marty-2.3.14 app/components/marty/extras/misc.rb
marty-2.3.13 app/components/marty/extras/misc.rb
marty-2.3.12 app/components/marty/extras/misc.rb
marty-2.3.11 app/components/marty/extras/misc.rb
marty-2.3.10 app/components/marty/extras/misc.rb
marty-2.3.9 app/components/marty/extras/misc.rb