Module: Backend::BeehiveHelper

Defined in:
app/helpers/backend/beehive_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: Beehive

Constant Summary collapse

FORMAT_VERSION =
2

Instance Method Summary collapse

Instance Method Details

#beehive(name = nil, &block) ⇒ Object

巣 Beehive permits to create modular interface organized in cells


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

def beehive(name = nil, &block)
  html = ''
  # return html unless block_given?
  name ||= "#{controller_name}_#{action_name}".to_sym
  board = Beehive.new(name, self)
  if block_given?
    if block.arity < 1
      board.instance_eval(&block)
    else
      block[board]
    end
  end
  render(partial: 'backend/shared/beehive', object: board)
end

#cell(type, options = {}, html_options = {}) ⇒ Object

Permits to display cell content independently


40
41
42
43
44
45
46
47
48
49
# File 'app/helpers/backend/beehive_helper.rb', line 40

def cell(type, options = {}, html_options = {})
  url = options[:params] || {}
  (:div, nil, html_options.merge(
                           data: {
                             cell: url_for(url.merge(controller: "backend/cells/#{type}_cells", action: :show)),
                             cell_empty_message: :no_data.tl,
                             cell_error_message: :internal_error.tl
                           }
  ))
end