プロジェクト

全般

プロフィール

Vote #67665

未完了

hook for :view_repositories_show_contextual is incomplete

Admin Redmine さんが約2年前に追加. 約2年前に更新.

ステータス:
Reopend
優先度:
通常
担当者:
-
カテゴリ:
Plugin API_20
対象バージョン:
-
開始日:
2010/07/21
期日:
進捗率:

0%

予定工数:
category_id:
20
version_id:
0
issue_org_id:
5932
author_id:
443
assigned_to_id:
0
comments:
4
status_id:
8
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Reopend]

説明

I wrote a plugin to add new commands in repository views (upload files, create directory and delete file/directory) and I noticed that :view_repositories_show_contextual hook lacks of 2 context parameters:

  • path
  • revision

As a "workaround", I patched the views (show.rhtml, entry.rhtml, changes.rhtml and annotate.rhtml) to replace:

<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project }) %>

with

<%= call_hook(:view_repositories_show_contextual, { :repository => @repository, :project => @project, :path => @path, :revision => @rev }) %>

but it would be better if included in the next release of Redmine...


journals

As you can see in "one of my plugins":http://dev.holgerjust.de/projects/redmine-checkout/repository/entry/trunk/lib/checkout/repository_hooks.rb#L15 (line 15), you can get these variables today without having to patch the hook calls.
--------------------------------------------------------------------------------
Many thanks!!! I didn't know how to do that and I really like your solution: I will undo my patches ASAP!!!
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
I disagree... Many things are accessible through @context[:controller]@ but it's not the right way to go for me. Hooks should provide instance variables directly so plugin developers don't have to do hacky things like @instance_variable_get@. Else, with this argument, we could remove nearly any context variables passed to the hooks ;)

It makes me think of using @.send()@ to bypass object privacy: possible, but not so good in most cases.

Is there a particular reason why we should refuse adding those variables ? Maybe something I missed..
--------------------------------------------------------------------------------

Admin Redmine さんが約2年前に更新

  • カテゴリPlugin API_20 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0