Sha256: 825fb7cfbd92d5d287cb92dbeb600062ab06405f210036041e2bf16444c1706a

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

module Netzke
  module Basepack
    class SearchWindow < Netzke::Basepack::Window

      action :search do
        { :text => I18n.t('netzke.basepack.search_window.action.search') }
      end

      action :cancel do
        { :text => I18n.t('netzke.basepack.search_window.action.cancel') }
      end

      js_properties :width => "50%",
                    :auto_height => true,
                    :close_action => "hide",
                    :buttons => [:search.action, :cancel.action],
                    :modal => true

      def configuration
        super.tap do |s|
          s[:items] = [:search_panel.component(:prevent_header => true)]
          s[:title] = I18n.t('netzke.basepack.search_window.title')
          s[:persistence] = false
        end
      end

      component :search_panel do
        {
          :class_name => "Netzke::Basepack::QueryBuilder",
          :model => config[:model],
          :fields => config[:fields]
        }
      end

      js_method :init_component, <<-JS
        function(){
          this.callParent();

          this.on('show', function(){
            this.closeRes = 'cancel';
          });
        }
      JS

      js_method :get_query, <<-JS
        function(){
          return this.items.first().getQuery();
        }
      JS

      js_method :on_search, <<-JS
        function(){
          this.closeRes = 'search';
          this.hide();
        }
      JS

      js_method :on_cancel, <<-JS
        function(){
          this.hide();
        }
      JS

    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
netzke-basepack-0.7.7 lib/netzke/basepack/search_window.rb
netzke-basepack-zh-0.7.6 lib/netzke/basepack/search_window.rb