Commit 761c2d93cc541057ee92ab10f404dd2e0d98183a
Exists in
master
and in
29 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,7 +28,7 @@ class ToleranceTimePlugin < Noosfero::Plugin | ||
| 28 | end | 28 | end |
| 29 | 29 | ||
| 30 | def cms_controller_filters | 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 | block = lambda do | 32 | block = lambda do |
| 33 | content = Article.find(params[:id]) | 33 | content = Article.find(params[:id]) |
| 34 | if ToleranceTimePlugin.expired?(content) | 34 | if ToleranceTimePlugin.expired?(content) |
| @@ -36,7 +36,6 @@ class ToleranceTimePlugin < Noosfero::Plugin | @@ -36,7 +36,6 @@ class ToleranceTimePlugin < Noosfero::Plugin | ||
| 36 | redirect_to content.url | 36 | redirect_to content.url |
| 37 | end | 37 | end |
| 38 | end | 38 | end |
| 39 | - | ||
| 40 | { :type => 'before_filter', | 39 | { :type => 'before_filter', |
| 41 | :method_name => 'expired_content', | 40 | :method_name => 'expired_content', |
| 42 | :options => {:only => 'edit'}, | 41 | :options => {:only => 'edit'}, |
| @@ -44,7 +43,7 @@ class ToleranceTimePlugin < Noosfero::Plugin | @@ -44,7 +43,7 @@ class ToleranceTimePlugin < Noosfero::Plugin | ||
| 44 | end | 43 | end |
| 45 | 44 | ||
| 46 | def content_viewer_controller_filters | 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 | block = lambda do | 47 | block = lambda do |
| 49 | content = Comment.find(params[:id]) | 48 | content = Comment.find(params[:id]) |
| 50 | if ToleranceTimePlugin.expired?(content) | 49 | if ToleranceTimePlugin.expired?(content) |
| @@ -52,7 +51,6 @@ class ToleranceTimePlugin < Noosfero::Plugin | @@ -52,7 +51,6 @@ class ToleranceTimePlugin < Noosfero::Plugin | ||
| 52 | redirect_to content.article.url | 51 | redirect_to content.article.url |
| 53 | end | 52 | end |
| 54 | end | 53 | end |
| 55 | - | ||
| 56 | { :type => 'before_filter', | 54 | { :type => 'before_filter', |
| 57 | :method_name => 'expired_content', | 55 | :method_name => 'expired_content', |
| 58 | :options => {:only => 'edit_comment'}, | 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,6 +2,7 @@ class ToleranceTimePlugin::Publication < Noosfero::Plugin::ActiveRecord | ||
| 2 | belongs_to :target, :polymorphic => true | 2 | belongs_to :target, :polymorphic => true |
| 3 | validates_presence_of :target_id, :target_type | 3 | validates_presence_of :target_id, :target_type |
| 4 | validates_uniqueness_of :target_id, :scope => :target_type | 4 | validates_uniqueness_of :target_id, :scope => :target_type |
| 5 | + attr_accessible :target | ||
| 5 | 6 | ||
| 6 | class << self | 7 | class << self |
| 7 | def find_by_target(target) | 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 +4,5 @@ class ToleranceTimePlugin::Tolerance < Noosfero::Plugin::ActiveRecord | ||
| 4 | validates_uniqueness_of :profile_id | 4 | validates_uniqueness_of :profile_id |
| 5 | validates_numericality_of :content_tolerance, :only_integer => true, :allow_nil => true | 5 | validates_numericality_of :content_tolerance, :only_integer => true, :allow_nil => true |
| 6 | validates_numericality_of :comment_tolerance, :only_integer => true, :allow_nil => true | 6 | validates_numericality_of :comment_tolerance, :only_integer => true, :allow_nil => true |
| 7 | + attr_accessible :profile, :content_tolerance, :comment_tolerance | ||
| 7 | end | 8 | end |
plugins/tolerance_time/views/tolerance_time_plugin_myprofile/index.html.erb
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | <%= error_messages_for :tolerance %> | 3 | <%= error_messages_for :tolerance %> |
| 4 | 4 | ||
| 5 | -<%= form_for :tolerance, @tolerance do |f| %> | 5 | +<%= form_for :tolerance do |f| %> |
| 6 | 6 | ||
| 7 | <% time_units = [[_('Seconds'), 1], [_('Minutes'), 60], [_('Hours'), 3600]]%> | 7 | <% time_units = [[_('Seconds'), 1], [_('Minutes'), 60], [_('Hours'), 3600]]%> |
| 8 | 8 |