muck-contents 3.1.4 → 3.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -0
- data/VERSION +1 -1
- data/app/views/admin/contents/index.html.erb +3 -2
- data/app/views/layouts/tiny_mce.html.erb +1 -3
- data/app/views/tiny_mce/_tiny_mce_head.erb +1 -1
- data/app/views/tiny_mce/_tiny_mce_scripts.erb +3 -1
- data/app/views/tiny_mce/files.erb +4 -3
- data/app/views/tiny_mce/flickr.erb +3 -3
- data/app/views/tiny_mce/images.erb +3 -3
- data/app/views/tiny_mce/links.erb +3 -3
- data/lib/muck-contents/config.rb +2 -0
- data/lib/muck-contents/models/content.rb +11 -8
- data/muck-contents.gemspec +2 -2
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -26,6 +26,7 @@ be sure to set content_css to any css files you want to have show up in your tin
|
|
26
26
|
MuckContents.configure do |config|
|
27
27
|
config.sanitize_content = true
|
28
28
|
config.enable_auto_translations = false # If true then all content objects will automatically be translated into all languages supported by Google Translate
|
29
|
+
config.translate_to = ['es', 'fr'] # If auto translate is enabled this indicates which languages to translate the content into. Specify Babelphish::GoogleTranslate::LANGUAGES to translate to all available language (not recommended).
|
29
30
|
config.enable_sunspot = false # This enables or disables sunspot for profiles. Only use acts_as_solr or sunspot not both. Sunspot does not include multicore support.
|
30
31
|
config.enable_solr = true # Enables solr for the content system. If you are using solr then set this to true. If you do not wish to setup and manage solr
|
31
32
|
# then set this value to false (but search will be disabled).
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.
|
1
|
+
3.1.5
|
@@ -10,7 +10,7 @@
|
|
10
10
|
</ul>
|
11
11
|
</div>
|
12
12
|
</div>
|
13
|
-
|
13
|
+
<% content_for :javascript do -%>
|
14
14
|
<script type="text/javascript" language="JavaScript">
|
15
15
|
jQuery(document).ready(function() {
|
16
16
|
var data = <%= @contents.collect{|content| { :title => content.title, :id => content.id } }.to_json.html_safe %>;
|
@@ -23,4 +23,5 @@ jQuery(document).ready(function() {
|
|
23
23
|
}
|
24
24
|
}).result(function(event, item) { location.href = '/contents/' + item.id + '/edit'; });
|
25
25
|
});
|
26
|
-
</script>
|
26
|
+
</script>
|
27
|
+
<% end -%>
|
@@ -1,4 +1,5 @@
|
|
1
1
|
<%= init_tiny_mce %>
|
2
|
+
<% content_for :javascript do -%>
|
2
3
|
<script language="javascript" type="text/javascript">
|
3
4
|
<% if include_save_page -%>
|
4
5
|
function save_page() {
|
@@ -39,4 +40,5 @@ function show_message(message){
|
|
39
40
|
jQuery('#<%=message_id%>').fadeIn();
|
40
41
|
<% end -%>
|
41
42
|
}
|
42
|
-
</script>
|
43
|
+
</script>
|
44
|
+
<% end -%>
|
@@ -78,9 +78,9 @@
|
|
78
78
|
|
79
79
|
</form>
|
80
80
|
|
81
|
-
<% content_for :
|
81
|
+
<% content_for :javascript do -%>
|
82
82
|
<%= javascript_include_tag 'tiny_mce/plugins/muckfile/js/functions.js' -%>
|
83
|
-
|
83
|
+
|
84
84
|
<script language="javascript" type="text/javascript">
|
85
85
|
|
86
86
|
tinyMCEPopup.onInit.add(function(ed) {
|
@@ -138,4 +138,5 @@ function insert_file_too(url, name){
|
|
138
138
|
}
|
139
139
|
mcTabs.displayTab('general_tab','general_panel');
|
140
140
|
}
|
141
|
-
</script>
|
141
|
+
</script>
|
142
|
+
<% end -%>
|
@@ -22,9 +22,8 @@
|
|
22
22
|
</div>
|
23
23
|
</form>
|
24
24
|
|
25
|
-
<% content_for :
|
25
|
+
<% content_for :javascript do -%>
|
26
26
|
<%= javascript_include_tag 'tiny_mce/plugins/muckflickr/js/functions.js' -%>
|
27
|
-
<% end -%>
|
28
27
|
<script language="javascript" type="text/javascript">
|
29
28
|
jQuery(document).ready(function() {
|
30
29
|
jQuery('.image-container').click(function() {
|
@@ -32,4 +31,5 @@ jQuery(document).ready(function() {
|
|
32
31
|
return false;
|
33
32
|
});
|
34
33
|
});
|
35
|
-
</script>
|
34
|
+
</script>
|
35
|
+
<% end -%>
|
@@ -243,9 +243,8 @@
|
|
243
243
|
</div>
|
244
244
|
</form>
|
245
245
|
|
246
|
-
<% content_for :
|
246
|
+
<% content_for :javascript do -%>
|
247
247
|
<%= javascript_include_tag 'tiny_mce/plugins/muckimage/js/functions.js' -%>
|
248
|
-
<% end -%>
|
249
248
|
<script language="javascript" type="text/javascript">
|
250
249
|
|
251
250
|
tinyMCEPopup.onInit.add(function(ed) {
|
@@ -315,4 +314,5 @@ function insert_image_too(url, alt_text){
|
|
315
314
|
mcTabs.displayTab('general_tab','general_panel');
|
316
315
|
ImageDialog.showPreviewImage(url);
|
317
316
|
}
|
318
|
-
</script>
|
317
|
+
</script>
|
318
|
+
<% end -%>
|
@@ -292,9 +292,8 @@
|
|
292
292
|
</div>
|
293
293
|
</form>
|
294
294
|
|
295
|
-
<% content_for :
|
295
|
+
<% content_for :javascript do -%>
|
296
296
|
<%= javascript_include_tag 'tiny_mce/plugins/mucklink/js/functions.js' -%>
|
297
|
-
<% end -%>
|
298
297
|
<script language="javascript" type="text/javascript">
|
299
298
|
jQuery(document).ready(function() {
|
300
299
|
var path = '<%=links_for_content_path%>';
|
@@ -317,4 +316,5 @@ jQuery(document).ready(function() {
|
|
317
316
|
}
|
318
317
|
});
|
319
318
|
});
|
320
|
-
</script>
|
319
|
+
</script>
|
320
|
+
<% end -%>
|
data/lib/muck-contents/config.rb
CHANGED
@@ -14,6 +14,7 @@ module MuckContents
|
|
14
14
|
|
15
15
|
attr_accessor :git_repository # Not currently used. Eventually this will be the path to a git repository that the content system uses to store revisions.
|
16
16
|
attr_accessor :enable_auto_translations # If true then all content objects will automatically be translated into all languages supported by Google Translate
|
17
|
+
attr_accessor :translate_to # If auto translate is enabled this indicates which languages to translate the content into. Specify Babelphish::GoogleTranslate::LANGUAGES to translate to all available language (not recommended).
|
17
18
|
attr_accessor :enable_sunspot # This enables or disables sunspot for profiles. Only use acts_as_solr or sunspot not both. Sunspot does not include multicore support.
|
18
19
|
attr_accessor :enable_solr # Enables solr for the content system. If you are using solr then set this to true. If you do not wish to setup and manage solr
|
19
20
|
# then set this value to false (but search will be disabled).
|
@@ -38,6 +39,7 @@ module MuckContents
|
|
38
39
|
self.enable_comments = false
|
39
40
|
self.git_repository = nil #"#{File.join(RAILS_ROOT, 'repo', RAILS_ENV)}"
|
40
41
|
self.content_css = ['/stylesheets/reset.css', '/stylesheets/styles.css']
|
42
|
+
self.translate_to = []
|
41
43
|
end
|
42
44
|
|
43
45
|
end
|
@@ -35,7 +35,8 @@ module MuckContents
|
|
35
35
|
|
36
36
|
before_save :sanitize_attributes if MuckContents.configuration.sanitize_content
|
37
37
|
before_save :ensure_locale_is_string
|
38
|
-
|
38
|
+
after_save :auto_translate
|
39
|
+
|
39
40
|
# TODO add states - draft, published
|
40
41
|
# maybe move content body_raw -> body_draft -> body
|
41
42
|
# then you could be working on a revision without it being live
|
@@ -48,8 +49,6 @@ module MuckContents
|
|
48
49
|
# end
|
49
50
|
# end
|
50
51
|
|
51
|
-
after_save :auto_translate if MuckContents.configuration.enable_auto_translations
|
52
|
-
|
53
52
|
if MuckContents.configuration.enable_solr
|
54
53
|
require 'acts_as_solr'
|
55
54
|
acts_as_solr({ :fields => [ :search_content => 'string' ] }, { :multi_core => true, :default_core => 'en' })
|
@@ -188,6 +187,7 @@ module MuckContents
|
|
188
187
|
|
189
188
|
# Called after 'save' if auto translate is enabled
|
190
189
|
def auto_translate
|
190
|
+
return unless MuckContents.configuration.enable_auto_translations
|
191
191
|
begin
|
192
192
|
translate(false)
|
193
193
|
rescue => ex
|
@@ -200,19 +200,22 @@ module MuckContents
|
|
200
200
|
end
|
201
201
|
|
202
202
|
# Translate title and body using Google
|
203
|
-
def translate(overwrite_user_edited_translations = false)
|
204
|
-
|
205
|
-
|
203
|
+
def translate(overwrite_user_edited_translations = false, translate_to = nil)
|
204
|
+
translate_to ||= MuckContents.configuration.translate_to
|
205
|
+
return if translate_to.blank?
|
206
|
+
|
207
|
+
title_translations = Babelphish::Translator.multiple_translate(self.title, translate_to, self.locale)
|
208
|
+
body_translations = Babelphish::Translator.multiple_translate(self.body, translate_to, self.locale)
|
206
209
|
existing_translations = {}
|
207
210
|
self.content_translations.each do |translation|
|
208
211
|
existing_translations[translation.locale] = translation
|
209
212
|
end
|
210
213
|
|
211
|
-
|
214
|
+
translate_to.each do |language|
|
212
215
|
if translation = existing_translations[language]
|
213
216
|
if !translation.user_edited || overwrite_user_edited_translations
|
214
217
|
translation.update_attributes!(:title => title_translations[language],
|
215
|
-
|
218
|
+
:body => body_translations[language])
|
216
219
|
end
|
217
220
|
else
|
218
221
|
self.content_translations.create!(:title => title_translations[language],
|
data/muck-contents.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{muck-contents}
|
8
|
-
s.version = "3.1.
|
8
|
+
s.version = "3.1.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Justin Ball", "Joel Duffin"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-19}
|
13
13
|
s.email = %q{justin@tatemae.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"README.rdoc"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muck-contents
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 3.1.
|
9
|
+
- 5
|
10
|
+
version: 3.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Justin Ball
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-03-
|
19
|
+
date: 2011-03-19 00:00:00 -06:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|