knitkit 2.0.5 → 2.0.6
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.
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +5 -8
- data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +11 -8
- data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +26 -4
- data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +49 -35
- data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +30 -21
- data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +41 -32
- data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +0 -6
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +42 -6
- data/app/{models → mailers}/website_inquiry_mailer.rb +0 -0
- data/app/models/article.rb +4 -0
- data/app/models/content.rb +0 -4
- data/app/models/theme.rb +3 -3
- data/app/models/website.rb +44 -17
- data/app/views/knitkit/website_sections/index.html.erb +1 -1
- data/app/views/layouts/knitkit/base.html.erb +6 -0
- data/app/views/shared/knitkit/_footer.html.erb +2 -2
- data/app/widgets/signup/base.rb +0 -2
- data/db/data_migrations/20120809020508_update_website_and_configuration.rb +77 -0
- data/lib/knitkit/engine.rb +4 -0
- data/lib/knitkit/extensions.rb +4 -1
- data/lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb +36 -33
- data/lib/knitkit/extensions/action_mailer/theme_support/acts_as_themed_mailer.rb +60 -0
- data/lib/knitkit/extensions/active_record/acts_as_commentable.rb +9 -4
- data/lib/knitkit/extensions/active_record/acts_as_document.rb +1 -1
- data/lib/knitkit/extensions/compass_ae/widgets/base.rb +21 -1
- data/lib/knitkit/extensions/compass_ae/widgets/widget_proxy_controller.rb +26 -0
- data/lib/knitkit/extensions/railties/action_view/base.rb +11 -0
- data/lib/knitkit/extensions/railties/action_view/helpers/blog_helper.rb +62 -0
- data/lib/knitkit/extensions/railties/action_view/helpers/content_helper.rb +83 -0
- data/lib/knitkit/extensions/railties/action_view/helpers/knitkit_helper.rb +67 -0
- data/lib/knitkit/extensions/railties/action_view/helpers/menu_helper.rb +71 -0
- data/lib/knitkit/version.rb +1 -1
- data/public/images/knitkit/close.png +0 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +150 -400
- data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +687 -593
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region.js +1 -2
- data/public/javascripts/erp_app/desktop/applications/knitkit/file_assets_panel.js +39 -15
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_data_view.js +1 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_panel.js +65 -126
- data/public/javascripts/erp_app/desktop/applications/knitkit/module.js +65 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/section_articles_grid_panel.js +265 -183
- data/public/javascripts/erp_app/desktop/applications/knitkit/themes_tree_panel.js +24 -9
- data/public/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +631 -595
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/document.js +265 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/host.js +133 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/menu.js +174 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/section.js +399 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website.js +165 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website_nav_items.js +266 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +1224 -0
- data/public/javascripts/knitkit/inline_editing.js +136 -0
- data/public/stylesheets/extjs/resources/css/knitkit_extjs_4.css +1 -2
- data/public/stylesheets/knitkit/inline_editing.css +88 -0
- data/public/stylesheets/knitkit/style.css +1 -1
- metadata +47 -31
- data/lib/knitkit/extensions/railties/action_view.rb +0 -199
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region.js +0 -2725
@@ -88,9 +88,6 @@ module Knitkit
|
|
88
88
|
website.subtitle = params[:subtitle]
|
89
89
|
website.title = params[:title]
|
90
90
|
website.name = params[:name]
|
91
|
-
website.email = params[:email]
|
92
|
-
website.auto_activate_publication = params[:auto_activate_publication] == 'yes'
|
93
|
-
website.email_inquiries = params[:email_inquiries] == 'yes'
|
94
91
|
|
95
92
|
# create homepage
|
96
93
|
website_section = WebsiteSection.new
|
@@ -129,12 +126,9 @@ module Knitkit
|
|
129
126
|
model = DesktopApplication.find_by_internal_identifier('knitkit')
|
130
127
|
begin
|
131
128
|
current_user.with_capability(model, 'edit', 'Website') do
|
132
|
-
@website.email = params[:email]
|
133
129
|
@website.name = params[:name]
|
134
130
|
@website.title = params[:title]
|
135
131
|
@website.subtitle = params[:subtitle]
|
136
|
-
@website.auto_activate_publication = params[:auto_activate_publication] == 'yes'
|
137
|
-
@website.email_inquiries = params[:email_inquiries] == 'yes'
|
138
132
|
|
139
133
|
render :json => @website.save ? {:success => true} : {:success => false}
|
140
134
|
end
|
@@ -94,7 +94,10 @@ module Knitkit
|
|
94
94
|
@website_section.render_base_layout = params[:render_with_base_layout] == 'yes'
|
95
95
|
@website_section.internal_identifier = params[:internal_identifier]
|
96
96
|
|
97
|
+
website = @website_section.website
|
97
98
|
if @website_section.save
|
99
|
+
@website_section.publish(website, 'Auto Publish', @website_section.version, current_user) if website.publish_on_save?
|
100
|
+
|
98
101
|
render :json => {:success => true}
|
99
102
|
else
|
100
103
|
render :json => {:success => false}
|
@@ -132,11 +135,13 @@ module Knitkit
|
|
132
135
|
model = DesktopApplication.find_by_internal_identifier('knitkit')
|
133
136
|
begin
|
134
137
|
current_user.with_capability(model, 'edit', 'Layout') do
|
135
|
-
|
136
|
-
|
138
|
+
result = Knitkit::SyntaxValidator.validate_content(:erb, params[:content])
|
137
139
|
unless result
|
140
|
+
website = @website_section.website
|
138
141
|
@website_section.layout = params[:content]
|
139
|
-
|
142
|
+
saved = @website_section.save
|
143
|
+
@website_section.publish(website, 'Auto Publish', @website_section.version, current_user) if saved and website.publish_on_save?
|
144
|
+
render :json => saved ? {:success => true} : {:success => false}
|
140
145
|
else
|
141
146
|
render :json => {:success => false, :message => result}
|
142
147
|
end
|
@@ -146,11 +151,42 @@ module Knitkit
|
|
146
151
|
end
|
147
152
|
end
|
148
153
|
|
154
|
+
def available_articles_filter
|
155
|
+
menu = []
|
156
|
+
websites = Website.all
|
157
|
+
all_articles = [{:name => 'All Articles', :id => 0}]
|
158
|
+
orphaned_articles = [{:name => 'Orphaned Articles Only', :id => -1}]
|
159
|
+
|
160
|
+
websites_array = []
|
161
|
+
websites.each do |w|
|
162
|
+
websites_array << { :name => "Website: #{w.name}", :id => w.id }
|
163
|
+
end
|
164
|
+
|
165
|
+
menu = all_articles + orphaned_articles + websites_array
|
166
|
+
|
167
|
+
render :inline => "{\"websites\":#{menu.to_json(:only => [:name, :id])}}"
|
168
|
+
end
|
169
|
+
|
149
170
|
def available_articles
|
150
|
-
|
151
|
-
|
171
|
+
website_id = params[:website_id]
|
172
|
+
current_articles = Article.joins(:website_section_contents).where("website_section_id = #{params[:section_id]}").all
|
173
|
+
|
174
|
+
# Defaults to retrieving all articles
|
175
|
+
available_articles = Article.order('LOWER(contents.internal_identifier) ASC')
|
176
|
+
|
177
|
+
# Orphaned Articles
|
178
|
+
if !website_id.blank? and website_id.to_i == -1
|
179
|
+
available_articles = available_articles.includes(:website_section_contents).where( :website_section_contents => { :content_id => nil } )
|
180
|
+
end
|
181
|
+
|
182
|
+
# Website Articles
|
183
|
+
if !website_id.blank? and website_id.to_i > 0
|
184
|
+
available_articles = available_articles.joins(:website_sections).where("website_sections.website_id = #{website_id}")
|
185
|
+
end
|
186
|
+
|
187
|
+
available_articles = available_articles.all - current_articles
|
152
188
|
|
153
|
-
render :inline => "{\"articles\":#{available_articles.to_json(:only => [:internal_identifier, :id])}}"
|
189
|
+
render :inline => "{\"articles\":#{available_articles.to_json(:only => [:title, :internal_identifier, :id], :methods => [:combobox_display_value])}}"
|
154
190
|
end
|
155
191
|
|
156
192
|
def existing_sections
|
File without changes
|
data/app/models/article.rb
CHANGED
data/app/models/content.rb
CHANGED
data/app/models/theme.rb
CHANGED
@@ -126,7 +126,7 @@ class Theme < ActiveRecord::Base
|
|
126
126
|
self.summary = about['summary'] if about['summary']
|
127
127
|
else
|
128
128
|
name = entry.name.sub(/__MACOSX\//, '')
|
129
|
-
name = Theme.strip_path(
|
129
|
+
name = Theme.strip_path(name, theme_root)
|
130
130
|
data = ''
|
131
131
|
entry.get_input_stream { |io| data = io.read }
|
132
132
|
data = StringIO.new(data) if data.present?
|
@@ -153,10 +153,10 @@ class Theme < ActiveRecord::Base
|
|
153
153
|
relative_path = file.directory.sub("#{url}",'')
|
154
154
|
path = FileUtils.mkdir_p(File.join(tmp_dir,relative_path))
|
155
155
|
full_path = File.join(path,file.name)
|
156
|
-
File.open(full_path, '
|
156
|
+
File.open(full_path, 'wb+') {|f| f.puts(contents) }
|
157
157
|
zip.add(File.join(relative_path[1..relative_path.length],file.name), full_path) if ::File.exists?(full_path)
|
158
158
|
}
|
159
|
-
::File.open(tmp_dir + 'about.yml', '
|
159
|
+
::File.open(tmp_dir + 'about.yml', 'wb+') { |f| f.puts(about.to_yaml) }
|
160
160
|
zip.add('about.yml', tmp_dir + 'about.yml')
|
161
161
|
end
|
162
162
|
end
|
data/app/models/website.rb
CHANGED
@@ -64,10 +64,21 @@ class Website < ActiveRecord::Base
|
|
64
64
|
#ActiveRecord::Base.connection.execute("select path from website_sections where website_id = #{self.id}").collect{|row| row['path']}
|
65
65
|
end
|
66
66
|
|
67
|
+
def config_value(config_item_type_iid)
|
68
|
+
primary_host_config_item_type = ConfigurationItemType.find_by_internal_identifier(config_item_type_iid)
|
69
|
+
self.configurations.first.get_configuration_item(primary_host_config_item_type).options.first.value
|
70
|
+
end
|
71
|
+
|
72
|
+
def email_inquiries?
|
73
|
+
config_value('email_inquiries') == 'yes'
|
74
|
+
end
|
75
|
+
|
67
76
|
def self.find_by_host(host)
|
68
77
|
website = nil
|
69
|
-
|
70
|
-
|
78
|
+
unless host.nil?
|
79
|
+
website_host = WebsiteHost.find_by_host(host)
|
80
|
+
website = website_host.website unless website_host.nil?
|
81
|
+
end
|
71
82
|
website
|
72
83
|
end
|
73
84
|
|
@@ -93,6 +104,24 @@ class Website < ActiveRecord::Base
|
|
93
104
|
self.published_websites.where(:active => true).first
|
94
105
|
end
|
95
106
|
|
107
|
+
def auto_activate_publication?
|
108
|
+
configuration_item = self.configurations.first.get_item(:auto_active_publications)
|
109
|
+
unless configuration_item.nil?
|
110
|
+
configuration_item.options.first.value == 'yes'
|
111
|
+
else
|
112
|
+
false
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def publish_on_save?
|
117
|
+
configuration_item = self.configurations.first.get_item(:publish_on_save)
|
118
|
+
unless configuration_item.nil?
|
119
|
+
configuration_item.options.first.value == 'yes'
|
120
|
+
else
|
121
|
+
false
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
96
125
|
def role
|
97
126
|
Role.iid(website_role_iid)
|
98
127
|
end
|
@@ -103,7 +132,6 @@ class Website < ActiveRecord::Base
|
|
103
132
|
configuration = ::Configuration.find_template('default_website_configuration').clone(true)
|
104
133
|
configuration.description = "Website #{self.name} Configuration"
|
105
134
|
configuration.internal_identifier = configuration.description.underscore
|
106
|
-
configuration.update_configuration_item(ConfigurationItemType.find_by_internal_identifier('contact_us_email_address'), self.email)
|
107
135
|
configuration.update_configuration_item(ConfigurationItemType.find_by_internal_identifier('login_url'), '/login')
|
108
136
|
configuration.update_configuration_item(ConfigurationItemType.find_by_internal_identifier('homepage_url'), '/home')
|
109
137
|
self.configurations << configuration
|
@@ -154,15 +182,14 @@ class Website < ActiveRecord::Base
|
|
154
182
|
:title => title,
|
155
183
|
:subtitle => subtitle,
|
156
184
|
:internal_identifier => internal_identifier,
|
157
|
-
:email => email,
|
158
|
-
:auto_activate_publication => auto_activate_publication,
|
159
|
-
:email_inquiries => email_inquiries,
|
160
185
|
:sections => [],
|
161
186
|
:images => [],
|
162
187
|
:files => [],
|
163
188
|
:website_navs => []
|
164
189
|
}
|
165
190
|
|
191
|
+
#TODO update to handle configurations
|
192
|
+
|
166
193
|
setup_hash[:sections] = sections.positioned.collect do |website_section|
|
167
194
|
website_section.build_section_hash
|
168
195
|
end
|
@@ -209,32 +236,32 @@ class Website < ActiveRecord::Base
|
|
209
236
|
|
210
237
|
sections.each do |website_section|
|
211
238
|
unless website_section.layout.blank?
|
212
|
-
File.open(File.join(sections_path,"#{website_section.internal_identifier}.rhtml"), '
|
239
|
+
File.open(File.join(sections_path,"#{website_section.internal_identifier}.rhtml"), 'wb+') {|f| f.puts(website_section.layout) }
|
213
240
|
end
|
214
241
|
end
|
215
242
|
|
216
243
|
contents = sections.collect(&:contents).flatten.uniq
|
217
244
|
contents.each do |content|
|
218
|
-
File.open(File.join(articles_path,"#{content.internal_identifier}.html"), '
|
245
|
+
File.open(File.join(articles_path,"#{content.internal_identifier}.html"), 'wb+') {|f| f.puts(content.body_html) }
|
219
246
|
unless content.excerpt_html.blank?
|
220
|
-
File.open(File.join(excerpts_path,"#{content.internal_identifier}.html"), '
|
247
|
+
File.open(File.join(excerpts_path,"#{content.internal_identifier}.html"), 'wb+') {|f| f.puts(content.excerpt_html) }
|
221
248
|
end
|
222
249
|
end
|
223
250
|
|
224
251
|
online_document_sections.each do |online_documented_section|
|
225
|
-
File.open(File.join(documented_contents_path,"#{online_documented_section.internal_identifier}.html"), '
|
252
|
+
File.open(File.join(documented_contents_path,"#{online_documented_section.internal_identifier}.html"), 'wb+') {|f| f.puts(online_documented_section.documented_item_published_content_html(active_publication)) }
|
226
253
|
end
|
227
254
|
|
228
255
|
self.files.where("directory like '%/sites/#{self.iid}/images%'").all.each do |image_asset|
|
229
256
|
contents = file_support.get_contents(File.join(file_support.root,image_asset.directory,image_asset.name))
|
230
257
|
FileUtils.mkdir_p(File.join(image_assets_path,image_asset.directory))
|
231
|
-
File.open(File.join(image_assets_path,image_asset.directory,image_asset.name), '
|
258
|
+
File.open(File.join(image_assets_path,image_asset.directory,image_asset.name), 'wb+') {|f| f.puts(contents) }
|
232
259
|
end
|
233
260
|
|
234
261
|
self.files.where("directory like '%/#{Rails.application.config.erp_tech_svcs.file_assets_location}/sites/#{self.iid}%'").all.each do |file_asset|
|
235
262
|
contents = file_support.get_contents(File.join(file_support.root,file_asset.directory,file_asset.name))
|
236
263
|
FileUtils.mkdir_p(File.join(file_assets_path,file_asset.directory))
|
237
|
-
File.open(File.join(file_assets_path,file_asset.directory,file_asset.name), '
|
264
|
+
File.open(File.join(file_assets_path,file_asset.directory,file_asset.name), 'wb+') {|f| f.puts(contents) }
|
238
265
|
end
|
239
266
|
|
240
267
|
files = []
|
@@ -246,7 +273,7 @@ class Website < ActiveRecord::Base
|
|
246
273
|
files << {:path => path, :name => entry}
|
247
274
|
end
|
248
275
|
|
249
|
-
File.open(tmp_dir + 'setup.yml', '
|
276
|
+
File.open(tmp_dir + 'setup.yml', 'wb+') { |f| f.puts(export_setup.to_yaml) }
|
250
277
|
|
251
278
|
(tmp_dir + "#{name}.zip").tap do |file_name|
|
252
279
|
file_name.unlink if file_name.exist?
|
@@ -313,11 +340,11 @@ class Website < ActiveRecord::Base
|
|
313
340
|
:name => setup_hash[:name],
|
314
341
|
:title => setup_hash[:title],
|
315
342
|
:subtitle => setup_hash[:subtitle],
|
316
|
-
:internal_identifier => setup_hash[:internal_identifier]
|
317
|
-
:email => setup_hash[:email],
|
318
|
-
:email_inquiries => setup_hash[:email_inquiries],
|
319
|
-
:auto_activate_publication => setup_hash[:auto_activate_publication]
|
343
|
+
:internal_identifier => setup_hash[:internal_identifier]
|
320
344
|
)
|
345
|
+
|
346
|
+
#TODO update to handle configurations
|
347
|
+
|
321
348
|
website.save!
|
322
349
|
|
323
350
|
#set default publication published by user
|
@@ -20,10 +20,14 @@
|
|
20
20
|
<%= static_stylesheet_link_tag('datepicker.css') %>
|
21
21
|
<%= static_stylesheet_link_tag('extjs/resources/css/knitkit_extjs_4.css') %>
|
22
22
|
<%= static_stylesheet_link_tag('knitkit/style.css') %>
|
23
|
+
<%= static_stylesheet_link_tag('knitkit/inline_editing.css') %>
|
23
24
|
<%= static_javascript_include_tag('erp_app/widgets.js') %>
|
24
25
|
<%= static_javascript_include_tag('ajax_pagination.js') %>
|
25
26
|
<%= static_javascript_include_tag('erp_app/shared/dynamic_forms/dynamic_forms_validation.js') %>
|
26
27
|
<%= static_javascript_include_tag('knitkit/helpers.js') %>
|
28
|
+
<%= static_javascript_include_tag('knitkit/inline_editing.js') %>
|
29
|
+
<%= static_javascript_include_tag('erp_app/ckeditor/ckeditor.js') %>
|
30
|
+
|
27
31
|
<%= yield :head %>
|
28
32
|
</head>
|
29
33
|
<body>
|
@@ -57,5 +61,7 @@
|
|
57
61
|
<%= content_for?(:footer) ? yield(:footer) : (render :partial => 'shared/knitkit/footer') %>
|
58
62
|
<%= yield :foot %>
|
59
63
|
</div>
|
64
|
+
<%= setSessionTimeout %>
|
65
|
+
<%= setup_inline_editing %>
|
60
66
|
</body>
|
61
67
|
</html>
|
@@ -1,3 +1,3 @@
|
|
1
1
|
<div id="footer">
|
2
|
-
Powered By
|
3
|
-
</div>
|
2
|
+
Powered By <a href="http://development.compassagile.com">CompassAE</a>
|
3
|
+
</div>
|
data/app/widgets/signup/base.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
module Widgets
|
3
2
|
module Signup
|
4
3
|
class Base < ErpApp::Widgets::Base
|
@@ -34,7 +33,6 @@ module Widgets
|
|
34
33
|
@user.party = individual.party
|
35
34
|
@user.save
|
36
35
|
render :update => {:id => "#{@uuid}_result", :view => :success}
|
37
|
-
render :update => {:id => "#{@uuid}_result_form", :view => :success}
|
38
36
|
else
|
39
37
|
render :update => {:id => "#{@uuid}_result_form", :view => :error}
|
40
38
|
|
@@ -0,0 +1,77 @@
|
|
1
|
+
class UpdateWebsiteAndConfiguration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
content_work_flow_category = Category.create(:description => 'Content Workflow', :internal_identifier => 'content_workflow')
|
4
|
+
|
5
|
+
website_setup_category = Category.find_by_internal_identifier('website_setup')
|
6
|
+
configuration = ::Configuration.find_template('default_website_configuration')
|
7
|
+
|
8
|
+
yes_option = ConfigurationOption.find_by_internal_identifier('yes')
|
9
|
+
yes_option = ConfigurationOption.create(
|
10
|
+
:description => 'Yes',
|
11
|
+
:internal_identifier => 'yes',
|
12
|
+
:value => 'yes'
|
13
|
+
) if yes_option.nil?
|
14
|
+
|
15
|
+
no_option = ConfigurationOption.find_by_internal_identifier('no')
|
16
|
+
no_option = ConfigurationOption.create(
|
17
|
+
:description => 'No',
|
18
|
+
:internal_identifier => 'no',
|
19
|
+
:value => 'no'
|
20
|
+
) if no_option.nil?
|
21
|
+
|
22
|
+
#add email inquiries config
|
23
|
+
email_inquiries_config_item_type = ConfigurationItemType.create(
|
24
|
+
:description => 'Email inquiries',
|
25
|
+
:internal_identifier => 'email_inquiries'
|
26
|
+
)
|
27
|
+
email_inquiries_config_item_type.configuration_options << yes_option
|
28
|
+
email_inquiries_config_item_type.add_default_option(no_option)
|
29
|
+
CategoryClassification.create(:category => website_setup_category, :classification => email_inquiries_config_item_type)
|
30
|
+
|
31
|
+
configuration.configuration_item_types << email_inquiries_config_item_type
|
32
|
+
|
33
|
+
#add auto activate publications
|
34
|
+
auto_activate_config_item_type = ConfigurationItemType.create(
|
35
|
+
:description => 'Auto activate publications',
|
36
|
+
:internal_identifier => 'auto_active_publications'
|
37
|
+
)
|
38
|
+
auto_activate_config_item_type.configuration_options << no_option
|
39
|
+
auto_activate_config_item_type.add_default_option(yes_option)
|
40
|
+
CategoryClassification.create(:category => content_work_flow_category, :classification => auto_activate_config_item_type)
|
41
|
+
|
42
|
+
configuration.configuration_item_types << auto_activate_config_item_type
|
43
|
+
|
44
|
+
#add auto publish on save
|
45
|
+
publish_on_save_config_item_type = ConfigurationItemType.create(
|
46
|
+
:description => 'Publish on save',
|
47
|
+
:internal_identifier => 'publish_on_save'
|
48
|
+
)
|
49
|
+
publish_on_save_config_item_type.configuration_options << no_option
|
50
|
+
publish_on_save_config_item_type.add_default_option(yes_option)
|
51
|
+
CategoryClassification.create(:category => content_work_flow_category, :classification => publish_on_save_config_item_type)
|
52
|
+
|
53
|
+
configuration.configuration_item_types << publish_on_save_config_item_type
|
54
|
+
|
55
|
+
Website.all.each do |website|
|
56
|
+
website_config = website.configurations.first
|
57
|
+
#add types
|
58
|
+
website_config.configuration_item_types << email_inquiries_config_item_type
|
59
|
+
website_config.configuration_item_types << auto_activate_config_item_type
|
60
|
+
website_config.configuration_item_types << publish_on_save_config_item_type
|
61
|
+
|
62
|
+
website_config.add_configuration_item(email_inquiries_config_item_type, (website.email_inquiries ? :yes : :no))
|
63
|
+
website_config.add_configuration_item(auto_activate_config_item_type, (website.auto_activate_publication ? :yes : :no))
|
64
|
+
website_config.add_configuration_item(publish_on_save_config_item_type, (website.auto_activate_publication ? :no : :yes))
|
65
|
+
|
66
|
+
website_config.save
|
67
|
+
end
|
68
|
+
|
69
|
+
remove_column(:websites, :email) if columns(:websites).collect {|c| c.name}.include?('email')
|
70
|
+
|
71
|
+
remove_column(:websites, :auto_activate_publication) if columns(:websites).collect {|c| c.name}.include?('auto_activate_publication')
|
72
|
+
remove_column(:websites, :email_inquiries) if columns(:websites).collect {|c| c.name}.include?('email_inquiries')
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.down
|
76
|
+
end
|
77
|
+
end
|
data/lib/knitkit/engine.rb
CHANGED
@@ -24,6 +24,10 @@ module Knitkit
|
|
24
24
|
include Knitkit::Extensions::ActionController::ThemeSupport::ActsAsThemedController
|
25
25
|
end
|
26
26
|
|
27
|
+
ActiveSupport.on_load(:action_mailer) do
|
28
|
+
include Knitkit::Extensions::ActionMailer::ThemeSupport::ActsAsThemedMailer
|
29
|
+
end
|
30
|
+
|
27
31
|
engine = self
|
28
32
|
config.to_prepare do
|
29
33
|
ErpBaseErpSvcs.register_compass_ae_engine(engine)
|
data/lib/knitkit/extensions.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'knitkit/extensions/core/array'
|
3
3
|
|
4
4
|
#railties
|
5
|
-
require 'knitkit/extensions/railties/action_view'
|
5
|
+
require 'knitkit/extensions/railties/action_view/base'
|
6
6
|
require 'knitkit/extensions/railties/theme_support/asset_tag_helper'
|
7
7
|
require 'knitkit/extensions/railties/theme_support/theme_file_resolver'
|
8
8
|
|
@@ -14,3 +14,6 @@ require 'knitkit/extensions/active_record/acts_as_document'
|
|
14
14
|
|
15
15
|
#active_controller extensions
|
16
16
|
require 'knitkit/extensions/action_controller/theme_support/acts_as_themed_controller'
|
17
|
+
|
18
|
+
#action_mailer extensions
|
19
|
+
require 'knitkit/extensions/action_mailer/theme_support/acts_as_themed_mailer'
|
@@ -23,17 +23,20 @@ module Knitkit
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def acts_as_themed_controller?
|
26
|
-
included_modules.include?(
|
26
|
+
included_modules.include?(InstanceMethods)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
module InstanceMethods
|
31
31
|
def current_themes
|
32
32
|
@current_themes ||= case accessor = self.class.read_inheritable_attribute(:current_themes)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
when Symbol then
|
34
|
+
accessor == :current_themes ? raise("screwed") : send(accessor)
|
35
|
+
when Proc then
|
36
|
+
accessor.call(self)
|
37
|
+
else
|
38
|
+
accessor
|
39
|
+
end
|
37
40
|
end
|
38
41
|
|
39
42
|
def add_theme_view_paths
|
@@ -41,34 +44,34 @@ module Knitkit
|
|
41
44
|
if respond_to?(:current_theme_paths)
|
42
45
|
current_theme_paths.each do |theme|
|
43
46
|
resolver = case Rails.application.config.erp_tech_svcs.file_storage
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
47
|
+
when :s3
|
48
|
+
path = File.join(theme[:url], "templates")
|
49
|
+
cached_resolver = ThemeSupport::Cache.theme_resolvers.find { |cached_resolver| cached_resolver.to_path == path }
|
50
|
+
if cached_resolver.nil?
|
51
|
+
resolver = ActionView::S3Resolver.new(path)
|
52
|
+
ThemeSupport::Cache.theme_resolvers << resolver
|
53
|
+
resolver
|
54
|
+
else
|
55
|
+
cached_resolver
|
56
|
+
end
|
57
|
+
when :filesystem
|
58
|
+
path = "#{theme[:path]}/templates"
|
59
|
+
cached_resolver = ThemeSupport::Cache.theme_resolvers.find { |cached_resolver| cached_resolver.to_path == path }
|
60
|
+
if cached_resolver.nil?
|
61
|
+
resolver = ActionView::ThemeFileResolver.new(path)
|
62
|
+
ThemeSupport::Cache.theme_resolvers << resolver
|
63
|
+
resolver
|
64
|
+
else
|
65
|
+
cached_resolver
|
66
|
+
end
|
67
|
+
end
|
65
68
|
prepend_view_path(resolver)
|
66
69
|
end
|
67
70
|
end
|
68
71
|
end
|
69
72
|
|
70
73
|
def current_theme_paths
|
71
|
-
current_themes ? current_themes.map { |theme| {:path => theme.path.to_s, :url => theme.url.to_s}} : []
|
74
|
+
current_themes ? current_themes.map { |theme| {:path => theme.path.to_s, :url => theme.url.to_s} } : []
|
72
75
|
end
|
73
76
|
|
74
77
|
def authorize_template_extension!(template, ext)
|
@@ -79,9 +82,9 @@ module Knitkit
|
|
79
82
|
def allowed_template_type?(ext)
|
80
83
|
force_template_types.blank? || force_template_types.include?(ext)
|
81
84
|
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
85
|
+
end #InstanceMethods
|
86
|
+
end #ActsAsThemedController
|
87
|
+
end #ThemeSupport
|
88
|
+
end #ActionController
|
89
|
+
end #Extensions
|
90
|
+
end #Knitkit
|