退役SEのつれづれ日記

定年退役SEが、つれづれなる想いをしたためています。
(旧名:『システムノヲニワソト』)

[plugin][redmine]redmine_issue_extensionsの導入・テスト

2016-10-04 | サーバ設定(redmine,zabbix
redmine_issue_extensionsの導入と稼働させるまでの対応について、纏めてみた。

1.コードの導入
(参考)
planio-gmbh/redmine_issue_extensions
 https://github.com/planio-gmbh/redmine_issue_extensions
[root@0hostname plugins]# git clone https://github.com/planio-gmbh/redmine_issue_extensions.git
Cloning into 'redmine_issue_extensions'...
remote: Counting objects: 864, done.
remote: Total 864 (delta 0), reused 0 (delta 0), pack-reused 864
Receiving objects: 100% (864/864), 275.59 KiB | 164.00 KiB/s, done.
Resolving deltas: 100% (132/132), done.

2.pluginの導入
[root@hostname htdocs]# rake --trace redmine:plugins:migrate NAME=redmine_issue_extensions RAILS_ENV=production
An error occurred while loading the routes definition of redmine_issue_extensions plugin (/opt/redmine/apps/redmine/htdocs/plugins/redmine_issue_extensions/config/routes.rb): You should not use the `match` method in your router without specifying an HTTP method.
If you want to expose your action to both GET and POST, add `via: [:get, :post]` option.
If you want to expose your action to GET, use `get` in the router:
Instead of: match "controller#action"
Do: get "controller#action".

3.エラーの対応:RAILS4でサポートされない表記方法を修正する
(1)match を get に変更
[修正対象候補リスト]:ここら辺をごにょごにょする。
☆/opt/redmine/apps/redmine/htdocs/plugins/redmine_issue_extensions/config/routes.rb
match 'issue_extensions/:action', :controller => 'issue_extensions', :via => [:get, :post]
match 'issue_extensions_settings/:action', :controller => 'issue_extensions_settings'
match 'issue_relations/:action', :controller => 'issue_relations', :via => [:get, :post]

(2)findメソッドの変更
[修正対象候補リスト]:ここら辺をごにょごにょする。
☆/opt/redmine/apps/redmine/htdocs/plugins/redmine_issue_extensions/app/models/issue_extensions_status_flow.rb
 status_flow = IssueExtensionsStatusFlow.find :first, :conditions => ['project_id = ?', project_id]
☆/opt/redmine/apps/redmine/htdocs/plugins/redmine_issue_extensions/app/views/issue_extensions_settings/_show.html.erb
 @statuses = IssueStatus.find(:all, :order => 'position') %>
☆/opt/redmine/apps/redmine/htdocs/plugins/redmine_issue_extensions/lib/issue_extensions_issue_hooks.rb
 issue_status = IssueExtensionsStatusFlow.find :first, :conditions => ['project_id = ?', issue[:project_id].to_i]
 issue_status_closed = IssueStatus.find :all, :conditions => ["is_closed = (?)", true]
 if Watcher.find :first, :conditions =>["watchable_type = (?) and watchable_id = (?) and user_id = (?)", journal[:journalized_type], issue[:id].to_i, journal[:user_id].to_i] == nil
 from_issue = Issue.find :first, :conditions =>["id = (?)", params[:relation_issue_id].to_i]
☆/opt/redmine/apps/redmine/htdocs/plugins/redmine_issue_extensions/app/views/issues/_issue_extensions_form.erb
 searched_issues = Issue.find(:all, :conditions => ["project_id = ? AND subject LIKE (?)", @issue.project_id, '%' + cb_subject + '%']) unless cb_subject == "" %>
(参考)
findよりfind_by_idでActiveRecord::RecordNotFoundを回避する
 http://d.hatena.ne.jp/takeru-c/20090920/1253416605
Redmine 3.0でglossary pluginを動くようにする
 http://www.torutk.com/issues/40

(3)link_to_remoteの変更
[修正対象候補リスト]:ここら辺をごにょごにょする。
☆/opt/redmine/apps/redmine/htdocs/plugins/redmine_issue_extensions/app/views/issues/_issue_extensions_form.erb
link_to_remote image_tag('edit.png') + l(:label_add_relation), {
:url => {:controller => 'issue_relations', :action => 'create', :issue_id => @issue, :id => @issue.id, :relation => {:relation_type => 'relates', :issue_to_id => earched_issue.id}},
:method => :post
}
(参考)
ψ(プサイ)の興味関心空間:rails2.xの**_remoteをrails3.xに機械的に移植するには
 http://ledyba.org/2011/03/05192131.php

なんとか、トップの画像のような表示と、完了で進捗率100%と設定、コメント入れるとウォッチャに登録してくれる機能が実現された。
コメント    この記事についてブログを書く
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする
« [plugin][redmine] enter_ca... | トップ | [plugin][redmine] redmine_k... »