Sha256: 35109046a05b9d683c302ad8284d14b24cd4e2e7a0e2277a40d5d301f15765bd

Contents?: true

Size: 1.28 KB

Versions: 38

Compression:

Stored size: 1.28 KB

Contents

$(document).ready ->
  $(".file-input-choose-file-button").live "click", ->
    self = $(@)
    
    if self.hasClass("disabled")
      return 0
    
    file_input = self.find("~ input[type='file']")
    file_name_span = self.closest(".controls").find(".file-input-attachment-filename")
     
    file_input.change ->
      file_input_val = file_input.val()
      file_name      = file_input_val.substring(file_input_val.lastIndexOf('/') + 1).substring(file_input_val.lastIndexOf('\\') + 1)
      file_name_span.text(file_name)

    file_input.click()
    
  $(".file-input-delete-attachment-button").live "click", ->
    
    btn = $(@)
    input_container = btn.closest(".controls")
    
    if btn.hasClass("active")
      input_container.find(".btn:not(.file-input-delete-attachment-button)").addClass("disabled")
      btn.siblings(".file-input-attachment-filename").css({"text-decoration": "line-through", opacity: 0.5})
      btn.find("~ .file-input-delete-attachment-checkbox").attr('checked', true);
    else
      input_container.find(".btn:not(.file-input-delete-attachment-button)").removeClass("disabled")
      btn.siblings(".file-input-attachment-filename").css({"text-decoration": "none", opacity: 1})
      btn.find("~ .file-input-delete-attachment-checkbox").attr('checked', false);
      

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
fullstack-admin-0.2.26 app/assets/javascripts/fullstack/admin/src/file_input.js.coffee
fullstack-admin-0.2.25 app/assets/javascripts/fullstack/admin/src/file_input.js.coffee
fullstack-admin-0.2.24 app/assets/javascripts/fullstack/admin/src/file_input.js.coffee
fullstack-admin-0.2.23 app/assets/javascripts/fullstack/admin/src/file_input.js.coffee
fullstack-admin-0.2.22 app/assets/javascripts/fullstack/admin/src/file_input.js.coffee
fullstack-admin-0.2.21 app/assets/javascripts/fullstack/admin/src/file_input.js.coffee
fullstack-admin-0.2.20 app/assets/javascripts/fullstack/admin/src/file_input.js.coffee
fullstack-admin-0.2.19 app/assets/javascripts/support/file_input.js.coffee
fullstack-admin-0.2.18 app/assets/javascripts/support/file_input.js.coffee
fullstack-admin-0.2.17 app/assets/javascripts/support/file_input.js.coffee
fullstack-admin-0.2.16 app/assets/javascripts/support/file_input.js.coffee
fullstack-admin-0.2.15 app/assets/javascripts/support/file_input.js.coffee
fullstack-admin-0.2.14 app/assets/javascripts/support/file_input.js.coffee
fullstack-admin-0.2.13 app/assets/javascripts/support/file_input.js.coffee
fullstack-admin-0.2.12 app/assets/javascripts/support/file_input.js.coffee
fullstack-admin-0.2.11 app/assets/javascripts/support/file_input.js.coffee
fullstack-admin-0.2.9 app/assets/javascripts/support/file_input.js.coffee
fullstack-admin-0.2.8 app/assets/javascripts/support/file_input.js.coffee
fullstack-admin-0.2.7 app/assets/javascripts/support/file_input.js.coffee
fullstack-admin-0.2.6 app/assets/javascripts/support/file_input.js.coffee