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
@@ -112,7 +112,7 @@ module Mokio
112
112
  (can? :create, Mokio::ExternalScript)
113
113
  )
114
114
  end
115
-
115
+
116
116
  #return table name for type
117
117
  def generate_tableize_name(type)
118
118
  type.gsub!("Mokio::","")
@@ -120,6 +120,32 @@ module Mokio
120
120
  type.tableize
121
121
  end
122
122
 
123
+ def set_sorting_param(obj_class)
124
+ if obj_class.respond_to? :default_datatable_sorting
125
+ obj_class.default_datatable_sorting
126
+ else
127
+ [[0, 'asc']]
128
+ end
129
+ end
130
+
131
+ # COMMON INPUTS HELPERS
132
+
133
+ def render_backend_input_lang_id(f)
134
+ f.input :lang_id, collection: Mokio::Lang.all.collect{|lang| [bt(lang.name), lang.id]},include_blank: bt('all'), disabled: !obj.display_editable_field?('lang_id'),wrapper: :select2
135
+ end
136
+
137
+ def render_backend_input_active(f)
138
+ render_backend_input_active_checkbox(f,'active')
139
+ end
140
+
141
+ def render_backend_input_home_page(f)
142
+ render_backend_input_active_checkbox(f,'home_page')
143
+ end
144
+
145
+ def render_backend_input_active_checkbox(f,name)
146
+ f.input name.to_sym,:wrapper => :active_checkbox, disabled: !obj.display_editable_field?("#{name}")
147
+ end
148
+
123
149
  end
124
150
  end
125
151
  end
@@ -13,7 +13,7 @@ module Mokio
13
13
  def data_file_model(obj)
14
14
  obj.respond_to?("data_file_type") ? obj.data_file_type.to_s.demodulize.tableize : "data_files"
15
15
  end
16
-
16
+
17
17
  def responsive_dynamic_table(&block)
18
18
  content_tag :table, :data => {:source => datatable_source_url}, :class => "responsive dynamicTable display table table-bordered", :border => 0, :cellpadding => 0, :cellspacing => 0, :width => "100%", :id =>"dTable" do
19
19
  capture(&block)
@@ -40,7 +40,7 @@ module Mokio
40
40
  content_tag :h4 do
41
41
  if name
42
42
  tag :span
43
- concat(name)
43
+ concat(name)
44
44
  end
45
45
  capture(&block) unless name
46
46
  end
@@ -66,7 +66,7 @@ module Mokio
66
66
  def table_controls_copy_btn(link)
67
67
  content_tag :a, :class => "tip", :href => link, "data-hasqtip" => true, "aria-describedby" => "qtip-2", :title => bt("copy") do
68
68
  tag :span, :class => "icon12 icomoon-icon-copy-2"
69
- end
69
+ end
70
70
  end
71
71
 
72
72
  #
@@ -106,7 +106,12 @@ module Mokio
106
106
  content_tag :div, :class => "activebutton" do
107
107
  tag :input, :type => "checkbox", :checked => ("checked" if arg)
108
108
  end
109
- end
109
+ end
110
+
111
+ def backend_modal_render(type,form_object)
112
+ return "" unless ['google','facebook','seo_tags'].include?(type)
113
+ render("mokio/common/modals/modal_#{type}",f: form_object)
114
+ end
110
115
  end
111
116
  end
112
117
  end
@@ -0,0 +1,91 @@
1
+ module Mokio
2
+ module Backend
3
+ module DynamicFieldsHelper
4
+
5
+ def dynamic_fields_link_to_add_row(f, association, **args)
6
+ new_object = f.object.send(association).klass.new
7
+ id = new_object.object_id
8
+ partial = args[:partial] || association.to_s.singularize
9
+ add_new_button_value = args[:add_new_button_value] || I18n.t('backend.dynamic_fields.add_new_button')
10
+ css_class = args[:add_button_class] || "btn btn-primary"
11
+
12
+ fields = f.simple_fields_for(association, new_object, child_index: id) do |builder|
13
+ if block_given?
14
+ yield builder
15
+ else
16
+ render(partial, form_obj: builder)
17
+ end
18
+ end
19
+ link_to(add_new_button_value, '#',class: "add_fields " + css_class, data: {id: id, form: association,fields: fields.gsub("\n", "")})
20
+ end
21
+
22
+ def dynamic_fields_render_part(obj,**args)
23
+ partial = args[:partial] || association.to_s.singularize
24
+ render "#{partial}", form_obj: obj
25
+ end
26
+
27
+ # form_obj: main form builder object
28
+ # association: has_many association name (sym)
29
+ # args:
30
+ # partial: partial name with fields ( default association_name ")
31
+ # fields_container_class: css class for container when partials views should be loaded
32
+ # container_id: main container id for dynamic fields
33
+ # table_view: true/false - table html tags
34
+ # delete_button_class: css class
35
+ # add_button_class: add new row css class
36
+ # add_new_button_value: text in button add
37
+ # delete_row_button_value: Text in button delete
38
+ # delete_row_button_message_value: Confirmation message
39
+
40
+ def dynamic_fields_render_all(form_obj,association,**args,&block)
41
+
42
+ partial = args[:partial] || association.to_s.singularize
43
+ fields_container_class = args[:fields_container_class] || "dynamic_fields_container_fields"
44
+ container_id = args[:container_id] || "#{association.to_s.singularize}_container"
45
+
46
+ content_rows = form_obj.simple_fields_for association do |builder_object|
47
+ if block_given?
48
+ yield builder_object
49
+ else
50
+ dynamic_fields_render_part builder_object,partial: "#{partial}"
51
+ end
52
+ end
53
+
54
+ content = content_tag(:div,class: fields_container_class) do
55
+ content_rows
56
+ end
57
+
58
+ if(args[:table_view])
59
+ content = content_tag(:table,class: "table") do
60
+ content_tag(:tbody,class: fields_container_class) do
61
+ content_rows
62
+ end
63
+ end
64
+ end
65
+
66
+ add_row = content_tag('div',class: 'form-actions') do
67
+ dynamic_fields_link_to_add_row(form_obj, association, class: 'btn btn-primary',partial: "#{partial}",&block)
68
+ end
69
+
70
+ content << add_row
71
+
72
+ main_content = content_tag(:div,id: container_id) do
73
+ content
74
+ end
75
+
76
+ main_content << javascript_tag("backend_dynamic_fields('##{container_id}')")
77
+ main_content
78
+ end
79
+
80
+ def dynamic_fields_render_delete(form_obj,**args)
81
+ css_class = args[:delete_button_class] || "btn btn-primary"
82
+ delete_row_button_value = args[:delete_row_button_value] || I18n.t('backend.dynamic_fields.delete_row_button')
83
+ confrimation_message = args[:delete_row_button_message_value] || I18n.t('backend.dynamic_fields.delete_row_button_message')
84
+
85
+ content = form_obj.hidden_field :_destroy
86
+ content << link_to(delete_row_button_value, '#', data: { message: confrimation_message } ,class: "dynamic_fields_remove_row #{css_class}")
87
+ end
88
+
89
+ end
90
+ end
91
+ end
@@ -2,4 +2,13 @@ class DeviseCustomFailure < Devise::FailureApp
2
2
  def redirect_url
3
3
  '/backend/users/sign_in'
4
4
  end
5
+
6
+ def respond
7
+ if http_auth?
8
+ http_auth
9
+ else
10
+ flash[:alert] = I18n.t(:invalid, :scope => [ :devise, :failure ])
11
+ redirect
12
+ end
13
+ end
5
14
  end
@@ -19,7 +19,6 @@
19
19
  # display_to :date
20
20
  # created_at :datetime
21
21
  # updated_at :datetime
22
- # meta_id :integer
23
22
  # gmap_id :integer
24
23
  #
25
24
  module Mokio
@@ -20,7 +20,6 @@
20
20
  # display_to :date
21
21
  # created_at :datetime
22
22
  # updated_at :datetime
23
- # meta_id :integer
24
23
  # gmap_id :integer
25
24
  #
26
25
  module Mokio
@@ -20,7 +20,6 @@
20
20
  # display_to :datetime
21
21
  # created_at :datetime
22
22
  # updated_at :datetime
23
- # meta_id :integer
24
23
  # gmap_id :integer
25
24
  #
26
25
  module Mokio
@@ -20,7 +20,6 @@
20
20
  # content_editable :boolean default(TRUE)
21
21
  # modules_editable :boolean default(TRUE)
22
22
  # fake :boolean default(FALSE)
23
- # meta_id :integer
24
23
  # slug :string(255)
25
24
  # css_class :string
26
25
  # css_body_class :string
@@ -20,7 +20,6 @@
20
20
  # display_to :date
21
21
  # created_at :datetime
22
22
  # updated_at :datetime
23
- # meta_id :integer
24
23
  # gmap_id :integer
25
24
  #
26
25
  module Mokio
@@ -20,7 +20,6 @@
20
20
  # display_to :date
21
21
  # created_at :datetime
22
22
  # updated_at :datetime
23
- # meta_id :integer
24
23
  # gmap_id :integer
25
24
  #
26
25
  module Mokio
@@ -0,0 +1,5 @@
1
+ module Mokio
2
+ class SeoTag < ActiveRecord::Base
3
+ include Mokio::Concerns::Models::SeoTag
4
+ end
5
+ end
@@ -19,7 +19,6 @@
19
19
  # display_to :date
20
20
  # created_at :datetime
21
21
  # updated_at :datetime
22
- # meta_id :integer
23
22
  # gmap_id :integer
24
23
  #
25
24
  module Mokio
@@ -27,8 +27,8 @@ class CkeditorPictureUploader < CarrierWave::Uploader::Base
27
27
  # def scale(width, height)
28
28
  # # do something
29
29
  # end
30
-
31
- process :read_dimensions
30
+
31
+ process :extract_dimensions
32
32
 
33
33
  # Create different versions of your uploaded files:
34
34
  version :thumb do
@@ -32,6 +32,7 @@
32
32
  = f.button :submit, bt("sign_in"), class: 'btn btn-info', id: 'loginBtn'
33
33
  -if flash[:alert] && flash[:alert] != t("devise.failure.unauthenticated")
34
34
  %div
35
- =flash[:alert]
35
+ %label.error
36
+ = flash[:alert]
36
37
  %br
37
38
  = link_to t("devise.link.forgot_password"), new_password_path(resource_name)
@@ -1,8 +1,8 @@
1
1
  = render :partial => "mokio/common/main_pic", locals: {f:f}
2
2
  = render :partial => "mokio/contents/common", locals: {f:f}
3
- = f.input :lang_id, collection: Mokio::Lang.all.collect{|lang| [bt(lang.name), lang.id]}, include_blank: bt('all'), disabled: !obj.display_editable_field?('lang_id')
4
- = f.input :active, :wrapper => :active_checkbox, disabled: !obj.display_editable_field?('active')
5
- = f.input :home_page, :wrapper => :active_checkbox, disabled: !obj.display_editable_field?('home_page')
3
+ = render_backend_input_lang_id(f)
4
+ = render_backend_input_active(f)
5
+ = render_backend_input_home_page(f)
6
6
  = f.input :title, disabled: !obj.display_editable_field?('title')
7
7
  = f.input :subtitle, disabled: !obj.display_editable_field?('subtitle'), :as => :string
8
8
  = f.input :intro, :wrapper => :ckeditor, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Full', :height => 150, :language => I18n.locale} }, disabled: !obj.display_editable_field?('intro')
@@ -14,3 +14,6 @@
14
14
  = t('menus.content_assoc')
15
15
  .span10
16
16
  =collection_select(:article, :menu_ids,menu_select_grouped(Mokio::Menu.all.includes(:content_links).arrange(:order => :seq)),:id,:name, {disabled: lambda{|s| s.fake.present? },selected:obj.menus.map {|j| j.id} },:multiple => true)
17
+
18
+ / #TODO - in all similar views
19
+ / DEPRECATION WARNING: Dangerous query method (method whose arguments are used as raw SQL) called with non-attribute argument(s): "coalesce(`mokio_menus`.`ancestry`, ''), seq". Non-attribute arguments will be disallowed in Rails 6.0. This method should not be called with user-provided values, such as request parameters or model attributes. Known-safe values can be passed by wrapping them in Arel.sql(). (called from __home_matt_projects_bloomnet_mokio_git_mokio_app_views_mokio_articles__form_html_slim___906233159799876300_69966117229420 at /home/matt/projects/bloomnet/mokio-git/mokio/app/views/mokio/articles/_form.html.slim:16)
@@ -6,17 +6,17 @@
6
6
  .row-fluid
7
7
  = simple_form_for obj, :html => { :class => 'form-horizontal' } do |f|
8
8
  = render :partial => "mokio/common/gmap", locals: {obj: obj, f: f} if obj.class.has_gmap_enabled?
9
- = render :partial => "mokio/common/meta", locals: {obj: obj, f: f} if obj.class.has_meta_enabled?
10
-
9
+ = backend_modal_render('seo_tags',f)
10
+
11
11
  = render :partial => "#{obj.class.to_s.tableize}/form", :locals => {f: f, obj: obj}
12
-
12
+
13
13
  - if params[:action] != "edit" || !has_data_files?(obj)
14
14
  - cache [:form_buttons, obj] do
15
15
  .form-actions
16
16
  = btn_submit bt("save")
17
17
  = btn_submit bt("save_and_create_new"), true
18
18
  = btn_cancel "#{engine_root}#{obj.class.to_s.tableize.gsub("mokio/", "")}"
19
-
19
+
20
20
  - if has_data_files?(obj) && params[:action] == "edit" && obj.default_data_file != Mokio::Youtube
21
21
  = render :template => "mokio/data_files/uploader"
22
22
  - if has_data_files?(obj) && obj.default_data_file == Mokio::Youtube && params[:action] == "edit"
@@ -3,8 +3,4 @@
3
3
  .box
4
4
  = box_title do
5
5
  = bt("edit_title", obj.respond_to?(:type) ? obj.type : @obj_class)
6
-
7
- -if Mokio.multi_lang_contents == true && obj.kind_of?(Mokio::BaseContent)
8
- = render :template => "mokio/common/multi_lang_form_content", locals: {obj: obj}
9
- -else
10
- = render :partial => "mokio/common/form_content", locals: {obj: obj}
6
+ = render :partial => "mokio/common/form_content", locals: {obj: obj}
@@ -23,6 +23,9 @@
23
23
  javascript:
24
24
  var obj_table = "#{@obj_class.to_s.demodulize.tableize}"
25
25
  var obj_class = "#{@obj_path}"
26
+ var tmp = "#{set_sorting_param(@obj_class)}";
27
+ tmp = tmp.replace(/&quot;/g, '"');
28
+ var default_sorting = JSON.parse(tmp);
26
29
  = javascript_include_tag "backend/datatable"
27
30
 
28
31
  /-if Mokio.solr_enabled == false
@@ -0,0 +1,47 @@
1
+ -if obj.class.respond_to?('has_seo_tagable_enabled?') && obj.class.has_seo_tagable_enabled?
2
+ a data-toggle="modal" href=("#seo_tags" )
3
+ button.btn.btn-warning.btn-mini.box-form2.right
4
+ span.icon16.icomoon-icon-google-plus.white
5
+ = bt("seo_tags", Mokio::SeoTag)
6
+ #seo_tags.modal.fade role="dialog" aria-hidden="true" style="display:none;" aria-labelledby="meta_g_ModalLabel"
7
+ .modal-dialog
8
+ .modal-content
9
+ .modal-header
10
+ h3.modal-title.modal-photo id="meta_g_ModalLabel"
11
+ span.icon24.icomoon-icon-google-plus
12
+ = bt("seo_tags", Mokio::SeoTag)
13
+ small = " #{bt("seo_tags_desc", Mokio::SeoTag)}"
14
+ .modal-body
15
+ = dynamic_fields_render_all(f, :seo_tags, table_view: true) do | form_obj |
16
+ tr.dynamic_fields_row
17
+ td = form_obj.input :tag_key, collection: obj.class.name.constantize.seo_tagable_columns, include_blank: false, wrapper: :input_without_label, label_method: ->(el){ obj.class.name.constantize.render_label(el) }
18
+ td = form_obj.input :tag_value, input_html: {style: 'height:35px; resize: none;'}, wrapper: :input_without_label
19
+ td = dynamic_fields_render_delete(form_obj)
20
+ .modal-footer
21
+ button.btn.btn-primary type="button" data-dismiss="modal" = bt("close")
22
+
23
+ javascript:
24
+ $('#seo_tags').on('hide.bs.modal', function (e) {
25
+ var error_message = "#{I18n.t('activerecord.errors.models.mokio/seo_tag.attributes.tag_key.taken')}";
26
+ var validForm = true;
27
+ var inputArr = [];
28
+
29
+ $('#seo_tags').find('select').each(function () {
30
+ if($(this).is(":visible")) {
31
+ inputValue = $(this).val();
32
+ inputArr.push(inputValue);
33
+ }
34
+ });
35
+
36
+ var inputArrUniq = inputArr.filter(function(elem, index, self) {
37
+ return index === self.indexOf(elem);
38
+ });
39
+
40
+ if(inputArrUniq.length != inputArr.length) {
41
+ validForm = false;
42
+ e.preventDefault();
43
+ e.stopPropagation();
44
+ alert(error_message);
45
+ return false;
46
+ }
47
+ });
@@ -3,7 +3,4 @@
3
3
  .box
4
4
  = box_title do
5
5
  = bt("new_title", @obj_class)
6
- -if Mokio.multi_lang_contents == true && obj.kind_of?(Mokio::BaseContent)
7
- = render :template => "mokio/common/multi_lang_form_content", locals: {obj: obj}
8
- -else
9
- = render :partial => "mokio/common/form_content", locals: {obj: obj}
6
+ = render :partial => "mokio/common/form_content", locals: {obj: obj}
@@ -1,12 +1,12 @@
1
- = f.input :lang_id, collection: Mokio::Lang.all.collect{|lang| [bt(lang.name), lang.id]}, include_blank: bt('all'), disabled: !obj.display_editable_field?('lang_id')
2
- = f.input :active, :wrapper => :active_checkbox, disabled: !obj.display_editable_field?('active')
3
- = f.input :home_page, :wrapper => :active_checkbox, disabled: !obj.display_editable_field?('home_page')
1
+ = render_backend_input_lang_id(f)
2
+ = render_backend_input_active(f)
3
+ = render_backend_input_home_page(f)
4
4
  = f.input :title, disabled: !obj.display_editable_field?('title')
5
5
  = f.input :subtitle, disabled: !obj.display_editable_field?('subtitle'), :as => :string
6
6
  = f.input :intro, :wrapper => :ckeditor, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Full', :height => 150, :language => I18n.locale} }, disabled: !obj.display_editable_field?('intro')
7
7
  = f.input :content, :wrapper => :ckeditor, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Full', :height => 400, :language => I18n.locale} }, disabled: !obj.display_editable_field?('content')
8
+ = f.input :recipient_emails, collection: [],:input_html => { :class => "recipients span10",multiple: true }, disabled: !obj.display_editable_field?('recipient_emails')
8
9
 
9
- = f.input :recipient_emails, :as => :string, :input_html => { :class => "recipients span10" }, disabled: !obj.display_editable_field?('recipient_emails')
10
10
  .row-fluid
11
11
  label.form-label.span2
12
12
  = t('menus.content_assoc')
@@ -40,12 +40,14 @@
40
40
  = "%content% - #{t('contacts.form_content')}"
41
41
 
42
42
  = t.input :tpl, :label => "", :wrapper => :ckeditor, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Medium', :height => 300} }
43
-
43
+
44
44
 
45
45
  = f.hidden_field :contact, value: true
46
46
  = f.hidden_field :intro, value: ""
47
47
 
48
48
  - content_for :js do
49
- = javascript_include_tag 'backend/plugins/forms/select/select2.min'
50
49
  javascript:
51
- $(".recipients").select2({tags:[]});
50
+ $(".recipients").select2({
51
+ tags: true,
52
+ tokenSeparators: [',', ' ']
53
+ })
@@ -18,8 +18,7 @@
18
18
 
19
19
  = simple_form_for obj, :html => { :class => 'form-horizontal' } do |f|
20
20
  = render :partial => "mokio/common/gmap", locals: {content: content, f: f} if content.class.has_gmap_enabled?
21
- = render :partial => "mokio/common/meta", locals: {content: content, f: f} if content.class.has_meta_enabled?
22
-
21
+ = backend_modal_render('seo_tags',f)
23
22
  = render :partial => "#{content.class.to_s.tableize}/form", :locals => {f: f, content: content}
24
23
 
25
24
  - if params[:action] != "edit" || !has_data_files?(content)