Module: JqajaxCoreHelper
- Defined in:
- app/helpers/jqajax_core_helper.rb
Instance Method Summary collapse
-
#default_ajax_link(options = {}) ⇒ Object
Default Ajax Link for Links.
- #init_slidedown ⇒ Object
- #select_onchange_data(options = {}) ⇒ Object
-
#slide_down_box(title, options = {:open => false}, &block) ⇒ Object
Creates a box that slides down and up to show/hide the content.
Instance Method Details
#default_ajax_link(options = {}) ⇒ Object
Default Ajax Link for Links
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/helpers/jqajax_core_helper.rb', line 8 def default_ajax_link( ={}) link_data = init_link_data() link_data.merge!(:title => [:title]) [:class] ||= "" [:class] << " #{JqajaxCore2::Config.core[:ajax_link_class]} #{JqajaxCore2::Config.core[:no_ajax_link_class]}" if [:append] == true link_data.merge!(JqajaxCore2::Config.html_data[:append] => true) end # Load-Message setzen: Entweder default oder eigene Nachricht if [:load_message] && ([:load_message] != false && ![:load_message].blank?) [:class] << " #{AJAX_LOAD_MESSAGE_TRIGGER}" if [:load_message].is_a?(String) link_data.merge!(JqajaxCore2::Config.loading[:load_message].to_s => [:load_message]) end elsif [:load_message] == false [:class] << " #{AJAX_HIDE_LOAD_MESSAGE_SELECTOR}" end link_data.merge!(()) return link_data end |
#init_slidedown ⇒ Object
87 88 89 |
# File 'app/helpers/jqajax_core_helper.rb', line 87 def raw("<script type='text/javascript'>init_slidedown();</script>") end |
#select_onchange_data(options = {}) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/helpers/jqajax_core_helper.rb', line 35 def select_onchange_data( ={}) link_data = init_link_data() link_data.merge!(:disabled => [:disabled]) [:class] ||= "" [:class] << " #{JqajaxCore2::Config.core[:select_onchange_selector]} #{JqajaxCore2::Config.core[:no_ajax_link_class]}" [:with] ||= :id [:url].merge!([:with] => JqajaxCore2::Config.core[:url_placeholder]) link_data.merge!(JqajaxCore2::Config.html_data[:target_url].to_s => ([:scope] || main_app).url_for([:url])) # Load-Message setzen: Entweder default oder eigene Nachricht if [:load_message] && ([:load_message] != false && ![:load_message].blank?) [:class] << " #{AJAX_LOAD_MESSAGE_TRIGGER}" if [:load_message].is_a?(String) link_data.merge!(JqajaxCore2::Config.loading[:load_message].to_s => [:load_message]) end elsif [:load_message] == false [:class] << " #{AJAX_HIDE_LOAD_MESSAGE_SELECTOR}" end link_data.merge!(()) return link_data end |
#slide_down_box(title, options = {:open => false}, &block) ⇒ Object
Creates a box that slides down and up to show/hide the content.
-
Use ‘:open => true’ to set the box open by default
-
Use ‘:default_class => “className”’ to set the class used for the header
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'app/helpers/jqajax_core_helper.rb', line 67 def (title, = {:open => false}, &block) [:default_class] ||= "icon-arrow-right" [:type] ||= :div box_session_id = Digest::SHA1.hexdigest("#{params[:action]}-#{title}") open = [:open] #|| (session[:slidedown_boxes_open].include?(box_session_id) rescue false) concat raw("<div class='js-slide-down-box plain #{'open' if open} #{[:box_class]} #{[:class]}' data-session-id='#{box_session_id}'> <#{[:type]} class='#{[:default_class]} js-slidedown-button'> #{title} </#{[:type]}> <div class='js-slidedown-content'>") yield concat raw("</div></div>") end |