mokio 0.0.15 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. checksums.yaml +5 -5
  2. data/app/assets/javascripts/backend.js +6 -3
  3. data/app/assets/javascripts/backend/datatable.js.coffee.erb +28 -26
  4. data/app/assets/javascripts/backend/head.js +1 -0
  5. data/app/assets/javascripts/backend/main.js +69 -44
  6. data/app/assets/javascripts/backend/mokio_dynamic_fields.js +20 -0
  7. data/app/assets/javascripts/backend/vendors/select2/select2.min.js +2 -0
  8. data/app/assets/stylesheets/backend.scss +6 -2
  9. data/app/assets/stylesheets/backend/custom.scss +13 -1
  10. data/app/assets/stylesheets/backend/main.scss +74 -73
  11. data/app/assets/stylesheets/backend/plugins/forms/select2/select2.scss +4 -0
  12. data/app/assets/stylesheets/backend/plugins/tables/dataTables/{jquery.dataTables.scss → jquery.dataTables.css} +7 -7
  13. data/app/assets/stylesheets/backend/theme/main.scss +413 -0
  14. data/app/assets/stylesheets/backend/theme/nice-select/_nice-select-prefixed.scss +190 -0
  15. data/app/assets/stylesheets/backend/theme/nice-select/nice-select.scss +178 -0
  16. data/app/assets/stylesheets/backend/theme/nice-select/style.scss +20 -0
  17. data/app/assets/stylesheets/backend/vendors/select2/select2.min.css +1 -0
  18. data/app/datatables/commons_datatable.rb +56 -36
  19. data/app/helpers/mokio/backend/backend_helper.rb +27 -1
  20. data/app/helpers/mokio/backend/common_helper.rb +9 -4
  21. data/app/helpers/mokio/backend/dynamic_fields_helper.rb +91 -0
  22. data/app/models/devise_custom_failure.rb +9 -0
  23. data/app/models/mokio/article.rb +0 -1
  24. data/app/models/mokio/contact.rb +0 -1
  25. data/app/models/mokio/content.rb +0 -1
  26. data/app/models/mokio/menu.rb +0 -1
  27. data/app/models/mokio/mov_gallery.rb +0 -1
  28. data/app/models/mokio/pic_gallery.rb +0 -1
  29. data/app/models/mokio/seo_tag.rb +5 -0
  30. data/app/models/mokio/support.rb +0 -1
  31. data/app/uploaders/ckeditor_picture_uploader.rb +2 -2
  32. data/app/views/devise/sessions/new.html.haml +2 -1
  33. data/app/views/mokio/articles/_form.html.slim +6 -3
  34. data/app/views/mokio/common/_form_content.html.slim +4 -4
  35. data/app/views/mokio/common/edit.html.slim +1 -5
  36. data/app/views/mokio/common/index.html.slim +3 -0
  37. data/app/views/mokio/common/modals/_modal_seo_tags.html.slim +47 -0
  38. data/app/views/mokio/common/new.html.slim +1 -4
  39. data/app/views/mokio/contacts/_form.html.slim +9 -7
  40. data/app/views/mokio/contents/new.html.slim +1 -2
  41. data/app/views/mokio/data_files/_file_upload.html.erb +1 -6
  42. data/app/views/mokio/layout/sidebar.html.slim +6 -13
  43. data/app/views/mokio/menus/_form.html.slim +97 -0
  44. data/app/views/mokio/menus/{_form.html.haml → _old_form.html.haml} +5 -6
  45. data/app/views/mokio/menus/{_form_slim.html.slim → _old_form_slim.html.slim} +8 -10
  46. data/app/views/mokio/menus/new_menu_position.slim +1 -1
  47. data/app/views/mokio/mov_galleries/_form_inputs.html.slim +3 -3
  48. data/app/views/mokio/pic_galleries/_form_inputs.html.slim +3 -3
  49. data/app/views/mokio/static_modules/_form.html.slim +2 -1
  50. data/config/initializers/frontend.rb +3 -0
  51. data/config/initializers/simple_form.rb +9 -0
  52. data/config/locales/en.yml +16 -26
  53. data/config/locales/pl.yml +11 -20
  54. data/db/migrate/20140422135850_add_mokio_to_application.rb +22 -24
  55. data/db/migrate/20191217135611_create_mokio_seo_tags.rb +11 -0
  56. data/lib/mokio.rb +37 -10
  57. data/lib/mokio/concerns.rb +3 -13
  58. data/lib/mokio/concerns/common/controller_functions.rb +1 -15
  59. data/lib/mokio/concerns/common/controller_object.rb +2 -2
  60. data/lib/mokio/concerns/common/seo_tags.rb +32 -0
  61. data/lib/mokio/concerns/common/services/sitemap_service.rb +196 -0
  62. data/lib/mokio/concerns/controllers/application.rb +5 -5
  63. data/lib/mokio/concerns/controllers/base.rb +12 -12
  64. data/lib/mokio/concerns/controllers/common.rb +6 -4
  65. data/lib/mokio/concerns/controllers/data_files.rb +3 -3
  66. data/lib/mokio/concerns/controllers/menus.rb +11 -13
  67. data/lib/mokio/concerns/controllers/mov_galleries.rb +1 -2
  68. data/lib/mokio/concerns/controllers/photos.rb +10 -10
  69. data/lib/mokio/concerns/controllers/pic_galleries.rb +2 -3
  70. data/lib/mokio/concerns/controllers/users.rb +4 -3
  71. data/lib/mokio/concerns/controllers/youtubes.rb +7 -7
  72. data/lib/mokio/concerns/models/available_module.rb +3 -3
  73. data/lib/mokio/concerns/models/common.rb +1 -29
  74. data/lib/mokio/concerns/models/contact_template.rb +0 -4
  75. data/lib/mokio/concerns/models/content.rb +15 -7
  76. data/lib/mokio/concerns/models/data_file.rb +3 -9
  77. data/lib/mokio/concerns/models/lang.rb +11 -7
  78. data/lib/mokio/concerns/models/menu.rb +4 -4
  79. data/lib/mokio/concerns/models/module_position.rb +1 -1
  80. data/lib/mokio/concerns/models/recipient.rb +0 -2
  81. data/lib/mokio/concerns/models/seo_tag.rb +118 -0
  82. data/lib/mokio/concerns/models/static_module.rb +2 -2
  83. data/lib/mokio/concerns/models/user.rb +1 -1
  84. data/lib/mokio/engine.rb +7 -17
  85. data/lib/mokio/frontend_helpers.rb +1 -0
  86. data/lib/mokio/frontend_helpers/seo_tag_helper.rb +33 -0
  87. data/lib/mokio/simple-form-wrappers.rb +11 -0
  88. data/lib/mokio/version.rb +1 -1
  89. data/lib/tasks/mokio_install.rake +37 -9
  90. data/spec/dummy/Rakefile +1 -3
  91. data/spec/dummy/app/controllers/application_controller.rb +1 -1
  92. data/spec/dummy/config.ru +1 -2
  93. data/spec/dummy/config/application.rb +9 -12
  94. data/spec/dummy/config/database.yml +18 -0
  95. data/spec/dummy/config/environment.rb +1 -1
  96. data/spec/dummy/log/development.log +0 -0
  97. data/spec/dummy/log/development_mokio.log +9 -0
  98. data/spec/models/content_spec.rb +0 -1
  99. data/spec/models/menu_spec.rb +8 -9
  100. data/spec/models/mov_gallery_spec.rb +0 -1
  101. data/spec/models/pic_gallery_spec.rb +0 -1
  102. metadata +212 -407
  103. data/README.rdoc +0 -47
  104. data/app/assets/javascripts/backend/plugins/forms/select/select2.js +0 -2195
  105. data/app/assets/javascripts/backend/plugins/forms/select/select2.min.js +0 -76
  106. data/app/assets/javascripts/backend/plugins/tables/dataTables/jquery.dataTables.js +0 -12099
  107. data/app/assets/javascripts/backend/plugins/tables/dataTables/jquery.dataTables.min.js +0 -155
  108. data/app/controllers/mokio/base_articles_controller.rb +0 -3
  109. data/app/controllers/mokio/base_contacts_controller.rb +0 -5
  110. data/app/controllers/mokio/base_contents_controller.rb +0 -3
  111. data/app/controllers/mokio/base_mov_galleries_controller.rb +0 -3
  112. data/app/controllers/mokio/base_pic_galleries_controller.rb +0 -4
  113. data/app/controllers/passwords_controller.rb +0 -14
  114. data/app/models/mokio/base_article.rb +0 -29
  115. data/app/models/mokio/base_contact.rb +0 -30
  116. data/app/models/mokio/base_content.rb +0 -5
  117. data/app/models/mokio/base_mov_gallery.rb +0 -30
  118. data/app/models/mokio/base_pic_gallery.rb +0 -30
  119. data/app/models/mokio/meta.rb +0 -24
  120. data/app/views/mokio/backend/articles/_form.html.haml +0 -9
  121. data/app/views/mokio/backend/common/_form_content.html.haml +0 -36
  122. data/app/views/mokio/backend/common/_gmap.html.haml +0 -39
  123. data/app/views/mokio/backend/common/_main_pic.html.haml +0 -4
  124. data/app/views/mokio/backend/common/_meta.html.haml +0 -51
  125. data/app/views/mokio/backend/common/_notice.html.haml +0 -3
  126. data/app/views/mokio/backend/common/_obj.html.haml +0 -16
  127. data/app/views/mokio/backend/common/copy.html.haml +0 -5
  128. data/app/views/mokio/backend/common/edit.html.haml +0 -6
  129. data/app/views/mokio/backend/common/index.html.haml +0 -19
  130. data/app/views/mokio/backend/common/new.html.haml +0 -6
  131. data/app/views/mokio/backend/contacts/_form.html.haml +0 -42
  132. data/app/views/mokio/backend/contents/_content_info_widget.html.haml +0 -22
  133. data/app/views/mokio/backend/dashboard/_content.html.haml +0 -9
  134. data/app/views/mokio/backend/dashboard/show.html.haml +0 -35
  135. data/app/views/mokio/backend/dashboard/tbl_content.html.haml +0 -24
  136. data/app/views/mokio/backend/data_files/_file_upload.html.erb +0 -71
  137. data/app/views/mokio/backend/data_files/uploader.html.haml +0 -15
  138. data/app/views/mokio/backend/errors/404.html.haml +0 -45
  139. data/app/views/mokio/backend/errors/unauthorized.html.haml +0 -11
  140. data/app/views/mokio/backend/layout/_user_widget.html.haml +0 -8
  141. data/app/views/mokio/backend/layout/header.html.haml +0 -14
  142. data/app/views/mokio/backend/layout/sidebar.html.haml +0 -59
  143. data/app/views/mokio/backend/menus/_form.html.haml +0 -66
  144. data/app/views/mokio/backend/menus/_menu.html.haml +0 -24
  145. data/app/views/mokio/backend/menus/index.html.haml +0 -53
  146. data/app/views/mokio/backend/menus/index.json.jbuilder +0 -4
  147. data/app/views/mokio/backend/menus/lang_changed.js.haml +0 -6
  148. data/app/views/mokio/backend/menus/sort.html.haml +0 -1
  149. data/app/views/mokio/backend/menus/update_menu_breadcrumps.js.haml +0 -1
  150. data/app/views/mokio/backend/mov_galleries/_form.html.haml +0 -17
  151. data/app/views/mokio/backend/mov_galleries/_form_inputs.html.haml +0 -8
  152. data/app/views/mokio/backend/photos/_gallery.html.haml +0 -25
  153. data/app/views/mokio/backend/photos/create.js.haml +0 -1
  154. data/app/views/mokio/backend/photos/crop_photo.js.haml +0 -10
  155. data/app/views/mokio/backend/photos/crop_thumb.js.haml +0 -11
  156. data/app/views/mokio/backend/photos/destroy.js.haml +0 -1
  157. data/app/views/mokio/backend/photos/from_external_link.html.haml +0 -19
  158. data/app/views/mokio/backend/photos/get_photo.js.haml +0 -1
  159. data/app/views/mokio/backend/photos/get_thumb.js.haml +0 -1
  160. data/app/views/mokio/backend/photos/photo.html.haml +0 -54
  161. data/app/views/mokio/backend/photos/remove_thumb.js.haml +0 -10
  162. data/app/views/mokio/backend/photos/rotate_photo.js.haml +0 -10
  163. data/app/views/mokio/backend/photos/rotate_thumb.js.haml +0 -11
  164. data/app/views/mokio/backend/photos/thumb.html.haml +0 -9
  165. data/app/views/mokio/backend/photos/update_thumb.js.haml +0 -11
  166. data/app/views/mokio/backend/photos/upload_external_links.js.haml +0 -4
  167. data/app/views/mokio/backend/pic_galleries/_form.html.haml +0 -16
  168. data/app/views/mokio/backend/pic_galleries/_form_inputs.html.haml +0 -9
  169. data/app/views/mokio/backend/site_helper/first_login.html.haml +0 -14
  170. data/app/views/mokio/backend/static_modules/_form.html.haml +0 -9
  171. data/app/views/mokio/backend/users/_form.html.haml +0 -11
  172. data/app/views/mokio/backend/users/edit_password.html.haml +0 -13
  173. data/app/views/mokio/backend/youtubes/_edit.html.haml +0 -49
  174. data/app/views/mokio/backend/youtubes/_gallery.html.haml +0 -24
  175. data/app/views/mokio/backend/youtubes/_new.html.haml +0 -4
  176. data/app/views/mokio/backend/youtubes/_preview_movie.html.haml +0 -1
  177. data/app/views/mokio/backend/youtubes/_search_yt.html.haml +0 -8
  178. data/app/views/mokio/backend/youtubes/_search_yt_body.html.haml +0 -11
  179. data/app/views/mokio/backend/youtubes/find.js.haml +0 -1
  180. data/app/views/mokio/backend/youtubes/preview.html.haml +0 -36
  181. data/app/views/mokio/backend/youtubes/preview_movie.js.haml +0 -5
  182. data/app/views/mokio/backend/youtubes/thumb.html.haml +0 -14
  183. data/app/views/mokio/backend/youtubes/uploader.html.haml +0 -10
  184. data/app/views/mokio/backend/youtubes/youtube.html.haml +0 -12
  185. data/app/views/mokio/base_articles/_multi_lang_form.html.slim +0 -18
  186. data/app/views/mokio/base_contacts/_multi_lang_form.html.slim +0 -48
  187. data/app/views/mokio/base_contents/update_content_form.js.slim +0 -1
  188. data/app/views/mokio/base_pic_galleries/_multi_lang_form.html.slim +0 -13
  189. data/app/views/mokio/common/_meta.html.slim +0 -50
  190. data/app/views/mokio/common/_multi_lang_gmap.html.slim +0 -41
  191. data/app/views/mokio/common/_multi_lang_meta.html.slim +0 -50
  192. data/app/views/mokio/common/multi_lang_form_content.html.slim +0 -56
  193. data/db/migrate/20140731061227_create_mokio_external_scripts.rb +0 -12
  194. data/db/migrate/20141009125027_alter_external_scripts.rb +0 -13
  195. data/db/migrate/20141024131942_migrate_external_codes_to_external_scripts.rb +0 -25
  196. data/db/migrate/20141209072051_change_data_type_for_display_dates.rb +0 -8
  197. data/db/migrate/20141209101853_add_menu_css_options.rb +0 -6
  198. data/db/migrate/20150220071158_add_subtitle_to_contents.rb +0 -7
  199. data/db/migrate/20150220091326_add_main_pic_to_mokio_menu.rb +0 -5
  200. data/db/migrate/20150408074951_create_mokio_base_contents.rb +0 -17
  201. data/db/migrate/20150408075454_add_base_content_id_to_mokio_contents.mokio.rb +0 -6
  202. data/db/migrate/20150414054139_add_name_to_mokio_users.rb +0 -6
  203. data/db/migrate/20150414070406_add_author_and_editor_to_mokio_content.rb +0 -6
  204. data/db/migrate/20150528104851_add_base_content_id_to_mokio_data_files.rb +0 -5
  205. data/lib/mokio/concerns/controllers/base_articles.rb +0 -31
  206. data/lib/mokio/concerns/controllers/base_contacts.rb +0 -32
  207. data/lib/mokio/concerns/controllers/base_contents.rb +0 -167
  208. data/lib/mokio/concerns/controllers/base_mov_galleries.rb +0 -48
  209. data/lib/mokio/concerns/controllers/base_pic_galleries.rb +0 -32
  210. data/lib/mokio/concerns/models/base_article.rb +0 -21
  211. data/lib/mokio/concerns/models/base_contact.rb +0 -36
  212. data/lib/mokio/concerns/models/base_content.rb +0 -51
  213. data/lib/mokio/concerns/models/base_mov_gallery.rb +0 -19
  214. data/lib/mokio/concerns/models/base_pic_gallery.rb +0 -22
  215. data/lib/mokio/concerns/models/meta.rb +0 -39
  216. data/spec/factories/meta.rb +0 -37
  217. data/spec/models/meta_spec.rb +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2209e0a799737cc58509f74c2183fcfd57181bbf
4
- data.tar.gz: 2d6398f323b92b0888fd221d48c4e47f678a9d37
2
+ SHA256:
3
+ metadata.gz: 9261c07e27d10631a8387355458fbd3ea0388dcf2f59a79535f1e8d77b23fa51
4
+ data.tar.gz: 82cc35827f1d0f9625e5daf6c1ac2727e544df8cf7e6953cf0bad1fe3adeb738
5
5
  SHA512:
6
- metadata.gz: 581e71618ee87b46df0196888603a3bcc0ca11ee0b1b66e21582f060cff90106a8bb652a09953afdfed519fe99bc87c594128c167de0390db321e3ecab435247
7
- data.tar.gz: 38edb77d90b7517a5e2f859de1db1dcdab9e8a8515b41cd351574698eeebe82447b4ee74e6d916699210c25edebaa18550dfd296720177938fd2f8e2e346cdb0
6
+ metadata.gz: 81111cf1ce6f94a52de13bc8ca9a12172bc3691c53ae1cb5f77d9dbc5358e5507bbbe59c91c3168c61ce65ffbd15935401ad1048bebad353928c1297c7d0f979
7
+ data.tar.gz: bc2a1380237cead41f0301c50d8a4e05b7aa726b78dbb89072873a0ab7bc197703b4c6da686aab139c80a8bdce5b4b4db795b47b4d2303d06af6def1fa67470d
@@ -12,9 +12,8 @@
12
12
  //= require backend/plugins/misc/search/tipuesearch
13
13
 
14
14
  // Table plugins
15
- // require backend/plugins/tables/dataTables/jquery.dataTables
16
15
  // require backend/plugins/tables/responsive-tables/responsive-tables
17
- //
16
+ //
18
17
  //= require dataTables/jquery.dataTables
19
18
 
20
19
  // Form plugins # required by main.js
@@ -54,4 +53,8 @@
54
53
  //= require backend/search
55
54
 
56
55
  // Photo box
57
- //= require fancybox
56
+ //= require fancybox
57
+
58
+ // Select2
59
+ //= require backend/vendors/select2/select2.min.js
60
+
@@ -1,33 +1,35 @@
1
1
  $ ->
2
2
  if $("table").hasClass("dynamicTable")
3
3
  $(".dynamicTable").dataTable
4
- sPaginationType: "full_numbers"
5
- bJQueryUI: false
6
- bAutoWidth: false
7
- bLengthChange: false
8
- bProcessing: true
9
- bServerSide: true
10
- aoColumnDefs: [ { 'bSortable': false, 'aTargets': [ -1 ] } ] # disable sorting in column with actions
11
- sAjaxSource: $('#dTable').data("source")
12
- iDisplayLength: <%= Mokio.backend_default_per_page %> # pagination - per page
13
- oLanguage:
14
- sProcessing: "<%= I18n.t("backend.please_wait") %>"
15
- sLengthMenu: "<%= I18n.t("backend.show") %>" + " _MENU_ " + "<%= I18n.t("backend.table_positions") %>"
16
- sZeroRecords: "<%= I18n.t("backend.no_matching_indexes") %>"
17
- sInfo: "<%= I18n.t("backend.table_positions_from") %>" + " _START_ " + "<%= I18n.t("backend.table_to") %> "+ " _END_ - " + "<%= I18n.t("backend.table_all") %>" + " _TOTAL_"
18
- sInfoEmpty: "<%= I18n.t("backend.table_no_records") %>"
19
- sInfoFiltered: "<%= I18n.t("backend.table_filtring_from") %>" + " _MAX_ " + "<%= I18n.t("backend.table_available_positions") %>"
20
- sInfoPostFix: ""
21
- sSearch: "<%= I18n.t("backend.search") %>"
22
- sUrl: ""
23
- oPaginate:
24
- sFirst: "<%= I18n.t("backend.table_first") %>"
25
- sPrevious: "<%= I18n.t("backend.table_previous") %>"
26
- sNext: "<%= I18n.t("backend.table_next") %>"
27
- sLast: "<%= I18n.t("backend.table_last") %>"
28
- fnInitComplete: (oSettings, json) ->
4
+ pagingType: "full_numbers"
5
+ jQueryUI: false,
6
+ order: default_sorting,
7
+ autoWidth: false
8
+ lengthChange: false
9
+ processing: true
10
+ serverSide: true
11
+ columnDefs: [ { 'orderable': false, 'targets': [ -1 ] } ] # disable sorting in column with actions
12
+ <%# ajax: $('#dTable').data("source") %>
13
+ ajax: {url: $('#dTable').data("source")}
14
+ pageLength: <%= Mokio.backend_default_per_page %> # pagination - per page
15
+ language:
16
+ processing: "<%= I18n.t("backend.please_wait") %>"
17
+ lengthMenu: "<%= I18n.t("backend.show") %>" + " _MENU_ " + "<%= I18n.t("backend.table_positions") %>"
18
+ zeroRecords: "<%= I18n.t("backend.no_matching_indexes") %>"
19
+ info: "<%= I18n.t("backend.table_positions_from") %>" + " _START_ " + "<%= I18n.t("backend.table_to") %> "+ " _END_ - " + "<%= I18n.t("backend.table_all") %>" + " _TOTAL_"
20
+ infoEmpty: "<%= I18n.t("backend.table_no_records") %>"
21
+ infoFiltered: "<%= I18n.t("backend.table_filtring_from") %>" + " _MAX_ " + "<%= I18n.t("backend.table_available_positions") %>"
22
+ infoPostFix: ""
23
+ search: "<%= I18n.t("backend.search") %>"
24
+ url: ""
25
+ paginate:
26
+ first: "<%= I18n.t("backend.table_first") %>"
27
+ previous: "<%= I18n.t("backend.table_previous") %>"
28
+ next: "<%= I18n.t("backend.table_next") %>"
29
+ last: "<%= I18n.t("backend.table_last") %>"
30
+ initComplete: (oSettings, json) ->
29
31
  $(".dataTables_filter>label>input").attr "id", "search"
30
- fnDrawCallback: (oSettings) ->
32
+ drawCallback: (oSettings) ->
31
33
  $(".activebtn").bootstrapSwitch()
32
34
  $(".activebtn").on "switch-change", (e, data) ->
33
35
  row_id = $(this).parents("tr").attr("id")
@@ -15,3 +15,4 @@
15
15
  // Ckeditor
16
16
  // require ckeditor/override
17
17
  //= require ckeditor/init
18
+ //= require backend/mokio_dynamic_fields
@@ -27,7 +27,7 @@ $(window).load(function() {
27
27
  // =============== Load animation using Rails Turbolinks ======================
28
28
  //
29
29
 
30
- //prevent font flickering in some browsers
30
+ //prevent font flickering in some browsers
31
31
  function prevent_font_flickering() {
32
32
  //if firefox 3.5+, hide content till load (or 3 seconds) to prevent FOUT
33
33
  var d = document, e = d.documentElement, s = d.createElement('style');
@@ -36,7 +36,7 @@ $(window).load(function() {
36
36
  e.firstChild.appendChild(s);
37
37
  function f(){ s.parentNode && s.parentNode.removeChild(s); }
38
38
  addEventListener('load',f,false);
39
- setTimeout(f,500);
39
+ setTimeout(f,500);
40
40
  }
41
41
  }
42
42
 
@@ -56,9 +56,34 @@ $(window).load(function() {
56
56
  // ==============================================================================
57
57
  //
58
58
 
59
-
60
59
  // document ready page:load using Rails Turbolinks
61
- $(document).on('ready page:load', function(){
60
+ // select2
61
+ $(document).on('ready page:load', function(){
62
+
63
+ var mokioSelect2 = ".mokio-select2";
64
+
65
+ $(document).find(mokioSelect2).each(function() {
66
+ var dataAjax = $(this).attr('data-ajax-collection');
67
+
68
+ if (dataAjax) {
69
+ $(this).select2({
70
+ ajax: {
71
+ url: dataAjax,
72
+ dataType: 'json',
73
+ processResults: function (data) {
74
+ return {
75
+ results: $.map(data, function(obj) {
76
+ return { id: obj.id, text: obj.name };
77
+ })
78
+ };
79
+ },
80
+ }
81
+ });
82
+ }else{
83
+ $(this).select2();
84
+ }
85
+
86
+ });
62
87
 
63
88
  //------------- Switcher code ( Remove it in production site ) -------------//
64
89
  // (function(){
@@ -82,7 +107,7 @@ $(document).on('ready page:load', function(){
82
107
  // if($(this).hasClass('bpat1')) {$('#content').css('background', 'url(/assets/backend/patterns/body/cream_dust.png)');}
83
108
  // if($(this).hasClass('bpat2')) {$('#content').css('background', 'url(/assets/backend/patterns/body/dust.png)');}
84
109
  // if($(this).hasClass('bpat3')) {$('#content').css('background', 'url(/assets/backend/patterns/body/grey.png)');}
85
- // if($(this).hasClass('bpat4')) {$('#content').css('background', 'url(/assets/backend/patterns/body/subtle_dots.png)');}
110
+ // if($(this).hasClass('bpat4')) {$('#content').css('background', 'url(/assets/backend/patterns/body/subtle_dots.png)');}
86
111
  // });
87
112
 
88
113
  // $('#switchBtn').click(function() {
@@ -108,7 +133,7 @@ $(document).on('ready page:load', function(){
108
133
  // supr_switcher.init();
109
134
 
110
135
  // })();
111
-
136
+
112
137
  //Disable certain links
113
138
  $('a[href^=\\#]').click(function (e) {
114
139
  e.preventDefault()
@@ -116,7 +141,7 @@ $(document).on('ready page:load', function(){
116
141
 
117
142
  $('.search-btn').addClass('nostyle');//tell uniform to not style this element
118
143
 
119
-
144
+
120
145
  //------------- Navigation -------------//
121
146
 
122
147
  mainNav = $('.mainnav>ul>li');
@@ -144,7 +169,7 @@ $(document).on('ready page:load', function(){
144
169
  //its a part of sub menu need to expand this menu
145
170
  aElem = ulElem.prev('a.hasUl').addClass('drop');
146
171
  ulElem.addClass('expand');
147
- }
172
+ }
148
173
  }
149
174
  });
150
175
  }
@@ -161,13 +186,13 @@ $(document).on('ready page:load', function(){
161
186
  if(absoluteUrl === 0) {
162
187
  //absolute url is disabled
163
188
  var afterDomain = window.location.pathname;
164
-
189
+
165
190
  setCurrentClass(mainNavLinkAll, afterDomain);
166
-
191
+
167
192
  } else {
168
193
  //absolute url is enabled
169
194
  var newDomain = 'http://' + domain + window.location.pathname;
170
-
195
+
171
196
  setCurrentClass(mainNavLinkAll, newDomain);
172
197
  }
173
198
  }
@@ -176,7 +201,7 @@ $(document).on('ready page:load', function(){
176
201
  mainNavLinkAll.hover(
177
202
  function () {
178
203
  $(this).find('span.icon16').addClass('red');
179
- },
204
+ },
180
205
  function () {
181
206
  $(this).find('span.icon16').removeClass('red');
182
207
  }
@@ -192,20 +217,20 @@ $(document).on('ready page:load', function(){
192
217
  $(this).siblings('ul.sub').slideUp(500).siblings().removeClass('drop');
193
218
  } else {
194
219
  $(this).siblings('ul.sub').slideDown(500).siblings().addClass('drop');
195
- }
196
- }
220
+ }
221
+ }
197
222
  });
198
223
  mainNavSubLink.click(function(event) {
199
224
  $this = $(this);
200
-
225
+
201
226
  if($this.hasClass('hasUl')) {
202
227
  event.preventDefault();
203
228
  if($this.hasClass('drop')) {
204
229
  $(this).siblings('ul.sub').slideUp(500).siblings().removeClass('drop');
205
230
  } else {
206
231
  $(this).siblings('ul.sub').slideDown(250).siblings().addClass('drop');
207
- }
208
- }
232
+ }
233
+ }
209
234
  });
210
235
 
211
236
  //responsive buttons
@@ -240,7 +265,7 @@ $(document).on('ready page:load', function(){
240
265
  if($('#sidebar-right').length) {
241
266
  $('#sidebar-right').css('display', 'block');
242
267
  }
243
-
268
+
244
269
  $('#header').css({'overflow-x': 'hidden', 'width' : '100%'});
245
270
  $('#header').animate({ 'margin-left' : '240px'}, 300, function() {});
246
271
  $('#content').css({'overflow-x': 'hidden', 'width' : '100%'});
@@ -256,7 +281,7 @@ $(document).on('ready page:load', function(){
256
281
 
257
282
  $('#sidebarbg').css('display', 'block');
258
283
  $('.resBtn').addClass('offCanvas');
259
-
284
+
260
285
  $this.addClass('drop');
261
286
  }
262
287
  });
@@ -271,13 +296,13 @@ $(document).on('ready page:load', function(){
271
296
  $this.addClass('drop');
272
297
  }
273
298
  });
274
-
299
+
275
300
  //Hide and show sidebar btn
276
301
 
277
302
  $(function () {
278
303
  //var pages = ['grid.html','charts.html'];
279
304
  var pages = [];
280
-
305
+
281
306
  for ( var i = 0, j = pages.length; i < j; i++ ) {
282
307
 
283
308
  if($.cookie("currentPage") == pages[i]) {
@@ -296,7 +321,7 @@ $(document).on('ready page:load', function(){
296
321
  }
297
322
 
298
323
  }
299
-
324
+
300
325
  });
301
326
 
302
327
  $( '.collapseBtn' ).bind( 'click', function(){
@@ -304,7 +329,7 @@ $(document).on('ready page:load', function(){
304
329
 
305
330
  //left sidbar clicked
306
331
  if ($this.hasClass('leftbar')) {
307
-
332
+
308
333
  if($(this).hasClass('hide')) {
309
334
  //show sidebar
310
335
  $('#sidebarbg').css('margin-left','0');
@@ -331,7 +356,7 @@ $(document).on('ready page:load', function(){
331
356
  top: '87'
332
357
  }, 500, 'easeInExpo', function() {
333
358
  // Animation complete.
334
-
359
+
335
360
  }).addClass('shadow');
336
361
  //expand content
337
362
  $this.addClass('hide');
@@ -342,14 +367,14 @@ $(document).on('ready page:load', function(){
342
367
  if($('#content-two').length) {
343
368
  $('#content-two').css('margin-left', '0');
344
369
  }
345
-
370
+
346
371
  }
347
372
 
348
373
  }
349
374
 
350
375
  //right sidebar clicked
351
376
  if ($this.hasClass('rightbar')) {
352
-
377
+
353
378
  if($(this).hasClass('hide')) {
354
379
  //show sidebar
355
380
  $('#sidebarbg-right').css('margin-right','0');
@@ -362,17 +387,17 @@ $(document).on('ready page:load', function(){
362
387
  }
363
388
  if($('#content-two').length) {
364
389
  $('#content-two').css({'margin-right' : '212' + 'px'});
365
- }
390
+ }
366
391
  /*if($('#sidebar').length) {
367
392
  $('#sidebar').css({'left' : '0', 'margin-left' : '0'});
368
393
  }*/
369
394
  $this.removeClass('hide');
370
395
  $('.collapseBtn.rightbar').css('top', '120'+'px').css('right', '18'+'px').removeClass('shadow');
371
396
  $this.children('a').attr('title','Hide Right Sidebar');
372
-
397
+
373
398
  } else {
374
399
  //hide sidebar
375
- $('#sidebarbg-right').css('margin-right','-299'+'px');
400
+ $('#sidebarbg-right').css('margin-right','-299'+'px');
376
401
  $('#sidebar-right').css('margin-right','-299'+'px');
377
402
  if($('#content').length) {
378
403
  $('#content').css('margin-right', '0');
@@ -382,13 +407,13 @@ $(document).on('ready page:load', function(){
382
407
  }
383
408
  if($('#content-two').length) {
384
409
  $('#content-two').css({'margin-right' : '0'});
385
- }
410
+ }
386
411
  $('.collapseBtn.rightbar').animate({ //use .hide() if you experience heavy animation :)
387
412
  right: '10',
388
413
  top: '78'
389
414
  }, 500, 'easeInExpo', function() {
390
415
  // Animation complete.
391
-
416
+
392
417
  }).addClass('shadow');
393
418
  //expand content
394
419
  $this.addClass('hide');
@@ -417,32 +442,32 @@ $(document).on('ready page:load', function(){
417
442
  $this.parent('div').addClass('min');
418
443
  cont = $this.parent('div').next('div.content')
419
444
  cont.slideUp(500, 'easeOutExpo'); //change effect if you want :)
420
-
421
- } else
445
+
446
+ } else
422
447
  if($this .hasClass('maximize')) {
423
448
  //minimize content
424
449
  $this.removeClass('maximize').addClass('minimize');
425
450
  $this.parent('div').removeClass('min');
426
451
  cont = $this.parent('div').next('div.content');
427
452
  cont.slideDown(500, 'easeInExpo'); //change effect if you want :)
428
- }
429
-
453
+ }
454
+
430
455
  })
431
456
 
432
457
  //show minimize and maximize icons
433
458
  widget.hover(function() {
434
- $(this).find('.title>a').show(50);
459
+ $(this).find('.title>a').show(50);
435
460
  }
436
461
  , function(){
437
- $(this).find('.title>a').hide();
462
+ $(this).find('.title>a').hide();
438
463
  });
439
464
 
440
465
  //add shadow if hover box
441
466
  widget.not('.drag').hover(function() {
442
- $(this).addClass('hover');
467
+ $(this).addClass('hover');
443
468
  }
444
469
  , function(){
445
- $(this).removeClass('hover');
470
+ $(this).removeClass('hover');
446
471
  });
447
472
 
448
473
  //------------- placeholder fallback -------------//
@@ -468,11 +493,11 @@ $(document).on('ready page:load', function(){
468
493
  });
469
494
 
470
495
  //------------- To top plugin -------------//
471
- $().UItoTop({
496
+ $().UItoTop({
472
497
  //containerID: 'toTop', // fading element id
473
498
  //containerHoverID: 'toTopHover', // fading element hover id
474
499
  //scrollSpeed: 1200,
475
- easingType: 'easeOutQuart'
500
+ easingType: 'easeOutQuart'
476
501
  });
477
502
 
478
503
  //------------- Tooltips -------------//
@@ -542,7 +567,7 @@ $(document).on('ready page:load', function(){
542
567
  $(this).animate({
543
568
  width: inputWdith
544
569
  }, 300 );
545
- });
570
+ });
546
571
 
547
572
  $('#dTable_filter input').blur(function(){
548
573
  $(this).animate({
@@ -588,7 +613,7 @@ $(document).ajaxComplete(function(event, request) {
588
613
  opacity: 0.95,
589
614
  history: false,
590
615
  sticker: false
591
- });
616
+ });
592
617
  }
593
618
  if (flash.info) {
594
619
  $.pnotify({
@@ -600,6 +625,6 @@ $(document).ajaxComplete(function(event, request) {
600
625
  opacity: 0.95,
601
626
  history: false,
602
627
  sticker: false
603
- });
628
+ });
604
629
  }
605
630
  });
@@ -0,0 +1,20 @@
1
+ function backend_dynamic_fields(assoc) {
2
+ $(assoc).on('click', '.dynamic_fields_remove_row', function(event) {
3
+ var message = $(this).data('message');
4
+
5
+ var confirmation = confirm(message);
6
+ if (confirmation) {
7
+ $(this).closest('td').find('input').val(true);
8
+ $(this).closest('.dynamic_fields_row').hide();
9
+ }
10
+ return event.preventDefault();
11
+ });
12
+
13
+ $(assoc).on('click', '.add_fields', function(event) {
14
+ var regexp, time;
15
+ time = new Date().getTime();
16
+ regexp = new RegExp($(this).data('id'), 'g');
17
+ $(assoc).find('.dynamic_fields_container_fields').append($(this).data('fields').replace(regexp, time));
18
+ return event.preventDefault();
19
+ });
20
+ }