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
@@ -1,159 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
4
-
5
- # This spec was generated by rspec-rails when you ran the scaffold generator.
6
- # It demonstrates how one might use RSpec to specify the controller code that
7
- # was generated by Rails when you ran the scaffold generator.
8
- #
9
- # It assumes that the implementation code is generated by the rails scaffold
10
- # generator. If you are using any extension libraries to generate different
11
- # controller code, this generated spec may or may not pass.
12
- #
13
- # It only uses APIs available in rails and/or rspec-rails. There are a number
14
- # of tools you can use to make these specs even more expressive, but we're
15
- # sticking to rails and rspec-rails APIs to keep things simple and stable.
16
- #
17
- # Compared to earlier versions of this generator, there is very limited use of
18
- # stubs and message expectations in this spec. Stubs are only used when there
19
- # is no simpler way to get a handle on the object needed for the example.
20
- # Message expectations are only used when there is no simpler way to specify
21
- # that an instance is receiving a specific message.
22
-
23
- describe Mokio::Backend::StaticModulesController do
24
-
25
- # This should return the minimal set of attributes required to create a valid
26
- # StaticModule. As you add validations to StaticModule, be sure to
27
- # adjust the attributes here as well.
28
- let(:valid_attributes) { { :title => "tytuł" } }
29
-
30
- # This should return the minimal set of values that should be in the session
31
- # in order to pass any filters (e.g. authentication) defined in
32
- # StaticModulesController. Be sure to keep this updated too.
33
- let(:valid_session) { { "title" => "test" } }
34
-
35
- # describe "GET index" do
36
- # it "assigns all static_modules as @static_modules" do
37
- # static_module = StaticModule.create! valid_attributes
38
- # get :index, {}, valid_session
39
- # assigns(:static_module).should eq([static_module])
40
- # end
41
- # end
42
-
43
- before :each do
44
- request.env["HTTP_REFERER"] = backend_static_modules_path
45
- end
46
-
47
-
48
- describe "GET new" do
49
- it "assigns a new static_module as @static_module" do
50
- get :new, {}, valid_session
51
- assigns(:static_module).should be_a_new(StaticModule)
52
- end
53
- end
54
-
55
- describe "GET edit" do
56
- it "assigns the requested static_module as @static_module" do
57
- static_module = StaticModule.create! valid_attributes
58
- get :edit, {:id => static_module.to_param}, valid_session
59
- assigns(:static_module).should eq(static_module)
60
- end
61
- end
62
-
63
- describe "POST create" do
64
- describe "with valid params" do
65
- it "creates a new StaticModule" do
66
- expect {
67
- post :create, {:static_module => valid_attributes, :save_and_new => 1}, valid_session
68
- }.to change(StaticModule, :count).by(1)
69
- end
70
-
71
- it "assigns a newly created static_module as @static_module" do
72
- post :create, {:static_module => valid_attributes, :save_and_new => 1}, valid_session
73
- assigns(:static_module).should be_a(StaticModule)
74
- assigns(:static_module).should be_persisted
75
- end
76
-
77
- it "redirects to index" do
78
- post :create, {:static_module => valid_attributes}, valid_session
79
- response.should redirect_to(backend_static_modules_url)
80
- end
81
- end
82
-
83
- describe "with invalid params" do
84
- it "assigns a newly created but unsaved static_module as @static_module" do
85
- # Trigger the behavior that occurs when invalid params are submitted
86
- StaticModule.any_instance.stub(:save).and_return(false)
87
- post :create, {:static_module => { }, :save_and_new => 1}, valid_session
88
- assigns(:static_module).should be_a_new(StaticModule)
89
- end
90
-
91
- it "re-renders the 'new' template" do
92
- # Trigger the behavior that occurs when invalid params are submitted
93
- StaticModule.any_instance.stub(:save).and_return(false)
94
- post :create, {:static_module => { }, :save_and_new => 1}, valid_session
95
- response.should render_template("new")
96
- end
97
- end
98
- end
99
-
100
- describe "PUT update" do
101
- describe "with valid params" do
102
- it "updates the requested static_module" do
103
- static_module = StaticModule.create! valid_attributes
104
- # Assuming there are no other static_modules in the database, this
105
- # specifies that the StaticModule created on the previous line
106
- # receives the :update_attributes message with whatever params are
107
- # submitted in the request.
108
- StaticModule.any_instance.should_receive(:update).with(valid_session)
109
- put :update, {:id => static_module.to_param, :static_module => valid_session, :save_and_new => 1}, valid_session
110
- end
111
-
112
- it "assigns the requested static_module as @static_module" do
113
- static_module = StaticModule.create! valid_attributes
114
- put :update, {:id => static_module.to_param, :static_module => valid_attributes, :save_and_new => 1}, valid_session
115
- assigns(:static_module).should eq(static_module)
116
- end
117
-
118
- it "redirects to index" do
119
- static_module = StaticModule.create! valid_attributes
120
- put :update, {:id => static_module.to_param, :static_module => valid_attributes}, valid_session
121
- response.should redirect_to(backend_static_modules_url)
122
- end
123
- end
124
-
125
- describe "with invalid params" do
126
- it "assigns the static_module as @static_module" do
127
- static_module = StaticModule.create! valid_attributes
128
- # Trigger the behavior that occurs when invalid params are submitted
129
- StaticModule.any_instance.stub(:save).and_return(false)
130
- put :update, {:id => static_module.to_param, :static_module => { }, :save_and_new => 1}, valid_session
131
- assigns(:static_module).should eq(static_module)
132
- end
133
-
134
- it "re-renders the 'edit' template" do
135
- static_module = StaticModule.create! valid_attributes
136
- # Trigger the behavior that occurs when invalid params are submitted
137
- StaticModule.any_instance.stub(:save).and_return(false)
138
- put :update, {:id => static_module.to_param, :static_module => { }, :save_and_new => 1}, valid_session
139
- response.should render_template("edit")
140
- end
141
- end
142
- end
143
-
144
- describe "DELETE destroy" do
145
- it "destroys the requested static_module" do
146
- static_module = StaticModule.create! valid_attributes
147
- expect {
148
- delete :destroy, {:id => static_module.to_param}, valid_session
149
- }.to change(StaticModule, :count).by(-1)
150
- end
151
-
152
- it "redirects to the static_modules list" do
153
- static_module = StaticModule.create! valid_attributes
154
- delete :destroy, {:id => static_module.to_param}, valid_session
155
- response.should redirect_to(backend_static_modules_url)
156
- end
157
- end
158
-
159
- end
@@ -1,17 +0,0 @@
1
- # == Schema Information
2
- #
3
- # Table name: tags
4
- #
5
- # id :integer not null, primary key
6
- # tag :string(255)
7
- # content_id :string(255)
8
- # created_at :datetime
9
- # updated_at :datetime
10
- #
11
-
12
- # Read about factories at https://github.com/thoughtbot/factory_girl
13
-
14
- FactoryGirl.define do
15
- factory :tag do
16
- end
17
- end
@@ -1,137 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mokio::Backend::CommonHelper do
4
- before(:each) do
5
- helper.extend Haml
6
- helper.extend Haml::Helpers
7
- helper.send :init_haml_helpers
8
- end
9
-
10
- describe "buttons" do
11
- describe 'table_controls_edit_btn' do
12
- before(:each) do
13
- @btn = helper.table_controls_edit_btn("link")
14
- end
15
-
16
- it 'creates link' do
17
- @btn.should =~ /href='link'/
18
- end
19
-
20
- it 'has edit title' do
21
- title = helper.bt("edit")
22
- @btn.should match("title='#{title}'")
23
- end
24
-
25
- it 'creates button' do
26
- @btn.should =~ /<span class='icon12 icomoon-icon-pencil'><\/span>/
27
- end
28
- end
29
-
30
- describe 'table_controls_delete_btn' do
31
- before(:each) do
32
- @btn = helper.table_controls_delete_btn("link")
33
- end
34
-
35
- it 'creates link' do
36
- @btn.should =~ /href='link'/
37
- end
38
-
39
- it 'has delete title' do
40
- title = helper.bt("delete")
41
- @btn.should match("title='#{title}'")
42
- end
43
-
44
- it 'creates button' do
45
- @btn.should =~ /<span class='icon12 icomoon-icon-remove'><\/span>/
46
- end
47
- end
48
-
49
- describe 'table_controls_copy_btn' do
50
- before(:each) do
51
- @btn = helper.table_controls_copy_btn("link")
52
- end
53
-
54
- it 'creates link' do
55
- @btn.should =~ /href='link'/
56
- end
57
-
58
- it 'has copy title' do
59
- title = helper.bt("copy")
60
- @btn.should match("title='#{title}'")
61
- end
62
-
63
- it 'creates button' do
64
- @btn.should =~ /<span class='icon12 icomoon-icon-copy-2'><\/span>/
65
- end
66
- end
67
-
68
- describe 'btn_new' do
69
- before(:each) do
70
- @btn = helper.btn_new("name", "link")
71
- end
72
-
73
- it 'creates link' do
74
- @btn.should =~ /href='link'/
75
- end
76
-
77
- it 'creates button' do
78
- @btn.should =~ /<button class='btn btn-primary btn-mini'>/
79
- end
80
-
81
- it 'place name inside button' do
82
- @btn.should =~ /[button].[name].[\/button]/
83
- end
84
- end
85
-
86
- describe 'btn_submit' do
87
- before(:each) do
88
- @btn = helper.btn_submit("name")
89
- end
90
-
91
- it 'is submit type' do
92
- @btn.should =~ /type='submit'/
93
- end
94
-
95
- it 'creates button' do
96
- @btn.should =~ /<button class='btn btn-primary'/
97
- end
98
-
99
- it 'place name inside button' do
100
- @btn.should =~ /[button].[name].[\/button]/
101
- end
102
- end
103
-
104
- describe 'btn_cancel' do
105
- before(:each) do
106
- @btn = helper.btn_cancel("link")
107
- end
108
-
109
- it 'creates link' do
110
- @btn.should =~ /href='link'/
111
- end
112
-
113
- it 'creates button' do
114
- @btn.should =~ /<a class='btn'/
115
- end
116
-
117
- it 'has cancel name' do
118
- name = helper.bt("cancel")
119
- @btn.should =~ /#{name}/
120
- end
121
- end
122
-
123
- describe 'active_button' do
124
- before(:each) do
125
- @btn = helper.active_button
126
- end
127
-
128
- it 'creates input' do
129
- @btn.should =~ /<input/
130
- end
131
-
132
- it 'is checked' do
133
- @btn.should =~ /checked='checked'/
134
- end
135
- end
136
- end
137
- end
@@ -1,64 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Mokio::Backend::MenuHelper do
4
-
5
- before(:each) do
6
- @menu = stub_model Menu, :name =>"Testtttt"
7
- @menu1 = stub_model Menu, :parent => @menu, :name => "Ala"
8
- helper.extend Haml
9
- helper.extend Haml::Helpers
10
- helper.send :init_haml_helpers
11
- end
12
-
13
- # describe "tree_menu" do
14
-
15
- # it "generates empty menu html" do
16
- # expect(tree_menu({}, true)).to eql("")
17
- # end
18
-
19
- # it "generates menu with href to menus" do
20
- # @tree = tree_menu({@menu => {@menu1 => {}}}, true)
21
- # expect(@tree).to include('<a href="/backend/menus/')
22
- # expect(@tree.match("Testtttt").size).to eql(1)
23
- # end
24
-
25
- # it "generates menu with ol and li elements" do
26
- # @tree = tree_menu({@menu => {@menu1 => {}}}, true)
27
- # expect(@tree).to include('<li class="sortable_true"')
28
- # @tree.should match(/<li.*<div.*Testtttt.*<\/div>.*<ol>.*<\/ol>.*<\/li>.*/xm)
29
- # end
30
- # end
31
-
32
- # describe "tree_menu_breadcrumb" do
33
-
34
- # it "generates empty list for new menu" do
35
- # @menu2 = Menu.new
36
- # expect(tree_menu_breadcrumps(@menu2)).to eql("")
37
- # end
38
-
39
- # it "generates menu with -> and two names" do
40
- # @menu = Menu.find_by(:name => "Góra")
41
- # @tree = tree_menu_breadcrumps(@menu)
42
- # expect(@tree).to match(/<a href=.*\/a> -&gt; <a href=.*\/a>/)
43
- # end
44
- # end
45
-
46
- describe "dual_select_box" do
47
- it "selected_modules are properly renedered by helper" do
48
- mod_pos = FactoryGirl.create(:module_position)
49
- stat_module = FactoryGirl.create(:static_module)
50
- stat_module.module_positions = [mod_pos]
51
- stat_module.save
52
- stat_module = FactoryGirl.create(:static_module)
53
- stat_module.module_positions = [mod_pos]
54
- stat_module.save
55
- av_module = AvailableModule.first
56
- menu = Menu.new(:name => "Menu777", :parent_id => 1, :lang_id => 1)
57
- menu.available_modules << av_module
58
- menu.save
59
- @col_left = menu.available_modules_by_pos[mod_pos.id]
60
- @dual = helper.dual_select_box(@col_left, 'id', 'module_title', [av_module], 'id', 'module_title', mod_pos.name, '_' + mod_pos.id.to_s, 'menu[available_module_ids][]', false, true, true, menu.display_editable_field?('available_modules'))
61
- expect(@dual).to include(av_module.module_title)
62
- end
63
- end
64
- end