Skip to content

Commit 141369d

Browse files
Merge branch 'dashboard' of https://github.com/Wealcoder/animation-addons-for-elementor into dashboard
2 parents 2db2791 + 1c83a64 commit 141369d

File tree

8 files changed

+120
-33
lines changed

8 files changed

+120
-33
lines changed

assets/css/wcf-template-library.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
min-width: 150px;
3030
}
3131

32+
#wcf-template-library-color-subtype {
33+
min-width: 150px;
34+
}
35+
3236
#wcf-template-library-header-preview-back {
3337
padding: 15px;
3438
border-inline-end: 1px solid #e6e8ea;

assets/css/wcf-template-library.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/wcf-template-library.js

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
1616
var currentPage = 1;
1717
var currentCategory = "";
1818
var currentType = "";
19+
var currentColorType = "";
1920
var allCategory = /*#__PURE__*/function () {
2021
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2122
return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -96,6 +97,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
9697
var category,
9798
type,
9899
page,
100+
color_type,
99101
result,
100102
query_domain,
101103
response,
@@ -107,6 +109,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
107109
category = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : "";
108110
type = _args3.length > 1 ? _args3[1] : undefined;
109111
page = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : 1;
112+
color_type = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : "";
110113
result = [];
111114
query_domain = new URL(aae_domain);
112115
if (type) {
@@ -119,35 +122,38 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
119122
query_domain.searchParams.set("page", page);
120123
currentPage = page;
121124
}
122-
_context3.prev = 8;
123-
_context3.next = 11;
125+
if (color_type) {
126+
query_domain.searchParams.set("color_type", color_type);
127+
}
128+
_context3.prev = 10;
129+
_context3.next = 13;
124130
return fetch(query_domain);
125-
case 11:
131+
case 13:
126132
response = _context3.sent;
127133
if (response.ok) {
128-
_context3.next = 14;
134+
_context3.next = 16;
129135
break;
130136
}
131137
throw new Error("HTTP error! Status: ".concat(response.status));
132-
case 14:
133-
_context3.next = 16;
134-
return response.json();
135138
case 16:
139+
_context3.next = 18;
140+
return response.json();
141+
case 18:
136142
data = _context3.sent;
137143
result = data.templates || [];
138-
_context3.next = 23;
144+
_context3.next = 25;
139145
break;
140-
case 20:
141-
_context3.prev = 20;
142-
_context3.t0 = _context3["catch"](8);
146+
case 22:
147+
_context3.prev = 22;
148+
_context3.t0 = _context3["catch"](10);
143149
console.error("Fetch Error:", _context3.t0);
144-
case 23:
150+
case 25:
145151
return _context3.abrupt("return", templates_validate(result));
146-
case 24:
152+
case 26:
147153
case "end":
148154
return _context3.stop();
149155
}
150-
}, _callee3, null, [[8, 20]]);
156+
}, _callee3, null, [[10, 22]]);
151157
}));
152158
return function get_category_templates() {
153159
return _ref3.apply(this, arguments);
@@ -263,6 +269,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
263269

264270
//category select
265271
selected_category(t);
272+
selected_color_type(t);
266273
render_single_template(t);
267274
search_function();
268275
template_import();
@@ -273,6 +280,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
273280
function _render_templates() {
274281
_render_templates = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(t, activeMenu) {
275282
var category,
283+
color_type,
276284
templates,
277285
is_loading,
278286
container,
@@ -282,28 +290,30 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
282290
while (1) switch (_context6.prev = _context6.next) {
283291
case 0:
284292
category = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : "";
293+
color_type = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : "";
285294
templates = wp.template("wcf-templates");
286295
contents = null;
287296
is_loading = true;
288297
loading(is_loading);
289-
_context6.next = 7;
298+
_context6.next = 8;
290299
return templates({
291300
templates: [],
292301
categories: storeCategory
293302
});
294-
case 7:
303+
case 8:
295304
contents = _context6.sent;
296305
t.append(contents);
297306
container = document.querySelector(".wcf-library-templates");
298307
currentCategory = category;
299308
currentType = activeMenu;
309+
currentColorType = color_type;
300310
if (active_resize_first_load === 0) {
301311
$(window).trigger("resize");
302312
active_resize_first_load++;
303313
}
304-
_context6.next = 15;
305-
return get_category_templates(category, activeMenu);
306-
case 15:
314+
_context6.next = 17;
315+
return get_category_templates(category, activeMenu, 1, color_type);
316+
case 17:
307317
getTemplate = _context6.sent;
308318
getTemplate.forEach(function (item) {
309319
var templateHtml = generateTemplate(item);
@@ -319,8 +329,12 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
319329
if (category) {
320330
$("#wcf-template-library-filter-subtype option[value='" + category + "']").attr("selected", "selected");
321331
}
332+
if (color_type) {
333+
$("#wcf-template-library-color-subtype option[value='" + color_type + "']").attr("selected", "selected");
334+
}
335+
322336
//window.backContent = $('#wcf-template-library .dialog-widget-content').html();
323-
case 20:
337+
case 23:
324338
case "end":
325339
return _context6.stop();
326340
}
@@ -405,7 +419,16 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
405419
var activeMenu = $(".wcf-template-library--header .elementor-active").attr("data-tab");
406420
var valueSelected = this.value;
407421
$(t).find(".dialog-message").remove();
408-
render_templates(t, activeMenu, valueSelected);
422+
render_templates(t, activeMenu, valueSelected, currentColorType);
423+
template_import();
424+
});
425+
}
426+
function selected_color_type(t) {
427+
$(document).on("change", "#wcf-template-library-color-subtype", function (e) {
428+
var activeMenu = $(".wcf-template-library--header .elementor-active").attr("data-tab");
429+
var valueSelected = this.value;
430+
$(t).find(".dialog-message").remove();
431+
render_templates(t, activeMenu, currentCategory, valueSelected);
409432
template_import();
410433
});
411434
}
@@ -528,7 +551,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
528551
break;
529552
}
530553
_context7.next = 3;
531-
return get_category_templates(currentCategory, currentType, currentPage + 1);
554+
return get_category_templates(currentCategory, currentType, currentPage + 1, currentColorType);
532555
case 3:
533556
currentchunk = _context7.sent;
534557
container = document.querySelector(".wcf-library-templates");

assets/js/wcf-template-library.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/src/js/wcf-template-library.js

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
let currentPage = 1;
1313
let currentCategory = "";
1414
let currentType = "";
15+
let currentColorType = "";
1516
let allCategory = async () => {
1617
await fetch(
1718
"https://crowdytheme.com/elementor/info-templates/wp-json/templates/v2/wcf-tpl-category"
@@ -74,7 +75,8 @@
7475
const get_category_templates = async function (
7576
category = "",
7677
type,
77-
page = 1
78+
page = 1,
79+
color_type = ""
7880
) {
7981
let result = [];
8082

@@ -90,6 +92,9 @@
9092
query_domain.searchParams.set("page", page);
9193
currentPage = page;
9294
}
95+
if (color_type) {
96+
query_domain.searchParams.set("color_type", color_type);
97+
}
9398
try {
9499
const response = await fetch(query_domain);
95100
if (!response.ok)
@@ -200,6 +205,7 @@
200205

201206
//category select
202207
selected_category(t);
208+
selected_color_type(t);
203209

204210
render_single_template(t);
205211

@@ -208,7 +214,12 @@
208214
template_import();
209215
}
210216

211-
async function render_templates(t, activeMenu, category = "") {
217+
async function render_templates(
218+
t,
219+
activeMenu,
220+
category = "",
221+
color_type = ""
222+
) {
212223
let templates = wp.template("wcf-templates");
213224
contents = null;
214225
let is_loading = true;
@@ -223,13 +234,16 @@
223234
const container = document.querySelector(".wcf-library-templates");
224235
currentCategory = category;
225236
currentType = activeMenu;
237+
currentColorType = color_type;
226238
if (active_resize_first_load === 0) {
227239
$(window).trigger("resize");
228240
active_resize_first_load++;
229241
}
230242
const getTemplate = await get_category_templates(
231243
category,
232-
activeMenu
244+
activeMenu,
245+
1,
246+
color_type
233247
);
234248
getTemplate.forEach((item) => {
235249
const templateHtml = generateTemplate(item);
@@ -251,6 +265,14 @@
251265
"']"
252266
).attr("selected", "selected");
253267
}
268+
if (color_type) {
269+
$(
270+
"#wcf-template-library-color-subtype option[value='" +
271+
color_type +
272+
"']"
273+
).attr("selected", "selected");
274+
}
275+
254276
//window.backContent = $('#wcf-template-library .dialog-widget-content').html();
255277
}
256278

@@ -371,7 +393,28 @@
371393
).attr("data-tab");
372394
let valueSelected = this.value;
373395
$(t).find(".dialog-message").remove();
374-
render_templates(t, activeMenu, valueSelected);
396+
render_templates(
397+
t,
398+
activeMenu,
399+
valueSelected,
400+
currentColorType
401+
);
402+
template_import();
403+
}
404+
);
405+
}
406+
407+
function selected_color_type(t) {
408+
$(document).on(
409+
"change",
410+
"#wcf-template-library-color-subtype",
411+
function (e) {
412+
let activeMenu = $(
413+
".wcf-template-library--header .elementor-active"
414+
).attr("data-tab");
415+
let valueSelected = this.value;
416+
$(t).find(".dialog-message").remove();
417+
render_templates(t, activeMenu, currentCategory, valueSelected);
375418
template_import();
376419
}
377420
);
@@ -498,7 +541,8 @@
498541
let currentchunk = await get_category_templates(
499542
currentCategory,
500543
currentType,
501-
currentPage + 1
544+
currentPage + 1,
545+
currentColorType
502546
);
503547
const container = document.querySelector(".wcf-library-templates");
504548
if (currentchunk) {

assets/src/scss/wcf-template-library.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
#wcf-template-library-filter-subtype {
2626
min-width: 150px;
2727
}
28+
#wcf-template-library-color-subtype {
29+
min-width: 150px;
30+
}
2831

2932
#wcf-template-library-header-preview-back {
3033
padding: 15px;

0 commit comments

Comments
 (0)