Skip to content

Commit

Permalink
Add default text to create ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Kainer committed Jan 30, 2017
1 parent d3a1335 commit 3915887
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<div class="description">
<tt-command-textview
[initialContent]="'Description text...'"
[realInitialContent]="template"
[projectId]="projectId"
[activeTags]="activeTags"
[assignedUsers]="assignedUsers"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class TicketCreateComponent {
@Input() allTicketTags: imm.Map<string, CommandTextviewTicketTag>;
@Input() allTimeCategories: imm.Map<string, CommandTextviewTimeCategory>;
@Input() allAssignmentTags: imm.Map<string, CommandTextviewAssignmentTag>;
@Input() template: string = '';
readonly activeTags = imm.List.of();
readonly assignedUsers = imm.List.of();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ <h3 class="title">
</div>
<div class="body">
<tt-ticket-create [projectId]="projectId" [allTicketTags]="allTicketTags" [allTimeCategories]="allTimeCategories" [allAssignmentTags]="allAssignmentTags"
(ticketAdd)="onTicketCreate($event)" [working]="createRunning">
(ticketAdd)="onTicketCreate($event)" [working]="createRunning" [template]="newTicketTemplate">
</tt-ticket-create>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
AssignmentTagResultJson, UserResultJson, TicketTagResultJson,
TimeCategoryJson,
TickettagApi, TicketuserrelationApi, TickettagrelationApi, ProjectApi,
TimecategoryApi
TimecategoryApi, ProjectResultJson
} from '../../api';
import {
TicketOverview, TicketOverviewTag, TicketOverviewAssTag, TicketOverviewUser,
Expand Down Expand Up @@ -46,6 +46,7 @@ export class TicketOverviewComponent implements OnInit {
private filterTerms = new Subject<TicketFilter>();
private ticketFilter: TicketFilter = new TicketFilter(undefined, undefined, undefined, undefined, undefined,
undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
private newTicketTemplate: string = '';
sortprop = ['NUMBER_ASC'];
offset = 0;
limit = 30;
Expand Down Expand Up @@ -178,8 +179,11 @@ export class TicketOverviewComponent implements OnInit {
let timeCategoriesObs = this.allTimeCategories ? Observable.of(this.allTimeCategories) : this.apiCallService
.callNoError<TimeCategoryJson[]>(p => this.timeCategoryApi.listProjectTimeCategoriesUsingGETWithHttpInfo(this.projectId, p))
.map(tcs => idListToMap(tcs).map(tc => new TicketOverviewTimeCategory(tc)).toMap());
let newTicketTemplateObs = this.apiCallService
.callNoError<ProjectResultJson>(p => this.projectApi.getProjectUsingGETWithHttpInfo(this.projectId, p))
.map(p => p.ticketTemplate);
return Observable
.zip(rawTicketObs, assignmentTagsObs, ticketTagsObs, projectUsersObs, timeCategoriesObs)
.zip(rawTicketObs, assignmentTagsObs, ticketTagsObs, projectUsersObs, timeCategoriesObs, newTicketTemplateObs)
.do(
tuple => {
if (!this.loading) {
Expand All @@ -190,6 +194,7 @@ export class TicketOverviewComponent implements OnInit {
this.allProjectUsers = tuple[3];
this.allTimeCategories = tuple[4];
this.totalElements = tuple[0].totalElements;
this.newTicketTemplate = tuple[5];
this.tickets = [];
const start = this.offset * this.limit;
const end = start + this.limit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="editor">
<textarea id="command-text" placeholder="{{initialContent || ''}}"></textarea>
<textarea id="command-text" placeholder="{{initialContent || ''}}">{{realInitialContent}}</textarea>
</div><div (window:keydown)="scrollToCommentInput($event)" style="display:none"></div>
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class CommandTextviewComponent implements AfterViewInit, OnChanges, OnDes
@Input() resetEventObservable: Observable<string> | null = null;
@Input() noCommands: boolean = false;
@Input() hasShortcut: boolean = false;
@Input() realInitialContent: string = '';

@Output() readonly contentChange = new EventEmitter<CommandTextviewSaveEvent>();
@Output() readonly save = new EventEmitter<void>();
Expand Down Expand Up @@ -104,12 +105,16 @@ export class CommandTextviewComponent implements AfterViewInit, OnChanges, OnDes
}, 100);
}
});
this.instance.setValue(this.realInitialContent || '');
}

ngOnChanges(changes: SimpleChanges): void {
if ('resetEventObservable' in changes) {
this.resubscribeResetEvent();
}
if (this.instance && 'realInitialContent' in changes) {
this.instance.setText(this.realInitialContent);
}
}

ngOnDestroy(): void {
Expand Down

0 comments on commit 3915887

Please sign in to comment.