]> BookStack Code Mirror - bookstack/commitdiff
Merge pull request #103 from ssddanbrown/add_role_view_permissions
authorDan Brown <redacted>
Sun, 1 May 2016 21:47:22 +0000 (22:47 +0100)
committerDan Brown <redacted>
Sun, 1 May 2016 21:47:22 +0000 (22:47 +0100)
Overhauled permission system and stripped migrations of most app code to reduce future breakages. Closes #101.

resources/assets/js/directives.js
resources/assets/js/pages/page-form.js
resources/assets/sass/_forms.scss
resources/views/settings/index.blade.php

index de87950dc6662fa55dfdc88a17e51b655fd21885..97d8a89e293fe9055b6ba843b342ba860b34383b 100644 (file)
@@ -15,7 +15,7 @@ module.exports = function (ngApp, events) {
      */
     ngApp.directive('toggleSwitch', function () {
         return {
-            restrict: 'E',
+            restrict: 'A',
             template: toggleSwitchTemplate,
             scope: true,
             link: function (scope, element, attrs) {
@@ -198,6 +198,30 @@ module.exports = function (ngApp, events) {
                 }
 
                 scope.tinymce.extraSetups.push(tinyMceSetup);
+
+                // Custom tinyMCE plugins
+                tinymce.PluginManager.add('customhr', function(editor) {
+                    editor.addCommand('InsertHorizontalRule', function() {
+                        var hrElem = document.createElement('hr');
+                        var cNode = editor.selection.getNode();
+                        var parentNode = cNode.parentNode;
+                        parentNode.insertBefore(hrElem, cNode);
+                    });
+
+                    editor.addButton('hr', {
+                        icon: 'hr',
+                        tooltip: 'Horizontal line',
+                        cmd: 'InsertHorizontalRule'
+                    });
+
+                    editor.addMenuItem('hr', {
+                        icon: 'hr',
+                        text: 'Horizontal line',
+                        cmd: 'InsertHorizontalRule',
+                        context: 'insert'
+                    });
+                });
+
                 tinymce.init(scope.tinymce);
             }
         }
index de7b3e687f181d6833669d45ccec1d8e6ebbaabd..5617fa5be98b6ce8b8d2d448b1c1e1a151cfaccd 100644 (file)
@@ -11,7 +11,7 @@ var mceOptions = module.exports = {
     extended_valid_elements: 'pre[*]',
     automatic_uploads: false,
     valid_children: "-div[p|pre|h1|h2|h3|h4|h5|h6|blockquote]",
-    plugins: "image table textcolor paste link fullscreen imagetools code hr autosave lists",
+    plugins: "image table textcolor paste link fullscreen imagetools code customhr autosave lists",
     imagetools_toolbar: 'imageoptions',
     toolbar: "undo redo | styleselect | bold italic underline strikethrough superscript subscript | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image-insert link hr | removeformat code fullscreen",
     content_style: "body {padding-left: 15px !important; padding-right: 15px !important; margin:0!important; margin-left:auto!important;margin-right:auto!important;}",
index 4a505c5f857b755761de1a99ccbb86fa09b7ee0e..482cf54bd8720e0f10fa11025e2ed54c023d5a58 100644 (file)
@@ -248,4 +248,9 @@ div[editor-type="markdown"] .title-input.page-title input[type="text"] {
 
 .image-picker img {
   background-color: #BBB;
+}
+
+div[toggle-switch] {
+  height: 18px;
+  width: 150px;
 }
\ No newline at end of file
index 4697d34674d4d299a13aa81538cb6f76e0e72b34..ce7a8d5d14acec3a0d531e0c731c759ffe08ed14 100644 (file)
                 </div>
                 <div class="form-group">
                     <label>Allow public viewing?</label>
-                    <toggle-switch name="setting-app-public" value="{{ setting('app-public') }}"></toggle-switch>
+                    <div toggle-switch name="setting-app-public" value="{{ setting('app-public') }}"></div>
                 </div>
                 <div class="form-group">
                     <label>Enable higher security image uploads?</label>
                     <p class="small">For performance reasons, all images are public by default, This option adds a random, hard-to-guess characters in front of image names. Ensure directory indexes are not enabled to prevent easy access.</p>
-                    <toggle-switch name="setting-app-secure-images" value="{{ setting('app-secure-images') }}"></toggle-switch>
+                    <div toggle-switch name="setting-app-secure-images" value="{{ setting('app-secure-images') }}"></div>
                 </div>
                 <div class="form-group">
                     <label for="setting-app-editor">Page editor</label>
@@ -61,7 +61,7 @@
             <div class="col-md-6">
                 <div class="form-group">
                     <label for="setting-registration-enabled">Allow registration?</label>
-                    <toggle-switch name="setting-registration-enabled" value="{{ setting('registration-enabled') }}"></toggle-switch>
+                    <div toggle-switch name="setting-registration-enabled" value="{{ setting('registration-enabled') }}"></div>
                 </div>
                 <div class="form-group">
                     <label for="setting-registration-role">Default user role after registration</label>
@@ -78,7 +78,7 @@
                 <div class="form-group">
                     <label for="setting-registration-confirmation">Require email confirmation?</label>
                     <p class="small">If domain restriction is used then email confirmation will be required and the below value will be ignored.</p>
-                    <toggle-switch name="setting-registration-confirmation" value="{{ setting('registration-confirmation') }}"></toggle-switch>
+                    <div toggle-switch name="setting-registration-confirmation" value="{{ setting('registration-confirmation') }}"></div>
                 </div>
             </div>
             <div class="col-md-6">