mokio 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +2 -0
- data/app/assets/stylesheets/backend/custom.css.scss +1 -1
- data/app/views/mokio/common/_meta.html.slim +20 -20
- data/app/views/mokio/menus/_form.html.haml +1 -1
- data/app/views/mokio/menus/_menu.html.slim +7 -1
- data/app/views/mokio/menus/index.html.slim +1 -0
- data/app/views/mokio/menus/new_menu_position.slim +21 -0
- data/config/locales/en.yml +4 -1
- data/config/locales/pl.yml +4 -1
- data/config/routes.rb +6 -3
- data/db/migrate/20140422135850_add_mokio_to_application.rb +15 -15
- data/lib/mokio/concerns/controllers/menus.rb +25 -2
- data/lib/mokio/concerns/models/contact.rb +1 -1
- data/lib/mokio/concerns/models/menu.rb +2 -1
- data/lib/mokio/concerns/models/recipient.rb +0 -9
- data/lib/mokio/engine.rb +8 -0
- data/lib/mokio/frontend_helpers/langs_helper.rb +16 -9
- data/lib/mokio/frontend_helpers/menu_helper.rb +21 -16
- data/lib/mokio/slugged.rb +5 -0
- data/lib/mokio/version.rb +1 -1
- data/spec/controllers/{backend → mokio}/contents_controller_spec.rb +34 -25
- data/spec/controllers/mokio/dashboard_controller_spec.rb +76 -0
- data/spec/controllers/{backend → mokio}/menus_controller_spec.rb +104 -99
- data/spec/controllers/mokio/mov_galleries_controller_spec.rb +125 -0
- data/spec/controllers/mokio/photos_controller_spec.rb +350 -0
- data/spec/controllers/mokio/pic_galleries_controller_spec.rb +125 -0
- data/spec/controllers/mokio/static_modules_controller_spec.rb +166 -0
- data/spec/factories/contact_templates.rb +1 -1
- data/spec/factories/content_links_factory.rb +1 -1
- data/spec/factories/contents_factory.rb +8 -8
- data/spec/factories/gmaps.rb +1 -1
- data/spec/factories/langs.rb +1 -1
- data/spec/factories/menus_factory.rb +1 -1
- data/spec/factories/meta.rb +1 -1
- data/spec/factories/recipients.rb +1 -1
- data/spec/factories/selected_modules.rb +1 -1
- data/spec/factories/static_modules_factory.rb +2 -2
- data/spec/factories/users.rb +1 -1
- data/spec/helpers/mokio/common_helper_spec.rb +141 -0
- data/spec/helpers/mokio/menus_helper_spec.rb +70 -0
- data/spec/models/available_module_spec.rb +13 -10
- data/spec/models/contact_template_spec.rb +5 -3
- data/spec/models/content_link_spec.rb +5 -4
- data/spec/models/content_spec.rb +71 -70
- data/spec/models/data_file_spec.rb +5 -4
- data/spec/models/gmap_spec.rb +5 -4
- data/spec/models/lang_spec.rb +5 -4
- data/spec/models/menu_spec.rb +10 -2
- data/spec/models/meta_spec.rb +5 -4
- data/spec/models/module_position_spec.rb +11 -10
- data/spec/models/mov_gallery_spec.rb +62 -59
- data/spec/models/pic_gallery_spec.rb +62 -59
- data/spec/models/recipient_spec.rb +5 -4
- data/spec/models/selected_module_spec.rb +72 -88
- data/spec/models/static_module_spec.rb +56 -55
- data/spec/models/user_spec.rb +7 -3
- data/spec/spec_helper.rb +4 -1
- metadata +21 -22
- data/spec/controllers/backend/dashboard_controller_spec.rb +0 -69
- data/spec/controllers/backend/mov_galleries_controller_spec.rb +0 -118
- data/spec/controllers/backend/photos_controller_spec.rb +0 -342
- data/spec/controllers/backend/pic_galleries_controller_spec.rb +0 -118
- data/spec/controllers/backend/static_modules_controller_spec.rb +0 -159
- data/spec/factories/tags.rb +0 -17
- data/spec/helpers/backend/common_helper_spec.rb +0 -137
- data/spec/helpers/backend/menus_helper_spec.rb +0 -64
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c699e4ede04dd7a79e2766ec3509713d773bb90
|
4
|
+
data.tar.gz: 0921f2de69320c60df935bfc8743ce59cd438819
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52e420ddad472cb8381e668b04f07160ed75ba352c9aa4de5656c62a40117560d96e9b695515dfa3af835dd362f622ee50e075bdc94b4c8b42f6dbedad0e496a
|
7
|
+
data.tar.gz: 940fa445ad459f82942ce668c3f1ad969c2335cda3e6213e2630b41927a3731c0a9f6946c3f6f91ddb2e3b1d2cc503ae96cbe8bc2da9753d0e745d6a40d861da
|
data/Rakefile
CHANGED
@@ -30,6 +30,8 @@ Bundler::GemHelper.install_tasks
|
|
30
30
|
# t.verbose = false
|
31
31
|
# end
|
32
32
|
|
33
|
+
Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
|
34
|
+
|
33
35
|
require 'rspec/core'
|
34
36
|
require 'rspec/core/rake_task'
|
35
37
|
desc "Run all specs in spec directory (excluding plugin specs)"
|
@@ -9,32 +9,32 @@
|
|
9
9
|
span.icon16.icomoon-icon-facebook-2.white
|
10
10
|
= bt("meta_facebook", Mokio::Meta)
|
11
11
|
|
12
|
-
#meta_g_modal.modal.fade role="dialog" aria-hidden="true" style="display:none;" aria-labelledby="meta_g_ModalLabel"
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
#meta_g_modal.modal.fade role="dialog" aria-hidden="true" style="display:none;" aria-labelledby="meta_g_ModalLabel"
|
13
|
+
.modal-dialog
|
14
|
+
.modal-content
|
15
|
+
.modal-header
|
16
|
+
h3.modal-title.modal-photo id="meta_g_ModalLabel"
|
17
|
+
span.icon24.icomoon-icon-google-plus
|
18
|
+
= bt("meta_google", Mokio::Meta)
|
19
|
+
small= bt("meta_google_desc", Mokio::Meta)
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
.modal-body
|
22
|
+
= f.fields_for :meta do |m|
|
23
|
+
= m.input :g_title
|
24
|
+
= m.input :g_desc
|
25
|
+
= m.input :g_keywords
|
26
|
+
= m.input :g_author
|
27
|
+
= m.input :g_copyright
|
28
|
+
= m.input :g_application_name
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
.modal-footer
|
31
|
+
button.btn.btn-primary type="button" data-dismiss="modal" = bt("close")
|
32
32
|
|
33
|
-
#meta_f_modal.modal.fade role="dialog" aria-hidden="true" style="display:none;" aria-labelledby="meta_f_ModalLabel"
|
33
|
+
#meta_f_modal.modal.fade role="dialog" aria-hidden="true" style="display:none;" aria-labelledby="meta_f_ModalLabel"
|
34
34
|
.modal-dialog
|
35
35
|
.modal-content
|
36
36
|
.modal-header
|
37
|
-
h3.modal-title.modal-photo id="meta_f_ModalLabel"
|
37
|
+
h3.modal-title.modal-photo id="meta_f_ModalLabel"
|
38
38
|
span.icon24.icomoon-icon-facebook-2
|
39
39
|
= bt("meta_facebook", Mokio::Meta)
|
40
40
|
small= bt("meta_facebook_desc", Mokio::Meta)
|
@@ -19,7 +19,7 @@
|
|
19
19
|
#url_box{:style => "display: #{@menu.contents.empty? && !@menu.external_link.blank? ? 'block' : 'none'};"}
|
20
20
|
= f.input :external_link, label: btc("external_link",'Menu'), disabled: !@menu.display_editable_field?('external_link')
|
21
21
|
= f.input :follow, :as => :select, :collection => [[bt("follow",'Menu'), "true"], [bt("nofollow",'Menu'), "false"]], :include_blank => false
|
22
|
-
= f.input :parent_id, :collection => @menu.parent_tree.collect{|m| [m.name, m.id]}, include_blank: false, disabled: !@menu.display_editable_field?('parent_id')
|
22
|
+
= f.input :parent_id, :collection => @menu.parent_tree.collect{|m| ["#{'-' * m.ancestry.count('/')}#{m.name}", m.id]}, include_blank: false, disabled: !@menu.display_editable_field?('parent_id')
|
23
23
|
|
24
24
|
.row-fluid
|
25
25
|
%label.form-label.span2
|
@@ -1,8 +1,14 @@
|
|
1
1
|
- cache [:tree, menu] do
|
2
|
-
div
|
2
|
+
div class=("menu_div active_#{menu.active} visible_#{menu.visible} fake_#{menu.fake}")
|
3
3
|
- if menu.fake
|
4
4
|
span.menu_name
|
5
5
|
= "#{menu.name} (ID: #{menu.id})"
|
6
|
+
span.menu_details
|
7
|
+
span.edit_buttons
|
8
|
+
- if menu.fake && !menu.parent.blank? && menu.children.empty?
|
9
|
+
= table_controls_delete_btn(obj_url(menu.class, menu), btc('confirm', Mokio::Menu))
|
10
|
+
- else
|
11
|
+
span.blank-delete
|
6
12
|
- else
|
7
13
|
- if menu.invisible_content
|
8
14
|
span.warning
|
@@ -6,6 +6,7 @@
|
|
6
6
|
h4
|
7
7
|
span= bt("index_title", Mokio::Menu)
|
8
8
|
= btn_new( bt("index_add_new", Mokio::Menu), new_url(Mokio::Menu) )
|
9
|
+
= btn_new( bt("index_add_new_menu_position", Mokio::Menu), new_menu_position_menus_url(Mokio::Menu) )
|
9
10
|
|
10
11
|
- if @menus.present?
|
11
12
|
ol#menusList.sortable
|
@@ -0,0 +1,21 @@
|
|
1
|
+
.span12
|
2
|
+
= render :partial => "mokio/common/notice"
|
3
|
+
.box
|
4
|
+
= box_title do
|
5
|
+
= bt("new_menu_position_title", @menu.class)
|
6
|
+
= common_form do
|
7
|
+
.row-fluid
|
8
|
+
= simple_form_for @menu, :url => create_menu_position_menus_path, :html => { :class => 'form-horizontal' } do |f|
|
9
|
+
|
10
|
+
.row-fluid
|
11
|
+
= f.hidden_field :fake, :value => true
|
12
|
+
= f.input :lang_id, collection: Mokio::Lang.all.collect{|lang| [bt(lang.name), lang.id]}, include_blank: false, disabled: !@menu.display_editable_field?('lang_id')
|
13
|
+
= f.input :name
|
14
|
+
|
15
|
+
|
16
|
+
- cache [:form_buttons, obj] do
|
17
|
+
.form-actions
|
18
|
+
= btn_submit bt("save")
|
19
|
+
= btn_submit bt("save_and_create_new"), true
|
20
|
+
= btn_cancel "#{engine_root}#{obj.class.to_s.tableize.gsub("mokio/", "")}"
|
21
|
+
|
data/config/locales/en.yml
CHANGED
@@ -182,6 +182,7 @@ en:
|
|
182
182
|
content_management: Content management
|
183
183
|
page_elements: Site elements
|
184
184
|
settings: Settings
|
185
|
+
new_menu_position: New menu position
|
185
186
|
|
186
187
|
static_modules:
|
187
188
|
actions: Actions
|
@@ -296,8 +297,9 @@ en:
|
|
296
297
|
not_updated: "Menu <strong>'%{title}'</strong> has NOT been saved"
|
297
298
|
not_deleted: "Menu <strong>'%{title}'</strong> has NOT beed deleted"
|
298
299
|
index_title: Menu management
|
299
|
-
index_add_new: Add menu
|
300
|
+
index_add_new: Add menu element
|
300
301
|
new_title: "New menu element"
|
302
|
+
index_add_new_menu_position: Add menu position
|
301
303
|
edit_title: "Edit menu element"
|
302
304
|
copy_title: "Copy menu element"
|
303
305
|
save: Save
|
@@ -319,6 +321,7 @@ en:
|
|
319
321
|
type: Type
|
320
322
|
filter: filter ...
|
321
323
|
blocks: "Reusable blocks"
|
324
|
+
new_menu_position_title: "New menu position"
|
322
325
|
|
323
326
|
pic_galleries:
|
324
327
|
active: Active
|
data/config/locales/pl.yml
CHANGED
@@ -182,6 +182,7 @@ pl:
|
|
182
182
|
content_management: Zarządzanie treścią
|
183
183
|
page_elements: Elementy strony
|
184
184
|
settings: Ustawienia
|
185
|
+
new_menu_position: Nowa pozycja dla menu
|
185
186
|
|
186
187
|
static_modules:
|
187
188
|
actions: Akcje
|
@@ -296,7 +297,8 @@ pl:
|
|
296
297
|
not_updated: "Menu <strong>'%{title}'</strong> nie zostało poprawnie zapisane."
|
297
298
|
not_deleted: "Menu <strong>'%{title}'</strong> nie zostało usunięte."
|
298
299
|
index_title: Zarządzanie menu
|
299
|
-
index_add_new: Dodaj menu
|
300
|
+
index_add_new: Dodaj element menu
|
301
|
+
index_add_new_menu_position: Dodaj pozycję dla menu
|
300
302
|
new_title: "Nowy element menu"
|
301
303
|
edit_title: "Edytuj element menu"
|
302
304
|
copy_title: "Kopiuj element menu"
|
@@ -319,6 +321,7 @@ pl:
|
|
319
321
|
type: Typ
|
320
322
|
filter: wyszukaj treść ...
|
321
323
|
blocks: Bloki
|
324
|
+
new_menu_position_title: Nowa pozycja dla menu
|
322
325
|
|
323
326
|
pic_galleries:
|
324
327
|
active: Włączona
|
data/config/routes.rb
CHANGED
@@ -9,11 +9,14 @@ Mokio::Engine.routes.draw do
|
|
9
9
|
member do
|
10
10
|
get :update_menu_breadcrumps
|
11
11
|
get :copy
|
12
|
+
|
12
13
|
end
|
13
14
|
|
14
15
|
collection do
|
15
16
|
post :sort
|
16
|
-
get
|
17
|
+
get :lang_changed
|
18
|
+
get :new_menu_position
|
19
|
+
post :create_menu_position
|
17
20
|
end
|
18
21
|
end
|
19
22
|
|
@@ -23,7 +26,7 @@ Mokio::Engine.routes.draw do
|
|
23
26
|
resources :static_modules do
|
24
27
|
member do
|
25
28
|
get :copy
|
26
|
-
|
29
|
+
post :update_active
|
27
30
|
end
|
28
31
|
end
|
29
32
|
|
@@ -133,7 +136,7 @@ Mokio::Engine.routes.draw do
|
|
133
136
|
|
134
137
|
resources :module_positions do
|
135
138
|
member do
|
136
|
-
|
139
|
+
post :update_active
|
137
140
|
get :copy
|
138
141
|
end
|
139
142
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class AddMokioToApplication < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
create_table "mokio_available_modules"
|
3
|
+
create_table "mokio_available_modules" do |t|
|
4
4
|
t.datetime "created_at"
|
5
5
|
t.datetime "updated_at"
|
6
6
|
t.integer "module_position_id"
|
@@ -10,7 +10,7 @@ class AddMokioToApplication < ActiveRecord::Migration
|
|
10
10
|
add_index "mokio_available_modules", ["module_position_id"], name: "index_mokio_available_modules_on_module_position_id", using: :btree
|
11
11
|
add_index "mokio_available_modules", ["static_module_id"], name: "index_mokio_available_modules_on_static_module_id", using: :btree
|
12
12
|
|
13
|
-
create_table "ckeditor_assets"
|
13
|
+
create_table "ckeditor_assets" do |t|
|
14
14
|
t.string "data_file_name", null: false
|
15
15
|
t.string "data_content_type"
|
16
16
|
t.integer "data_file_size"
|
@@ -27,7 +27,7 @@ class AddMokioToApplication < ActiveRecord::Migration
|
|
27
27
|
add_index "ckeditor_assets", ["assetable_type", "type", "assetable_id"], name: "idx_ckeditor_assetable_type", using: :btree
|
28
28
|
|
29
29
|
|
30
|
-
create_table "mokio_contact_templates"
|
30
|
+
create_table "mokio_contact_templates" do |t|
|
31
31
|
t.text "tpl"
|
32
32
|
t.datetime "created_at"
|
33
33
|
t.datetime "updated_at"
|
@@ -36,7 +36,7 @@ class AddMokioToApplication < ActiveRecord::Migration
|
|
36
36
|
|
37
37
|
add_index "mokio_contact_templates", ["contact_id"], name: "index_mokio_contact_templates_on_contact_id", using: :btree
|
38
38
|
|
39
|
-
create_table "mokio_content_links"
|
39
|
+
create_table "mokio_content_links" do |t|
|
40
40
|
t.integer "content_id"
|
41
41
|
t.integer "menu_id"
|
42
42
|
t.integer "seq"
|
@@ -44,7 +44,7 @@ class AddMokioToApplication < ActiveRecord::Migration
|
|
44
44
|
|
45
45
|
add_index "mokio_content_links", ["content_id", "menu_id"], name: "index_mokio_content_links_on_content_id_and_menu_id", unique: true, using: :btree
|
46
46
|
|
47
|
-
create_table "mokio_contents"
|
47
|
+
create_table "mokio_contents" do |t|
|
48
48
|
t.string "title"
|
49
49
|
t.text "intro"
|
50
50
|
t.text "content"
|
@@ -71,7 +71,7 @@ class AddMokioToApplication < ActiveRecord::Migration
|
|
71
71
|
add_index "mokio_contents", ["gmap_id"], name: "index_mokio_contents_on_gmap_id", using: :btree
|
72
72
|
add_index "mokio_contents", ["meta_id"], name: "index_mokio_contents_on_meta_id", using: :btree
|
73
73
|
|
74
|
-
create_table "mokio_data_files"
|
74
|
+
create_table "mokio_data_files" do |t|
|
75
75
|
t.string "name"
|
76
76
|
t.string "data_file"
|
77
77
|
t.integer "download_count", default: 0
|
@@ -92,7 +92,7 @@ class AddMokioToApplication < ActiveRecord::Migration
|
|
92
92
|
|
93
93
|
add_index "mokio_data_files", ["content_id"], name: "index_mokio_data_files_on_content_id", using: :btree
|
94
94
|
|
95
|
-
create_table "mokio_gmaps"
|
95
|
+
create_table "mokio_gmaps" do |t|
|
96
96
|
t.string "full_address"
|
97
97
|
t.string "street_number"
|
98
98
|
t.string "route"
|
@@ -112,7 +112,7 @@ class AddMokioToApplication < ActiveRecord::Migration
|
|
112
112
|
add_index "mokio_gmaps", ["lat"], name: "index_mokio_gmaps_on_lat", using: :btree
|
113
113
|
add_index "mokio_gmaps", ["lng"], name: "index_mokio_gmaps_on_lng", using: :btree
|
114
114
|
|
115
|
-
create_table "mokio_langs"
|
115
|
+
create_table "mokio_langs" do |t|
|
116
116
|
t.string "name"
|
117
117
|
t.string "shortname"
|
118
118
|
t.boolean "active"
|
@@ -121,7 +121,7 @@ class AddMokioToApplication < ActiveRecord::Migration
|
|
121
121
|
t.datetime "updated_at"
|
122
122
|
end
|
123
123
|
|
124
|
-
create_table "mokio_menus"
|
124
|
+
create_table "mokio_menus" do |t|
|
125
125
|
t.string "name"
|
126
126
|
t.boolean "active", default: true
|
127
127
|
t.integer "seq"
|
@@ -148,7 +148,7 @@ class AddMokioToApplication < ActiveRecord::Migration
|
|
148
148
|
add_index "mokio_menus", ["meta_id"], name: "index_mokio_menus_on_meta_id", using: :btree
|
149
149
|
add_index "mokio_menus", ["slug"], name: "index_mokio_menus_on_slug", unique: true, using: :btree
|
150
150
|
|
151
|
-
create_table "mokio_meta"
|
151
|
+
create_table "mokio_meta" do |t|
|
152
152
|
t.string "g_title"
|
153
153
|
t.string "g_desc"
|
154
154
|
t.string "g_keywords"
|
@@ -164,14 +164,14 @@ class AddMokioToApplication < ActiveRecord::Migration
|
|
164
164
|
t.datetime "updated_at"
|
165
165
|
end
|
166
166
|
|
167
|
-
create_table "mokio_module_positions"
|
167
|
+
create_table "mokio_module_positions" do |t|
|
168
168
|
t.string "name"
|
169
169
|
t.string "tpl"
|
170
170
|
t.datetime "created_at"
|
171
171
|
t.datetime "updated_at"
|
172
172
|
end
|
173
173
|
|
174
|
-
create_table "mokio_recipients"
|
174
|
+
create_table "mokio_recipients" do |t|
|
175
175
|
t.string "email", null: false
|
176
176
|
t.boolean "active", default: true
|
177
177
|
t.datetime "created_at"
|
@@ -181,7 +181,7 @@ class AddMokioToApplication < ActiveRecord::Migration
|
|
181
181
|
|
182
182
|
add_index "mokio_recipients", ["contact_id"], name: "index_mokio_recipients_on_contact_id", using: :btree
|
183
183
|
|
184
|
-
create_table "mokio_selected_modules"
|
184
|
+
create_table "mokio_selected_modules" do |t|
|
185
185
|
t.integer "available_module_id"
|
186
186
|
t.integer "menu_id"
|
187
187
|
t.integer "seq"
|
@@ -189,7 +189,7 @@ class AddMokioToApplication < ActiveRecord::Migration
|
|
189
189
|
t.datetime "updated_at"
|
190
190
|
end
|
191
191
|
|
192
|
-
create_table "mokio_static_modules"
|
192
|
+
create_table "mokio_static_modules" do |t|
|
193
193
|
t.integer "available_modules_id"
|
194
194
|
t.string "title"
|
195
195
|
t.text "content"
|
@@ -207,7 +207,7 @@ class AddMokioToApplication < ActiveRecord::Migration
|
|
207
207
|
t.text "intro"
|
208
208
|
end
|
209
209
|
|
210
|
-
create_table "mokio_users"
|
210
|
+
create_table "mokio_users" do |t|
|
211
211
|
t.string "email", default: "", null: false
|
212
212
|
t.string "encrypted_password", default: "", null: false
|
213
213
|
t.string "reset_password_token"
|
@@ -71,6 +71,19 @@ module Mokio
|
|
71
71
|
render :nothing => true
|
72
72
|
end
|
73
73
|
|
74
|
+
# Renders form for creating menu positon (fake menu - direct child of a lang root)
|
75
|
+
|
76
|
+
def new_menu_position
|
77
|
+
@menu = Mokio::Menu.new
|
78
|
+
end
|
79
|
+
|
80
|
+
def create_menu_position
|
81
|
+
parent = Mokio::Menu.where(lang_id: params[:menu][:lang_id], ancestry: nil).first
|
82
|
+
params[:menu][:parent_id] = parent.id
|
83
|
+
params[:menu][:deletable] = true
|
84
|
+
create
|
85
|
+
end
|
86
|
+
|
74
87
|
private
|
75
88
|
#
|
76
89
|
# Method to initialize menu's dual select boxes
|
@@ -109,7 +122,17 @@ module Mokio
|
|
109
122
|
|
110
123
|
def transform_modules #:doc:
|
111
124
|
if !params[:menu][:available_module_ids].nil?
|
112
|
-
|
125
|
+
av_module_ids = params[:menu][:available_module_ids].values.flatten
|
126
|
+
|
127
|
+
# modules that are always displayed are not saved as selected_modules
|
128
|
+
|
129
|
+
av_modules = AvailableModule.where('id IN (?)', av_module_ids)
|
130
|
+
av_modules.each do |mod|
|
131
|
+
if mod.static_module.always_displayed
|
132
|
+
av_module_ids.delete(mod.id.to_s)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
params[:menu][:available_module_ids] = av_module_ids
|
113
136
|
end
|
114
137
|
end
|
115
138
|
|
@@ -146,7 +169,7 @@ module Mokio
|
|
146
169
|
# Never trust parameters from the scary internet, only allow the white list through.
|
147
170
|
#
|
148
171
|
def menu_params #:doc:
|
149
|
-
params[:menu].permit(:name, :seq, :target, :external_link, :follow, :parent_id, :active, :visible, :description, :lang_id, :content_ids => [],:available_module_ids => [],
|
172
|
+
params[:menu].permit(:name, :seq, :target, :external_link, :follow, :parent_id, :active, :visible, :description, :lang_id, :fake, :content_ids => [],:available_module_ids => [],
|
150
173
|
:meta_attributes => Mokio::Meta.meta_attributes)
|
151
174
|
end
|
152
175
|
end
|
@@ -21,7 +21,7 @@ module Mokio
|
|
21
21
|
# Get recipient_id's for given email
|
22
22
|
#
|
23
23
|
def recipient_emails=(emails)
|
24
|
-
self.
|
24
|
+
self.recipients = emails.delete(' ').split(',').map {|m| Mokio::Recipient.new(email: m) }
|
25
25
|
end
|
26
26
|
|
27
27
|
#
|
@@ -98,6 +98,7 @@ module Mokio
|
|
98
98
|
# Returns list of contents available for assignment to given menu element (based on lang_id) ordered by title
|
99
99
|
#
|
100
100
|
def available_contents
|
101
|
+
raise "NoLangDefinedException" if Mokio::Lang.count < 1
|
101
102
|
if lang_id.nil? || lang_id == 0
|
102
103
|
Mokio::Content.lang(Mokio::Lang.first.id).order(:title) - contents
|
103
104
|
else
|
@@ -202,7 +203,7 @@ module Mokio
|
|
202
203
|
m = self
|
203
204
|
slug = m.slug
|
204
205
|
unless m.parent.nil? || slug.nil?
|
205
|
-
while !m.parent.fake
|
206
|
+
while m.parent && !m.parent.fake
|
206
207
|
slug = m.parent.slug + "/" + slug
|
207
208
|
m = m.parent
|
208
209
|
end
|
@@ -11,15 +11,6 @@ module Mokio
|
|
11
11
|
belongs_to :contact
|
12
12
|
validates :email, :email => true
|
13
13
|
end
|
14
|
-
|
15
|
-
module ClassMethods
|
16
|
-
#
|
17
|
-
# Get ids from given emails
|
18
|
-
#
|
19
|
-
def ids_from_emails(emails)
|
20
|
-
emails.delete(' ').split(',').map {|m| Mokio::Recipient.create(email: m).id }
|
21
|
-
end
|
22
|
-
end
|
23
14
|
end
|
24
15
|
end
|
25
16
|
end
|
data/lib/mokio/engine.rb
CHANGED
@@ -85,5 +85,13 @@ module Mokio
|
|
85
85
|
initializer "mokio.views" do |app|
|
86
86
|
app.config.views_config = Mokio::TemplateRenderer.read_config
|
87
87
|
end
|
88
|
+
|
89
|
+
config.generators do |g|
|
90
|
+
g.test_framework :rspec, :fixture => false
|
91
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
92
|
+
g.assets false
|
93
|
+
g.helper false
|
94
|
+
end
|
95
|
+
|
88
96
|
end
|
89
97
|
end
|