kirgudu_base 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (187) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/kirgudu_base/dynamicEvents.js +2 -1
  3. data/app/assets/javascripts/kirgudu_base/jquery.container-management.js +241 -0
  4. data/app/assets/javascripts/kirgudu_base/jquery.fancybox copia.js +2020 -0
  5. data/app/assets/javascripts/kirgudu_base/scripts_nrg.js +300 -383
  6. data/app/controllers/kirgudu_base/admin_controller.rb +1 -44
  7. data/app/controllers/kirgudu_base/application_controller.rb +135 -92
  8. data/app/controllers/kirgudu_base/cabinet_controller.rb +35 -35
  9. data/app/controllers/kirgudu_base/security/authentications_controller.rb +452 -0
  10. data/app/controllers/kirgudu_base/security/email_confirmations_controller.rb +46 -0
  11. data/app/helpers/kirgudu_base/application_helper.rb +25 -0
  12. data/app/helpers/kirgudu_base/authentication_form_builder.rb +76 -0
  13. data/app/helpers/kirgudu_base/controllers/{basic_actions_with_parent.rb → OLD_basic_actions.rb} +39 -54
  14. data/app/helpers/kirgudu_base/controllers/basic_actions.rb +967 -161
  15. data/app/helpers/kirgudu_base/controllers/container_items_management_actions.rb +118 -40
  16. data/app/helpers/kirgudu_base/controllers/container_items_sorting_actions.rb +2 -2
  17. data/app/helpers/kirgudu_base/controllers/dynamic_pages.rb +147 -11
  18. data/app/helpers/kirgudu_base/form_builder.rb +3 -1
  19. data/app/helpers/kirgudu_base/gui_helper.rb +10 -5
  20. data/app/helpers/kirgudu_base/models/exports.rb +122 -122
  21. data/app/helpers/kirgudu_base/models/scopes.rb +5 -0
  22. data/app/mailers/authentications_mailer.rb +53 -0
  23. data/app/models/kirgudu_base/base_model.rb +47 -14
  24. data/app/models/kirgudu_base/dynamic_pages/builder.rb +0 -8
  25. data/app/models/kirgudu_base/dynamic_pages/controller_link.rb +4 -1
  26. data/app/models/kirgudu_base/dynamic_pages/controller_link_builder.rb +2 -1
  27. data/app/models/kirgudu_base/dynamic_pages/controller_link_id.rb +6 -6
  28. data/app/models/kirgudu_base/dynamic_pages/controller_link_id_builder.rb +6 -6
  29. data/app/models/kirgudu_base/dynamic_pages/element.rb +4 -5
  30. data/app/models/kirgudu_base/dynamic_pages/entry_builder.rb +2 -2
  31. data/app/models/kirgudu_base/dynamic_pages/event_if_block_builder.rb +1 -1
  32. data/app/models/kirgudu_base/dynamic_pages/form_builder.rb +2 -2
  33. data/app/models/kirgudu_base/dynamic_pages/list.rb +2 -0
  34. data/app/models/kirgudu_base/dynamic_pages/list_builder.rb +7 -3
  35. data/app/models/kirgudu_base/dynamic_pages/management_settings.rb +30 -0
  36. data/app/models/kirgudu_base/dynamic_pages/management_settings_builder.rb +47 -0
  37. data/app/models/kirgudu_base/dynamic_pages/menu.rb +9 -5
  38. data/app/models/kirgudu_base/dynamic_pages/menu_builder.rb +8 -5
  39. data/app/models/kirgudu_base/dynamic_pages/menu_item.rb +22 -6
  40. data/app/models/kirgudu_base/dynamic_pages/menu_items_block_builder.rb +9 -4
  41. data/app/models/kirgudu_base/dynamic_pages/menu_section.rb +38 -0
  42. data/app/models/kirgudu_base/dynamic_pages/menu_section_builder.rb +36 -0
  43. data/app/models/kirgudu_base/dynamic_pages/page.rb +6 -2
  44. data/app/models/kirgudu_base/dynamic_pages/page_builder.rb +18 -0
  45. data/app/models/kirgudu_base/dynamic_pages/relation.rb +23 -0
  46. data/app/models/kirgudu_base/dynamic_pages/relation_builder.rb +35 -0
  47. data/app/models/kirgudu_base/dynamic_pages/sorting_settings.rb +31 -0
  48. data/app/models/kirgudu_base/dynamic_pages/sorting_settings_builder.rb +48 -0
  49. data/app/models/kirgudu_base/security/autheintication.rb +4 -0
  50. data/app/models/kirgudu_base/security/authentication.rb +6 -7
  51. data/app/models/kirgudu_base/security/email_confirmation.rb +7 -0
  52. data/app/models/kirgudu_base/security/restore_password_code.rb +5 -0
  53. data/app/models/kirgudu_base/security/user.rb +2 -0
  54. data/app/models/kirgudu_base/security.rb +6 -7
  55. data/app/models/kirgudu_base/settings/group.rb +22 -0
  56. data/app/models/kirgudu_base/settings/option.rb +44 -0
  57. data/app/models/kirgudu_base/settings/settings_manager.rb +69 -0
  58. data/app/models/kirgudu_base/settings/value.rb +36 -0
  59. data/app/views/admin_templates/default/admin/layouts/application.html.erb +6 -4
  60. data/app/views/admin_templates/default/admin/system/settings/groups/edit.html.erb +9 -9
  61. data/app/views/admin_templates/default/admin/system/settings/groups/new.html.erb +1 -1
  62. data/app/views/admin_templates/default/admin/system/settings/options/edit.html.erb +1 -1
  63. data/app/views/admin_templates/default/admin/system/settings/options/new.html.erb +1 -1
  64. data/app/views/admin_templates/default/admin/system/settings/values/edit.html.erb +1 -1
  65. data/app/views/admin_templates/default/admin/system/settings/values/new.html.erb +1 -1
  66. data/app/views/admin_templates/erp/admin/shared/_top_nav_bar.html.erb +1 -3
  67. data/app/views/admin_templates/erp/admin/shared/entry_edit_form_renderer.html.erb +1 -1
  68. data/app/views/admin_templates/erp/admin/shared/entry_new_form_renderer.html.erb +1 -1
  69. data/app/views/admin_templates/good/admin/layouts/OLD_application.html.erb +14 -14
  70. data/app/views/admin_templates/good/admin/layouts/application.html.erb +11 -113
  71. data/app/views/admin_templates/good/admin/shared/_left_menu.html.erb +74 -63
  72. data/app/views/admin_templates/good/{zapanel/files/New Adobe Photoshop Image 12.psd → admin/shared/_left_menu_item.html.erb} +0 -0
  73. data/app/views/admin_templates/good/admin/shared/_left_menu_section.html.erb +21 -0
  74. data/app/views/admin_templates/good/admin/shared/render_new_OLD.html.erb +90 -0
  75. data/app/views/admin_templates/good/admin/shared/renderer_edit.html.erb +44 -13
  76. data/app/views/admin_templates/good/admin/shared/renderer_edit_OLD.html.erb +106 -0
  77. data/app/views/admin_templates/good/admin/shared/renderer_entries_list.html.erb +39 -18
  78. data/app/views/admin_templates/good/admin/shared/renderer_entries_list_with_parent.html.erb +4 -4
  79. data/app/views/admin_templates/good/admin/shared/renderer_management.html.erb +164 -0
  80. data/app/views/admin_templates/good/admin/shared/renderer_new.html.erb +40 -10
  81. data/app/views/admin_templates/good/admin/shared/renderer_show.html.erb +170 -58
  82. data/app/views/admin_templates/good/admin/shared/renderer_show_OLD.html.erb +159 -0
  83. data/app/views/admin_templates/good/admin/shared/renderer_sorting.html.erb +30 -0
  84. data/app/views/admin_templates/good/kirgudu_base/authentications/login.html.erb +13 -13
  85. data/app/views/admin_templates/good/kirgudu_base/authentications/register.html.erb +1 -1
  86. data/app/views/admin_templates/good/kirgudu_base/old/login_page.html.erb +7 -7
  87. data/app/views/admin_templates/good_flexy/admin/layouts/application.html.erb +17 -16
  88. data/app/views/admin_templates/good_flexy/admin/shared/_left_menu.html.erb +7 -0
  89. data/app/views/admin_templates/good_flexy/admin/shared/renderer_entries_list.html.erb +25 -17
  90. data/app/views/admin_templates/good_flexy/admin/shared/renderer_form_edit.html.erb +34 -13
  91. data/app/views/admin_templates/good_flexy/admin/shared/renderer_form_new.html.erb +31 -10
  92. data/app/views/admin_templates/good_flexy/admin/shared/renderer_show.html.erb +67 -52
  93. data/config/locales/kirgudu_base.ru.yml +92 -0
  94. data/config/routes.rb +16 -16
  95. data/db/migrate/20140413134252_create_kirgudu_base_security_authentications.rb +15 -0
  96. data/db/migrate/20140413152144_create_kirgudu_base_security_email_confirmations.rb +17 -0
  97. data/db/migrate/20140413201121_add_confirmations_kirgudu_base_security_users.rb +14 -0
  98. data/db/migrate/20140415093106_create_kirgudu_base_security_restore_password_codes.rb +20 -0
  99. data/lib/kirgudu_base.rb +2 -2
  100. data/test/fixtures/kirgudu_base/kirgudu_base/security/autheintications.yml +11 -0
  101. data/test/fixtures/kirgudu_base/security/applications.yml +21 -0
  102. data/test/fixtures/kirgudu_base/security/autheintications.yml +11 -0
  103. data/test/fixtures/kirgudu_base/security/authentications.yml +11 -0
  104. data/test/fixtures/kirgudu_base/security/email_confirmations.yml +13 -0
  105. data/test/fixtures/kirgudu_base/security/restore_password_codes.yml +13 -0
  106. data/test/models/kirgudu_base/kirgudu_base/security/autheintication_test.rb +9 -0
  107. data/test/models/kirgudu_base/security/application_test.rb +9 -0
  108. data/test/models/kirgudu_base/security/autheintication_test.rb +9 -0
  109. data/test/models/kirgudu_base/security/authentication_test.rb +9 -0
  110. data/test/models/kirgudu_base/security/email_confirmation_test.rb +9 -0
  111. data/test/models/kirgudu_base/security/restore_password_code_test.rb +9 -0
  112. metadata +102 -79
  113. data/app/assets/javascripts/kirgudu_base/jquery.fancybox.pack.js +0 -45
  114. data/app/controllers/kirgudu_base/authentications_controller.rb +0 -157
  115. data/app/views/admin_templates/good/zapanel/404.html +0 -386
  116. data/app/views/admin_templates/good/zapanel/billing.html +0 -550
  117. data/app/views/admin_templates/good/zapanel/blank-page.html +0 -343
  118. data/app/views/admin_templates/good/zapanel/buttons.html +0 -1018
  119. data/app/views/admin_templates/good/zapanel/calendars.html +0 -451
  120. data/app/views/admin_templates/good/zapanel/cart.html +0 -522
  121. data/app/views/admin_templates/good/zapanel/charts.html +0 -611
  122. data/app/views/admin_templates/good/zapanel/collapse.html +0 -555
  123. data/app/views/admin_templates/good/zapanel/contact.php +0 -102
  124. data/app/views/admin_templates/good/zapanel/dashboard.html +0 -985
  125. data/app/views/admin_templates/good/zapanel/dashboard2.html +0 -1091
  126. data/app/views/admin_templates/good/zapanel/dashboard3.html +0 -1079
  127. data/app/views/admin_templates/good/zapanel/data/movies.json +0 -1
  128. data/app/views/admin_templates/good/zapanel/faq.html +0 -435
  129. data/app/views/admin_templates/good/zapanel/file-manager.html +0 -358
  130. data/app/views/admin_templates/good/zapanel/files/index.php +0 -0
  131. data/app/views/admin_templates/good/zapanel/font-awesome/less/bootstrap.less +0 -84
  132. data/app/views/admin_templates/good/zapanel/font-awesome/less/core.less +0 -129
  133. data/app/views/admin_templates/good/zapanel/font-awesome/less/extras.less +0 -93
  134. data/app/views/admin_templates/good/zapanel/font-awesome/less/font-awesome-ie7.less +0 -1953
  135. data/app/views/admin_templates/good/zapanel/font-awesome/less/font-awesome.less +0 -33
  136. data/app/views/admin_templates/good/zapanel/font-awesome/less/icons.less +0 -381
  137. data/app/views/admin_templates/good/zapanel/font-awesome/less/mixins.less +0 -48
  138. data/app/views/admin_templates/good/zapanel/font-awesome/less/path.less +0 -14
  139. data/app/views/admin_templates/good/zapanel/font-awesome/less/variables.less +0 -735
  140. data/app/views/admin_templates/good/zapanel/font-awesome/scss/_bootstrap.scss +0 -84
  141. data/app/views/admin_templates/good/zapanel/font-awesome/scss/_core.scss +0 -129
  142. data/app/views/admin_templates/good/zapanel/font-awesome/scss/_extras.scss +0 -93
  143. data/app/views/admin_templates/good/zapanel/font-awesome/scss/_icons.scss +0 -381
  144. data/app/views/admin_templates/good/zapanel/font-awesome/scss/_mixins.scss +0 -48
  145. data/app/views/admin_templates/good/zapanel/font-awesome/scss/_path.scss +0 -14
  146. data/app/views/admin_templates/good/zapanel/font-awesome/scss/_variables.scss +0 -734
  147. data/app/views/admin_templates/good/zapanel/font-awesome/scss/font-awesome-ie7.scss +0 -1953
  148. data/app/views/admin_templates/good/zapanel/font-awesome/scss/font-awesome.scss +0 -33
  149. data/app/views/admin_templates/good/zapanel/form.html +0 -790
  150. data/app/views/admin_templates/good/zapanel/gallery.html +0 -392
  151. data/app/views/admin_templates/good/zapanel/grids.html +0 -574
  152. data/app/views/admin_templates/good/zapanel/hosting-dashboard.html +0 -448
  153. data/app/views/admin_templates/good/zapanel/icon.html +0 -722
  154. data/app/views/admin_templates/good/zapanel/inbox.html +0 -375
  155. data/app/views/admin_templates/good/zapanel/index.html +0 -48
  156. data/app/views/admin_templates/good/zapanel/invoice.html +0 -423
  157. data/app/views/admin_templates/good/zapanel/js/proxy/elFinderSupportVer1.js +0 -338
  158. data/app/views/admin_templates/good/zapanel/js/skins/default/lightbox-close.png +0 -0
  159. data/app/views/admin_templates/good/zapanel/js/skins/default/lightbox-next.png +0 -0
  160. data/app/views/admin_templates/good/zapanel/js/skins/default/lightbox-prev.png +0 -0
  161. data/app/views/admin_templates/good/zapanel/notification.html +0 -400
  162. data/app/views/admin_templates/good/zapanel/order-recieved.html +0 -348
  163. data/app/views/admin_templates/good/zapanel/php/MySQLStorage.sql +0 -23
  164. data/app/views/admin_templates/good/zapanel/php/connector.php +0 -44
  165. data/app/views/admin_templates/good/zapanel/php/elFinder.class.php +0 -1103
  166. data/app/views/admin_templates/good/zapanel/php/elFinderConnector.class.php +0 -133
  167. data/app/views/admin_templates/good/zapanel/php/elFinderVolumeDriver.class.php +0 -3370
  168. data/app/views/admin_templates/good/zapanel/php/elFinderVolumeLocalFileSystem.class.php +0 -835
  169. data/app/views/admin_templates/good/zapanel/php/elFinderVolumeMySQL.class.php +0 -896
  170. data/app/views/admin_templates/good/zapanel/php/mime.types +0 -512
  171. data/app/views/admin_templates/good/zapanel/price-table.html +0 -400
  172. data/app/views/admin_templates/good/zapanel/profile.html +0 -387
  173. data/app/views/admin_templates/good/zapanel/progressbar.html +0 -555
  174. data/app/views/admin_templates/good/zapanel/range-slider.html +0 -440
  175. data/app/views/admin_templates/good/zapanel/ribbon-grids.html +0 -491
  176. data/app/views/admin_templates/good/zapanel/sale-purchase-dashboard.html +0 -803
  177. data/app/views/admin_templates/good/zapanel/search.html +0 -370
  178. data/app/views/admin_templates/good/zapanel/skins/default/lightbox-close.png +0 -0
  179. data/app/views/admin_templates/good/zapanel/skins/default/lightbox-loading.gif +0 -0
  180. data/app/views/admin_templates/good/zapanel/skins/default/lightbox-next.png +0 -0
  181. data/app/views/admin_templates/good/zapanel/skins/default/lightbox-pause.png +0 -0
  182. data/app/views/admin_templates/good/zapanel/skins/default/lightbox-play.png +0 -0
  183. data/app/views/admin_templates/good/zapanel/skins/default/lightbox-playvideo.png +0 -0
  184. data/app/views/admin_templates/good/zapanel/skins/default/lightbox-prev.png +0 -0
  185. data/app/views/admin_templates/good/zapanel/slider.html +0 -453
  186. data/app/views/admin_templates/good/zapanel/tables.html +0 -470
  187. data/app/views/admin_templates/good/zapanel/typography.html +0 -746
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de6ac3436756f7fa031556a7a381d19ba583c1cc
4
- data.tar.gz: 7bc2e18b8fa930785762383f8e2158763f11ab0e
3
+ metadata.gz: ecd323bdcf486c841acadcab10db9faab2582b1b
4
+ data.tar.gz: db180e8e1676927a52bb85041b8917973aff9090
5
5
  SHA512:
6
- metadata.gz: c77040972abbdea8a662441e4a60c0ced2f3cf98d7a297d19fd9466614723a88f909acc8c44a7a7567b45f1f1f2f8b81d3ad7826b128591895d91bc334d3fcb9
7
- data.tar.gz: 98f5d125d6b01fda9610f84bf2bf088253f2ab1db3d761e6a0e3e7d0dcb1ea551085ac732a064c14ed58166b8f7eee4876f11f7b3fc59f693264bc5ec6357760
6
+ metadata.gz: fde871d9f7d72d1e835c2e358a0f7250c1b13df2dece8da65af85c023f99acd5b34323ec82cd49555a37796d26447181a622eb34a86f82aabdc421136bfce26c
7
+ data.tar.gz: 0f22e2ae17276530d4a7b84a103396e17f35c9a915dae1ec3199fdf69ca92e47cb12caf0b26168c70854bbbde17c5c99f9518a34d45489a9146746755481d4a8
@@ -103,6 +103,7 @@ function dynamicEvents_applyTo_chosenSelect(parent_control, control, action) {
103
103
  else if (action.name == "retrieve") {
104
104
 
105
105
  var ajaxDataOptions = {};
106
+ ajaxDataOptions["per_page"] = 99999;
106
107
 
107
108
  ajaxDataOptions[parent_control.attr('property-name')] = parent_value;
108
109
 
@@ -120,7 +121,7 @@ function dynamicEvents_applyTo_chosenSelect(parent_control, control, action) {
120
121
  control.removeAttr("disabled");
121
122
  //console.log("found entry: " + $.toJSON(data));
122
123
  if (data.status == 2) {
123
- control.append("<option value=''>" + control.attr('data-placeholder') + "</option>");
124
+ control.append("<option value=''>" + control.attr('placeholder') + "</option>");
124
125
  $.each(data.data, function (index, entry) {
125
126
  control.append("<option value='" + entry.id + "'>" + entry.name + "</option>");
126
127
  });
@@ -0,0 +1,241 @@
1
+ /**
2
+ * jquery.autocomplete-with-id.js v1.0
3
+ * jQuery iPhone-like switch button
4
+ * @author Antonio Veracruz Development <development@antonio-veracruz.com>
5
+ *
6
+ * Copyright (c) Antonio Veracruz Development - released under MIT License {{{
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person
9
+ * obtaining a copy of this software and associated documentation
10
+ * files (the "Software"), to deal in the Software without
11
+ * restriction, including without limitation the rights to use,
12
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ * copies of the Software, and to permit persons to whom the
14
+ * Software is furnished to do so, subject to the following
15
+ * conditions:
16
+
17
+ * The above copyright notice and this permission notice shall be
18
+ * included in all copies or substantial portions of the Software.
19
+
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27
+ * OTHER DEALINGS IN THE SOFTWARE.
28
+
29
+ * }}}
30
+ */
31
+
32
+ /*
33
+ * Meant to be used on a <input type="checkbox">, this widget will replace the receiver element with an iPhone-style
34
+ * switch button with two states: "on" and "off".
35
+ * Labels of the states are customizable, as are their presence and position. The receiver element's "checked" attribute
36
+ * is updated according to the state of the switch, so that it can be used in a <form>.
37
+ *
38
+ */
39
+
40
+ (function ($) {
41
+
42
+ $.widget("sylightsUI.containerManagement", {
43
+
44
+ options: {
45
+ url: null,
46
+ data_type: "json",
47
+ method: "get",
48
+
49
+ show_labels: true,
50
+ placeholder: "",
51
+ hint: "",
52
+ value_property: "id",
53
+ label_property: "name",
54
+
55
+ clear: true,
56
+ clear_after: null,
57
+ css_text_container: null,
58
+ css_label_container: null
59
+
60
+ },
61
+
62
+ _create: function () {
63
+ this._initControl();
64
+ this._initPluginEvents();
65
+ },
66
+
67
+
68
+ _initControl: function () {
69
+
70
+ var gallery = $(gallery_css);
71
+ var tray = $(tray_css);
72
+ var management_url_add = $(url_css + "[type='add']").first().attr('href');
73
+ var management_url_remove = $(url_css + "[type='remove']").first().attr('href');
74
+
75
+ //alert("URL ADD CSS: " + url_css+"[type='add']\r\nURL ADD: " + management_url_add + "\r\nURL REMOVE: " + management_url_remove);
76
+
77
+ $("li", gallery).draggable({
78
+ cancel: "a.ui-icon",
79
+ revert: "invalid",
80
+ cursor: "move",
81
+ helper: "clone"
82
+ });
83
+
84
+ tray.droppable({
85
+ accept: gallery_css + " > li",
86
+ drop: function (event, ui) {
87
+ //alert("URL Add: " + management_url_add);
88
+ makeAjaxCall(management_url_add, {
89
+ method: 'post',
90
+ dataType: 'json',
91
+ data: {entry_id: ui.draggable.attr('entry-id')},
92
+ success: function (data) {
93
+ if (data.status == "management_ok") {
94
+ ui.draggable.fadeOut(function () {
95
+ tray.append(ui.draggable);
96
+ ui.draggable.fadeIn();
97
+ ui.draggable.append(" --- <a href=\"javascript:managementRemoveItem( '" + management_url_remove + "', '" + tray_css + "', " + ui.draggable.attr('entry-id') + " );\"> </a>");
98
+ });
99
+ }
100
+ else {
101
+ showFancyMessage(data.message);
102
+ }
103
+ },
104
+ error: function () {
105
+ showFancyMessage();
106
+ }
107
+ });
108
+ }
109
+ });
110
+
111
+
112
+
113
+ // Call refresh to update labels text and visibility
114
+ self._refresh();
115
+ },
116
+
117
+ _refresh: function () {
118
+ var self = this;
119
+
120
+ //alert("Label: " + this.label + "; Placeholder: " + this.placeholer );
121
+ if (self.editMode)
122
+ {
123
+ // edit mode
124
+ self.text_container.val(self.label);
125
+ self.label_container.hide();
126
+ self.text_container.show();
127
+ self.text_container.focus();
128
+ }
129
+ else
130
+ {
131
+ //label mode
132
+ self.label_container.html(self.label || self.placeholder);
133
+ self.text_container.hide();
134
+ self.label_container.show();
135
+ }
136
+ },
137
+
138
+
139
+ _initEvents: function () {
140
+ var self = this;
141
+ },
142
+
143
+
144
+ _initPluginEvents: function () {
145
+ var self = this;
146
+
147
+ self.label_container.click(function () {
148
+ self.editMode = true;
149
+ self._refresh();
150
+ });
151
+
152
+
153
+ self.text_container.focusout(
154
+ function(){
155
+ new_text_value = self.text_container.val().trim();
156
+ if ( new_text_value == ""){
157
+ self.value = null;
158
+ self.label = null;
159
+ self.id_container.val("");
160
+ }
161
+ self.editMode = false;
162
+ self._refresh()
163
+ }
164
+ );
165
+
166
+ self.text_container.autocomplete({
167
+ delay: 0,
168
+ source: function (request, response) {
169
+
170
+ var ajax_params = {};
171
+ ajax_params[self.search_property] = request.term;
172
+
173
+ if (this.parent_container != null) {
174
+ ajax_params[this.parent_container.attr('property-name')] = this.parent_container.attr('value');
175
+ }
176
+ $.ajax({
177
+ url: self.options.url,
178
+ dataType: "json",
179
+ data: ajax_params,
180
+ beforeSend: function (xhr) {
181
+ xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'));
182
+ },
183
+ success: function (data) {
184
+ //alert(jQuery.toJSON(data));
185
+ if (data.status == 2) {
186
+ //console.log("Autocompelete Result: " + $.toJSON(data.data));
187
+ response($.map(data.data, function (item) {
188
+ //console.log("Label Property: " + self.options.label_property);
189
+ //console.log("Value Property: " + self.options.value_property);
190
+ return {
191
+ label: item[self.options.label_property],
192
+ value: item[self.options.value_property]
193
+ }
194
+ }));
195
+ }
196
+ }
197
+
198
+ });
199
+ },
200
+ //minLength: 2,
201
+ select: function (event, ui) {
202
+ self.value = ui.item.value;
203
+ self.label = ui.item.label;
204
+ self.id_container.val(self.value);
205
+ self.text_container.val(self.label);
206
+
207
+ self.editMode = false; // label model
208
+ self._refresh();
209
+
210
+ return false;
211
+ },
212
+ open: function () {
213
+ self.menu_is_open = true;
214
+ },
215
+ close: function () {
216
+ self.menu_is_open = false;
217
+ }
218
+ });
219
+ },
220
+
221
+
222
+ _setDefaultValue: function(){
223
+ var self = this;
224
+ self.id_container.val(self.defaultValue);
225
+ self.label = self.defaultLabel;
226
+ self.value = self.defaultValue;
227
+ },
228
+
229
+ _nullifyValue: function(){
230
+ var self = this;
231
+ self.id_container.val(null);
232
+ self.label = null;
233
+ self.value = null;
234
+ }
235
+
236
+ });
237
+
238
+ })(jQuery);
239
+
240
+
241
+