Added ability to change the ticket status
This commit is contained in:
@ -1,2 +1,28 @@
|
||||
$(document).ready ->
|
||||
console.log('Hello, world!')
|
||||
|
||||
$('.ticket-status').on('click', handleStatusClick)
|
||||
|
||||
handleStatusClick = (e, msg = 'Set ticket status:') ->
|
||||
validStatus = ['open', 'closed', 'parked']
|
||||
newStatus = prompt(msg, $('.ticket-status > span').text())
|
||||
newStatus = newStatus.toLowerCase()
|
||||
|
||||
if (newStatus != null) and (newStatus != '')
|
||||
if (newStatus in validStatus)
|
||||
console.log('Setting status to ' + newStatus)
|
||||
editLink = $('#ticketEditLink').attr('href') + '/status'
|
||||
console.log('Sending data to ' + editLink)
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: editLink,
|
||||
data:
|
||||
status: newStatus,
|
||||
success: (data) ->
|
||||
newStatus = newStatus.charAt(0).toUpperCase() + newStatus.slice(1)
|
||||
$('.ticket-status > span').text(newStatus)
|
||||
console.log('Ticket updated successfully.')
|
||||
})
|
||||
else
|
||||
console.log('Invalid status entered')
|
||||
handleStatusClick(e, 'Invalid status; valid values are open, closed, and parked')
|
||||
|
@ -98,7 +98,7 @@ input[type="submit"].button-primary
|
||||
p:last-child
|
||||
margin-bottom: 5px
|
||||
|
||||
.ticket-status
|
||||
.ticket-attributes
|
||||
list-style: none
|
||||
margin: 0
|
||||
border: 1px solid #bbb
|
||||
@ -141,6 +141,12 @@ input[type="submit"].button-primary
|
||||
margin-right: 5px
|
||||
font-size: 2rem
|
||||
|
||||
.ticket-status
|
||||
transition: all 230ms ease-in-out
|
||||
&:hover
|
||||
background: rgba(0, 0, 0, .1)
|
||||
cursor: pointer
|
||||
|
||||
#comment-form
|
||||
textarea
|
||||
height: 150px
|
||||
|
Reference in New Issue
Block a user