Sha256: 550426184ae24c0512583c853d982cbf71022f5a229a8e00892661428ec039a2

Contents?: true

Size: 1.98 KB

Versions: 17

Compression:

Stored size: 1.98 KB

Contents

window.App.NewReleaseForm =

  init: (options)->
    $nestedEditor = $('.changes-nested-editor')
    $nestedEditor.find('.add-link, .delete-link').attr('tabindex', '-1')
    $nestedEditor.delegate '.change-description input', 'keypress', (e)->
      if e.keyCode == 13
        e.preventDefault()
        e.stopImmediatePropagation()
        NestedEditorFor.addRow(NestedEditorFor.getFromEvent(e));
    $nestedEditor.delegate '.change-description input', 'keyup', (e)->
      if e.keyCode == 8 and $(this).val() == ''
        e.preventDefault()
        e.stopImmediatePropagation()
        NestedEditorFor.deleteRow(NestedEditorFor.getFromEvent(e));
      if e.keyCode == 38
        $(this).closest('.nested-row').prev().find('input').select()
      if e.keyCode == 40
        $(this).closest('.nested-row').next().find('input').select()

    ticketSummaries = []
    ticketBySummary = {}
    for ticket in options.tickets
      summary = "[##{ticket.number}] #{ticket.summary}"
      ticketSummaries.push summary
      ticketBySummary[summary] = ticket

    addTicket = (ticket)->
      return if $("#ticket_#{ticket.id}").length > 0
      html = """
      <tr id="ticket_#{ticket.id}">
        <td class="release-ticket-check">
          <input type="checkbox" id="release_ticket_#{ticket.id}" name="release[ticket_ids][]" value="#{ticket.id}" checked="checked" />
        </td>
        <td class="release-ticket-summary">
          #{App.formatTicketSummary(ticket.summary)}
        </td>
        <td class="release-ticket-number">
          <a href="#{ticket.ticketUrl}" target="_blank">##{ticket.number}
        </td>
      </tr>
      """
      $('#new_ticket_li').before(html)

    $('#release_tickets').delegate '.delete-link', 'click', (e)->
      e.preventDefault()
      $(@).closest('tr').remove()

    $('#new_ticket_field')
      .typeahead
        source: ticketSummaries
        updater: (item)->
          selectedTicket = ticketBySummary[item]
          addTicket(selectedTicket) if selectedTicket
          ''

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
houston-core-0.8.0.pre app/assets/javascripts/houston/app/releases.coffee
houston-core-0.7.0 app/assets/javascripts/houston/app/releases.coffee
houston-core-0.7.0.beta4 app/assets/javascripts/houston/app/releases.coffee
houston-core-0.7.0.beta3 app/assets/javascripts/houston/app/releases.coffee
houston-core-0.7.0.beta2 app/assets/javascripts/houston/app/releases.coffee
houston-core-0.7.0.beta app/assets/javascripts/houston/app/releases.coffee
houston-core-0.6.3 app/assets/javascripts/app/releases.coffee
houston-core-0.6.2 app/assets/javascripts/app/releases.coffee
houston-core-0.6.1 app/assets/javascripts/app/releases.coffee
houston-core-0.6.0 app/assets/javascripts/app/releases.coffee
houston-core-0.5.6 app/assets/javascripts/app/releases.coffee
houston-core-0.5.5 app/assets/javascripts/app/releases.coffee
houston-core-0.5.4 app/assets/javascripts/app/releases.coffee
houston-core-0.5.3 app/assets/javascripts/app/releases.coffee
houston-core-0.5.2 app/assets/javascripts/app/releases.coffee
houston-core-0.5.1 app/assets/javascripts/app/releases.coffee
houston-core-0.5.0 app/assets/javascripts/app/releases.coffee