@thecodeblogs/blog 0.15.5 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/thecodeblogs-blog.mjs +2018 -0
- package/fesm2022/thecodeblogs-blog.mjs.map +1 -0
- package/lib/components/entry-creator/entry-creator.component.d.ts +1 -1
- package/lib/components/entry-renderer/entry-renderer.component.d.ts +1 -1
- package/lib/components/entry-renderer-wrapper/entry-renderer-wrapper.component.d.ts +1 -1
- package/lib/components/entry-selector-dialog/entry-selector-dialog.component.d.ts +1 -1
- package/lib/components/entry-summary/entry-summary.component.d.ts +1 -1
- package/lib/components/json-renderer/json-renderer.component.d.ts +1 -1
- package/lib/components/landing-page/landing-page.component.d.ts +1 -1
- package/lib/components/main/main.component.d.ts +1 -1
- package/lib/components/media-upload-modal/media-upload-modal.component.d.ts +4 -2
- package/lib/components/outline-view/outline-view.component.d.ts +1 -1
- package/lib/components/schedule-publish-dialog/schedule-publish-dialog.component.d.ts +1 -1
- package/lib/components/side-navigation/side-navigation.component.d.ts +1 -1
- package/lib/components/static-html/static-html.component.d.ts +1 -1
- package/lib/core.module.d.ts +38 -39
- package/lib/pipes/LinkyPipe.d.ts +1 -1
- package/lib/pipes/TimeAgoPipe.d.ts +1 -1
- package/package.json +22 -26
- package/esm2020/lib/components/entry-creator/entry-creator.component.mjs +0 -341
- package/esm2020/lib/components/entry-renderer/entry-renderer.component.mjs +0 -108
- package/esm2020/lib/components/entry-renderer-wrapper/entry-renderer-wrapper.component.mjs +0 -75
- package/esm2020/lib/components/entry-selector-dialog/entry-selector-dialog-data.mjs +0 -3
- package/esm2020/lib/components/entry-selector-dialog/entry-selector-dialog.component.mjs +0 -54
- package/esm2020/lib/components/entry-summary/entry-summary.component.mjs +0 -28
- package/esm2020/lib/components/json-renderer/json-renderer.component.mjs +0 -26
- package/esm2020/lib/components/landing-page/landing-page.component.mjs +0 -35
- package/esm2020/lib/components/main/main.component.mjs +0 -56
- package/esm2020/lib/components/media-upload-modal/media-upload-modal.component.mjs +0 -160
- package/esm2020/lib/components/outline-view/outline-view.component.mjs +0 -38
- package/esm2020/lib/components/schedule-publish-dialog/schedule-publish-dialog-data.mjs +0 -3
- package/esm2020/lib/components/schedule-publish-dialog/schedule-publish-dialog.component.mjs +0 -33
- package/esm2020/lib/components/side-navigation/side-navigation.component.mjs +0 -230
- package/esm2020/lib/components/static-html/static-html.component.mjs +0 -28
- package/esm2020/lib/core.module.mjs +0 -213
- package/esm2020/lib/data/base.mjs +0 -7
- package/esm2020/lib/data/content-type.mjs +0 -10
- package/esm2020/lib/data/content.mjs +0 -5
- package/esm2020/lib/data/core-event-type.enum.mjs +0 -7
- package/esm2020/lib/data/core-event.mjs +0 -7
- package/esm2020/lib/data/entry.mjs +0 -79
- package/esm2020/lib/data/guid.mjs +0 -12
- package/esm2020/lib/data/identity.mjs +0 -2
- package/esm2020/lib/data/list-response.mjs +0 -3
- package/esm2020/lib/data/section.mjs +0 -11
- package/esm2020/lib/data/tag.mjs +0 -7
- package/esm2020/lib/data/visitor-profile.mjs +0 -3
- package/esm2020/lib/pipes/LinkyPipe.mjs +0 -15
- package/esm2020/lib/pipes/TimeAgoPipe.mjs +0 -100
- package/esm2020/lib/routing/routes.mjs +0 -25
- package/esm2020/lib/services/analytics/interaction.service.mjs +0 -20
- package/esm2020/lib/services/analytics/view.service.mjs +0 -20
- package/esm2020/lib/services/comment.service.mjs +0 -28
- package/esm2020/lib/services/django-rest-framework-endpoint.service.mjs +0 -50
- package/esm2020/lib/services/entry.service.mjs +0 -106
- package/esm2020/lib/services/identity.service.mjs +0 -20
- package/esm2020/lib/services/interaction.mjs +0 -3
- package/esm2020/lib/services/prism.service.mjs +0 -39
- package/esm2020/lib/services/static-html.service.mjs +0 -22
- package/esm2020/lib/services/tag.service.mjs +0 -33
- package/esm2020/lib/services/upload.mjs +0 -3
- package/esm2020/lib/services/upload.service.mjs +0 -22
- package/esm2020/lib/services/view.mjs +0 -3
- package/esm2020/lib/services/visitor-profile.service.mjs +0 -35
- package/esm2020/public-api.mjs +0 -45
- package/esm2020/thecodeblogs-blog.mjs +0 -5
- package/fesm2015/thecodeblogs-blog.mjs +0 -1942
- package/fesm2015/thecodeblogs-blog.mjs.map +0 -1
- package/fesm2020/thecodeblogs-blog.mjs +0 -1936
- package/fesm2020/thecodeblogs-blog.mjs.map +0 -1
|
@@ -1,1936 +0,0 @@
|
|
|
1
|
-
import { orderBy, map as map$1, filter } from 'lodash';
|
|
2
|
-
import * as i0 from '@angular/core';
|
|
3
|
-
import { Injectable, EventEmitter, PLATFORM_ID, Inject, SecurityContext, Component, Input, HostListener, ViewChild, Pipe, NgModule } from '@angular/core';
|
|
4
|
-
import * as i1 from '@angular/common/http';
|
|
5
|
-
import { HttpParams } from '@angular/common/http';
|
|
6
|
-
import { map, debounceTime, startWith } from 'rxjs/operators';
|
|
7
|
-
import { Subject, Subscription } from 'rxjs';
|
|
8
|
-
import * as i2$1 from '@angular/common';
|
|
9
|
-
import { isPlatformBrowser, CommonModule } from '@angular/common';
|
|
10
|
-
import 'clipboard';
|
|
11
|
-
import 'prismjs';
|
|
12
|
-
import 'prismjs/plugins/toolbar/prism-toolbar';
|
|
13
|
-
import 'prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard';
|
|
14
|
-
import 'prismjs/components/prism-css';
|
|
15
|
-
import 'prismjs/components/prism-javascript';
|
|
16
|
-
import 'prismjs/components/prism-java';
|
|
17
|
-
import 'prismjs/components/prism-markup';
|
|
18
|
-
import 'prismjs/components/prism-typescript';
|
|
19
|
-
import 'prismjs/components/prism-sass';
|
|
20
|
-
import 'prismjs/components/prism-scss';
|
|
21
|
-
import * as i2 from 'ngx-device-detector';
|
|
22
|
-
import * as i1$1 from '@angular/platform-browser';
|
|
23
|
-
import { ENTER, COMMA, TAB } from '@angular/cdk/keycodes';
|
|
24
|
-
import * as i1$2 from '@angular/material/dialog';
|
|
25
|
-
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
26
|
-
import * as i4 from '@angular/material/button';
|
|
27
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
28
|
-
import * as i5 from '@angular/material/divider';
|
|
29
|
-
import { MatDividerModule } from '@angular/material/divider';
|
|
30
|
-
import * as i6 from '@angular/material/table';
|
|
31
|
-
import { MatTableModule } from '@angular/material/table';
|
|
32
|
-
import * as i7 from 'ng2-file-upload';
|
|
33
|
-
import { FileUploader, FileUploadModule } from 'ng2-file-upload';
|
|
34
|
-
import * as i1$3 from '@fortawesome/angular-fontawesome';
|
|
35
|
-
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
|
36
|
-
import * as i6$1 from '@angular/forms';
|
|
37
|
-
import { UntypedFormControl, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
38
|
-
import * as i8 from '@angular/material/card';
|
|
39
|
-
import { MatCardModule } from '@angular/material/card';
|
|
40
|
-
import * as i9 from '@angular/material/input';
|
|
41
|
-
import { MatInputModule } from '@angular/material/input';
|
|
42
|
-
import * as i10 from '@angular/material/form-field';
|
|
43
|
-
import * as i11 from '@angular/cdk/text-field';
|
|
44
|
-
import * as i12 from '@angular/material/radio';
|
|
45
|
-
import { MatRadioModule } from '@angular/material/radio';
|
|
46
|
-
import * as i13 from '@angular/material/autocomplete';
|
|
47
|
-
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
48
|
-
import * as i14 from '@angular/material/core';
|
|
49
|
-
import { MatNativeDateModule } from '@angular/material/core';
|
|
50
|
-
import * as i15 from '@angular/material/chips';
|
|
51
|
-
import { MatChipsModule } from '@angular/material/chips';
|
|
52
|
-
import * as i16 from '@angular/material/icon';
|
|
53
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
54
|
-
import * as i17 from '@angular/material/datepicker';
|
|
55
|
-
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
56
|
-
import * as i6$2 from 'ngx-material-timepicker';
|
|
57
|
-
import { NgxMaterialTimepickerModule } from 'ngx-material-timepicker';
|
|
58
|
-
import * as i1$4 from '@angular/router';
|
|
59
|
-
import { NavigationEnd, RouterModule } from '@angular/router';
|
|
60
|
-
import * as i3 from '@angular/cdk/drag-drop';
|
|
61
|
-
import { DragDropModule } from '@angular/cdk/drag-drop';
|
|
62
|
-
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
63
|
-
import * as i8$1 from '@angular/material/list';
|
|
64
|
-
import { MatListModule } from '@angular/material/list';
|
|
65
|
-
import * as i9$1 from '@angular/material/progress-spinner';
|
|
66
|
-
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
67
|
-
import * as i3$1 from '@angular/material/sidenav';
|
|
68
|
-
import { MatSidenavModule } from '@angular/material/sidenav';
|
|
69
|
-
import Autolinker from 'autolinker';
|
|
70
|
-
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
71
|
-
import { faSpinner } from '@fortawesome/free-solid-svg-icons';
|
|
72
|
-
|
|
73
|
-
class Guid {
|
|
74
|
-
newGuid() {
|
|
75
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
76
|
-
// tslint:disable-next-line:no-bitwise
|
|
77
|
-
const r = Math.random() * 16 | 0,
|
|
78
|
-
// tslint:disable-next-line:triple-equals no-bitwise
|
|
79
|
-
v = c == 'x' ? r : (r & 0x3 | 0x8);
|
|
80
|
-
return v.toString(16);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
class Base {
|
|
86
|
-
constructor() {
|
|
87
|
-
this.id = new Guid().newGuid();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
var ContentType;
|
|
92
|
-
(function (ContentType) {
|
|
93
|
-
ContentType["TEXT"] = "text";
|
|
94
|
-
ContentType["URL"] = "url";
|
|
95
|
-
ContentType["CODE"] = "code";
|
|
96
|
-
ContentType["IMAGE"] = "image";
|
|
97
|
-
ContentType["MEDIA"] = "media";
|
|
98
|
-
ContentType["HTML"] = "html";
|
|
99
|
-
})(ContentType || (ContentType = {}));
|
|
100
|
-
|
|
101
|
-
class Content extends Base {
|
|
102
|
-
}
|
|
103
|
-
Content.KEY_MIMETYPE = 'mimeType';
|
|
104
|
-
|
|
105
|
-
class Entry extends Base {
|
|
106
|
-
constructor(init) {
|
|
107
|
-
super();
|
|
108
|
-
this.should_publish_in_future = false;
|
|
109
|
-
Object.assign(this, init);
|
|
110
|
-
if (!this.create_date) {
|
|
111
|
-
this.create_date = new Date();
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
this.create_date = new Date(this.create_date);
|
|
115
|
-
}
|
|
116
|
-
if (!this.edit_date) {
|
|
117
|
-
this.edit_date = new Date();
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
this.edit_date = new Date(this.edit_date);
|
|
121
|
-
}
|
|
122
|
-
if (this.publish_date) {
|
|
123
|
-
this.publish_date = new Date(this.publish_date);
|
|
124
|
-
}
|
|
125
|
-
if (this.future_publish_date) {
|
|
126
|
-
this.future_publish_date = new Date(this.future_publish_date);
|
|
127
|
-
}
|
|
128
|
-
if (!this.version) {
|
|
129
|
-
this.version = 1;
|
|
130
|
-
}
|
|
131
|
-
if (!this.tags) {
|
|
132
|
-
this.tags = [];
|
|
133
|
-
}
|
|
134
|
-
if (this.views) {
|
|
135
|
-
if (this.views < 10) {
|
|
136
|
-
this._friendly_views = 'Less than ten';
|
|
137
|
-
}
|
|
138
|
-
else if (10 < this.views && this.views < 100) {
|
|
139
|
-
this._friendly_views = 'Around one hundred';
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
this._friendly_views = this.views.toString();
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
if (!this.sections) {
|
|
146
|
-
this.sections = [];
|
|
147
|
-
}
|
|
148
|
-
// For entries that existed before this variable was introduced, the server will return undefined. If this
|
|
149
|
-
// stays undefined, it will violate the null constraints on the DB, so this code checks for both null
|
|
150
|
-
// and undefined and then populates the value accordingly
|
|
151
|
-
if (typeof (this.should_publish_in_future) === 'undefined' || this.should_publish_in_future === null) {
|
|
152
|
-
this.should_publish_in_future = false;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
sort() {
|
|
156
|
-
this.sections = orderBy(this.sections, ({ order }) => Number(order), ['asc']);
|
|
157
|
-
for (let i = 0; i < this.sections.length; i++) {
|
|
158
|
-
this.sections[i].order = i * 10;
|
|
159
|
-
}
|
|
160
|
-
for (const section of this.sections) {
|
|
161
|
-
section.contents = orderBy(section.contents, ({ order }) => Number(order), ['asc']);
|
|
162
|
-
for (let i = 0; i < section.contents.length; i++) {
|
|
163
|
-
section.contents[i].order = i * 10;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
showEditInformation() {
|
|
168
|
-
// @ts-ignore
|
|
169
|
-
const difference = Math.floor((this.create_date - this.edit_date) / (1000 * 60 * 60 * 24));
|
|
170
|
-
return (difference > 1 || difference < -1);
|
|
171
|
-
}
|
|
172
|
-
getProp(prop) {
|
|
173
|
-
if (this.__server_generated_properties) {
|
|
174
|
-
return this.__server_generated_properties[prop];
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
return '';
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
class ListResponse {
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
class Section extends Base {
|
|
186
|
-
constructor() {
|
|
187
|
-
super();
|
|
188
|
-
if (!this.order) {
|
|
189
|
-
this.order = -1;
|
|
190
|
-
}
|
|
191
|
-
this.contents = [];
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
class CoreEvent {
|
|
196
|
-
constructor(data, type) {
|
|
197
|
-
this.data = data;
|
|
198
|
-
this.type = type;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
var CoreEventType;
|
|
203
|
-
(function (CoreEventType) {
|
|
204
|
-
CoreEventType["UPDATE"] = "update";
|
|
205
|
-
CoreEventType["CREATE"] = "create";
|
|
206
|
-
CoreEventType["DELETE"] = "delete";
|
|
207
|
-
})(CoreEventType || (CoreEventType = {}));
|
|
208
|
-
|
|
209
|
-
class VisitorProfile {
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
class CommentService {
|
|
213
|
-
constructor(http) {
|
|
214
|
-
this.http = http;
|
|
215
|
-
this.endpoint = '/blog_api/comments/';
|
|
216
|
-
this.adminEndpoint = '/blog_api/admin/comments/';
|
|
217
|
-
}
|
|
218
|
-
getComments(entry) {
|
|
219
|
-
return this.http.get(this.endpoint, { params: { entry } });
|
|
220
|
-
}
|
|
221
|
-
postComment(comment) {
|
|
222
|
-
return this.http.post(this.endpoint, comment, { params: { entry: comment.entry } });
|
|
223
|
-
}
|
|
224
|
-
patchComment(comment) {
|
|
225
|
-
return this.http.patch(this.adminEndpoint + '/' + comment.id + '/', comment);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
CommentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: CommentService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
229
|
-
CommentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: CommentService, providedIn: 'root' });
|
|
230
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: CommentService, decorators: [{
|
|
231
|
-
type: Injectable,
|
|
232
|
-
args: [{
|
|
233
|
-
providedIn: 'root'
|
|
234
|
-
}]
|
|
235
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
|
|
236
|
-
|
|
237
|
-
class DjangoRestFrameworkEndpointService {
|
|
238
|
-
constructor(http) {
|
|
239
|
-
this.http = http;
|
|
240
|
-
this.events = new EventEmitter();
|
|
241
|
-
this.endpoint = '';
|
|
242
|
-
}
|
|
243
|
-
triggerCoreEvent(obj, type) {
|
|
244
|
-
this.events.next(new CoreEvent(obj, type));
|
|
245
|
-
return obj;
|
|
246
|
-
}
|
|
247
|
-
handleResponse(obj) {
|
|
248
|
-
return obj;
|
|
249
|
-
}
|
|
250
|
-
handleListResponse(obj) {
|
|
251
|
-
return obj;
|
|
252
|
-
}
|
|
253
|
-
get() {
|
|
254
|
-
return this.http.get(this.endpoint).pipe(map(this.handleListResponse.bind(this)));
|
|
255
|
-
}
|
|
256
|
-
getById(id) {
|
|
257
|
-
return this.http.get(this.endpoint + id + '/').pipe(map(this.handleResponse.bind(this)));
|
|
258
|
-
}
|
|
259
|
-
create(entity) {
|
|
260
|
-
return this.http.post(this.endpoint + '/', entity).pipe(map((val) => this.triggerCoreEvent(val, CoreEventType.CREATE)), map(this.handleResponse.bind(this)));
|
|
261
|
-
}
|
|
262
|
-
delete(entity) {
|
|
263
|
-
return this.http.delete(this.endpoint + entity.id + '/').pipe(map((val) => this.triggerCoreEvent(val, CoreEventType.DELETE)), map(this.handleResponse.bind(this)));
|
|
264
|
-
}
|
|
265
|
-
update(entity) {
|
|
266
|
-
return this.http.patch(this.endpoint + entity.id + '/', entity).pipe(map((val) => this.triggerCoreEvent(val, CoreEventType.UPDATE)), map(this.handleResponse.bind(this)));
|
|
267
|
-
}
|
|
268
|
-
getListByUrl(url) {
|
|
269
|
-
return this.http.get(url).pipe(map(this.handleListResponse.bind(this)));
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
DjangoRestFrameworkEndpointService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: DjangoRestFrameworkEndpointService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
273
|
-
DjangoRestFrameworkEndpointService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: DjangoRestFrameworkEndpointService, providedIn: 'root' });
|
|
274
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: DjangoRestFrameworkEndpointService, decorators: [{
|
|
275
|
-
type: Injectable,
|
|
276
|
-
args: [{
|
|
277
|
-
providedIn: 'root'
|
|
278
|
-
}]
|
|
279
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
|
|
280
|
-
|
|
281
|
-
class EntryService extends DjangoRestFrameworkEndpointService {
|
|
282
|
-
handleResponse(obj) {
|
|
283
|
-
return new Entry(obj);
|
|
284
|
-
}
|
|
285
|
-
handleListResponse(obj) {
|
|
286
|
-
const response = obj;
|
|
287
|
-
const results = [];
|
|
288
|
-
for (const result of response.results) {
|
|
289
|
-
results.push(new Entry(result));
|
|
290
|
-
}
|
|
291
|
-
response.results = results;
|
|
292
|
-
return response;
|
|
293
|
-
}
|
|
294
|
-
constructor(http) {
|
|
295
|
-
super(http);
|
|
296
|
-
this.http = http;
|
|
297
|
-
this.endpoint = '/blog_api/entries/';
|
|
298
|
-
this.adminEndpoint = '/blog_api/admin/entries/';
|
|
299
|
-
this.currentlyEditedEntry = new Subject();
|
|
300
|
-
this.sub = this.currentlyEditedEntry.pipe(debounceTime(3000)).subscribe((e) => {
|
|
301
|
-
e.edit_date = new Date();
|
|
302
|
-
const params = new HttpParams().set('published', JSON.stringify(false)).set('defunct', JSON.stringify(false));
|
|
303
|
-
this.http.patch(this.adminEndpoint + e.id + '/', e, { params }).pipe(map(this.handleResponse.bind(this))).subscribe((response) => {
|
|
304
|
-
this.triggerCoreEvent(response, CoreEventType.UPDATE);
|
|
305
|
-
console.log('Synced ' + e.id + '...');
|
|
306
|
-
}, (err) => {
|
|
307
|
-
console.log('Error encountered syncing ' + e.id + ', trying to create...');
|
|
308
|
-
this.http.post(this.adminEndpoint, e).pipe(map(this.handleResponse)).subscribe((response) => {
|
|
309
|
-
this.triggerCoreEvent(response, CoreEventType.CREATE);
|
|
310
|
-
console.log('Created ' + e.id + '...');
|
|
311
|
-
}, (createErr) => {
|
|
312
|
-
console.log('Error creating ' + e.id);
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
get() {
|
|
318
|
-
return this.http.get(this.endpoint).pipe(map(this.handleListResponse.bind(this)));
|
|
319
|
-
}
|
|
320
|
-
search(searchTerm) {
|
|
321
|
-
return this.http.get(this.endpoint + "?search=" + searchTerm).pipe(map(this.handleListResponse.bind(this)));
|
|
322
|
-
}
|
|
323
|
-
getUnpublishedEntries() {
|
|
324
|
-
const params = new HttpParams().set('published', JSON.stringify(false)).set('defunct', JSON.stringify(false));
|
|
325
|
-
return this.http.get(this.adminEndpoint, { params });
|
|
326
|
-
}
|
|
327
|
-
getBySlug(slug) {
|
|
328
|
-
return this.http.get(this.endpoint + slug + '/by_slug/').pipe(map(this.handleResponse.bind(this)));
|
|
329
|
-
}
|
|
330
|
-
getUnpublishedById(id) {
|
|
331
|
-
const params = new HttpParams().set('published', JSON.stringify(false)).set('defunct', JSON.stringify(false));
|
|
332
|
-
return this.http.get(this.adminEndpoint + id, { params }).pipe(map(this.handleResponse.bind(this)));
|
|
333
|
-
}
|
|
334
|
-
updateUnpublishedEntry(entry) {
|
|
335
|
-
const params = new HttpParams().set('published', JSON.stringify(false)).set('defunct', JSON.stringify(false));
|
|
336
|
-
return this.http.patch(this.adminEndpoint + entry.id + '/', entry, { params }).pipe(map((val) => this.triggerCoreEvent(val, CoreEventType.UPDATE)), map(this.handleResponse.bind(this)));
|
|
337
|
-
}
|
|
338
|
-
slugify(s) {
|
|
339
|
-
const charMap = JSON.parse('{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","¢":"cent","£":"pound","¤":"currency","¥":"yen","©":"(c)","ª":"a","®":"(r)","º":"o","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"DJ","đ":"dj","Ē":"E","ē":"e","Ė":"E","ė":"e","Ę":"e","ę":"e","Ě":"E","ě":"e","Ğ":"G","ğ":"g","Ģ":"G","ģ":"g","Ĩ":"I","ĩ":"i","Ī":"i","ī":"i","Į":"I","į":"i","İ":"I","ı":"i","Ķ":"k","ķ":"k","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ł":"L","ł":"l","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","Ō":"O","ō":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","Ŕ":"R","ŕ":"r","Ř":"R","ř":"r","Ś":"S","ś":"s","Ş":"S","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","Ť":"T","ť":"t","Ũ":"U","ũ":"u","Ū":"u","ū":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","Ə":"E","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Lj":"LJ","lj":"lj","Nj":"NJ","nj":"nj","Ș":"S","ș":"s","Ț":"T","ț":"t","ə":"e","˚":"o","Ά":"A","Έ":"E","Ή":"H","Ί":"I","Ό":"O","Ύ":"Y","Ώ":"W","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"H","Θ":"8","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"3","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ϊ":"I","Ϋ":"Y","ά":"a","έ":"e","ή":"h","ί":"i","ΰ":"y","α":"a","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"h","θ":"8","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"3","ο":"o","π":"p","ρ":"r","ς":"s","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"w","ϊ":"i","ϋ":"y","ό":"o","ύ":"y","ώ":"w","Ё":"Yo","Ђ":"DJ","Є":"Ye","І":"I","Ї":"Yi","Ј":"J","Љ":"LJ","Њ":"NJ","Ћ":"C","Џ":"DZ","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"U","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"u","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","ё":"yo","ђ":"dj","є":"ye","і":"i","ї":"yi","ј":"j","љ":"lj","њ":"nj","ћ":"c","ѝ":"u","џ":"dz","Ґ":"G","ґ":"g","Ғ":"GH","ғ":"gh","Қ":"KH","қ":"kh","Ң":"NG","ң":"ng","Ү":"UE","ү":"ue","Ұ":"U","ұ":"u","Һ":"H","һ":"h","Ә":"AE","ә":"ae","Ө":"OE","ө":"oe","Ա":"A","Բ":"B","Գ":"G","Դ":"D","Ե":"E","Զ":"Z","Է":"E\'","Ը":"Y\'","Թ":"T\'","Ժ":"JH","Ի":"I","Լ":"L","Խ":"X","Ծ":"C\'","Կ":"K","Հ":"H","Ձ":"D\'","Ղ":"GH","Ճ":"TW","Մ":"M","Յ":"Y","Ն":"N","Շ":"SH","Չ":"CH","Պ":"P","Ջ":"J","Ռ":"R\'","Ս":"S","Վ":"V","Տ":"T","Ր":"R","Ց":"C","Փ":"P\'","Ք":"Q\'","Օ":"O\'\'","Ֆ":"F","և":"EV","ء":"a","آ":"aa","أ":"a","ؤ":"u","إ":"i","ئ":"e","ا":"a","ب":"b","ة":"h","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ى":"a","ي":"y","ً":"an","ٌ":"on","ٍ":"en","َ":"a","ُ":"u","ِ":"e","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","پ":"p","چ":"ch","ژ":"zh","ک":"k","گ":"g","ی":"y","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","฿":"baht","ა":"a","ბ":"b","გ":"g","დ":"d","ე":"e","ვ":"v","ზ":"z","თ":"t","ი":"i","კ":"k","ლ":"l","მ":"m","ნ":"n","ო":"o","პ":"p","ჟ":"zh","რ":"r","ს":"s","ტ":"t","უ":"u","ფ":"f","ქ":"k","ღ":"gh","ყ":"q","შ":"sh","ჩ":"ch","ც":"ts","ძ":"dz","წ":"ts","ჭ":"ch","ხ":"kh","ჯ":"j","ჰ":"h","Ṣ":"S","ṣ":"s","Ẁ":"W","ẁ":"w","Ẃ":"W","ẃ":"w","Ẅ":"W","ẅ":"w","ẞ":"SS","Ạ":"A","ạ":"a","Ả":"A","ả":"a","Ấ":"A","ấ":"a","Ầ":"A","ầ":"a","Ẩ":"A","ẩ":"a","Ẫ":"A","ẫ":"a","Ậ":"A","ậ":"a","Ắ":"A","ắ":"a","Ằ":"A","ằ":"a","Ẳ":"A","ẳ":"a","Ẵ":"A","ẵ":"a","Ặ":"A","ặ":"a","Ẹ":"E","ẹ":"e","Ẻ":"E","ẻ":"e","Ẽ":"E","ẽ":"e","Ế":"E","ế":"e","Ề":"E","ề":"e","Ể":"E","ể":"e","Ễ":"E","ễ":"e","Ệ":"E","ệ":"e","Ỉ":"I","ỉ":"i","Ị":"I","ị":"i","Ọ":"O","ọ":"o","Ỏ":"O","ỏ":"o","Ố":"O","ố":"o","Ồ":"O","ồ":"o","Ổ":"O","ổ":"o","Ỗ":"O","ỗ":"o","Ộ":"O","ộ":"o","Ớ":"O","ớ":"o","Ờ":"O","ờ":"o","Ở":"O","ở":"o","Ỡ":"O","ỡ":"o","Ợ":"O","ợ":"o","Ụ":"U","ụ":"u","Ủ":"U","ủ":"u","Ứ":"U","ứ":"u","Ừ":"U","ừ":"u","Ử":"U","ử":"u","Ữ":"U","ữ":"u","Ự":"U","ự":"u","Ỳ":"Y","ỳ":"y","Ỵ":"Y","ỵ":"y","Ỷ":"Y","ỷ":"y","Ỹ":"Y","ỹ":"y","–":"-","‘":"\'","’":"\'","“":"\\\"","”":"\\\"","„":"\\\"","†":"+","•":"*","…":"...","₠":"ecu","₢":"cruzeiro","₣":"french franc","₤":"lira","₥":"mill","₦":"naira","₧":"peseta","₨":"rupee","₩":"won","₪":"new shequel","₫":"dong","€":"euro","₭":"kip","₮":"tugrik","₯":"drachma","₰":"penny","₱":"peso","₲":"guarani","₳":"austral","₴":"hryvnia","₵":"cedi","₸":"kazakhstani tenge","₹":"indian rupee","₺":"turkish lira","₽":"russian ruble","₿":"bitcoin","℠":"sm","™":"tm","∂":"d","∆":"delta","∑":"sum","∞":"infinity","♥":"love","元":"yuan","円":"yen","﷼":"rial","ﻵ":"laa","ﻷ":"laa","ﻹ":"lai","ﻻ":"la"}');
|
|
340
|
-
const locales = JSON.parse('{"bg":{"Й":"Y","Ц":"Ts","Щ":"Sht","Ъ":"A","Ь":"Y","й":"y","ц":"ts","щ":"sht","ъ":"a","ь":"y"},"de":{"Ä":"AE","ä":"ae","Ö":"OE","ö":"oe","Ü":"UE","ü":"ue","ß":"ss","%":"prozent","&":"und","|":"oder","∑":"summe","∞":"unendlich","♥":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","¢":"centavos","£":"libras","¤":"moneda","₣":"francos","∑":"suma","∞":"infinito","♥":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","¢":"centime","£":"livre","¤":"devise","₣":"franc","∑":"somme","∞":"infini","♥":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","¢":"centavo","∑":"soma","£":"libra","∞":"infinito","♥":"amor"},"uk":{"И":"Y","и":"y","Й":"Y","й":"y","Ц":"Ts","ц":"ts","Х":"Kh","х":"kh","Щ":"Shch","щ":"shch","Г":"H","г":"h"},"vi":{"Đ":"D","đ":"d"},"da":{"Ø":"OE","ø":"oe","Å":"AA","å":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"større end"},"nb":{"&":"og","Å":"AA","Æ":"AE","Ø":"OE","å":"aa","æ":"ae","ø":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","Å":"AA","Ä":"AE","Ö":"OE","å":"aa","ä":"ae","ö":"oe"}}');
|
|
341
|
-
if (typeof s !== 'string') {
|
|
342
|
-
throw new Error('slugify: string argument expected');
|
|
343
|
-
}
|
|
344
|
-
const replacement = '-';
|
|
345
|
-
const trim = true;
|
|
346
|
-
const locale = 'en';
|
|
347
|
-
let slug = s.normalize().split('')
|
|
348
|
-
// replace characters based on charMap
|
|
349
|
-
.reduce((result, ch) => {
|
|
350
|
-
let appendChar = locale[ch] || charMap[ch] || ch;
|
|
351
|
-
if (appendChar === replacement) {
|
|
352
|
-
appendChar = ' ';
|
|
353
|
-
}
|
|
354
|
-
return result + appendChar
|
|
355
|
-
// remove not allowed characters
|
|
356
|
-
.replace(/[^\w\s$*_+~.()'"!\-:@]+/g, '');
|
|
357
|
-
}, '');
|
|
358
|
-
slug = slug.trim();
|
|
359
|
-
// Replace spaces with replacement character, treating multiple consecutive
|
|
360
|
-
// spaces as a single space.
|
|
361
|
-
slug = slug.replace(/\s+/g, replacement);
|
|
362
|
-
slug = slug.toLowerCase();
|
|
363
|
-
return slug;
|
|
364
|
-
}
|
|
365
|
-
delete(entity) {
|
|
366
|
-
return this.http.delete(this.adminEndpoint + entity.id + '/').pipe(map((val) => this.triggerCoreEvent(val, CoreEventType.DELETE)), map(this.handleResponse.bind(this)));
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
EntryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: EntryService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
370
|
-
EntryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: EntryService, providedIn: 'root' });
|
|
371
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: EntryService, decorators: [{
|
|
372
|
-
type: Injectable,
|
|
373
|
-
args: [{
|
|
374
|
-
providedIn: 'root'
|
|
375
|
-
}]
|
|
376
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
|
|
377
|
-
|
|
378
|
-
class IdentityService {
|
|
379
|
-
constructor(http) {
|
|
380
|
-
this.http = http;
|
|
381
|
-
}
|
|
382
|
-
getMe() {
|
|
383
|
-
throw new Error('You must provide an implementation for this');
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
IdentityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: IdentityService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
387
|
-
IdentityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: IdentityService, providedIn: 'root' });
|
|
388
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: IdentityService, decorators: [{
|
|
389
|
-
type: Injectable,
|
|
390
|
-
args: [{
|
|
391
|
-
providedIn: 'root'
|
|
392
|
-
}]
|
|
393
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
|
|
394
|
-
|
|
395
|
-
class PrismService {
|
|
396
|
-
constructor(platformId) {
|
|
397
|
-
this.platformId = platformId;
|
|
398
|
-
if (Prism) {
|
|
399
|
-
Prism.manual = true;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
highlightAll() {
|
|
403
|
-
if (isPlatformBrowser(this.platformId)) {
|
|
404
|
-
Prism.highlightAll();
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
PrismService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: PrismService, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
409
|
-
PrismService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: PrismService, providedIn: 'root' });
|
|
410
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: PrismService, decorators: [{
|
|
411
|
-
type: Injectable,
|
|
412
|
-
args: [{
|
|
413
|
-
providedIn: 'root'
|
|
414
|
-
}]
|
|
415
|
-
}], ctorParameters: function () { return [{ type: Object, decorators: [{
|
|
416
|
-
type: Inject,
|
|
417
|
-
args: [PLATFORM_ID]
|
|
418
|
-
}] }]; } });
|
|
419
|
-
|
|
420
|
-
class UploadService {
|
|
421
|
-
constructor(http) {
|
|
422
|
-
this.http = http;
|
|
423
|
-
}
|
|
424
|
-
get(id) {
|
|
425
|
-
return this.http.get(UploadService.status_endpoint.replace('{pk}', id) + '/');
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
UploadService.upload_endpoint = '/file_api/uploads/create_image/';
|
|
429
|
-
UploadService.status_endpoint = '/file_api/uploads/{pk}/status';
|
|
430
|
-
UploadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: UploadService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
431
|
-
UploadService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: UploadService, providedIn: 'root' });
|
|
432
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: UploadService, decorators: [{
|
|
433
|
-
type: Injectable,
|
|
434
|
-
args: [{
|
|
435
|
-
providedIn: 'root'
|
|
436
|
-
}]
|
|
437
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
|
|
438
|
-
|
|
439
|
-
class Upload {
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
class ViewService extends DjangoRestFrameworkEndpointService {
|
|
443
|
-
constructor(http) {
|
|
444
|
-
super(http);
|
|
445
|
-
this.http = http;
|
|
446
|
-
this.endpoint = '/blog_api/views/';
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
ViewService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ViewService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
450
|
-
ViewService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ViewService, providedIn: 'root' });
|
|
451
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: ViewService, decorators: [{
|
|
452
|
-
type: Injectable,
|
|
453
|
-
args: [{
|
|
454
|
-
providedIn: 'root'
|
|
455
|
-
}]
|
|
456
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
|
|
457
|
-
|
|
458
|
-
class InteractionService extends DjangoRestFrameworkEndpointService {
|
|
459
|
-
constructor(http) {
|
|
460
|
-
super(http);
|
|
461
|
-
this.http = http;
|
|
462
|
-
this.endpoint = '/blog_api/interactions/';
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
InteractionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: InteractionService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
466
|
-
InteractionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: InteractionService, providedIn: 'root' });
|
|
467
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: InteractionService, decorators: [{
|
|
468
|
-
type: Injectable,
|
|
469
|
-
args: [{
|
|
470
|
-
providedIn: 'root'
|
|
471
|
-
}]
|
|
472
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
|
|
473
|
-
|
|
474
|
-
class View {
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
class Interaction {
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
class VisitorProfileService extends DjangoRestFrameworkEndpointService {
|
|
481
|
-
constructor(http, deviceDetectorService) {
|
|
482
|
-
super(http);
|
|
483
|
-
this.http = http;
|
|
484
|
-
this.deviceDetectorService = deviceDetectorService;
|
|
485
|
-
this.endpoint = '/blog_api/visitor_profiles/';
|
|
486
|
-
}
|
|
487
|
-
getVisitorProfile() {
|
|
488
|
-
const deviceInfo = this.deviceDetectorService.getDeviceInfo();
|
|
489
|
-
const vp = new VisitorProfile();
|
|
490
|
-
vp.telemetry = deviceInfo;
|
|
491
|
-
vp.name = deviceInfo.os;
|
|
492
|
-
vp.family = deviceInfo.browser;
|
|
493
|
-
vp.version = deviceInfo.browser_version;
|
|
494
|
-
vp.device = deviceInfo.device;
|
|
495
|
-
vp.os_version = deviceInfo.os_version;
|
|
496
|
-
vp.language = navigator.language;
|
|
497
|
-
return vp;
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
VisitorProfileService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: VisitorProfileService, deps: [{ token: i1.HttpClient }, { token: i2.DeviceDetectorService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
501
|
-
VisitorProfileService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: VisitorProfileService, providedIn: 'root' });
|
|
502
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: VisitorProfileService, decorators: [{
|
|
503
|
-
type: Injectable,
|
|
504
|
-
args: [{
|
|
505
|
-
providedIn: 'root'
|
|
506
|
-
}]
|
|
507
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.DeviceDetectorService }]; } });
|
|
508
|
-
|
|
509
|
-
class StaticHtmlService {
|
|
510
|
-
constructor(domSanitizer) {
|
|
511
|
-
this.domSanitizer = domSanitizer;
|
|
512
|
-
}
|
|
513
|
-
mapStaticHtml(htmlString, isTrusted) {
|
|
514
|
-
return isTrusted ?
|
|
515
|
-
htmlString :
|
|
516
|
-
this.domSanitizer.sanitize(SecurityContext.HTML, htmlString);
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
StaticHtmlService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: StaticHtmlService, deps: [{ token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
520
|
-
StaticHtmlService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: StaticHtmlService, providedIn: 'root' });
|
|
521
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: StaticHtmlService, decorators: [{
|
|
522
|
-
type: Injectable,
|
|
523
|
-
args: [{
|
|
524
|
-
providedIn: 'root'
|
|
525
|
-
}]
|
|
526
|
-
}], ctorParameters: function () { return [{ type: i1$1.DomSanitizer }]; } });
|
|
527
|
-
|
|
528
|
-
class Tag {
|
|
529
|
-
constructor(obj) {
|
|
530
|
-
this.id = obj.id;
|
|
531
|
-
this.label = obj.label;
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
class TagService extends DjangoRestFrameworkEndpointService {
|
|
536
|
-
handleResponse(obj) {
|
|
537
|
-
return new Tag(obj);
|
|
538
|
-
}
|
|
539
|
-
handleListResponse(obj) {
|
|
540
|
-
const response = obj;
|
|
541
|
-
const results = [];
|
|
542
|
-
for (let i = 0; i < response.results.length; i++) {
|
|
543
|
-
results.push(new Tag(response.results[i]));
|
|
544
|
-
}
|
|
545
|
-
response.results = results;
|
|
546
|
-
return response;
|
|
547
|
-
}
|
|
548
|
-
constructor(http) {
|
|
549
|
-
super(http);
|
|
550
|
-
this.http = http;
|
|
551
|
-
this.endpoint = '/blog_api/tags/';
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
TagService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: TagService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
555
|
-
TagService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: TagService, providedIn: 'root' });
|
|
556
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: TagService, decorators: [{
|
|
557
|
-
type: Injectable,
|
|
558
|
-
args: [{
|
|
559
|
-
providedIn: 'root'
|
|
560
|
-
}]
|
|
561
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
|
|
562
|
-
|
|
563
|
-
class EntrySelectorDialogData {
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
class EntrySelectorDialogComponent {
|
|
567
|
-
constructor(dialogRef, data, entryService) {
|
|
568
|
-
this.dialogRef = dialogRef;
|
|
569
|
-
this.data = data;
|
|
570
|
-
this.entryService = entryService;
|
|
571
|
-
this.columnsToDisplay = ['title', 'create_date', 'actions'];
|
|
572
|
-
}
|
|
573
|
-
ngOnInit() {
|
|
574
|
-
this.entryService.getUnpublishedEntries().subscribe((next) => {
|
|
575
|
-
this.entries = next.results;
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
onNoClick() {
|
|
579
|
-
this.dialogRef.close();
|
|
580
|
-
}
|
|
581
|
-
select(entry) {
|
|
582
|
-
this.entryService.getUnpublishedById(entry.id).subscribe((entry_new) => {
|
|
583
|
-
localStorage.setItem(EntrySelectorDialogComponent.CURRENT_ENTRY, JSON.stringify(entry_new));
|
|
584
|
-
entry_new.sort();
|
|
585
|
-
this.entryService.currentlyEditedEntry.next(entry_new);
|
|
586
|
-
this.dialogRef.close(entry_new.id);
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
delete(entry) {
|
|
590
|
-
this.entryService.delete(entry).subscribe((response) => {
|
|
591
|
-
this.entryService.getUnpublishedEntries().subscribe((next) => {
|
|
592
|
-
this.entries = next.results;
|
|
593
|
-
});
|
|
594
|
-
}, (error) => {
|
|
595
|
-
alert('NOT DELETED: ' + error);
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
EntrySelectorDialogComponent.CURRENT_ENTRY = 'current_entry';
|
|
600
|
-
EntrySelectorDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: EntrySelectorDialogComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: EntryService }], target: i0.ɵɵFactoryTarget.Component });
|
|
601
|
-
EntrySelectorDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: EntrySelectorDialogComponent, selector: "app-entry-selector-dialog", ngImport: i0, template: "<h1 mat-dialog-title>Select an Entry to Edit</h1>\n<!--<mat-radio-group aria-label=\"Select an option\">-->\n<!-- <mat-radio-button class=\"option\" value=\"unpublished\">Unpublished</mat-radio-button>-->\n<!-- <mat-radio-button class=\"option\" value=\"published\">Published</mat-radio-button>-->\n<!--</mat-radio-group>-->\n<mat-divider class=\"option-list-divider\"></mat-divider>\n<div mat-dialog-content>\n\n <table mat-table [dataSource]=entries>\n <ng-container matColumnDef=\"id\">\n <th mat-header-cell *matHeaderCellDef> Id </th>\n <td mat-cell *matCellDef=\"let entry\"> {{entry.id}} </td>\n </ng-container>\n <ng-container matColumnDef=\"title\">\n <th mat-header-cell *matHeaderCellDef> Title </th>\n <td mat-cell *matCellDef=\"let entry\"> {{entry.title}} </td>\n </ng-container>\n <ng-container matColumnDef=\"create_date\">\n <th mat-header-cell *matHeaderCellDef> Created </th>\n <td mat-cell *matCellDef=\"let entry\"> {{entry.create_date}} </td>\n </ng-container>\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef> Actions </th>\n <td mat-cell *matCellDef=\"let entry\">\n <button mat-button color=\"primary\" (click)=\"select(entry)\">Edit</button> | <button mat-button color=\"warn\" (click)=\"delete(entry)\">Delete</button>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"columnsToDisplay\"></tr>\n <tr mat-row *matRowDef=\"let myRowData; columns: columnsToDisplay\"></tr>\n </table>\n <div *ngIf=\"!entries?.length\">There are no unpublished entries</div>\n</div>\n<div mat-dialog-actions>\n <button mat-button (click)=\"onNoClick()\">Cancel</button>\n</div>\n", styles: [".entry-checkbox-container{display:inline-block;width:100%;margin:5px 0}.option-list-divider{margin:10px 0}.option{margin-right:5px}.mat-column-actions{min-width:175px}.mat-column-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:365px}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "directive", type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i6.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i6.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i6.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i6.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i6.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i6.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i6.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i6.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i6.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i6.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }] });
|
|
602
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: EntrySelectorDialogComponent, decorators: [{
|
|
603
|
-
type: Component,
|
|
604
|
-
args: [{ selector: 'app-entry-selector-dialog', template: "<h1 mat-dialog-title>Select an Entry to Edit</h1>\n<!--<mat-radio-group aria-label=\"Select an option\">-->\n<!-- <mat-radio-button class=\"option\" value=\"unpublished\">Unpublished</mat-radio-button>-->\n<!-- <mat-radio-button class=\"option\" value=\"published\">Published</mat-radio-button>-->\n<!--</mat-radio-group>-->\n<mat-divider class=\"option-list-divider\"></mat-divider>\n<div mat-dialog-content>\n\n <table mat-table [dataSource]=entries>\n <ng-container matColumnDef=\"id\">\n <th mat-header-cell *matHeaderCellDef> Id </th>\n <td mat-cell *matCellDef=\"let entry\"> {{entry.id}} </td>\n </ng-container>\n <ng-container matColumnDef=\"title\">\n <th mat-header-cell *matHeaderCellDef> Title </th>\n <td mat-cell *matCellDef=\"let entry\"> {{entry.title}} </td>\n </ng-container>\n <ng-container matColumnDef=\"create_date\">\n <th mat-header-cell *matHeaderCellDef> Created </th>\n <td mat-cell *matCellDef=\"let entry\"> {{entry.create_date}} </td>\n </ng-container>\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef> Actions </th>\n <td mat-cell *matCellDef=\"let entry\">\n <button mat-button color=\"primary\" (click)=\"select(entry)\">Edit</button> | <button mat-button color=\"warn\" (click)=\"delete(entry)\">Delete</button>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"columnsToDisplay\"></tr>\n <tr mat-row *matRowDef=\"let myRowData; columns: columnsToDisplay\"></tr>\n </table>\n <div *ngIf=\"!entries?.length\">There are no unpublished entries</div>\n</div>\n<div mat-dialog-actions>\n <button mat-button (click)=\"onNoClick()\">Cancel</button>\n</div>\n", styles: [".entry-checkbox-container{display:inline-block;width:100%;margin:5px 0}.option-list-divider{margin:10px 0}.option{margin-right:5px}.mat-column-actions{min-width:175px}.mat-column-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:365px}\n"] }]
|
|
605
|
-
}], ctorParameters: function () { return [{ type: i1$2.MatDialogRef }, { type: EntrySelectorDialogData, decorators: [{
|
|
606
|
-
type: Inject,
|
|
607
|
-
args: [MAT_DIALOG_DATA]
|
|
608
|
-
}] }, { type: EntryService }]; } });
|
|
609
|
-
|
|
610
|
-
class MediaUploadModalComponent {
|
|
611
|
-
static getCookie(name) {
|
|
612
|
-
const ca = document.cookie.split(';');
|
|
613
|
-
const caLen = ca.length;
|
|
614
|
-
const cookieName = `${name}=`;
|
|
615
|
-
let c;
|
|
616
|
-
for (let i = 0; i < caLen; i += 1) {
|
|
617
|
-
c = ca[i].replace(/^\s+/g, '');
|
|
618
|
-
if (c.indexOf(cookieName) === 0) {
|
|
619
|
-
return c.substring(cookieName.length, c.length);
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
return '';
|
|
623
|
-
}
|
|
624
|
-
constructor(dialogRef, uploadService) {
|
|
625
|
-
this.dialogRef = dialogRef;
|
|
626
|
-
this.uploadService = uploadService;
|
|
627
|
-
this.allowedMimeTypes = [
|
|
628
|
-
'image/jpeg',
|
|
629
|
-
'image/gif',
|
|
630
|
-
'image/png',
|
|
631
|
-
'image/jpg',
|
|
632
|
-
'video/mp4',
|
|
633
|
-
'video/webm',
|
|
634
|
-
'video/ogg',
|
|
635
|
-
];
|
|
636
|
-
this.uploadUrlKey = 'path_to_file';
|
|
637
|
-
this.uploading = false;
|
|
638
|
-
}
|
|
639
|
-
pollForCompletion() {
|
|
640
|
-
this.uploadService.get(this.uploadId).subscribe((response) => {
|
|
641
|
-
if (response.processed) {
|
|
642
|
-
this.imgLink = response[this.uploadUrlKey];
|
|
643
|
-
this.mimeType = response.mime_type;
|
|
644
|
-
clearInterval(this.poller);
|
|
645
|
-
this.poller = null;
|
|
646
|
-
this.uploading = false;
|
|
647
|
-
}
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
|
-
ngOnInit() {
|
|
651
|
-
this.uploader = new FileUploader({
|
|
652
|
-
url: UploadService.upload_endpoint,
|
|
653
|
-
itemAlias: 'file',
|
|
654
|
-
authToken: '',
|
|
655
|
-
headers: [
|
|
656
|
-
{ name: 'X-CSRFToken', value: MediaUploadModalComponent.getCookie('csrftoken') },
|
|
657
|
-
],
|
|
658
|
-
additionalParameter: { csrf_token: MediaUploadModalComponent.getCookie('csrftoken') },
|
|
659
|
-
removeAfterUpload: true,
|
|
660
|
-
allowedMimeType: this.allowedMimeTypes,
|
|
661
|
-
});
|
|
662
|
-
this.uploader.onCompleteItem = (item, response) => {
|
|
663
|
-
const responseObj = JSON.parse(response);
|
|
664
|
-
this.uploadId = responseObj.id;
|
|
665
|
-
this.poller = setInterval(this.pollForCompletion.bind(this), 2000);
|
|
666
|
-
};
|
|
667
|
-
this.uploader.onWhenAddingFileFailed = (item, filter, options) => {
|
|
668
|
-
this.error = 'This file is not a supported mimetype.';
|
|
669
|
-
this.uploading = false;
|
|
670
|
-
};
|
|
671
|
-
if (this.file) {
|
|
672
|
-
this.uploader.addToQueue([this.file]);
|
|
673
|
-
this.uploader.uploadAll();
|
|
674
|
-
this.uploading = true;
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
onFileSelected(e) {
|
|
678
|
-
this.uploader.uploadAll();
|
|
679
|
-
this.uploading = true;
|
|
680
|
-
}
|
|
681
|
-
buildHost(url) {
|
|
682
|
-
return location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '') + url;
|
|
683
|
-
}
|
|
684
|
-
close() {
|
|
685
|
-
this.dialogRef.close();
|
|
686
|
-
}
|
|
687
|
-
ngOnDestroy() {
|
|
688
|
-
if (this.socketSub) {
|
|
689
|
-
this.socketSub.complete();
|
|
690
|
-
this.socketSub = null;
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
blobToFile(theBlob, fileName) {
|
|
694
|
-
// A Blob() is almost a File() - it's just missing the two properties below which we will add
|
|
695
|
-
theBlob.lastModifiedDate = new Date();
|
|
696
|
-
theBlob.name = fileName;
|
|
697
|
-
return theBlob;
|
|
698
|
-
}
|
|
699
|
-
onPaste(e) {
|
|
700
|
-
if (e instanceof ClipboardEvent) {
|
|
701
|
-
const files = e.clipboardData.files;
|
|
702
|
-
if (files) {
|
|
703
|
-
if (files.length < 1) {
|
|
704
|
-
// const items = e.clipboardData.items;
|
|
705
|
-
// for(let i = 0; i < items.length; i++) {
|
|
706
|
-
// const item = items[i];
|
|
707
|
-
// item.getAsString((text) => {
|
|
708
|
-
// try {
|
|
709
|
-
// const url = new URL(text);
|
|
710
|
-
// if(url) {
|
|
711
|
-
// fetch(text)
|
|
712
|
-
// .then(res => res.blob()) // Gets the response and returns it as a blob
|
|
713
|
-
// .then(blob => {
|
|
714
|
-
// const file = this.blobToFile(blob, 'web-created')
|
|
715
|
-
// this.uploader.addToQueue([file])
|
|
716
|
-
// this.uploader.uploadAll();
|
|
717
|
-
// this.uploading = true;
|
|
718
|
-
// });
|
|
719
|
-
// }
|
|
720
|
-
// } catch(e) {
|
|
721
|
-
//
|
|
722
|
-
// }
|
|
723
|
-
// });
|
|
724
|
-
// }
|
|
725
|
-
}
|
|
726
|
-
else if (files.length > 1) {
|
|
727
|
-
console.log('Multiple files detected');
|
|
728
|
-
}
|
|
729
|
-
else {
|
|
730
|
-
for (let i = 0; i < files.length; i++) {
|
|
731
|
-
this.uploader.addToQueue([files[i]]);
|
|
732
|
-
}
|
|
733
|
-
this.uploader.uploadAll();
|
|
734
|
-
this.uploading = true;
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
else {
|
|
738
|
-
console.log('Stuff not working');
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
MediaUploadModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: MediaUploadModalComponent, deps: [{ token: i1$2.MatDialogRef }, { token: UploadService }], target: i0.ɵɵFactoryTarget.Component });
|
|
744
|
-
MediaUploadModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: MediaUploadModalComponent, selector: "app-media-upload-modal", inputs: { allowedMimeTypes: "allowedMimeTypes", uploadUrlKey: "uploadUrlKey", file: "file" }, host: { listeners: { "document:paste": "onPaste($event)" } }, ngImport: i0, template: "<h1 mat-dialog-title>Upload an Image</h1>\n<!--<mat-radio-group aria-label=\"Select an option\">-->\n<!-- <mat-radio-button class=\"option\" value=\"unpublished\">Unpublished</mat-radio-button>-->\n<!-- <mat-radio-button class=\"option\" value=\"published\">Published</mat-radio-button>-->\n<!--</mat-radio-group>-->\n<mat-divider class=\"option-list-divider\"></mat-divider>\n<div mat-dialog-content>\n <div *ngIf=\"uploading\">\n <fa-icon [icon]=\"'spinner'\" [spin]=\"true\"></fa-icon>\n </div>\n <ng-container *ngIf=\"!imgLink && !uploading\">\n <h4>Select a File</h4>\n <div class=\"input-group\">\n <div class=\"form-group\">\n <!-- <label for=\"import_file\">Choose File</label>-->\n <input type=\"file\" id=\"import_file\"\n *ngIf=\"uploader.queue.length==0 && !uploading\"\n ng2FileSelect\n [uploader]=\"uploader\"\n (onFileSelected)=\"onFileSelected($event)\"\n >\n </div>\n </div>\n <br>\n <h3>Paste a File</h3>\n <p>You can use the paste command to paste any image here</p>\n </ng-container>\n <div *ngIf=\"imgLink\">\n <img *ngIf=\"imgLink\" [src]=\"imgLink\"/>\n </div>\n <div *ngIf=\"error\">\n <div class=\"alert alert-danger\">\n {{error}}\n </div>\n </div>\n</div>\n<div mat-dialog-actions>\n <button mat-button [disabled]=\"!imgLink || uploading\" (click)=\"close()\">Attach</button>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "directive", type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i1$3.FaIconComponent, selector: "fa-icon", inputs: ["icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "classes", "transform", "a11yRole"] }, { kind: "directive", type: i7.FileSelectDirective, selector: "[ng2FileSelect]", inputs: ["uploader"], outputs: ["onFileSelected"] }] });
|
|
745
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: MediaUploadModalComponent, decorators: [{
|
|
746
|
-
type: Component,
|
|
747
|
-
args: [{ selector: 'app-media-upload-modal', template: "<h1 mat-dialog-title>Upload an Image</h1>\n<!--<mat-radio-group aria-label=\"Select an option\">-->\n<!-- <mat-radio-button class=\"option\" value=\"unpublished\">Unpublished</mat-radio-button>-->\n<!-- <mat-radio-button class=\"option\" value=\"published\">Published</mat-radio-button>-->\n<!--</mat-radio-group>-->\n<mat-divider class=\"option-list-divider\"></mat-divider>\n<div mat-dialog-content>\n <div *ngIf=\"uploading\">\n <fa-icon [icon]=\"'spinner'\" [spin]=\"true\"></fa-icon>\n </div>\n <ng-container *ngIf=\"!imgLink && !uploading\">\n <h4>Select a File</h4>\n <div class=\"input-group\">\n <div class=\"form-group\">\n <!-- <label for=\"import_file\">Choose File</label>-->\n <input type=\"file\" id=\"import_file\"\n *ngIf=\"uploader.queue.length==0 && !uploading\"\n ng2FileSelect\n [uploader]=\"uploader\"\n (onFileSelected)=\"onFileSelected($event)\"\n >\n </div>\n </div>\n <br>\n <h3>Paste a File</h3>\n <p>You can use the paste command to paste any image here</p>\n </ng-container>\n <div *ngIf=\"imgLink\">\n <img *ngIf=\"imgLink\" [src]=\"imgLink\"/>\n </div>\n <div *ngIf=\"error\">\n <div class=\"alert alert-danger\">\n {{error}}\n </div>\n </div>\n</div>\n<div mat-dialog-actions>\n <button mat-button [disabled]=\"!imgLink || uploading\" (click)=\"close()\">Attach</button>\n</div>\n" }]
|
|
748
|
-
}], ctorParameters: function () { return [{ type: i1$2.MatDialogRef }, { type: UploadService }]; }, propDecorators: { allowedMimeTypes: [{
|
|
749
|
-
type: Input
|
|
750
|
-
}], uploadUrlKey: [{
|
|
751
|
-
type: Input
|
|
752
|
-
}], file: [{
|
|
753
|
-
type: Input
|
|
754
|
-
}], onPaste: [{
|
|
755
|
-
type: HostListener,
|
|
756
|
-
args: ['document:paste', ['$event']]
|
|
757
|
-
}] } });
|
|
758
|
-
|
|
759
|
-
class EntryCreatorComponent {
|
|
760
|
-
static getCookie(name) {
|
|
761
|
-
const ca = document.cookie.split(';');
|
|
762
|
-
const caLen = ca.length;
|
|
763
|
-
const cookieName = `${name}=`;
|
|
764
|
-
let c;
|
|
765
|
-
for (let i = 0; i < caLen; i += 1) {
|
|
766
|
-
c = ca[i].replace(/^\s+/g, '');
|
|
767
|
-
if (c.indexOf(cookieName) === 0) {
|
|
768
|
-
return c.substring(cookieName.length, c.length);
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
return '';
|
|
772
|
-
}
|
|
773
|
-
constructor(entryService, tagService, identityService, cdr, dialog) {
|
|
774
|
-
this.entryService = entryService;
|
|
775
|
-
this.tagService = tagService;
|
|
776
|
-
this.identityService = identityService;
|
|
777
|
-
this.cdr = cdr;
|
|
778
|
-
this.dialog = dialog;
|
|
779
|
-
this.ContentType = ContentType;
|
|
780
|
-
this.Object = Object;
|
|
781
|
-
this.entry = null;
|
|
782
|
-
this.separatorKeysCodes = [ENTER, COMMA, TAB];
|
|
783
|
-
this.removable = true;
|
|
784
|
-
this.all_tags = ['Angular', 'Bash', 'MacOS', 'Typescript', 'NPM', 'Databases'];
|
|
785
|
-
this.tagCtrl = new UntypedFormControl();
|
|
786
|
-
this.publishDateControl = new UntypedFormControl();
|
|
787
|
-
this.selectable = false;
|
|
788
|
-
this.scheduling = false;
|
|
789
|
-
this.customScheduleTime = '';
|
|
790
|
-
this.today = new Date();
|
|
791
|
-
this.allowedMimeTypes = [
|
|
792
|
-
'image/jpeg',
|
|
793
|
-
'image/gif',
|
|
794
|
-
'image/png',
|
|
795
|
-
'image/jpg',
|
|
796
|
-
'video/mp4',
|
|
797
|
-
'video/webm',
|
|
798
|
-
'video/ogg',
|
|
799
|
-
];
|
|
800
|
-
this.uploadUrlKey = 'path_to_file';
|
|
801
|
-
this.uploader = new FileUploader({
|
|
802
|
-
url: '/file_api/uploads/create_image/',
|
|
803
|
-
itemAlias: 'file',
|
|
804
|
-
authToken: '',
|
|
805
|
-
headers: [
|
|
806
|
-
{
|
|
807
|
-
name: 'X-CSRFToken',
|
|
808
|
-
value: EntryCreatorComponent.getCookie('csrftoken')
|
|
809
|
-
},
|
|
810
|
-
],
|
|
811
|
-
additionalParameter: {
|
|
812
|
-
'csrf_token': EntryCreatorComponent.getCookie('csrftoken')
|
|
813
|
-
},
|
|
814
|
-
removeAfterUpload: true,
|
|
815
|
-
allowedMimeType: this.allowedMimeTypes,
|
|
816
|
-
});
|
|
817
|
-
const scheduledDate = new Date();
|
|
818
|
-
this.customScheduleTime = scheduledDate.getHours() + ':' + scheduledDate.getMinutes() + ' AM';
|
|
819
|
-
}
|
|
820
|
-
_filter(value) {
|
|
821
|
-
const filterValue = value.toLowerCase();
|
|
822
|
-
return this.all_tags.filter(tag => tag.toLowerCase().indexOf(filterValue) === 0);
|
|
823
|
-
}
|
|
824
|
-
add(event) {
|
|
825
|
-
const input = event.input;
|
|
826
|
-
const value = event.value;
|
|
827
|
-
// Add our tag
|
|
828
|
-
if ((value || '').trim()) {
|
|
829
|
-
this.tags.push(value.trim());
|
|
830
|
-
}
|
|
831
|
-
// Reset the input value
|
|
832
|
-
if (input) {
|
|
833
|
-
input.value = '';
|
|
834
|
-
}
|
|
835
|
-
this.tagCtrl.setValue(null);
|
|
836
|
-
this.onChange();
|
|
837
|
-
}
|
|
838
|
-
remove(fruit) {
|
|
839
|
-
const index = this.tags.indexOf(fruit);
|
|
840
|
-
if (index >= 0) {
|
|
841
|
-
this.tags.splice(index, 1);
|
|
842
|
-
}
|
|
843
|
-
this.onChange();
|
|
844
|
-
}
|
|
845
|
-
selected(event) {
|
|
846
|
-
this.tags.push(event.option.viewValue);
|
|
847
|
-
this.tagInput.nativeElement.value = '';
|
|
848
|
-
this.tagCtrl.setValue(null);
|
|
849
|
-
this.onChange();
|
|
850
|
-
}
|
|
851
|
-
refreshTags() {
|
|
852
|
-
this.tagService.get().subscribe((response) => {
|
|
853
|
-
this.all_tags = map$1(response.results, (t) => t.label);
|
|
854
|
-
this.filtered_tags = this.tagCtrl.valueChanges.pipe(startWith(null), map((tag) => tag ? this._filter(tag) : this.all_tags.slice()));
|
|
855
|
-
});
|
|
856
|
-
}
|
|
857
|
-
createNewEntry() {
|
|
858
|
-
this.entry = new Entry();
|
|
859
|
-
this.entry.title = EntryCreatorComponent.DEFAULT_NEW_ENTRY_TITLE;
|
|
860
|
-
this.entry.published = false;
|
|
861
|
-
this.entry.version = 1;
|
|
862
|
-
this.entryService.create(this.entry).subscribe((response) => {
|
|
863
|
-
this.entry = response;
|
|
864
|
-
this.entry.sort();
|
|
865
|
-
setTimeout(() => {
|
|
866
|
-
this.entryService.currentlyEditedEntry.next(this.entry);
|
|
867
|
-
}, 10);
|
|
868
|
-
});
|
|
869
|
-
}
|
|
870
|
-
ngOnInit() {
|
|
871
|
-
this.refreshTags();
|
|
872
|
-
this.identityService.getMe().subscribe((me) => {
|
|
873
|
-
this.me = me;
|
|
874
|
-
});
|
|
875
|
-
const savedEntry = localStorage.getItem(EntryCreatorComponent.CURRENT_ENTRY);
|
|
876
|
-
if (savedEntry) {
|
|
877
|
-
this.entry = new Entry(JSON.parse(savedEntry));
|
|
878
|
-
if (this.entry.should_publish_in_future && this.entry.future_publish_date < new Date()) {
|
|
879
|
-
this.createNewEntry();
|
|
880
|
-
}
|
|
881
|
-
this.entry.sort();
|
|
882
|
-
if (this.entry.should_publish_in_future) {
|
|
883
|
-
// Restore scheduling settings
|
|
884
|
-
this.scheduling = true;
|
|
885
|
-
let hours = this.entry.future_publish_date.getHours();
|
|
886
|
-
let minutes = this.entry.future_publish_date.getMinutes();
|
|
887
|
-
const ampm = hours >= 12 ? 'PM' : 'AM';
|
|
888
|
-
if (hours >= 12) {
|
|
889
|
-
hours = hours % 12;
|
|
890
|
-
hours = hours ? hours : 12;
|
|
891
|
-
}
|
|
892
|
-
minutes = minutes < 10 ? '0' + minutes : minutes;
|
|
893
|
-
this.customScheduleTime = hours + ':' + minutes + ' ' + ampm;
|
|
894
|
-
}
|
|
895
|
-
setTimeout(() => {
|
|
896
|
-
this.entryService.currentlyEditedEntry.next(this.entry);
|
|
897
|
-
}, 10);
|
|
898
|
-
}
|
|
899
|
-
else {
|
|
900
|
-
this.seeEntries();
|
|
901
|
-
}
|
|
902
|
-
this.uploader.onCompleteItem = (item, response) => {
|
|
903
|
-
// const responseObj = JSON.parse(response)
|
|
904
|
-
// this.uploadId = responseObj.id;
|
|
905
|
-
};
|
|
906
|
-
this.uploader.onWhenAddingFileFailed = (item, uploadFilter, options) => {
|
|
907
|
-
// this.error = 'This file is not a supported mimetype.'
|
|
908
|
-
// this.uploading = false;
|
|
909
|
-
};
|
|
910
|
-
this.tags = this.entry.tags;
|
|
911
|
-
}
|
|
912
|
-
onFileSelected(e) {
|
|
913
|
-
this.uploader.uploadAll();
|
|
914
|
-
}
|
|
915
|
-
startUploader(content) {
|
|
916
|
-
const dialogRef = this.dialog.open(MediaUploadModalComponent, {});
|
|
917
|
-
dialogRef.componentInstance.allowedMimeTypes = this.allowedMimeTypes;
|
|
918
|
-
dialogRef.componentInstance.uploadUrlKey = this.uploadUrlKey;
|
|
919
|
-
dialogRef.afterClosed().subscribe(() => {
|
|
920
|
-
content.value = dialogRef.componentInstance.imgLink;
|
|
921
|
-
content.additional = [];
|
|
922
|
-
content.additional.push({ key: Content.KEY_MIMETYPE, value: dialogRef.componentInstance.mimeType });
|
|
923
|
-
this.onChange();
|
|
924
|
-
});
|
|
925
|
-
}
|
|
926
|
-
addSection() {
|
|
927
|
-
this.entry.sections.push(new Section());
|
|
928
|
-
this.onChange();
|
|
929
|
-
}
|
|
930
|
-
removeSection(section) {
|
|
931
|
-
const remove = confirm('Are you sure you want to remove this section?');
|
|
932
|
-
if (remove) {
|
|
933
|
-
this.entry.sections =
|
|
934
|
-
filter(this.entry.sections, (sct) => sct.id !== section.id);
|
|
935
|
-
this.onChange();
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
addContent(section) {
|
|
939
|
-
section.contents.push(new Content());
|
|
940
|
-
this.onChange();
|
|
941
|
-
}
|
|
942
|
-
removeContent(content) {
|
|
943
|
-
const remove = confirm('Are you sure you want to remove this content?');
|
|
944
|
-
if (remove) {
|
|
945
|
-
for (const section of this.entry.sections) {
|
|
946
|
-
section.contents = filter(section.contents, (ct) => ct.id !== content.id);
|
|
947
|
-
}
|
|
948
|
-
this.onChange();
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
onChange() {
|
|
952
|
-
this.entry.slug = this.entryService.slugify(this.entry.title).toLowerCase();
|
|
953
|
-
localStorage.setItem(EntryCreatorComponent.CURRENT_ENTRY, JSON.stringify(this.entry));
|
|
954
|
-
this.entry.sort();
|
|
955
|
-
this.cdr.detectChanges();
|
|
956
|
-
this.entryService.currentlyEditedEntry.next(this.entry);
|
|
957
|
-
this.entryService._currentlyEditedEntry = this.entry;
|
|
958
|
-
}
|
|
959
|
-
resetDate() {
|
|
960
|
-
this.entry.create_date = new Date();
|
|
961
|
-
this.entry.edit_date = new Date();
|
|
962
|
-
this.onChange();
|
|
963
|
-
}
|
|
964
|
-
startNew() {
|
|
965
|
-
const finish = confirm('Are you sure your finished? The JSON and entry displayed will be removed. Make sure you have already copied it.');
|
|
966
|
-
if (finish) {
|
|
967
|
-
this.entry = new Entry();
|
|
968
|
-
this.entry.title = EntryCreatorComponent.DEFAULT_NEW_ENTRY_TITLE;
|
|
969
|
-
this.entry.published = false;
|
|
970
|
-
this.entry.version = 1;
|
|
971
|
-
this.entryService.currentlyEditedEntry.next(this.entry);
|
|
972
|
-
localStorage.setItem(EntryCreatorComponent.CURRENT_ENTRY, JSON.stringify(this.entry));
|
|
973
|
-
this.entryService.create(this.entry).subscribe((next) => {
|
|
974
|
-
});
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
seeEntries() {
|
|
978
|
-
const dialogRef = this.dialog.open(EntrySelectorDialogComponent, {
|
|
979
|
-
width: '800px',
|
|
980
|
-
data: { name: 'test', animal: 'test' }
|
|
981
|
-
});
|
|
982
|
-
dialogRef.afterClosed().subscribe((id) => {
|
|
983
|
-
if (id) {
|
|
984
|
-
this.entryService.getUnpublishedById(id).subscribe((result) => {
|
|
985
|
-
const entry = result;
|
|
986
|
-
this.entryService.currentlyEditedEntry.next(entry);
|
|
987
|
-
localStorage.setItem(EntryCreatorComponent.CURRENT_ENTRY, JSON.stringify(entry));
|
|
988
|
-
this.entry = entry;
|
|
989
|
-
});
|
|
990
|
-
}
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
|
-
postPublishCallback() {
|
|
994
|
-
this.entryService.currentlyEditedEntry.next(null);
|
|
995
|
-
this.entry = null;
|
|
996
|
-
this.seeEntries();
|
|
997
|
-
}
|
|
998
|
-
cancelScheduling() {
|
|
999
|
-
this.entry.future_publish_date = null;
|
|
1000
|
-
this.entry.should_publish_in_future = false;
|
|
1001
|
-
this.scheduling = false;
|
|
1002
|
-
this.onChange();
|
|
1003
|
-
}
|
|
1004
|
-
exposeScheduling() {
|
|
1005
|
-
const scheduledDate = new Date();
|
|
1006
|
-
scheduledDate.setDate(scheduledDate.getDate() + 1);
|
|
1007
|
-
this.entry.future_publish_date = scheduledDate;
|
|
1008
|
-
this.setTime(this.customScheduleTime);
|
|
1009
|
-
this.entry.should_publish_in_future = true;
|
|
1010
|
-
this.scheduling = true;
|
|
1011
|
-
this.onChange();
|
|
1012
|
-
}
|
|
1013
|
-
publish() {
|
|
1014
|
-
const publish = confirm('Are you sure you want to publish? Once an article is published it is available to everyone.');
|
|
1015
|
-
if (publish) {
|
|
1016
|
-
this.entry.published = true;
|
|
1017
|
-
this.entry.publish_date = new Date();
|
|
1018
|
-
this.entry.edit_date = new Date();
|
|
1019
|
-
this.entryService.updateUnpublishedEntry(this.entry).subscribe(this.postPublishCallback.bind(this));
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
delete() {
|
|
1023
|
-
const confirmDelete = confirm('Are you sure you want to delete this draft? Once it is deleted it cannot be recovered.');
|
|
1024
|
-
if (confirmDelete) {
|
|
1025
|
-
this.entryService.delete(this.entry).subscribe(() => {
|
|
1026
|
-
this.entry = null;
|
|
1027
|
-
this.entryService.currentlyEditedEntry.next(null);
|
|
1028
|
-
localStorage.removeItem(EntryCreatorComponent.CURRENT_ENTRY);
|
|
1029
|
-
});
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
onDateChange() {
|
|
1033
|
-
this.entry.future_publish_date.setHours(this.hours);
|
|
1034
|
-
this.entry.future_publish_date.setMinutes(this.minutes);
|
|
1035
|
-
this.onChange();
|
|
1036
|
-
}
|
|
1037
|
-
setTime(e) {
|
|
1038
|
-
const firstTimeSplit = e.split(' ');
|
|
1039
|
-
const secondTimeSplit = firstTimeSplit[0].split(':');
|
|
1040
|
-
this.hours = Number(secondTimeSplit[0]);
|
|
1041
|
-
this.minutes = Number(secondTimeSplit[1]);
|
|
1042
|
-
if (firstTimeSplit[1] === 'PM') {
|
|
1043
|
-
this.hours = Number(this.hours) + 12;
|
|
1044
|
-
}
|
|
1045
|
-
this.entry.future_publish_date.setHours(this.hours);
|
|
1046
|
-
this.entry.future_publish_date.setMinutes(this.minutes);
|
|
1047
|
-
this.onChange();
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
EntryCreatorComponent.CURRENT_ENTRY = 'current_entry';
|
|
1051
|
-
EntryCreatorComponent.DEFAULT_NEW_ENTRY_TITLE = 'A New Entry';
|
|
1052
|
-
EntryCreatorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: EntryCreatorComponent, deps: [{ token: EntryService }, { token: TagService }, { token: IdentityService }, { token: i0.ChangeDetectorRef }, { token: i1$2.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
|
|
1053
|
-
EntryCreatorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: EntryCreatorComponent, selector: "app-entry-creator", inputs: { allowedMimeTypes: "allowedMimeTypes", uploadUrlKey: "uploadUrlKey" }, viewQueries: [{ propertyName: "tagInput", first: true, predicate: ["tagInput"], descendants: true }, { propertyName: "matAutocomplete", first: true, predicate: ["tagauto"], descendants: true }], ngImport: i0, template: "<div class=\"section creator fields\">\n <form #createForm=\"ngForm\" (change)=\"onChange()\" *ngIf=\"this.entry\">\n <div class=\"form-group\">\n <mat-form-field class=\"full-width\">\n <mat-label>Title</mat-label>\n <input matInput\n [(ngModel)]=\"entry.title\"\n name=\"title\">\n </mat-form-field>\n </div>\n <mat-card class=\"form-section tags\">\n <div>\n <mat-form-field class=\"full-width\" hintLabel=\"Use a comma to seperate different tags\">\n <mat-chip-listbox #tagList aria-label=\"Tags\">\n <mat-chip-option\n *ngFor=\"let tag of tags\"\n [selectable]=\"selectable\"\n [removable]=\"removable\"\n (removed)=\"remove(tag)\">\n {{tag}}\n <mat-icon matChipRemove *ngIf=\"removable\">cancel</mat-icon>\n </mat-chip-option>\n <input\n matInput\n placeholder=\"Tags...\"\n #tagInput\n [formControl]=\"tagCtrl\"\n [matAutocomplete]=\"tagauto\"\n [matChipInputFor]=\"tagList\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n (matChipInputTokenEnd)=\"add($event)\">\n </mat-chip-listbox>\n <mat-autocomplete #tagauto=\"matAutocomplete\" (optionSelected)=\"selected($event)\">\n <mat-option *ngFor=\"let tag of filtered_tags | async\" [value]=\"tag\">\n {{tag}}\n </mat-option>\n </mat-autocomplete>\n </mat-form-field>\n </div>\n </mat-card>\n <mat-card class=\"form-section\" *ngFor=\"let section of entry.sections\">\n <div>\n <mat-form-field class=\"full-width\">\n <mat-label>Subheading</mat-label>\n <input matInput\n [(ngModel)]=\"section.subheading\"\n name=\"{{section.id}}-subheading\">\n </mat-form-field>\n <div class=\"form-content\" *ngFor=\"let content of section.contents\">\n <div class=\"form-group\">\n <mat-radio-group\n aria-label=\"Select the Content Type\"\n name=\"{{content.id}}-content-type\"\n class=\"radio-group\"\n [(ngModel)]=\"content.type\">\n <mat-radio-button\n *ngFor=\"let value of Object.values(ContentType)\"\n class=\"radio-button\"\n [value]=\"value\">{{value}}\n </mat-radio-button>\n </mat-radio-group>\n </div>\n <ng-container [ngSwitch]=\"content.type\">\n <ng-container *ngSwitchCase=\"ContentType.URL\">\n <mat-form-field class=\"full-width\">\n <mat-label>Value</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-value\"\n [(ngModel)]=\"content.value\">\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>Title</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-title\"\n [(ngModel)]=\"content.title\">\n </mat-form-field>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.TEXT\">\n <mat-form-field class=\"full-width\">\n <mat-label>Value</mat-label>\n <textarea matInput\n cdkTextareaAutosize\n #autosize=\"cdkTextareaAutosize\"\n cdkAutosizeMinRows=\"3\"\n cdkAutosizeMaxRows=\"20\"\n name=\"{{content.id}}-content-value\"\n [(ngModel)]=\"content.value\"\n ></textarea>\n </mat-form-field>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.HTML\">\n <mat-form-field class=\"full-width\">\n <mat-label>Value</mat-label>\n <textarea matInput\n cdkTextareaAutosize\n #autosize=\"cdkTextareaAutosize\"\n cdkAutosizeMinRows=\"3\"\n cdkAutosizeMaxRows=\"20\"\n name=\"{{content.id}}-content-value\"\n [(ngModel)]=\"content.value\"\n ></textarea>\n </mat-form-field>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.CODE\">\n <mat-form-field class=\"full-width\">\n <mat-label>Value</mat-label>\n <textarea matInput\n cdkTextareaAutosize\n #autosize=\"cdkTextareaAutosize\"\n cdkAutosizeMinRows=\"10\"\n cdkAutosizeMaxRows=\"100\"\n name=\"{{content.id}}-content-value\"\n [(ngModel)]=\"content.value\"\n ></textarea>\n </mat-form-field>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.IMAGE\">\n <mat-form-field class=\"full-width\">\n <mat-label>Value</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-value\"\n [(ngModel)]=\"content.value\">\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>Value</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-source\"\n [(ngModel)]=\"content.value\">\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>Description</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-description\"\n [(ngModel)]=\"content.description\">\n </mat-form-field>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.MEDIA\">\n <div class=\"full-width\">\n <ng-container *ngIf=\"content.value\">\n <mat-form-field class=\"full-width\">\n <mat-label>Value</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-value\"\n [(ngModel)]=\"content.value\">\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>Description</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-description\"\n [(ngModel)]=\"content.description\">\n </mat-form-field>\n </ng-container>\n <ng-container *ngIf=\"content.additional\">\n <ng-container *ngFor=\"let add of content.additional\">\n <mat-form-field class=\"full-width\">\n <mat-label>{{add.key}}</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-{{add.key}}\"\n [(ngModel)]=\"add.value\"\n [disabled]=\"true\"\n >\n </mat-form-field>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"!content.value\">\n <button mat-raised-button (click)=startUploader(content)>Upload</button>\n </ng-container>\n </div>\n </ng-container>\n </ng-container>\n <button mat-raised-button (click)=removeContent(content)>Remove Content</button>\n <button mat-raised-button (click)=\"addContent(section)\">+ Add Content</button>\n </div>\n <button mat-raised-button (click)=\"removeSection(section)\">Remove Section</button>\n <button mat-raised-button (click)=\"addContent(section)\" *ngIf=\"section.contents.length === 0\">+ Add\n Content\n </button>\n <button mat-raised-button (click)=\"addSection()\">+ Add Section</button>\n </div>\n\n </mat-card>\n <button mat-raised-button (click)=\"addSection()\" *ngIf=\"entry.sections?.length === 0\">+ Add Section</button>\n <button mat-raised-button (click)=\"addSection()\" *ngIf=\"!entry.sections\">+ Add Section</button>\n\n <div class=\"controls\">\n <button mat-raised-button (click)=\"resetDate()\">Reset the Date</button>\n <button mat-raised-button (click)=\"delete()\">Delete</button>\n <button mat-raised-button [disabled]=\"scheduling\" (click)=\"publish()\">Publish</button>\n <button mat-raised-button [disabled]=\"scheduling\" (click)=\"exposeScheduling()\">Schedule</button>\n <button mat-raised-button (click)=\"startNew()\">New</button>\n </div>\n <p *ngIf=\"scheduling\">Publishing is disabled while scheduling is being used.</p>\n\n <mat-card [hidden]=\"!scheduling\">\n <h4>\n Scheduling Options\n </h4>\n\n <div class=\"form-group\">\n <mat-form-field class=\"full-width\">\n <mat-label>Date</mat-label>\n <input\n #futurePublishDate\n matInput\n [matDatepicker]=\"picker\"\n [min]=\"today\"\n (dateInput)=\"onDateChange()\"\n (dateChange)=\"onDateChange()\"\n [(ngModel)]=\"entry.future_publish_date\"\n name=\"future-publish-date\"\n >\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker\n #picker></mat-datepicker>\n </mat-form-field>\n\n <mat-label>Time</mat-label>\n <ngx-timepicker-field\n [defaultTime]=\"customScheduleTime\"\n [format]=\"12\"\n [buttonAlign]=\"'left'\"\n (timeChanged)=\"setTime($event)\"\n ></ngx-timepicker-field>\n <p>Times are represented in your local time zone</p>\n </div>\n\n <div mat-dialog-actions>\n <div class=\"controls\">\n <button mat-raised-button (click)=\"cancelScheduling()\">Cancel Scheduling</button>\n </div>\n </div>\n <p>This post will be published as soon as its scheduled date and time arrive. No further action is needed by you. If you do not\n want to use scheduling, you can cancel scheduling and manually publish.</p>\n </mat-card>\n </form>\n <div class=\"controls\">\n <button mat-raised-button (click)=\"seeEntries()\">See Entries</button>\n <button *ngIf=\"!this.entry\" mat-raised-button (click)=\"startNew()\">New</button>\n </div>\n</div>\n", styles: [".creator{min-height:calc(100vh - 100px)}form{padding:20px}.content{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}button{margin:4px}.radio-group{display:flex;flex-direction:column;margin:15px 0}.radio-button{margin:4px}.full-width{width:100%}.content-card{margin:0 0 10px}.form-section{margin-bottom:10px}.form-content:not(:last-child){border-bottom:1px dotted #aaa;padding-bottom:10px}.controls{display:inline-block;width:100%;padding:10px}[hidden]{display:none!important}\n"], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i6$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i6$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i6$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i6$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i6$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i8.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i9.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i10.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10.MatLabel, selector: "mat-label" }, { kind: "directive", type: i10.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i11.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "directive", type: i12.MatRadioGroup, selector: "mat-radio-group", exportAs: ["matRadioGroup"] }, { kind: "component", type: i12.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i13.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i14.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i13.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "directive", type: i15.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "component", type: i15.MatChipListbox, selector: "mat-chip-listbox", inputs: ["tabIndex", "multiple", "aria-orientation", "selectable", "compareWith", "required", "value"], outputs: ["change"] }, { kind: "component", type: i15.MatChipOption, selector: "mat-basic-chip-option, mat-chip-option", inputs: ["color", "disabled", "disableRipple", "tabIndex", "selectable", "selected"], outputs: ["selectionChange"] }, { kind: "directive", type: i15.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i16.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i17.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i17.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i17.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: i6$2.NgxTimepickerFieldComponent, selector: "ngx-timepicker-field", inputs: ["buttonAlign", "format", "min", "max", "defaultTime", "disabled", "toggleIcon", "clockTheme", "controlOnly", "cancelBtnTmpl", "confirmBtnTmpl"], outputs: ["timeChanged"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }] });
|
|
1054
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: EntryCreatorComponent, decorators: [{
|
|
1055
|
-
type: Component,
|
|
1056
|
-
args: [{ selector: 'app-entry-creator', template: "<div class=\"section creator fields\">\n <form #createForm=\"ngForm\" (change)=\"onChange()\" *ngIf=\"this.entry\">\n <div class=\"form-group\">\n <mat-form-field class=\"full-width\">\n <mat-label>Title</mat-label>\n <input matInput\n [(ngModel)]=\"entry.title\"\n name=\"title\">\n </mat-form-field>\n </div>\n <mat-card class=\"form-section tags\">\n <div>\n <mat-form-field class=\"full-width\" hintLabel=\"Use a comma to seperate different tags\">\n <mat-chip-listbox #tagList aria-label=\"Tags\">\n <mat-chip-option\n *ngFor=\"let tag of tags\"\n [selectable]=\"selectable\"\n [removable]=\"removable\"\n (removed)=\"remove(tag)\">\n {{tag}}\n <mat-icon matChipRemove *ngIf=\"removable\">cancel</mat-icon>\n </mat-chip-option>\n <input\n matInput\n placeholder=\"Tags...\"\n #tagInput\n [formControl]=\"tagCtrl\"\n [matAutocomplete]=\"tagauto\"\n [matChipInputFor]=\"tagList\"\n [matChipInputSeparatorKeyCodes]=\"separatorKeysCodes\"\n (matChipInputTokenEnd)=\"add($event)\">\n </mat-chip-listbox>\n <mat-autocomplete #tagauto=\"matAutocomplete\" (optionSelected)=\"selected($event)\">\n <mat-option *ngFor=\"let tag of filtered_tags | async\" [value]=\"tag\">\n {{tag}}\n </mat-option>\n </mat-autocomplete>\n </mat-form-field>\n </div>\n </mat-card>\n <mat-card class=\"form-section\" *ngFor=\"let section of entry.sections\">\n <div>\n <mat-form-field class=\"full-width\">\n <mat-label>Subheading</mat-label>\n <input matInput\n [(ngModel)]=\"section.subheading\"\n name=\"{{section.id}}-subheading\">\n </mat-form-field>\n <div class=\"form-content\" *ngFor=\"let content of section.contents\">\n <div class=\"form-group\">\n <mat-radio-group\n aria-label=\"Select the Content Type\"\n name=\"{{content.id}}-content-type\"\n class=\"radio-group\"\n [(ngModel)]=\"content.type\">\n <mat-radio-button\n *ngFor=\"let value of Object.values(ContentType)\"\n class=\"radio-button\"\n [value]=\"value\">{{value}}\n </mat-radio-button>\n </mat-radio-group>\n </div>\n <ng-container [ngSwitch]=\"content.type\">\n <ng-container *ngSwitchCase=\"ContentType.URL\">\n <mat-form-field class=\"full-width\">\n <mat-label>Value</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-value\"\n [(ngModel)]=\"content.value\">\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>Title</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-title\"\n [(ngModel)]=\"content.title\">\n </mat-form-field>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.TEXT\">\n <mat-form-field class=\"full-width\">\n <mat-label>Value</mat-label>\n <textarea matInput\n cdkTextareaAutosize\n #autosize=\"cdkTextareaAutosize\"\n cdkAutosizeMinRows=\"3\"\n cdkAutosizeMaxRows=\"20\"\n name=\"{{content.id}}-content-value\"\n [(ngModel)]=\"content.value\"\n ></textarea>\n </mat-form-field>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.HTML\">\n <mat-form-field class=\"full-width\">\n <mat-label>Value</mat-label>\n <textarea matInput\n cdkTextareaAutosize\n #autosize=\"cdkTextareaAutosize\"\n cdkAutosizeMinRows=\"3\"\n cdkAutosizeMaxRows=\"20\"\n name=\"{{content.id}}-content-value\"\n [(ngModel)]=\"content.value\"\n ></textarea>\n </mat-form-field>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.CODE\">\n <mat-form-field class=\"full-width\">\n <mat-label>Value</mat-label>\n <textarea matInput\n cdkTextareaAutosize\n #autosize=\"cdkTextareaAutosize\"\n cdkAutosizeMinRows=\"10\"\n cdkAutosizeMaxRows=\"100\"\n name=\"{{content.id}}-content-value\"\n [(ngModel)]=\"content.value\"\n ></textarea>\n </mat-form-field>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.IMAGE\">\n <mat-form-field class=\"full-width\">\n <mat-label>Value</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-value\"\n [(ngModel)]=\"content.value\">\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>Value</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-source\"\n [(ngModel)]=\"content.value\">\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>Description</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-description\"\n [(ngModel)]=\"content.description\">\n </mat-form-field>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.MEDIA\">\n <div class=\"full-width\">\n <ng-container *ngIf=\"content.value\">\n <mat-form-field class=\"full-width\">\n <mat-label>Value</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-value\"\n [(ngModel)]=\"content.value\">\n </mat-form-field>\n <mat-form-field class=\"full-width\">\n <mat-label>Description</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-description\"\n [(ngModel)]=\"content.description\">\n </mat-form-field>\n </ng-container>\n <ng-container *ngIf=\"content.additional\">\n <ng-container *ngFor=\"let add of content.additional\">\n <mat-form-field class=\"full-width\">\n <mat-label>{{add.key}}</mat-label>\n <input\n matInput\n name=\"{{content.id}}-content-{{add.key}}\"\n [(ngModel)]=\"add.value\"\n [disabled]=\"true\"\n >\n </mat-form-field>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"!content.value\">\n <button mat-raised-button (click)=startUploader(content)>Upload</button>\n </ng-container>\n </div>\n </ng-container>\n </ng-container>\n <button mat-raised-button (click)=removeContent(content)>Remove Content</button>\n <button mat-raised-button (click)=\"addContent(section)\">+ Add Content</button>\n </div>\n <button mat-raised-button (click)=\"removeSection(section)\">Remove Section</button>\n <button mat-raised-button (click)=\"addContent(section)\" *ngIf=\"section.contents.length === 0\">+ Add\n Content\n </button>\n <button mat-raised-button (click)=\"addSection()\">+ Add Section</button>\n </div>\n\n </mat-card>\n <button mat-raised-button (click)=\"addSection()\" *ngIf=\"entry.sections?.length === 0\">+ Add Section</button>\n <button mat-raised-button (click)=\"addSection()\" *ngIf=\"!entry.sections\">+ Add Section</button>\n\n <div class=\"controls\">\n <button mat-raised-button (click)=\"resetDate()\">Reset the Date</button>\n <button mat-raised-button (click)=\"delete()\">Delete</button>\n <button mat-raised-button [disabled]=\"scheduling\" (click)=\"publish()\">Publish</button>\n <button mat-raised-button [disabled]=\"scheduling\" (click)=\"exposeScheduling()\">Schedule</button>\n <button mat-raised-button (click)=\"startNew()\">New</button>\n </div>\n <p *ngIf=\"scheduling\">Publishing is disabled while scheduling is being used.</p>\n\n <mat-card [hidden]=\"!scheduling\">\n <h4>\n Scheduling Options\n </h4>\n\n <div class=\"form-group\">\n <mat-form-field class=\"full-width\">\n <mat-label>Date</mat-label>\n <input\n #futurePublishDate\n matInput\n [matDatepicker]=\"picker\"\n [min]=\"today\"\n (dateInput)=\"onDateChange()\"\n (dateChange)=\"onDateChange()\"\n [(ngModel)]=\"entry.future_publish_date\"\n name=\"future-publish-date\"\n >\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker\n #picker></mat-datepicker>\n </mat-form-field>\n\n <mat-label>Time</mat-label>\n <ngx-timepicker-field\n [defaultTime]=\"customScheduleTime\"\n [format]=\"12\"\n [buttonAlign]=\"'left'\"\n (timeChanged)=\"setTime($event)\"\n ></ngx-timepicker-field>\n <p>Times are represented in your local time zone</p>\n </div>\n\n <div mat-dialog-actions>\n <div class=\"controls\">\n <button mat-raised-button (click)=\"cancelScheduling()\">Cancel Scheduling</button>\n </div>\n </div>\n <p>This post will be published as soon as its scheduled date and time arrive. No further action is needed by you. If you do not\n want to use scheduling, you can cancel scheduling and manually publish.</p>\n </mat-card>\n </form>\n <div class=\"controls\">\n <button mat-raised-button (click)=\"seeEntries()\">See Entries</button>\n <button *ngIf=\"!this.entry\" mat-raised-button (click)=\"startNew()\">New</button>\n </div>\n</div>\n", styles: [".creator{min-height:calc(100vh - 100px)}form{padding:20px}.content{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}button{margin:4px}.radio-group{display:flex;flex-direction:column;margin:15px 0}.radio-button{margin:4px}.full-width{width:100%}.content-card{margin:0 0 10px}.form-section{margin-bottom:10px}.form-content:not(:last-child){border-bottom:1px dotted #aaa;padding-bottom:10px}.controls{display:inline-block;width:100%;padding:10px}[hidden]{display:none!important}\n"] }]
|
|
1057
|
-
}], ctorParameters: function () { return [{ type: EntryService }, { type: TagService }, { type: IdentityService }, { type: i0.ChangeDetectorRef }, { type: i1$2.MatDialog }]; }, propDecorators: { tagInput: [{
|
|
1058
|
-
type: ViewChild,
|
|
1059
|
-
args: ['tagInput']
|
|
1060
|
-
}], matAutocomplete: [{
|
|
1061
|
-
type: ViewChild,
|
|
1062
|
-
args: ['tagauto']
|
|
1063
|
-
}], allowedMimeTypes: [{
|
|
1064
|
-
type: Input
|
|
1065
|
-
}], uploadUrlKey: [{
|
|
1066
|
-
type: Input
|
|
1067
|
-
}] } });
|
|
1068
|
-
|
|
1069
|
-
class StaticHtmlComponent {
|
|
1070
|
-
constructor(staticHtmlService, domSanitizer) {
|
|
1071
|
-
this.staticHtmlService = staticHtmlService;
|
|
1072
|
-
this.domSanitizer = domSanitizer;
|
|
1073
|
-
}
|
|
1074
|
-
refreshContent() {
|
|
1075
|
-
this.innerHtml = this.domSanitizer.bypassSecurityTrustHtml(this.staticHtmlService.mapStaticHtml(this.value, false));
|
|
1076
|
-
}
|
|
1077
|
-
ngOnChanges(changes) {
|
|
1078
|
-
this.refreshContent();
|
|
1079
|
-
}
|
|
1080
|
-
ngOnInit() {
|
|
1081
|
-
this.refreshContent();
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
StaticHtmlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: StaticHtmlComponent, deps: [{ token: StaticHtmlService }, { token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
|
|
1085
|
-
StaticHtmlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: StaticHtmlComponent, selector: "app-static-html", inputs: { value: "value" }, usesOnChanges: true, ngImport: i0, template: "<div [innerHtml]=\"innerHtml\">\n</div>\n", styles: [""] });
|
|
1086
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: StaticHtmlComponent, decorators: [{
|
|
1087
|
-
type: Component,
|
|
1088
|
-
args: [{ selector: 'app-static-html', template: "<div [innerHtml]=\"innerHtml\">\n</div>\n" }]
|
|
1089
|
-
}], ctorParameters: function () { return [{ type: StaticHtmlService }, { type: i1$1.DomSanitizer }]; }, propDecorators: { value: [{
|
|
1090
|
-
type: Input
|
|
1091
|
-
}] } });
|
|
1092
|
-
|
|
1093
|
-
class TimeAgoPipe {
|
|
1094
|
-
constructor(changeDetectorRef, ngZone) {
|
|
1095
|
-
this.changeDetectorRef = changeDetectorRef;
|
|
1096
|
-
this.ngZone = ngZone;
|
|
1097
|
-
}
|
|
1098
|
-
transform(value) {
|
|
1099
|
-
this.removeTimer();
|
|
1100
|
-
let d = new Date(value);
|
|
1101
|
-
let now = new Date();
|
|
1102
|
-
let seconds = Math.round(Math.abs((now.getTime() - d.getTime()) / 1000));
|
|
1103
|
-
let timeToUpdate = (Number.isNaN(seconds)) ? 1000 : this.getSecondsUntilUpdate(seconds) * 1000;
|
|
1104
|
-
this.timer = this.ngZone.runOutsideAngular(() => {
|
|
1105
|
-
if (typeof window !== 'undefined') {
|
|
1106
|
-
return window.setTimeout(() => {
|
|
1107
|
-
this.ngZone.run(() => this.changeDetectorRef.markForCheck());
|
|
1108
|
-
}, timeToUpdate);
|
|
1109
|
-
}
|
|
1110
|
-
return null;
|
|
1111
|
-
});
|
|
1112
|
-
let minutes = Math.round(Math.abs(seconds / 60));
|
|
1113
|
-
let hours = Math.round(Math.abs(minutes / 60));
|
|
1114
|
-
let days = Math.round(Math.abs(hours / 24));
|
|
1115
|
-
let months = Math.round(Math.abs(days / 30.416));
|
|
1116
|
-
let years = Math.round(Math.abs(days / 365));
|
|
1117
|
-
if (Number.isNaN(seconds)) {
|
|
1118
|
-
return '';
|
|
1119
|
-
}
|
|
1120
|
-
else if (seconds <= 45) {
|
|
1121
|
-
return 'a few seconds ago';
|
|
1122
|
-
}
|
|
1123
|
-
else if (seconds <= 90) {
|
|
1124
|
-
return 'a minute ago';
|
|
1125
|
-
}
|
|
1126
|
-
else if (minutes <= 45) {
|
|
1127
|
-
return minutes + ' minutes ago';
|
|
1128
|
-
}
|
|
1129
|
-
else if (minutes <= 90) {
|
|
1130
|
-
return 'an hour ago';
|
|
1131
|
-
}
|
|
1132
|
-
else if (hours <= 22) {
|
|
1133
|
-
return hours + ' hours ago';
|
|
1134
|
-
}
|
|
1135
|
-
else if (hours <= 36) {
|
|
1136
|
-
return 'a day ago';
|
|
1137
|
-
}
|
|
1138
|
-
else if (days <= 25) {
|
|
1139
|
-
return days + ' days ago';
|
|
1140
|
-
}
|
|
1141
|
-
else if (days <= 45) {
|
|
1142
|
-
return 'a month ago';
|
|
1143
|
-
}
|
|
1144
|
-
else if (days <= 345) {
|
|
1145
|
-
return months + ' months ago';
|
|
1146
|
-
}
|
|
1147
|
-
else if (days <= 545) {
|
|
1148
|
-
return 'a year ago';
|
|
1149
|
-
}
|
|
1150
|
-
else { // (days > 545)
|
|
1151
|
-
return years + ' years ago';
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
ngOnDestroy() {
|
|
1155
|
-
this.removeTimer();
|
|
1156
|
-
}
|
|
1157
|
-
removeTimer() {
|
|
1158
|
-
if (this.timer) {
|
|
1159
|
-
window.clearTimeout(this.timer);
|
|
1160
|
-
this.timer = null;
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
getSecondsUntilUpdate(seconds) {
|
|
1164
|
-
let min = 60;
|
|
1165
|
-
let hr = min * 60;
|
|
1166
|
-
let day = hr * 24;
|
|
1167
|
-
if (seconds < min) { // less than 1 min, update every 2 secs
|
|
1168
|
-
return 2;
|
|
1169
|
-
}
|
|
1170
|
-
else if (seconds < hr) { // less than an hour, update every 30 secs
|
|
1171
|
-
return 30;
|
|
1172
|
-
}
|
|
1173
|
-
else if (seconds < day) { // less then a day, update every 5 mins
|
|
1174
|
-
return 300;
|
|
1175
|
-
}
|
|
1176
|
-
else { // update every hour
|
|
1177
|
-
return 3600;
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
TimeAgoPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: TimeAgoPipe, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1182
|
-
TimeAgoPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: TimeAgoPipe, name: "timeAgo", pure: false });
|
|
1183
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: TimeAgoPipe, decorators: [{
|
|
1184
|
-
type: Pipe,
|
|
1185
|
-
args: [{
|
|
1186
|
-
name: 'timeAgo',
|
|
1187
|
-
pure: false
|
|
1188
|
-
}]
|
|
1189
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; } });
|
|
1190
|
-
|
|
1191
|
-
class EntryRendererComponent {
|
|
1192
|
-
constructor(prismService, ngZone, identityService, commentService, router, entryService) {
|
|
1193
|
-
this.prismService = prismService;
|
|
1194
|
-
this.ngZone = ngZone;
|
|
1195
|
-
this.identityService = identityService;
|
|
1196
|
-
this.commentService = commentService;
|
|
1197
|
-
this.router = router;
|
|
1198
|
-
this.entryService = entryService;
|
|
1199
|
-
this.ContentType = ContentType;
|
|
1200
|
-
this.comments = [];
|
|
1201
|
-
this.commentText = '';
|
|
1202
|
-
this.alert = alert;
|
|
1203
|
-
this.editMode = false;
|
|
1204
|
-
}
|
|
1205
|
-
ngOnInit() {
|
|
1206
|
-
this.identityService.getMe().subscribe((me) => {
|
|
1207
|
-
this.me = me;
|
|
1208
|
-
});
|
|
1209
|
-
this.commentService.getComments(this.entry.id).subscribe((response) => {
|
|
1210
|
-
this.comments = response.results;
|
|
1211
|
-
for (const comment of this.comments) {
|
|
1212
|
-
comment.date_obj = new Date(comment.created_on);
|
|
1213
|
-
}
|
|
1214
|
-
});
|
|
1215
|
-
}
|
|
1216
|
-
ngAfterViewChecked() {
|
|
1217
|
-
if (!this.editMode) {
|
|
1218
|
-
this.ngZone.runOutsideAngular(() => {
|
|
1219
|
-
try {
|
|
1220
|
-
this.prismService.highlightAll();
|
|
1221
|
-
}
|
|
1222
|
-
catch (e) {
|
|
1223
|
-
}
|
|
1224
|
-
});
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
edit(entry) {
|
|
1228
|
-
entry.version++;
|
|
1229
|
-
entry.published = false;
|
|
1230
|
-
delete entry.publish_date;
|
|
1231
|
-
this.entryService.create(entry).subscribe((response) => {
|
|
1232
|
-
localStorage.setItem(EntryCreatorComponent.CURRENT_ENTRY, JSON.stringify(response));
|
|
1233
|
-
this.router.navigateByUrl('create(left-col:create//right-col:create)').then(() => {
|
|
1234
|
-
});
|
|
1235
|
-
});
|
|
1236
|
-
}
|
|
1237
|
-
postComment(e) {
|
|
1238
|
-
e.preventDefault();
|
|
1239
|
-
if (this.commentText !== '') {
|
|
1240
|
-
this.commentService.postComment({ entry: this.entry.id, content: this.commentText }).subscribe((comment) => {
|
|
1241
|
-
this.comments.push(comment);
|
|
1242
|
-
});
|
|
1243
|
-
this.commentText = '';
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
mediaIsZip(content) {
|
|
1247
|
-
let mediaIsZip = false;
|
|
1248
|
-
if (content.additional) {
|
|
1249
|
-
for (const add of content.additional) {
|
|
1250
|
-
if (add.key === Content.KEY_MIMETYPE) {
|
|
1251
|
-
if (add.value === 'application/zip') {
|
|
1252
|
-
mediaIsZip = true;
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
|
-
return mediaIsZip;
|
|
1258
|
-
}
|
|
1259
|
-
approve(comment) {
|
|
1260
|
-
comment.approved = !comment.approved;
|
|
1261
|
-
this.commentService.patchComment(Object.assign({}, { approved: true }, comment)).subscribe((rComment) => {
|
|
1262
|
-
});
|
|
1263
|
-
}
|
|
1264
|
-
unapprove(comment) {
|
|
1265
|
-
comment.approved = !comment.approved;
|
|
1266
|
-
this.commentService.patchComment(Object.assign({}, { approved: false }, comment)).subscribe((rComment) => {
|
|
1267
|
-
});
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
EntryRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: EntryRendererComponent, deps: [{ token: PrismService }, { token: i0.NgZone }, { token: IdentityService }, { token: CommentService }, { token: i1$4.Router }, { token: EntryService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1271
|
-
EntryRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: EntryRendererComponent, selector: "app-entry-renderer", inputs: { entry: "entry", editMode: "editMode" }, ngImport: i0, template: "<div *ngIf=\"entry\">\n <h2>{{entry?.title}}</h2>\n <a *ngIf=\"me?.id === entry?.getProp('author_id')\" href=\"javascript:void(0)\" (click)=\"edit(entry)\"><h4>[Edit]</h4></a>\n <h3>Posted {{entry?.create_date.toString() | timeAgo}} on {{entry?.create_date?.getMonth() + 1}}/{{entry?.create_date?.getDate()}}/{{entry?.create_date?.getFullYear()}}</h3>\n <h5 *ngIf=\"entry?.showEditInformation()\">Article was last edited {{entry?.edit_date.toString() | timeAgo}}</h5>\n <br>\n <p *ngIf=\"entry?.tags?.length > 0\">Tags: <span *ngFor=\"let tag of entry?.tags; let last = last\">{{tag}}<ng-container *ngIf=\"!last\"> |\n </ng-container></span><span *ngIf=\"entry?.views\">, {{entry._friendly_views}} views</span></p>\n <br>\n\n <ng-container *ngFor=\"let section of entry?.sections\">\n <h4>{{section?.subheading}}</h4>\n <ng-container *ngFor=\"let content of section?.contents\">\n <ng-container [ngSwitch]=\"content.type\">\n <ng-container *ngSwitchCase=\"ContentType.CODE\">\n <pre><code class=\"language-ts\">{{content?.value}}</code></pre>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.URL\">\n <a [href]=\"content?.value\" target=\"_blank\">{{content.title}}</a><br>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.IMAGE\">\n <div class=\"restrict\">\n <div class=\"image\">\n <img [src]=\"content?.value\"/>\n </div>\n <div class=\"description\" *ngIf=\"content?.description\">{{content?.description}}</div>\n <div class=\"source\" *ngIf=\"content?.source\">\n <a [href]=\"content?.source\" [target]=\"'_blank'\">Source: {{content?.source}}</a>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"ContentType.MEDIA\">\n <ng-container *ngIf=\"mediaIsZip(content)\">\n <div class=\"download\">\n <a href=\"content?.value\">{{content?.description}}</a>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!mediaIsZip(content)\">\n <div class=\"restrict\">\n <div class=\"image\">\n <img [src]=\"content?.value\"/>\n </div>\n <div class=\"description\" *ngIf=\"content?.description\">{{content?.description}}</div>\n <div class=\"source\" *ngIf=\"content?.source\">\n <a [href]=\"content?.source\" [target]=\"'_blank'\">Source: {{content?.source}}</a>\n </div>\n </div>\n </ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.HTML\">\n <app-static-html\n [value]=\"content?.value\"\n >\n </app-static-html>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <p>{{content?.value}}</p>\n </ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n <ng-container>\n <h2>Comments</h2>\n <p *ngIf=\"comments?.length == 0\">There are no comments yet.</p>\n <ng-container *ngIf=\"comments?.length > 0\">\n <div *ngFor=\"let comment of comments\">\n <mat-card style=\"margin-bottom: 20px;\" class=\"restrict\">\n <mat-card-title><img class=\"gravatar\" src=\"{{comment.gravatar_url}} + ?s=30\"> {{comment.user_display_name}}</mat-card-title>\n <mat-card-subtitle>{{comment.date_obj | timeAgo}}</mat-card-subtitle>\n <mat-card-content>\n <p>{{comment.content}}</p>\n <ng-container *ngIf=\"me?.id === entry?.__server_generated_properties?.author_id\">\n <a href=\"javascript:void(0);\" *ngIf=\"!comment?.approved\" (click)=\"approve(comment)\">Approve</a>\n <a href=\"javascript:void(0);\" *ngIf=\"comment?.approved\" (click)=\"unapprove(comment)\">Unapprove</a>\n </ng-container>\n </mat-card-content>\n </mat-card>\n </div>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"!me\">\n <a href=\"/signup\">Signup</a> or <a href=\"/login\">login</a> to join the conversation!\n </ng-container>\n <ng-container *ngIf=\"me && !me?.comments_public\">\n <p>Note, your comments will not be public be default. It is possible I will make your comments public, but for now comments are just between you and me.</p>\n </ng-container>\n <ng-container *ngIf=\"me\">\n <h2 style=\"width: 100%;\">Leave a Comment</h2>\n <br>\n <mat-form-field class=\"restrict\" style=\"width: 100%;\" appearance=\"outline\">\n <mat-label>Comment</mat-label>\n <textarea [(ngModel)]=\"commentText\" (keydown.enter)=\"postComment($event)\" matInput></textarea>\n </mat-form-field>\n <br>\n <button (click)=\"postComment($event)\" style=\"text-align: right;\" mat-button>Submit</button>\n </ng-container>\n <div style=\"margin-bottom: 30px;\"></div>\n</div>\n\n", styles: [".image{width:100%;text-align:center;justify-content:center}.source,.description{text-align:center;font-size:12px}.gravatar{margin-right:20px}.smaller{text-size:12px;text-color:gray}\n"], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "directive", type: i6$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i8.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i8.MatCardContent, selector: "mat-card-content" }, { kind: "directive", type: i8.MatCardSubtitle, selector: "mat-card-subtitle, [mat-card-subtitle], [matCardSubtitle]" }, { kind: "directive", type: i8.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i9.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i10.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10.MatLabel, selector: "mat-label" }, { kind: "component", type: StaticHtmlComponent, selector: "app-static-html", inputs: ["value"] }, { kind: "pipe", type: TimeAgoPipe, name: "timeAgo" }] });
|
|
1272
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: EntryRendererComponent, decorators: [{
|
|
1273
|
-
type: Component,
|
|
1274
|
-
args: [{ selector: 'app-entry-renderer', template: "<div *ngIf=\"entry\">\n <h2>{{entry?.title}}</h2>\n <a *ngIf=\"me?.id === entry?.getProp('author_id')\" href=\"javascript:void(0)\" (click)=\"edit(entry)\"><h4>[Edit]</h4></a>\n <h3>Posted {{entry?.create_date.toString() | timeAgo}} on {{entry?.create_date?.getMonth() + 1}}/{{entry?.create_date?.getDate()}}/{{entry?.create_date?.getFullYear()}}</h3>\n <h5 *ngIf=\"entry?.showEditInformation()\">Article was last edited {{entry?.edit_date.toString() | timeAgo}}</h5>\n <br>\n <p *ngIf=\"entry?.tags?.length > 0\">Tags: <span *ngFor=\"let tag of entry?.tags; let last = last\">{{tag}}<ng-container *ngIf=\"!last\"> |\n </ng-container></span><span *ngIf=\"entry?.views\">, {{entry._friendly_views}} views</span></p>\n <br>\n\n <ng-container *ngFor=\"let section of entry?.sections\">\n <h4>{{section?.subheading}}</h4>\n <ng-container *ngFor=\"let content of section?.contents\">\n <ng-container [ngSwitch]=\"content.type\">\n <ng-container *ngSwitchCase=\"ContentType.CODE\">\n <pre><code class=\"language-ts\">{{content?.value}}</code></pre>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.URL\">\n <a [href]=\"content?.value\" target=\"_blank\">{{content.title}}</a><br>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.IMAGE\">\n <div class=\"restrict\">\n <div class=\"image\">\n <img [src]=\"content?.value\"/>\n </div>\n <div class=\"description\" *ngIf=\"content?.description\">{{content?.description}}</div>\n <div class=\"source\" *ngIf=\"content?.source\">\n <a [href]=\"content?.source\" [target]=\"'_blank'\">Source: {{content?.source}}</a>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"ContentType.MEDIA\">\n <ng-container *ngIf=\"mediaIsZip(content)\">\n <div class=\"download\">\n <a href=\"content?.value\">{{content?.description}}</a>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!mediaIsZip(content)\">\n <div class=\"restrict\">\n <div class=\"image\">\n <img [src]=\"content?.value\"/>\n </div>\n <div class=\"description\" *ngIf=\"content?.description\">{{content?.description}}</div>\n <div class=\"source\" *ngIf=\"content?.source\">\n <a [href]=\"content?.source\" [target]=\"'_blank'\">Source: {{content?.source}}</a>\n </div>\n </div>\n </ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.HTML\">\n <app-static-html\n [value]=\"content?.value\"\n >\n </app-static-html>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <p>{{content?.value}}</p>\n </ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n <ng-container>\n <h2>Comments</h2>\n <p *ngIf=\"comments?.length == 0\">There are no comments yet.</p>\n <ng-container *ngIf=\"comments?.length > 0\">\n <div *ngFor=\"let comment of comments\">\n <mat-card style=\"margin-bottom: 20px;\" class=\"restrict\">\n <mat-card-title><img class=\"gravatar\" src=\"{{comment.gravatar_url}} + ?s=30\"> {{comment.user_display_name}}</mat-card-title>\n <mat-card-subtitle>{{comment.date_obj | timeAgo}}</mat-card-subtitle>\n <mat-card-content>\n <p>{{comment.content}}</p>\n <ng-container *ngIf=\"me?.id === entry?.__server_generated_properties?.author_id\">\n <a href=\"javascript:void(0);\" *ngIf=\"!comment?.approved\" (click)=\"approve(comment)\">Approve</a>\n <a href=\"javascript:void(0);\" *ngIf=\"comment?.approved\" (click)=\"unapprove(comment)\">Unapprove</a>\n </ng-container>\n </mat-card-content>\n </mat-card>\n </div>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"!me\">\n <a href=\"/signup\">Signup</a> or <a href=\"/login\">login</a> to join the conversation!\n </ng-container>\n <ng-container *ngIf=\"me && !me?.comments_public\">\n <p>Note, your comments will not be public be default. It is possible I will make your comments public, but for now comments are just between you and me.</p>\n </ng-container>\n <ng-container *ngIf=\"me\">\n <h2 style=\"width: 100%;\">Leave a Comment</h2>\n <br>\n <mat-form-field class=\"restrict\" style=\"width: 100%;\" appearance=\"outline\">\n <mat-label>Comment</mat-label>\n <textarea [(ngModel)]=\"commentText\" (keydown.enter)=\"postComment($event)\" matInput></textarea>\n </mat-form-field>\n <br>\n <button (click)=\"postComment($event)\" style=\"text-align: right;\" mat-button>Submit</button>\n </ng-container>\n <div style=\"margin-bottom: 30px;\"></div>\n</div>\n\n", styles: [".image{width:100%;text-align:center;justify-content:center}.source,.description{text-align:center;font-size:12px}.gravatar{margin-right:20px}.smaller{text-size:12px;text-color:gray}\n"] }]
|
|
1275
|
-
}], ctorParameters: function () { return [{ type: PrismService }, { type: i0.NgZone }, { type: IdentityService }, { type: CommentService }, { type: i1$4.Router }, { type: EntryService }]; }, propDecorators: { entry: [{
|
|
1276
|
-
type: Input
|
|
1277
|
-
}], editMode: [{
|
|
1278
|
-
type: Input
|
|
1279
|
-
}] } });
|
|
1280
|
-
|
|
1281
|
-
class EntrySummaryComponent {
|
|
1282
|
-
constructor(router) {
|
|
1283
|
-
this.router = router;
|
|
1284
|
-
this.ContentType = ContentType;
|
|
1285
|
-
}
|
|
1286
|
-
ngOnInit() {
|
|
1287
|
-
}
|
|
1288
|
-
routeTo(entry) {
|
|
1289
|
-
this.router.navigate(['/', 'blog', entry.slug]).then(() => {
|
|
1290
|
-
});
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
EntrySummaryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: EntrySummaryComponent, deps: [{ token: i1$4.Router }], target: i0.ɵɵFactoryTarget.Component });
|
|
1294
|
-
EntrySummaryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: EntrySummaryComponent, selector: "app-entry-summary", inputs: { entry: "entry" }, ngImport: i0, template: "\n<div class=\"entry section restrict\">\n <h2>{{entry?.title}}</h2>\n <!-- <a href=\"javascript:void(0)\" (click)=\"edit(entry)\"><h6>[Edit]</h6></a>-->\n <h3>Posted {{entry?.create_date.toString() | timeAgo}} on {{entry?.create_date?.getMonth() + 1}}/{{entry?.create_date?.getDate()}}/{{entry?.create_date?.getFullYear()}}</h3>\n <h5 *ngIf=\"entry.showEditInformation()\">Article was last edited {{entry?.edit_date.toString() | timeAgo}}</h5>\n <br>\n\n <ng-container *ngFor=\"let section of entry?.sections.slice(0, 1)\">\n <h4>{{section?.subheading}}</h4>\n <ng-container *ngFor=\"let content of section?.contents.slice(0, 1)\">\n <ng-container [ngSwitch]=\"content.type\">\n <ng-container *ngSwitchCase=\"ContentType.CODE\">\n <pre><code class=\"language-ts\">{{content?.value}}</code></pre>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.URL\">\n <a [href]=\"content?.value\" target=\"_blank\">{{content.title}}</a>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.IMAGE\">\n <div class=\"restrict\">\n <div class=\"image\">\n <img [src]=\"content?.value\"/>\n </div>\n <div class=\"description\" *ngIf=\"content?.description\">{{content?.description}}</div>\n <div class=\"source\" *ngIf=\"content?.source\">\n <a [href]=\"content?.source\" [target]=\"'_blank'\">Source: {{content?.source}}</a>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.MEDIA\">\n <div class=\"restrict\">\n <div class=\"image\">\n <img [src]=\"content?.value\"/>\n </div>\n <div class=\"description\" *ngIf=\"content?.description\">{{content?.description}}</div>\n <div class=\"source\" *ngIf=\"content?.source\">\n <a [href]=\"content?.source\" [target]=\"'_blank'\">Source: {{content?.source}}</a>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.HTML\">\n <app-static-html\n [value]=\"content?.value\"\n >\n </app-static-html>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <p>{{content?.value}}</p>\n </ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n\n <a href=\"javascript:void(0);\" (click)=\"routeTo(entry)\">Read more...</a>\n</div>\n", styles: [".entry{padding:20px;border-bottom:solid 1px rgba(0,0,0,.12)}\n"], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i2$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "component", type: StaticHtmlComponent, selector: "app-static-html", inputs: ["value"] }, { kind: "pipe", type: TimeAgoPipe, name: "timeAgo" }] });
|
|
1295
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: EntrySummaryComponent, decorators: [{
|
|
1296
|
-
type: Component,
|
|
1297
|
-
args: [{ selector: 'app-entry-summary', template: "\n<div class=\"entry section restrict\">\n <h2>{{entry?.title}}</h2>\n <!-- <a href=\"javascript:void(0)\" (click)=\"edit(entry)\"><h6>[Edit]</h6></a>-->\n <h3>Posted {{entry?.create_date.toString() | timeAgo}} on {{entry?.create_date?.getMonth() + 1}}/{{entry?.create_date?.getDate()}}/{{entry?.create_date?.getFullYear()}}</h3>\n <h5 *ngIf=\"entry.showEditInformation()\">Article was last edited {{entry?.edit_date.toString() | timeAgo}}</h5>\n <br>\n\n <ng-container *ngFor=\"let section of entry?.sections.slice(0, 1)\">\n <h4>{{section?.subheading}}</h4>\n <ng-container *ngFor=\"let content of section?.contents.slice(0, 1)\">\n <ng-container [ngSwitch]=\"content.type\">\n <ng-container *ngSwitchCase=\"ContentType.CODE\">\n <pre><code class=\"language-ts\">{{content?.value}}</code></pre>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.URL\">\n <a [href]=\"content?.value\" target=\"_blank\">{{content.title}}</a>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.IMAGE\">\n <div class=\"restrict\">\n <div class=\"image\">\n <img [src]=\"content?.value\"/>\n </div>\n <div class=\"description\" *ngIf=\"content?.description\">{{content?.description}}</div>\n <div class=\"source\" *ngIf=\"content?.source\">\n <a [href]=\"content?.source\" [target]=\"'_blank'\">Source: {{content?.source}}</a>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.MEDIA\">\n <div class=\"restrict\">\n <div class=\"image\">\n <img [src]=\"content?.value\"/>\n </div>\n <div class=\"description\" *ngIf=\"content?.description\">{{content?.description}}</div>\n <div class=\"source\" *ngIf=\"content?.source\">\n <a [href]=\"content?.source\" [target]=\"'_blank'\">Source: {{content?.source}}</a>\n </div>\n </div>\n </ng-container>\n <ng-container *ngSwitchCase=\"ContentType.HTML\">\n <app-static-html\n [value]=\"content?.value\"\n >\n </app-static-html>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <p>{{content?.value}}</p>\n </ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n\n <a href=\"javascript:void(0);\" (click)=\"routeTo(entry)\">Read more...</a>\n</div>\n", styles: [".entry{padding:20px;border-bottom:solid 1px rgba(0,0,0,.12)}\n"] }]
|
|
1298
|
-
}], ctorParameters: function () { return [{ type: i1$4.Router }]; }, propDecorators: { entry: [{
|
|
1299
|
-
type: Input
|
|
1300
|
-
}] } });
|
|
1301
|
-
|
|
1302
|
-
class JsonRendererComponent {
|
|
1303
|
-
constructor(entryService) {
|
|
1304
|
-
this.entryService = entryService;
|
|
1305
|
-
this.JSON = JSON;
|
|
1306
|
-
}
|
|
1307
|
-
ngOnInit() {
|
|
1308
|
-
this.entryService.currentlyEditedEntry.subscribe((entry) => {
|
|
1309
|
-
console.log(entry);
|
|
1310
|
-
this.entry = entry;
|
|
1311
|
-
});
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
JsonRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: JsonRendererComponent, deps: [{ token: EntryService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1315
|
-
JsonRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: JsonRendererComponent, selector: "app-json-renderer", inputs: { entry: "entry" }, ngImport: i0, template: "<div class=\"section json-render json\">\n <app-entry-renderer [editMode]=\"true\" [entry]=\"entry\"></app-entry-renderer>\n <pre *ngIf=\"entry\">{{JSON.stringify(entry)}}</pre>\n</div>\n", styles: [".json pre{white-space:pre-wrap;word-wrap:anywhere}.json-render{padding:0 20px}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: EntryRendererComponent, selector: "app-entry-renderer", inputs: ["entry", "editMode"] }] });
|
|
1316
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: JsonRendererComponent, decorators: [{
|
|
1317
|
-
type: Component,
|
|
1318
|
-
args: [{ selector: 'app-json-renderer', template: "<div class=\"section json-render json\">\n <app-entry-renderer [editMode]=\"true\" [entry]=\"entry\"></app-entry-renderer>\n <pre *ngIf=\"entry\">{{JSON.stringify(entry)}}</pre>\n</div>\n", styles: [".json pre{white-space:pre-wrap;word-wrap:anywhere}.json-render{padding:0 20px}\n"] }]
|
|
1319
|
-
}], ctorParameters: function () { return [{ type: EntryService }]; }, propDecorators: { entry: [{
|
|
1320
|
-
type: Input
|
|
1321
|
-
}] } });
|
|
1322
|
-
|
|
1323
|
-
class LandingPageComponent {
|
|
1324
|
-
constructor(router, entryService) {
|
|
1325
|
-
this.router = router;
|
|
1326
|
-
this.entryService = entryService;
|
|
1327
|
-
this.JSON = JSON;
|
|
1328
|
-
}
|
|
1329
|
-
ngOnInit() {
|
|
1330
|
-
this.entryService.get().subscribe((response) => {
|
|
1331
|
-
this.entries = map$1(response.results.slice(0, 3), (result) => {
|
|
1332
|
-
return { id: result.id, entry: new Entry(result) };
|
|
1333
|
-
});
|
|
1334
|
-
});
|
|
1335
|
-
}
|
|
1336
|
-
ngOnDestroy() {
|
|
1337
|
-
if (this.sourceSub) {
|
|
1338
|
-
this.sourceSub.unsubscribe();
|
|
1339
|
-
this.sourceSub = null;
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
LandingPageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: LandingPageComponent, deps: [{ token: i1$4.Router }, { token: EntryService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1344
|
-
LandingPageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: LandingPageComponent, selector: "app-landing-page", ngImport: i0, template: "<div class=\"landing-page\">\n <ng-container *ngFor=\"let entry of entries\">\n <app-entry-summary [entry]=\"entry.entry\"></app-entry-summary>\n </ng-container>\n</div>\n", styles: [".landing-page{min-height:calc(100vh - 100px);max-height:calc(100vh - 100px)}@media screen and (max-height: 560px){.landing-page{max-height:100vh}}\n"], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: EntrySummaryComponent, selector: "app-entry-summary", inputs: ["entry"] }] });
|
|
1345
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: LandingPageComponent, decorators: [{
|
|
1346
|
-
type: Component,
|
|
1347
|
-
args: [{ selector: 'app-landing-page', template: "<div class=\"landing-page\">\n <ng-container *ngFor=\"let entry of entries\">\n <app-entry-summary [entry]=\"entry.entry\"></app-entry-summary>\n </ng-container>\n</div>\n", styles: [".landing-page{min-height:calc(100vh - 100px);max-height:calc(100vh - 100px)}@media screen and (max-height: 560px){.landing-page{max-height:100vh}}\n"] }]
|
|
1348
|
-
}], ctorParameters: function () { return [{ type: i1$4.Router }, { type: EntryService }]; } });
|
|
1349
|
-
|
|
1350
|
-
class OutlineViewComponent {
|
|
1351
|
-
constructor(entryService) {
|
|
1352
|
-
this.entryService = entryService;
|
|
1353
|
-
this.Math = Math;
|
|
1354
|
-
}
|
|
1355
|
-
ngOnInit() {
|
|
1356
|
-
this.entryService.currentlyEditedEntry.subscribe((entry) => {
|
|
1357
|
-
this.entry = entry;
|
|
1358
|
-
});
|
|
1359
|
-
}
|
|
1360
|
-
sectionDrop(e) {
|
|
1361
|
-
const entry = this.entry;
|
|
1362
|
-
const diff = e.currentIndex - e.previousIndex;
|
|
1363
|
-
entry.sections[e.previousIndex].order = e.currentIndex * 10 + (diff > 0 ? 1 : -1);
|
|
1364
|
-
entry.sort();
|
|
1365
|
-
this.entryService.currentlyEditedEntry.next(this.entry);
|
|
1366
|
-
}
|
|
1367
|
-
contentDrop(e, section) {
|
|
1368
|
-
const entry = this.entry;
|
|
1369
|
-
const diff = e.currentIndex - e.previousIndex;
|
|
1370
|
-
section.contents[e.previousIndex].order = e.currentIndex * 10 + (diff > 0 ? 1 : -1);
|
|
1371
|
-
entry.sort();
|
|
1372
|
-
this.entryService.currentlyEditedEntry.next(this.entry);
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
OutlineViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: OutlineViewComponent, deps: [{ token: EntryService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1376
|
-
OutlineViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: OutlineViewComponent, selector: "app-outline-view", ngImport: i0, template: "<div *ngIf=\"entry\" class=\"section outline\">\n <h1 *ngIf=\"entry?.sections?.length === 0\">Outline View</h1>\n <div cdkDropList class=\"sections\" (cdkDropListDropped)=\"sectionDrop($event)\">\n <mat-card class=\"card\" cdkDrag *ngFor=\"let section of entry.sections\">\n <h3>Section {{Math.ceil(section.order / 10) + 1}}</h3>\n {{section.subheading}}\n <div cdkDropList class=\"contents\" (cdkDropListDropped)=\"contentDrop($event, section)\">\n <h3>Contents for {{section.subheading}}</h3>\n <div class=\"content-card\" *ngFor=\"let content of section.contents\" cdkDrag>\n <div class=\"content\">{{content.value}}</div>\n <div class=\"content-placeholder\" *cdkDragPlaceholder></div>\n </div>\n </div>\n </mat-card>\n <div class=\"custom-placeholder\" *cdkDragPlaceholder></div>\n </div>\n</div>\n", styles: [".outline{padding:0 20px}.content{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}.card,.content-card{margin:4px;cursor:pointer}.content-card:not(:last-child){border-bottom:1px dotted #aaa}.custom-placeholder{background:#ccc;border:dotted 3px #999;transition:transform .25s cubic-bezier(0,0,.2,1);min-height:60px}.content-placeholder{background:#ccc;border:dotted 3px #999;transition:transform .25s cubic-bezier(0,0,.2,1);min-height:30px}\n"], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i3.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i3.CdkDragPlaceholder, selector: "ng-template[cdkDragPlaceholder]", inputs: ["data"] }, { kind: "component", type: i8.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }] });
|
|
1377
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: OutlineViewComponent, decorators: [{
|
|
1378
|
-
type: Component,
|
|
1379
|
-
args: [{ selector: 'app-outline-view', template: "<div *ngIf=\"entry\" class=\"section outline\">\n <h1 *ngIf=\"entry?.sections?.length === 0\">Outline View</h1>\n <div cdkDropList class=\"sections\" (cdkDropListDropped)=\"sectionDrop($event)\">\n <mat-card class=\"card\" cdkDrag *ngFor=\"let section of entry.sections\">\n <h3>Section {{Math.ceil(section.order / 10) + 1}}</h3>\n {{section.subheading}}\n <div cdkDropList class=\"contents\" (cdkDropListDropped)=\"contentDrop($event, section)\">\n <h3>Contents for {{section.subheading}}</h3>\n <div class=\"content-card\" *ngFor=\"let content of section.contents\" cdkDrag>\n <div class=\"content\">{{content.value}}</div>\n <div class=\"content-placeholder\" *cdkDragPlaceholder></div>\n </div>\n </div>\n </mat-card>\n <div class=\"custom-placeholder\" *cdkDragPlaceholder></div>\n </div>\n</div>\n", styles: [".outline{padding:0 20px}.content{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}.card,.content-card{margin:4px;cursor:pointer}.content-card:not(:last-child){border-bottom:1px dotted #aaa}.custom-placeholder{background:#ccc;border:dotted 3px #999;transition:transform .25s cubic-bezier(0,0,.2,1);min-height:60px}.content-placeholder{background:#ccc;border:dotted 3px #999;transition:transform .25s cubic-bezier(0,0,.2,1);min-height:30px}\n"] }]
|
|
1380
|
-
}], ctorParameters: function () { return [{ type: EntryService }]; } });
|
|
1381
|
-
|
|
1382
|
-
class SideNavigationComponent {
|
|
1383
|
-
constructor(entryService, router, identityService, renderer) {
|
|
1384
|
-
this.entryService = entryService;
|
|
1385
|
-
this.router = router;
|
|
1386
|
-
this.identityService = identityService;
|
|
1387
|
-
this.renderer = renderer;
|
|
1388
|
-
this.state = 'out';
|
|
1389
|
-
this.response = null;
|
|
1390
|
-
this.debounceTimeout = 200;
|
|
1391
|
-
this.loading = true;
|
|
1392
|
-
this.entries = [];
|
|
1393
|
-
this.entriesByMonthAndYear = [];
|
|
1394
|
-
this.searchTerm = "";
|
|
1395
|
-
this.doSearch = new EventEmitter();
|
|
1396
|
-
this.searchControl = new FormControl('');
|
|
1397
|
-
}
|
|
1398
|
-
ngOnInit() {
|
|
1399
|
-
this.doSearch.pipe(debounceTime(this.debounceTimeout)).subscribe((result) => {
|
|
1400
|
-
this.searchEntries(result);
|
|
1401
|
-
});
|
|
1402
|
-
this.identityService.getMe().subscribe((identity) => {
|
|
1403
|
-
this.identity = identity;
|
|
1404
|
-
}, (err) => {
|
|
1405
|
-
this.identity = null;
|
|
1406
|
-
});
|
|
1407
|
-
this.getEntries();
|
|
1408
|
-
}
|
|
1409
|
-
getMore() {
|
|
1410
|
-
this.getEntriesWithUrl(this.response.next, false);
|
|
1411
|
-
}
|
|
1412
|
-
getEntriesWithUrl(url, wipe = true) {
|
|
1413
|
-
this.loading = true;
|
|
1414
|
-
this.entryService.getListByUrl(url).subscribe((response) => {
|
|
1415
|
-
this.response = response;
|
|
1416
|
-
this.entries = this.entries.concat(map$1(response.results, (result) => {
|
|
1417
|
-
return { id: result.id, entry: new Entry(result) };
|
|
1418
|
-
}));
|
|
1419
|
-
this.organizeEntries(wipe);
|
|
1420
|
-
});
|
|
1421
|
-
}
|
|
1422
|
-
organizeEntries(wipe = true) {
|
|
1423
|
-
if (wipe) {
|
|
1424
|
-
this.state = 'out';
|
|
1425
|
-
}
|
|
1426
|
-
let organizeEntriesFn = () => {
|
|
1427
|
-
if (wipe) {
|
|
1428
|
-
this.entriesByMonthAndYear = [];
|
|
1429
|
-
}
|
|
1430
|
-
let newEntries = JSON.parse(JSON.stringify(this.entriesByMonthAndYear));
|
|
1431
|
-
for (const entryWrapper of this.entries) {
|
|
1432
|
-
const entry = entryWrapper.entry;
|
|
1433
|
-
const create_date = new Date(entry.create_date);
|
|
1434
|
-
const month = create_date.getMonth();
|
|
1435
|
-
const year = create_date.getFullYear();
|
|
1436
|
-
const key = month + '/' + year;
|
|
1437
|
-
const sort_index = (year * 100) + month;
|
|
1438
|
-
const containers = filter(newEntries, (entryContainer) => entryContainer.month_year === key);
|
|
1439
|
-
if (containers.length > 0) {
|
|
1440
|
-
const container = containers[0];
|
|
1441
|
-
const entriesWithId = filter(container.entries, (e) => e.id === entryWrapper.entry.id);
|
|
1442
|
-
if (entriesWithId.length === 0) {
|
|
1443
|
-
container.entries.push(entry);
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
else {
|
|
1447
|
-
const newContainer = { month_year: key, month_year_number: sort_index, entries: [entry] };
|
|
1448
|
-
newEntries.push(newContainer);
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
newEntries.sort((entry_a, entry_b) => {
|
|
1452
|
-
return entry_a.month_year_number - entry_b.month_year_number;
|
|
1453
|
-
});
|
|
1454
|
-
newEntries.reverse();
|
|
1455
|
-
let setEntriesFn = () => {
|
|
1456
|
-
this.entriesByMonthAndYear = newEntries;
|
|
1457
|
-
this.loading = false;
|
|
1458
|
-
if (wipe) {
|
|
1459
|
-
this.state = 'in';
|
|
1460
|
-
}
|
|
1461
|
-
};
|
|
1462
|
-
setTimeout(setEntriesFn.bind(this), 400);
|
|
1463
|
-
};
|
|
1464
|
-
setTimeout(organizeEntriesFn.bind(this), 400);
|
|
1465
|
-
}
|
|
1466
|
-
getEntries() {
|
|
1467
|
-
this.loading = true;
|
|
1468
|
-
this.entryService.get().subscribe((response) => {
|
|
1469
|
-
this.response = response;
|
|
1470
|
-
this.entries = map$1(response.results, (result) => {
|
|
1471
|
-
return { id: result.id, entry: new Entry(result) };
|
|
1472
|
-
});
|
|
1473
|
-
this.organizeEntries();
|
|
1474
|
-
});
|
|
1475
|
-
}
|
|
1476
|
-
searchEntries(searchTerm) {
|
|
1477
|
-
let turnOnLoading = () => {
|
|
1478
|
-
this.loading = true;
|
|
1479
|
-
};
|
|
1480
|
-
setTimeout(turnOnLoading.bind(this), this.debounceTimeout + 100);
|
|
1481
|
-
if (searchTerm !== "") {
|
|
1482
|
-
this.entryService.search(searchTerm).subscribe((response) => {
|
|
1483
|
-
this.response = response;
|
|
1484
|
-
this.entries = map$1(response.results, (result) => {
|
|
1485
|
-
return { id: result.id, entry: new Entry(result) };
|
|
1486
|
-
});
|
|
1487
|
-
this.organizeEntries();
|
|
1488
|
-
});
|
|
1489
|
-
}
|
|
1490
|
-
else {
|
|
1491
|
-
this.getEntries();
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
render() {
|
|
1495
|
-
}
|
|
1496
|
-
routeTo(entry) {
|
|
1497
|
-
if (!entry) {
|
|
1498
|
-
this.router.navigateByUrl('create(left-col:create//right-col:create)').then(() => {
|
|
1499
|
-
});
|
|
1500
|
-
}
|
|
1501
|
-
else {
|
|
1502
|
-
this.router.navigate(['/', 'blog', entry.slug]).then(() => {
|
|
1503
|
-
// Noop
|
|
1504
|
-
});
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
getMonthAndYearFromKey(key) {
|
|
1508
|
-
let subheading = '';
|
|
1509
|
-
const parts = key.split('/');
|
|
1510
|
-
switch (Number(parts[0])) {
|
|
1511
|
-
case 0:
|
|
1512
|
-
subheading += 'January ';
|
|
1513
|
-
break;
|
|
1514
|
-
case 1:
|
|
1515
|
-
subheading += 'February ';
|
|
1516
|
-
break;
|
|
1517
|
-
case 2:
|
|
1518
|
-
subheading += 'March ';
|
|
1519
|
-
break;
|
|
1520
|
-
case 3:
|
|
1521
|
-
subheading += 'April ';
|
|
1522
|
-
break;
|
|
1523
|
-
case 4:
|
|
1524
|
-
subheading += 'May ';
|
|
1525
|
-
break;
|
|
1526
|
-
case 5:
|
|
1527
|
-
subheading += 'June ';
|
|
1528
|
-
break;
|
|
1529
|
-
case 6:
|
|
1530
|
-
subheading += 'July ';
|
|
1531
|
-
break;
|
|
1532
|
-
case 7:
|
|
1533
|
-
subheading += 'August ';
|
|
1534
|
-
break;
|
|
1535
|
-
case 8:
|
|
1536
|
-
subheading += 'September ';
|
|
1537
|
-
break;
|
|
1538
|
-
case 9:
|
|
1539
|
-
subheading += 'October ';
|
|
1540
|
-
break;
|
|
1541
|
-
case 10:
|
|
1542
|
-
subheading += 'November ';
|
|
1543
|
-
break;
|
|
1544
|
-
case 11:
|
|
1545
|
-
subheading += 'December ';
|
|
1546
|
-
break;
|
|
1547
|
-
default:
|
|
1548
|
-
subheading += 'January ';
|
|
1549
|
-
}
|
|
1550
|
-
subheading += parts[1];
|
|
1551
|
-
return subheading;
|
|
1552
|
-
}
|
|
1553
|
-
ngOnDestroy() {
|
|
1554
|
-
if (this.sourceSub) {
|
|
1555
|
-
this.sourceSub.unsubscribe();
|
|
1556
|
-
this.sourceSub = null;
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1559
|
-
onSearchChange(searchValue) {
|
|
1560
|
-
this.doSearch.emit(searchValue);
|
|
1561
|
-
}
|
|
1562
|
-
}
|
|
1563
|
-
SideNavigationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: SideNavigationComponent, deps: [{ token: EntryService }, { token: i1$4.Router }, { token: IdentityService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
1564
|
-
SideNavigationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: SideNavigationComponent, selector: "app-side-navigation", viewQueries: [{ propertyName: "divNav", first: true, predicate: ["navcontainer"], descendants: true }], ngImport: i0, template: "<div class=\"sidenav no-scrollbar\">\n <div style=\"margin-top: 20px;\">\n <mat-form-field style=\"width: 100%\">\n <mat-label>Search</mat-label>\n <input matInput [formControl]=\"searchControl\" (ngModelChange)=\"onSearchChange($event)\">\n </mat-form-field>\n </div>\n\n <div\n class=\"progress\"\n [hidden]=\"!loading\"\n >\n <mat-progress-spinner\n style=\"margin-left: 16px;\"\n [diameter]=20\n mode=\"indeterminate\"\n >\n </mat-progress-spinner>\n </div>\n\n <div #navcontainer class=\"navcontainer\"\n [@sideNavAnimation]=\"state\"\n >\n <mat-nav-list\n *ngFor=\"let container of entriesByMonthAndYear\"\n >\n <h3>{{getMonthAndYearFromKey(container.month_year)}}</h3>\n <a mat-list-item *ngFor=\"let entry of container.entries\" href=\"javascript:void(0)\" (click)=\"routeTo(entry)\">{{entry.title}}</a>\n </mat-nav-list>\n\n <a\n class=\"sidelink\"\n *ngIf=\"this?.response?.next && !loading\"\n (click)=\"getMore()\"\n href=\"javascript:void(0);\">More...</a>\n </div>\n <ng-container *ngIf=\"identity?.id === 1\">\n <h2>Misc</h2>\n\n <mat-nav-list>\n <a mat-list-item href=\"javascript:void(0);\" (click)=\"routeTo(null)\">Create</a>\n </mat-nav-list>\n </ng-container>\n <h3 *ngIf=\"identity\">Logged in as {{identity?.email}}</h3>\n</div>\n\n", styles: [".progress{position:absolute;top:100px;left:0}.sidelink{padding-left:16px}.sidenav{position:relative;max-height:calc(100vh - 100px)}@media screen and (max-height: 560px){.sidenav{max-height:100vh}}h2,h3{margin-left:10px;justify-content:right}\n"], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i9.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i10.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10.MatLabel, selector: "mat-label" }, { kind: "component", type: i8$1.MatNavList, selector: "mat-nav-list", exportAs: ["matNavList"] }, { kind: "component", type: i8$1.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "component", type: i9$1.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }], animations: [
|
|
1565
|
-
trigger('sideNavAnimation', [
|
|
1566
|
-
state('in', style({ transform: 'translateX(0%)' })),
|
|
1567
|
-
state('out', style({ transform: 'translateX(110%)' })),
|
|
1568
|
-
transition('in => out', [
|
|
1569
|
-
animate('100ms ease-out', style({ transform: 'translateX(110%)' }))
|
|
1570
|
-
]),
|
|
1571
|
-
transition('out => in', [
|
|
1572
|
-
animate('100ms ease-in', style({ transform: 'translateX(0%)' }))
|
|
1573
|
-
])
|
|
1574
|
-
]),
|
|
1575
|
-
] });
|
|
1576
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: SideNavigationComponent, decorators: [{
|
|
1577
|
-
type: Component,
|
|
1578
|
-
args: [{ selector: 'app-side-navigation', animations: [
|
|
1579
|
-
trigger('sideNavAnimation', [
|
|
1580
|
-
state('in', style({ transform: 'translateX(0%)' })),
|
|
1581
|
-
state('out', style({ transform: 'translateX(110%)' })),
|
|
1582
|
-
transition('in => out', [
|
|
1583
|
-
animate('100ms ease-out', style({ transform: 'translateX(110%)' }))
|
|
1584
|
-
]),
|
|
1585
|
-
transition('out => in', [
|
|
1586
|
-
animate('100ms ease-in', style({ transform: 'translateX(0%)' }))
|
|
1587
|
-
])
|
|
1588
|
-
]),
|
|
1589
|
-
], template: "<div class=\"sidenav no-scrollbar\">\n <div style=\"margin-top: 20px;\">\n <mat-form-field style=\"width: 100%\">\n <mat-label>Search</mat-label>\n <input matInput [formControl]=\"searchControl\" (ngModelChange)=\"onSearchChange($event)\">\n </mat-form-field>\n </div>\n\n <div\n class=\"progress\"\n [hidden]=\"!loading\"\n >\n <mat-progress-spinner\n style=\"margin-left: 16px;\"\n [diameter]=20\n mode=\"indeterminate\"\n >\n </mat-progress-spinner>\n </div>\n\n <div #navcontainer class=\"navcontainer\"\n [@sideNavAnimation]=\"state\"\n >\n <mat-nav-list\n *ngFor=\"let container of entriesByMonthAndYear\"\n >\n <h3>{{getMonthAndYearFromKey(container.month_year)}}</h3>\n <a mat-list-item *ngFor=\"let entry of container.entries\" href=\"javascript:void(0)\" (click)=\"routeTo(entry)\">{{entry.title}}</a>\n </mat-nav-list>\n\n <a\n class=\"sidelink\"\n *ngIf=\"this?.response?.next && !loading\"\n (click)=\"getMore()\"\n href=\"javascript:void(0);\">More...</a>\n </div>\n <ng-container *ngIf=\"identity?.id === 1\">\n <h2>Misc</h2>\n\n <mat-nav-list>\n <a mat-list-item href=\"javascript:void(0);\" (click)=\"routeTo(null)\">Create</a>\n </mat-nav-list>\n </ng-container>\n <h3 *ngIf=\"identity\">Logged in as {{identity?.email}}</h3>\n</div>\n\n", styles: [".progress{position:absolute;top:100px;left:0}.sidelink{padding-left:16px}.sidenav{position:relative;max-height:calc(100vh - 100px)}@media screen and (max-height: 560px){.sidenav{max-height:100vh}}h2,h3{margin-left:10px;justify-content:right}\n"] }]
|
|
1590
|
-
}], ctorParameters: function () { return [{ type: EntryService }, { type: i1$4.Router }, { type: IdentityService }, { type: i0.Renderer2 }]; }, propDecorators: { divNav: [{
|
|
1591
|
-
type: ViewChild,
|
|
1592
|
-
args: ['navcontainer', { static: false }]
|
|
1593
|
-
}] } });
|
|
1594
|
-
|
|
1595
|
-
class MainComponent {
|
|
1596
|
-
constructor(router) {
|
|
1597
|
-
this.router = router;
|
|
1598
|
-
this.loaded = true;
|
|
1599
|
-
this.subs = new Subscription();
|
|
1600
|
-
this.resizeSubject = new Subject();
|
|
1601
|
-
}
|
|
1602
|
-
ngOnInit() {
|
|
1603
|
-
this.subs.add(this.router.events.subscribe((e) => {
|
|
1604
|
-
if (e instanceof NavigationEnd) {
|
|
1605
|
-
if (e.urlAfterRedirects.includes('create')) {
|
|
1606
|
-
this.showLeftCol = true;
|
|
1607
|
-
this.showRightCol = true;
|
|
1608
|
-
}
|
|
1609
|
-
else {
|
|
1610
|
-
this.showLeftCol = true;
|
|
1611
|
-
this.showRightCol = false;
|
|
1612
|
-
this.innerWidth = window.innerWidth;
|
|
1613
|
-
this.collapseLeftColIfTooNarrow();
|
|
1614
|
-
}
|
|
1615
|
-
}
|
|
1616
|
-
}));
|
|
1617
|
-
this.subs.add(this.resizeSubject.pipe(debounceTime(100)).subscribe((width) => {
|
|
1618
|
-
this.innerWidth = width;
|
|
1619
|
-
this.collapseLeftColIfTooNarrow();
|
|
1620
|
-
}));
|
|
1621
|
-
}
|
|
1622
|
-
collapseLeftColIfTooNarrow() {
|
|
1623
|
-
this.showLeftCol = this.innerWidth >= 800;
|
|
1624
|
-
}
|
|
1625
|
-
onResize(event) {
|
|
1626
|
-
this.resizeSubject.next(window.innerWidth);
|
|
1627
|
-
}
|
|
1628
|
-
ngOnDestroy() {
|
|
1629
|
-
this.subs.unsubscribe();
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
MainComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: MainComponent, deps: [{ token: i1$4.Router }], target: i0.ɵɵFactoryTarget.Component });
|
|
1633
|
-
MainComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: MainComponent, selector: "lib-main", host: { listeners: { "window:resize": "onResize($event)" } }, ngImport: i0, template: "<ng-container *ngIf=\"loaded\">\n <div class=\"container\">\n <div class=\"body\">\n <div class=\"container-row\">\n <mat-sidenav-container [autosize]=\"true\">\n <mat-sidenav [(opened)]=\"showLeftCol\" #leftcol opened mode=\"side\" class=\"left no-scrollbar\">\n <router-outlet name=\"left-col\"></router-outlet>\n <button mat-mini-fab color=\"primary\" class=\"fade left-toggle\" *ngIf=\"showLeftCol\" (click)=\"leftcol.toggle()\"> << </button>\n </mat-sidenav>\n <mat-sidenav [(opened)]=\"showRightCol\" #rightcol mode=\"side\" position=\"end\" class=\"right\">\n <button mat-mini-fab color=\"primary\" class=\"fade right-toggle\" *ngIf=\"showRightCol\" (click)=\"rightcol.toggle()\"> >> </button>\n <router-outlet name=\"right-col\"></router-outlet>\n </mat-sidenav>\n <div class=\"middle\">\n <button mat-mini-fab color=\"primary\" class=\"fade left-toggle\" *ngIf=\"!showLeftCol\" (click)=\"leftcol.toggle()\"> >> </button>\n <button mat-mini-fab color=\"primary\" class=\"fade right-toggle\" *ngIf=\"!showRightCol\" (click)=\"rightcol.toggle()\"> << </button>\n <router-outlet></router-outlet>\n </div>\n </mat-sidenav-container>\n </div>\n </div>\n </div>\n</ng-container>\n", styles: ["a{text-decoration:none}.body{flex-grow:1;max-height:calc(100vh - 100px);overflow:scroll}@media screen and (max-height: 560px){.body{max-height:100vh}}.left,.right{min-width:400px;max-width:33vw}.left-toggle{position:fixed;top:50%;left:5px;z-index:100}.right-toggle{position:fixed;top:50%;right:5px;z-index:100}a{margin-right:10px}a:not(:last-child):after{margin-left:10px;content:\"|\"}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$4.RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: i3$1.MatSidenav, selector: "mat-sidenav", inputs: ["fixedInViewport", "fixedTopGap", "fixedBottomGap"], exportAs: ["matSidenav"] }, { kind: "component", type: i3$1.MatSidenavContainer, selector: "mat-sidenav-container", exportAs: ["matSidenavContainer"] }, { kind: "component", type: i4.MatMiniFabButton, selector: "button[mat-mini-fab]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }] });
|
|
1634
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: MainComponent, decorators: [{
|
|
1635
|
-
type: Component,
|
|
1636
|
-
args: [{ selector: 'lib-main', template: "<ng-container *ngIf=\"loaded\">\n <div class=\"container\">\n <div class=\"body\">\n <div class=\"container-row\">\n <mat-sidenav-container [autosize]=\"true\">\n <mat-sidenav [(opened)]=\"showLeftCol\" #leftcol opened mode=\"side\" class=\"left no-scrollbar\">\n <router-outlet name=\"left-col\"></router-outlet>\n <button mat-mini-fab color=\"primary\" class=\"fade left-toggle\" *ngIf=\"showLeftCol\" (click)=\"leftcol.toggle()\"> << </button>\n </mat-sidenav>\n <mat-sidenav [(opened)]=\"showRightCol\" #rightcol mode=\"side\" position=\"end\" class=\"right\">\n <button mat-mini-fab color=\"primary\" class=\"fade right-toggle\" *ngIf=\"showRightCol\" (click)=\"rightcol.toggle()\"> >> </button>\n <router-outlet name=\"right-col\"></router-outlet>\n </mat-sidenav>\n <div class=\"middle\">\n <button mat-mini-fab color=\"primary\" class=\"fade left-toggle\" *ngIf=\"!showLeftCol\" (click)=\"leftcol.toggle()\"> >> </button>\n <button mat-mini-fab color=\"primary\" class=\"fade right-toggle\" *ngIf=\"!showRightCol\" (click)=\"rightcol.toggle()\"> << </button>\n <router-outlet></router-outlet>\n </div>\n </mat-sidenav-container>\n </div>\n </div>\n </div>\n</ng-container>\n", styles: ["a{text-decoration:none}.body{flex-grow:1;max-height:calc(100vh - 100px);overflow:scroll}@media screen and (max-height: 560px){.body{max-height:100vh}}.left,.right{min-width:400px;max-width:33vw}.left-toggle{position:fixed;top:50%;left:5px;z-index:100}.right-toggle{position:fixed;top:50%;right:5px;z-index:100}a{margin-right:10px}a:not(:last-child):after{margin-left:10px;content:\"|\"}\n"] }]
|
|
1637
|
-
}], ctorParameters: function () { return [{ type: i1$4.Router }]; }, propDecorators: { onResize: [{
|
|
1638
|
-
type: HostListener,
|
|
1639
|
-
args: ['window:resize', ['$event']]
|
|
1640
|
-
}] } });
|
|
1641
|
-
|
|
1642
|
-
class EntryRendererWrapperComponent {
|
|
1643
|
-
seeAll(toggle) {
|
|
1644
|
-
this.seeAllEntries = toggle;
|
|
1645
|
-
}
|
|
1646
|
-
constructor(entryService, router, route, viewService, interactionService) {
|
|
1647
|
-
this.entryService = entryService;
|
|
1648
|
-
this.router = router;
|
|
1649
|
-
this.route = route;
|
|
1650
|
-
this.viewService = viewService;
|
|
1651
|
-
this.interactionService = interactionService;
|
|
1652
|
-
this.seeAllEntries = false;
|
|
1653
|
-
}
|
|
1654
|
-
getEntry() {
|
|
1655
|
-
const slug = this.route.snapshot.paramMap.get('slug');
|
|
1656
|
-
if (slug) {
|
|
1657
|
-
this.entryService.getBySlug(slug).subscribe((response) => {
|
|
1658
|
-
this.currentEntry = response;
|
|
1659
|
-
const view = new View();
|
|
1660
|
-
view.entry = this.currentEntry.id;
|
|
1661
|
-
this.viewService.create(view).subscribe((viewResponse) => {
|
|
1662
|
-
// Noop
|
|
1663
|
-
});
|
|
1664
|
-
});
|
|
1665
|
-
}
|
|
1666
|
-
this.route.queryParams.subscribe(params => {
|
|
1667
|
-
const campaign = params['campaign'];
|
|
1668
|
-
if (campaign && campaign !== '') {
|
|
1669
|
-
const interaction = new Interaction();
|
|
1670
|
-
interaction.content = { 'campaign': campaign, slug };
|
|
1671
|
-
this.interactionService.create(interaction).subscribe((response) => {
|
|
1672
|
-
});
|
|
1673
|
-
setTimeout(() => {
|
|
1674
|
-
const urlMinsCampaign = this.router.url.replace(new RegExp('.campaign=' + campaign), '');
|
|
1675
|
-
this.router.navigateByUrl(urlMinsCampaign);
|
|
1676
|
-
}, 0);
|
|
1677
|
-
}
|
|
1678
|
-
});
|
|
1679
|
-
}
|
|
1680
|
-
ngOnInit() {
|
|
1681
|
-
this.routerSub = this.router.events.subscribe((e) => {
|
|
1682
|
-
if (e instanceof NavigationEnd) {
|
|
1683
|
-
this.currentEntry = null;
|
|
1684
|
-
this.seeAll(false);
|
|
1685
|
-
setTimeout(() => {
|
|
1686
|
-
this.getEntry();
|
|
1687
|
-
}, 10);
|
|
1688
|
-
}
|
|
1689
|
-
});
|
|
1690
|
-
this.getEntry();
|
|
1691
|
-
}
|
|
1692
|
-
ngOnDestroy() {
|
|
1693
|
-
if (this.routerSub) {
|
|
1694
|
-
this.routerSub.complete();
|
|
1695
|
-
this.routerSub = null;
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
}
|
|
1699
|
-
EntryRendererWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: EntryRendererWrapperComponent, deps: [{ token: EntryService }, { token: i1$4.Router }, { token: i1$4.ActivatedRoute }, { token: ViewService }, { token: InteractionService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1700
|
-
EntryRendererWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: EntryRendererWrapperComponent, selector: "lib-entry-renderer-wrapper", ngImport: i0, template: "<div class=\"rendered-entry section\">\n <app-entry-renderer *ngIf=\"currentEntry\" [entry]=\"currentEntry\"></app-entry-renderer>\n</div>\n", styles: [".rendered-entry{padding:0 20px}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: EntryRendererComponent, selector: "app-entry-renderer", inputs: ["entry", "editMode"] }] });
|
|
1701
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: EntryRendererWrapperComponent, decorators: [{
|
|
1702
|
-
type: Component,
|
|
1703
|
-
args: [{ selector: 'lib-entry-renderer-wrapper', template: "<div class=\"rendered-entry section\">\n <app-entry-renderer *ngIf=\"currentEntry\" [entry]=\"currentEntry\"></app-entry-renderer>\n</div>\n", styles: [".rendered-entry{padding:0 20px}\n"] }]
|
|
1704
|
-
}], ctorParameters: function () { return [{ type: EntryService }, { type: i1$4.Router }, { type: i1$4.ActivatedRoute }, { type: ViewService }, { type: InteractionService }]; } });
|
|
1705
|
-
|
|
1706
|
-
class LinkyPipe {
|
|
1707
|
-
transform(value, options) {
|
|
1708
|
-
return Autolinker.link(value, Object.assign({}, options, { newWindow: true, stripPrefix: false }));
|
|
1709
|
-
}
|
|
1710
|
-
}
|
|
1711
|
-
LinkyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: LinkyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1712
|
-
LinkyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: LinkyPipe, name: "linky" });
|
|
1713
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: LinkyPipe, decorators: [{
|
|
1714
|
-
type: Pipe,
|
|
1715
|
-
args: [{ name: 'linky' }]
|
|
1716
|
-
}] });
|
|
1717
|
-
|
|
1718
|
-
const routes = [
|
|
1719
|
-
{ path: '', component: SideNavigationComponent, outlet: 'left-col' },
|
|
1720
|
-
{
|
|
1721
|
-
path: 'landing',
|
|
1722
|
-
component: MainComponent
|
|
1723
|
-
},
|
|
1724
|
-
{ path: 'blog/:slug', component: EntryRendererWrapperComponent },
|
|
1725
|
-
{ path: 'create', component: EntryCreatorComponent },
|
|
1726
|
-
{ path: 'create', component: OutlineViewComponent, outlet: 'left-col' },
|
|
1727
|
-
{ path: 'create', component: JsonRendererComponent, outlet: 'right-col' },
|
|
1728
|
-
{ path: '', redirectTo: '/landing', pathMatch: 'full' },
|
|
1729
|
-
{ path: '**', redirectTo: '/404error' }
|
|
1730
|
-
];
|
|
1731
|
-
class Routes {
|
|
1732
|
-
constructor() {
|
|
1733
|
-
this.routes = routes;
|
|
1734
|
-
}
|
|
1735
|
-
}
|
|
1736
|
-
|
|
1737
|
-
class SchedulePublishDialogData {
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
class SchedulePublishDialogComponent {
|
|
1741
|
-
constructor(dialogRef, data) {
|
|
1742
|
-
this.dialogRef = dialogRef;
|
|
1743
|
-
this.data = data;
|
|
1744
|
-
}
|
|
1745
|
-
ngOnInit() {
|
|
1746
|
-
}
|
|
1747
|
-
onNoClick() {
|
|
1748
|
-
}
|
|
1749
|
-
onYesClick() {
|
|
1750
|
-
this.dialogRef.close('test');
|
|
1751
|
-
}
|
|
1752
|
-
}
|
|
1753
|
-
SchedulePublishDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: SchedulePublishDialogComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
|
|
1754
|
-
SchedulePublishDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: SchedulePublishDialogComponent, selector: "lib-schedule-publish-dialog", ngImport: i0, template: "<h1 mat-dialog-title>Select a Date and Time to Schedule This Post</h1>\n<!--<mat-radio-group aria-label=\"Select an option\">-->\n<!-- <mat-radio-button class=\"option\" value=\"unpublished\">Unpublished</mat-radio-button>-->\n<!-- <mat-radio-button class=\"option\" value=\"published\">Published</mat-radio-button>-->\n<!--</mat-radio-group>-->\n<p>Date</p>\n<mat-form-field appearance=\"fill\">\n <mat-label>Choose a date</mat-label>\n <input matInput [matDatepicker]=\"picker\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n</mat-form-field>\n<p>Time</p>\n<input [ngxTimepicker]=\"timepicker\" readonly>\n<ngx-material-timepicker #timepicker></ngx-material-timepicker>\n<div mat-dialog-actions>\n <button mat-button (click)=\"onNoClick()\">Cancel</button>\n <button mat-button (click)=\"onYesClick()\" cdkFocusInitial>Schedule Publish</button>\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i9.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i10.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i10.MatLabel, selector: "mat-label" }, { kind: "directive", type: i10.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i17.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i17.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i17.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: i6$2.NgxMaterialTimepickerComponent, selector: "ngx-material-timepicker", inputs: ["ESC", "hoursOnly", "ngxMaterialTimepickerTheme", "format", "minutesGap", "cancelBtnTmpl", "editableHintTmpl", "confirmBtnTmpl", "enableKeyboardInput", "preventOverlayClick", "disableAnimation", "appendToInput", "defaultTime", "timepickerClass", "theme", "min", "max"], outputs: ["timeSet", "opened", "closed", "hourSelected", "timeChanged"] }, { kind: "directive", type: i6$2.TimepickerDirective, selector: "[ngxTimepicker]", inputs: ["format", "value", "min", "max", "ngxTimepicker", "disabled", "disableClick"] }] });
|
|
1755
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: SchedulePublishDialogComponent, decorators: [{
|
|
1756
|
-
type: Component,
|
|
1757
|
-
args: [{ selector: 'lib-schedule-publish-dialog', template: "<h1 mat-dialog-title>Select a Date and Time to Schedule This Post</h1>\n<!--<mat-radio-group aria-label=\"Select an option\">-->\n<!-- <mat-radio-button class=\"option\" value=\"unpublished\">Unpublished</mat-radio-button>-->\n<!-- <mat-radio-button class=\"option\" value=\"published\">Published</mat-radio-button>-->\n<!--</mat-radio-group>-->\n<p>Date</p>\n<mat-form-field appearance=\"fill\">\n <mat-label>Choose a date</mat-label>\n <input matInput [matDatepicker]=\"picker\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker #picker></mat-datepicker>\n</mat-form-field>\n<p>Time</p>\n<input [ngxTimepicker]=\"timepicker\" readonly>\n<ngx-material-timepicker #timepicker></ngx-material-timepicker>\n<div mat-dialog-actions>\n <button mat-button (click)=\"onNoClick()\">Cancel</button>\n <button mat-button (click)=\"onYesClick()\" cdkFocusInitial>Schedule Publish</button>\n</div>\n" }]
|
|
1758
|
-
}], ctorParameters: function () { return [{ type: i1$2.MatDialogRef }, { type: SchedulePublishDialogData, decorators: [{
|
|
1759
|
-
type: Inject,
|
|
1760
|
-
args: [MAT_DIALOG_DATA]
|
|
1761
|
-
}] }]; } });
|
|
1762
|
-
|
|
1763
|
-
class CoreModule {
|
|
1764
|
-
constructor(library) {
|
|
1765
|
-
this.library = library;
|
|
1766
|
-
this.library.addIcons(faSpinner);
|
|
1767
|
-
}
|
|
1768
|
-
}
|
|
1769
|
-
CoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: CoreModule, deps: [{ token: i1$3.FaIconLibrary }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1770
|
-
CoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: CoreModule, declarations: [EntryRendererComponent,
|
|
1771
|
-
EntryCreatorComponent,
|
|
1772
|
-
LandingPageComponent,
|
|
1773
|
-
SideNavigationComponent,
|
|
1774
|
-
OutlineViewComponent,
|
|
1775
|
-
JsonRendererComponent,
|
|
1776
|
-
EntrySummaryComponent,
|
|
1777
|
-
EntrySelectorDialogComponent,
|
|
1778
|
-
MediaUploadModalComponent,
|
|
1779
|
-
TimeAgoPipe,
|
|
1780
|
-
LinkyPipe,
|
|
1781
|
-
StaticHtmlComponent,
|
|
1782
|
-
MainComponent,
|
|
1783
|
-
EntryRendererWrapperComponent,
|
|
1784
|
-
SchedulePublishDialogComponent], imports: [CommonModule,
|
|
1785
|
-
RouterModule,
|
|
1786
|
-
FormsModule,
|
|
1787
|
-
ReactiveFormsModule,
|
|
1788
|
-
DragDropModule,
|
|
1789
|
-
MatCardModule,
|
|
1790
|
-
MatSidenavModule,
|
|
1791
|
-
MatButtonModule,
|
|
1792
|
-
MatInputModule,
|
|
1793
|
-
MatListModule,
|
|
1794
|
-
MatRadioModule,
|
|
1795
|
-
MatDialogModule,
|
|
1796
|
-
MatCheckboxModule,
|
|
1797
|
-
MatDividerModule,
|
|
1798
|
-
MatAutocompleteModule,
|
|
1799
|
-
MatChipsModule,
|
|
1800
|
-
MatIconModule,
|
|
1801
|
-
MatDatepickerModule,
|
|
1802
|
-
MatNativeDateModule,
|
|
1803
|
-
MatTableModule,
|
|
1804
|
-
MatProgressSpinnerModule,
|
|
1805
|
-
FontAwesomeModule,
|
|
1806
|
-
FileUploadModule,
|
|
1807
|
-
NgxMaterialTimepickerModule], exports: [EntryRendererComponent,
|
|
1808
|
-
EntryCreatorComponent,
|
|
1809
|
-
LandingPageComponent,
|
|
1810
|
-
SideNavigationComponent,
|
|
1811
|
-
OutlineViewComponent,
|
|
1812
|
-
JsonRendererComponent,
|
|
1813
|
-
EntrySummaryComponent,
|
|
1814
|
-
EntrySelectorDialogComponent,
|
|
1815
|
-
MediaUploadModalComponent,
|
|
1816
|
-
TimeAgoPipe,
|
|
1817
|
-
LinkyPipe,
|
|
1818
|
-
StaticHtmlComponent,
|
|
1819
|
-
MainComponent,
|
|
1820
|
-
EntryRendererWrapperComponent] });
|
|
1821
|
-
CoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: CoreModule, providers: [
|
|
1822
|
-
CommentService,
|
|
1823
|
-
EntryService,
|
|
1824
|
-
UploadService,
|
|
1825
|
-
PrismService,
|
|
1826
|
-
IdentityService,
|
|
1827
|
-
DjangoRestFrameworkEndpointService,
|
|
1828
|
-
TagService,
|
|
1829
|
-
], imports: [CommonModule,
|
|
1830
|
-
RouterModule,
|
|
1831
|
-
FormsModule,
|
|
1832
|
-
ReactiveFormsModule,
|
|
1833
|
-
DragDropModule,
|
|
1834
|
-
MatCardModule,
|
|
1835
|
-
MatSidenavModule,
|
|
1836
|
-
MatButtonModule,
|
|
1837
|
-
MatInputModule,
|
|
1838
|
-
MatListModule,
|
|
1839
|
-
MatRadioModule,
|
|
1840
|
-
MatDialogModule,
|
|
1841
|
-
MatCheckboxModule,
|
|
1842
|
-
MatDividerModule,
|
|
1843
|
-
MatAutocompleteModule,
|
|
1844
|
-
MatChipsModule,
|
|
1845
|
-
MatIconModule,
|
|
1846
|
-
MatDatepickerModule,
|
|
1847
|
-
MatNativeDateModule,
|
|
1848
|
-
MatTableModule,
|
|
1849
|
-
MatProgressSpinnerModule,
|
|
1850
|
-
FontAwesomeModule,
|
|
1851
|
-
FileUploadModule,
|
|
1852
|
-
NgxMaterialTimepickerModule] });
|
|
1853
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: CoreModule, decorators: [{
|
|
1854
|
-
type: NgModule,
|
|
1855
|
-
args: [{
|
|
1856
|
-
declarations: [
|
|
1857
|
-
EntryRendererComponent,
|
|
1858
|
-
EntryCreatorComponent,
|
|
1859
|
-
LandingPageComponent,
|
|
1860
|
-
SideNavigationComponent,
|
|
1861
|
-
OutlineViewComponent,
|
|
1862
|
-
JsonRendererComponent,
|
|
1863
|
-
EntrySummaryComponent,
|
|
1864
|
-
EntrySelectorDialogComponent,
|
|
1865
|
-
MediaUploadModalComponent,
|
|
1866
|
-
TimeAgoPipe,
|
|
1867
|
-
LinkyPipe,
|
|
1868
|
-
StaticHtmlComponent,
|
|
1869
|
-
MainComponent,
|
|
1870
|
-
EntryRendererWrapperComponent,
|
|
1871
|
-
SchedulePublishDialogComponent,
|
|
1872
|
-
],
|
|
1873
|
-
imports: [
|
|
1874
|
-
CommonModule,
|
|
1875
|
-
RouterModule,
|
|
1876
|
-
FormsModule,
|
|
1877
|
-
ReactiveFormsModule,
|
|
1878
|
-
DragDropModule,
|
|
1879
|
-
MatCardModule,
|
|
1880
|
-
MatSidenavModule,
|
|
1881
|
-
MatButtonModule,
|
|
1882
|
-
MatInputModule,
|
|
1883
|
-
MatListModule,
|
|
1884
|
-
MatRadioModule,
|
|
1885
|
-
MatDialogModule,
|
|
1886
|
-
MatCheckboxModule,
|
|
1887
|
-
MatDividerModule,
|
|
1888
|
-
MatAutocompleteModule,
|
|
1889
|
-
MatChipsModule,
|
|
1890
|
-
MatIconModule,
|
|
1891
|
-
MatDatepickerModule,
|
|
1892
|
-
MatNativeDateModule,
|
|
1893
|
-
MatTableModule,
|
|
1894
|
-
MatProgressSpinnerModule,
|
|
1895
|
-
FontAwesomeModule,
|
|
1896
|
-
FileUploadModule,
|
|
1897
|
-
NgxMaterialTimepickerModule,
|
|
1898
|
-
],
|
|
1899
|
-
providers: [
|
|
1900
|
-
CommentService,
|
|
1901
|
-
EntryService,
|
|
1902
|
-
UploadService,
|
|
1903
|
-
PrismService,
|
|
1904
|
-
IdentityService,
|
|
1905
|
-
DjangoRestFrameworkEndpointService,
|
|
1906
|
-
TagService,
|
|
1907
|
-
],
|
|
1908
|
-
exports: [
|
|
1909
|
-
EntryRendererComponent,
|
|
1910
|
-
EntryCreatorComponent,
|
|
1911
|
-
LandingPageComponent,
|
|
1912
|
-
SideNavigationComponent,
|
|
1913
|
-
OutlineViewComponent,
|
|
1914
|
-
JsonRendererComponent,
|
|
1915
|
-
EntrySummaryComponent,
|
|
1916
|
-
EntrySelectorDialogComponent,
|
|
1917
|
-
MediaUploadModalComponent,
|
|
1918
|
-
TimeAgoPipe,
|
|
1919
|
-
LinkyPipe,
|
|
1920
|
-
StaticHtmlComponent,
|
|
1921
|
-
MainComponent,
|
|
1922
|
-
EntryRendererWrapperComponent,
|
|
1923
|
-
]
|
|
1924
|
-
}]
|
|
1925
|
-
}], ctorParameters: function () { return [{ type: i1$3.FaIconLibrary }]; } });
|
|
1926
|
-
|
|
1927
|
-
/*
|
|
1928
|
-
* Public API Surface of core
|
|
1929
|
-
*/
|
|
1930
|
-
|
|
1931
|
-
/**
|
|
1932
|
-
* Generated bundle index. Do not edit.
|
|
1933
|
-
*/
|
|
1934
|
-
|
|
1935
|
-
export { Base, CommentService, Content, ContentType, CoreEvent, CoreEventType, CoreModule, DjangoRestFrameworkEndpointService, Entry, EntryCreatorComponent, EntryRendererComponent, EntryRendererWrapperComponent, EntrySelectorDialogComponent, EntryService, EntrySummaryComponent, Guid, IdentityService, Interaction, InteractionService, JsonRendererComponent, LandingPageComponent, LinkyPipe, ListResponse, MainComponent, MediaUploadModalComponent, OutlineViewComponent, PrismService, Routes, Section, SideNavigationComponent, StaticHtmlComponent, StaticHtmlService, TagService, TimeAgoPipe, Upload, UploadService, View, ViewService, VisitorProfile, VisitorProfileService };
|
|
1936
|
-
//# sourceMappingURL=thecodeblogs-blog.mjs.map
|