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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -0
  3. data/app/assets/stylesheets/backend/custom.css.scss +1 -1
  4. data/app/views/mokio/common/_meta.html.slim +20 -20
  5. data/app/views/mokio/menus/_form.html.haml +1 -1
  6. data/app/views/mokio/menus/_menu.html.slim +7 -1
  7. data/app/views/mokio/menus/index.html.slim +1 -0
  8. data/app/views/mokio/menus/new_menu_position.slim +21 -0
  9. data/config/locales/en.yml +4 -1
  10. data/config/locales/pl.yml +4 -1
  11. data/config/routes.rb +6 -3
  12. data/db/migrate/20140422135850_add_mokio_to_application.rb +15 -15
  13. data/lib/mokio/concerns/controllers/menus.rb +25 -2
  14. data/lib/mokio/concerns/models/contact.rb +1 -1
  15. data/lib/mokio/concerns/models/menu.rb +2 -1
  16. data/lib/mokio/concerns/models/recipient.rb +0 -9
  17. data/lib/mokio/engine.rb +8 -0
  18. data/lib/mokio/frontend_helpers/langs_helper.rb +16 -9
  19. data/lib/mokio/frontend_helpers/menu_helper.rb +21 -16
  20. data/lib/mokio/slugged.rb +5 -0
  21. data/lib/mokio/version.rb +1 -1
  22. data/spec/controllers/{backend → mokio}/contents_controller_spec.rb +34 -25
  23. data/spec/controllers/mokio/dashboard_controller_spec.rb +76 -0
  24. data/spec/controllers/{backend → mokio}/menus_controller_spec.rb +104 -99
  25. data/spec/controllers/mokio/mov_galleries_controller_spec.rb +125 -0
  26. data/spec/controllers/mokio/photos_controller_spec.rb +350 -0
  27. data/spec/controllers/mokio/pic_galleries_controller_spec.rb +125 -0
  28. data/spec/controllers/mokio/static_modules_controller_spec.rb +166 -0
  29. data/spec/factories/contact_templates.rb +1 -1
  30. data/spec/factories/content_links_factory.rb +1 -1
  31. data/spec/factories/contents_factory.rb +8 -8
  32. data/spec/factories/gmaps.rb +1 -1
  33. data/spec/factories/langs.rb +1 -1
  34. data/spec/factories/menus_factory.rb +1 -1
  35. data/spec/factories/meta.rb +1 -1
  36. data/spec/factories/recipients.rb +1 -1
  37. data/spec/factories/selected_modules.rb +1 -1
  38. data/spec/factories/static_modules_factory.rb +2 -2
  39. data/spec/factories/users.rb +1 -1
  40. data/spec/helpers/mokio/common_helper_spec.rb +141 -0
  41. data/spec/helpers/mokio/menus_helper_spec.rb +70 -0
  42. data/spec/models/available_module_spec.rb +13 -10
  43. data/spec/models/contact_template_spec.rb +5 -3
  44. data/spec/models/content_link_spec.rb +5 -4
  45. data/spec/models/content_spec.rb +71 -70
  46. data/spec/models/data_file_spec.rb +5 -4
  47. data/spec/models/gmap_spec.rb +5 -4
  48. data/spec/models/lang_spec.rb +5 -4
  49. data/spec/models/menu_spec.rb +10 -2
  50. data/spec/models/meta_spec.rb +5 -4
  51. data/spec/models/module_position_spec.rb +11 -10
  52. data/spec/models/mov_gallery_spec.rb +62 -59
  53. data/spec/models/pic_gallery_spec.rb +62 -59
  54. data/spec/models/recipient_spec.rb +5 -4
  55. data/spec/models/selected_module_spec.rb +72 -88
  56. data/spec/models/static_module_spec.rb +56 -55
  57. data/spec/models/user_spec.rb +7 -3
  58. data/spec/spec_helper.rb +4 -1
  59. metadata +21 -22
  60. data/spec/controllers/backend/dashboard_controller_spec.rb +0 -69
  61. data/spec/controllers/backend/mov_galleries_controller_spec.rb +0 -118
  62. data/spec/controllers/backend/photos_controller_spec.rb +0 -342
  63. data/spec/controllers/backend/pic_galleries_controller_spec.rb +0 -118
  64. data/spec/controllers/backend/static_modules_controller_spec.rb +0 -159
  65. data/spec/factories/tags.rb +0 -17
  66. data/spec/helpers/backend/common_helper_spec.rb +0 -137
  67. data/spec/helpers/backend/menus_helper_spec.rb +0 -64
@@ -20,7 +20,8 @@
20
20
  #
21
21
 
22
22
  require 'spec_helper'
23
-
24
- describe Gmap do
25
- pending "add some examples to (or delete) #{__FILE__}"
26
- end
23
+ module Mokio
24
+ describe Gmap do
25
+ pending "add some examples to (or delete) #{__FILE__}"
26
+ end
27
+ end
@@ -12,7 +12,8 @@
12
12
  #
13
13
 
14
14
  require 'spec_helper'
15
-
16
- describe Lang do
17
- pending "add some examples to (or delete) #{__FILE__}"
18
- end
15
+ module Mokio
16
+ describe Lang do
17
+ pending "add some examples to (or delete) #{__FILE__}"
18
+ end
19
+ end
@@ -28,6 +28,8 @@ require 'spec_helper'
28
28
 
29
29
  MENU_COUNT_INITIAL = 7
30
30
 
31
+ module Mokio
32
+
31
33
  describe Menu do
32
34
 
33
35
  before :all do
@@ -35,6 +37,11 @@ describe Menu do
35
37
  Lang.create(:name => 'polish', :shortname => 'pl', :id => 1)
36
38
  end
37
39
 
40
+ # before :each do
41
+ # # @routes = Mokio::Engine.routes
42
+ # end
43
+
44
+
38
45
  it "has one record" do
39
46
 
40
47
  expect {FactoryGirl.create(:menu)}.to change(Menu, :count).by(1)
@@ -240,8 +247,9 @@ describe Menu do
240
247
 
241
248
  describe 'some_editable' do
242
249
  it 'is invalid when not editable' do
243
- @menu = FactoryGirl.build(:menu, :not_editable)
250
+ @menu = FactoryGirl.create(:menu, :not_editable)
244
251
  @menu.name = 'aaa'
252
+ # raise (@menu.valid?).inspect
245
253
  expect(@menu).not_to be_valid
246
254
  end
247
255
 
@@ -311,5 +319,5 @@ describe Menu do
311
319
  end
312
320
 
313
321
  end
314
-
322
+ end
315
323
  end
@@ -19,7 +19,8 @@
19
19
  #
20
20
 
21
21
  require 'spec_helper'
22
-
23
- describe Meta do
24
- pending "add some examples to (or delete) #{__FILE__}"
25
- end
22
+ module Mokio
23
+ describe Meta do
24
+ pending "add some examples to (or delete) #{__FILE__}"
25
+ end
26
+ end
@@ -10,16 +10,17 @@
10
10
  #
11
11
 
12
12
  require 'spec_helper'
13
+ module Mokio
14
+ describe ModulePosition do
15
+ it 'has valid factory' do
16
+ FactoryGirl.create(:module_position).should be_valid
17
+ end
13
18
 
14
- describe ModulePosition do
15
- it 'has valid factory' do
16
- FactoryGirl.create(:module_position).should be_valid
17
- end
18
-
19
- describe 'has and belongs to many static modules' do
20
- it 'reflect on association' do
21
- module_position = ModulePosition.reflect_on_association(:static_modules)
22
- module_position.macro.should == :has_and_belongs_to_many
19
+ describe 'has and belongs to many static modules' do
20
+ it 'reflect on association' do
21
+ module_position = ModulePosition.reflect_on_association(:static_modules)
22
+ module_position.macro.should == :has_many
23
+ end
23
24
  end
24
25
  end
25
- end
26
+ end
@@ -25,79 +25,82 @@
25
25
 
26
26
  require 'spec_helper'
27
27
 
28
- describe MovGallery do
28
+ module Mokio
29
29
 
30
- describe 'defaults' do
31
- before(:each) do
32
- @gallery = MovGallery.new
33
- end
30
+ describe MovGallery do
34
31
 
35
- it 'has MovGallery type' do
36
- @gallery.type.should == "MovGallery"
37
- end
32
+ describe 'defaults' do
33
+ before(:each) do
34
+ @gallery = MovGallery.new
35
+ end
38
36
 
39
- it 'is invalid without title' do
40
- @gallery.should_not be_valid
41
- end
37
+ it 'has MovGallery type' do
38
+ @gallery.type.should == "Mokio::MovGallery"
39
+ end
42
40
 
43
- #
44
- # default added MovGallery have to have this values
45
- #
46
- it 'is editable' do
47
- @gallery.editable.should == true
48
- end
41
+ it 'is invalid without title' do
42
+ @gallery.should_not be_valid
43
+ end
49
44
 
50
- it 'is deletable' do
51
- @gallery.deletable.should == true
52
- end
45
+ #
46
+ # default added MovGallery have to have this values
47
+ #
48
+ it 'is editable' do
49
+ @gallery.editable.should == true
50
+ end
53
51
 
54
- it 'is active' do
55
- @gallery.active.should == true
56
- end
57
- end
52
+ it 'is deletable' do
53
+ @gallery.deletable.should == true
54
+ end
58
55
 
59
- describe 'associations and inheritance' do
60
- #
61
- # MovGallery < Content
62
- #
63
- it 'is Content child' do
64
- expect(subject).to be_a_kind_of Content
56
+ it 'is active' do
57
+ @gallery.active.should == true
58
+ end
65
59
  end
66
60
 
67
- it "should have many data_files" do
68
- association = MovGallery.reflect_on_association(:data_files)
69
- association.macro.should == :has_many
70
- end
61
+ describe 'associations and inheritance' do
62
+ #
63
+ # MovGallery < Content
64
+ #
65
+ it 'is Content child' do
66
+ expect(subject).to be_a_kind_of Content
67
+ end
71
68
 
72
- it "should have many menus" do
73
- association = MovGallery.reflect_on_association(:menus)
74
- association.macro.should == :has_many
75
- end
69
+ it "should have many data_files" do
70
+ association = MovGallery.reflect_on_association(:data_files)
71
+ association.macro.should == :has_many
72
+ end
76
73
 
77
- it "should have many content_links" do
78
- association = MovGallery.reflect_on_association(:content_links)
79
- association.macro.should == :has_many
80
- end
81
- end
74
+ it "should have many menus" do
75
+ association = MovGallery.reflect_on_association(:menus)
76
+ association.macro.should == :has_many
77
+ end
82
78
 
83
- it 'has default_data_file saved as model reference' do
84
- gallery = MovGallery.new
85
- gallery.default_data_file.should_not == "Youtube"
86
- gallery.default_data_file.should == Youtube
87
- end
79
+ it "should have many content_links" do
80
+ association = MovGallery.reflect_on_association(:content_links)
81
+ association.macro.should == :has_many
82
+ end
83
+ end
88
84
 
89
- describe 'data_files' do
90
- it 'saves association with data_file' do
91
- gallery = MovGallery.new(:title => "test")
92
- gallery.data_files.build(data_file: "test.png", name: "Test")
93
- gallery.save!
94
- expect(DataFile).to have(1).records
85
+ it 'has default_data_file saved as model reference' do
86
+ gallery = MovGallery.new
87
+ gallery.default_data_file.should_not == "Youtube"
88
+ gallery.default_data_file.should == Youtube
95
89
  end
96
90
 
97
- it 'does not save association without data_file' do
98
- content = MovGallery.new(:title => "test")
99
- content.save!
100
- expect(DataFile).to have(0).records
91
+ describe 'data_files' do
92
+ it 'saves association with data_file' do
93
+ gallery = MovGallery.new(:title => "test")
94
+ gallery.data_files.build(data_file: "test.png", name: "Test")
95
+ gallery.save!
96
+ expect(DataFile).to have(1).records
97
+ end
98
+
99
+ it 'does not save association without data_file' do
100
+ content = MovGallery.new(:title => "test")
101
+ content.save!
102
+ expect(DataFile).to have(0).records
103
+ end
101
104
  end
102
105
  end
103
- end
106
+ end
@@ -25,79 +25,82 @@
25
25
 
26
26
  require 'spec_helper'
27
27
 
28
- describe PicGallery do
28
+ module Mokio
29
29
 
30
- describe 'defaults' do
31
- before(:each) do
32
- @gallery = PicGallery.new
33
- end
30
+ describe PicGallery do
34
31
 
35
- it 'has PicGallery type' do
36
- @gallery.type.should == "PicGallery"
37
- end
32
+ describe 'defaults' do
33
+ before(:each) do
34
+ @gallery = PicGallery.new
35
+ end
38
36
 
39
- it 'is invalid without title' do
40
- @gallery.should_not be_valid
41
- end
37
+ it 'has PicGallery type' do
38
+ @gallery.type.should == "Mokio::PicGallery"
39
+ end
42
40
 
43
- #
44
- # default added PicGallery have to have this values
45
- #
46
- it 'is editable' do
47
- @gallery.editable.should == true
48
- end
41
+ it 'is invalid without title' do
42
+ @gallery.should_not be_valid
43
+ end
49
44
 
50
- it 'is deletable' do
51
- @gallery.deletable.should == true
52
- end
45
+ #
46
+ # default added PicGallery have to have this values
47
+ #
48
+ it 'is editable' do
49
+ @gallery.editable.should == true
50
+ end
53
51
 
54
- it 'is active' do
55
- @gallery.active.should == true
56
- end
57
- end
52
+ it 'is deletable' do
53
+ @gallery.deletable.should == true
54
+ end
58
55
 
59
- describe 'associations and inheritance' do
60
- #
61
- # PicGallery < Content
62
- #
63
- it 'is Content child' do
64
- expect(subject).to be_a_kind_of Content
56
+ it 'is active' do
57
+ @gallery.active.should == true
58
+ end
65
59
  end
66
60
 
67
- it "should have many data_files" do
68
- association = PicGallery.reflect_on_association(:data_files)
69
- association.macro.should == :has_many
70
- end
61
+ describe 'associations and inheritance' do
62
+ #
63
+ # PicGallery < Content
64
+ #
65
+ it 'is Content child' do
66
+ expect(subject).to be_a_kind_of Content
67
+ end
71
68
 
72
- it "should have many menus" do
73
- association = PicGallery.reflect_on_association(:menus)
74
- association.macro.should == :has_many
75
- end
69
+ it "should have many data_files" do
70
+ association = PicGallery.reflect_on_association(:data_files)
71
+ association.macro.should == :has_many
72
+ end
76
73
 
77
- it "should have many content_links" do
78
- association = PicGallery.reflect_on_association(:content_links)
79
- association.macro.should == :has_many
80
- end
81
- end
74
+ it "should have many menus" do
75
+ association = PicGallery.reflect_on_association(:menus)
76
+ association.macro.should == :has_many
77
+ end
82
78
 
83
- it 'has default_data_file saved as model reference' do
84
- gallery = PicGallery.new
85
- gallery.default_data_file.should_not == "Photo"
86
- gallery.default_data_file.should == Photo
87
- end
79
+ it "should have many content_links" do
80
+ association = PicGallery.reflect_on_association(:content_links)
81
+ association.macro.should == :has_many
82
+ end
83
+ end
88
84
 
89
- describe 'data_files' do
90
- it 'saves association with data_file' do
91
- gallery = PicGallery.new(:title => "test")
92
- gallery.data_files.build(data_file: "test.png", name: "Test")
93
- gallery.save!
94
- expect(DataFile).to have(1).records
85
+ it 'has default_data_file saved as model reference' do
86
+ gallery = PicGallery.new
87
+ gallery.default_data_file.should_not == "Photo"
88
+ gallery.default_data_file.should == Photo
95
89
  end
96
90
 
97
- it 'does not save association without data_file' do
98
- content = PicGallery.new(:title => "test")
99
- content.save!
100
- expect(DataFile).to have(0).records
91
+ describe 'data_files' do
92
+ it 'saves association with data_file' do
93
+ gallery = PicGallery.new(:title => "test")
94
+ gallery.data_files.build(data_file: "test.png", name: "Test")
95
+ gallery.save!
96
+ expect(DataFile).to have(1).records
97
+ end
98
+
99
+ it 'does not save association without data_file' do
100
+ content = PicGallery.new(:title => "test")
101
+ content.save!
102
+ expect(DataFile).to have(0).records
103
+ end
101
104
  end
102
105
  end
103
- end
106
+ end
@@ -11,7 +11,8 @@
11
11
  #
12
12
 
13
13
  require 'spec_helper'
14
-
15
- describe Recipient do
16
- pending "add some examples to (or delete) #{__FILE__}"
17
- end
14
+ module Mokio
15
+ describe Recipient do
16
+ pending "add some examples to (or delete) #{__FILE__}"
17
+ end
18
+ end
@@ -12,102 +12,86 @@
12
12
 
13
13
  require 'spec_helper'
14
14
 
15
- describe SelectedModule do
15
+ module Mokio
16
16
 
17
- before(:each) do
18
- @menu = FactoryGirl.create(:menu)
19
- @position = FactoryGirl.create(:module_position)
20
- @static_module = FactoryGirl.create(:static_module, :module_position_ids => [@position.id])
21
- end
17
+ describe SelectedModule do
22
18
 
23
- it "adds properly new selected module to men" do
24
- av_mod = AvailableModule.first #?
25
- @menu.available_modules << av_mod
26
- @menu.save
27
- expect(SelectedModule).to have(1).records
28
- expect(@menu.available_modules.size).to eq(1)
29
- end
19
+ before(:each) do
20
+ @menu = FactoryGirl.create(:menu)
21
+ @position = FactoryGirl.create(:module_position)
22
+ @static_module = FactoryGirl.create(:static_module, :module_position_ids => [@position.id])
23
+ end
30
24
 
31
- it "removes properly selected module from menu" do
32
- av_mod = AvailableModule.first
33
- @menu.available_modules.delete(av_mod)
34
- @menu.save
35
- expect(SelectedModule).to have(0).records
36
- expect(@menu.available_modules.size).to eq(0)
37
- end
25
+ it "adds properly new selected module to men" do
26
+ av_mod = AvailableModule.first #?
27
+ @menu.available_modules << av_mod
28
+ @menu.save
29
+ expect(SelectedModule).to have(1).records
30
+ expect(@menu.available_modules.size).to eq(1)
31
+ end
38
32
 
39
-
40
- # it "counts only records that match a query" do
41
- # Menu.create!(:name => "Uuups")
42
- # expect(Menu.where(:name => "Uuups")).to have(1).record
43
- # expect(Menu.where(:name => "Eeeee")).to have(0).records
44
- # end
33
+ it "removes properly selected module from menu" do
34
+ av_mod = AvailableModule.first
35
+ @menu.available_modules.delete(av_mod)
36
+ @menu.save
37
+ expect(SelectedModule).to have(0).records
38
+ expect(@menu.available_modules.size).to eq(0)
39
+ end
45
40
 
46
- # it "saves parent" do
47
- # @parent = Menu.create!(:name => "Parent")
48
- # Menu.create!(:name => "Child", :parent => Menu.create!(:name => "Parent"))
49
- # @parent = Menu.where(:name => "Parent").first
50
- # @child = Menu.where(:name => "Child").first
51
- # expect(@parent.children.include?(@child))
52
- # end
53
- # it "validates presence of name" do
54
- # @menu = Menu.new(:name => "", :id => -1)
55
- # @menu.should_not be_valid
56
- # end
57
41
 
58
- # it "saves error for empty name" do
59
- # @menu = Menu.new(:name => "", :id => -1)
60
- # begin
61
- # @menu.save
62
- # rescue
63
- # end
64
- # @menu.errors.should_not be_empty
65
-
66
- # end
42
+ it "counts only records that match a query" do
43
+ FactoryGirl.create(:menu, :name => "Uuups")
44
+ expect(Menu.where(:name => "Uuups")).to have(1).record
45
+ expect(Menu.where(:name => "Eeeee")).to have(0).records
46
+ end
67
47
 
68
- # it "validates if lang matches parent" do
69
- # @parent = Menu.new(:name => "Parent", :lang_id => 1)
70
- # @parent.save
71
- # @menu = Menu.new(:name => "Child", :parent_id => @parent.id, :lang_id => 2)
72
- # @menu.should_not be_valid
73
- # end
48
+ it "saves parent" do
49
+ @parent = FactoryGirl.create(:menu, :name => "Parent")
50
+ FactoryGirl.create(:menu, :name => "Child", :parent => @parent)
51
+ @parent = Menu.where(:name => "Parent").first
52
+ @child = Menu.where(:name => "Child").first
53
+ expect(@parent.children.include?(@child))
54
+ end
55
+ it "validates presence of name" do
56
+ @menu = Menu.new(:name => "", :id => -1)
57
+ @menu.should_not be_valid
58
+ end
74
59
 
75
- # it "saves error for not matching parent and lang" do
76
- # @parent = Menu.new(:name => "Parent", :lang_id => 1)
77
- # @parent.save
78
- # @menu = Menu.new(:name => "Child", :parent_id => @parent.id, :lang_id => 2)
79
- # begin
80
- # @menu.save
81
- # rescue
82
- # end
83
- # @menu.errors.should_not be_empty
84
-
85
- # end
60
+ it "saves error for empty name" do
61
+ @menu = Menu.new(:name => "", :id => -1)
62
+ begin
63
+ @menu.save
64
+ rescue
65
+ end
66
+ @menu.errors.should_not be_empty
86
67
 
87
- # it "has many contents" do
88
- # @menu = Menu.new(:name => "Child777", :parent_id => 1, :lang_id => 1)
89
- # @content = Content.new(:title => "Art")
90
- # @content.save
91
- # @menu.contents << @content
92
- # @menu.save
93
- # @menu1 = Menu.find(@menu.id)
94
- # @menu1.contents.size.should eq(1)
95
- # @menu1.contents[0].title.should eq("Art")
96
- # end
68
+ end
97
69
 
98
- # describe 'has and belongs to many contents' do
99
-
100
- # it 'reflect on association' do
101
- # menu = Menu.reflect_on_association(:contents)
102
- # menu.macro.should == :has_many
103
- # end
70
+ it "has many contents" do
71
+ @menu = Menu.new(:name => "Child777", :parent_id => 1, :lang_id => 1)
72
+ @content = Content.new(:title => "Art")
73
+ @content.save
74
+ @menu.contents << @content
75
+ @menu.save
76
+ @menu1 = Menu.find(@menu.id)
77
+ @menu1.contents.size.should eq(1)
78
+ @menu1.contents[0].title.should eq("Art")
79
+ end
104
80
 
105
- # it 'properly saves contents for menu' do
106
- # @content = FactoryGirl.create(:content)
107
- # @menu = FactoryGirl.create(:menu, :content_ids => [@content.id])
108
- # @menu.reload
109
- # @menu.contents.count.should eq(1)
110
- # @content.menus.count.should eq(1)
111
- # end
112
- # end
113
- end
81
+ # describe 'has and belongs to many contents' do
82
+
83
+ # it 'reflect on association' do
84
+ # menu = Menu.reflect_on_association(:contents)
85
+ # menu.macro.should == :has_many
86
+ # end
87
+
88
+ # it 'properly saves contents for menu' do
89
+ # @content = FactoryGirl.create(:content)
90
+ # @menu = FactoryGirl.create(:menu, :content_ids => [@content.id])
91
+ # @menu.reload
92
+ # @menu.contents.count.should eq(1)
93
+ # @content.menus.count.should eq(1)
94
+ # end
95
+ # end
96
+ end
97
+ end