render query methods required in all controllers (because of possible usage with macros
This commit is contained in:
@@ -270,38 +270,4 @@ module AdditionalsQueriesHelper
|
|||||||
|
|
||||||
tags
|
tags
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_query_group_view(query, locals = {})
|
|
||||||
return if locals[:group_name].blank?
|
|
||||||
|
|
||||||
render partial: 'queries/additionals_group_view',
|
|
||||||
locals: { query: query }.merge(locals)
|
|
||||||
end
|
|
||||||
|
|
||||||
def render_query_block_columns(query, entry, tr_classes:, with_buttons: false)
|
|
||||||
td_colspan = query.inline_columns.size + 1
|
|
||||||
td_colspan += 1 if with_buttons
|
|
||||||
|
|
||||||
content = []
|
|
||||||
query.block_columns.each do |column|
|
|
||||||
next unless (text = column_content column, entry) || text.blank?
|
|
||||||
|
|
||||||
content << tag.tr(class: tr_classes) do # rubocop: disable Style/MethodCallWithArgsParentheses
|
|
||||||
tag.td colspan: td_colspan, class: "#{column.css_classes} block_column" do
|
|
||||||
td_content = []
|
|
||||||
td_content << tag.span(column.caption) if query.block_columns.count > 1
|
|
||||||
td_content << text
|
|
||||||
safe_join td_content
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
safe_join content
|
|
||||||
end
|
|
||||||
|
|
||||||
def render_query_description(query)
|
|
||||||
return unless query.description? && query.persisted?
|
|
||||||
|
|
||||||
tag.div textilizable(query, :description), class: 'query-description'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@@ -2,6 +2,40 @@
|
|||||||
|
|
||||||
module Additionals
|
module Additionals
|
||||||
module Helpers
|
module Helpers
|
||||||
|
def render_query_group_view(query, locals = {})
|
||||||
|
return if locals[:group_name].blank?
|
||||||
|
|
||||||
|
render partial: 'queries/additionals_group_view',
|
||||||
|
locals: { query: query }.merge(locals)
|
||||||
|
end
|
||||||
|
|
||||||
|
def render_query_block_columns(query, entry, tr_classes:, with_buttons: false)
|
||||||
|
td_colspan = query.inline_columns.size + 1
|
||||||
|
td_colspan += 1 if with_buttons
|
||||||
|
|
||||||
|
content = []
|
||||||
|
query.block_columns.each do |column|
|
||||||
|
next unless (text = column_content column, entry) || text.blank?
|
||||||
|
|
||||||
|
content << tag.tr(class: tr_classes) do # rubocop: disable Style/MethodCallWithArgsParentheses
|
||||||
|
tag.td colspan: td_colspan, class: "#{column.css_classes} block_column" do
|
||||||
|
td_content = []
|
||||||
|
td_content << tag.span(column.caption) if query.block_columns.count > 1
|
||||||
|
td_content << text
|
||||||
|
safe_join td_content
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
safe_join content
|
||||||
|
end
|
||||||
|
|
||||||
|
def render_query_description(query)
|
||||||
|
return unless query.description? && query.persisted?
|
||||||
|
|
||||||
|
tag.div textilizable(query, :description), class: 'query-description'
|
||||||
|
end
|
||||||
|
|
||||||
def live_search_title_info(entity)
|
def live_search_title_info(entity)
|
||||||
fields = "LiveSearch::#{entity.to_s.classify}".constantize.info_fields
|
fields = "LiveSearch::#{entity.to_s.classify}".constantize.info_fields
|
||||||
all_fields = fields.map { |f| "#{f}:term" }.join ', '
|
all_fields = fields.map { |f| "#{f}:term" }.join ', '
|
||||||
|
Reference in New Issue
Block a user