Module: QueriesHelper
- Defined in:
- app/helpers/queries_helper.rb
Instance Method Summary collapse
-
#engine_routes_mount_point ⇒ Object
for AJAX calls.
- #filter_column_fields ⇒ Object
- #relation_metadata(klass) ⇒ Object
- #to_html_id(str) ⇒ Object
Instance Method Details
#engine_routes_mount_point ⇒ Object
for AJAX calls
39 40 41 |
# File 'app/helpers/queries_helper.rb', line 39 def engine_routes_mount_point Rails.application.routes.routes.find { |r| r.app == VisualQuery::Engine }.path.spec end |
#filter_column_fields ⇒ Object
9 10 11 12 13 |
# File 'app/helpers/queries_helper.rb', line 9 def filter_column_fields %w(schema rel_name col_name).inject(""){|res, column_field| res << text_field_tag("#{@field_prefix}[#{column_field}]", instance_variable_get("@#{column_field}"), :type => "hidden")} end |
#relation_metadata(klass) ⇒ Object
3 4 5 6 7 |
# File 'app/helpers/queries_helper.rb', line 3 def (klass) %Q!<a title="#{_("Щракнете за да видите колоните на таблицата")}" href="javascript:void(0);" onclick="Tutuf.VisualQuery.columns('#{klass}',this);return false" >#{_(klass.table_name)}</a>!.html_safe end |
#to_html_id(str) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/helpers/queries_helper.rb', line 15 def to_html_id(str) trans = { "і"=>"i","ґ"=>"g","ё"=>"yo","№"=>"#","є"=>"e", "ї"=>"yi","а"=>"a","б"=>"b", "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"zh", "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l", "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r", "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h", "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"'", "ы"=>"y","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya", "Ґ"=>"G","Ё"=>"YO","Є"=>"E","Ї"=>"YI","І"=>"I", "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G", "Д"=>"D","Е"=>"E","Ж"=>"ZH","З"=>"Z","И"=>"I", "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N", "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T", "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH", "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"'","Ы"=>"Y","Ь"=>"", "Э"=>"E","Ю"=>"YU","Я"=>"YA" } str.to_s.mb_chars.split('').map{|c| trans[c.to_s] || c}.join.gsub(/\s+/, '_') end |