Skip to content

Commit c8bc877

Browse files
author
dularion
committed
add customizable footer content #980
1 parent 7a811d2 commit c8bc877

File tree

8 files changed

+71
-6
lines changed

8 files changed

+71
-6
lines changed

grails-app/assets/javascripts/streama/controllers/dash-ctrl.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,6 @@ angular.module('streama').controller('dashCtrl',
124124
alertify.alert('You need to fill out some required base-settings. You will be redirected to the settings page now.', function () {
125125
$state.go('settings.settings');
126126
});
127-
}else{
128-
apiService.settings.checkImageIntegrity().then(function (imageIntegrityResponse) {
129-
var imageIntegrityResult = imageIntegrityResponse.data;
130-
console.log('%c imageIntegrityResult', 'color: deeppink; font-weight: bold; text-shadow: 0 0 5px deeppink;', imageIntegrityResult);
131-
});
132127
}
133128
});
134129
return settingsPromise;
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//= wrapped
2+
3+
angular.module('streama')
4+
.directive('streamaWysiwyg', function () {
5+
return {
6+
require: 'ngModel',
7+
restrict: 'E',
8+
template: '<div class="quill-editor"></div>',
9+
scope: {
10+
},
11+
link: function ($scope, $elem, $attrs, $ctrl) {
12+
13+
var toolbarOptions = [
14+
['bold', 'italic', 'underline'], // toggled buttons
15+
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
16+
[{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
17+
[{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme
18+
[{ 'font': [] }],
19+
[{ 'align': [] }],
20+
['clean'] // remove formatting button
21+
];
22+
23+
$ctrl.$render = render;
24+
var quill = new Quill($elem[0], {
25+
theme: 'bubble',
26+
modules: {
27+
toolbar: toolbarOptions
28+
}
29+
});
30+
quill.on('text-change', onTextChange);
31+
32+
function onTextChange(delta, oldDelta, source) {
33+
$ctrl.$setViewValue(quill.root.innerHTML);
34+
}
35+
36+
function render() {
37+
quill.root.innerHTML = $ctrl.$modelValue;
38+
}
39+
}
40+
}
41+
});

grails-app/assets/javascripts/streama/services/filters.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ angular.module('streama').filter('trustResourceUrl', ['$sce', function($sce) {
3232
};
3333
}]);
3434

35+
angular.module('streama').filter('trustHtml', ['$sce', function($sce) {
36+
return function(input) {
37+
return $sce.trustAsHtml(input);
38+
};
39+
}]);
40+
3541

3642
function pad(n, width, z) {
3743
z = z || '0';

grails-app/assets/javascripts/streama/templates/settings-settings.tpl.htm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ <h1>
4444
<div ng-switch-when="integer" class="col-sm-2">
4545
<input type="text" class="form-control" ng-model="setting.value" />
4646
</div>
47+
<div ng-switch-when="wysiwyg" class="col-md-6">
48+
<streama-wysiwyg ng-model="setting.value"></streama-wysiwyg>
49+
</div>
4750
<div ng-switch-when="fileUpload" class="col-sm-7">
4851
<div class="row">
4952
<div class="col-md-6">

grails-app/assets/stylesheets/_misc.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,10 @@
3434
background-color: darken($primary, 50%);
3535
}
3636

37-
37+
streama-wysiwyg{
38+
display: block;
39+
background: rgba(255, 255, 255, 0.07);
40+
}
41+
.ql-bubble .ql-tooltip {
42+
z-index: 999;
43+
}

grails-app/services/streama/DefaultDataService.groovy

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,15 @@ class DefaultDataService {
223223
value: 'false',
224224
required: false,
225225
validationRequired: false
226+
],
227+
[
228+
settingsKey: 'Footer Content',
229+
name: 'footer-content',
230+
description: 'HTML Content for the Footer',
231+
settingsType: 'wysiwyg',
232+
value: '',
233+
required: false,
234+
validationRequired: false
226235
],
227236
// [
228237
// settingsKey: 'Remove Source After Convert',

grails-app/views/index.gsp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
}
1414
</style>
1515

16+
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
17+
<link rel="stylesheet" href="//cdn.quilljs.com/1.3.6/quill.bubble.css">
1618
<asset:stylesheet src="vendor.css"/>
1719
<asset:stylesheet src="application.css"/>
1820
<g:linkRelIconSetting setting="${Settings.findByName('favicon').value}"></g:linkRelIconSetting>
@@ -40,6 +42,7 @@
4042

4143
<g:render template="/templates/footer"></g:render>
4244

45+
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
4346
<asset:javascript src="vendor.js" />
4447
<asset:javascript src="streama/streama.js" />
4548

grails-app/views/templates/_footer.gsp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
<g:if test="${streama.Settings.findByName('show_version_num').value == 'true'}">
44
<div class="version">v${grailsApplication.metadata.getApplicationVersion()}</div>
55
</g:if>
6+
7+
<div ng-bind-html="$root.getSetting('footer-content').parsedValue | trustHtml"></div>
68
</div>

0 commit comments

Comments
 (0)