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
@@ -9,21 +9,57 @@ module Mokio
|
|
9
9
|
|
10
10
|
included do
|
11
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) )
|
12
39
|
end
|
13
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
|
48
|
+
end
|
49
|
+
|
50
|
+
|
14
51
|
def set_breadcrumbs_prefix
|
15
52
|
@breadcrumbs_prefix = "content_management"
|
16
53
|
@breadcrumbs_prefix_link = "contents"
|
17
54
|
end
|
18
55
|
|
19
|
-
|
20
56
|
private
|
21
57
|
#
|
22
58
|
# Never trust parameters from the scary internet, only allow the white list through.
|
23
59
|
#
|
24
60
|
def article_params #:doc:
|
25
|
-
params.require(:article).permit(
|
26
|
-
:gallery_type, :display_from, :display_to, :main_pic, :tag_list
|
61
|
+
params.require(:article).permit(extended_parameters,mokio_gems_parameters, :title, :subtitle, :intro, :content, :article_type, :home_page, :tpl, :contact, :active, :seq, :lang_id,
|
62
|
+
:gallery_type, :display_from, :display_to, :main_pic, :tag_list,:menu_ids => [], :data_files_attributes => [:data_file, :main_pic, :id, :remove_data_file]
|
27
63
|
)
|
28
64
|
end
|
29
65
|
end
|
@@ -0,0 +1,31 @@
|
|
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
|
@@ -0,0 +1,32 @@
|
|
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
|
@@ -0,0 +1,167 @@
|
|
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
|
@@ -0,0 +1,48 @@
|
|
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
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Mokio
|
2
|
+
module Concerns
|
3
|
+
module Controllers
|
4
|
+
#
|
5
|
+
# Concern for PicGalleriesController
|
6
|
+
#
|
7
|
+
module BasePicGalleries
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
included do
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# Overriten create from CommonController#create (Mokio::Concerns::Controllers::Common)
|
15
|
+
#
|
16
|
+
|
17
|
+
def set_breadcrumbs_prefix
|
18
|
+
@breadcrumbs_prefix = "content_management"
|
19
|
+
@breadcrumbs_prefix_link = "contents"
|
20
|
+
end
|
21
|
+
private
|
22
|
+
#
|
23
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
24
|
+
#
|
25
|
+
def base_pic_gallery_params #:doc:
|
26
|
+
params.require(:base_pic_gallery).permit(:title, :subtitle, :type, :active,:home_page, :intro, :content, :display_from, :display_to, :lang_id, :main_pic, :tag_list, :menu_ids => [], :data_file => [],
|
27
|
+
:meta_attributes => Mokio::Meta.meta_attributes)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -52,15 +52,13 @@ module Mokio
|
|
52
52
|
load_and_authorize_resource
|
53
53
|
end
|
54
54
|
|
55
|
-
|
56
|
-
|
57
55
|
#
|
58
56
|
# Index action renders <b>json</b> with parameters to jquery.datatables
|
59
57
|
#
|
60
58
|
def index
|
61
59
|
respond_to do |format|
|
62
60
|
# @TODO zrobic cos by przy formacie html nie renderował się javascript z datatable
|
63
|
-
format.html # { create_obj(@obj_class.page( params[:page] ) ) }
|
61
|
+
format.html # { create_obj(@obj_class.page( params[:page] ) ) }
|
64
62
|
format.json { render json: ::CommonsDatatable.new(view_context, @obj_class) }
|
65
63
|
end
|
66
64
|
end
|
@@ -91,7 +89,7 @@ module Mokio
|
|
91
89
|
if !params[:save_and_new].blank?
|
92
90
|
format.html { redirect_to obj_new_url(@obj_class.new), notice: CommonTranslation.created(obj) }
|
93
91
|
format.json { render action: 'new', status: :created, location: obj }
|
94
|
-
else
|
92
|
+
else
|
95
93
|
format.html { redirect_to obj_index_url, notice: CommonTranslation.created(obj) }
|
96
94
|
format.json { render action: 'index', status: :created, location: obj }
|
97
95
|
end
|
@@ -106,12 +104,13 @@ module Mokio
|
|
106
104
|
# Standard update action. Update params object for specified class in database
|
107
105
|
#
|
108
106
|
def update
|
107
|
+
|
109
108
|
respond_to do |format|
|
110
109
|
if obj.update(obj_params)
|
111
110
|
if !params[:save_and_new].blank?
|
112
111
|
format.html { redirect_to obj_new_url(@obj_class.new), notice: CommonTranslation.updated(obj) }
|
113
112
|
format.json { head :no_content }
|
114
|
-
else
|
113
|
+
else
|
115
114
|
format.html { redirect_to obj_index_url, notice: CommonTranslation.updated(obj) }
|
116
115
|
format.json { render action: 'index', status: :created, location: obj }
|
117
116
|
end
|
@@ -135,7 +134,7 @@ module Mokio
|
|
135
134
|
end
|
136
135
|
end
|
137
136
|
|
138
|
-
#
|
137
|
+
#
|
139
138
|
# Similar to <b>new</b> action but creates new object with copied data.
|
140
139
|
# This method is using amoeba_dup to duplicate object with every associations specified in Model (<b>gem amoeba</b>)
|
141
140
|
# === Examples
|
@@ -148,7 +147,7 @@ module Mokio
|
|
148
147
|
# include_field [:tags, :authors]
|
149
148
|
# end
|
150
149
|
#
|
151
|
-
# If you use this method add to your controller resources in routes.rb:
|
150
|
+
# If you use this method add to your controller resources in routes.rb:
|
152
151
|
# member do
|
153
152
|
# get :copy
|
154
153
|
# end
|
@@ -163,7 +162,7 @@ module Mokio
|
|
163
162
|
|
164
163
|
#
|
165
164
|
# Method for ajax updating "active" attribute
|
166
|
-
# If you use this method, add to your controller resources in routes.rb:
|
165
|
+
# If you use this method, add to your controller resources in routes.rb:
|
167
166
|
# member do
|
168
167
|
# get :update_active
|
169
168
|
# end
|