Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.24 KB | None | 0 0
  1. Index: src/Components/NeoAdminFoo/Sass/NeoAdminFoo.scss
  2. IDEA additional info:
  3. Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
  4. <+>UTF-8
  5. ===================================================================
  6. --- src/Components/NeoAdminFoo/Sass/NeoAdminFoo.scss (date 1570721516000)
  7. +++ src/Components/NeoAdminFoo/Sass/NeoAdminFoo.scss (date 1571062720242)
  8. @@ -1,1 +1,13 @@
  9. +#NeoAdminFoo{
  10. + .hotelMargin{
  11. + padding: 10px;
  12. + }
  13.  
  14. + .hotelImg {
  15. + max-width: 100%;
  16. + }
  17. +
  18. + .hotelDescription{
  19. + font-size: 14px;
  20. + }
  21. +}
  22. \ No newline at end of file
  23. Index: src/Components/NeoAdminFoo/Views/NeoAdminFoo.twig
  24. IDEA additional info:
  25. Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
  26. <+>UTF-8
  27. ===================================================================
  28. --- src/Components/NeoAdminFoo/Views/NeoAdminFoo.twig (date 1570721516000)
  29. +++ src/Components/NeoAdminFoo/Views/NeoAdminFoo.twig (date 1571062720243)
  30. @@ -1,1 +1,15 @@
  31. -<!-- HTML component content -->
  32. +{% block content %}
  33. + {% set hotelData = component.response %}
  34. + <div id="NeoAdminFoo">
  35. + <div class="row">
  36. + <div class="col-md-6">
  37. + <img class="hotelImg hotelMargin" src="{{ hotelData.media.url }}"/>
  38. + </div>
  39. + <div class="col-md-6">
  40. + <h1 class="hotelMargin">{{ hotelData.HotelName }}</h1>
  41. + <div class="hotelDescription hotelMargin">{{ hotelData.HotelDescription | raw }}</div>
  42. + <button id="diplayDescription" type="button" class="btn btn-primary hotelMargin">Ocultar Descripción</button>
  43. + </div>
  44. + </div>
  45. + </div>
  46. +{% endblock %}
  47. Index: src/Components/NeoAdminFoo/Controllers/NeoAdminFooComponent.php
  48. IDEA additional info:
  49. Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
  50. <+>UTF-8
  51. ===================================================================
  52. --- src/Components/NeoAdminFoo/Controllers/NeoAdminFooComponent.php (date 1570721516000)
  53. +++ src/Components/NeoAdminFoo/Controllers/NeoAdminFooComponent.php (date 1571062720240)
  54. @@ -40,7 +40,38 @@
  55. */
  56. public function getNewResponse(): ComponentResponseContract
  57. {
  58. - return new NeoAdminFooComponentResponse();
  59. +
  60. + $response = new NeoAdminFooComponentResponse();
  61. + //Se envia un array con una única posición por temas de testing.
  62. + $response = $this->getDetails([7]);
  63. +
  64. + return $response;
  65. + }
  66. +
  67. + /**
  68. + * Hace la llamada a los detalles del hotel. Seguidamente rellena el componente response, comprobando antes
  69. + * que el media devuelto sea una foto del hotel, y no otro tipo de documento.
  70. + *
  71. + * @param $hotelId
  72. + *
  73. + * @return NeoAdminFooComponentResponse
  74. + */
  75. + public function getDetails($hotelId): ComponentResponseContract
  76. + {
  77. + $apiResponse = ApiManager::hotelDetails($hotelId);
  78. + $hotelDetail = $apiResponse['hotel_detail'][0];
  79. + $hotelDetailResponse = new NeoAdminFooComponentResponse();
  80. + $hotelDetailResponse->setHotelName($hotelDetail['hotel_name']);
  81. + $hotelDetailResponse->setHotelDescription($hotelDetail['hotel_description']);
  82. + foreach ($hotelDetail['media'] as $media){
  83. + if($media['media_type']==='photo'){
  84. + $hotelDetailResponse->setMedia($media);
  85. + break;
  86. + }
  87. + }
  88. +
  89. +
  90. + return $hotelDetailResponse;
  91. }
  92.  
  93. /**
  94. Index: src/Model/NeoAdminFooComponentRequest.php
  95. IDEA additional info:
  96. Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
  97. <+>UTF-8
  98. ===================================================================
  99. --- src/Model/NeoAdminFooComponentRequest.php (date 1570721516000)
  100. +++ src/Model/NeoAdminFooComponentRequest.php (date 1571062720244)
  101. @@ -58,7 +58,7 @@
  102. * @var string[]
  103. */
  104. protected static $swaggerTypes = [
  105. -
  106. + 'hotel_id' => 'string'
  107. ];
  108.  
  109. /**
  110. @@ -67,7 +67,7 @@
  111. * @var string[]
  112. */
  113. protected static $swaggerFormats = [
  114. -
  115. + 'hotel_id' => null
  116. ];
  117.  
  118. /**
  119. @@ -97,7 +97,7 @@
  120. * @var string[]
  121. */
  122. protected static $attributeMap = [
  123. -
  124. + 'hotel_id' => 'HotelId'
  125. ];
  126.  
  127. /**
  128. @@ -106,7 +106,7 @@
  129. * @var string[]
  130. */
  131. protected static $setters = [
  132. -
  133. + 'hotel_id' => 'setHotelId'
  134. ];
  135.  
  136. /**
  137. @@ -115,7 +115,7 @@
  138. * @var string[]
  139. */
  140. protected static $getters = [
  141. -
  142. + 'hotel_id' => 'getHotelId'
  143. ];
  144.  
  145. /**
  146. @@ -178,6 +178,7 @@
  147. */
  148. public function __construct(array $data = null)
  149. {
  150. + $this->container['hotel_id'] = isset($data['hotel_id']) ? $data['hotel_id'] : null;
  151. }
  152.  
  153. /**
  154. @@ -203,6 +204,30 @@
  155. return count($this->listInvalidProperties()) === 0;
  156. }
  157.  
  158. +
  159. + /**
  160. + * Gets hotel_id
  161. + *
  162. + * @return string
  163. + */
  164. + public function getHotelId()
  165. + {
  166. + return $this->container['hotel_id'];
  167. + }
  168. +
  169. + /**
  170. + * Sets hotel_id
  171. + *
  172. + * @param string $hotel_id Hotel id which details are needed
  173. + *
  174. + * @return $this
  175. + */
  176. + public function setHotelId($hotel_id)
  177. + {
  178. + $this->container['hotel_id'] = $hotel_id;
  179. +
  180. + return $this;
  181. + }
  182. /**
  183. * Returns true if offset exists. False otherwise.
  184. *
  185. Index: src/Components/NeoAdminFoo/Js/NeoAdminFoo.js
  186. IDEA additional info:
  187. Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
  188. <+>UTF-8
  189. ===================================================================
  190. --- src/Components/NeoAdminFoo/Js/NeoAdminFoo.js (date 1570721516000)
  191. +++ src/Components/NeoAdminFoo/Js/NeoAdminFoo.js (date 1571062720242)
  192. @@ -1,5 +1,13 @@
  193. require('./Plugins/NeoAdminFoo');
  194.  
  195. jQuery(window).ready(function () {
  196. - //$('.example_element').examplePlugin();
  197. + $('body').on('click','#diplayDescription',function(){
  198. + //Toggles the display of the description. Also changes the button text, depending of the description display.
  199. + $('.hotelDescription').toggle();
  200. + if($('.hotelDescription').css('display')==='none'){
  201. + $('#diplayDescription').html('Ver descripción');
  202. + }else {
  203. + $('#diplayDescription').html('Ocultar descripción');
  204. + }
  205. + });
  206. });
  207. Index: src/Model/NeoAdminFooComponentResponse.php
  208. IDEA additional info:
  209. Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
  210. <+>UTF-8
  211. ===================================================================
  212. --- src/Model/NeoAdminFooComponentResponse.php (date 1570721516000)
  213. +++ src/Model/NeoAdminFooComponentResponse.php (date 1571062720245)
  214. @@ -57,7 +57,10 @@
  215. * @var string[]
  216. */
  217. protected static $swaggerTypes = [
  218. - 'error' => '\NeoAdminComponents\Model\ComponentResponseError[]'
  219. + 'error' => '\NeoAdminComponents\Model\ComponentResponseError[]',
  220. + 'hotel_name' => 'string',
  221. + 'hotel_description' => 'string',
  222. + 'media' => 'object'
  223. ];
  224.  
  225. /**
  226. @@ -66,7 +69,10 @@
  227. * @var string[]
  228. */
  229. protected static $swaggerFormats = [
  230. - 'error' => null
  231. + 'error' => null,
  232. + 'hotel_name' => null,
  233. + 'hotel_description' => null,
  234. + 'media' => null
  235. ];
  236.  
  237. /**
  238. @@ -96,7 +102,10 @@
  239. * @var string[]
  240. */
  241. protected static $attributeMap = [
  242. - 'error' => 'Error'
  243. + 'error' => 'Error',
  244. + 'hotel_name' => 'HotelName',
  245. + 'hotel_description' => 'HotelDescription',
  246. + 'media' => 'Media'
  247. ];
  248.  
  249. /**
  250. @@ -105,7 +114,10 @@
  251. * @var string[]
  252. */
  253. protected static $setters = [
  254. - 'error' => 'setError'
  255. + 'error' => 'setError',
  256. + 'hotel_name' => 'setHotelName',
  257. + 'hotel_description' => 'setHotelDescription',
  258. + 'media' => 'setMedia'
  259. ];
  260.  
  261. /**
  262. @@ -114,7 +126,10 @@
  263. * @var string[]
  264. */
  265. protected static $getters = [
  266. - 'error' => 'getError'
  267. + 'error' => 'getError',
  268. + 'hotel_name' => 'getHotelName',
  269. + 'hotel_description' => 'getHotelDescription',
  270. + 'media' => 'getMedia'
  271. ];
  272.  
  273. /**
  274. @@ -178,6 +193,9 @@
  275. public function __construct(array $data = null)
  276. {
  277. $this->container['error'] = isset($data['error']) ? $data['error'] : null;
  278. + $this->container['hotel_name'] = isset($data['hotel_name']) ? $data['hotel_name'] : null;
  279. + $this->container['hotel_description'] = isset($data['hotel_description']) ? $data['hotel_description'] : null;
  280. + $this->container['media'] = isset($data['media']) ? $data['media'] : null;
  281. }
  282.  
  283. /**
  284. @@ -225,6 +243,78 @@
  285. {
  286. $this->container['error'] = $error;
  287.  
  288. + return $this;
  289. + }
  290. +
  291. + /**
  292. + * Gets hotel_name
  293. + *
  294. + * @return string
  295. + */
  296. + public function getHotelName()
  297. + {
  298. + return $this->container['hotel_name'];
  299. + }
  300. +
  301. + /**
  302. + * Sets hotel_name
  303. + *
  304. + * @param string $hotel_name Name of the hotel needed
  305. + *
  306. + * @return $this
  307. + */
  308. + public function setHotelName($hotel_name)
  309. + {
  310. + $this->container['hotel_name'] = $hotel_name;
  311. +
  312. + return $this;
  313. + }
  314. +
  315. + /**
  316. + * Gets hotel_description
  317. + *
  318. + * @return string
  319. + */
  320. + public function getHotelDescription()
  321. + {
  322. + return $this->container['hotel_description'];
  323. + }
  324. +
  325. + /**
  326. + * Sets hotel_description
  327. + *
  328. + * @param string $hotel_description Description of the hotel needed
  329. + *
  330. + * @return $this
  331. + */
  332. + public function setHotelDescription($hotel_description)
  333. + {
  334. + $this->container['hotel_description'] = $hotel_description;
  335. +
  336. + return $this;
  337. + }
  338. +
  339. + /**
  340. + * Gets media
  341. + *
  342. + * @return object
  343. + */
  344. + public function getMedia()
  345. + {
  346. + return $this->container['media'];
  347. + }
  348. +
  349. + /**
  350. + * Sets media
  351. + *
  352. + * @param object $media Media details where image photo resides
  353. + *
  354. + * @return $this
  355. + */
  356. + public function setMedia($media)
  357. + {
  358. + $this->container['media'] = $media;
  359. +
  360. return $this;
  361. }
  362. /**
  363. Index: swagger.yaml
  364. IDEA additional info:
  365. Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
  366. <+>UTF-8
  367. ===================================================================
  368. --- swagger.yaml (date 1570721516000)
  369. +++ swagger.yaml (date 1571062720246)
  370. @@ -1075,9 +1075,24 @@
  371. description: Modelo del request del componente NeoAdminFoo
  372. type: object
  373. required: []
  374. + properties:
  375. + HotelId:
  376. + description: Hotel id which details are needed
  377. + type: string
  378.  
  379. NeoAdminFooComponentResponse:
  380. allOf:
  381. - $ref: '#/definitions/ComponentResponse'
  382. - type: object
  383. description: Modelo del response del componente NeoAdminFoo
  384. + properties:
  385. + HotelName:
  386. + description: Name of the hotel needed
  387. + type: string
  388. + HotelDescription:
  389. + description: Description of the hotel needed
  390. + type: string
  391. + Media:
  392. + type: object
  393. + description: Media details where image photo resides
  394. +
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement