PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.3
Yatra – Travel Booking & Tour Operator Software v3.0.3
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
yatra / assets / dist / blocks / tripcategory.js

tripcategory.js in Yatra – Travel Booking & Tour Operator Software 3.0.3, at assets/dist/blocks/tripcategory.js

248 lines 6.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function(element, blocks, blockEditor, components, i18n, ServerSideRender) {
2 "use strict";
3 function Edit({ attributes: attributes2, setAttributes }) {
4 const {
5 order,
6 columns,
7 per_page,
8 title: title2,
9 show_pagination,
10 category: category2,
11 show_trip_count,
12 show_description,
13 show_image,
14 hide_empty,
15 featured_only
16 } = attributes2;
17 return /* @__PURE__ */ element.createElement(element.Fragment, null, /* @__PURE__ */ element.createElement(blockEditor.InspectorControls, null, /* @__PURE__ */ element.createElement(
18 components.PanelBody,
19 {
20 title: i18n.__("Trip category settings", "yatra"),
21 initialOpen: true
22 },
23 /* @__PURE__ */ element.createElement(
24 components.TextControl,
25 {
26 label: i18n.__("Title", "yatra"),
27 value: title2,
28 onChange: (value) => setAttributes({ title: value })
29 }
30 ),
31 /* @__PURE__ */ element.createElement(
32 components.TextControl,
33 {
34 label: i18n.__("Categories (slugs)", "yatra"),
35 help: i18n.__(
36 "Optional. One slug or comma-separated slugs (same as the [yatra_trip_category] category attribute). Leave empty to list all categories.",
37 "yatra"
38 ),
39 value: category2,
40 onChange: (value) => setAttributes({ category: value })
41 }
42 ),
43 /* @__PURE__ */ element.createElement(
44 components.SelectControl,
45 {
46 label: i18n.__("Order", "yatra"),
47 value: order,
48 options: [
49 { label: i18n.__("Ascending", "yatra"), value: "asc" },
50 { label: i18n.__("Descending", "yatra"), value: "desc" }
51 ],
52 onChange: (value) => setAttributes({ order: value })
53 }
54 ),
55 /* @__PURE__ */ element.createElement(
56 components.RangeControl,
57 {
58 label: i18n.__("Number of categories", "yatra"),
59 value: per_page,
60 onChange: (value) => setAttributes({
61 per_page: value !== void 0 && value !== null ? value : 10
62 }),
63 min: 1,
64 max: 50
65 }
66 ),
67 /* @__PURE__ */ element.createElement(
68 components.RangeControl,
69 {
70 label: i18n.__("Columns", "yatra"),
71 value: columns,
72 onChange: (value) => setAttributes({
73 columns: value !== void 0 && value !== null ? value : 3
74 }),
75 min: 1,
76 max: 6
77 }
78 ),
79 /* @__PURE__ */ element.createElement(
80 components.ToggleControl,
81 {
82 label: i18n.__("Show pagination", "yatra"),
83 checked: show_pagination,
84 onChange: (value) => setAttributes({ show_pagination: value })
85 }
86 )
87 ), /* @__PURE__ */ element.createElement(
88 components.PanelBody,
89 {
90 title: i18n.__("Display options", "yatra"),
91 initialOpen: false
92 },
93 /* @__PURE__ */ element.createElement(
94 components.ToggleControl,
95 {
96 label: i18n.__("Show trip count", "yatra"),
97 checked: show_trip_count,
98 onChange: (value) => setAttributes({ show_trip_count: value })
99 }
100 ),
101 /* @__PURE__ */ element.createElement(
102 components.ToggleControl,
103 {
104 label: i18n.__("Show description", "yatra"),
105 checked: show_description,
106 onChange: (value) => setAttributes({ show_description: value })
107 }
108 ),
109 /* @__PURE__ */ element.createElement(
110 components.ToggleControl,
111 {
112 label: i18n.__("Show image", "yatra"),
113 checked: show_image,
114 onChange: (value) => setAttributes({ show_image: value })
115 }
116 ),
117 /* @__PURE__ */ element.createElement(
118 components.ToggleControl,
119 {
120 label: i18n.__("Hide empty categories", "yatra"),
121 checked: hide_empty,
122 onChange: (value) => setAttributes({ hide_empty: value })
123 }
124 ),
125 /* @__PURE__ */ element.createElement(
126 components.ToggleControl,
127 {
128 label: i18n.__("Featured only (filter list)", "yatra"),
129 help: i18n.__(
130 "When on, only categories with “Featured category” enabled in Yatra → Trips → Categories are listed. The red “Featured” badge on each card is controlled per category there—not by this toggle.",
131 "yatra"
132 ),
133 checked: featured_only,
134 onChange: (value) => setAttributes({ featured_only: value })
135 }
136 )
137 )), /* @__PURE__ */ element.createElement("div", { className: "yatra-block-editor-preview" }, /* @__PURE__ */ element.createElement(
138 ServerSideRender,
139 {
140 block: "yatra/trip-category",
141 attributes: attributes2,
142 key: JSON.stringify(attributes2)
143 }
144 )));
145 }
146 const $schema = "https://schemas.wp.org/trunk/block.json";
147 const apiVersion = 3;
148 const name = "yatra/trip-category";
149 const title = "Trip categories";
150 const category = "yatra";
151 const icon = "category";
152 const description = "Display trip category cards with trip counts and pricing (same layout as destinations).";
153 const keywords = [
154 "category",
155 "trip",
156 "taxonomy",
157 "yatra"
158 ];
159 const textdomain = "yatra";
160 const attributes = {
161 align: {
162 type: "string",
163 "default": ""
164 },
165 order: {
166 type: "string",
167 "default": "desc"
168 },
169 columns: {
170 type: "number",
171 "default": 3
172 },
173 per_page: {
174 type: "number",
175 "default": 10
176 },
177 title: {
178 type: "string",
179 "default": "Trip Categories"
180 },
181 show_pagination: {
182 type: "boolean",
183 "default": true
184 },
185 category: {
186 type: "string",
187 "default": ""
188 },
189 show_trip_count: {
190 type: "boolean",
191 "default": true
192 },
193 show_description: {
194 type: "boolean",
195 "default": true
196 },
197 show_image: {
198 type: "boolean",
199 "default": true
200 },
201 hide_empty: {
202 type: "boolean",
203 "default": true
204 },
205 featured_only: {
206 type: "boolean",
207 "default": false
208 }
209 };
210 const supports = {
211 html: false,
212 inserter: true,
213 align: [
214 "wide",
215 "full"
216 ]
217 };
218 const editorScript = "yatra-trip-category-block-editor";
219 const blockMetadata = {
220 $schema,
221 apiVersion,
222 name,
223 title,
224 category,
225 icon,
226 description,
227 keywords,
228 textdomain,
229 attributes,
230 supports,
231 editorScript
232 };
233 const {
234 $schema: _$schema,
235 editorScript: _$editorScript,
236 ...metadata
237 } = blockMetadata;
238 if (blocks.getBlockType(metadata.name)) {
239 blocks.unregisterBlockType(metadata.name);
240 }
241 blocks.registerBlockType(metadata.name, {
242 ...metadata,
243 edit: Edit,
244 save: () => null
245 });
246 })(wp.element, wp.blocks, wp.blockEditor, wp.components, wp.i18n, wp.serverSideRender);
247 //# sourceMappingURL=tripcategory.js.map
248