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
@@ -1,6 +1,6 @@
1
1
  module Mokio
2
- module Concerns
3
- module Controllers
2
+ module Concerns
3
+ module Controllers
4
4
  #
5
5
  # Concern for ApplicationController
6
6
  #
@@ -10,9 +10,9 @@ module Mokio
10
10
  included do
11
11
  # Prevent CSRF attacks by raising an exception.
12
12
  # For APIs, you may want to use :null_session instead.
13
- protect_from_forgery with: :exception
13
+ protect_from_forgery prepend: true
14
14
 
15
- before_filter :configure_permitted_parameters, if: :devise_controller?
15
+ before_action :configure_permitted_parameters, if: :devise_controller?
16
16
 
17
17
  rescue_from CanCan::AccessDenied do |exception|
18
18
  render :template =>'/mokio/errors/unauthorized', :alert => exception.message # backend_root_url
@@ -21,7 +21,7 @@ module Mokio
21
21
 
22
22
  protected
23
23
  #
24
- # <b>before_filter</b> in ApplicationController using <b>gem devise</b>
24
+ # <b>before_action</b> in ApplicationController using <b>gem devise</b>
25
25
  #
26
26
  def configure_permitted_parameters
27
27
  devise_parameter_sanitizer.permit(:sign_up, keys: [:email, :password, :password_confirmation])
@@ -8,21 +8,21 @@ module Mokio
8
8
  extend ActiveSupport::Concern
9
9
 
10
10
  included do
11
- protect_from_forgery
11
+ protect_from_forgery prepend: true
12
12
  layout "mokio/backend"
13
13
 
14
14
  before_action :authenticate_user!
15
- after_filter :flash_to_headers # json sending flash notices with ajax success see in main.js
15
+ after_action :flash_to_headers # json sending flash notices with ajax success see in main.js
16
16
  attr_accessor :breadcrumbs_prefix
17
17
  attr_accessor :breadcrumbs_prefix_link
18
- before_filter :set_breadcrumbs_prefix
19
-
18
+ before_action :set_breadcrumbs_prefix
19
+ before_action :prepare_locale
20
20
  end
21
21
 
22
22
  #
23
23
  # Sending flash messages in X-Flash-Messages header.
24
24
  # Decoding to UTF-8 with ajax success placed in main.js.
25
- # <b>after_filter</b> in BaseController
25
+ # <b>after_action</b> in BaseController
26
26
  #
27
27
  def flash_to_headers
28
28
  if request.xhr?
@@ -41,13 +41,8 @@ module Mokio
41
41
  # Redirects back if back if available otherwise redirects to specified url, flash message is displayed
42
42
  #
43
43
  def redirect_back(format, url, message)
44
- begin
45
- format.html { redirect_to :back, notice: message }
46
- format.json { head :no_content }
47
- rescue ::ActionController::RedirectBackError
48
- format.html { redirect_to url, notice: message }
49
- format.json { head :no_content }
50
- end
44
+ format.html { redirect_to url, notice: message }
45
+ format.json { head :no_content }
51
46
  end
52
47
 
53
48
  def set_breadcrumbs_prefix
@@ -55,6 +50,11 @@ module Mokio
55
50
  @breadcrumbs_prefix_link = ""
56
51
  end
57
52
 
53
+ def prepare_locale
54
+ I18n.locale = session[:locale_cms] || Mokio.cms_locale
55
+ session[:locale_cms] = I18n.locale
56
+ end
57
+
58
58
  #
59
59
  # override current_ability to use Mokio's one
60
60
  #
@@ -56,6 +56,9 @@ module Mokio
56
56
 
57
57
  end
58
58
 
59
+ def ajax_collection
60
+ render json: []
61
+ end
59
62
  #
60
63
  # Index action renders <b>json</b> with parameters to jquery.datatables
61
64
  #
@@ -87,7 +90,6 @@ module Mokio
87
90
  #
88
91
  def create
89
92
  create_obj( @obj_class.new(obj_params) )
90
-
91
93
  respond_to do |format|
92
94
  if obj.save
93
95
  if !params[:save_and_new].blank?
@@ -148,7 +150,7 @@ module Mokio
148
150
  # has_many :authors
149
151
  #
150
152
  # amoeba do
151
- # include_field [:tags, :authors]
153
+ # include_association [:tags, :authors]
152
154
  # end
153
155
  #
154
156
  # If you use this method add to your controller resources in routes.rb:
@@ -182,8 +184,8 @@ module Mokio
182
184
  end
183
185
 
184
186
  respond_to do |format|
185
- format.html { render :nothing => true }
186
- format.js { render :nothing => true }
187
+ format.html { head :ok }
188
+ format.js { head :ok }
187
189
  end
188
190
  end
189
191
 
@@ -3,12 +3,12 @@ module Mokio
3
3
  module Controllers
4
4
  #
5
5
  # Concern for DataFilesController
6
- #
6
+ #
7
7
  module DataFiles
8
8
  extend ActiveSupport::Concern
9
9
 
10
10
  included do
11
- before_filter :data_file, only: [:edit, :update, :destroy]
11
+ before_action :data_file, only: [:edit, :update, :destroy]
12
12
 
13
13
  load_and_authorize_resource
14
14
  end
@@ -90,7 +90,7 @@ module Mokio
90
90
 
91
91
  private
92
92
  #
93
- # before_filter finding datafile by id
93
+ # before_action finding datafile by id
94
94
  #
95
95
  def data_file #:doc:
96
96
  @data_file = Mokio::DataFile.find(params[:id])
@@ -1,4 +1,4 @@
1
- module Mokio
1
+ module Mokio
2
2
  module Concerns
3
3
  module Controllers
4
4
  #
@@ -36,7 +36,7 @@ module Mokio
36
36
  def update
37
37
  @content_ids = params[:menu][:content_ids]
38
38
  @av_mod_ids = params[:menu][:available_module_ids]
39
- super
39
+ super
40
40
  end
41
41
 
42
42
  #
@@ -66,7 +66,7 @@ module Mokio
66
66
  if Mokio::Menu.update(@change.keys, @change.values)
67
67
  flash[:notice] = t("menus.sort_true")
68
68
  else
69
- flash[:error] = t("menus.sort_false")
69
+ flash[:error] = t("menus.sort_false")
70
70
  end
71
71
 
72
72
  render :nothing => true
@@ -89,16 +89,15 @@ module Mokio
89
89
  #
90
90
  # Method to initialize menu's dual select boxes
91
91
  #
92
- def init_dual_select #:doc:
93
- @dual_select_str = ""
92
+ def init_dual_select #:doc:
93
+ @dual_select_arr = []
94
94
 
95
95
  Mokio::ModulePosition.all.each do |mp|
96
- @dual_select_str += " dualSelectInit('_#{mp.id}', false);"
96
+ @dual_select_arr << mp.id
97
97
  end
98
98
  end
99
-
100
99
  #
101
- # Transforms structure like: menu_id1 => parent_id1, menu_id2 => parent_id2 into
100
+ # Transforms structure like: menu_id1 => parent_id1, menu_id2 => parent_id2 into
102
101
  # structure like: menu_id => {:parent_id => parent_id, :seq => seq_number}
103
102
  #
104
103
  def transform(menu_tree_param, change) #:doc:
@@ -109,13 +108,13 @@ module Mokio
109
108
  menu_tree_param.each do |menu_id, parent_id|
110
109
  menu = menus.select{|m| m.id == menu_id.to_i}.first
111
110
  # parent_id = menu.lang_id if parent_id == 'null'
112
-
111
+
113
112
  if parent_id == "null"
114
113
  parent_id = menu.ancestor_ids.select{|ar| root_ids.include?(ar)}.first
115
114
  end
116
115
 
117
116
  seq[parent_id] = seq[parent_id].nil? ? 1 : seq[parent_id].to_i + 1
118
- change[menu_id] = {:parent_id => parent_id, :seq => seq[parent_id]}
117
+ change[menu_id] = {:parent_id => parent_id, :seq => seq[parent_id]}
119
118
  end
120
119
 
121
120
  change
@@ -165,13 +164,12 @@ module Mokio
165
164
  @menu.save
166
165
  end
167
166
  end
168
-
167
+
169
168
  #
170
169
  # Never trust parameters from the scary internet, only allow the white list through.
171
170
  #
172
171
  def menu_params #:doc:
173
- params[:menu].permit(extended_parameters,mokio_gems_parameters, :name, :subtitle, :seq, :target, :external_link, :css_class, :css_body_class, :main_pic, :follow, :parent_id, :active, :visible, :description, :lang_id, :fake, :content_ids => [],:available_module_ids => [],
174
- :meta_attributes => Mokio::Meta.meta_attributes)
172
+ params[:menu].permit(extended_parameters,mokio_gems_parameters, :name, :subtitle, :seq, :target, :external_link, :css_class, :css_body_class, :main_pic, :follow, :parent_id, :active, :visible, :description, :lang_id, :fake, :content_ids => [],:available_module_ids => [])
175
173
  end
176
174
  end
177
175
  end
@@ -55,8 +55,7 @@ module Mokio
55
55
  # Never trust parameters from the scary internet, only allow the white list through.
56
56
  #
57
57
  def mov_gallery_params #:doc:
58
- params.require(:mov_gallery).permit(mokio_gems_parameters,:title, :subtitle, :type, :active, :home_page ,:intro, :content, :display_from, :display_to, :lang_id, :main_pic, :tag_list, :menu_ids => [], :data_file => [],
59
- :meta_attributes => Mokio::Meta.meta_attributes)
58
+ params.require(:mov_gallery).permit(mokio_gems_parameters,:title, :subtitle, :type, :active, :home_page ,:intro, :content, :display_from, :display_to, :lang_id, :main_pic, :tag_list, :menu_ids => [], :data_file => [])
60
59
  end
61
60
  end
62
61
  end
@@ -11,7 +11,7 @@ module Mokio
11
11
  extend ActiveSupport::Concern
12
12
 
13
13
  included do
14
- before_filter :edited_photo, only: [:get_thumb, :update_thumb, :remove_thumb, :crop_thumb, :rotate_thumb,
14
+ before_action :edited_photo, only: [:get_thumb, :update_thumb, :remove_thumb, :crop_thumb, :rotate_thumb,
15
15
  :get_photo, :rotate_photo, :crop_photo]
16
16
  end
17
17
 
@@ -50,8 +50,8 @@ module Mokio
50
50
  # split with "\n" can create "empty" string with '\r', when parsing textarea parameter
51
51
  # we don't want to have them in loop
52
52
  #
53
- urls.reject! {|u| u == "\r"}
54
-
53
+ urls.reject! {|u| u == "\r"}
54
+
55
55
  if urls
56
56
  urls.each do |url|
57
57
  url = url.gsub(/,/, '')
@@ -66,7 +66,7 @@ module Mokio
66
66
  #
67
67
  if Faraday.head(url).status == 200
68
68
  photo = create_external_photo url
69
-
69
+
70
70
  if photo.save # !!!
71
71
  @photos << photo
72
72
  notice += "#{t("photos.created", title: photo.name)}\n"
@@ -90,7 +90,7 @@ module Mokio
90
90
  #
91
91
  # we can have both error and notice messages so only those cases
92
92
  #
93
- flash[:error] = error unless error == t("photos.photos_from_external_links_error")
93
+ flash[:error] = error unless error == t("photos.photos_from_external_links_error")
94
94
  flash[:notice] = notice unless notice.blank?
95
95
 
96
96
  respond_to do |format|
@@ -104,7 +104,7 @@ module Mokio
104
104
  def destroy
105
105
  @id = params[:id]
106
106
  @photo = photo_model.friendly.find(@id)
107
-
107
+
108
108
  if @photo.destroy
109
109
  flash[:notice] = t("photos.deleted", title: @photo.name)
110
110
  else
@@ -166,13 +166,13 @@ module Mokio
166
166
  # when MiniMagick.open failed, continue action with only error message for user, this prevent redirect to 500 in this case
167
167
  #
168
168
  rescue Errno::ENOENT
169
- flash[:error] = t("photos.not_crop", name: @edited_photo.name)
169
+ flash[:error] = t("photos.not_crop", name: @edited_photo.name)
170
170
  logger.error exception_msg(image_path)
171
171
  end
172
172
 
173
173
  respond_to do |format|
174
174
  format.js {render :template => "mokio/photos/crop_thumb"}
175
- end
175
+ end
176
176
  end
177
177
 
178
178
  #
@@ -224,7 +224,7 @@ module Mokio
224
224
  #
225
225
  def remove_thumb
226
226
  @edited_photo.remove_thumb = true
227
-
227
+
228
228
  if @edited_photo.save!
229
229
  flash[:notice] = t("photos.thumb_deleted", name: @edited_photo.name)
230
230
  @edited_photo.touch
@@ -313,7 +313,7 @@ module Mokio
313
313
  # Never trust parameters from the scary internet, only allow the white list through.
314
314
  #
315
315
  def photo_params #:doc:
316
- params.require(:photo).permit(:name, :subtitle, :intro, :external_link, :thumb, :active, :content_id,:base_content_id, :data_file, :remote_data_file_url, :seq)
316
+ params.require(:photo).permit(:name, :subtitle, :intro, :external_link, :thumb, :active, :content_id,:data_file, :remote_data_file_url, :seq)
317
317
  end
318
318
 
319
319
  #
@@ -1,5 +1,5 @@
1
1
  module Mokio
2
- module Concerns
2
+ module Concerns
3
3
  module Controllers
4
4
  #
5
5
  # Concern for PicGalleriesController
@@ -54,8 +54,7 @@ module Mokio
54
54
  # Never trust parameters from the scary internet, only allow the white list through.
55
55
  #
56
56
  def pic_gallery_params #:doc:
57
- params.require(:pic_gallery).permit(mokio_gems_parameters,:title, :subtitle, :type, :active,:home_page, :intro, :content, :display_from, :display_to, :lang_id, :main_pic, :tag_list, :menu_ids => [], :data_file => [],
58
- :meta_attributes => Mokio::Meta.meta_attributes)
57
+ params.require(:pic_gallery).permit(mokio_gems_parameters,:title, :subtitle, :type, :active,:home_page, :intro, :content, :display_from, :display_to, :lang_id, :main_pic, :tag_list, :menu_ids => [], :data_file => [])
59
58
  end
60
59
  end
61
60
  end
@@ -8,7 +8,7 @@ module Mokio
8
8
  extend ActiveSupport::Concern
9
9
 
10
10
  include Mokio::Concerns::Common::Translations
11
-
11
+
12
12
  included do
13
13
  end
14
14
 
@@ -35,7 +35,7 @@ module Mokio
35
35
  if !params[:save_and_new].blank?
36
36
  format.html { redirect_to obj_new_url(@obj_class.new), notice: CommonTranslation.updated(obj) }
37
37
  format.json { head :no_content }
38
- else
38
+ else
39
39
  format.html { redirect_to obj_index_url, notice: CommonTranslation.updated(obj) }
40
40
  format.json { render action: 'index', status: :created, location: obj }
41
41
  end
@@ -50,7 +50,7 @@ module Mokio
50
50
  # Editing password for user
51
51
  #
52
52
  def edit_password
53
-
53
+ set_obj
54
54
  # Request Referer for redirect user in the place where it was before the change password
55
55
  session[:return_to] = request.referer
56
56
  @password_only = true
@@ -60,6 +60,7 @@ module Mokio
60
60
  # Updating password for user
61
61
  #
62
62
  def update_password
63
+ set_obj
63
64
  @user.only_password = true
64
65
  respond_to do |format|
65
66
  if @user.update(user_params)
@@ -8,8 +8,8 @@ module Mokio
8
8
  extend ActiveSupport::Concern
9
9
 
10
10
  included do
11
- before_filter :set_edited_gallery, :only => [:create, :update, :find]
12
- before_filter :set_edited_movie, :only => [:edit, :update, :preview_movie]
11
+ before_action :set_edited_gallery, :only => [:create, :update, :find]
12
+ before_action :set_edited_movie, :only => [:edit, :update, :preview_movie]
13
13
  end
14
14
 
15
15
  #
@@ -29,14 +29,14 @@ module Mokio
29
29
  end
30
30
 
31
31
  @youtube.thumb = @youtube.thumb.file
32
-
32
+
33
33
  if @youtube.save
34
34
  flash[:notice] = t("youtubes.created", title: @youtube.name).html_safe
35
35
  else
36
36
  flash[:error] = t("youtubes.created", title: @youtube.name).html_safe
37
37
  end
38
38
 
39
- redirect_to edit_content_path(@edited_gallery)
39
+ redirect_to edit_content_path(@edited_gallery)
40
40
  end
41
41
 
42
42
  #
@@ -76,7 +76,7 @@ module Mokio
76
76
 
77
77
  #
78
78
  # Searches for a movie on Youtube, Vimeo or Dailymotion based on given URL.
79
- # Renders preview.html.haml
79
+ # Renders preview.html.haml
80
80
  #
81
81
  def find
82
82
  @youtube = Mokio::Youtube.new
@@ -102,7 +102,7 @@ module Mokio
102
102
  end
103
103
 
104
104
  #
105
- # Opens a window with a movie based on the movie URL
105
+ # Opens a window with a movie based on the movie URL
106
106
  #
107
107
  def preview_movie
108
108
  @video = Mokio::Youtube.find_movie(@edited_movie.movie_url)
@@ -114,7 +114,7 @@ module Mokio
114
114
  private
115
115
  #
116
116
  # Never trust parameters from the scary internet, only allow the white list through.
117
- #
117
+ #
118
118
  def youtube_params #:doc:
119
119
  params.require(:youtube).permit(:name, :intro, :external_link, :active, :content_id, :movie_url, :id, :thumb, :subtitle, :thumb_external_url)
120
120
  end
@@ -11,17 +11,17 @@ module Mokio
11
11
  belongs_to :static_module
12
12
  belongs_to :module_position
13
13
 
14
- scope :not_selected_for_menu, -> (menu_id = -1) {
14
+ scope :not_selected_for_menu, -> (menu_id = -1) {
15
15
  ids = Mokio::SelectedModule.where(:menu_id => menu_id).pluck(:available_module_id)
16
16
  joins("join mokio_static_modules on mokio_available_modules.static_module_id = mokio_static_modules.id").
17
- where('mokio_available_modules.id not in (?) and always_displayed = 0', ids.empty? ? '-1' : ids)
17
+ where('mokio_available_modules.id not in (?) and always_displayed = false', ids.empty? ? '-1' : ids)
18
18
  }
19
19
  scope :always_displayed, -> {joins("join mokio_static_modules on mokio_available_modules.static_module_id = mokio_static_modules.id").where('mokio_static_modules.always_displayed = ?', true)}
20
20
  scope :for_lang, -> (lang_id = 0) {joins("join mokio_static_modules on mokio_available_modules.static_module_id = mokio_static_modules.id").where('mokio_static_modules.lang_id = ? or mokio_static_modules.lang_id is null', lang_id)}
21
21
 
22
22
  # acts_as_list :column => :seq, :scope => :module_position
23
23
  #
24
- # scope :selected_for_menu, -> (menu_id = -1) {
24
+ # scope :selected_for_menu, -> (menu_id = -1) {
25
25
  # ids = SelectedModule.where(:menu_id => menu_id).pluck(:available_module_id)
26
26
  # joins("join static_modules on available_modules.static_module_id = static_modules.id").
27
27
  # where('available_modules.id in (?) or always_displayed = 1', ids.empty? ? '-1' : ids)
@@ -14,13 +14,12 @@ module Mokio
14
14
  DATE_ATTRIBUTES = %w(display_from display_to updated_at created_at)
15
15
 
16
16
  included do
17
- attr_accessor :empty_meta
18
17
 
19
18
  scope :active, -> { where(active: true) }
20
19
  scope :order_default, -> { order("seq asc") }
21
20
 
22
21
  before_destroy :deletable
23
- before_save :complete_meta
22
+
24
23
 
25
24
  validate :some_editable , on: :update
26
25
 
@@ -46,13 +45,6 @@ module Mokio
46
45
  def has_gmap_enabled?
47
46
  Mokio.backend_gmap_enabled.include?(self.name)
48
47
  end
49
-
50
- #
51
- # Returns boolean value depends on included model names in Mokio.backend_meta_enabled
52
- #
53
- def has_meta_enabled?
54
- Mokio.backend_meta_enabled.include?(self.name)
55
- end
56
48
  end
57
49
 
58
50
  #
@@ -118,26 +110,6 @@ module Mokio
118
110
  def cloneable?
119
111
  true
120
112
  end
121
-
122
- #
123
- # Method for autocomplete meta tags
124
- #
125
- def complete_meta
126
- if self.class.has_meta_enabled?
127
- self.empty_meta = true if self.meta.present? && (self.meta.g_title.blank? || self.meta.f_title.blank? || self.meta.g_application_name.blank?)
128
-
129
- application_name = Rails.application.class.to_s.split("::").first
130
- self.meta.g_title = self.title if self.meta.present? && self.meta.g_title.blank?
131
- self.meta.f_title = self.title if self.meta.present? && self.meta.f_title.blank?
132
- self.meta.g_application_name = application_name if self.meta.present? && self.meta.g_application_name.blank?
133
-
134
- if self.respond_to?(:intro) && self.intro.present?
135
- intro = ActionController::Base.helpers.strip_tags(self.intro).truncate(160).gsub!(/\s+/, ' ')
136
- self.meta.g_desc = intro if self.meta.present? && self.meta.g_desc.blank?
137
- self.meta.f_desc = intro if self.meta.present? && self.meta.f_desc.blank?
138
- end
139
- end
140
- end
141
113
  end
142
114
  end
143
115
  end