Module: Backend::KujakuHelper

Defined in:
app/helpers/backend/kujaku_helper.rb

Overview

License

Ekylibre - Simple agricultural ERP Copyright (C) 2008-2015 Brice Texier

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <www.gnu.org/licenses/>.

Defined Under Namespace

Classes: Kujaku

Instance Method Summary collapse

Instance Method Details

#kujaku(*args, &_block) ⇒ Object

Kujaku 孔雀 Search bar


23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/helpers/backend/kujaku_helper.rb', line 23

def kujaku(*args, &_block)
  options = args.extract_options!
  url = options[:url] || {}
  name = args.shift || ("#{controller_path}-#{action_name}-" + caller.first.split(/\:/).second).parameterize
  k = Kujaku.new(self, name)
  if block_given?
    yield k
  else
    k.text
  end
  return '' unless k.feathers.any?
  collapsed = current_user.preference("interface.kujakus.#{k.uid}.collapsed", (options.key?(:collapsed) ? !!options[:collapsed] : true), :boolean).value
  render('backend/shared/kujaku', kujaku: k, url: url, collapsed: collapsed, with_form: !options[:form].is_a?(FalseClass))
end