Sha256: d70b447dc72132cf10f1a5f5b6b0207b85e80f5b73451c26b5cfc2f2e5d26ad0
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
module EgovUtils module Helpers module Tags class FileuidField < ActionView::Helpers::Tags::TextField def render res = super res << @template_object.javascript_tag(javascript_str(@options)) res end private def all_agendas ['T', 'Tm', 'INS', 'E'] # a dalsi end def javascript_str(options) agendas = all_agendas agendas &= @options.delete('agendas') if @options['agendas'] index = name_and_id_index(options) tag_id = @options.fetch("id") { tag_id(index) } str = "$(function(){" str << " $('##{tag_id}').fileUid({ available_agendas: #{ agendas.to_json } });" str << " var destroy_evt_method = function(evt){" str << " $('##{tag_id}').fileUid('destroy');" str << " $(document).off('turbolinks:before-cache', destroy_evt_method);" str << " };" str << " $(document).on('turbolinks:before-cache', destroy_evt_method);" str << "});" pp str str end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
egov_utils-0.1.13 | lib/egov_utils/helpers/tags/fileuid_field.rb |