Skip to content

Commit

Permalink
3.0、3.1に仮対応
Browse files Browse the repository at this point in the history
  • Loading branch information
ameya86 committed Oct 4, 2015
1 parent ea67261 commit ccd3bf2
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
10 changes: 7 additions & 3 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
チケットの既読/未読を管理し、チケット一覧に「既読」「読んだ日時」列を追加します。
チケットを更新すると、そのチケットは未読チケットに戻ります。

Redmine2.5.1で簡単な動作確認したのみ。
Redmine3.0.5、3.1.1で簡単な動作確認したのみ。


== インストール

1. RAILS_ROOT/pluginsに配置する。

2. rake db:migrate_plugins RAILS_ENV=production
2. rake redmine:plugins:migrate RAILS_ENV=production
を実行する。

3. Redmineを再起動する。
Expand All @@ -19,7 +19,7 @@ Redmine2.5.1で簡単な動作確認したのみ。
== アンインストール

1. RAILS_ROOTで
rake db:migrate:plugin RAILS_ENV=production VERSION=0 NAME=redmine_already_read
rake redmine:plugins:migrate RAILS_ENV=production VERSION=0 NAME=redmine_already_read
を実行する。

2. RAILS_ROOT/pluginsから削除する。
Expand All @@ -37,6 +37,10 @@ Redmine2.5.1で簡単な動作確認したのみ。

== 更新履歴

=== Version 0.0.5

3.0、3.1に仮対応。

=== Version 0.0.4

2.3のクエリの実装変更に仮対応。
Expand Down
9 changes: 5 additions & 4 deletions app/models/already_read.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ class AlreadyRead < ActiveRecord::Base
:author => :user,
:url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.issue.id}}

acts_as_activity_provider :find_options => {:include => [ {:issue => [:project, :tracker, :status]}, :user ]},
acts_as_activity_provider :scope => preload({:issue => [:project, :tracker, :status]}, :user),
:author_key => :user_id, :type => 'issues'

# "活動"で参照するための閲覧スコープ
scope :visible,
lambda {|*args| { :include => {:issue => :project},
:conditions => Issue.visible_condition(args.shift || User.current, *args) } }
scope :visible, lambda {|*args|
joins(:issue => :project).
where(Issue.visible_condition(args.shift || User.current, *args))
}

# 状態の説明
# "活動"で参照する
Expand Down
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
name 'Redmine Already Read plugin'
author 'OZAWA Yasuhiro'
description 'Markup read issues.'
version '0.0.4'
version '0.0.5'
url 'https://github.com/ameya86/redmine_already_read'
author_url 'http://blog.livedoor.jp/ameya86/'

Expand Down
2 changes: 1 addition & 1 deletion lib/already_read/issue_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def css_classes_with_already_read
end

class Issue < ActiveRecord::Base
has_many :already_reads, :include => [:user], :order => :created_on
has_many :already_reads, lambda {includes(:user); order(:created_on)}
has_many :already_read_users, :through => :already_reads, :source => :user
after_update :reset_already_read

Expand Down
2 changes: 1 addition & 1 deletion lib/already_read/issues_controller_patch.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_dependency 'issues_controller'

class IssuesController < ApplicationController
after_filter :issue_read, :only => [:show]
after_action :issue_read, :only => [:show]

private
# 既読フラグを付ける
Expand Down
2 changes: 1 addition & 1 deletion lib/already_read/user_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
require_dependency 'user'

class User < Principal
has_many :already_reads, :order => :created_on
has_many :already_reads, lambda {order(:created_on)}
has_many :already_read_issues, :through => :already_reads, :source => :issue
end

0 comments on commit ccd3bf2

Please sign in to comment.