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
@@ -1,16 +1,28 @@
1
1
  <div class="col-md-12">
2
- <button class="btn blue" type="button" href="<%= self.controller.to_url_for(:new) %>">New</button>
2
+ <button class="btn blue action-button" type="button" href="<%= self.controller.to_url_for(:new, data[:parent_ids]) %>">
3
+ <%= I18n.t("common.menus.buttons_menu.new") %>
4
+ </button>
5
+
6
+
7
+ <% data[:page].menus[:top_menu].items.each do |menu_item| %>
8
+ <button class="btn green action-button" type="button" href="<%= menu_item.build_url(self.controller, data[:parent_ids]) %>">
9
+ <%= menu_item.i18n_data_as_string(:label) || I18n.t("common.menus.buttons_menu.#{menu_item.name}") %>
10
+ </button>
11
+ <% end if data[:page].menus[:top_menu] %>
12
+
3
13
  </div>
4
14
 
15
+
5
16
  <script>
6
17
  $(document).ready(
7
18
  function () {
8
- $('.btn').click(function () {
19
+ $('.action-button').click(function () {
9
20
  window.location = $(this).attr('href')
10
21
  });
11
22
  }
12
23
  );
13
24
  </script>
25
+
14
26
  <style>
15
27
  .td {
16
28
 
@@ -57,7 +69,7 @@
57
69
  <%= I18n.t("activerecord.attributes.#{self.controller.entry_class.to_i18n}.id") %>
58
70
  </th>
59
71
  <% end %>
60
- <% page.lists[:entries_list].properties.each do |property| %>
72
+ <% data[:page].lists[:entries_list].properties.each_pair do |key, property| %>
61
73
  <th>
62
74
  <%= property.label ? property.i18n_data_as_string(:label) : I18n.t("activerecord.attributes.#{self.controller.entry_class.to_i18n}.#{property.name}") %>
63
75
  </th>
@@ -68,7 +80,7 @@
68
80
  </tr>
69
81
  </thead>
70
82
  <tbody>
71
- <% entries_list.each do |item| %>
83
+ <% data[:entries].each do |item| %>
72
84
  <tr>
73
85
  <% if @settings_manager.get('additional_use_bulk_action') == true %>
74
86
  <td>
@@ -85,16 +97,15 @@
85
97
  <%= print_property(item, :id) %>
86
98
  </td>
87
99
  <% end %>
88
- <% page.lists[:entries_list].properties.each do | property| %>
100
+ <% data[:page].lists[:entries_list].properties.each_pair do |key, property| %>
89
101
  <td>
90
102
  <%= print_property(item, property.text_value_property || property.name) %>
91
103
  </td>
92
104
  <% end %>
93
105
  <td>
94
- <%= link_to "show", self.controller.to_url_for(:show, id: item) %>
95
- <%= link_to "edit", self.controller.to_url_for(:edit, id: item) %>
96
- <%= link_to "delete", self.controller.to_url_for(:edit, id: item) %>
97
-
106
+ <%= link_to "show", self.controller.to_url_for(:show, data[:parent_ids].merge(id: item.id)) %>
107
+ <%= link_to "edit", self.controller.to_url_for(:edit, data[:parent_ids].merge(id: item.id)) %>
108
+ <%= link_to "delete1", self.controller.to_url_for(:destroy, data[:parent_ids].merge(id: item.id)), :"redirect-url" => data[:current_url], class: "delete-button" %>
98
109
  </td>
99
110
  </tr>
100
111
  <% end %>
@@ -102,13 +113,13 @@
102
113
  </table>
103
114
  <div id="summary">
104
115
  <div>
105
- <%= will_paginate entries_list %>
116
+ <%= will_paginate data[:entries] %>
106
117
  </div>
107
118
  </div>
108
119
  </div>
109
120
  <div class="pagLegend">
110
- <div>Всего записей: <strong><%= entries_list.total_entries %></strong></div>
111
- <div>Страницы: <strong><%= entries_list.current_page %></strong> из <strong><%= entries_list.total_pages %></strong>
121
+ <div>Всего записей: <strong><%= data[:entries].total_entries %></strong></div>
122
+ <div>Страницы: <strong><%= data[:entries].current_page %></strong> из <strong><%= data[:entries].total_pages %></strong>
112
123
  </div>
113
124
  </div>
114
125
  </div>
@@ -127,27 +138,27 @@
127
138
  <%= I18n.t("common.section_titles.filters") %>
128
139
  </h3>
129
140
  </div>
130
- <% if page.lists[:entries_list].filters.select{ |filter| filter.visible == :true }.length > 0 %>
141
+ <% if data[:page].lists[:entries_list].filters.select{ |filter| filter.visible == :true }.length > 0 %>
131
142
  <div class="widget-sec">
132
- <%= form_tag(self.controller.to_url_for(:index), id: "filters-form", method: :get ) do %>
133
- <% page.lists[:entries_list].filters.select{ |f| f.visible == :true }.each do |filter| %>
143
+ <%= form_tag(self.controller.to_url_for(:index, data[:parent_ids]), id: "filters-form", method: :get ) do %>
144
+ <% data[:page].lists[:entries_list].filters.select{ |f| f.visible == :true }.each do |filter| %>
134
145
  <div class="form-group">
135
146
  <label for="exampleInputEmail1">
136
147
  <%= filter.i18n_data_as_string(:label) || filter.name %>
137
148
  </label>
138
- <%= control_tag filter, params, filters_data[filter.name], class: "form-control" %>
149
+ <%= control_tag filter, params, data[:filters_data][filter.name], class: "form-control" %>
139
150
  </div>
140
151
  <% end %>
141
152
 
142
153
  <button type="submit" class="btn gray pull-right">
143
154
  <%= I18n.t("common.buttons.filter") %>
144
155
  </button>
145
- <a href="<%= self.controller.to_url_for(:index) %>">
156
+ <a href="<%= self.controller.to_url_for(:index, data[:parent_ids]) %>">
146
157
  <%= I18n.t("common.buttons.filters_reset") %>
147
158
  </a>
148
159
  <% end %>
149
160
  </div>
150
- <% end if page.lists[:entries_list].filters %>
161
+ <% end if data[:page].lists[:entries_list].filters %>
151
162
  </div>
152
163
  </div>
153
164
 
@@ -155,3 +166,13 @@
155
166
  $.input_events = {};
156
167
  <% end %>
157
168
 
169
+ <script>
170
+ $(document).ready(
171
+ function () {
172
+ $('.delete-button').click(function () {
173
+ deleteRecordByUrl($(this).attr("href"), $(this).attr("redirect-url"));
174
+ return false;
175
+ });
176
+ }
177
+ );
178
+ </script>
@@ -1,11 +1,11 @@
1
- <div class="col-md-12">
2
- <button class="btn blue" type="button" href="<%= self.controller.to_url_for(:new) %>">New</button>
3
- </div>
1
+ <button class="btn blue action-button" type="button" href="<%= self.controller.to_url_for(:new, data[:parent_ids]) %>">
2
+ <%= I18n.t("common.menus.buttons_menu.new") %>
3
+ </button>
4
4
 
5
5
  <script>
6
6
  $(document).ready(
7
7
  function () {
8
- $('.btn').click(function () {
8
+ $('.action-button').click(function () {
9
9
  window.location = $(this).attr('href')
10
10
  });
11
11
  }
@@ -0,0 +1,164 @@
1
+ <script type="javascript">
2
+ $(document).ready(function () {
3
+ //managementAttachDraggables('div.items-management-url', '#items-management-tray', '#items-management-gallery');
4
+ });
5
+ </script>
6
+
7
+ <div class="col-md-12">
8
+ <div class="widget-body">
9
+
10
+ <div class="widget-heading green">
11
+ <i class="icon-table pull-left"></i>
12
+
13
+ <h3 class="pull-left">
14
+ <%= I18n.t("#{self.controller.to_i18n}.management.title") %>
15
+ </h3>
16
+
17
+ </div>
18
+ <div class="widget-sec">
19
+ <div class="col-md-6">
20
+ <div class="widget-body">
21
+ <div class="widget-heading green">
22
+ <i class="icon-table pull-left"></i>
23
+
24
+ <h3 class="pull-left">
25
+ <%= I18n.t("#{self.controller.to_i18n}.management.items.title") %>
26
+ </h3>
27
+
28
+ </div>
29
+ <div class="widget-sec">
30
+ <ul id="management-tray-items">
31
+ <li> .
32
+ <%= I18n.t("#{self.controller.to_i18n}.management.labels.drop_here") %>
33
+ </li>
34
+ <% data[:items].each do |item| %>
35
+ <li item-id="<%= print_property(item, :id) %>">
36
+ <%= item.to_s %>
37
+ (<a href="javascript:managementRemoveItem('<%= self.controller.to_url_for(:manage_items_remove, data[:parent_ids]) %>', '#management-tray-items', <%= item.id %>);"><%= I18n.t("admin.shared.management.remove_button") %></a>)
38
+ </li>
39
+ <% end %>
40
+ </ul>
41
+ </div>
42
+ </div>
43
+ </div>
44
+
45
+
46
+ <div class="col-md-6">
47
+ <div class="widget-body">
48
+ <div class="widget-heading blue">
49
+ <i class="icon-double-angle-right pull-left"></i>
50
+
51
+ <h3 class="pull-left">
52
+ <%= I18n.t("#{self.controller.to_i18n}.management.entries.title") %>
53
+ </h3>
54
+ </div>
55
+ <div class="widget-sec">
56
+ <ul id="management-tray-entries">
57
+ <% data[:entries].each do |entry| %>
58
+ <li entry-id="<%= print_property(entry, :id) %>">
59
+ <%= entry.to_s %>
60
+ </li>
61
+ <% end %>
62
+ </ul>
63
+ </div>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </div>
69
+
70
+ <!-- End box -->
71
+ <div class="items-management-url" type='add' style="display: none;" href="<%= self.controller.to_url_for(:manage_items_add, data[:parent_ids]) %>"></div>
72
+ <div class="items-management-url" type='remove' style="display: none;" href="<%= self.controller.to_url_for(:manage_items_remove, data[:parent_ids]) %>"></div>
73
+
74
+
75
+
76
+ <script>
77
+
78
+ function managementAttachDragables(urlCss, trayCss, galleryCss) {
79
+ var gallery = $(galleryCss);
80
+ var tray = $(trayCss);
81
+ var managementUrlAdd = $(urlCss + "[type='add']").first().attr('href');
82
+ var managementUrlRemove = $(urlCss + "[type='remove']").first().attr('href');
83
+
84
+ //alert("URL ADD CSS: " + urlCss+"[type='add']\r\nURL ADD: " + managementUrlAdd + "\r\nURL REMOVE: " + managementUrlRemove);
85
+
86
+ $("li", gallery).draggable({
87
+ cancel: "a.ui-icon",
88
+ revert: "invalid",
89
+ cursor: "move",
90
+ helper: "clone"
91
+ });
92
+
93
+ tray.droppable({
94
+ accept: galleryCss + " > li",
95
+ drop: function (event, ui) {
96
+ //alert("URL Add: " + managementUrlAdd);
97
+ makeAjaxCall(managementUrlAdd, {
98
+ method: 'put',
99
+ dataType: 'json',
100
+ data: {entry_id: ui.draggable.attr('entry-id')},
101
+ success: function (data) {
102
+ if (data.status == <%= ::ChupakabraTools::SetManagementResult.id_by_tag("management_ok") %>) {
103
+ ui.draggable.fadeOut(function () {
104
+ tray.append(ui.draggable);
105
+ ui.draggable.fadeIn();
106
+ ui.draggable.append(" (<a href=\"javascript:managementRemoveItem('" + managementUrlRemove + "', '" + trayCss + "', " + ui.draggable.attr('entry-id') + " );\"><%= I18n.t("admin.shared.management.remove_button") %></a>)");
107
+ });
108
+
109
+ // tray.html(
110
+ // tray.children("li").sort(function (a, b) {
111
+ // return $(a).text().trim().toUpperCase().localeCompare(
112
+ // $(b).text().trim().toUpperCase());
113
+ // })
114
+ // );
115
+ }
116
+ else {
117
+ showFancyMessage(data.message);
118
+ }
119
+ },
120
+ error: function () {
121
+ showFancyMessage("<%= I18n.t("admin.shared.messages.error_ajax_load") %>");
122
+ }
123
+ });
124
+ }
125
+ });
126
+ }
127
+
128
+ function managementRemoveItem(url, trayCss, item_id) {
129
+ //alert("Remove Item");
130
+ makeAjaxCall(url, {
131
+ method: 'delete',
132
+ dataType: 'json',
133
+ data: {item_id: item_id },
134
+ success: function (data) {
135
+ if (data.status == <%= ::ChupakabraTools::SetManagementResult.id_by_tag("management_ok") %>) {
136
+ var tray = $(trayCss);
137
+ var itemToRemove = tray.find('li[item-id = ' + item_id + ']');
138
+ itemToRemove.fadeOut();
139
+ }
140
+ else {
141
+ showFancyMessage(data.message);
142
+ }
143
+ },
144
+ error: function () {
145
+ showFancyMessage("<%= I18n.t("admin.shared.messages.error_ajax_load") %>");
146
+ }
147
+ });
148
+ }
149
+
150
+
151
+ $(document).ready(
152
+ function () {
153
+ managementAttachDragables("div.items-management-url", "#management-tray-items", "#management-tray-entries");
154
+ }
155
+ );
156
+ </script>
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
@@ -1,3 +1,33 @@
1
+ <div class="title">
2
+ <h2>
3
+ <i class=" icon-bar-chart"></i>
4
+ <%= I18n.t("#{self.controller.to_i18n}.new.title") %>
5
+ </h2>
6
+ </div>
7
+
8
+
9
+
10
+ <div class="col-md-12">
11
+ <% data[:page].menus[:top_menu].items.each do |menu_item| %>
12
+ <button class="btn green" type="button" href="<%= menu_item.build_url(self.controller, params) %>">
13
+ <%= menu_item.i18n_data_as_string(:label) || I18n.t("common.menus.buttons_menu.#{menu_item.name}") %>
14
+ </button>
15
+ <% end if data[:page].menus[:top_menu] %>
16
+ </div>
17
+
18
+ <script>
19
+ $(document).ready(
20
+ function () {
21
+ $('.btn').click(function () {
22
+ window.location = $(this).attr('href')
23
+ });
24
+ }
25
+ );
26
+ </script>
27
+
28
+
29
+
30
+
1
31
  <div class="col-md-9">
2
32
  <div class="widget-body">
3
33
  <div class="widget-heading green">
@@ -7,13 +37,13 @@
7
37
  </h3>
8
38
  </div>
9
39
  <div class="widget-sec">
10
- <%= kirgudu_form_for(entry, page.forms[:changes], self.controller.to_url_for(:create)) do |f| %>
11
- <% page.forms[:changes].properties.each do |property| %>
40
+ <%= kirgudu_form_for(data[:entry], data[:page].forms[:changes], self.controller.to_url_for(:create, data[:parent_ids])) do |f| %>
41
+ <% data[:page].forms[:changes].properties.each_pair do |key, property| %>
12
42
  <div class="form-group">
13
43
  <label for="exampleInputEmail1">
14
- <%= I18n.t("activerecord.attributes.#{entry.class.to_i18n}.#{property.name}") %>
44
+ <%= I18n.t("activerecord.attributes.#{data[:entry].class.to_i18n}.#{key}") %>
15
45
  </label>
16
- <%= f.control property, controls_data[property.name], class: "form-control" %>
46
+ <%= f.control property, data[:controls_data][key], class: "form-control" %>
17
47
  <% if property.help %>
18
48
  <p class="help-block"><%= property.help %></p>
19
49
  <% end %>
@@ -39,15 +69,15 @@
39
69
  <%= I18n.t("common.section_titles.errors") %>
40
70
  </h3>
41
71
  </div>
42
- <% if entry.errors.values.length > 0 %>
72
+ <% if data[:entry].errors.values.length > 0 %>
43
73
  <div class="widget-sec">
44
- <% entry.errors.each do |error| %>
74
+ <% data[:entry].errors.each do |error| %>
45
75
  <div class="form-group">
46
76
  <label for="exampleInputEmail1">
47
77
  <b>
48
- <%= I18n.t("activerecord.attributes.#{entry.class.to_i18n}.#{page.forms[:changes].properties[error].name}") if page.forms[:changes].properties[error] %></b>
78
+ <%= I18n.t("activerecord.attributes.#{data[:entry].class.to_i18n}.#{data[:page].forms[:changes].properties[error].name}") if data[:page].forms[:changes].properties[error] %></b>
49
79
  </label>
50
- <% entry.errors[error].each do |error_message| %>
80
+ <% data[:entry].errors[error].each do |error_message| %>
51
81
  <label for="exampleInputEmail1">
52
82
  <%= error_message %>
53
83
  </label>
@@ -61,9 +91,9 @@
61
91
 
62
92
  <%= content_for :body_scripts_on_document_ready do %>
63
93
  $.input_events = {};
64
- <% page.forms[:changes].properties.each do |property| %>
94
+ <% data[:page].forms[:changes].properties.each_pair do |key, property| %>
65
95
  <% if property.events && property.events.length > 0 %>
66
- $.input_events['<%= "#{entry.class.for_form_params}_#{property.name}" %>'] = <%= property.events_for_json.to_json.html_safe %>;
96
+ $.input_events['<%= "#{data[:entry].class.for_form_params}_#{key}" %>'] = <%= property.events_for_json.to_json.html_safe %>;
67
97
  <% end %>
68
98
  <% end %>
69
99
  <% end %>