|
18 | 18 | </head>
|
19 | 19 | <body>
|
20 | 20 | <div id="wrapper" class="${containerType}">
|
21 |
| - <g:render template="/admin/editDocuments" model="${[excludeReport:true, documents:documents, containerId:'help-documents', useExistingModel:false, filterBy:'all']}"/> |
| 21 | + <section aria-label="breadcrumb"> |
| 22 | + <ol class="breadcrumb"> |
| 23 | + <li class="breadcrumb-item"><g:link controller="home">Home</g:link></li> |
| 24 | + <li class="breadcrumb-item"><g:link controller="admin">Admin</g:link></li> |
| 25 | + <li class="breadcrumb-item">Edit help documents</li> |
| 26 | + </ol> |
| 27 | + </section> |
| 28 | + <h3>Edit Help Documents</h3> |
| 29 | + <p>Create a new category of help documents by entering the category name and pressing Add new category below</p> |
| 30 | + <form class="form form-inline"> |
| 31 | + <input type="text" data-bind="value: newCategoryName" class="form-control col-8" placeholder="Name of new category"/> |
| 32 | + <button class="btn btn-success" data-bind="enable: newCategoryName, click:newCategory">Add new category</button> |
| 33 | + </form> |
| 34 | + |
| 35 | + <br/> |
| 36 | + <p>Add a new help document in the selected category by selecting the category then pressing New help document in category below</p> |
| 37 | + <form class="form form-inline"> |
| 38 | + |
| 39 | + <select class="form-control col-8" id="document-category" name="documentCategory" data-bind="options: documentCategories, value: selectedCategory, optionsCaption: 'Select a category'"></select> |
| 40 | + <button class="btn btn-info" id="doAttach" data-bind="enable:selectedCategory, click:attachDocument">New help document in category</button> |
| 41 | + </form> |
| 42 | + |
| 43 | + |
| 44 | + <hr/> |
| 45 | + <p>Help documents</p> |
| 46 | + <div id="edit-documents" class="pill-pane tab-pane"> |
| 47 | + <div class="row"> |
| 48 | + <div class="col-sm-12 ml-3 "> |
| 49 | + <g:render template="/shared/editDocuments" |
| 50 | + model="[useExistingModel: true,editable:true, filterBy: 'all', ignore: '', imageUrl:assetPath(src:'filetypes'),containerId:'adminDocumentList']"/> |
| 51 | + </div> |
| 52 | + </div> |
| 53 | + %{--The modal view containing the contents for a modal dialog used to attach a document--}% |
| 54 | + <g:render template="/shared/attachDocument"/> |
| 55 | + |
| 56 | + </div> |
22 | 57 | </div>
|
23 | 58 | <asset:javascript src="common-bs4.js"/>
|
24 | 59 | <asset:javascript src="document.js"/>
|
25 | 60 | <asset:javascript src="file-upload-manifest.js"/>
|
| 61 | +<asset:javascript src="admin.js"/> |
26 | 62 |
|
27 | 63 | <asset:script>
|
28 | 64 |
|
29 |
| - var documents = <fc:modelAsJavascript model="${documents}"/>; |
| 65 | + const documents = <fc:modelAsJavascript model="${documents}"/>; |
| 66 | + const categories = <fc:modelAsJavascript model="${categories}"/>; |
| 67 | + const hubId = '${hubId}'; |
30 | 68 | $(function () {
|
31 |
| - |
32 |
| - |
33 |
| - var owner = {hubId:'${hubId}'}; |
34 |
| - var category = '${category}'; |
35 |
| - documentRoles = [{id:'helpDocument', name:'Help Document', isPublicRole:true}]; |
36 |
| - var options = { |
37 |
| - roles: ['helpDocument'], |
38 |
| - owner: owner, |
39 |
| - documentDefaults: { |
40 |
| - role: 'helpDocument', |
41 |
| - public: true, |
42 |
| - labels:[category] |
43 |
| - }, |
44 |
| - modalSelector: '#attachDocument', |
45 |
| - documentUpdateUrl: fcConfig.documentUpdateUrl, |
46 |
| - documentDeleteUrl: fcConfig.documentDeleteUrl, |
47 |
| - imageLocation: fcConfig.imageLocation |
48 |
| - }; |
49 |
| - var documentsViewModel = new EditableDocumentsViewModel(options); |
50 |
| - documentsViewModel.loadDocuments(documents); |
51 |
| - ko.applyBindings(documentsViewModel, document.getElementById('edit-documents')); |
52 |
| - |
53 |
| - |
| 69 | + let viewModel = new EditHelpDocumentsViewModel(hubId, categories, documents); |
| 70 | + ko.applyBindings(viewModel, document.getElementById('wrapper')); |
54 | 71 | });
|
55 | 72 |
|
56 | 73 | </asset:script>
|
|
0 commit comments