aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-22 10:22:53 +0100
committerChocobozzz <me@florianbigard.com>2018-02-22 10:22:53 +0100
commit00b5556c182fa70dfca17c517488b8afae6257c9 (patch)
tree853ad8d85572b5b37b1956fea96a51fed211453f /client/src/app/+admin
parent6221f311de0eb8f2a9e7e4a77b8cb0ecbde6dfcd (diff)
downloadPeerTube-00b5556c182fa70dfca17c517488b8afae6257c9.tar.gz
PeerTube-00b5556c182fa70dfca17c517488b8afae6257c9.tar.zst
PeerTube-00b5556c182fa70dfca17c517488b8afae6257c9.zip
Add ability to add custom css/javascript
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html24
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss6
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts18
3 files changed, 44 insertions, 4 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
index 0fe2aa203..8dca9bc04 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
@@ -128,5 +128,29 @@
128 </div> 128 </div>
129 </ng-template> 129 </ng-template>
130 130
131 <div class="inner-form-title">Customizations</div>
132
133 <div class="form-group">
134 <label for="customizationJavascript">JavaScript</label>
135 <textarea
136 id="customizationJavascript" formControlName="customizationJavascript"
137 [ngClass]="{ 'input-error': formErrors['customizationJavascript'] }"
138 ></textarea>
139 <div *ngIf="formErrors.customizationJavascript" class="form-error">
140 {{ formErrors.customizationJavascript }}
141 </div>
142 </div>
143
144 <div class="form-group">
145 <label for="customizationCSS">CSS</label>
146 <textarea
147 id="customizationCSS" formControlName="customizationCSS"
148 [ngClass]="{ 'input-error': formErrors['customizationCSS'] }"
149 ></textarea>
150 <div *ngIf="formErrors.customizationCSS" class="form-error">
151 {{ formErrors.customizationCSS }}
152 </div>
153 </div>
154
131 <input type="submit" value="Update configuration" [disabled]="!form.valid"> 155 <input type="submit" value="Update configuration" [disabled]="!form.valid">
132</form> 156</form>
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss
index 0195f44eb..e72f30c69 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss
@@ -29,3 +29,9 @@ input[type=submit] {
29 margin-top: 30px; 29 margin-top: 30px;
30 margin-bottom: 10px; 30 margin-bottom: 10px;
31} 31}
32
33textarea {
34 @include peertube-textarea(500px, 150px);
35
36 display: block;
37}
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
index cd8c926f7..027268536 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
@@ -49,7 +49,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
49 signupLimit: '', 49 signupLimit: '',
50 adminEmail: '', 50 adminEmail: '',
51 userVideoQuota: '', 51 userVideoQuota: '',
52 transcodingThreads: '' 52 transcodingThreads: '',
53 customizationJavascript: '',
54 customizationCSS: ''
53 } 55 }
54 validationMessages = { 56 validationMessages = {
55 instanceName: INSTANCE_NAME.MESSAGES, 57 instanceName: INSTANCE_NAME.MESSAGES,
@@ -84,7 +86,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
84 adminEmail: [ '', ADMIN_EMAIL.VALIDATORS ], 86 adminEmail: [ '', ADMIN_EMAIL.VALIDATORS ],
85 userVideoQuota: [ '', USER_VIDEO_QUOTA.VALIDATORS ], 87 userVideoQuota: [ '', USER_VIDEO_QUOTA.VALIDATORS ],
86 transcodingThreads: [ '', TRANSCODING_THREADS.VALIDATORS ], 88 transcodingThreads: [ '', TRANSCODING_THREADS.VALIDATORS ],
87 transcodingEnabled: [ ] 89 transcodingEnabled: [ ],
90 customizationJavascript: [ '' ],
91 customizationCSS: [ '' ]
88 } 92 }
89 93
90 for (const resolution of this.resolutions) { 94 for (const resolution of this.resolutions) {
@@ -125,7 +129,11 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
125 instance: { 129 instance: {
126 name: this.form.value['instanceName'], 130 name: this.form.value['instanceName'],
127 description: this.form.value['instanceDescription'], 131 description: this.form.value['instanceDescription'],
128 terms: this.form.value['instanceTerms'] 132 terms: this.form.value['instanceTerms'],
133 customizations: {
134 javascript: this.form.value['customizationJavascript'],
135 css: this.form.value['customizationCSS']
136 }
129 }, 137 },
130 cache: { 138 cache: {
131 previews: { 139 previews: {
@@ -183,7 +191,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
183 adminEmail: this.customConfig.admin.email, 191 adminEmail: this.customConfig.admin.email,
184 userVideoQuota: this.customConfig.user.videoQuota, 192 userVideoQuota: this.customConfig.user.videoQuota,
185 transcodingThreads: this.customConfig.transcoding.threads, 193 transcodingThreads: this.customConfig.transcoding.threads,
186 transcodingEnabled: this.customConfig.transcoding.enabled 194 transcodingEnabled: this.customConfig.transcoding.enabled,
195 customizationJavascript: this.customConfig.instance.customizations.javascript,
196 customizationCSS: this.customConfig.instance.customizations.css
187 } 197 }
188 198
189 for (const resolution of this.resolutions) { 199 for (const resolution of this.resolutions) {