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
@@ -8,10 +8,6 @@ module Mokio
8
8
  extend ActiveSupport::Concern
9
9
 
10
10
  included do
11
-
12
- belongs_to :base_contact
13
- accepts_nested_attributes_for :base_contact
14
-
15
11
  belongs_to :contact
16
12
  accepts_nested_attributes_for :contact
17
13
  end
@@ -9,27 +9,27 @@ module Mokio
9
9
 
10
10
  included do
11
11
  include Mokio::Concerns::Models::Common
12
+ include Mokio::Concerns::Common::SeoTags
13
+ include Mokio::Concerns::Common::Services::Sitemap::Model
12
14
 
13
15
  has_many :content_links, :dependent => :destroy
14
16
  has_many :data_files, :dependent => :destroy
15
17
  has_many :menus, :through => :content_links
16
18
 
17
- belongs_to :gmap, :dependent => :destroy # Relation with gmap isn't necessary !
18
- belongs_to :meta, :dependent => :destroy
19
+ belongs_to :gmap, :dependent => :destroy,optional: true # Relation with gmap isn't necessary !
19
20
 
20
21
  belongs_to :author, :class_name => 'Mokio::User', :foreign_key => :created_by
21
22
  belongs_to :editor, :class_name => 'Mokio::User', :foreign_key => :updated_by
22
- belongs_to :lang
23
+ belongs_to :lang, required: false
23
24
 
24
25
  mount_uploader :main_pic, Mokio::MainPicUploader
25
26
 
26
27
  accepts_nested_attributes_for :menus
27
- accepts_nested_attributes_for :meta, :allow_destroy => true
28
28
  accepts_nested_attributes_for :gmap, :allow_destroy => true, :reject_if => lambda { |g| g[:full_address].blank? }
29
29
  accepts_nested_attributes_for :data_files, :allow_destroy => true, :reject_if => lambda { |d| d[:data_file].blank? }
30
-
30
+
31
31
  validates :title, presence: true
32
- validate :compare_dates
32
+ validate :compare_dates
33
33
 
34
34
  scope :lang, -> (lang_id) { where('lang_id = ? or lang_id is null', lang_id) }
35
35
  scope :order_default, -> { order("seq asc") }
@@ -50,11 +50,19 @@ module Mokio
50
50
  #
51
51
  # Columns for table in CommonController#index view
52
52
  #
53
- def columns_for_table
53
+ def columns_for_table
54
54
  %w(title active type updated_at lang_id)
55
55
  end
56
56
  end
57
57
 
58
+ def sitemap_url_strategy
59
+ {loc: "#{self.title}",priority: 1,lastmod: self.updated_at }
60
+ end
61
+
62
+ def can_add_to_sitemap?
63
+ true
64
+ end
65
+
58
66
  def author_name
59
67
  author.name_view unless author.blank?
60
68
  end
@@ -11,9 +11,8 @@ module Mokio
11
11
  extend FriendlyId
12
12
 
13
13
  friendly_id :slug_candidates, use: :slugged
14
- validates_uniqueness_of :slug
14
+ validates_uniqueness_of :slug,case_sensitive: true
15
15
  belongs_to :contents, :touch => true
16
- belongs_to :base_contents
17
16
 
18
17
  mount_uploader :data_file, Mokio::DataFileUploader
19
18
  mount_uploader :thumb, Mokio::ThumbUploader
@@ -61,13 +60,8 @@ module Mokio
61
60
  # For some reason touch => true does not work for DataFile :(
62
61
  #
63
62
  def touch_content
64
- if self.content_id.present?
65
- Mokio::Content.find(self.content_id).touch(:etag)
66
- else
67
- Mokio::BaseContent.find(self.base_content_id).touch(:etag)
68
-
69
- end
70
- end
63
+ Mokio::Content.find(self.content_id).touch(:etag)
64
+ end
71
65
 
72
66
  def slide?
73
67
  false
@@ -73,23 +73,27 @@ module Mokio
73
73
  def destroy_all_dependand
74
74
  Mokio::StaticModule.where(:lang_id => id).update_all(:lang_id => nil)
75
75
  Mokio::ContentLink.delete_all(:menu_id => menu.pluck(:id))
76
- Mokio::Meta.delete(menu.where.not(:meta_id => nil).pluck(:meta_id))
77
76
  Mokio::Menu.delete_all(:lang_id => id)
78
77
  end
79
78
 
80
79
  def add_fake_menu
81
80
  @menu = Mokio::Menu.new( name: self.shortname , lang_id: self.id,fake:true,deletable:false,editable:false)
82
- @menu.build_meta
83
81
 
84
82
  if(@menu.save)
85
83
  self.menu_id = @menu.id
86
84
  self.save(:validate => false)
87
- result = Mokio::Menu.all.fake_structure_unique
85
+ result = Mokio::Menu.all.fake_structure_unique.where.not(ancestry: nil).select(:name).distinct
86
+
88
87
  result.each do |s|
89
- if s.depth == 1
90
- @parent_menu = Mokio::Menu.new( name: s.name,ancestry:@menu.id, lang_id:self.id,fake:true,deletable:false,editable:false)
91
- @parent_menu.save
92
- end
88
+ @parent_menu = Mokio::Menu.new(
89
+ name: s.name,
90
+ ancestry: @menu.id,
91
+ lang_id: self.id,
92
+ fake: true,
93
+ deletable:false,
94
+ editable:false
95
+ )
96
+ @parent_menu.save
93
97
  end
94
98
  end
95
99
  end
@@ -9,6 +9,7 @@ module Mokio
9
9
 
10
10
  included do
11
11
  include Mokio::Concerns::Models::Common
12
+ include Mokio::Concerns::Common::SeoTags
12
13
  extend FriendlyId
13
14
 
14
15
  friendly_id :slug_candidates, use: :slugged
@@ -17,10 +18,10 @@ module Mokio
17
18
 
18
19
  validates :name, presence: true
19
20
  validates :lang_id, presence: true
20
- validates_uniqueness_of :slug
21
+ validates_uniqueness_of :slug,case_sensitive: true
21
22
 
22
23
  belongs_to :lang
23
- belongs_to :meta, :dependent => :destroy
24
+ belongs_to :meta, :dependent => :destroy,optional: true
24
25
 
25
26
  mount_uploader :main_pic, Mokio::MainPicUploader
26
27
 
@@ -30,7 +31,6 @@ module Mokio
30
31
  has_many :available_modules, -> {order('mokio_selected_modules.seq')}, :through => :selected_modules
31
32
 
32
33
  accepts_nested_attributes_for :contents, :available_modules
33
- accepts_nested_attributes_for :meta
34
34
 
35
35
  before_save :seq_and_lang_update
36
36
 
@@ -40,7 +40,7 @@ module Mokio
40
40
  scope :order_default, -> { order("seq asc") }
41
41
  scope :active, -> { where(active: true) }
42
42
  scope :nofake, -> { where(fake: false)}
43
- scope :fake_structure_unique, -> { where(fake: true).group(:name) }
43
+ scope :fake_structure_unique, -> { where(fake: true) }
44
44
 
45
45
  def should_generate_new_friendly_id?
46
46
  name_changed?
@@ -12,7 +12,7 @@ module Mokio
12
12
  accepts_nested_attributes_for :static_modules
13
13
  validates :name , presence: true
14
14
  amoeba do
15
- include_field :static_modules
15
+ include_association :static_modules
16
16
  end
17
17
  end
18
18
 
@@ -9,8 +9,6 @@ module Mokio
9
9
 
10
10
  included do
11
11
  belongs_to :contact
12
- belongs_to :base_contact
13
-
14
12
  validates :email, :email => true
15
13
  end
16
14
  end
@@ -0,0 +1,118 @@
1
+ module Mokio
2
+ module Concerns
3
+ module Models
4
+ module SeoTag
5
+
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ belongs_to :seo_tagable, polymorphic: true
10
+ validates_uniqueness_of :tag_key, :scope => [:seo_tagable_type, :seo_tagable_id], case_sensitive: true
11
+
12
+ def is_title?
13
+ tag_key == "title"
14
+ end
15
+
16
+ end
17
+
18
+ module ClassMethods
19
+ def seo_tag_attributes
20
+ [:tag_key, :tag_value, :id, :_destroy]
21
+ end
22
+
23
+ def seo_tags_list_keys
24
+ self.seo_tags_list.pluck(:key)
25
+ end
26
+
27
+ def seo_tags_list
28
+ [
29
+ { type: "name", key: "title"},
30
+ { type: "name", key: "keywords"},
31
+ { type: "name", key: "description"},
32
+ { type: "name", key: "subject"},
33
+ { type: "name", key: "copyright"},
34
+ { type: "name", key: "language"},
35
+ { type: "name", key: "robots"},
36
+ { type: "name", key: "revised"},
37
+ { type: "name", key: "abstract"},
38
+ { type: "name", key: "topic"},
39
+ { type: "name", key: "summary"},
40
+ { type: "name", key: "Classification"},
41
+ { type: "name", key: "author"},
42
+ { type: "name", key: "designer"},
43
+ { type: "name", key: "copyright"},
44
+ { type: "name", key: "reply-to"},
45
+ { type: "name", key: "owner"},
46
+ { type: "name", key: "url"},
47
+ { type: "name", key: "identifier-URL"},
48
+ { type: "name", key: "directory"},
49
+ { type: "name", key: "category"},
50
+ { type: "name", key: "coverage"},
51
+ { type: "name", key: "distribution"},
52
+ { type: "name", key: "rating"},
53
+ { type: "name", key: "revisit-after"},
54
+ { type: "name", key: "og:title"},
55
+ { type: "name", key: "og:type"},
56
+ { type: "name", key: "og:url"},
57
+ { type: "name", key: "og:image"},
58
+ { type: "name", key: "og:site_name"},
59
+ { type: "name", key: "og:description"},
60
+ { type: "name", key: "fb:page_id"},
61
+ { type: "name", key: "og:email"},
62
+ { type: "name", key: "og:phone_number"},
63
+ { type: "name", key: "og:fax_number"},
64
+ { type: "name", key: "og:latitude"},
65
+ { type: "name", key: "og:longitude"},
66
+ { type: "name", key: "og:street-address"},
67
+ { type: "name", key: "og:locality"},
68
+ { type: "name", key: "og:region"},
69
+ { type: "name", key: "og:postal-code"},
70
+ { type: "name", key: "og:country-name"},
71
+ { type: "name", key: "microid"},
72
+ { type: "name", key: "apple-mobile-web-app-capable"},
73
+ { type: "name", key: "apple-touch-fullscreen"},
74
+ { type: "name", key: "apple-mobile-web-app-status-bar-style"},
75
+ { type: "name", key: "format-detection"},
76
+ { type: "name", key: "mssmarttagspreventparsing"},
77
+ { type: "name", key: "msapplication-starturl"},
78
+ { type: "name", key: "msapplication-window"},
79
+ { type: "name", key: "msapplication-navbutton-color"},
80
+ { type: "name", key: "application-name"},
81
+ { type: "name", key: "msapplication-tooltip"},
82
+ { type: "name", key: "msapplication-task"},
83
+ { type: "name", key: "tweetmeme-title"},
84
+ { type: "name", key: "apple-mobile-web-app-capable"},
85
+ { type: "name", key: "apple-mobile-web-app-status-bar-style"},
86
+ { type: "name", key: "format-detection"},
87
+ { type: "name", key: "viewport"},
88
+
89
+ { type: "property", key: "og:type" },
90
+ { type: "property", key: "og:points" },
91
+ { type: "property", key: "og:video" },
92
+ { type: "property", key: "og:video:height" },
93
+ { type: "property", key: "og:video:width" },
94
+ { type: "property", key: "og:video:type" },
95
+ { type: "property", key: "og:video" },
96
+ { type: "property", key: "og:video:type" },
97
+ { type: "property", key: "og:video" },
98
+ { type: "property", key: "og:video:type"},
99
+ { type: "property", key: "og:audio" },
100
+ { type: "property", key: "og:audio:title" },
101
+ { type: "property", key: "og:audio:artist" },
102
+ { type: "property", key: "og:audio:album" },
103
+ { type: "property", key: "og:audio:type" },
104
+
105
+ { type: "http-equiv", key: "Page-Enter"},
106
+ { type: "http-equiv", key: "Page-Exit"},
107
+ { type: "http-equiv", key: "X-UA-Compatible"},
108
+ { type: "http-equiv", key: "Expires"},
109
+ { type: "http-equiv", key: "Pragma"},
110
+ { type: "http-equiv", key: "Cache-Control"},
111
+ ]
112
+
113
+ end
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
@@ -13,12 +13,12 @@ module Mokio
13
13
  has_and_belongs_to_many :module_positions, :join_table => "mokio_available_modules"
14
14
  accepts_nested_attributes_for :module_positions
15
15
  validates :title, presence: true
16
-
16
+
17
17
  #
18
18
  # include module_positions to amoeba duplication process
19
19
  #
20
20
  amoeba do
21
- include_field :module_positions
21
+ include_association :module_positions
22
22
  end
23
23
  end
24
24
 
@@ -43,7 +43,7 @@ module Mokio
43
43
  roles :admin, :content_editor, :menu_editor, :static_module_editor, :user_editor, :comment_approver, :reader
44
44
 
45
45
  # before_validation :add_default_role
46
- belongs_to :market
46
+ # belongs_to :market
47
47
 
48
48
  if Mokio.solr_enabled
49
49
  searchable do
@@ -22,23 +22,6 @@ module Mokio
22
22
  end
23
23
  end
24
24
 
25
- initializer 'mokio.helpers' do |app|
26
- ActiveSupport.on_load :action_view do
27
- ActionView::Base.send :include, Mokio::Backend::BackendHelper
28
- ActionView::Base.send :include, Mokio::Backend::BreadcrumbsHelper
29
- ActionView::Base.send :include, Mokio::Backend::CommonHelper
30
- ActionView::Base.send :include, Mokio::Backend::JavascriptHelper
31
- ActionView::Base.send :include, Mokio::Backend::MenuHelper
32
- ActionView::Base.send :include, Mokio::Backend::UrlHelper
33
-
34
- ActionView::Base.send :include, Mokio::FrontendHelpers::MenuHelper
35
- ActionView::Base.send :include, Mokio::FrontendHelpers::StaticModulesHelper
36
- ActionView::Base.send :include, Mokio::FrontendHelpers::ContentHelper
37
- ActionView::Base.send :include, Mokio::FrontendHelpers::ExternalScriptsHelper
38
- ActionView::Base.send :include, Mokio::FrontendHelpers::LangsHelper
39
- end
40
- end
41
-
42
25
  #
43
26
  # Precompile hook
44
27
  #
@@ -75,6 +58,13 @@ module Mokio
75
58
  frontend/*
76
59
  frontend/bg/*
77
60
  backend/head.js
61
+ backend/datatable.js
62
+ backend/favicon.ico
63
+ backend/menu/menu_dual_select.js
64
+ backend/help-engine/jquery.joyride-2.1.js
65
+ backend/help-engine/help-engine.js
66
+ backend/mokio-logo.svg
67
+ backend/menu/jquery.ui.nestedSortable.js
78
68
  )
79
69
  end
80
70
 
@@ -3,4 +3,5 @@ require 'mokio/frontend_helpers/menu_helper'
3
3
  require 'mokio/frontend_helpers/static_modules_helper'
4
4
  require 'mokio/frontend_helpers/external_scripts_helper'
5
5
  require 'mokio/frontend_helpers/langs_helper'
6
+ require 'mokio/frontend_helpers/seo_tag_helper'
6
7
 
@@ -0,0 +1,33 @@
1
+ module Mokio
2
+ module FrontendHelpers
3
+ #
4
+ # Frontend helper methods used with Mokio::SeoTag objects
5
+ #
6
+ module SeoTagHelper
7
+ def render_seo_meta_tags(model_obj)
8
+ result = ""
9
+ return result unless model_obj.class.has_seo_tagable_enabled?
10
+ collection = model_obj.seo_tags
11
+ if collection.any?
12
+ seo_hash = {}
13
+ Mokio::SeoTag.seo_tags_list.map{|a| seo_hash[a[:key].to_sym] = a[:type]}
14
+ collection.each do |el|
15
+ result << render_seo_meta_build_tag_helper(el,seo_hash)
16
+ end
17
+ end
18
+ result
19
+ end
20
+
21
+ private
22
+
23
+ def render_seo_meta_build_tag_helper(el, seo_hash)
24
+ return nil unless el.present? && seo_hash.present?
25
+ if el.is_title?
26
+ content_tag(:title, el.tag_value)
27
+ else
28
+ tag(:meta, "#{seo_hash[el.tag_key.to_sym]}" => ("#{el.tag_key}"), :content => ("#{el.tag_value}"))
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -9,6 +9,17 @@ SimpleForm.setup do |config|
9
9
  # whole input.
10
10
 
11
11
  # =========================================================================================== #
12
+ config.wrappers :select2, :tag => 'div', :class => 'row-fluid', :error_class => 'error' do |b|
13
+ b.use :html5
14
+ b.wrapper :tag => 'label', :class => 'form-label span2' do |bb|
15
+ bb.use :label_text
16
+ end
17
+ b.wrapper :tag => 'div', :class => 'span10' do |bb|
18
+ bb.use :input, :class => 'mokio-select2'
19
+ end
20
+ b.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
21
+ b.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
22
+ end
12
23
 
13
24
  config.wrappers :custom, :tag => 'div', :class => 'row-fluid', :error_class => 'error' do |b|
14
25
  b.use :html5
@@ -2,5 +2,5 @@ module Mokio
2
2
  #
3
3
  # Actual Mokio version
4
4
  #
5
- VERSION = "0.0.15"
5
+ VERSION = "2.0.8"
6
6
  end
@@ -3,6 +3,27 @@ require 'mokio'
3
3
  require 'rails/generators'
4
4
 
5
5
  namespace :mokio do
6
+ desc "Reset pg columns sequence"
7
+
8
+ task reset_pg_sequence: :environment do
9
+ ActiveRecord::Base.connection.tables.each do |t|
10
+ ActiveRecord::Base.connection.reset_pk_sequence!(t)
11
+ end
12
+ end
13
+
14
+ desc "Add mokio routing to routes.rb"
15
+
16
+ task :install_routes => :environment do |t|
17
+ path = "#{Rails.root}/config/routes.rb"
18
+ text = File.read(path)
19
+
20
+ if !Rails.application.routes.url_helpers.method_defined?(:mokio_url)
21
+ File.open(path, "w") do |file|
22
+ file.puts text.gsub(/Rails.application.routes.draw do/, "Rails.application.routes.draw do \n mount Mokio::Engine => '/backend'")
23
+ end
24
+ end
25
+ end
26
+
6
27
  desc "Create database, running migrations and creating some default data for Mokio application"
7
28
 
8
29
  task :install, [:email, :password] => :environment do |t, args|
@@ -41,7 +62,6 @@ namespace :mokio do
41
62
  parent: menu,
42
63
  slug: "top"
43
64
  })
44
- top_menu.build_meta
45
65
  puts "\n\tCreated default initial menu 'top'".green if top_menu.save(:validate => false)
46
66
 
47
67
 
@@ -55,18 +75,27 @@ namespace :mokio do
55
75
  })
56
76
  puts "\n\tCreated default user '#{args[:email]}' with password '#{args[:password]}'".green if user.save(:validate => false)
57
77
 
58
- text = File.read("#{Rails.root}/config/routes.rb")
78
+ Rake::Task["mokio:install_routes"].execute
59
79
 
60
- File.open("#{Rails.root}/config/routes.rb", "w") do |file|
61
- file.puts text.gsub(/# The priority is based upon order of creation: first created \-\> highest priority\./, "mount Mokio::Engine => '/backend'")
62
- end
80
+ # text = File.read("#{Rails.root}/config/routes.rb")
81
+
82
+ # File.open("#{Rails.root}/config/routes.rb", "w") do |file|
83
+ # file.puts text.gsub(/# The priority is based upon order of creation: first created \-\> highest priority\./, "mount Mokio::Engine => '/backend'")
84
+ # end
63
85
 
64
86
  unless File.exist?("#{Rails.root}/config/initializers/mokio.rb")
65
87
  puts "\n"
66
88
  result = Rails::Generators.invoke("mokio:install")
67
89
  puts "\n\tCreated initializer(configuration file) in #{result}".green
68
90
  end
91
+
92
+ if(ActiveRecord::Base.configurations[Rails.env]['adapter']) == "postgresql"
93
+ Rake::Task["mokio:reset_pg_sequence"].execute
94
+ end
95
+ Rake::Task["webpacker:install"].execute
96
+
69
97
  puts "\nMokio is ready to start! Run 'rails server' and go to localhost:3000/backend to see your application in development mode"
98
+
70
99
  end
71
100
 
72
101
 
@@ -83,7 +112,7 @@ namespace :mokio do
83
112
  end
84
113
 
85
114
  Mokio::Lang.import langs
86
-
115
+
87
116
  menus = build_menu(config['menus'], nil)
88
117
 
89
118
  menus.each do |me|
@@ -93,13 +122,12 @@ namespace :mokio do
93
122
 
94
123
  #recursively prepares Menu nodes based on given node list (menu_params)
95
124
 
96
- def build_menu(menu_params, ancestry)
125
+ def build_menu(menu_params, ancestry)
97
126
  menus = []
98
127
  menu_params.each do |m|
99
-
128
+
100
129
  m["ancestry"] = ancestry
101
130
  new_menu = Mokio::Menu.new(m.except("children"))
102
- new_menu.build_meta
103
131
  menus << new_menu
104
132
 
105
133
  unless m["children"].nil?