mokio 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/backend.css.scss +3 -1
- data/app/assets/stylesheets/backend/custom.css.scss +45 -30
- data/app/assets/stylesheets/backend/menu.css.scss +7 -0
- data/app/controllers/mokio/base_articles_controller.rb +3 -0
- data/app/controllers/mokio/base_contacts_controller.rb +5 -0
- data/app/controllers/mokio/base_contents_controller.rb +3 -0
- data/app/controllers/mokio/base_mov_galleries_controller.rb +3 -0
- data/app/controllers/mokio/base_pic_galleries_controller.rb +4 -0
- data/app/controllers/mokio/support_controller.rb +11 -0
- data/app/controllers/passwords_controller.rb +6 -0
- data/app/models/mokio/base_article.rb +29 -0
- data/app/models/mokio/base_contact.rb +30 -0
- data/app/models/mokio/base_content.rb +5 -0
- data/app/models/mokio/base_mov_gallery.rb +30 -0
- data/app/models/mokio/base_pic_gallery.rb +30 -0
- data/app/models/mokio/support.rb +29 -0
- data/app/uploaders/ckeditor_attachment_file_uploader.rb +1 -1
- data/app/views/devise/sessions/new.html.haml +0 -1
- data/app/views/mokio/articles/_form.html.slim +3 -2
- data/app/views/mokio/base_articles/_multi_lang_form.html.slim +18 -0
- data/app/views/mokio/base_contacts/_multi_lang_form.html.slim +48 -0
- data/app/views/mokio/base_contents/update_content_form.js.slim +1 -0
- data/app/views/mokio/base_pic_galleries/_multi_lang_form.html.slim +13 -0
- data/app/views/mokio/common/_main_pic.html.slim +3 -1
- data/app/views/mokio/common/_multi_lang_gmap.html.slim +41 -0
- data/app/views/mokio/common/_multi_lang_meta.html.slim +50 -0
- data/app/views/mokio/common/edit.html.slim +5 -1
- data/app/views/mokio/common/multi_lang_form_content.html.slim +56 -0
- data/app/views/mokio/common/new.html.slim +4 -1
- data/app/views/mokio/contacts/_form.html.slim +2 -1
- data/app/views/mokio/contents/_common.slim +2 -0
- data/app/views/mokio/contents/delete_main_pic.js.slim +1 -0
- data/app/views/mokio/contents/new.html.slim +50 -0
- data/app/views/mokio/data_files/_file_upload.html.erb +8 -1
- data/app/views/mokio/layout/_user_widget.html.slim +4 -0
- data/app/views/mokio/layout/sidebar.html.slim +19 -9
- data/app/views/mokio/layout/sidebar_support.html.slim +4 -0
- data/app/views/mokio/menus/_form.html.haml +13 -5
- data/app/views/mokio/menus/_menu.html.slim +1 -1
- data/app/views/mokio/mov_galleries/_form_inputs.html.slim +5 -4
- data/app/views/mokio/pic_galleries/_form.html.slim +1 -1
- data/app/views/mokio/pic_galleries/_form_inputs.html.slim +5 -5
- data/app/views/mokio/support/index.html.slim +23 -0
- data/app/views/mokio/users/_form.html.slim +2 -0
- data/app/views/mokio/youtubes/_gallery.html.slim +9 -10
- data/app/views/mokio/youtubes/_search_yt.html.slim +8 -9
- data/config/locales/en.yml +24 -0
- data/config/locales/pl.yml +48 -1
- data/config/routes.rb +63 -2
- data/config/views.yml +4 -0
- data/db/migrate/20150408074951_create_mokio_base_contents.rb +17 -0
- data/db/migrate/20150408075454_add_base_content_id_to_mokio_contents.mokio.rb +6 -0
- data/db/migrate/20150414054139_add_name_to_mokio_users.rb +6 -0
- data/db/migrate/20150414070406_add_author_and_editor_to_mokio_content.rb +6 -0
- data/db/migrate/20150528104851_add_base_content_id_to_mokio_data_files.rb +5 -0
- data/lib/generators/mokio/btr_generator.rb +11 -0
- data/lib/generators/mokio/contents_generator.rb +58 -0
- data/lib/generators/mokio/templates/contents/_form.html.slim +15 -0
- data/lib/generators/mokio/templates/contents/_sidebar_btn.html.slim +1 -0
- data/lib/generators/mokio/templates/contents/controller.rb +23 -0
- data/lib/generators/mokio/templates/contents/model.rb +24 -0
- data/lib/generators/mokio/templates/contents/views_template.yml +6 -0
- data/lib/generators/mokio/templates/mokio.rb +32 -0
- data/lib/generators/mokio/templates/translations/backend_example.yml +57 -0
- data/lib/mokio.rb +13 -2
- data/lib/mokio/concerns.rb +15 -1
- data/lib/mokio/concerns/common/controller_functions.rb +19 -1
- data/lib/mokio/concerns/common/controller_object.rb +2 -2
- data/lib/mokio/concerns/controllers/application.rb +32 -3
- data/lib/mokio/concerns/controllers/articles.rb +39 -3
- data/lib/mokio/concerns/controllers/base.rb +1 -0
- data/lib/mokio/concerns/controllers/base_articles.rb +31 -0
- data/lib/mokio/concerns/controllers/base_contacts.rb +32 -0
- data/lib/mokio/concerns/controllers/base_contents.rb +167 -0
- data/lib/mokio/concerns/controllers/base_mov_galleries.rb +48 -0
- data/lib/mokio/concerns/controllers/base_pic_galleries.rb +32 -0
- data/lib/mokio/concerns/controllers/common.rb +7 -8
- data/lib/mokio/concerns/controllers/contacts.rb +39 -1
- data/lib/mokio/concerns/controllers/contents.rb +1 -0
- data/lib/mokio/concerns/controllers/main_pics.rb +32 -0
- data/lib/mokio/concerns/controllers/menus.rb +3 -2
- data/lib/mokio/concerns/controllers/mov_galleries.rb +19 -3
- data/lib/mokio/concerns/controllers/photos.rb +1 -1
- data/lib/mokio/concerns/controllers/pic_galleries.rb +18 -3
- data/lib/mokio/concerns/models/article.rb +1 -0
- data/lib/mokio/concerns/models/base_article.rb +21 -0
- data/lib/mokio/concerns/models/base_contact.rb +36 -0
- data/lib/mokio/concerns/models/base_content.rb +51 -0
- data/lib/mokio/concerns/models/base_mov_gallery.rb +19 -0
- data/lib/mokio/concerns/models/base_pic_gallery.rb +22 -0
- data/lib/mokio/concerns/models/common.rb +1 -1
- data/lib/mokio/concerns/models/contact_template.rb +4 -0
- data/lib/mokio/concerns/models/content.rb +12 -0
- data/lib/mokio/concerns/models/data_file.rb +9 -3
- data/lib/mokio/concerns/models/lang.rb +1 -1
- data/lib/mokio/concerns/models/recipient.rb +2 -0
- data/lib/mokio/concerns/models/user.rb +5 -1
- data/lib/mokio/frontend_helpers/menu_helper.rb +17 -8
- data/lib/mokio/version.rb +1 -1
- data/spec/dummy/config/routes.rb +2 -0
- metadata +55 -11
- data/app/views/devise/passwords/edit.html.erb +0 -19
- data/app/views/devise/passwords/new.html.erb +0 -15
- data/app/views/mokio/menus/sort.html.slim +0 -1
- data/spec/dummy/config/views.yml +0 -11
@@ -8,12 +8,50 @@ module Mokio
|
|
8
8
|
extend ActiveSupport::Concern
|
9
9
|
|
10
10
|
included do
|
11
|
+
|
12
|
+
before_action :init_obj, :set_author, :only =>[:create]
|
13
|
+
before_action :set_editor, :only => [:create, :update]
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# Overriten create from CommonController#create (Mokio::Concerns::Controllers::Common)
|
19
|
+
#
|
20
|
+
def create
|
21
|
+
respond_to do |format|
|
22
|
+
if obj.save
|
23
|
+
if !params[:save_and_new].blank?
|
24
|
+
format.html { redirect_to obj_new_url(@obj_class.new), notice: Mokio::Concerns::Common::Translations::CommonTranslation.created(obj) }
|
25
|
+
format.json { render action: 'new', status: :created, location: obj }
|
26
|
+
else
|
27
|
+
format.html { redirect_to obj_index_url, notice: Mokio::Concerns::Common::Translations::CommonTranslation.created(obj) }
|
28
|
+
format.json { render action: 'index', status: :created, location: obj }
|
29
|
+
end
|
30
|
+
else
|
31
|
+
format.html { render "new", notice: Mokio::Concerns::Common::Translations::CommonTranslation.not_created(obj) }
|
32
|
+
format.json { render json: @obj.errors, status: :unprocessable_entity }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def init_obj
|
38
|
+
create_obj( @obj_class.new(obj_params) )
|
39
|
+
end
|
40
|
+
|
41
|
+
def set_author
|
42
|
+
obj.created_by = current_user.id
|
43
|
+
end
|
44
|
+
|
45
|
+
def set_editor
|
46
|
+
obj.updated_by = current_user.id
|
47
|
+
set_author if obj.created_by.blank? # for backward compatibility
|
11
48
|
end
|
12
49
|
|
13
50
|
#
|
14
51
|
# Extended CommonController new (Mokio::Concerns::Controllers::Common)
|
15
52
|
#
|
16
53
|
def new
|
54
|
+
|
17
55
|
super
|
18
56
|
obj.build_contact_template
|
19
57
|
end
|
@@ -28,7 +66,7 @@ module Mokio
|
|
28
66
|
# Never trust parameters from the scary internet, only allow the white list through.
|
29
67
|
#
|
30
68
|
def contact_params #:doc:
|
31
|
-
params.require(:contact).permit(extended_parameters,
|
69
|
+
params.require(:contact).permit(extended_parameters,mokio_gems_parameters,:title, :subtitle, :intro, :content, :article_type, :contact, :active,:home_page, :lang_id, :recipient_emails, :menu_ids => [], :contact_template_attributes => Mokio::ContactTemplate.contact_template_attributes)
|
32
70
|
end
|
33
71
|
end
|
34
72
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Mokio
|
2
|
+
module Concerns
|
3
|
+
module Controllers
|
4
|
+
#
|
5
|
+
# Concern for ContentsController
|
6
|
+
#
|
7
|
+
module MainPics
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
|
12
|
+
def delete_main_pic
|
13
|
+
obj = Mokio::Content.find(params[:id])
|
14
|
+
obj.remove_main_pic!
|
15
|
+
|
16
|
+
if obj.save!
|
17
|
+
flash[:notice] = t("main_pics.deleted")
|
18
|
+
else
|
19
|
+
flash[:error] = t("main_pics.not_deleted")
|
20
|
+
end
|
21
|
+
|
22
|
+
respond_to do |format|
|
23
|
+
format.js
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -25,6 +25,7 @@ module Mokio
|
|
25
25
|
# extended CommonController#index (Mokio::Concerns::Controllers::Common)
|
26
26
|
#
|
27
27
|
def index
|
28
|
+
|
28
29
|
@menus = Mokio::Menu.includes(:content_links).arrange(:order => :seq)
|
29
30
|
super
|
30
31
|
end
|
@@ -71,7 +72,7 @@ module Mokio
|
|
71
72
|
render :nothing => true
|
72
73
|
end
|
73
74
|
|
74
|
-
# Renders form for creating menu
|
75
|
+
# Renders form for creating menu position (fake menu - direct child of a lang root)
|
75
76
|
|
76
77
|
def new_menu_position
|
77
78
|
@menu = Mokio::Menu.new
|
@@ -169,7 +170,7 @@ module Mokio
|
|
169
170
|
# Never trust parameters from the scary internet, only allow the white list through.
|
170
171
|
#
|
171
172
|
def menu_params #:doc:
|
172
|
-
params[:menu].permit(: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 => [],
|
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 => [],
|
173
174
|
:meta_attributes => Mokio::Meta.meta_attributes)
|
174
175
|
end
|
175
176
|
end
|
@@ -8,14 +8,30 @@ module Mokio
|
|
8
8
|
extend ActiveSupport::Concern
|
9
9
|
|
10
10
|
included do
|
11
|
+
|
12
|
+
before_action :init_obj, :set_author, :only =>[:create]
|
13
|
+
before_action :set_editor, :only => [:create, :update]
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
def init_obj
|
18
|
+
@mov_gallery = Mokio::MovGallery.new(mov_gallery_params)
|
19
|
+
end
|
20
|
+
|
21
|
+
def set_author
|
22
|
+
@mov_gallery.created_by = current_user.id
|
23
|
+
end
|
24
|
+
|
25
|
+
def set_editor
|
26
|
+
obj.updated_by = current_user.id
|
27
|
+
set_author if obj.created_by.blank? # for backward compatibility
|
11
28
|
end
|
12
29
|
|
30
|
+
|
13
31
|
#
|
14
32
|
# Overriten create from CommonController#create (Mokio::Concerns::Controllers::Common)
|
15
33
|
#
|
16
34
|
def create
|
17
|
-
@mov_gallery = Mokio::MovGallery.new(mov_gallery_params)
|
18
|
-
|
19
35
|
respond_to do |format|
|
20
36
|
if @mov_gallery.save
|
21
37
|
if !params[:save_and_new].blank?
|
@@ -39,7 +55,7 @@ module Mokio
|
|
39
55
|
# Never trust parameters from the scary internet, only allow the white list through.
|
40
56
|
#
|
41
57
|
def mov_gallery_params #:doc:
|
42
|
-
params.require(:mov_gallery).permit(
|
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 => [],
|
43
59
|
:meta_attributes => Mokio::Meta.meta_attributes)
|
44
60
|
end
|
45
61
|
end
|
@@ -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, :data_file, :remote_data_file_url, :seq)
|
316
|
+
params.require(:photo).permit(:name, :subtitle, :intro, :external_link, :thumb, :active, :content_id,:base_content_id, :data_file, :remote_data_file_url, :seq)
|
317
317
|
end
|
318
318
|
|
319
319
|
#
|
@@ -8,14 +8,29 @@ module Mokio
|
|
8
8
|
extend ActiveSupport::Concern
|
9
9
|
|
10
10
|
included do
|
11
|
+
|
12
|
+
before_action :init_obj, :set_author, :only =>[:create]
|
13
|
+
before_action :set_editor, :only => [:create, :update]
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
def init_obj
|
18
|
+
@pic_gallery = Mokio::PicGallery.new(pic_gallery_params)
|
19
|
+
end
|
20
|
+
|
21
|
+
def set_author
|
22
|
+
@pic_gallery.created_by = current_user.id
|
23
|
+
end
|
24
|
+
|
25
|
+
def set_editor
|
26
|
+
obj.updated_by = current_user.id
|
27
|
+
set_author if obj.created_by.blank? # for backward compatibility
|
11
28
|
end
|
12
29
|
|
13
30
|
#
|
14
31
|
# Overriten create from CommonController#create (Mokio::Concerns::Controllers::Common)
|
15
32
|
#
|
16
33
|
def create
|
17
|
-
@pic_gallery = Mokio::PicGallery.new(pic_gallery_params)
|
18
|
-
|
19
34
|
respond_to do |format|
|
20
35
|
if @pic_gallery.save
|
21
36
|
if !params[:save_and_new].blank?
|
@@ -39,7 +54,7 @@ module Mokio
|
|
39
54
|
# Never trust parameters from the scary internet, only allow the white list through.
|
40
55
|
#
|
41
56
|
def pic_gallery_params #:doc:
|
42
|
-
params.require(:pic_gallery).permit(
|
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 => [],
|
43
58
|
:meta_attributes => Mokio::Meta.meta_attributes)
|
44
59
|
end
|
45
60
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Mokio
|
2
|
+
module Concerns
|
3
|
+
module Models #:nodoc:
|
4
|
+
#
|
5
|
+
# Concern for Mokio::Article model
|
6
|
+
#
|
7
|
+
module BaseArticle
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
attr_accessor :form_active
|
12
|
+
|
13
|
+
def form_active
|
14
|
+
false
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Mokio
|
2
|
+
module Concerns
|
3
|
+
module Models
|
4
|
+
#
|
5
|
+
# Concern for Contact model
|
6
|
+
#
|
7
|
+
module BaseContact
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
has_many :recipients, dependent: :destroy
|
12
|
+
has_one :contact_template, dependent: :destroy ,:foreign_key => "contact_id"
|
13
|
+
|
14
|
+
accepts_nested_attributes_for :recipients
|
15
|
+
accepts_nested_attributes_for :contact_template
|
16
|
+
|
17
|
+
# delegate :tpl, to: :contact_template
|
18
|
+
end
|
19
|
+
|
20
|
+
#
|
21
|
+
# Get recipient_id's for given email
|
22
|
+
#
|
23
|
+
def recipient_emails=(emails)
|
24
|
+
self.recipients = emails.delete(' ').split(',').map {|m| Mokio::Recipient.new(email: m) }
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# Return recipient emails
|
29
|
+
#
|
30
|
+
def recipient_emails
|
31
|
+
self.recipients.map(&:email).join(',')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Mokio
|
2
|
+
module Concerns
|
3
|
+
module Models
|
4
|
+
#
|
5
|
+
# Concern for Content model
|
6
|
+
#
|
7
|
+
module BaseContent
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
include Mokio::Concerns::Models::Common
|
12
|
+
|
13
|
+
has_many :data_files, :dependent => :destroy, :foreign_key => :base_content_id
|
14
|
+
has_many :contents ,:dependent => :destroy
|
15
|
+
|
16
|
+
# validates :title, presence: true
|
17
|
+
# validate :contents
|
18
|
+
accepts_nested_attributes_for :contents
|
19
|
+
accepts_nested_attributes_for :data_files, :allow_destroy => true, :reject_if => lambda { |d| d[:data_file].blank? }
|
20
|
+
|
21
|
+
mount_uploader :main_pic, Mokio::MainPicUploader
|
22
|
+
after_save :update_etag
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
module ClassMethods
|
27
|
+
#
|
28
|
+
# Columns for table in CommonController#index view
|
29
|
+
#
|
30
|
+
def columns_for_table
|
31
|
+
%w(title)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def update_etag
|
36
|
+
self.touch(:etag)
|
37
|
+
end
|
38
|
+
|
39
|
+
def editable
|
40
|
+
true
|
41
|
+
end
|
42
|
+
|
43
|
+
def deletable
|
44
|
+
true
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Mokio
|
2
|
+
module Concerns
|
3
|
+
module Models
|
4
|
+
#
|
5
|
+
# Concern for MovGallery model
|
6
|
+
#
|
7
|
+
module BaseMovGallery
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
end
|
12
|
+
|
13
|
+
def default_data_file
|
14
|
+
Mokio::Youtube
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Mokio
|
2
|
+
module Concerns
|
3
|
+
module Models
|
4
|
+
#
|
5
|
+
# Concern for PicGallery model
|
6
|
+
#
|
7
|
+
module BasePicGallery
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# Return constant
|
15
|
+
#
|
16
|
+
def default_data_file
|
17
|
+
Mokio::Photo
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -126,7 +126,7 @@ module Mokio
|
|
126
126
|
if self.class.has_meta_enabled?
|
127
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
128
|
|
129
|
-
application_name = Rails.application.class.to_s.split("::").first
|
129
|
+
application_name = Rails.application.class.to_s.split("::").first
|
130
130
|
self.meta.g_title = self.title if self.meta.present? && self.meta.g_title.blank?
|
131
131
|
self.meta.f_title = self.title if self.meta.present? && self.meta.f_title.blank?
|
132
132
|
self.meta.g_application_name = application_name if self.meta.present? && self.meta.g_application_name.blank?
|
@@ -17,6 +17,10 @@ module Mokio
|
|
17
17
|
belongs_to :gmap, :dependent => :destroy # Relation with gmap isn't necessary !
|
18
18
|
belongs_to :meta, :dependent => :destroy
|
19
19
|
|
20
|
+
belongs_to :author, :class_name => 'Mokio::User', :foreign_key => :created_by
|
21
|
+
belongs_to :editor, :class_name => 'Mokio::User', :foreign_key => :updated_by
|
22
|
+
belongs_to :lang
|
23
|
+
|
20
24
|
mount_uploader :main_pic, Mokio::MainPicUploader
|
21
25
|
|
22
26
|
accepts_nested_attributes_for :menus
|
@@ -51,6 +55,14 @@ module Mokio
|
|
51
55
|
end
|
52
56
|
end
|
53
57
|
|
58
|
+
def author_name
|
59
|
+
author.name_view unless author.blank?
|
60
|
+
end
|
61
|
+
|
62
|
+
def editor_name
|
63
|
+
editor.name_view unless editor.blank?
|
64
|
+
end
|
65
|
+
|
54
66
|
#
|
55
67
|
# Touching etag field
|
56
68
|
#
|
@@ -13,7 +13,8 @@ module Mokio
|
|
13
13
|
friendly_id :slug_candidates, use: :slugged
|
14
14
|
validates_uniqueness_of :slug
|
15
15
|
belongs_to :contents, :touch => true
|
16
|
-
|
16
|
+
belongs_to :base_contents
|
17
|
+
|
17
18
|
mount_uploader :data_file, Mokio::DataFileUploader
|
18
19
|
mount_uploader :thumb, Mokio::ThumbUploader
|
19
20
|
|
@@ -60,8 +61,13 @@ module Mokio
|
|
60
61
|
# For some reason touch => true does not work for DataFile :(
|
61
62
|
#
|
62
63
|
def touch_content
|
63
|
-
|
64
|
-
|
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
|
65
71
|
|
66
72
|
def slide?
|
67
73
|
false
|