mcms_pages 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +40 -0
- data/app/assets/images/layouts/one-column.png +0 -0
- data/app/assets/images/layouts/three-column.png +0 -0
- data/app/assets/images/layouts/two-column-with-left.png +0 -0
- data/app/assets/images/layouts/two-column-with-right.png +0 -0
- data/app/assets/images/mcms_pages/9.jpg +0 -0
- data/app/assets/images/mcms_pages/background.jpg +0 -0
- data/app/assets/images/mcms_pages/bamboo_love.jpg +0 -0
- data/app/assets/images/mcms_pages/branch-end.gif +0 -0
- data/app/assets/images/mcms_pages/branch-start.gif +0 -0
- data/app/assets/images/mcms_pages/branch.gif +0 -0
- data/app/assets/images/mcms_pages/content_bottom.jpg +0 -0
- data/app/assets/images/mcms_pages/icons/accept.png +0 -0
- data/app/assets/images/mcms_pages/icons/add.png +0 -0
- data/app/assets/images/mcms_pages/icons/ajax-loader.gif +0 -0
- data/app/assets/images/mcms_pages/icons/application_edit.png +0 -0
- data/app/assets/images/mcms_pages/icons/application_go.png +0 -0
- data/app/assets/images/mcms_pages/icons/arrow_left.png +0 -0
- data/app/assets/images/mcms_pages/icons/arrow_switch.png +0 -0
- data/app/assets/images/mcms_pages/icons/arrow_up.png +0 -0
- data/app/assets/images/mcms_pages/icons/bin.png +0 -0
- data/app/assets/images/mcms_pages/icons/bin_closed.png +0 -0
- data/app/assets/images/mcms_pages/icons/cancel.png +0 -0
- data/app/assets/images/mcms_pages/icons/cog_add.png +0 -0
- data/app/assets/images/mcms_pages/icons/cog_edit.png +0 -0
- data/app/assets/images/mcms_pages/icons/cross.png +0 -0
- data/app/assets/images/mcms_pages/icons/delete.png +0 -0
- data/app/assets/images/mcms_pages/icons/doc.png +0 -0
- data/app/assets/images/mcms_pages/icons/down.gif +0 -0
- data/app/assets/images/mcms_pages/icons/edit.png +0 -0
- data/app/assets/images/mcms_pages/icons/email.png +0 -0
- data/app/assets/images/mcms_pages/icons/email_edit.png +0 -0
- data/app/assets/images/mcms_pages/icons/email_go.png +0 -0
- data/app/assets/images/mcms_pages/icons/email_open.png +0 -0
- data/app/assets/images/mcms_pages/icons/eye.png +0 -0
- data/app/assets/images/mcms_pages/icons/folder.png +0 -0
- data/app/assets/images/mcms_pages/icons/folder_open.png +0 -0
- data/app/assets/images/mcms_pages/icons/folder_page_white.png +0 -0
- data/app/assets/images/mcms_pages/icons/image_add.png +0 -0
- data/app/assets/images/mcms_pages/icons/image_edit.png +0 -0
- data/app/assets/images/mcms_pages/icons/img.png +0 -0
- data/app/assets/images/mcms_pages/icons/information.png +0 -0
- data/app/assets/images/mcms_pages/icons/layout_add.png +0 -0
- data/app/assets/images/mcms_pages/icons/layout_edit.png +0 -0
- data/app/assets/images/mcms_pages/icons/music.png +0 -0
- data/app/assets/images/mcms_pages/icons/page.png +0 -0
- data/app/assets/images/mcms_pages/icons/page_add.png +0 -0
- data/app/assets/images/mcms_pages/icons/page_edit.png +0 -0
- data/app/assets/images/mcms_pages/icons/page_white_edit.png +0 -0
- data/app/assets/images/mcms_pages/icons/page_white_gear.png +0 -0
- data/app/assets/images/mcms_pages/icons/page_white_put.png +0 -0
- data/app/assets/images/mcms_pages/icons/pdf.png +0 -0
- data/app/assets/images/mcms_pages/icons/ppt.png +0 -0
- data/app/assets/images/mcms_pages/icons/star.png +0 -0
- data/app/assets/images/mcms_pages/icons/tick.png +0 -0
- data/app/assets/images/mcms_pages/icons/up.gif +0 -0
- data/app/assets/images/mcms_pages/icons/user_add.png +0 -0
- data/app/assets/images/mcms_pages/icons/user_comment.png +0 -0
- data/app/assets/images/mcms_pages/icons/user_edit.png +0 -0
- data/app/assets/images/mcms_pages/icons/xls.png +0 -0
- data/app/assets/images/mcms_pages/icons/zip.png +0 -0
- data/app/assets/images/mcms_pages/icons/zoom.png +0 -0
- data/app/assets/images/mcms_pages/tab_off.jpg +0 -0
- data/app/assets/images/mcms_pages/tab_on.jpg +0 -0
- data/app/assets/javascripts/menuPage.js +45 -0
- data/app/assets/javascripts/pageFormAdmin.js +192 -0
- data/app/assets/stylesheets/mcms_pages/layout.css.scss +16 -0
- data/app/assets/stylesheets/mcms_pages/page_styles.css +95 -0
- data/app/assets/stylesheets/mcms_pages/pages.css.scss +172 -0
- data/app/controllers/admin/layouts_controller.rb +51 -0
- data/app/controllers/admin/pages_controller.rb +303 -0
- data/app/controllers/admin_controller.rb +22 -0
- data/app/controllers/application_controller.rb +20 -0
- data/app/controllers/pages_controller.rb +151 -0
- data/app/helpers/pages_helper.rb +118 -0
- data/app/models/ckeditor/asset.rb +8 -0
- data/app/models/ckeditor/attachment_file.rb +13 -0
- data/app/models/ckeditor/picture.rb +14 -0
- data/app/models/layout.rb +64 -0
- data/app/models/page.rb +152 -0
- data/app/models/page_part.rb +99 -0
- data/app/models/page_parts_page.rb +52 -0
- data/app/views/mcms_pages/admin/layouts/index.html.erb +54 -0
- data/app/views/mcms_pages/admin/pages/_action.html.erb +19 -0
- data/app/views/mcms_pages/admin/pages/_error_messages.html.erb +42 -0
- data/app/views/mcms_pages/admin/pages/_form.html.erb +90 -0
- data/app/views/mcms_pages/admin/pages/_form.js.erb +55 -0
- data/app/views/mcms_pages/admin/pages/_page.html.erb +63 -0
- data/app/views/mcms_pages/admin/pages/_page_part_edit_form.html.erb +140 -0
- data/app/views/mcms_pages/admin/pages/_page_part_form.html.erb +133 -0
- data/app/views/mcms_pages/admin/pages/_page_part_form_field.html.erb +21 -0
- data/app/views/mcms_pages/admin/pages/_page_part_page_form_field.html.erb +39 -0
- data/app/views/mcms_pages/admin/pages/add_page_part.js.erb +25 -0
- data/app/views/mcms_pages/admin/pages/edit.html.erb +15 -0
- data/app/views/mcms_pages/admin/pages/find_child.html.erb +15 -0
- data/app/views/mcms_pages/admin/pages/index.html.erb +26 -0
- data/app/views/mcms_pages/admin/pages/new.html.erb +15 -0
- data/app/views/mcms_pages/layouts/_footer.html.erb +16 -0
- data/app/views/mcms_pages/layouts/_header.html.erb +16 -0
- data/app/views/mcms_pages/layouts/_javascript.html.erb +22 -0
- data/app/views/mcms_pages/layouts/_stylesheets.html.erb +23 -0
- data/app/views/mcms_pages/layouts/mcms_layout.html.erb +39 -0
- data/app/views/mcms_pages/pages/_left_side_body.html.erb +16 -0
- data/app/views/mcms_pages/pages/_main_body.html.erb +16 -0
- data/app/views/mcms_pages/pages/_menu.html.erb +18 -0
- data/app/views/mcms_pages/pages/_menubar.html.erb +24 -0
- data/app/views/mcms_pages/pages/_one_column_layout.html.erb +14 -0
- data/app/views/mcms_pages/pages/_right_side_body.html.erb +16 -0
- data/app/views/mcms_pages/pages/_three_column_layout.html.erb +20 -0
- data/app/views/mcms_pages/pages/_two_column_layout.html.erb +27 -0
- data/app/views/mcms_pages/pages/home.html.erb +26 -0
- data/app/views/mcms_pages/pages/show.html.erb +34 -0
- data/config/routes.rb +57 -0
- data/db/migrate/20120605100629_create_pages.rb +17 -0
- data/db/migrate/20120605100650_create_page_parts.rb +10 -0
- data/db/migrate/20120606150655_create_mcms_assets.rb +26 -0
- data/db/migrate/20120606150656_add_title_position_to_page_parts.rb +5 -0
- data/db/migrate/20120609055514_add_parent_id_to_pages.rb +5 -0
- data/db/migrate/20120612054659_add_lft_rgt_to_mcms_pages.rb +6 -0
- data/db/migrate/20120614125619_create_layouts.rb +16 -0
- data/db/migrate/20120614131633_add_layout_id_to_mcms_pages.rb +5 -0
- data/db/migrate/20120614134343_add_foreign_key_to_page.rb +6 -0
- data/db/migrate/20120618060815_drop_column_permalink_from_mcms_pages.rb +10 -0
- data/db/migrate/20120618102226_add_slug_to_mcms_pages.rb +6 -0
- data/db/migrate/20120625063039_create_page_associations.rb +14 -0
- data/db/migrate/20120625112225_add_header_footer_to_mcms_layouts.rb +6 -0
- data/db/seeds.rb +175 -0
- data/lib/generators/mcms_pages/USAGE +8 -0
- data/lib/generators/mcms_pages/assets_generator.rb +79 -0
- data/lib/generators/mcms_pages/mcms_pages_generator.rb +101 -0
- data/lib/generators/mcms_pages/templates/asset_manager.rb +160 -0
- data/lib/generators/mcms_pages/templates/ckeditor.rb +18 -0
- data/lib/generators/mcms_pages/views_generator.rb +79 -0
- data/lib/mcms_pages/engine.rb +13 -0
- data/lib/mcms_pages/version.rb +3 -0
- data/lib/mcms_pages.rb +7 -0
- data/lib/tasks/mcms_pages_tasks.rake +4 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/log/development.log +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/mcms_pages_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- metadata +360 -0
data/db/seeds.rb
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
@File Name : seeds.rb
|
4
|
+
@Company Name : Mindfire Solutions Private Limited
|
5
|
+
@Creator Name : Vikram Kumar Mishra
|
6
|
+
@Date Created : 2012-06-05
|
7
|
+
@Date Modified : 2012-06-19
|
8
|
+
@Last Modification Details : modified to create records in DB.
|
9
|
+
@Purpose : This file should contain all the record creation needed to seed the database with its default values,
|
10
|
+
The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
11
|
+
|
12
|
+
=end
|
13
|
+
|
14
|
+
if Layout.all.empty?
|
15
|
+
|
16
|
+
Layout.create({
|
17
|
+
|
18
|
+
:name => "one column",
|
19
|
+
:left => 0,
|
20
|
+
:right => 0,
|
21
|
+
:main => 1,
|
22
|
+
:header => 1,
|
23
|
+
:footer => 1,
|
24
|
+
:column_count => 1
|
25
|
+
|
26
|
+
})
|
27
|
+
Layout.create({
|
28
|
+
|
29
|
+
:name => "two column with right",
|
30
|
+
:left => 0,
|
31
|
+
:right => 1,
|
32
|
+
:main => 1,
|
33
|
+
:header => 1,
|
34
|
+
:footer => 1,
|
35
|
+
:column_count => 2
|
36
|
+
|
37
|
+
})
|
38
|
+
Layout.create({
|
39
|
+
|
40
|
+
:name => "two column with left",
|
41
|
+
:left => 1,
|
42
|
+
:right => 0,
|
43
|
+
:main => 1,
|
44
|
+
:header => 1,
|
45
|
+
:footer => 1,
|
46
|
+
:column_count => 2
|
47
|
+
|
48
|
+
})
|
49
|
+
Layout.create({
|
50
|
+
|
51
|
+
:name => "three column",
|
52
|
+
:left => 1,
|
53
|
+
:right => 1,
|
54
|
+
:main => 1,
|
55
|
+
:header => 1,
|
56
|
+
:footer => 1,
|
57
|
+
:column_count => 3
|
58
|
+
|
59
|
+
})
|
60
|
+
|
61
|
+
Layout.create({
|
62
|
+
|
63
|
+
:name => "default",
|
64
|
+
:left => 0,
|
65
|
+
:right => 0,
|
66
|
+
:main => 1,
|
67
|
+
:header => 0,
|
68
|
+
:footer => 0,
|
69
|
+
:column_count => 0
|
70
|
+
|
71
|
+
})
|
72
|
+
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
if Page.where(:link_url => "/").empty?
|
77
|
+
|
78
|
+
home_page = Page.create!({
|
79
|
+
|
80
|
+
:title => "Home",
|
81
|
+
:link_url => "/home",
|
82
|
+
:layout_id => "1"
|
83
|
+
|
84
|
+
})
|
85
|
+
|
86
|
+
home_page.page_parts.create({
|
87
|
+
|
88
|
+
:title => "header",
|
89
|
+
:body => "<p>Header Part of the page.</p>"
|
90
|
+
|
91
|
+
})
|
92
|
+
|
93
|
+
home_page.page_parts.create({
|
94
|
+
|
95
|
+
:title => "footer",
|
96
|
+
:body => "<p>Footer part of the page</p>"
|
97
|
+
|
98
|
+
})
|
99
|
+
|
100
|
+
home_page.page_parts.create({
|
101
|
+
|
102
|
+
:title => "main Body",
|
103
|
+
:body => "<p>Welcome to our site. This is just a place holder page while we gather our content.</p>"
|
104
|
+
|
105
|
+
})
|
106
|
+
|
107
|
+
|
108
|
+
page_not_found_page = home_page.children.create({
|
109
|
+
|
110
|
+
:title => "Page not found",
|
111
|
+
:link_url => "/404",
|
112
|
+
:show_in_menu => false,
|
113
|
+
:layout_id => "1",
|
114
|
+
:published => true
|
115
|
+
|
116
|
+
})
|
117
|
+
|
118
|
+
page_not_found_page.page_parts.create({
|
119
|
+
|
120
|
+
:title => "header",
|
121
|
+
:body => ""
|
122
|
+
|
123
|
+
})
|
124
|
+
|
125
|
+
page_not_found_page.page_parts.create({
|
126
|
+
|
127
|
+
:title => "footer",
|
128
|
+
:body => ""
|
129
|
+
|
130
|
+
})
|
131
|
+
|
132
|
+
page_not_found_page.page_parts.create({
|
133
|
+
|
134
|
+
:title => "main body",
|
135
|
+
:body => "<h2>Sorry, there was a problem...</h2><p>The page you requested was not found.</p><p><a href='/'>Return to the home page</a></p>"
|
136
|
+
|
137
|
+
})
|
138
|
+
end
|
139
|
+
|
140
|
+
if Page.find_by_title("About").nil?
|
141
|
+
|
142
|
+
about_us_page = Page.create({
|
143
|
+
|
144
|
+
:title => "About",
|
145
|
+
:layout_id => "1",
|
146
|
+
:published => "1",
|
147
|
+
:show_in_menu => "1"
|
148
|
+
|
149
|
+
})
|
150
|
+
|
151
|
+
about_us_page.page_parts.create({
|
152
|
+
|
153
|
+
:title => "header",
|
154
|
+
:body => "<p>Header Part of the page About.</p>"
|
155
|
+
})
|
156
|
+
|
157
|
+
about_us_page.page_parts.create({
|
158
|
+
|
159
|
+
:title => "footer",
|
160
|
+
:body => "<p>Footer part of the page About</p>"
|
161
|
+
|
162
|
+
})
|
163
|
+
|
164
|
+
about_us_page.page_parts.create({
|
165
|
+
|
166
|
+
:title => "main body",
|
167
|
+
:body => "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus fringilla nisi a elit.
|
168
|
+
Duis ultricies orci ut arcu. Ut ac nibh. Duis blandit rhoncus magna. Pellentesque semper risus ut magna.
|
169
|
+
Etiam pulvinar tellus eget diam. Morbi blandit. Donec pulvinar mauris at ligula. Sed pellentesque, ipsum id
|
170
|
+
congue molestie, lectus risus egestas pede, ac viverra diam lacus ac urna. Aenean elit.</p>"
|
171
|
+
|
172
|
+
})
|
173
|
+
|
174
|
+
end
|
175
|
+
|
@@ -0,0 +1,79 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
@File Name : assets_generator.rb
|
4
|
+
@Company Name : Mindfire Solutions Pvt. Ltd.
|
5
|
+
@Creator Name : Vikram Kumar Mishra
|
6
|
+
@Date Created : 2012-07-09
|
7
|
+
@Date Modified :
|
8
|
+
@Last Modification Details :
|
9
|
+
@Purpose : This file is responsible to install assets and views for mcms_pages module in other application/module
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
module McmsPages
|
14
|
+
|
15
|
+
module Generators
|
16
|
+
|
17
|
+
# To generate Pages views.
|
18
|
+
# copy_views` is the main method and by default copies all views
|
19
|
+
module AssetPathTemplates
|
20
|
+
extend ActiveSupport::Concern
|
21
|
+
|
22
|
+
included do
|
23
|
+
|
24
|
+
public_task :copy_assets
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
# @Params : None
|
29
|
+
# @Returns : None
|
30
|
+
# @Purpose : To copy stylesheets
|
31
|
+
def copy_assets
|
32
|
+
|
33
|
+
view_directory :mcms_pages
|
34
|
+
|
35
|
+
end # end method
|
36
|
+
|
37
|
+
protected
|
38
|
+
|
39
|
+
# @Params : None
|
40
|
+
# @Returns : None
|
41
|
+
# @Purpose : To define the source path to copy views
|
42
|
+
def view_directory(name, _target_path = nil)
|
43
|
+
|
44
|
+
directory name.to_s, _target_path || "#{target_path}/#{name}"
|
45
|
+
|
46
|
+
end # end method
|
47
|
+
|
48
|
+
# @Params : None
|
49
|
+
# @Returns : None
|
50
|
+
# @Purpose : To define the target path to copy views
|
51
|
+
def target_path
|
52
|
+
|
53
|
+
@target_path ||= "app/assets/stylesheets"
|
54
|
+
|
55
|
+
end # end method
|
56
|
+
|
57
|
+
end # end module ViewPathTemplates
|
58
|
+
|
59
|
+
|
60
|
+
class AssetsGenerator < Rails::Generators::Base
|
61
|
+
|
62
|
+
include AssetPathTemplates
|
63
|
+
source_root File.expand_path("../../../../app/assets/stylesheets", __FILE__)
|
64
|
+
|
65
|
+
# @Params : None
|
66
|
+
# @Returns : None
|
67
|
+
# @Purpose : Just to print a line on console
|
68
|
+
def install_assets
|
69
|
+
|
70
|
+
say "MCMS PAGES Assets created to your application."
|
71
|
+
|
72
|
+
end # end method
|
73
|
+
|
74
|
+
end # end class
|
75
|
+
|
76
|
+
end # end module Generators
|
77
|
+
|
78
|
+
end # end module McmsPages
|
79
|
+
|
@@ -0,0 +1,101 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
@File Name : mcms_pagesn_generator.rb
|
4
|
+
@Company Name : Mindfire Solutions Pvt. Ltd.
|
5
|
+
@Creator Name : Vikram Kumar Mishra
|
6
|
+
@Date Created : 2012-07-06
|
7
|
+
@Date Modified :
|
8
|
+
@Last Modification Details :
|
9
|
+
@Purpose : This file is responsible to install mcms_pages module in other application/module
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
class McmsPagesGenerator < Rails::Generators::NamedBase
|
14
|
+
source_root File.expand_path('../templates', __FILE__)
|
15
|
+
|
16
|
+
# @Params : None
|
17
|
+
# @Returns : None
|
18
|
+
# @Purpose : Just to print a line on console
|
19
|
+
def install_pages
|
20
|
+
|
21
|
+
say "Installing MCMS_PAGES MODULE"
|
22
|
+
|
23
|
+
end # end method
|
24
|
+
|
25
|
+
# @Params : None
|
26
|
+
# @Returns : None
|
27
|
+
# @Purpose : To Copy asset_manager from engine to app
|
28
|
+
def copy_asset_manager
|
29
|
+
|
30
|
+
#copy file lib/asset_manager.rb to app/lib/asset_manager.rb if it doesn't exists
|
31
|
+
copy_file "asset_manager.rb", "lib/asset_manager.rb" unless File.exists?(File.join(destination_root, 'lib', 'asset_manager.rb'))
|
32
|
+
|
33
|
+
|
34
|
+
end # end method
|
35
|
+
|
36
|
+
# @Params : None
|
37
|
+
# @Returns : None
|
38
|
+
# @Purpose : To Copy ckeditor initializer from engine to app
|
39
|
+
def copy_initializer
|
40
|
+
|
41
|
+
#copy file lib/asset_manager.rb to app/lib/asset_manager.rb if it doesn't exists
|
42
|
+
copy_file "ckeditor.rb", "config/initializers/ckeditor.rb" unless File.exists?(File.join(destination_root, 'config/initializers', 'ckeditor.rb'))
|
43
|
+
|
44
|
+
|
45
|
+
end # end method
|
46
|
+
|
47
|
+
# @Params : None
|
48
|
+
# @Returns : None
|
49
|
+
# @Purpose : To Copy all the migrations from db/migrate of engine to db/migrate of application
|
50
|
+
def add_migrations
|
51
|
+
|
52
|
+
say "copying migrations......."
|
53
|
+
|
54
|
+
# running command line command to copy engine's migration file
|
55
|
+
rake("mcms_pages_engine:install:migrations")
|
56
|
+
|
57
|
+
end # end method
|
58
|
+
|
59
|
+
# @Params : None
|
60
|
+
# @Returns : None
|
61
|
+
# @Purpose : To append seeds data from engine to app's seeds.rb
|
62
|
+
def append_seed_data
|
63
|
+
|
64
|
+
# create file deb/seeds.rb to parent app if not exists
|
65
|
+
create_file "db/seeds.rb" unless File.exists?(File.join(destination_root, 'db', 'seeds.rb'))
|
66
|
+
|
67
|
+
# append data to app's seeds.rb
|
68
|
+
append_file 'db/seeds.rb', :verbose => true do
|
69
|
+
|
70
|
+
<<-EOH
|
71
|
+
|
72
|
+
McmsPages::Engine.load_seed
|
73
|
+
|
74
|
+
EOH
|
75
|
+
|
76
|
+
end # end block
|
77
|
+
|
78
|
+
end # end method
|
79
|
+
|
80
|
+
|
81
|
+
# @Params : None
|
82
|
+
# @Returns : None
|
83
|
+
# @Purpose : To prompt user for some instrctions on console
|
84
|
+
def prompt_user
|
85
|
+
|
86
|
+
say "\ndon't forget to run the following \n
|
87
|
+
|
88
|
+
rake db:migrate\n
|
89
|
+
|
90
|
+
rake db:seed\n
|
91
|
+
|
92
|
+
Add the line\n\n\t\t root :to => 'pages#home'\n\n\t in config/routes.rb file \n
|
93
|
+
|
94
|
+
start the rails server and hit the url http://localhost:3000/mcms/pages\n
|
95
|
+
|
96
|
+
Yay!\n\n"
|
97
|
+
|
98
|
+
end# end method
|
99
|
+
|
100
|
+
end
|
101
|
+
|
@@ -0,0 +1,160 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
@File Name : lib/asset_manager.rb
|
4
|
+
@Company Name : Mindfire Solutions Private Limited
|
5
|
+
@Creator Name : Vikram Kumar Mishra
|
6
|
+
@Date Created : 2012-06-09
|
7
|
+
@Date Modified :
|
8
|
+
@Last Modification Details :
|
9
|
+
@Purpose : To include controller action specific JS and CSS.
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
class AssetManager
|
14
|
+
|
15
|
+
# @param = mixed
|
16
|
+
# @return = none
|
17
|
+
# To include individual CSS file
|
18
|
+
def self.include_css file
|
19
|
+
|
20
|
+
# if param is of type Array
|
21
|
+
if file.class == Array
|
22
|
+
|
23
|
+
# loop through the param and include all files one by one
|
24
|
+
file.each do |f|
|
25
|
+
|
26
|
+
#calling include_css_file_individual to include css file
|
27
|
+
include_css_file_individual f
|
28
|
+
|
29
|
+
end # end each loop
|
30
|
+
|
31
|
+
else
|
32
|
+
|
33
|
+
#calling include_css_file_individual to include css file
|
34
|
+
include_css_file_individual file
|
35
|
+
|
36
|
+
end # end if
|
37
|
+
|
38
|
+
end # end class method include_css
|
39
|
+
|
40
|
+
# @param = mixed
|
41
|
+
# @return = none
|
42
|
+
# TO include all JS file
|
43
|
+
def self.include_local_library library
|
44
|
+
|
45
|
+
#calling include_js_library to include specific JS files
|
46
|
+
include_js_library library, :local
|
47
|
+
|
48
|
+
end # end class method include_local_library
|
49
|
+
|
50
|
+
# @params = mixed(JS files) and type of library
|
51
|
+
# @return = none
|
52
|
+
# To include JS files
|
53
|
+
def self.include_js_library library, type = :local
|
54
|
+
|
55
|
+
#if param is of type array
|
56
|
+
if library.class == Array
|
57
|
+
|
58
|
+
# loop through the param and include all JS files one by one
|
59
|
+
library.each do |l|
|
60
|
+
|
61
|
+
#calling include_js_library_individual to include js file
|
62
|
+
include_js_library_individual l, type
|
63
|
+
|
64
|
+
end # end each loop
|
65
|
+
|
66
|
+
else
|
67
|
+
|
68
|
+
#calling include_js_library_individual to include js file
|
69
|
+
include_js_library_individual library, type
|
70
|
+
|
71
|
+
end # end if
|
72
|
+
|
73
|
+
end # end class method include_js_library
|
74
|
+
|
75
|
+
|
76
|
+
# @param = none
|
77
|
+
# @return = Array
|
78
|
+
def self.get_libraries
|
79
|
+
|
80
|
+
# return class array
|
81
|
+
return @@js_includes
|
82
|
+
|
83
|
+
end # end class method get_libraries
|
84
|
+
|
85
|
+
# @param = none
|
86
|
+
# @return = Array
|
87
|
+
def self.get_css
|
88
|
+
|
89
|
+
# return class array
|
90
|
+
return @@css_includes
|
91
|
+
|
92
|
+
end # end class method get_css
|
93
|
+
|
94
|
+
|
95
|
+
# declaring private section to be visible within the class only
|
96
|
+
private
|
97
|
+
|
98
|
+
# declaring class variable of type array
|
99
|
+
@@js_includes = []
|
100
|
+
@@css_includes = []
|
101
|
+
|
102
|
+
|
103
|
+
def self.include_js_library_individual library, type
|
104
|
+
|
105
|
+
# declare a local variable of type string with empty value
|
106
|
+
file = ""
|
107
|
+
|
108
|
+
# checking the type of param name type
|
109
|
+
case type
|
110
|
+
|
111
|
+
when :local # when it is local
|
112
|
+
|
113
|
+
# check if the class of param library is symbol
|
114
|
+
if library.class == Symbol
|
115
|
+
|
116
|
+
# convert symbols into string and assign it to variable file
|
117
|
+
file = library.to_s + ".js"
|
118
|
+
|
119
|
+
else
|
120
|
+
|
121
|
+
#assign the name in file variable
|
122
|
+
file = library
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
# when :contrib
|
127
|
+
#
|
128
|
+
# file = "contrib/" + @@libraries[library]
|
129
|
+
|
130
|
+
end # end case statement
|
131
|
+
|
132
|
+
# include the file into the array
|
133
|
+
@@js_includes << file unless file.blank? or @@js_includes.include? file
|
134
|
+
|
135
|
+
end # end private class method include_js_library_individual
|
136
|
+
|
137
|
+
|
138
|
+
# @param = string or symbol
|
139
|
+
# @return = class variable of type array
|
140
|
+
def self.include_css_file_individual file
|
141
|
+
|
142
|
+
# if params belongs to symbol class
|
143
|
+
if file.class == Symbol
|
144
|
+
|
145
|
+
# convert symbols into string
|
146
|
+
file = file.to_s + '.css'
|
147
|
+
|
148
|
+
end # end if
|
149
|
+
|
150
|
+
# include the file into the array
|
151
|
+
@@css_includes << file unless file.blank? or @@css_includes.include? file
|
152
|
+
|
153
|
+
end # end private class method include_css_file_individual
|
154
|
+
|
155
|
+
# declaring class variable of type hash
|
156
|
+
@@libraries = {
|
157
|
+
# declare the library file here in hash format
|
158
|
+
}
|
159
|
+
|
160
|
+
end # end AssetManager Class
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Use this hook to configure ckeditor
|
2
|
+
if Object.const_defined?("Ckeditor")
|
3
|
+
Ckeditor.setup do |config|
|
4
|
+
# ==> ORM configuration
|
5
|
+
# Load and configure the ORM. Supports :active_record (default), :mongo_mapper and
|
6
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
7
|
+
# available as additional gems.
|
8
|
+
require "ckeditor/orm/active_record"
|
9
|
+
|
10
|
+
# Allowed image file types for upload.
|
11
|
+
# Set to nil or [] (empty array) for all file types
|
12
|
+
# config.image_file_types = ["jpg", "jpeg", "png", "gif", "tiff"]
|
13
|
+
|
14
|
+
# Allowed attachment file types for upload.
|
15
|
+
# Set to nil or [] (empty array) for all file types
|
16
|
+
# config.attachment_file_types = ["doc", "docx", "xls", "odt", "ods", "pdf", "rar", "zip", "tar", "swf"]
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
@File Name : views_generator.rb
|
4
|
+
@Company Name : Mindfire Solutions Pvt. Ltd.
|
5
|
+
@Creator Name : Vikram Kumar Mishra
|
6
|
+
@Date Created : 2012-07-09
|
7
|
+
@Date Modified :
|
8
|
+
@Last Modification Details :
|
9
|
+
@Purpose : This file is responsible to install assets and views for mcms_pages module in other application/module
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
module McmsPages
|
14
|
+
|
15
|
+
module Generators
|
16
|
+
|
17
|
+
# To generate Pages views.
|
18
|
+
# copy_views` is the main method and by default copies all views
|
19
|
+
module ViewPathTemplates
|
20
|
+
extend ActiveSupport::Concern
|
21
|
+
|
22
|
+
included do
|
23
|
+
|
24
|
+
public_task :copy_views
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
# @Params : None
|
29
|
+
# @Returns : None
|
30
|
+
# @Purpose : To copy views
|
31
|
+
def copy_views
|
32
|
+
|
33
|
+
view_directory :mcms_pages
|
34
|
+
|
35
|
+
end # end method
|
36
|
+
|
37
|
+
protected
|
38
|
+
|
39
|
+
# @Params : None
|
40
|
+
# @Returns : None
|
41
|
+
# @Purpose : To define the source path to copy views
|
42
|
+
def view_directory(name, _target_path = nil)
|
43
|
+
|
44
|
+
directory name.to_s, _target_path || "#{target_path}/#{name}"
|
45
|
+
|
46
|
+
end # end method
|
47
|
+
|
48
|
+
# @Params : None
|
49
|
+
# @Returns : None
|
50
|
+
# @Purpose : To define the target path to copy views
|
51
|
+
def target_path
|
52
|
+
|
53
|
+
@target_path ||= "app/views"
|
54
|
+
|
55
|
+
end # end method
|
56
|
+
|
57
|
+
end # end module ViewPathTemplates
|
58
|
+
|
59
|
+
|
60
|
+
class ViewsGenerator < Rails::Generators::Base
|
61
|
+
|
62
|
+
include ViewPathTemplates
|
63
|
+
source_root File.expand_path("../../../../app/views", __FILE__)
|
64
|
+
|
65
|
+
# @Params : None
|
66
|
+
# @Returns : None
|
67
|
+
# @Purpose : Just to print a line on console
|
68
|
+
def install_views
|
69
|
+
|
70
|
+
say "MCMS PAGES views created to your application."
|
71
|
+
|
72
|
+
end # end method
|
73
|
+
|
74
|
+
end # end class
|
75
|
+
|
76
|
+
end # end module Generators
|
77
|
+
|
78
|
+
end # end module McmsPages
|
79
|
+
|
data/lib/mcms_pages.rb
ADDED