Module: ErpApp::Extensions::Railties::ActionView::Helpers::IncludeHelper
- Defined in:
- lib/erp_app/extensions/railties/action_view/helpers/include_helper.rb
Instance Method Summary collapse
- #include_code_mirror_library ⇒ Object
- #include_compass_ae_instance_about ⇒ Object
- #include_highslide(options = {}) ⇒ Object
- #load_shared_application_resources(resource_type) ⇒ Object
- #setSessionTimeout(warn_milli_seconds = ((ErpApp::Config.session_warn_after*60)*1000), redirect_milli_seconds = ((ErpApp::Config.session_redirect_after*60)*1000), redirect_to = '/session/sign_out') ⇒ Object (also: #set_session_timeout)
- #setup_js_authentication(user, app_container) ⇒ Object
Instance Method Details
#include_code_mirror_library ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/erp_app/extensions/railties/action_view/helpers/include_helper.rb', line 38 def include_code_mirror_library resources = static_javascript_include_tag("erp_app/codemirror/lib/codemirror.js") resources << static_javascript_include_tag("erp_app/codemirror/mode/htmlmixed/htmlmixed.js") resources << static_javascript_include_tag("erp_app/codemirror/mode/xml/xml.js") resources << static_javascript_include_tag("erp_app/codemirror/mode/css/css.js") resources << static_javascript_include_tag("erp_app/codemirror/mode/javascript/javascript.js") resources << static_javascript_include_tag("erp_app/codemirror/mode/ruby/ruby.js") resources << static_javascript_include_tag("erp_app/codemirror/mode/yaml/yaml.js") resources << static_javascript_include_tag("erp_app/codemirror/lib/util/runmode.js") resources << static_javascript_include_tag("erp_app/codemirror_highlight.js") resources << (raw "<link rel=\"stylesheet\" type=\"text/css\" href=\"/javascripts/erp_app/codemirror/lib/codemirror.css\" />") resources end |
#include_compass_ae_instance_about ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/erp_app/extensions/railties/action_view/helpers/include_helper.rb', line 52 def include_compass_ae_instance_about compass_ae_instance = CompassAeInstance.find_by_internal_identifier('base') json_hash = { :version => compass_ae_instance.version, :installedAt => compass_ae_instance.created_at.strftime("%B %d, %Y at %I:%M%p"), :lastUpdateAt => compass_ae_instance.updated_at.strftime("%B %d, %Y at %I:%M%p"), :installedEngines => compass_ae_instance.installed_engines, :guid => compass_ae_instance.guid } raw "<script type=\"text/javascript\">compassAeInstance = #{json_hash.to_json};</script>" end |
#include_highslide(options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/erp_app/extensions/railties/action_view/helpers/include_helper.rb', line 8 def ( = {}) raw case [:version].to_s.downcase when 'full' static_javascript_include_tag("erp_app/highslide/highslide/highslide-full.js") when 'gallery' static_javascript_include_tag("erp_app/highslide/highslide/highslide-with-gallery.js") when 'html' static_javascript_include_tag("erp_app/highslide/highslide/highslide-with-html.js") else static_javascript_include_tag("erp_app/highslide/highslide/highslide.js") end end |
#load_shared_application_resources(resource_type) ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'lib/erp_app/extensions/railties/action_view/helpers/include_helper.rb', line 73 def load_shared_application_resources(resource_type) resource_type = resource_type.to_sym case resource_type when :javascripts raw static_javascript_include_tag(ErpApp::ApplicationResourceLoader::SharedLoader.new.locate_shared_files(resource_type)) when :stylesheets raw static_stylesheet_link_tag(ErpApp::ApplicationResourceLoader::SharedLoader.new.locate_shared_files(resource_type)) end end |
#setSessionTimeout(warn_milli_seconds = ((ErpApp::Config.session_warn_after*60)*1000), redirect_milli_seconds = ((ErpApp::Config.session_redirect_after*60)*1000), redirect_to = '/session/sign_out') ⇒ Object Also known as: set_session_timeout
64 65 66 67 68 |
# File 'lib/erp_app/extensions/railties/action_view/helpers/include_helper.rb', line 64 def setSessionTimeout(warn_milli_seconds=((ErpApp::Config.session_warn_after*60)*1000), redirect_milli_seconds=((ErpApp::Config.session_redirect_after*60)*1000), redirect_to='/session/sign_out') raw "<script type='text/javascript'>Compass.ErpApp.Utility.SessionTimeout.setupSessionTimeout(#{warn_milli_seconds}, #{redirect_milli_seconds}, '#{redirect_to}') </script>" if current_user end |
#setup_js_authentication(user, app_container) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/erp_app/extensions/railties/action_view/helpers/include_helper.rb', line 21 def setup_js_authentication(user, app_container) current_user = { :username => user.username, :lastloginAt => user.last_login_at, :lastActivityAt => user.last_activity_at, :failedLoginCount => user.failed_logins_count, :email => user.email, :roles => user.all_roles.collect { |role| role.internal_identifier }, :capabilities => user.class_capabilities_to_hash, :id => user.id, :description => user.party.to_s } js_string = static_javascript_include_tag('erp_app/authentication/compass_user.js') js_string << (raw "<script type='text/javascript'>var currentUser = new ErpApp.CompassAccessNegotiator.CompassUser(#{current_user.to_json});</script>") js_string end |