Commit 761c2d93cc541057ee92ab10f404dd2e0d98183a
Exists in
master
and in
21 other branches
Merge branch 'tolerance-time' into 'master'
solved bugs in tolerance time plugin See merge request !332
Showing
4 changed files
with
5 additions
and
5 deletions
Show diff stats
plugins/tolerance_time/lib/tolerance_time_plugin.rb
| ... | ... | @@ -28,7 +28,7 @@ class ToleranceTimePlugin < Noosfero::Plugin |
| 28 | 28 | end |
| 29 | 29 | |
| 30 | 30 | def cms_controller_filters |
| 31 | - return if !context.environment.plugin_enabled?(ToleranceTimePlugin) | |
| 31 | + p = Proc.new { |context| return if !context.environment.plugin_enabled?(ToleranceTimePlugin) } | |
| 32 | 32 | block = lambda do |
| 33 | 33 | content = Article.find(params[:id]) |
| 34 | 34 | if ToleranceTimePlugin.expired?(content) |
| ... | ... | @@ -36,7 +36,6 @@ class ToleranceTimePlugin < Noosfero::Plugin |
| 36 | 36 | redirect_to content.url |
| 37 | 37 | end |
| 38 | 38 | end |
| 39 | - | |
| 40 | 39 | { :type => 'before_filter', |
| 41 | 40 | :method_name => 'expired_content', |
| 42 | 41 | :options => {:only => 'edit'}, |
| ... | ... | @@ -44,7 +43,7 @@ class ToleranceTimePlugin < Noosfero::Plugin |
| 44 | 43 | end |
| 45 | 44 | |
| 46 | 45 | def content_viewer_controller_filters |
| 47 | - return if !context.environment.plugin_enabled?(ToleranceTimePlugin) | |
| 46 | + p = Proc.new { |context| return if !context.environment.plugin_enabled?(ToleranceTimePlugin) } | |
| 48 | 47 | block = lambda do |
| 49 | 48 | content = Comment.find(params[:id]) |
| 50 | 49 | if ToleranceTimePlugin.expired?(content) |
| ... | ... | @@ -52,7 +51,6 @@ class ToleranceTimePlugin < Noosfero::Plugin |
| 52 | 51 | redirect_to content.article.url |
| 53 | 52 | end |
| 54 | 53 | end |
| 55 | - | |
| 56 | 54 | { :type => 'before_filter', |
| 57 | 55 | :method_name => 'expired_content', |
| 58 | 56 | :options => {:only => 'edit_comment'}, | ... | ... |
plugins/tolerance_time/lib/tolerance_time_plugin/publication.rb
| ... | ... | @@ -2,6 +2,7 @@ class ToleranceTimePlugin::Publication < Noosfero::Plugin::ActiveRecord |
| 2 | 2 | belongs_to :target, :polymorphic => true |
| 3 | 3 | validates_presence_of :target_id, :target_type |
| 4 | 4 | validates_uniqueness_of :target_id, :scope => :target_type |
| 5 | + attr_accessible :target | |
| 5 | 6 | |
| 6 | 7 | class << self |
| 7 | 8 | def find_by_target(target) | ... | ... |
plugins/tolerance_time/lib/tolerance_time_plugin/tolerance.rb
| ... | ... | @@ -4,4 +4,5 @@ class ToleranceTimePlugin::Tolerance < Noosfero::Plugin::ActiveRecord |
| 4 | 4 | validates_uniqueness_of :profile_id |
| 5 | 5 | validates_numericality_of :content_tolerance, :only_integer => true, :allow_nil => true |
| 6 | 6 | validates_numericality_of :comment_tolerance, :only_integer => true, :allow_nil => true |
| 7 | + attr_accessible :profile, :content_tolerance, :comment_tolerance | |
| 7 | 8 | end | ... | ... |
plugins/tolerance_time/views/tolerance_time_plugin_myprofile/index.html.erb