Class: EasyQueryAdapterPresenter

Inherits:
RedmineExtensions::BasePresenter show all
Defined in:
app/presenters/easy_query_adapter_presenter.rb

Instance Attribute Summary collapse

Attributes inherited from RedmineExtensions::BasePresenter

#model, #options

Instance Method Summary collapse

Methods inherited from RedmineExtensions::BasePresenter

#h, present, presenter_for, register, registered_presenters, #to_model, #update_options

Constructor Details

#initialize(query, view_context = nil, options = {}) ⇒ EasyQueryAdapterPresenter

should be defined in parent in future



7
8
9
10
11
12
13
# File 'app/presenters/easy_query_adapter_presenter.rb', line 7

def initialize(query, view_context=nil, options={})
  super(query, view_context, options)
  @query = query

  @page_module = options[:page_module]

end

Instance Attribute Details

#page_moduleObject

— GETTERS —



4
5
6
# File 'app/presenters/easy_query_adapter_presenter.rb', line 4

def page_module
  @page_module
end

#row_limitObject

— GETTERS —



4
5
6
# File 'app/presenters/easy_query_adapter_presenter.rb', line 4

def row_limit
  @row_limit
end

Instance Method Details

#available_outputsObject



28
29
30
# File 'app/presenters/easy_query_adapter_presenter.rb', line 28

def available_outputs
  outputs.available_output_names
end

#default_nameObject

—– RENDERING HELPERS —-



38
39
40
# File 'app/presenters/easy_query_adapter_presenter.rb', line 38

def default_name
  h.l(self.class.name.underscore, :scope => [:easy_query, :name])
end

#entities(options = {}) ⇒ Object



15
16
17
18
# File 'app/presenters/easy_query_adapter_presenter.rb', line 15

def entities(options={})
  #can not fetch, cuz gantt is fetching enstead of nil
  @entities ||= @options[:entities] || h.instance_variable_get(:@entities) #|| model.entities(options)
end

#entity_count(options = {}) ⇒ Object



20
21
22
# File 'app/presenters/easy_query_adapter_presenter.rb', line 20

def entity_count(options={})
  @entity_count ||= h.instance_variable_get(:@entity_count) || model.entity_count(options)
end

#entity_pagesObject



24
25
26
# File 'app/presenters/easy_query_adapter_presenter.rb', line 24

def entity_pages
  @options[:entity_pages] || h.instance_variable_get(:@entity_pages)
end

#filters_active?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'app/presenters/easy_query_adapter_presenter.rb', line 46

def filters_active?
  model.filters.any?
end

#nameObject



42
43
44
# File 'app/presenters/easy_query_adapter_presenter.rb', line 42

def name
  @name ||= options[:easy_query_name] || (model.new_record? ? default_name : model.name)
end

#outputsObject



32
33
34
# File 'app/presenters/easy_query_adapter_presenter.rb', line 32

def outputs
  @outputs ||= RedmineExtensions::EasyQueryHelpers::Outputs.new(self)
end