Compare commits
No commits in common. "77c8605b4984aa1cfe950247a801577feb8e7b98" and "f3ac8a696542706f4d3a26e4f114e2b71777b6ac" have entirely different histories.
77c8605b49
...
f3ac8a6965
@ -1,54 +1,2 @@
|
|||||||
$(document).ready ->
|
$(document).ready ->
|
||||||
console.log('Hello, world!')
|
console.log('Hello, world!')
|
||||||
|
|
||||||
$('.ticket-severity').on('click', handleSeverityClick)
|
|
||||||
$('.ticket-status').on('click', handleStatusClick)
|
|
||||||
|
|
||||||
handleSeverityClick = (e, msg = 'Set ticket severity:') ->
|
|
||||||
validSeverity = ['low', 'medium', 'high']
|
|
||||||
newSeverity = prompt(msg, $('.ticket-severity > span').text())
|
|
||||||
newSeverity = newSeverity.toLowerCase()
|
|
||||||
|
|
||||||
if (newSeverity != null) and (newSeverity != '')
|
|
||||||
if (newSeverity in validSeverity)
|
|
||||||
console.log('Setting severity to ' + newSeverity)
|
|
||||||
editLink = $('#ticketEditLink').attr('href') + '/severity'
|
|
||||||
console.log('Sending data to ' + editLink)
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: editLink,
|
|
||||||
data:
|
|
||||||
severity: newSeverity,
|
|
||||||
success: (data) ->
|
|
||||||
newSeverity = newSeverity.charAt(0).toUpperCase() + newSeverity.slice(1)
|
|
||||||
$('.ticket-severity > span').text(newSeverity)
|
|
||||||
console.log('Ticket updated successfully.')
|
|
||||||
})
|
|
||||||
else
|
|
||||||
console.log('Invalid severity entered')
|
|
||||||
handleSeverityClick(e, 'Invalid severity; valid values are low, medium, and high.')
|
|
||||||
|
|
||||||
|
|
||||||
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
|
p:last-child
|
||||||
margin-bottom: 5px
|
margin-bottom: 5px
|
||||||
|
|
||||||
.ticket-attributes
|
.ticket-status
|
||||||
list-style: none
|
list-style: none
|
||||||
margin: 0
|
margin: 0
|
||||||
border: 1px solid #bbb
|
border: 1px solid #bbb
|
||||||
@ -141,13 +141,6 @@ input[type="submit"].button-primary
|
|||||||
margin-right: 5px
|
margin-right: 5px
|
||||||
font-size: 2rem
|
font-size: 2rem
|
||||||
|
|
||||||
.ticket-severity,
|
|
||||||
.ticket-status
|
|
||||||
transition: all 230ms ease-in-out
|
|
||||||
&:hover
|
|
||||||
background: rgba(0, 0, 0, .1)
|
|
||||||
cursor: pointer
|
|
||||||
|
|
||||||
#comment-form
|
#comment-form
|
||||||
textarea
|
textarea
|
||||||
height: 150px
|
height: 150px
|
||||||
|
@ -69,23 +69,6 @@ class TicketController extends Controller {
|
|||||||
->withStatus(302);
|
->withStatus(302);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postEditAttr(Request $request, Response $response, array $args): Response {
|
|
||||||
// grab ticket from database
|
|
||||||
$ticket = Ticket::where('id', $args['ticket_id'])->first();
|
|
||||||
|
|
||||||
// edit the specified attribute
|
|
||||||
$params = (array)$request->getParsedBody();
|
|
||||||
$attr = $args['attr'];
|
|
||||||
$ticket->$attr = $params[$attr];
|
|
||||||
|
|
||||||
// save updated ticket
|
|
||||||
$ticket->save();
|
|
||||||
|
|
||||||
// return a response
|
|
||||||
$response->getBody()->write(json_encode(['status' => 'success']));
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDelete(Request $request, Response $response, array $args): Response {
|
public function getDelete(Request $request, Response $response, array $args): Response {
|
||||||
$ticket = Ticket::where('id', $args['ticket_id'])->first();
|
$ticket = Ticket::where('id', $args['ticket_id'])->first();
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ $app->post('/ticket/create', '\\BitGoblin\\Goliath\\Controllers\\TicketControlle
|
|||||||
// /ticket/edit routes - update a ticket!
|
// /ticket/edit routes - update a ticket!
|
||||||
$app->get('/ticket/{ticket_id}/edit', '\\BitGoblin\\Goliath\\Controllers\\TicketController:getEdit')->setName('ticket.edit');
|
$app->get('/ticket/{ticket_id}/edit', '\\BitGoblin\\Goliath\\Controllers\\TicketController:getEdit')->setName('ticket.edit');
|
||||||
$app->post('/ticket/{ticket_id}/edit', '\\BitGoblin\\Goliath\\Controllers\\TicketController:postEdit')->setName('ticket.edit');
|
$app->post('/ticket/{ticket_id}/edit', '\\BitGoblin\\Goliath\\Controllers\\TicketController:postEdit')->setName('ticket.edit');
|
||||||
$app->post('/ticket/{ticket_id}/edit/{attr}', '\\BitGoblin\\Goliath\\Controllers\\TicketController:postEditAttr')->setName('ticket.edit.attr');
|
|
||||||
|
|
||||||
// ticket deletion route
|
// ticket deletion route
|
||||||
$app->get('/ticket/{ticket_id}/delete', '\\BitGoblin\\Goliath\\Controllers\\TicketController:getDelete')->setName('ticket.delete');
|
$app->get('/ticket/{ticket_id}/delete', '\\BitGoblin\\Goliath\\Controllers\\TicketController:getDelete')->setName('ticket.delete');
|
||||||
|
@ -23,17 +23,17 @@
|
|||||||
|
|
||||||
<!-- ticket status column -->
|
<!-- ticket status column -->
|
||||||
<div class="three columns">
|
<div class="three columns">
|
||||||
<ul class="ticket-attributes">
|
<ul class="ticket-status">
|
||||||
<li class="ticket-actions">
|
<li class="ticket-actions">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a id="ticketEditLink" href="{{ url_for('ticket.edit', {ticket_id: ticket.id}) }}"><i class="fa-solid fa-pen-to-square"></i>Edit</a></li><li><a href="{{ url_for('ticket.delete', {ticket_id: ticket.id}) }}"><i class="fa-solid fa-trash"></i>Delete</a></li>
|
<li><a href="{{ url_for('ticket.edit', {ticket_id: ticket.id}) }}"><i class="fa-solid fa-pen-to-square"></i>Edit</a></li><li><a href="{{ url_for('ticket.delete', {ticket_id: ticket.id}) }}"><i class="fa-solid fa-trash"></i>Delete</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="ticket-severity">
|
<li>
|
||||||
Severity: <span>{{ ticket.severity | capitalize }}</span>
|
Severity {{ ticket.severity | capitalize }}
|
||||||
</li>
|
</li>
|
||||||
<li class="ticket-status">
|
<li>
|
||||||
Status: <span>{{ ticket.status | capitalize }}</span>
|
Status: {{ ticket.status | capitalize }}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Assignee(s): N/a
|
Assignee(s): N/a
|
||||||
|
Loading…
Reference in New Issue
Block a user