Sha256: 686af93439b231a19e9ec56f556d18abfdf6e870a5467282b7bf59b2371d730a

Contents?: true

Size: 1.39 KB

Versions: 22

Compression:

Stored size: 1.39 KB

Contents

module Marty
  module Extras
    module Layout

      def hbox(*args)
        params = args.pop
        params.merge(layout: { type: :hbox, align: :stretch },
                     items: args,
                     )
      end

      def vbox(*args)
        params = args.pop
        params.merge(layout: { type: :vbox, align: :stretch },
                     items: args,
                     )
      end

      def fieldset(title, *args)
        params = args.pop
        params.merge(items: args,
                     xtype: 'fieldset',
                     defaults: { anchor: '100%' },
                     title: title,
                     )
      end

      def dispfield(params={})
        {
          attr_type: :displayfield,
          hide_label: !params[:field_label],
          read_only: true,
        }.merge(params)
      end

      def vspacer(params={})
        vbox({flex: 1, border: false}.merge(params))
      end

      def hspacer(params={})
        hbox({flex: 1, border: false}.merge(params))
      end

      def textarea_field(name, options={})
        {
          name:        name,
          width:       "100%",
          height:      150,
          xtype:       :textareafield,
          auto_scroll: true,
          spellcheck:  false,
          field_style: {
            font_family: 'courier new',
            font_size:   '12px'
          },
        } + options
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
marty-1.0.5 app/components/marty/extras/layout.rb
marty-1.0.4 app/components/marty/extras/layout.rb
marty-1.0.3 app/components/marty/extras/layout.rb
marty-1.0.1 app/components/marty/extras/layout.rb
marty-1.0.0 app/components/marty/extras/layout.rb
marty-0.5.41 app/components/marty/extras/layout.rb
marty-0.5.40 app/components/marty/extras/layout.rb
marty-0.5.39 app/components/marty/extras/layout.rb
marty-0.5.38 app/components/marty/extras/layout.rb
marty-0.5.36 app/components/marty/extras/layout.rb
marty-0.5.35 app/components/marty/extras/layout.rb
marty-0.5.34 app/components/marty/extras/layout.rb
marty-0.5.33 app/components/marty/extras/layout.rb
marty-0.5.32 app/components/marty/extras/layout.rb
marty-0.5.31 app/components/marty/extras/layout.rb
marty-0.5.30 app/components/marty/extras/layout.rb
marty-0.5.29 app/components/marty/extras/layout.rb
marty-0.5.28 app/components/marty/extras/layout.rb
marty-0.5.27 app/components/marty/extras/layout.rb
marty-0.5.26 app/components/marty/extras/layout.rb