@hashtagcms/admin-ui-kit 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +83 -0
  3. package/dist/admin-ui-kit.min.css +14 -0
  4. package/dist/admin-ui-kit.min.js +2 -0
  5. package/dist/admin-ui-kit.min.js.LICENSE.txt +175 -0
  6. package/package.json +53 -0
  7. package/packages/components/README.md +92 -0
  8. package/packages/components/package.json +28 -0
  9. package/packages/components/src/action-bar.vue +237 -0
  10. package/packages/components/src/category-platform.vue +97 -0
  11. package/packages/components/src/category-settings.vue +815 -0
  12. package/packages/components/src/cms-module-dropdown.vue +78 -0
  13. package/packages/components/src/downlods.vue +21 -0
  14. package/packages/components/src/file-uploader.vue +188 -0
  15. package/packages/components/src/frontend-module-creator.vue +599 -0
  16. package/packages/components/src/global-site-button.vue +94 -0
  17. package/packages/components/src/homepage.vue +1087 -0
  18. package/packages/components/src/html-slot.vue +23 -0
  19. package/packages/components/src/image-gallery.vue +144 -0
  20. package/packages/components/src/index.js +53 -0
  21. package/packages/components/src/info-boxes.vue +68 -0
  22. package/packages/components/src/info-popup.vue +121 -0
  23. package/packages/components/src/language-button.vue +80 -0
  24. package/packages/components/src/language-copier.vue +177 -0
  25. package/packages/components/src/left-nav.vue +159 -0
  26. package/packages/components/src/library/copy-paste.vue +186 -0
  27. package/packages/components/src/library/info-box.vue +102 -0
  28. package/packages/components/src/library/left-menu-show-hide.vue +47 -0
  29. package/packages/components/src/library/loader.vue +141 -0
  30. package/packages/components/src/library/modal-box.vue +136 -0
  31. package/packages/components/src/library/split-button.vue +127 -0
  32. package/packages/components/src/library/timer-button.vue +43 -0
  33. package/packages/components/src/library/toast-box.vue +53 -0
  34. package/packages/components/src/menu-sorter.vue +265 -0
  35. package/packages/components/src/module-creator.vue +650 -0
  36. package/packages/components/src/module-permission.vue +334 -0
  37. package/packages/components/src/pagination.vue +125 -0
  38. package/packages/components/src/platform-button.vue +118 -0
  39. package/packages/components/src/search-bar.vue +144 -0
  40. package/packages/components/src/site-button.vue +42 -0
  41. package/packages/components/src/site-cloner.vue +150 -0
  42. package/packages/components/src/sitewise-copier.vue +234 -0
  43. package/packages/components/src/sitewise-data.vue +347 -0
  44. package/packages/components/src/sorter.vue +239 -0
  45. package/packages/components/src/tabular-view.vue +824 -0
  46. package/packages/components/src/title-bar.vue +76 -0
  47. package/packages/components/src/top-nav.vue +96 -0
  48. package/packages/helpers/README.md +88 -0
  49. package/packages/helpers/package.json +20 -0
  50. package/packages/helpers/src/admin-config.js +9 -0
  51. package/packages/helpers/src/common.js +89 -0
  52. package/packages/helpers/src/dashboard.js +16 -0
  53. package/packages/helpers/src/editor.js +163 -0
  54. package/packages/helpers/src/error-message-handler.js +50 -0
  55. package/packages/helpers/src/event-bus.js +4 -0
  56. package/packages/helpers/src/form.js +4 -0
  57. package/packages/helpers/src/fx.js +106 -0
  58. package/packages/helpers/src/humanize.js +14 -0
  59. package/packages/helpers/src/map.js +3 -0
  60. package/packages/styles/README.md +37 -0
  61. package/packages/styles/package.json +15 -0
  62. package/packages/styles/src/_action-bar.scss +35 -0
  63. package/packages/styles/src/_admin.scss +22 -0
  64. package/packages/styles/src/_animate.scss +1579 -0
  65. package/packages/styles/src/_badges.scss +34 -0
  66. package/packages/styles/src/_category-list.scss +14 -0
  67. package/packages/styles/src/_common.scss +163 -0
  68. package/packages/styles/src/_info-box.scss +96 -0
  69. package/packages/styles/src/_left-nav.scss +59 -0
  70. package/packages/styles/src/_loader.scss +82 -0
  71. package/packages/styles/src/_menu-sorter.scss +39 -0
  72. package/packages/styles/src/_model-creator.scss +48 -0
  73. package/packages/styles/src/_module-permission.scss +25 -0
  74. package/packages/styles/src/_page-manager.scss +63 -0
  75. package/packages/styles/src/_popover-modal.scss +20 -0
  76. package/packages/styles/src/_table-grid.scss +39 -0
  77. package/packages/styles/src/_toast.scss +20 -0
  78. package/packages/styles/src/_variables.scss +37 -0
  79. package/packages/styles/src/app.scss +2 -0
@@ -0,0 +1,175 @@
1
+ /*!
2
+ * HashtagCMS Admin UI Kit v1.0.7
3
+ * Copyright (c) 2026 Marghoob Suleman
4
+ * Link: https://hashtagcms.org
5
+ * Licensed under MIT
6
+ */
7
+
8
+ /*!
9
+ * secure-ls - v1.2.6
10
+ * URL - https://github.com/softvar/secure-ls
11
+ *
12
+ * The MIT License (MIT)
13
+ *
14
+ * Copyright (c) 2016-2024 Varun Malhotra
15
+ *
16
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
17
+ * of this software and associated documentation files (the "Software"), to deal
18
+ * in the Software without restriction, including without limitation the rights
19
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
+ * copies of the Software, and to permit persons to whom the Software is
21
+ * furnished to do so, subject to the following conditions:
22
+ *
23
+ * The above copyright notice and this permission notice shall be included in all
24
+ * copies or substantial portions of the Software.
25
+ *
26
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32
+ * SOFTWARE.
33
+ *
34
+ *
35
+ * Dependencies used -
36
+ * 1. crypto-js - ^4.2.0
37
+ * 2. lz-string - ^1.5.0
38
+ */
39
+
40
+ /*! ./Base64 */
41
+
42
+ /*! ./SecureLS */
43
+
44
+ /*! ./WordArray */
45
+
46
+ /*! ./cipher-core */
47
+
48
+ /*! ./constants */
49
+
50
+ /*! ./core */
51
+
52
+ /*! ./enc-base64 */
53
+
54
+ /*! ./enc-utf8 */
55
+
56
+ /*! ./evpkdf */
57
+
58
+ /*! ./hmac */
59
+
60
+ /*! ./md5 */
61
+
62
+ /*! ./sha1 */
63
+
64
+ /*! ./sha256 */
65
+
66
+ /*! ./utils */
67
+
68
+ /*! crypto */
69
+
70
+ /*! crypto-js/aes */
71
+
72
+ /*! crypto-js/pbkdf2 */
73
+
74
+ /*! crypto-js/rabbit */
75
+
76
+ /*! crypto-js/rc4 */
77
+
78
+ /*! crypto-js/tripledes */
79
+
80
+ /*! lz-string/libs/lz-string */
81
+
82
+ /*!**********************!*\
83
+ !*** ./src/index.js ***!
84
+ \**********************/
85
+
86
+ /*!**********************!*\
87
+ !*** ./src/utils.js ***!
88
+ \**********************/
89
+
90
+ /*!***********************!*\
91
+ !*** ./src/Base64.js ***!
92
+ \***********************/
93
+
94
+ /*!************************!*\
95
+ !*** crypto (ignored) ***!
96
+ \************************/
97
+
98
+ /*!*************************!*\
99
+ !*** ./src/SecureLS.js ***!
100
+ \*************************/
101
+
102
+ /*!*************************!*\
103
+ !*** ./src/enc-utf8.js ***!
104
+ \*************************/
105
+
106
+ /*!**************************!*\
107
+ !*** ./src/WordArray.js ***!
108
+ \**************************/
109
+
110
+ /*!**************************!*\
111
+ !*** ./src/constants.js ***!
112
+ \**************************/
113
+
114
+ /*!***************************************!*\
115
+ !*** ./node_modules/crypto-js/aes.js ***!
116
+ \***************************************/
117
+
118
+ /*!***************************************!*\
119
+ !*** ./node_modules/crypto-js/md5.js ***!
120
+ \***************************************/
121
+
122
+ /*!***************************************!*\
123
+ !*** ./node_modules/crypto-js/rc4.js ***!
124
+ \***************************************/
125
+
126
+ /*!****************************************!*\
127
+ !*** ./node_modules/crypto-js/core.js ***!
128
+ \****************************************/
129
+
130
+ /*!****************************************!*\
131
+ !*** ./node_modules/crypto-js/hmac.js ***!
132
+ \****************************************/
133
+
134
+ /*!****************************************!*\
135
+ !*** ./node_modules/crypto-js/sha1.js ***!
136
+ \****************************************/
137
+
138
+ /*!******************************************!*\
139
+ !*** ./node_modules/crypto-js/evpkdf.js ***!
140
+ \******************************************/
141
+
142
+ /*!******************************************!*\
143
+ !*** ./node_modules/crypto-js/pbkdf2.js ***!
144
+ \******************************************/
145
+
146
+ /*!******************************************!*\
147
+ !*** ./node_modules/crypto-js/rabbit.js ***!
148
+ \******************************************/
149
+
150
+ /*!******************************************!*\
151
+ !*** ./node_modules/crypto-js/sha256.js ***!
152
+ \******************************************/
153
+
154
+ /*!*********************************************!*\
155
+ !*** ./node_modules/crypto-js/tripledes.js ***!
156
+ \*********************************************/
157
+
158
+ /*!**********************************************!*\
159
+ !*** ./node_modules/crypto-js/enc-base64.js ***!
160
+ \**********************************************/
161
+
162
+ /*!***********************************************!*\
163
+ !*** ./node_modules/crypto-js/cipher-core.js ***!
164
+ \***********************************************/
165
+
166
+ /*!**************************************************!*\
167
+ !*** ./node_modules/lz-string/libs/lz-string.js ***!
168
+ \**************************************************/
169
+
170
+ /**!
171
+ * Sortable 1.15.6
172
+ * @author RubaXa <trash@rubaxa.org>
173
+ * @author owenm <owen23355@gmail.com>
174
+ * @license MIT
175
+ */
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@hashtagcms/admin-ui-kit",
3
+ "version": "1.0.6",
4
+ "description": "The official Admin UI Kit for HashtagCMS, bundled with essential UI components, utility helpers, and design system styles.",
5
+ "author": "HashtagCMS",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "main": "dist/admin-ui-kit.min.js",
11
+ "files": [
12
+ "dist",
13
+ "packages"
14
+ ],
15
+ "homepage": "https://hashtagcms.org",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/hashtagcms/admin-ui-kit.git"
19
+ },
20
+ "workspaces": [
21
+ "packages/*"
22
+ ],
23
+ "scripts": {
24
+ "test": "vitest run",
25
+ "dev": "webpack --mode development --progress --color",
26
+ "build": "webpack --mode production --progress --color",
27
+ "watch": "webpack --mode development --watch --progress --color",
28
+ "playground": "vite --config vite.playground.config.js"
29
+ },
30
+ "devDependencies": {
31
+ "@babel/core": "^7.23.0",
32
+ "@babel/preset-env": "^7.23.0",
33
+ "@vitejs/plugin-vue": "^6.0.3",
34
+ "@vue/test-utils": "^2.4.6",
35
+ "babel-loader": "^9.1.0",
36
+ "css-loader": "^6.8.0",
37
+ "jsdom": "^27.0.1",
38
+ "mini-css-extract-plugin": "^2.7.0",
39
+ "sass": "^1.69.0",
40
+ "sass-loader": "^13.3.0",
41
+ "vitest": "^3.2.4",
42
+ "vue-loader": "^17.3.0",
43
+ "webpack": "^5.89.0",
44
+ "webpack-cli": "^5.1.0"
45
+ },
46
+ "dependencies": {
47
+ "@hashtagcms/admin-sdk": "^1.0.2",
48
+ "axios": "^1.6.0",
49
+ "mitt": "^3.0.1",
50
+ "motion": "^10.16.4",
51
+ "secure-ls": "^2.0.0"
52
+ }
53
+ }
@@ -0,0 +1,92 @@
1
+ # @hashtagcms/components
2
+
3
+ A collection of robust, reusable Vue.js components designed for building HashtagCMS admin interfaces. These components are optimized for server-side rendering integration (using `data-` attributes) and modern SPA capabilities.
4
+
5
+ ## 📦 Installation
6
+
7
+ ```bash
8
+ npm install @hashtagcms/components
9
+ ```
10
+
11
+ ## 🚀 Usage
12
+
13
+ Import components directly in your Vue application:
14
+
15
+ ```javascript
16
+ import { ActionBar, TabularView } from "@hashtagcms/components";
17
+
18
+ // Or import individual files
19
+ import ActionBar from "@hashtagcms/components/action-bar";
20
+ ```
21
+
22
+ ## 🛠 Component Reference
23
+
24
+ ### `ActionBar`
25
+
26
+ A versatile toolbar that sits at the top of module pages. It handles adding new items, searching, layout switching (grid/table), and language toggling.
27
+
28
+ **Props:**
29
+
30
+ - `data-controller-name`: The current controller (e.g., `'site'`).
31
+ - `data-controller-title`: Page title.
32
+ - `data-action-fields`: Array of enabled actions (e.g., `['edit', 'delete']`).
33
+ - `data-fields`: Fields available for search.
34
+ - `data-show-search`: Boolean to toggle search button.
35
+
36
+ ### `TabularView`
37
+
38
+ The powerhouse grid component for displaying lists of data.
39
+
40
+ **Features:**
41
+
42
+ - **Dynamic Columns**: Renders columns based on `data-headers`.
43
+ - **Actions**: Automatically generates Edit/Delete/Approve buttons based on permissions.
44
+ - **Smart Rendering**: Handles images, videos, and nested object values (e.g., `lang.name`) automatically.
45
+ - **Inline Editing**: Supports inline toggle switches for boolean states (like `publish_status`).
46
+
47
+ **Props:**
48
+
49
+ - `data-list`: JSON string of the data rows.
50
+ - `data-headers`: Configuration for columns.
51
+ - `data-user-rights`: Array of permissions (e.g., `['edit', 'delete']`).
52
+ - `data-action-as-ajax`: Actions that should trigger an API call instead of navigation.
53
+
54
+ ### `SearchBar`
55
+
56
+ A dynamic search form that allows users to query data with specific logic.
57
+
58
+ **Features:**
59
+
60
+ - **Field Selection**: Dropdown to choose which field to search.
61
+ - **Operators**: Supports `=`, `!=`, `>`, `<`, `like%`, etc.
62
+ - **Type Detection**: Automatically switches input type to `date` for date fields.
63
+
64
+ ### `Pagination`
65
+
66
+ A Bootstrap-styled pagination component that synchronizes with Laravel's pagination response.
67
+
68
+ **Props:**
69
+
70
+ - `data-paginator`: The full pagination object from Laravel.
71
+ - `data-total`: Total number of records.
72
+ - `data-show-download`: Helper to show/hide export options.
73
+
74
+ ### `ModulePermission`
75
+
76
+ A specialized component for managing role-based access control (RBAC) matrices.
77
+
78
+ ### `InfoPopup`
79
+
80
+ A modal wrapper used by `TabularView` and others to display quick information or read-only details without leaving the page.
81
+
82
+ ### Library Components
83
+
84
+ We also export smaller utility components found in `src/library`:
85
+
86
+ - `ToastBox`: Notification toaster.
87
+ - `Loader`: Full-screen or partial loading spinner.
88
+ - `ModalBox`: Generic dialog wrapper.
89
+
90
+ ## 🤝 Integration Note
91
+
92
+ Most components are designed to accept data via `props`. When used in a mixed Blade/Vue environment, standard practice is to pass JSON-encoded strings to the `data-` attributes, which the components automatically parse.
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@hashtagcms/components",
3
+ "version": "1.0.0",
4
+ "description": "Vue.js components for HashtagCMS",
5
+ "author": "HashtagCMS",
6
+ "license": "MIT",
7
+ "homepage": "https://hashtagcms.org",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/hashtagcms/admin-ui-kit.git"
11
+ },
12
+ "main": "src/index.js",
13
+ "exports": {
14
+ ".": "./src/index.js",
15
+ "./*": "./src/*.vue",
16
+ "./library/*": "./src/library/*.vue"
17
+ },
18
+ "peerDependencies": {
19
+ "vue": "^3.5.13"
20
+ },
21
+ "dependencies": {
22
+ "@hashtagcms/helpers": "*",
23
+ "@hashtagcms/styles": "*",
24
+ "sortablejs": "^1.15.2",
25
+ "pluralize": "^8.0.0",
26
+ "axios": "^1.6.0"
27
+ }
28
+ }
@@ -0,0 +1,237 @@
1
+ <template>
2
+ <div class="container-fluid border-bottom mb-2 pb-2">
3
+ <div class="row">
4
+ <div class="col">
5
+ <div
6
+ class="btn-toolbar justify-content-between"
7
+ role="toolbar"
8
+ aria-label="Toolbar with button groups"
9
+ >
10
+ <div class="btn-group" role="group">
11
+ <h4 class="moduleTitle">{{ getTitle(controllerTitle) }}</h4>
12
+ </div>
13
+ <div class="input-group actionToolbar">
14
+ <language-button
15
+ v-if="hasLangMethod"
16
+ :data-languages="dataLanguages"
17
+ :data-selected-language="dataSelectedLanguage"
18
+ >English</language-button
19
+ >
20
+ <button
21
+ v-if="showAdd && showAddButtonBasedOnAction"
22
+ title="Add New"
23
+ @click="addNew"
24
+ type="button"
25
+ class="btn btn-outline-secondary"
26
+ aria-label="Add New"
27
+ >
28
+ <i class="fa fa-plus" aria-hidden="true"></i> Add New
29
+ </button>
30
+ <a
31
+ v-for="actionButton in moreActionButtons"
32
+ class="btn btn-outline-secondary"
33
+ :href="getAction(actionButton.action)"
34
+ :title="actionButton.label"
35
+ >
36
+ <i
37
+ v-if="actionButton.icon_css"
38
+ :class="actionButton.icon_css"
39
+ aria-hidden="true"
40
+ ></i>
41
+ <span v-if="getButtonType(actionButton) == 'button'">{{
42
+ actionButton.label
43
+ }}</span>
44
+ </a>
45
+ <button
46
+ v-if="showSearchButton"
47
+ title="Search"
48
+ @click="showHideSearch"
49
+ type="button"
50
+ :class="isActive"
51
+ aria-label="Search"
52
+ >
53
+ <i class="fa fa-search" aria-hidden="true"></i>
54
+ </button>
55
+ <button
56
+ v-if="fields.length > 0"
57
+ title="Change Layout"
58
+ @click="changeLayout()"
59
+ type="button"
60
+ class="btn btn-outline-secondary"
61
+ aria-label="Layout"
62
+ >
63
+ <i :class="layoutIcon" aria-hidden="true"></i>
64
+ </button>
65
+ <a v-if="showBack" class="btn btn-outline-secondary" :href="backURL"
66
+ >Back</a
67
+ >
68
+ </div>
69
+ </div>
70
+ </div>
71
+ </div>
72
+ <div class="row">
73
+ <div class="col" v-if="showSearchPanel">
74
+ <search-bar
75
+ :class="searchAnim"
76
+ :data-controller-name="controllerName"
77
+ :data-selected-params="selectedParams"
78
+ :data-fields="fields"
79
+ :data-action-fields="actionFields"
80
+ ></search-bar>
81
+ </div>
82
+ </div>
83
+ </div>
84
+ </template>
85
+
86
+ <script>
87
+ import AdminConfig from "@hashtagcms/helpers/admin-config";
88
+ import CmsModuleDropdown from "./cms-module-dropdown.vue";
89
+ import LanguageButton from "./language-button.vue";
90
+ import SearchBar from "./search-bar.vue";
91
+ import { Toast } from "@hashtagcms/helpers/common";
92
+ import Humanize from "@hashtagcms/helpers/humanize";
93
+
94
+ export default {
95
+ components: {
96
+ "cms-module-dropdown": CmsModuleDropdown,
97
+ "language-button": LanguageButton,
98
+ "search-bar": SearchBar,
99
+ },
100
+ mounted() {
101
+ this.shouldShowSearchPanel();
102
+ //console.log(this.dataShowSearch);
103
+ },
104
+ props: [
105
+ "dataSelectedParams",
106
+ "dataControllerName",
107
+ "dataControllerTitle",
108
+ "dataFields",
109
+ "dataActionFields",
110
+ "dataLanguages",
111
+ "dataSelectedLanguage",
112
+ "dataMoreActions",
113
+ "dataShowAdd",
114
+ "dataHasLangMethod",
115
+ "dataCmsModules",
116
+ "dataShowSearch",
117
+ "dataShowBack",
118
+ "dataLayoutType",
119
+ ],
120
+ computed: {
121
+ backURL() {
122
+ return AdminConfig.admin_path(this.controllerName);
123
+ },
124
+ layoutIcon() {
125
+ return this.layoutType === "grid" ? "fa fa-th-list" : "fa fa-table";
126
+ },
127
+ showAddButtonBasedOnAction() {
128
+ return this.actionFields.indexOf("edit") !== -1;
129
+ },
130
+ },
131
+ data() {
132
+ return {
133
+ canAdd: true,
134
+ showSearchButton: !(
135
+ typeof this.dataShowSearch === "undefined" ||
136
+ this.dataShowSearch === "" ||
137
+ this.dataShowSearch === "false"
138
+ ),
139
+ showSearchPanel: false,
140
+ isActive: "btn btn-outline-secondary",
141
+ searchAnim: "",
142
+ moreActionButtons:
143
+ typeof this.dataMoreActions === "undefined" ||
144
+ this.dataMoreActions === ""
145
+ ? []
146
+ : JSON.parse(this.dataMoreActions),
147
+ showAdd:
148
+ typeof this.dataShowAdd === "undefined" || this.dataShowAdd === "true",
149
+ hasLangMethod: !(
150
+ typeof this.dataHasLangMethod === "undefined" ||
151
+ this.dataHasLangMethod === "false"
152
+ ),
153
+ cmsModules:
154
+ typeof this.dataCmsModules === "undefined" || this.dataCmsModules === ""
155
+ ? []
156
+ : JSON.parse(this.dataCmsModules),
157
+ selectedParams:
158
+ typeof this.dataSelectedParams === "undefined"
159
+ ? ""
160
+ : this.dataSelectedParams,
161
+ controllerName:
162
+ typeof this.dataControllerName === "undefined"
163
+ ? ""
164
+ : this.dataControllerName,
165
+ controllerTitle:
166
+ typeof this.dataControllerTitle === "undefined"
167
+ ? ""
168
+ : this.dataControllerTitle,
169
+ fields:
170
+ typeof this.dataFields === "undefined" || this.dataFields === ""
171
+ ? []
172
+ : this.dataFields,
173
+ actionFields:
174
+ typeof this.dataActionFields === "undefined" ||
175
+ this.dataActionFields === ""
176
+ ? []
177
+ : this.dataActionFields,
178
+ showBack: this.dataShowBack === "true",
179
+ layoutType:
180
+ typeof this.dataLayoutType === "undefined" || this.dataLayoutType === ""
181
+ ? "table"
182
+ : this.dataLayoutType,
183
+ };
184
+ },
185
+ methods: {
186
+ changeLayout() {
187
+ Toast.show(this, "Please wait. Changing listing style for you...", 5000);
188
+ this.layoutType = this.layoutType === "table" ? "grid" : "table";
189
+ if ("URLSearchParams" in window) {
190
+ let searchParams = new URLSearchParams(window.location.search);
191
+ searchParams.set("layout", this.layoutType);
192
+ window.location.search = searchParams.toString();
193
+ }
194
+ },
195
+ getAction(val) {
196
+ if (val.indexOf("http") === 0) {
197
+ return val;
198
+ }
199
+ return AdminConfig.admin_path(val);
200
+ },
201
+ maintainActiveSearch(animate = true) {
202
+ this.isActive =
203
+ this.showSearchPanel === true
204
+ ? "btn btn-success"
205
+ : "btn btn-outline-secondary";
206
+ this.searchAnim =
207
+ this.showSearchPanel === true && animate == true
208
+ ? "animated flipInX"
209
+ : "";
210
+ },
211
+ showHideSearch() {
212
+ this.showSearchPanel = !this.showSearchPanel;
213
+ this.maintainActiveSearch();
214
+ },
215
+ shouldShowSearchPanel() {
216
+ if (this.selectedParams !== "") {
217
+ if (JSON.parse(this.selectedParams).q) {
218
+ this.showSearchPanel = true;
219
+ }
220
+ this.maintainActiveSearch(false);
221
+ }
222
+ },
223
+ addNew() {
224
+ if (this.controllerName !== "") {
225
+ var controller_url = AdminConfig.admin_path(this.controllerName);
226
+ window.location.href = controller_url + "/create";
227
+ }
228
+ },
229
+ getButtonType(row) {
230
+ return !row.as || row.as === "button" ? "button" : row.as;
231
+ },
232
+ getTitle: function (text) {
233
+ return Humanize(text);
234
+ },
235
+ },
236
+ };
237
+ </script>
@@ -0,0 +1,97 @@
1
+ <template>
2
+ <div>
3
+ <modal-box ref="platformbox" @onClose="hideSpinner">
4
+ <template #title> Select Platform </template>
5
+ <template #content>
6
+ <div class="row">
7
+ <div class="col-auto">
8
+ <select
9
+ v-model="currentPlatform"
10
+ class="form-select select-medium"
11
+ @change="editNow()"
12
+ >
13
+ <option value="">Select a platform</option>
14
+ <option v-for="platform in platforms" :value="platform.id">
15
+ {{ platform.name }}
16
+ </option>
17
+ </select>
18
+ </div>
19
+ <div class="col-auto">
20
+ <button
21
+ class="btn btn-success btn-from-submit"
22
+ type="button"
23
+ @click="editNow()"
24
+ >
25
+ Edit Now
26
+ </button>
27
+ </div>
28
+ </div>
29
+ </template>
30
+ </modal-box>
31
+ </div>
32
+ </template>
33
+
34
+ <script>
35
+ import AdminConfig from "@hashtagcms/helpers/admin-config";
36
+ import { EventBus } from "@hashtagcms/helpers/event-bus";
37
+ import { Toast } from "@hashtagcms/helpers/common";
38
+ import ModalBox from "./library/modal-box.vue";
39
+
40
+ export default {
41
+ components: {
42
+ "modal-box": ModalBox,
43
+ },
44
+ mounted() {
45
+ this.verifyAction();
46
+ },
47
+ props: ["dataPlatforms"],
48
+ data() {
49
+ return {
50
+ modelCss: "modal",
51
+ showHide: true,
52
+ platforms:
53
+ this.dataPlatforms && this.dataPlatforms != "null"
54
+ ? JSON.parse(this.dataPlatforms)
55
+ : [],
56
+ currentPlatform: "",
57
+ currentTarget: null,
58
+ };
59
+ },
60
+ methods: {
61
+ verifyAction: function () {
62
+ let $this = this;
63
+ EventBus.on("list-view-pre-edit", function (current) {
64
+ $this.currentTarget = current;
65
+ $this.open();
66
+ });
67
+ },
68
+ editNow() {
69
+ let platform_id = this.currentPlatform;
70
+ if (platform_id === "") {
71
+ Toast.show(this, "Please select a platform");
72
+ return false;
73
+ }
74
+ let target = this.currentTarget;
75
+ let id = target.getAttribute("data-rowid");
76
+ window.location = AdminConfig.admin_path(
77
+ `category/edit/${id}/${platform_id}`,
78
+ );
79
+ },
80
+ open() {
81
+ // console.log(this.platforms);
82
+ if (this.platforms.length > 1) {
83
+ this.$refs.platformbox.open();
84
+ } else {
85
+ this.currentPlatform = this.platforms[0].id;
86
+ this.editNow();
87
+ }
88
+ },
89
+ close() {
90
+ this.$refs.platformbox.close();
91
+ },
92
+ hideSpinner() {
93
+ EventBus.emit("list-view-hide-spinner", this);
94
+ },
95
+ },
96
+ };
97
+ </script>