Skip to content

Commit

Permalink
add customizable footer content #980
Browse files Browse the repository at this point in the history
  • Loading branch information
dularion committed May 13, 2020
1 parent 7a811d2 commit c8bc877
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 6 deletions.
Expand Up @@ -124,11 +124,6 @@ angular.module('streama').controller('dashCtrl',
alertify.alert('You need to fill out some required base-settings. You will be redirected to the settings page now.', function () {
$state.go('settings.settings');
});
}else{
apiService.settings.checkImageIntegrity().then(function (imageIntegrityResponse) {
var imageIntegrityResult = imageIntegrityResponse.data;
console.log('%c imageIntegrityResult', 'color: deeppink; font-weight: bold; text-shadow: 0 0 5px deeppink;', imageIntegrityResult);
});
}
});
return settingsPromise;
Expand Down
@@ -0,0 +1,41 @@
//= wrapped

angular.module('streama')
.directive('streamaWysiwyg', function () {
return {
require: 'ngModel',
restrict: 'E',
template: '<div class="quill-editor"></div>',
scope: {
},
link: function ($scope, $elem, $attrs, $ctrl) {

var toolbarOptions = [
['bold', 'italic', 'underline'], // toggled buttons
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
[{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
[{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme
[{ 'font': [] }],
[{ 'align': [] }],
['clean'] // remove formatting button
];

$ctrl.$render = render;
var quill = new Quill($elem[0], {
theme: 'bubble',
modules: {
toolbar: toolbarOptions
}
});
quill.on('text-change', onTextChange);

function onTextChange(delta, oldDelta, source) {
$ctrl.$setViewValue(quill.root.innerHTML);
}

function render() {
quill.root.innerHTML = $ctrl.$modelValue;
}
}
}
});
6 changes: 6 additions & 0 deletions grails-app/assets/javascripts/streama/services/filters.js
Expand Up @@ -32,6 +32,12 @@ angular.module('streama').filter('trustResourceUrl', ['$sce', function($sce) {
};
}]);

angular.module('streama').filter('trustHtml', ['$sce', function($sce) {
return function(input) {
return $sce.trustAsHtml(input);
};
}]);


function pad(n, width, z) {
z = z || '0';
Expand Down
Expand Up @@ -44,6 +44,9 @@ <h1>
<div ng-switch-when="integer" class="col-sm-2">
<input type="text" class="form-control" ng-model="setting.value" />
</div>
<div ng-switch-when="wysiwyg" class="col-md-6">
<streama-wysiwyg ng-model="setting.value"></streama-wysiwyg>
</div>
<div ng-switch-when="fileUpload" class="col-sm-7">
<div class="row">
<div class="col-md-6">
Expand Down
8 changes: 7 additions & 1 deletion grails-app/assets/stylesheets/_misc.scss
Expand Up @@ -34,4 +34,10 @@
background-color: darken($primary, 50%);
}


streama-wysiwyg{
display: block;
background: rgba(255, 255, 255, 0.07);
}
.ql-bubble .ql-tooltip {
z-index: 999;
}
9 changes: 9 additions & 0 deletions grails-app/services/streama/DefaultDataService.groovy
Expand Up @@ -223,6 +223,15 @@ class DefaultDataService {
value: 'false',
required: false,
validationRequired: false
],
[
settingsKey: 'Footer Content',
name: 'footer-content',
description: 'HTML Content for the Footer',
settingsType: 'wysiwyg',
value: '',
required: false,
validationRequired: false
],
// [
// settingsKey: 'Remove Source After Convert',
Expand Down
3 changes: 3 additions & 0 deletions grails-app/views/index.gsp
Expand Up @@ -13,6 +13,8 @@
}
</style>

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

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

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

Expand Down
2 changes: 2 additions & 0 deletions grails-app/views/templates/_footer.gsp
Expand Up @@ -3,4 +3,6 @@
<g:if test="${streama.Settings.findByName('show_version_num').value == 'true'}">
<div class="version">v${grailsApplication.metadata.getApplicationVersion()}</div>
</g:if>

<div ng-bind-html="$root.getSetting('footer-content').parsedValue | trustHtml"></div>
</div>

0 comments on commit c8bc877

Please sign in to comment.