]> BookStack Code Mirror - bookstack/blob - resources/views/pages/form-toolbox.blade.php
Added basic attachment editing functionality
[bookstack] / resources / views / pages / form-toolbox.blade.php
1
2 <div toolbox class="floating-toolbox">
3
4     <div class="tabs primary-background-light">
5         <span toolbox-toggle><i class="zmdi zmdi-caret-left-circle"></i></span>
6         <span tab-button="tags" title="Page Tags" class="active"><i class="zmdi zmdi-tag"></i></span>
7         @if(userCan('file-create-all'))
8             <span tab-button="files" title="Attachments"><i class="zmdi zmdi-attachment"></i></span>
9         @endif
10     </div>
11
12     <div tab-content="tags" ng-controller="PageTagController" page-id="{{ $page->id or 0 }}">
13         <h4>Page Tags</h4>
14         <div class="padded tags">
15             <p class="muted small">Add some tags to better categorise your content. <br> You can assign a value to a tag for more in-depth organisation.</p>
16             <table class="no-style" tag-autosuggestions style="width: 100%;">
17                 <tbody ui-sortable="sortOptions" ng-model="tags" >
18                     <tr ng-repeat="tag in tags track by $index">
19                         <td width="20" ><i class="handle zmdi zmdi-menu"></i></td>
20                         <td><input autosuggest="{{ baseUrl('/ajax/tags/suggest/names') }}" autosuggest-type="name" class="outline" ng-attr-name="tags[@{{$index}}][name]" type="text" ng-model="tag.name" ng-change="tagChange(tag)" ng-blur="tagBlur(tag)" placeholder="Tag"></td>
21                         <td><input autosuggest="{{ baseUrl('/ajax/tags/suggest/values') }}" autosuggest-type="value" class="outline" ng-attr-name="tags[@{{$index}}][value]" type="text" ng-model="tag.value" ng-change="tagChange(tag)" ng-blur="tagBlur(tag)" placeholder="Tag Value (Optional)"></td>
22                         <td width="10" ng-show="tags.length != 1" class="text-center text-neg" style="padding: 0;" ng-click="removeTag(tag)"><i class="zmdi zmdi-close"></i></td>
23                     </tr>
24                 </tbody>
25             </table>
26             <table class="no-style" style="width: 100%;">
27                 <tbody>
28                 <tr class="unsortable">
29                     <td  width="34"></td>
30                     <td ng-click="addEmptyTag()">
31                         <button type="button" class="text-button">Add another tag</button>
32                     </td>
33                     <td></td>
34                 </tr>
35                 </tbody>
36             </table>
37         </div>
38     </div>
39
40     @if(userCan('file-create-all'))
41         <div tab-content="files" ng-controller="PageAttachmentController" page-id="{{ $page->id or 0 }}">
42             <h4>Attached Files</h4>
43             <div class="padded files">
44
45                 <div id="file-list" ng-show="!editFile">
46                     <p class="muted small">Upload some files to display on your page. This are visible in the page sidebar.</p>
47                     <drop-zone upload-url="@{{getUploadUrl()}}" uploaded-to="@{{uploadedTo}}" event-success="uploadSuccess"></drop-zone>
48
49                     <hr class="even">
50
51                     <div class="form-group">
52                         <label for="attachment-via-link">File Name</label>
53                         <input type="text" placeholder="File name" ng-model="file.name">
54                     </div>
55                     <div class="form-group">
56                         <label for="attachment-via-link">Link to file</label>
57                         <input type="text" placeholder="File url" ng-model="file.link">
58                     </div>
59                     <button type="button" ng-click="attachLinkSubmit(file)" class="button pos">Attach</button>
60
61
62                     <table class="no-style" tag-autosuggestions style="width: 100%;">
63                         <tbody ui-sortable="sortOptions" ng-model="files" >
64                         <tr ng-repeat="file in files track by $index">
65                             <td width="20" ><i class="handle zmdi zmdi-menu"></i></td>
66                             <td ng-bind="file.name"></td>
67                             <td width="10" ng-click="deleteFile(file)" class="text-center text-neg" style="padding: 0;"><i class="zmdi zmdi-close"></i></td>
68                             <td width="10" ng-click="startEdit(file)" class="text-center text-neg" style="padding: 0;"><i class="zmdi zmdi-edit"></i></td>
69                         </tr>
70                         </tbody>
71                     </table>
72                 </div>
73
74                 <div id="file-edit" ng-if="editFile">
75                     <h5>Edit File</h5>
76                     <div class="form-group">
77                         <label for="attachment-name-edit">File Name</label>
78                         <input type="text" id="attachment-name-edit" placeholder="File name" ng-model="editFile.name">
79                     </div>
80                     <hr class="even">
81                     <drop-zone upload-url="@{{getUploadUrl(editFile)}}" uploaded-to="@{{uploadedTo}}" placeholder="Drop files or click here to upload and overwrite" event-success="uploadSuccessUpdate"></drop-zone>
82                     <hr class="even">
83                     <div class="form-group">
84                         <label for="attachment-link-edit">Link to file</label>
85                         <input type="text" id="attachment-link-edit" placeholder="File url" ng-model="editFile.link">
86                     </div>
87
88                     <button type="button" class="button" ng-click="cancelEdit()">Back</button>
89                     <button type="button" class="button pos" ng-click="updateFile(editFile)">Save</button>
90                 </div>
91
92             </div>
93         </div>
94     @endif
95
96 </div>