Skip to content

Commit

Permalink
"活動"に対応 / Add "Activity"
Browse files Browse the repository at this point in the history
  • Loading branch information
ameya86 committed Feb 6, 2013
1 parent ec57b62 commit 9c669d5
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 8 deletions.
9 changes: 7 additions & 2 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

== インストール

1. RAILS_ROOT/vendor/pluginsに配置する。
1. RAILS_ROOT/pluginsに配置する。

2. rake db:migrate_plugins RAILS_ENV=production
を実行する。
Expand All @@ -20,7 +20,7 @@
rake db:migrate:plugin RAILS_ENV=production VERSION=0 NAME=redmine_already_read
を実行する。

2. RAILS_ROOT/vendor/pluginsから削除する。
2. RAILS_ROOT/pluginsから削除する。

3. Redmineを再起動する。

Expand All @@ -35,6 +35,11 @@

== 更新履歴

=== Version 0.0.3

"活動"にチケットを読んだことが残るようにしました。


=== Version 0.0.2

フィルターが正しく表示されていなかったのを修正。
Expand Down
26 changes: 26 additions & 0 deletions app/models/already_read.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,30 @@ class AlreadyRead < ActiveRecord::Base
belongs_to :issue

validates_presence_of :user, :issue

# "活動"に表示されるようにイベントをプロバイダを登録する
acts_as_event :title => Proc.new {|o| "#{o.issue.tracker.name} ##{o.issue.id} (#{o.issue.status}): #{o.issue.subject}"},
:type => 'issue-note',
: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 ]},
:author_key => :user_id, :type => 'issues'

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

# 状態の説明
# "活動"で参照する
def description
return l(:activity_already_read)
end

# 属するプロジェクト
# "活動"で参照する
def project
return self.issue.project
end
end
6 changes: 4 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ en:
field_already_read_date: Read Date

label_already_read: Read
label_read: Read
label_unread: Unread
label_already_read_read: Read
label_already_read_unread: Unread

activity_already_read: Read
6 changes: 4 additions & 2 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ ja:
field_already_read_date: 読んだ日時

label_already_read: 既読
label_read: 既読
label_unread: 未読
label_already_read_read: 既読
label_already_read_unread: 未読

activity_already_read: 読みました
5 changes: 4 additions & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
name 'Redmine Already Read plugin'
author 'OZAWA Yasuhiro'
description 'Markup read issues.'
version '0.0.2'
version '0.0.3'
url 'https://github.com/ameya86/redmine_already_read'
author_url 'http://blog.livedoor.jp/ameya86/'

# "活動"にチケットイベントとして登録
activity_provider :issues, :class_name => 'AlreadyRead'
end
2 changes: 1 addition & 1 deletion lib/already_read/issue_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Issue < ActiveRecord::Base

# 状態を文字で返す
def already_read(user = User.current)
return (already_read?(user))? l(:label_read) : l(:label_unread)
return (already_read?(user))? l(:label_already_read_read) : l(:label_already_read_unread)
end

# 既読ならtrueを返す
Expand Down
Binary file added sample/already_read1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sample/already_read2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9c669d5

Please sign in to comment.