mokio 0.0.15 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/assets/javascripts/backend.js +6 -3
- data/app/assets/javascripts/backend/datatable.js.coffee.erb +28 -26
- data/app/assets/javascripts/backend/head.js +1 -0
- data/app/assets/javascripts/backend/main.js +69 -44
- data/app/assets/javascripts/backend/mokio_dynamic_fields.js +20 -0
- data/app/assets/javascripts/backend/vendors/select2/select2.min.js +2 -0
- data/app/assets/stylesheets/backend.scss +6 -2
- data/app/assets/stylesheets/backend/custom.scss +13 -1
- data/app/assets/stylesheets/backend/main.scss +74 -73
- data/app/assets/stylesheets/backend/plugins/forms/select2/select2.scss +4 -0
- data/app/assets/stylesheets/backend/plugins/tables/dataTables/{jquery.dataTables.scss → jquery.dataTables.css} +7 -7
- data/app/assets/stylesheets/backend/theme/main.scss +413 -0
- data/app/assets/stylesheets/backend/theme/nice-select/_nice-select-prefixed.scss +190 -0
- data/app/assets/stylesheets/backend/theme/nice-select/nice-select.scss +178 -0
- data/app/assets/stylesheets/backend/theme/nice-select/style.scss +20 -0
- data/app/assets/stylesheets/backend/vendors/select2/select2.min.css +1 -0
- data/app/datatables/commons_datatable.rb +56 -36
- data/app/helpers/mokio/backend/backend_helper.rb +27 -1
- data/app/helpers/mokio/backend/common_helper.rb +9 -4
- data/app/helpers/mokio/backend/dynamic_fields_helper.rb +91 -0
- data/app/models/devise_custom_failure.rb +9 -0
- data/app/models/mokio/article.rb +0 -1
- data/app/models/mokio/contact.rb +0 -1
- data/app/models/mokio/content.rb +0 -1
- data/app/models/mokio/menu.rb +0 -1
- data/app/models/mokio/mov_gallery.rb +0 -1
- data/app/models/mokio/pic_gallery.rb +0 -1
- data/app/models/mokio/seo_tag.rb +5 -0
- data/app/models/mokio/support.rb +0 -1
- data/app/uploaders/ckeditor_picture_uploader.rb +2 -2
- data/app/views/devise/sessions/new.html.haml +2 -1
- data/app/views/mokio/articles/_form.html.slim +6 -3
- data/app/views/mokio/common/_form_content.html.slim +4 -4
- data/app/views/mokio/common/edit.html.slim +1 -5
- data/app/views/mokio/common/index.html.slim +3 -0
- data/app/views/mokio/common/modals/_modal_seo_tags.html.slim +47 -0
- data/app/views/mokio/common/new.html.slim +1 -4
- data/app/views/mokio/contacts/_form.html.slim +9 -7
- data/app/views/mokio/contents/new.html.slim +1 -2
- data/app/views/mokio/data_files/_file_upload.html.erb +1 -6
- data/app/views/mokio/layout/sidebar.html.slim +6 -13
- data/app/views/mokio/menus/_form.html.slim +97 -0
- data/app/views/mokio/menus/{_form.html.haml → _old_form.html.haml} +5 -6
- data/app/views/mokio/menus/{_form_slim.html.slim → _old_form_slim.html.slim} +8 -10
- data/app/views/mokio/menus/new_menu_position.slim +1 -1
- data/app/views/mokio/mov_galleries/_form_inputs.html.slim +3 -3
- data/app/views/mokio/pic_galleries/_form_inputs.html.slim +3 -3
- data/app/views/mokio/static_modules/_form.html.slim +2 -1
- data/config/initializers/frontend.rb +3 -0
- data/config/initializers/simple_form.rb +9 -0
- data/config/locales/en.yml +16 -26
- data/config/locales/pl.yml +11 -20
- data/db/migrate/20140422135850_add_mokio_to_application.rb +22 -24
- data/db/migrate/20191217135611_create_mokio_seo_tags.rb +11 -0
- data/lib/mokio.rb +37 -10
- data/lib/mokio/concerns.rb +3 -13
- data/lib/mokio/concerns/common/controller_functions.rb +1 -15
- data/lib/mokio/concerns/common/controller_object.rb +2 -2
- data/lib/mokio/concerns/common/seo_tags.rb +32 -0
- data/lib/mokio/concerns/common/services/sitemap_service.rb +196 -0
- data/lib/mokio/concerns/controllers/application.rb +5 -5
- data/lib/mokio/concerns/controllers/base.rb +12 -12
- data/lib/mokio/concerns/controllers/common.rb +6 -4
- data/lib/mokio/concerns/controllers/data_files.rb +3 -3
- data/lib/mokio/concerns/controllers/menus.rb +11 -13
- data/lib/mokio/concerns/controllers/mov_galleries.rb +1 -2
- data/lib/mokio/concerns/controllers/photos.rb +10 -10
- data/lib/mokio/concerns/controllers/pic_galleries.rb +2 -3
- data/lib/mokio/concerns/controllers/users.rb +4 -3
- data/lib/mokio/concerns/controllers/youtubes.rb +7 -7
- data/lib/mokio/concerns/models/available_module.rb +3 -3
- data/lib/mokio/concerns/models/common.rb +1 -29
- data/lib/mokio/concerns/models/contact_template.rb +0 -4
- data/lib/mokio/concerns/models/content.rb +15 -7
- data/lib/mokio/concerns/models/data_file.rb +3 -9
- data/lib/mokio/concerns/models/lang.rb +11 -7
- data/lib/mokio/concerns/models/menu.rb +4 -4
- data/lib/mokio/concerns/models/module_position.rb +1 -1
- data/lib/mokio/concerns/models/recipient.rb +0 -2
- data/lib/mokio/concerns/models/seo_tag.rb +118 -0
- data/lib/mokio/concerns/models/static_module.rb +2 -2
- data/lib/mokio/concerns/models/user.rb +1 -1
- data/lib/mokio/engine.rb +7 -17
- data/lib/mokio/frontend_helpers.rb +1 -0
- data/lib/mokio/frontend_helpers/seo_tag_helper.rb +33 -0
- data/lib/mokio/simple-form-wrappers.rb +11 -0
- data/lib/mokio/version.rb +1 -1
- data/lib/tasks/mokio_install.rake +37 -9
- data/spec/dummy/Rakefile +1 -3
- data/spec/dummy/app/controllers/application_controller.rb +1 -1
- data/spec/dummy/config.ru +1 -2
- data/spec/dummy/config/application.rb +9 -12
- data/spec/dummy/config/database.yml +18 -0
- data/spec/dummy/config/environment.rb +1 -1
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/development_mokio.log +9 -0
- data/spec/models/content_spec.rb +0 -1
- data/spec/models/menu_spec.rb +8 -9
- data/spec/models/mov_gallery_spec.rb +0 -1
- data/spec/models/pic_gallery_spec.rb +0 -1
- metadata +212 -407
- data/README.rdoc +0 -47
- data/app/assets/javascripts/backend/plugins/forms/select/select2.js +0 -2195
- data/app/assets/javascripts/backend/plugins/forms/select/select2.min.js +0 -76
- data/app/assets/javascripts/backend/plugins/tables/dataTables/jquery.dataTables.js +0 -12099
- data/app/assets/javascripts/backend/plugins/tables/dataTables/jquery.dataTables.min.js +0 -155
- data/app/controllers/mokio/base_articles_controller.rb +0 -3
- data/app/controllers/mokio/base_contacts_controller.rb +0 -5
- data/app/controllers/mokio/base_contents_controller.rb +0 -3
- data/app/controllers/mokio/base_mov_galleries_controller.rb +0 -3
- data/app/controllers/mokio/base_pic_galleries_controller.rb +0 -4
- data/app/controllers/passwords_controller.rb +0 -14
- data/app/models/mokio/base_article.rb +0 -29
- data/app/models/mokio/base_contact.rb +0 -30
- data/app/models/mokio/base_content.rb +0 -5
- data/app/models/mokio/base_mov_gallery.rb +0 -30
- data/app/models/mokio/base_pic_gallery.rb +0 -30
- data/app/models/mokio/meta.rb +0 -24
- data/app/views/mokio/backend/articles/_form.html.haml +0 -9
- data/app/views/mokio/backend/common/_form_content.html.haml +0 -36
- data/app/views/mokio/backend/common/_gmap.html.haml +0 -39
- data/app/views/mokio/backend/common/_main_pic.html.haml +0 -4
- data/app/views/mokio/backend/common/_meta.html.haml +0 -51
- data/app/views/mokio/backend/common/_notice.html.haml +0 -3
- data/app/views/mokio/backend/common/_obj.html.haml +0 -16
- data/app/views/mokio/backend/common/copy.html.haml +0 -5
- data/app/views/mokio/backend/common/edit.html.haml +0 -6
- data/app/views/mokio/backend/common/index.html.haml +0 -19
- data/app/views/mokio/backend/common/new.html.haml +0 -6
- data/app/views/mokio/backend/contacts/_form.html.haml +0 -42
- data/app/views/mokio/backend/contents/_content_info_widget.html.haml +0 -22
- data/app/views/mokio/backend/dashboard/_content.html.haml +0 -9
- data/app/views/mokio/backend/dashboard/show.html.haml +0 -35
- data/app/views/mokio/backend/dashboard/tbl_content.html.haml +0 -24
- data/app/views/mokio/backend/data_files/_file_upload.html.erb +0 -71
- data/app/views/mokio/backend/data_files/uploader.html.haml +0 -15
- data/app/views/mokio/backend/errors/404.html.haml +0 -45
- data/app/views/mokio/backend/errors/unauthorized.html.haml +0 -11
- data/app/views/mokio/backend/layout/_user_widget.html.haml +0 -8
- data/app/views/mokio/backend/layout/header.html.haml +0 -14
- data/app/views/mokio/backend/layout/sidebar.html.haml +0 -59
- data/app/views/mokio/backend/menus/_form.html.haml +0 -66
- data/app/views/mokio/backend/menus/_menu.html.haml +0 -24
- data/app/views/mokio/backend/menus/index.html.haml +0 -53
- data/app/views/mokio/backend/menus/index.json.jbuilder +0 -4
- data/app/views/mokio/backend/menus/lang_changed.js.haml +0 -6
- data/app/views/mokio/backend/menus/sort.html.haml +0 -1
- data/app/views/mokio/backend/menus/update_menu_breadcrumps.js.haml +0 -1
- data/app/views/mokio/backend/mov_galleries/_form.html.haml +0 -17
- data/app/views/mokio/backend/mov_galleries/_form_inputs.html.haml +0 -8
- data/app/views/mokio/backend/photos/_gallery.html.haml +0 -25
- data/app/views/mokio/backend/photos/create.js.haml +0 -1
- data/app/views/mokio/backend/photos/crop_photo.js.haml +0 -10
- data/app/views/mokio/backend/photos/crop_thumb.js.haml +0 -11
- data/app/views/mokio/backend/photos/destroy.js.haml +0 -1
- data/app/views/mokio/backend/photos/from_external_link.html.haml +0 -19
- data/app/views/mokio/backend/photos/get_photo.js.haml +0 -1
- data/app/views/mokio/backend/photos/get_thumb.js.haml +0 -1
- data/app/views/mokio/backend/photos/photo.html.haml +0 -54
- data/app/views/mokio/backend/photos/remove_thumb.js.haml +0 -10
- data/app/views/mokio/backend/photos/rotate_photo.js.haml +0 -10
- data/app/views/mokio/backend/photos/rotate_thumb.js.haml +0 -11
- data/app/views/mokio/backend/photos/thumb.html.haml +0 -9
- data/app/views/mokio/backend/photos/update_thumb.js.haml +0 -11
- data/app/views/mokio/backend/photos/upload_external_links.js.haml +0 -4
- data/app/views/mokio/backend/pic_galleries/_form.html.haml +0 -16
- data/app/views/mokio/backend/pic_galleries/_form_inputs.html.haml +0 -9
- data/app/views/mokio/backend/site_helper/first_login.html.haml +0 -14
- data/app/views/mokio/backend/static_modules/_form.html.haml +0 -9
- data/app/views/mokio/backend/users/_form.html.haml +0 -11
- data/app/views/mokio/backend/users/edit_password.html.haml +0 -13
- data/app/views/mokio/backend/youtubes/_edit.html.haml +0 -49
- data/app/views/mokio/backend/youtubes/_gallery.html.haml +0 -24
- data/app/views/mokio/backend/youtubes/_new.html.haml +0 -4
- data/app/views/mokio/backend/youtubes/_preview_movie.html.haml +0 -1
- data/app/views/mokio/backend/youtubes/_search_yt.html.haml +0 -8
- data/app/views/mokio/backend/youtubes/_search_yt_body.html.haml +0 -11
- data/app/views/mokio/backend/youtubes/find.js.haml +0 -1
- data/app/views/mokio/backend/youtubes/preview.html.haml +0 -36
- data/app/views/mokio/backend/youtubes/preview_movie.js.haml +0 -5
- data/app/views/mokio/backend/youtubes/thumb.html.haml +0 -14
- data/app/views/mokio/backend/youtubes/uploader.html.haml +0 -10
- data/app/views/mokio/backend/youtubes/youtube.html.haml +0 -12
- data/app/views/mokio/base_articles/_multi_lang_form.html.slim +0 -18
- data/app/views/mokio/base_contacts/_multi_lang_form.html.slim +0 -48
- data/app/views/mokio/base_contents/update_content_form.js.slim +0 -1
- data/app/views/mokio/base_pic_galleries/_multi_lang_form.html.slim +0 -13
- data/app/views/mokio/common/_meta.html.slim +0 -50
- data/app/views/mokio/common/_multi_lang_gmap.html.slim +0 -41
- data/app/views/mokio/common/_multi_lang_meta.html.slim +0 -50
- data/app/views/mokio/common/multi_lang_form_content.html.slim +0 -56
- data/db/migrate/20140731061227_create_mokio_external_scripts.rb +0 -12
- data/db/migrate/20141009125027_alter_external_scripts.rb +0 -13
- data/db/migrate/20141024131942_migrate_external_codes_to_external_scripts.rb +0 -25
- data/db/migrate/20141209072051_change_data_type_for_display_dates.rb +0 -8
- data/db/migrate/20141209101853_add_menu_css_options.rb +0 -6
- data/db/migrate/20150220071158_add_subtitle_to_contents.rb +0 -7
- data/db/migrate/20150220091326_add_main_pic_to_mokio_menu.rb +0 -5
- data/db/migrate/20150408074951_create_mokio_base_contents.rb +0 -17
- data/db/migrate/20150408075454_add_base_content_id_to_mokio_contents.mokio.rb +0 -6
- data/db/migrate/20150414054139_add_name_to_mokio_users.rb +0 -6
- data/db/migrate/20150414070406_add_author_and_editor_to_mokio_content.rb +0 -6
- data/db/migrate/20150528104851_add_base_content_id_to_mokio_data_files.rb +0 -5
- data/lib/mokio/concerns/controllers/base_articles.rb +0 -31
- data/lib/mokio/concerns/controllers/base_contacts.rb +0 -32
- data/lib/mokio/concerns/controllers/base_contents.rb +0 -167
- data/lib/mokio/concerns/controllers/base_mov_galleries.rb +0 -48
- data/lib/mokio/concerns/controllers/base_pic_galleries.rb +0 -32
- data/lib/mokio/concerns/models/base_article.rb +0 -21
- data/lib/mokio/concerns/models/base_contact.rb +0 -36
- data/lib/mokio/concerns/models/base_content.rb +0 -51
- data/lib/mokio/concerns/models/base_mov_gallery.rb +0 -19
- data/lib/mokio/concerns/models/base_pic_gallery.rb +0 -22
- data/lib/mokio/concerns/models/meta.rb +0 -39
- data/spec/factories/meta.rb +0 -37
- data/spec/models/meta_spec.rb +0 -26
@@ -1,56 +0,0 @@
|
|
1
|
-
.content
|
2
|
-
= common_form do
|
3
|
-
.row-fluid
|
4
|
-
= simple_form_for obj, :html => { :class => 'form-horizontal' } do |g|
|
5
|
-
= g.input :main_pic
|
6
|
-
= g.input :title, disabled: !obj.display_editable_field?('title')
|
7
|
-
= g.input :display_from, :wrapper => :date, :as => :string, :input_html => { :class => "mask-date display_from", :value => (localize(g.object.display_from, :format => :datepicker) if g.object.display_from) }, disabled: !obj.display_editable_field?('display_from')
|
8
|
-
= g.input :display_to, :wrapper => :date, :as => :string, :input_html => { :class => "mask-date display_to", :value => (localize(g.object.display_to, :format => :datepicker) if g.object.display_to) }, disabled: !obj.display_editable_field?('display_to')
|
9
|
-
= g.input :active, :wrapper => :active_checkbox, disabled: !obj.display_editable_field?('active')
|
10
|
-
= g.input :home_page, :wrapper => :active_checkbox, disabled: !obj.display_editable_field?('home_page')
|
11
|
-
|
12
|
-
ul#langContentTab.nav.nav-tabs
|
13
|
-
-@contents.each_with_index do |content,i|
|
14
|
-
li class=(i == 0 ? "in active":" ") id="nav_lang_#{content.lang_id}"
|
15
|
-
a href="#lang_#{content.lang_id}"
|
16
|
-
=content.lang.name.html_safe
|
17
|
-
i.icon12
|
18
|
-
.tab-content
|
19
|
-
hr
|
20
|
-
-@contents.each_with_index do |content,i|
|
21
|
-
.tab-pane.fade id="lang_#{content.lang_id}" class=(i == 0 ? "in active":" ")
|
22
|
-
= g.simple_fields_for :contents,content do |lf|
|
23
|
-
= render :partial => "mokio/common/multi_lang_gmap", locals: {obj: content, f: lf} if obj.class.has_gmap_enabled?
|
24
|
-
= render :partial => "mokio/common/multi_lang_meta", locals: {obj: content, f: lf} if content.class.has_meta_enabled?
|
25
|
-
= lf.input :form_active, :label => I18n.t('backend.form_active'), :as => :boolean, :input_html => { :checked => (true if content.title.present? ) ,:contentForm => "content_form_#{content.lang_id}"}
|
26
|
-
/-if content.base_content_id.nil?
|
27
|
-
/ .row-fluid
|
28
|
-
/ label.form-label.span2
|
29
|
-
/ = t('menus.content_assoc')
|
30
|
-
/ .span10
|
31
|
-
/ = lf.collection_select(:base_content_id, @contents_select.where('lang_id = ? OR lang_id IS NULL',content.lang_id), :id, :title ,:include_blank => true)
|
32
|
-
|
33
|
-
.content_form id="content_form_#{content.lang_id}"
|
34
|
-
= render :partial => "#{ obj.class.to_s.tableize}/multi_lang_form", :locals => {f: g, obj: content,lf:lf}
|
35
|
-
|
36
|
-
- cache [:form_buttons, obj] do
|
37
|
-
.form-actions
|
38
|
-
= btn_submit bt("save")
|
39
|
-
= btn_submit bt("save_and_create_new"), true
|
40
|
-
= btn_cancel "#{engine_root}#{obj.class.to_s.tableize.gsub("mokio/", "")}"
|
41
|
-
- if has_data_files?(obj) && params[:action] == "edit" && obj.default_data_file != Mokio::Youtube
|
42
|
-
= render :template => "mokio/data_files/uploader" , locals: {obj: obj, f: g}
|
43
|
-
- if has_data_files?(obj) && obj.default_data_file == Mokio::Youtube && params[:action] == "edit"
|
44
|
-
= render :template => "mokio/youtubes/uploader" , locals: {obj: obj, f: g}
|
45
|
-
- if has_data_files?(obj) && params[:action] == "edit"
|
46
|
-
= render :partial => "#{obj.default_data_file.to_s.tableize}/gallery", :locals => {videos: @videos}
|
47
|
-
|
48
|
-
= render :partial => "mokio/common/datepicker_settings"
|
49
|
-
-content_for :js do
|
50
|
-
= javascript_include_tag 'backend/forms'
|
51
|
-
|
52
|
-
- if has_data_files?(obj) && params[:action] == "edit"
|
53
|
-
= javascript_include_tag "backend/galleries"
|
54
|
-
|
55
|
-
- if params[:action] == "new" && has_data_files?(obj)
|
56
|
-
= flash_message(bt("cannot_add_files_now", @obj_class))
|
@@ -1,12 +0,0 @@
|
|
1
|
-
class CreateMokioExternalScripts < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
if !ActiveRecord::Base.connection.table_exists? :mokio_external_scripts
|
4
|
-
create_table :mokio_external_scripts do |t|
|
5
|
-
t.text "code"
|
6
|
-
t.string "script"
|
7
|
-
t.boolean "editable",default: true
|
8
|
-
t.boolean "deletable",default: true
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class AlterExternalScripts < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
if ActiveRecord::Base.connection.table_exists? :mokio_external_scripts
|
4
|
-
change_table :mokio_external_scripts do |t|
|
5
|
-
t.change :code, :string
|
6
|
-
t.change :script, :text
|
7
|
-
end
|
8
|
-
change_table :mokio_external_scripts do |t|
|
9
|
-
t.rename :code, :name
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
class MigrateExternalCodesToExternalScripts < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
if ActiveRecord::Base.connection.table_exists? :mokio_external_codes
|
4
|
-
if ActiveRecord::Base.connection.table_exists? :mokio_external_scripts
|
5
|
-
ActiveRecord::Base.transaction do
|
6
|
-
|
7
|
-
begin
|
8
|
-
|
9
|
-
query = "INSERT INTO mokio_external_scripts (name,script) SELECT name,code FROM mokio_external_codes"
|
10
|
-
ActiveRecord::Base.connection.execute(query)
|
11
|
-
|
12
|
-
query = "DROP TABLE mokio_external_codes"
|
13
|
-
ActiveRecord::Base.connection.execute(query)
|
14
|
-
|
15
|
-
rescue Exception => exc
|
16
|
-
@_errors = true
|
17
|
-
puts ("Something went wrong (mokio_external_codes to mokio_external_scripts - migration ) : #{exc.message}")
|
18
|
-
end
|
19
|
-
|
20
|
-
raise ActiveRecord::Rollback if @_errors
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
class AddSubtitleToContents < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
add_column :mokio_contents, :subtitle, :text, :after => :title
|
4
|
-
add_column :mokio_menus, :subtitle, :text, :after => :name
|
5
|
-
add_column :mokio_static_modules, :subtitle, :text, :after => :title
|
6
|
-
end
|
7
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
class CreateMokioBaseContents < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table :mokio_base_contents do |t|
|
4
|
-
t.string "title"
|
5
|
-
t.string "type"
|
6
|
-
t.boolean "home_page"
|
7
|
-
t.boolean "active", default: true
|
8
|
-
t.boolean "editable", default: true
|
9
|
-
t.boolean "deletable", default: true
|
10
|
-
t.date "display_from"
|
11
|
-
t.date "display_to"
|
12
|
-
t.string "main_pic"
|
13
|
-
t.string "etag"
|
14
|
-
t.timestamps
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module Mokio
|
2
|
-
module Concerns #:nodoc:
|
3
|
-
module Controllers #:nodoc:
|
4
|
-
#
|
5
|
-
# Concern for ArticlesController
|
6
|
-
#
|
7
|
-
module BaseArticles
|
8
|
-
extend ActiveSupport::Concern
|
9
|
-
|
10
|
-
included do
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
def set_breadcrumbs_prefix
|
15
|
-
@breadcrumbs_prefix = "content_management"
|
16
|
-
@breadcrumbs_prefix_link = "contents"
|
17
|
-
end
|
18
|
-
|
19
|
-
|
20
|
-
private
|
21
|
-
#
|
22
|
-
# Never trust parameters from the scary internet, only allow the white list through.
|
23
|
-
#
|
24
|
-
|
25
|
-
def base_article_params #:doc:
|
26
|
-
params.require(:base_article).permit(base_attributes,:contents_attributes => content_attributes)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module Mokio
|
2
|
-
module Concerns
|
3
|
-
module Controllers
|
4
|
-
#
|
5
|
-
# Concern for ContactsController
|
6
|
-
#
|
7
|
-
module BaseContacts
|
8
|
-
extend ActiveSupport::Concern
|
9
|
-
|
10
|
-
included do
|
11
|
-
end
|
12
|
-
|
13
|
-
#
|
14
|
-
# Extended CommonController new (Mokio::Concerns::Controllers::Common)
|
15
|
-
#
|
16
|
-
|
17
|
-
def set_breadcrumbs_prefix
|
18
|
-
@breadcrumbs_prefix = "content_management"
|
19
|
-
@breadcrumbs_prefix_link = "contents"
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
#
|
24
|
-
# Never trust parameters from the scary internet, only allow the white list through.
|
25
|
-
#
|
26
|
-
def base_contact_params #:doc:
|
27
|
-
params.require(:base_contact).permit(base_attributes,:contents_attributes => content_attributes, :contact_template_attributes => Mokio::ContactTemplate.contact_template_attributes)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,167 +0,0 @@
|
|
1
|
-
module Mokio
|
2
|
-
module Concerns
|
3
|
-
module Controllers
|
4
|
-
#
|
5
|
-
# Concern for ContentsController
|
6
|
-
#
|
7
|
-
module BaseContents
|
8
|
-
extend ActiveSupport::Concern
|
9
|
-
include Mokio::Concerns::Common::Translations
|
10
|
-
included do
|
11
|
-
end
|
12
|
-
|
13
|
-
def new
|
14
|
-
|
15
|
-
@contents = []
|
16
|
-
Mokio::Lang.all.each {|lang| @contents << content_model.new(:lang_id => lang.id)}
|
17
|
-
build_base_enabled
|
18
|
-
@contents_select = build_contents
|
19
|
-
|
20
|
-
# @contents.each {|content| @contents << content.build_contact_template}
|
21
|
-
end
|
22
|
-
|
23
|
-
def edit
|
24
|
-
|
25
|
-
|
26
|
-
@contents = []
|
27
|
-
obj.contents.each {|content| @contents << content}
|
28
|
-
create_form_obj(obj,@contents)
|
29
|
-
@contents.each {|content| content.build_gmap if content.class.has_gmap_enabled? && content.gmap.nil?}
|
30
|
-
@contents_select = build_contents
|
31
|
-
build_base_enabled
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
def create
|
36
|
-
|
37
|
-
create_obj( @obj_class.new(create_base_params))
|
38
|
-
params[obj_name][:contents_attributes].each do |key,value|
|
39
|
-
if value[:form_active] == '1'
|
40
|
-
obj.contents << content_model.new(value)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
respond_to do |format|
|
45
|
-
if obj.save
|
46
|
-
if !params[:save_and_new].blank?
|
47
|
-
format.html { redirect_to obj_new_url(@obj_class.new), notice: CommonTranslation.created(obj) }
|
48
|
-
format.json { render action: 'new', status: :created, location: obj }
|
49
|
-
else
|
50
|
-
format.html { redirect_to obj_index_url, notice: CommonTranslation.created(obj) }
|
51
|
-
format.json { render action: 'index', status: :created, location: obj }
|
52
|
-
end
|
53
|
-
else
|
54
|
-
@contents = []
|
55
|
-
obj.contents.each {|content| @contents << content}
|
56
|
-
create_form_obj(obj,@contents)
|
57
|
-
|
58
|
-
format.html { render "new", notice: CommonTranslation.not_created(obj) }
|
59
|
-
format.json { render json: @obj.errors, status: :unprocessable_entity }
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def update
|
65
|
-
|
66
|
-
contents_params = obj_params
|
67
|
-
contents_params[:contents_attributes] = {}
|
68
|
-
|
69
|
-
params[obj_name][:contents_attributes].each do |key,value|
|
70
|
-
if value[:form_active] == '1'
|
71
|
-
contents_params[:contents_attributes][key.to_i] = value
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
respond_to do |format|
|
76
|
-
|
77
|
-
if obj.update(contents_params)
|
78
|
-
if !params[:save_and_new].blank?
|
79
|
-
format.html { redirect_to obj_new_url(@obj_class.new), notice: CommonTranslation.updated(obj) }
|
80
|
-
format.json { head :no_content }
|
81
|
-
else
|
82
|
-
format.html { redirect_to obj_index_url, notice: CommonTranslation.updated(obj) }
|
83
|
-
format.json { render action: 'index', status: :created, location: obj }
|
84
|
-
end
|
85
|
-
else
|
86
|
-
@contents = []
|
87
|
-
obj.contents.each {|content| @contents << content}
|
88
|
-
create_form_obj(obj,@contents)
|
89
|
-
|
90
|
-
format.html { render "edit", notice: CommonTranslation.not_updated(obj) }
|
91
|
-
format.json { render json: @obj.errors, status: :unprocessable_entity }
|
92
|
-
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
|
98
|
-
def base_attributes
|
99
|
-
[:id,:title,:main_pic,:display_from,:display_to,:home_page,:active]
|
100
|
-
end
|
101
|
-
|
102
|
-
def content_attributes
|
103
|
-
[extended_parameters,:id,:title, :subtitle, :intro, :content, :article_type, :home_page, :tpl, :contact, :active, :seq, :lang_id,:gallery_type, :display_from, :display_to, :main_pic, :tag_list,:menu_ids => [], :data_files_attributes => [:data_file, :main_pic, :id, :remove_data_file]]
|
104
|
-
end
|
105
|
-
|
106
|
-
# update content form
|
107
|
-
def update_content_form
|
108
|
-
@contents = []
|
109
|
-
@contents << Mokio::Content.find_by_base_content_id(params[:base_content_id])
|
110
|
-
|
111
|
-
if params[:base_id].present?
|
112
|
-
obj = Mokio::BaseContent.find(params[:base_id])
|
113
|
-
obj.contents.each {|content| @contents << content}
|
114
|
-
end
|
115
|
-
|
116
|
-
Mokio::Lang.all.each {|lang| @contents << content_model.new(:lang_id => lang.id) if @contents.collect{|content| content.lang_id }.exclude?(lang.id)}
|
117
|
-
|
118
|
-
@contents.each {|content| content.build_gmap if content.class.has_gmap_enabled? && content.gmap.nil?}
|
119
|
-
@contents_select = build_contents
|
120
|
-
@content = render_to_string "mokio/backend/common/multi_lang_form_content" , :layout => false
|
121
|
-
@lang = params[:lang_id]
|
122
|
-
end
|
123
|
-
|
124
|
-
|
125
|
-
private
|
126
|
-
#
|
127
|
-
# Never trust parameters from the scary internet, only allow the white list through.
|
128
|
-
#
|
129
|
-
|
130
|
-
def base_content_params #:doc:
|
131
|
-
params.require(:base_content).permit(base_attributes)
|
132
|
-
end
|
133
|
-
|
134
|
-
def create_base_params
|
135
|
-
base_object_params = obj_params
|
136
|
-
base_object_params.delete(:contents_attributes)
|
137
|
-
base_object_params.delete(:meta_attributes)
|
138
|
-
base_object_params
|
139
|
-
end
|
140
|
-
|
141
|
-
# create Mokio::Contents model for self class /article,contact,galleries
|
142
|
-
def content_model
|
143
|
-
name= "Mokio::#{self.controller_name.gsub('base_','').singularize.classify}".constantize
|
144
|
-
name
|
145
|
-
end
|
146
|
-
|
147
|
-
# build meta and gmap for many contents
|
148
|
-
def build_base_enabled
|
149
|
-
@contents.each {|content| content.build_gmap if content.class.has_gmap_enabled? && content.gmap.nil?}
|
150
|
-
@contents.each { |content| content.build_meta if content.class.has_meta_enabled? && content.meta.nil?}
|
151
|
-
end
|
152
|
-
# build contents collection for select
|
153
|
-
|
154
|
-
def build_contents
|
155
|
-
Mokio::Content.all.where("base_content_id is NULL")
|
156
|
-
end
|
157
|
-
|
158
|
-
def create_form_obj(obj,arr)
|
159
|
-
|
160
|
-
Mokio::Lang.all.each {|lang| arr << content_model.new(:lang_id => lang.id) if obj.contents.collect{|content| content.lang_id }.exclude?(lang.id)}
|
161
|
-
arr
|
162
|
-
end
|
163
|
-
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module Mokio
|
2
|
-
module Concerns
|
3
|
-
module Controllers
|
4
|
-
#
|
5
|
-
# Concern for MovGalleriesController
|
6
|
-
#
|
7
|
-
module BaseMovGalleries
|
8
|
-
extend ActiveSupport::Concern
|
9
|
-
|
10
|
-
included do
|
11
|
-
end
|
12
|
-
|
13
|
-
#
|
14
|
-
# Overriten create from CommonController#create (Mokio::Concerns::Controllers::Common)
|
15
|
-
#
|
16
|
-
def create
|
17
|
-
@mov_gallery = Mokio::MovGallery.new(mov_gallery_params)
|
18
|
-
|
19
|
-
respond_to do |format|
|
20
|
-
if @mov_gallery.save
|
21
|
-
if !params[:save_and_new].blank?
|
22
|
-
format.html { redirect_to new_mov_gallery_path, notice: t("mov_galleries.created_and_new", title: @mov_gallery.title) }
|
23
|
-
else
|
24
|
-
format.html { redirect_to edit_content_path(@mov_gallery), notice: t("mov_galleries.created", title: @mov_gallery.title) }
|
25
|
-
end
|
26
|
-
else
|
27
|
-
format.html { render "new", notice: t("mov_galleries.not_created", title: @mov_gallery) }
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def set_breadcrumbs_prefix
|
33
|
-
@breadcrumbs_prefix = "content_management"
|
34
|
-
@breadcrumbs_prefix_link = "contents"
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
#
|
39
|
-
# Never trust parameters from the scary internet, only allow the white list through.
|
40
|
-
#
|
41
|
-
def base_mov_gallery_params #:doc:
|
42
|
-
params.require(:base_mov_gallery).permit(:title, :subtitle, :type, :active, :home_page ,:intro, :content, :display_from, :display_to, :lang_id, :main_pic, :tag_list, :menu_ids => [], :data_file => [],
|
43
|
-
:meta_attributes => Mokio::Meta.meta_attributes)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|