Sha256: 1c7a45ef2c544d7b087159565456940f86103b9dbafd5fd90b5adf9aaa11d0ff

Contents?: true

Size: 637 Bytes

Versions: 6

Compression:

Stored size: 637 Bytes

Contents

module EgovUtils
  module ApplicationHelper

    def i18n_js_set_locales_tag
      s = ''
      s << "window.I18n.defaultLocale = '#{I18n.default_locale}';"
      s << "window.I18n.locale = '#{I18n.locale}';"
      s
      javascript_tag s
    end

    def main_schema_attribute(schema)
      schema.available_attributes_hash[schema.main_attribute_name]
    end

    def role_based_render(name, *attributes)
      res = ''.html_safe
      current_user.all_role_names.each do |role_name|
        res << render(name+'_'+role_name, *attributes) if lookup_context.exists?(name+'_'+role_name, [], true)
      end
      res
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
egov_utils-0.1.28 app/helpers/egov_utils/application_helper.rb
egov_utils-0.1.27 app/helpers/egov_utils/application_helper.rb
egov_utils-0.1.26 app/helpers/egov_utils/application_helper.rb
egov_utils-0.1.23 app/helpers/egov_utils/application_helper.rb
egov_utils-0.1.19 app/helpers/egov_utils/application_helper.rb
egov_utils-0.1.18 app/helpers/egov_utils/application_helper.rb