Skip to content

Commit 21460f0

Browse files
committed
Tweak TicketView
1 parent 902c5f2 commit 21460f0

3 files changed

Lines changed: 56 additions & 13 deletions

File tree

src/Traq/ViewModels/TicketView.php

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,49 @@ public function getSeverity(): string
156156

157157
public function toArray(): array
158158
{
159-
return get_object_vars($this);
159+
$data = [
160+
'ticket_id' => $this->ticket_id,
161+
'summary' => $this->summary,
162+
'user_id' => $this->user_id,
163+
'assigned_to_id' => $this->assigned_to_id,
164+
'votes' => $this->votes,
165+
'created_at' => $this->created_at,
166+
'updated_at' => $this->updated_at,
167+
'is_closed' => $this->is_closed,
168+
'owner' => [
169+
'name' => $this->owner,
170+
],
171+
'assignee' => $this->assignee ? [
172+
'name' => $this->assignee,
173+
] : null,
174+
'type' => [
175+
'name' => $this->type,
176+
],
177+
'milestone' => $this->milestone ? [
178+
'name' => $this->milestone,
179+
'slug' => $this->milestone_slug,
180+
] : null,
181+
'version' => $this->version ? [
182+
'name' => $this->version,
183+
'slug' => $this->version_slug,
184+
] : null,
185+
'component' => $this->component ? [
186+
'name' => $this->component,
187+
] : null,
188+
'status' => [
189+
'name' => $this->status,
190+
],
191+
'priority' => [
192+
'name' => $this->priority,
193+
],
194+
'severity' => [
195+
'name' => $this->severity,
196+
],
197+
'project' => [
198+
'slug' => $this->project_slug,
199+
],
200+
];
201+
202+
return $data;
160203
}
161204
}

src/views/default/profile/view.phtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@
150150
<td>
151151
<a :href="window.traq.base + projectSlug + '/tickets/' + ticket.ticket_id" x-text="ticket.summary"></a>
152152
</td>
153-
<td x-text="ticket.status"></td>
154-
<td x-text="ticket.type"></td>
155-
<td x-text="ticket.milestone"></td>
156-
<td x-text="ticket.component"></td>
153+
<td x-text="ticket.status.name"></td>
154+
<td x-text="ticket.type.name"></td>
155+
<td x-text="ticket.milestone.name"></td>
156+
<td x-text="ticket.component.name"></td>
157157
</tr>
158158
</template>
159159
</tbody>

src/views/default/tickets/index.phtml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,14 @@
272272
<td x-show="columns.summary">
273273
<a :href="`${window.traq.base}${window.traq.project_slug}/tickets/${ticket.ticket_id}`" x-text="ticket.summary"></a>
274274
</td>
275-
<td x-text="ticket.status" x-show="columns.status"></td>
276-
<td x-text="ticket.owner" x-show="columns.owner"></td>
277-
<td x-text="ticket.type" x-show="columns.type"></td>
278-
<td x-text="ticket.component" x-show="columns.component"></td>
279-
<td x-text="ticket.milestone" x-show="columns.milestone"></td>
280-
<td x-text="ticket.assignee" x-show="columns.assignee"></td>
281-
<td x-text="ticket.priority" x-show="columns.priority"></td>
282-
<td x-text="ticket.severity" x-show="columns.severity"></td>
275+
<td x-text="ticket.status.name" x-show="columns.status"></td>
276+
<td x-text="ticket.owner.name" x-show="columns.owner"></td>
277+
<td x-text="ticket.type.name" x-show="columns.type"></td>
278+
<td x-text="ticket.component.name" x-show="columns.component"></td>
279+
<td x-text="ticket.milestone.name" x-show="columns.milestone"></td>
280+
<td x-text="ticket.assignee.name" x-show="columns.assignee"></td>
281+
<td x-text="ticket.priority.name" x-show="columns.priority"></td>
282+
<td x-text="ticket.severity.name" x-show="columns.severity"></td>
283283
<td x-text="ticket.created_at" x-show="columns.reported"></td>
284284
<td x-text="ticket.updated_at" x-show="columns.updated"></td>
285285
<td x-text="ticket.votes" x-show="columns.votes"></td>

0 commit comments

Comments
 (0)