Module: Caboose::ApplicationHelper
- Defined in:
- app/helpers/caboose/application_helper.rb
Instance Method Summary collapse
- #caboose_asset_path(path, options = {}) ⇒ Object
- #caboose_tinymce ⇒ Object
- #cloudfront_asset_path(path) ⇒ Object
- #forem_user ⇒ Object
- #gzip_javascript_include_tag(asset) ⇒ Object
- #gzip_stylesheet_link_tag(asset) ⇒ Object
- #parent_categories ⇒ Object
Instance Method Details
#caboose_asset_path(path, options = {}) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'app/helpers/caboose/application_helper.rb', line 54 def caboose_asset_path(path, = {}) str = "" begin str = asset_path(path, ) rescue Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError Caboose.log("Precompiled asset not found\n\nAsset: #{path}\nFile: #{caller_locations[1].path}\nLine: #{caller_locations[1].lineno}") end return str end |
#caboose_tinymce ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/helpers/caboose/application_helper.rb', line 3 def caboose_tinymce return " <script src='https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.7.13/tinymce.min.js'></script> <script type='text/javascript'> //<![CDATA[ tinyMCE.init({ selector: 'textarea.tinymce', width: '800px', height: '300px', convert_urls: false, plugins: 'advlist autolink lists link image charmap preview hr anchor pagebreak searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking table contextmenu directionality paste textcolor caboose', toolbar1: 'caboose_save caboose_cancel | bold italic forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image', image_advtab: true, external_plugins: { 'caboose': '#{Caboose::cdn_domain == '/' ? '' : "//#{Caboose::cdn_domain}"}/assets/tinymce/plugins/caboose/plugin.js' }, setup: function(editor) { var control = ModelBinder.tinymce_control(editor.id); editor.on('keyup', function(e) { control.tinymce_change(editor); }); } }); //]]> </script>\n" end |
#cloudfront_asset_path(path) ⇒ Object
48 49 50 51 52 |
# File 'app/helpers/caboose/application_helper.rb', line 48 def cloudfront_asset_path(path) str = asset_path(str) str = str.gsub('http://', 'https://') if request.env['HTTPS'] == 'on' return str end |
#forem_user ⇒ Object
30 31 32 |
# File 'app/helpers/caboose/application_helper.rb', line 30 def forem_user return @logged_in_user end |
#gzip_javascript_include_tag(asset) ⇒ Object
34 35 36 37 38 39 |
# File 'app/helpers/caboose/application_helper.rb', line 34 def gzip_javascript_include_tag(asset) tag = javascript_include_tag asset tag = tag.gsub(/\.js/i, ".js.gz") if Rails.env.production? && request.accept_encoding =~ /gzip/i #tag = tag.gsub(/\.js/i, ".js.gz") if request.accept_encoding =~ /gzip/i tag.html_safe end |
#gzip_stylesheet_link_tag(asset) ⇒ Object
41 42 43 44 45 46 |
# File 'app/helpers/caboose/application_helper.rb', line 41 def gzip_stylesheet_link_tag(asset) tag = stylesheet_link_tag asset, media: "all" tag = tag.gsub(/\.css/i, ".css.gz") if Rails.env.production? && request.accept_encoding =~ /gzip/i #tag = tag.gsub(/\.css/i, ".css.gz") if request.accept_encoding =~ /gzip/i tag.html_safe end |