gluttonberg-core 2.5.5 → 2.5.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.
Files changed (66) hide show
  1. data/app/assets/javascripts/gb_application.js +34 -0
  2. data/app/assets/stylesheets/gb_admin-override.sass +17 -1
  3. data/app/controllers/gluttonberg/admin/asset_library/assets_controller.rb +4 -2
  4. data/app/controllers/gluttonberg/admin/content/articles_controller.rb +22 -22
  5. data/app/controllers/gluttonberg/admin/content/comments_controller.rb +80 -23
  6. data/app/controllers/gluttonberg/admin/main_controller.rb +1 -1
  7. data/app/controllers/gluttonberg/public/comments_controller.rb +9 -8
  8. data/app/helpers/gluttonberg/admin.rb +3 -3
  9. data/app/helpers/gluttonberg/asset_library.rb +14 -11
  10. data/app/models/gluttonberg/asset.rb +8 -6
  11. data/app/models/gluttonberg/comment.rb +57 -3
  12. data/app/models/gluttonberg/comment_subscription.rb +2 -0
  13. data/app/models/gluttonberg/setting.rb +11 -5
  14. data/app/views/gluttonberg/admin/asset_library/assets/_browser_root.html.haml +20 -3
  15. data/app/views/gluttonberg/admin/asset_library/assets/search.json.haml +1 -1
  16. data/app/views/gluttonberg/admin/content/comments/index.html.haml +36 -10
  17. data/app/views/gluttonberg/admin/content/main/_sidebar.html.haml +6 -3
  18. data/app/views/gluttonberg/admin/main/index.html.haml +4 -4
  19. data/app/views/gluttonberg/admin/settings/generic_settings/index.html.haml +11 -7
  20. data/config/routes.rb +10 -0
  21. data/db/migrate/20130201025800_spam_flag_for_comments.rb +6 -0
  22. data/lib/engine.rb +3 -2
  23. data/lib/generators/gluttonberg/installer/installer_generator.rb +33 -32
  24. data/lib/gluttonberg/content/block.rb +2 -0
  25. data/lib/gluttonberg/content/clean_html.rb +16 -14
  26. data/lib/gluttonberg/content/despamilator/conf/unusual_characters.txt +6674 -0
  27. data/lib/gluttonberg/content/despamilator/filter/emails.rb +49 -0
  28. data/lib/gluttonberg/content/despamilator/filter/gtubs_test_filter.rb +25 -0
  29. data/lib/gluttonberg/content/despamilator/filter/html_tags.rb +134 -0
  30. data/lib/gluttonberg/content/despamilator/filter/ip_address_url.rb +27 -0
  31. data/lib/gluttonberg/content/despamilator/filter/long_words.rb +29 -0
  32. data/lib/gluttonberg/content/despamilator/filter/mixed_case.rb +25 -0
  33. data/lib/gluttonberg/content/despamilator/filter/naughty_words.rb +80 -0
  34. data/lib/gluttonberg/content/despamilator/filter/no_vowels.rb +28 -0
  35. data/lib/gluttonberg/content/despamilator/filter/numbers_and_words.rb +55 -0
  36. data/lib/gluttonberg/content/despamilator/filter/obfuscated_urls.rb +45 -0
  37. data/lib/gluttonberg/content/despamilator/filter/prices.rb +23 -0
  38. data/lib/gluttonberg/content/despamilator/filter/script_tag.rb +25 -0
  39. data/lib/gluttonberg/content/despamilator/filter/shouting.rb +38 -0
  40. data/lib/gluttonberg/content/despamilator/filter/spammy_tlds.rb +26 -0
  41. data/lib/gluttonberg/content/despamilator/filter/square_brackets.rb +27 -0
  42. data/lib/gluttonberg/content/despamilator/filter/trailing_number.rb +25 -0
  43. data/lib/gluttonberg/content/despamilator/filter/unusual_characters.rb +51 -0
  44. data/lib/gluttonberg/content/despamilator/filter/urls.rb +45 -0
  45. data/lib/gluttonberg/content/despamilator/filter/very_long_domain_name.rb +31 -0
  46. data/lib/gluttonberg/content/despamilator/filter/weird_punctuation.rb +48 -0
  47. data/lib/gluttonberg/content/despamilator/filter.rb +57 -0
  48. data/lib/gluttonberg/content/despamilator/subject/text.rb +36 -0
  49. data/lib/gluttonberg/content/despamilator/subject.rb +34 -0
  50. data/lib/gluttonberg/content/despamilator/version.rb +7 -0
  51. data/lib/gluttonberg/content/despamilator.rb +79 -0
  52. data/lib/gluttonberg/content.rb +12 -11
  53. data/lib/gluttonberg/library/attachment_mixin.rb +52 -269
  54. data/lib/gluttonberg/library/config/image_sizes.rb +61 -0
  55. data/lib/gluttonberg/library/config.rb +10 -0
  56. data/lib/gluttonberg/library/processor/audio.rb +42 -0
  57. data/lib/gluttonberg/library/processor/image.rb +134 -0
  58. data/lib/gluttonberg/library/processor.rb +11 -0
  59. data/lib/gluttonberg/library/storage/filesystem.rb +76 -0
  60. data/lib/gluttonberg/library/storage/s3.rb +196 -0
  61. data/lib/gluttonberg/library/storage.rb +11 -0
  62. data/lib/gluttonberg/library.rb +87 -86
  63. data/lib/gluttonberg/record_history.rb +14 -15
  64. data/lib/gluttonberg/tasks/asset.rake +25 -3
  65. data/lib/gluttonberg/version.rb +1 -1
  66. metadata +53 -2
@@ -2,6 +2,7 @@ module Gluttonberg
2
2
  class Setting < ActiveRecord::Base
3
3
  self.table_name = "gb_settings"
4
4
  after_save :update_settings_in_config
5
+
5
6
  before_destroy :destroy_cache
6
7
  attr_accessible :name, :value, :values_list, :help, :category, :row , :delete_able , :enabled
7
8
  def self.generate_or_update_settings(settings={})
@@ -40,24 +41,29 @@ module Gluttonberg
40
41
  :s3_access_key => ["" , 15 , "S3 Access Key"],
41
42
  :s3_server_url => ["" , 16 , "S3 Server URL"],
42
43
  :s3_bucket => ["" , 17 , "S3 Bucket Name"],
43
- :audio_assets => ["" , 18 , "Audio settings" , "Enable;Disable"]
44
+ :audio_assets => ["" , 18 , "Audio settings" , "Enable;Disable"],
45
+ :comment_blacklist => ["" , 19 , "When a comment contains any of these words in its comment, Author Name, Author website, Author e-mail, it will be marked as spam. It will match inside words, so \"able\" will match \"comparable\". Please separate words with a comma."],
46
+ :comment_email_as_spam => ["Yes" , 20 , "Do you want to mark those comments as spam which only contains emails and urls?" , "Yes;No" ],
47
+ :comment_number_of_emails_allowed => ["2" , 21 , "How many email addresses should a comment include to be marked as spam?" ],
48
+ :comment_number_of_urls_allowed => ["2" , 21 , "How many URLs should a comment include to be marked as spam?" ]
44
49
  }
45
50
  self.generate_or_update_settings(settings)
46
51
  end
47
52
 
53
+ def self.has_deletable_settings?
54
+ self.where(:delete_able => true).count > 0
55
+ end
56
+
48
57
  def dropdown_required?
49
58
  !values_list.blank?
50
59
  end
51
60
 
52
-
53
61
  def parsed_values_list_for_dropdown
54
62
  unless values_list.blank?
55
63
  values_list.split(";")
56
64
  end
57
65
  end
58
66
 
59
-
60
-
61
67
  def self.get_setting(key)
62
68
  if Gluttonberg::Setting.table_exists?
63
69
  data = nil
@@ -80,7 +86,7 @@ module Gluttonberg
80
86
 
81
87
  def self.update_settings(settings={})
82
88
  settings.each do |key , val |
83
- obj = self.first(:name=> key)
89
+ obj = self.where(:name=> key).first
84
90
  obj.value = val
85
91
  obj.save!
86
92
  end
@@ -1,3 +1,17 @@
1
+ :css
2
+ .tab-content > .active, .pill-content > .active{
3
+ padding: 10px;
4
+ }
5
+
6
+ .tab-content > .active .thumbnails .span3{
7
+ width: 150px;
8
+ }
9
+ .tab-content > .active .thumbnails .span3 .thumbnail img{
10
+ min-height: 25px;
11
+ }
12
+ .tab-content > .active .thumbnails .thumbnail{
13
+ overflow-x: hidden;
14
+ }
1
15
  = image_tag("/assets/gb_spinner.gif" , :id => "progress_ajax_upload" , :style => "display:none")
2
16
 
3
17
  %ul.nav.nav-tabs#asset_tabs
@@ -20,11 +34,12 @@
20
34
  %ul.assetList
21
35
  %li
22
36
  - else
23
- = render :partial => "gluttonberg/admin/shared/asset_panel.html" , :locals => {:assets => @assets}
37
+ = render :partial => "gluttonberg/admin/shared/asset_panel" , :locals => {:assets => @assets} , :formats => [:html]
24
38
 
25
39
  #collections.tab-pane
26
40
  - unless @collections.empty?
27
41
  .accordion#accordion_for_collections
42
+ - first_open = false
28
43
  - for collection in @collections
29
44
  - unless @category.blank? || @category.asset_type_ids.blank?
30
45
  - assets = collection.assets.where({:asset_type_id => @category.asset_type_ids })
@@ -35,9 +50,11 @@
35
50
  .accordion-heading
36
51
  %a{ :class=>"accordion-toggle no-ajax" , "data-toggle" => "collapse" , "data-parent" => "#accordion_for_collections" , "data-target" => "#collection-#{collection.id}", "href" => "#collection-#{collection.id}"}
37
52
  = "#{collection.name} ( #{pluralize(assets.length,'asset')} )"
38
- .accordion-body{:id => "collection-#{collection.id}" , :class => "collapse in"}
53
+ .accordion-body{:id => "collection-#{collection.id}" , :class => "collapse #{first_open ? '' : 'in' } " }
39
54
  .accordion-inner
40
55
  = render :partial => "gluttonberg/admin/shared/asset_panel.html" , :locals => {:assets => assets}
56
+ .clear
57
+ - first_open = true
41
58
 
42
59
  #upload.tab-pane
43
60
  - @asset = Gluttonberg::Asset.new
@@ -57,4 +74,4 @@
57
74
  #search_tab_results
58
75
 
59
76
  :javascript
60
- $(".collapse").collapse({parent: "#accordion_for_collections"})
77
+ //$(".collapse").collapse({parent: "#accordion_for_collections"})
@@ -1,2 +1,2 @@
1
1
  - @assets = @search_assets
2
- = { :name => "Search results for '#{params[:asset_query]}'" , :backURL => admin_asset_browser_url+"?no_frame=false", :markup => asset_panel(@search_assets , params[:category] , "search" ) }.to_json.html_safe
2
+ = { :name => "Search results for '#{params[:asset_query]}'" , :backURL => admin_asset_browser_url+"?no_frame=false", :markup => asset_panel(@search_assets , params[:category] , "search" ) }.to_json.html_safe
@@ -1,5 +1,4 @@
1
1
  - @page_title = "Comments"
2
- - @page_title = "#{link_to @blog.name, admin_blog_articles_path(@blog)} > #{@article.title} Comments".html_safe
3
2
 
4
3
  .row-fluid
5
4
  = render :partial => "/gluttonberg/admin/content/main/sidebar"
@@ -9,6 +8,14 @@
9
8
  %h1
10
9
  = @page_title
11
10
  .subnav
11
+ - if action_name != "index"
12
+ = sub_nav do
13
+ = nav_link("Pending (#{Gluttonberg::Comment.pending_comments_count})", admin_pending_comments_path)
14
+ = nav_link("Approved (#{Gluttonberg::Comment.approved_comments_count})", admin_approved_comments_path)
15
+ = nav_link("Rejected (#{Gluttonberg::Comment.rejected_comments_count})", admin_rejected_comments_path)
16
+ = nav_link("Spam (#{Gluttonberg::Comment.spam_comments_count})", admin_spam_comments_path)
17
+
18
+
12
19
  - if @comments.empty?
13
20
  %p.empty No Comments
14
21
  - else
@@ -26,15 +33,34 @@
26
33
  %tbody
27
34
  - @comments.each do |comment|
28
35
  %tr
29
- %td{:style => "width:10%;"}
36
+ %td{:style => "width:15%;"}
30
37
  = comment.author_name
31
- %td{:style => "width:40%;"}
38
+ %td{:style => "width:50%;"}
32
39
  = simple_format(comment.body)
33
- %td{:style => "width:17%;"}
40
+ %td{:style => "width:10%;"}
34
41
  = comment.created_at
35
- %td.controls{:style => "width:35%;"}
36
- - if comment.moderation_required && can?(:moderate , Gluttonberg::Comment)
37
- = link_to("Approve", moderation_admin_blog_article_comment_path(@blog, @article, comment, :moderation => "approve"), :class => "btn")
38
- = link_to( "Disapprove", moderation_admin_blog_article_comment_path(@blog, @article, comment, :moderation => "disapprove") , :class => "btn")
39
- = link_to("Delete", delete_admin_blog_article_comment_path(@blog, @article, comment), :class => "btn btn-danger")
40
- = will_paginate(@comments)
42
+ %td.controls{:style => "width:20%;"}
43
+ .btn-group
44
+ %a{ :class => "btn dropdown-toggle" , "data-toggle" => "dropdown" , :href => "#"}
45
+ Actions
46
+ %span.caret
47
+ %ul.dropdown-menu
48
+
49
+ - if comment.moderation_required && can?(:moderate , Gluttonberg::Comment)
50
+ %li= link_to("Approve", admin_comment_moderation_path(comment, :moderation => "approve"), :class => "")
51
+ %li= link_to( "Reject", admin_comment_moderation_path(comment, :moderation => "disapprove") , :class => "")
52
+ %li= link_to( "Block comments from this author", admin_block_comment_author_path(comment) , :class => "")
53
+ - elsif can?(:moderate , Gluttonberg::Comment)
54
+ - if comment.approved == true
55
+ %li= link_to( "Reject", admin_comment_moderation_path(comment, :moderation => "disapprove") , :class => "")
56
+ - else
57
+ %li= link_to("Approve", admin_comment_moderation_path(comment, :moderation => "approve"), :class => "")
58
+ %li.divider
59
+ %li.danger= link_to("Delete", admin_comment_delete_path(comment), :class => "")
60
+ = will_paginate(@comments)
61
+
62
+ - if action_name == "pending"
63
+ %p
64
+ If you have recently updated spam settings then please click on following link for re-assessing all pending comments with new spam settings.
65
+
66
+ = link_to "Detect spam in all pending comments" , admin_spam_detection_for_all_pending_comments_path , :class => "btn btn-info"
@@ -5,12 +5,15 @@
5
5
  Content
6
6
  %li
7
7
  = active_link_to("Pages", admin_pages_path, :title => "Pages", :class => "pages")
8
- - if Gluttonberg::Blog.table_exists?
8
+ - if Gluttonberg::Blog.table_exists?
9
9
  %li
10
10
  = active_link_to("Blogs", admin_blogs_path, :title => "Blogs", :class => "blog")
11
+ %li
12
+ = active_link_to("Comments", admin_pending_comments_path, :title => "Comments", :class => "comments", :active => /^\/admin\/comments/)
13
+
11
14
  - if Rails.configuration.enable_gallery == true
12
- %li
13
- = active_link_to("Photo Galleries", admin_galleries_path, :title => "Photo galleries", :class => "gallery")
15
+ %li
16
+ = active_link_to("Photo Galleries", admin_galleries_path, :title => "Photo galleries", :class => "gallery")
14
17
  - for entry in Gluttonberg::Components.nav_entries
15
18
  -if entry[3].blank? || entry[3]==false || (entry[3]==true && session.user.is_super_admin)
16
19
  %li
@@ -22,13 +22,13 @@
22
22
  %p
23
23
  %strong Discussion
24
24
  %p
25
- = "#{Gluttonberg::Comment.count} Comments"
25
+ = link_to "#{Gluttonberg::Comment.all_pending.count} Pending" , admin_pending_comments_path
26
26
  %p
27
- = "#{Gluttonberg::Comment.all_approved.count} Approved"
27
+ = link_to "#{Gluttonberg::Comment.all_approved.count} Approved" , admin_approved_comments_path
28
28
  %p
29
- = "#{Gluttonberg::Comment.all_pending.count} Pending"
29
+ = link_to "#{Gluttonberg::Comment.all_rejected.count} Rejected" , admin_rejected_comments_path
30
30
  %p
31
- = "#{Gluttonberg::Comment.all_rejected.count} Spam"
31
+ = link_to "#{Gluttonberg::Comment.all_spam.count} Spam" , admin_spam_comments_path
32
32
  .span9
33
33
  %h1
34
34
  = website_title
@@ -18,7 +18,8 @@
18
18
  %tr
19
19
  %th Name
20
20
  %th Value (Click to edit)
21
- %th.controls Controls
21
+ - if Gluttonberg::Setting.has_deletable_settings?
22
+ %th.controls Controls
22
23
  %tbody
23
24
  - i = 1
24
25
  %tr{ :class => ""}
@@ -26,15 +27,17 @@
26
27
  Select Home Page
27
28
  %td.second_column
28
29
  = select_tag :home , options_from_collection_for_select(@pages, "id", "name" , selected = @current_home_page_id.to_s ) , { :include_blank => true , :class => "home_page_setting_dropdown" , :rel => admin_page_update_home_path(1) }
29
-
30
- %td.controls
31
30
  = image_tag("/assets/gb_spinner.gif" , :id => "progress_home_page" , :style => "display:none")
32
31
  - for setting in @settings
33
32
  - i += 1
34
33
  %tr{ :class => "#{cycle("even", "odd")}"}
35
- %td.first_column{ :style => 'width:20%' }
34
+ %td.first_column{ :style => 'width:220px' }
36
35
  = setting.user_friendly_name
37
36
  %td.second_column
37
+ - unless setting.help.blank?
38
+ %i{ :style => "font-size: 90%;" }= setting.help
39
+ %span{:style => "height: 10px; display: block;"}
40
+
38
41
  - if setting.dropdown_required?
39
42
  = select_tag(:value , options_for_select( setting.parsed_values_list_for_dropdown , setting.value ) , { :include_blank => true , :data_id => setting.id , :rel => admin_generic_setting_path( setting) , :class => "setting_dropdown" })
40
43
  - elsif setting.name == "fb_icon"
@@ -46,8 +49,9 @@
46
49
  = gb_editable_field setting, :value , :update_url => admin_generic_setting_path( setting)
47
50
 
48
51
  = image_tag("/assets/gb_spinner.gif" , :id => "progress_#{setting.id}" , :style => "display:none")
49
- %td.controls
50
- - if setting.delete_able
51
- = link_to 'Delete', delete_admin_generic_setting_path(setting)
52
+ - if Gluttonberg::Setting.has_deletable_settings?
53
+ %td.controls
54
+ - if setting.delete_able
55
+ = link_to 'Delete', delete_admin_generic_setting_path(setting)
52
56
 
53
57
 
data/config/routes.rb CHANGED
@@ -22,6 +22,16 @@ Rails.application.routes.draw do
22
22
  end
23
23
 
24
24
  get "pages_list_for_tinymce" => "pages#pages_list_for_tinymce" , :as => :pages_list_for_tinymce
25
+ get "/comments/spam_detection_for_all_pending" => "comments#spam_detection_for_all_pending" , :as => :spam_detection_for_all_pending_comments
26
+ get "/comments/pending" => "comments#pending" , :as => :pending_comments
27
+ get "/comments/spam" => "comments#spam" , :as => :spam_comments
28
+ get "/comments/approved" => "comments#approved" , :as => :approved_comments
29
+ get "/comments/rejected" => "comments#rejected" , :as => :rejected_comments
30
+ get "/comments/moderation/:id" => "comments#moderation" , :as => :comment_moderation
31
+ get "/comments/delete/:id" => "comments#delete" , :as => :comment_delete
32
+ delete "/comments/destroy/:id" => "comments#destroy" , :as => :comment_destroy
33
+ get "/comments/block_comment_author/:id" => "comments#block_comment_author" , :as => :block_comment_author
34
+
25
35
  resources :blogs do
26
36
  get 'delete', :on => :member
27
37
  resources :articles do
@@ -0,0 +1,6 @@
1
+ class SpamFlagForComments < ActiveRecord::Migration
2
+ def change
3
+ add_column :gb_comments , :spam , :boolean , :default => false
4
+ add_column :gb_comments , :spam_score , :float
5
+ end
6
+ end
data/lib/engine.rb CHANGED
@@ -20,9 +20,10 @@ module Gluttonberg
20
20
  config.identify_locale = :prefix
21
21
  config.host_name = "localhost:3000"
22
22
  config.user_roles = [] # User model always concat following two roles ["superadmin" , "admin"]
23
- config.honeypot_field_name = "gluttonberg_honeypot"
23
+ config.honeypot_field_name = "our_newly_weekly_series"
24
24
  config.custom_css_for_cms = false
25
25
  config.custom_js_for_cms = false
26
+ config.asset_storage = :filesystem
26
27
  #engines which depends on gluttonberg-core can
27
28
  #use this to provide additional processor for assets
28
29
  #in first stage I am going to use it with Tv
@@ -87,7 +88,7 @@ module Gluttonberg
87
88
  end
88
89
 
89
90
  initializer "setup gluttonberg asset library" do |app|
90
- Gluttonberg::Library.setup
91
+ #Gluttonberg::Library.setup
91
92
  require "acts-as-taggable-on"
92
93
  if ::ActsAsTaggableOn::Tag.attribute_names.include?("slug") == true
93
94
  ::ActsAsTaggableOn::Tag.send(:include , Gluttonberg::Content::SlugManagement)
@@ -1,13 +1,13 @@
1
1
  require 'rails/generators'
2
- require 'rails/generators/migration'
2
+ require 'rails/generators/migration'
3
3
 
4
4
  class Gluttonberg::InstallerGenerator < Rails::Generators::Base
5
5
  include Rails::Generators::Migration
6
-
6
+
7
7
  def self.source_root
8
8
  @source_root ||= File.join(File.dirname(__FILE__), 'templates')
9
9
  end
10
-
10
+
11
11
  def self.next_migration_number(dirname)
12
12
  if ActiveRecord::Base.timestamped_migrations
13
13
  Time.now.utc.strftime("%Y%m%d%H%M%S")
@@ -15,76 +15,77 @@ class Gluttonberg::InstallerGenerator < Rails::Generators::Base
15
15
  "%.3d" % (current_migration_number(dirname) + 1)
16
16
  end
17
17
  end
18
-
18
+
19
19
  def create_delayed_job_script_file
20
20
  template 'delayed_job_script', 'script/delayed_job'
21
21
  chmod 'script/delayed_job', 0755
22
22
  end
23
-
23
+
24
24
  def create_migration_file
25
25
  migration_template 'gluttonberg_migration.rb', 'db/migrate/gluttonberg_migration.rb'
26
+ rake("gluttonberg_engine:install:migrations")
26
27
  end
27
-
28
+
28
29
  def create_page_descriptions_file
29
30
  copy_file 'page_descriptions.rb', 'config/page_descriptions.rb'
30
31
  end
31
-
32
+
32
33
  def create_sitemaprb_file
33
34
  copy_file 'sitemap.rb', 'config/sitemap.rb'
34
35
  end
35
-
36
+
36
37
  def create_default_public_layout
37
38
  #create pages folder
38
39
  path = File.join(Rails.root, "app", "views" , "pages" )
39
40
  FileUtils.mkdir(path) unless File.exists?(path)
40
41
  #copy layout into host app
41
- template "public.html.haml", File.join('app/views/layouts', "public.html.haml")
42
+ template "public.html.haml", File.join('app/views/layouts', "public.html.haml")
42
43
  end
43
-
44
+
44
45
  def run_migration
45
46
  rake("db:migrate")
46
47
  end
47
-
48
+
48
49
  def bootstrap_data
49
50
  rake("gluttonberg:library:bootstrap")
50
51
  rake("gluttonberg:generate_default_locale")
51
52
  rake("gluttonberg:generate_or_update_default_settings")
52
53
  end
53
-
54
+
54
55
  def localization_config
55
-
56
+
56
57
  application %{
57
58
  # Gluttonberg Related config
58
-
59
-
60
- # config.cms_based_public_css = false
61
- # config.custom_js_for_cms = false
62
- config.localize = false
59
+
60
+
61
+ # config.cms_based_public_css = false
62
+ # config.custom_js_for_cms = false
63
+ config.localize = false
63
64
  # By Default gluttonberg applications are localized. If you do not want localized application then uncomment following line.
64
-
65
- # By default membership system is disabled. uncommenting following line make it enabled.
65
+
66
+ # By default membership system is disabled. uncommenting following line make it enabled.
66
67
  # if email_verification is true then newly registered members have to verify their email address
67
68
  # config.enable_members = {:email_verification => true}
68
-
69
- # By default photo gallery is not visible in backend.
70
- # config.enable_gallery = true
71
-
69
+
70
+ # By default photo gallery is not visible in backend.
71
+ # config.enable_gallery = true
72
+
72
73
  # You can customize your thumbnails. For geometry values please read ImageMagick documentation
73
- config.thumbnails = {
74
- :jwysiwyg_image => {:label => "Thumb for jwysiwyg", :filename => "_jwysiwyg_image", :geometry => "250x200"}
74
+ config.thumbnails = {
75
+ :jwysiwyg_image => {:label => "Thumb for jwysiwyg", :filename => "_jwysiwyg_image", :geometry => "250x200"}
75
76
  }
76
-
77
-
77
+
78
+
78
79
  }
79
-
80
+
80
81
  end
81
-
82
+
82
83
  def add_memory_store_config_in_production
83
84
  data = []
84
85
  file_path = File.join(Rails.root, "config", "environments" , "production.rb" )
85
86
  file = File.new(file_path)
86
87
 
87
- file.each_line do |line|
88
+ file.each_line do |line|
88
89
  data << line
89
90
  end
90
91
 
@@ -100,6 +101,6 @@ class Gluttonberg::InstallerGenerator < Rails::Generators::Base
100
101
  file.puts(data.join(""))
101
102
  file.close
102
103
  end
103
-
104
+
104
105
  end
105
106
 
@@ -83,6 +83,8 @@ module Gluttonberg
83
83
  localized_model.attr_accessible :text, :parent, :page_localization
84
84
  localized_model.is_versioned
85
85
 
86
+ localized_model.clean_html([:text])
87
+
86
88
  end
87
89
 
88
90
  # Does this class have an associated localization class.
@@ -1,33 +1,35 @@
1
1
  module Gluttonberg
2
2
  module Content
3
-
3
+
4
4
  module CleanHtml
5
-
5
+
6
6
  def self.setup
7
7
  ::ActiveRecord::Base.send :include, Gluttonberg::Content::CleanHtml
8
8
  end
9
-
9
+
10
10
  def self.included(klass)
11
11
  klass.class_eval do
12
12
  extend ClassMethods
13
- include InstanceMethods
14
- before_validation :clean_all_html_content
15
-
16
- cattr_accessor :html_columns_list
17
13
  end
18
14
  end
19
-
15
+
20
16
  module ClassMethods
21
17
  def clean_html(cols)
22
- self.html_columns_list = cols
18
+ class_eval <<-EOV
19
+ include InstanceMethods
20
+ before_validation :clean_all_html_content
21
+ cattr_accessor :html_columns_list
22
+ self.html_columns_list = cols
23
+
24
+ EOV
23
25
  end
24
-
26
+
25
27
  def clean_tags(str)
26
28
  if !str.blank? && str.instance_of?(String)
27
29
  str = self.removeStyle(str)
28
30
  str = self.removeMetaTag(str)
29
31
  str = removeEmptyTag(str)
30
- end
32
+ end
31
33
  str
32
34
  end
33
35
 
@@ -58,17 +60,17 @@ module Gluttonberg
58
60
  str
59
61
  end
60
62
  end
61
-
63
+
62
64
  module InstanceMethods
63
65
  def clean_all_html_content
64
66
  unless self.class.html_columns_list.blank?
65
67
  self.class.html_columns_list.each do |field|
66
68
  write_attribute(field , self.class.clean_tags(read_attribute(field)) )
67
69
  end
68
- end
70
+ end
69
71
  end
70
72
  end
71
-
73
+
72
74
  end
73
75
  end
74
76
  end