|
4 | 4 | ViewData["Title"] = Localizer["themes"]; |
5 | 5 | } |
6 | 6 |
|
7 | | -<div id="app" class="bf-content"> |
8 | | - <div id="themesList" class="bf-posts-grid d-flex"> |
| 7 | + <div id="app" class="bf-content"> |
| 8 | + <div id="themesList" class="bf-posts-grid d-flex"> |
9 | 9 |
|
10 | | - <div v-for="(theme, index) in themes" class="post-grid-col"> |
11 | | - <div class="post-grid-item"> |
12 | | - <a class="item-link" v-bind:style="{ backgroundImage: 'url(' + webRoot + theme.cover + ')' }"> |
13 | | - <div class="item-title mt-auto"> </div> |
14 | | - </a> |
15 | | - <div class="item-info d-flex align-items-center"> |
16 | | - <span class="item-date mr-auto"> |
17 | | - {{ theme.title }} |
18 | | - </span> |
19 | | - <i v-if="theme.isCurrent" class="fas fa-star" style="color: #ffbe00; font-size: 1.3em"></i> |
20 | | - <button v-if="!theme.isCurrent" class="btn-unstyled item-favorite ml-3" v-on:click="select(theme.title)" data-tooltip="" title="" data-original-title="select"> |
21 | | - <i class="far fa-star"></i> |
22 | | - </button> |
23 | | - <a v-if="!theme.isCurrent" class="item-show ml-4" href="#" v-on:click="return remove(theme.title)" data-tooltip="" title="" data-original-title="delete"> |
24 | | - <i class="fas fa-trash" style="color: #ff6666"></i> |
| 10 | + <div v-for="(theme, index) in themes" class="post-grid-col"> |
| 11 | + <div class="post-grid-item"> |
| 12 | + <a class="item-link" v-bind:style="{ backgroundImage: 'url(' + webRoot + theme.cover + ')' }"> |
| 13 | + <div class="item-title mt-auto"> </div> |
25 | 14 | </a> |
| 15 | + <div class="item-info d-flex align-items-center"> |
| 16 | + <span class="item-date mr-auto"> |
| 17 | + {{ theme.title }} |
| 18 | + </span> |
| 19 | + <i v-if="theme.isCurrent" class="fas fa-star" style="color: #ffbe00; font-size: 1.3em"></i> |
| 20 | + <button v-if="!theme.isCurrent" class="btn-unstyled item-favorite ml-3" v-on:click="select(theme.title)" data-tooltip="" title="Active" data-original-title="select"> |
| 21 | + <i class="far fa-star"></i> |
| 22 | + </button> |
| 23 | + <button v-if="theme.hasSettings" class="btn-unstyled item-show ml-3" v-on:click="settings(theme.title)" data-tooltip="" title="Settings" data-original-title="select"> |
| 24 | + <i class="fa fa-sliders-h"></i> |
| 25 | + </button> |
| 26 | + |
| 27 | + <a v-if="!theme.isCurrent" class="item-show ml-4" href="#" v-on:click="return remove(theme.title)" data-tooltip="" title="Delete" data-original-title="delete"> |
| 28 | + <i class="fas fa-trash" style="color: #ff6666"></i> |
| 29 | + </a> |
| 30 | + </div> |
| 31 | + </div> |
| 32 | + </div> |
| 33 | + |
| 34 | + </div> |
| 35 | + |
| 36 | + <div class="modal fade" id="dlgSettings" tabindex="-1" role="dialog" aria-hidden="true"> |
| 37 | + <div class="modal-dialog" role="document"> |
| 38 | + <div class="modal-content"> |
| 39 | + <div class="modal-header"> |
| 40 | + <h4 class="modal-title" id="hdrSettings">@Localizer["settings"]</h4> |
| 41 | + <button type="button" class="close ml-2" title="Close" data-placement="bottom" data-tooltip data-dismiss="modal" aria-label="@Localizer["close"]"> |
| 42 | + <i class="fa fa-times"></i> |
| 43 | + </button> |
| 44 | + </div> |
| 45 | + <div class="modal-body"> |
| 46 | + <form> |
| 47 | + <div class="form-group"> |
| 48 | + <textarea rows="10" v-model="themeData" class="form-control" autofocus></textarea> |
| 49 | + </div> |
| 50 | + <button type="button" v-on:click="save()" class="btn btn-primary btn-main">@Localizer["save"]</button> |
| 51 | + </form> |
| 52 | + </div> |
26 | 53 | </div> |
27 | 54 | </div> |
28 | 55 | </div> |
29 | 56 |
|
30 | 57 | </div> |
31 | | -</div> |
32 | 58 |
|
33 | 59 | @section Scripts{ |
34 | 60 | <script> |
35 | 61 | new Vue({ |
36 | 62 | el: "#app", |
37 | 63 | data: { |
38 | | - themes: [] |
| 64 | + themes: [], |
| 65 | + themeSelected: '', |
| 66 | + themeData: {} |
39 | 67 | }, |
40 | 68 | methods: { |
41 | 69 | load: function (page) { |
|
55 | 83 | toastr.error(error); |
56 | 84 | }); |
57 | 85 | }, |
| 86 | + settings: function (title) { |
| 87 | + this.themeSelected = title; |
| 88 | +
|
| 89 | + axios.get(webRoot + 'api/themes/data?theme=' + title) |
| 90 | + .then(response => { |
| 91 | + this.themeData = JSON.stringify(response.data, null, '\t'); |
| 92 | + }) |
| 93 | + .catch(function (error) { toastr.error(error); }); |
| 94 | +
|
| 95 | + $('#dlgSettings').modal(); |
| 96 | + }, |
| 97 | + save: function () { |
| 98 | + var dt = { |
| 99 | + "theme": this.themeSelected, |
| 100 | + "data": this.themeData |
| 101 | + }; |
| 102 | + axios.post(webRoot + 'api/themes/data', dt) |
| 103 | + .then(function (response) { |
| 104 | + toastr.success('Updated'); |
| 105 | + $('#dlgSettings').modal('hide'); |
| 106 | + }) |
| 107 | + .catch(function (error) { |
| 108 | + toastr.error(error); |
| 109 | + }); |
| 110 | + }, |
58 | 111 | remove: function(title){ |
59 | 112 | var result = confirm("Please confirm removing this theme"); |
60 | 113 | if (result) { |
|
0 commit comments