Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
j_platform / app / assets / javascripts / j_platform / nav.js.coffee
Size: Mime:
hosts = [
  $('meta[name="feeds-host"]').attr('content'),
  $('meta[name="visualizer-host"]').attr('content')
]

$(document).on "click", "#nav-project-dropdown .select-working-project", (e) ->
  $("#project-dropdown-spinner").remove()
  $(this).after('<div id="project-dropdown-spinner"></div>')
  $("#project-dropdown-spinner").spin('global', '#4D5C65')

  changed = 0
  for host in hosts
    $.ajax
      url: "#{host}#{$(this).attr('href')}"
      complete: ->
        if (++changed is hosts.length)
          targetLoc = removeLocationHash locationWithoutProjectId()
          window.location = targetLoc

locationWithoutProjectId = ->
  window.location.href.replace(/project_id=\d*&?/, '')

removeLocationHash = (targetLoc)->
  targetLoc.split('#')[0].replace(/\/?\?$/, '')

$(document).on "click", "html", (e) ->
  $("#nav-project-dropdown").removeClass("open")

$(document).on "click", ".project-dropdown-toggle", (e) ->
  $(this).parent().toggleClass('open')
  e.stopPropagation()

$(document).on "click", ".btn-project-info", (e) ->
  $(this).addClass('hide-icon')

$(document).on "shown.bs.modal", "#project-info-tabs", (e) ->
  $('.btn-project-info').removeClass('hide-icon')
  cardFilter.showHideCardSection()
  svgFill()
  $('.nav-tabs li').click (e) ->
    unless $(@).hasClass('active')
      $('#search-cards').val('').keyup()

$(document).on "ajax:success", "#project-info", (e, data) ->
  $("#modal-holder").html(data)
  $("#project-info-tabs").modal('show')

  $("#project-info-tabs").on "shown.bs.modal", ->
    enableChosen()

## Launch Social Post
$(document).on "click", "#social_post_launcher", (e) ->
  linkObj = $ @
  if linkObj.attr('data-disabled')
    e.preventDefault();
    errorText = linkObj.data('error') || "Social Post is currently disabled. Please ensure that you have social accounts available for your current project."
    noty {text: errorText, type: "error"}
    return false

## TODO: consider consolidating these into one function/listener with toggleClass on "hover-icon" based on event
$(document).on "mouseenter", ".uploaders a", (e)->
  $(this).addClass "hover-icon"
  fill(this)
$(document).on "mouseleave", ".uploaders a", (e)->
  $(this).removeClass "hover-icon"
  fill(this)