Sha256: 9df80742af569298a8aa5f7f5f911eff966b9c49320b4c29e4d87a4b6945c7ad

Contents?: true

Size: 1.67 KB

Versions: 1

Compression:

Stored size: 1.67 KB

Contents

window.JqAjaxCore2.Helpers =

linkOptionsFromElement: (item) =>
  # Item is passed as $() object
  item = $(item)
  link_options = {};
  
  link_options['target_div']        =   item.attr('<%= JqajaxCore2::Config.core[:update_div] %>')       || '<%= JqajaxCore2::Config.core[:ajax_content_container_id] %>'
  link_options['load_message']      =   item.attr('<%= JqajaxCore2::Config.loading[:load_message] %>')  || ''
  link_options['submit_data']       =   item.attr('<%= JqajaxCore2::Config.html_data[:submit_data] %>') || ''
  link_options['callback']          =   item.attr('<%= JqajaxCore2::Config.html_data[:callback] %>')    || ''
  link_options['append']            =   item.attr('<%= JqajaxCore2::Config.html_data[:append] %>') ? true : false
  
  # Checking for confirmation 
  link_options['confirm_message']   =   (item.attr('<%= JqajaxCore2::Config.html_data[:confirm] %>')  || '')
  link_options['confirm']           =   link_options['confirm_message'] != ''
  
  return link_options
  

# Element ausblenden - verwendung als Callback nach löschen etc...
hideItem: (id) ->
  $("#"+id).fadeOut(300);



# Element löschen - verwendung als Callback nach löschen etc...
removeItem: (id) ->
  $("#"+id).remove();

getJsonData: (url, type) ->
  type = 'get' if type == undefined
  result = []
  $.ajax({ url: url,async: false, type: type }).done (response) ->
    result = response

  return result


randomString: ->
  chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"
  string_length = 8
  randomstring = ''
  rnum = 0
  for i in [0..string_length]
    rnum = Math.floor(Math.random() * chars.length)
    randomstring += chars.substring(rnum,rnum+1)
  return randomstring

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jqajax_core2-0.0.81 app/assets/javascripts/jqac2/helpers.js.coffee.erb