Project

General

Profile

"Seal of approval" plugin

Added by Tim Lobitz about 13 years ago

Hi,

I installed redmine_project_filtering https://github.com/splendeo/redmine_project_filtering to have certain attributes of projects appear on the overview page. It shows all custom fields created as "List" in Administration -> Custom Fields -> Projects on the projects overview page.

One of my custom fields is "Seal of Approval". Currently, it has the values "Yes" or "No", but I want to make it a bit... fancier :D. Depending on the value, an image is to be displayed anywhere next to the Project Name (above, below, left, right, doesn't matter, kind of like the fav.png - star for "My projects"), indicating the type of seal.

Is there any plugin that does such a thing? If not, can redmine (or a plugin) be modified to behave that way?

I have zero knowledge about Ruby / Rails and Redmine Plugin Development but am very willing to learn. Shouldn't be too hard, I guess, something like

if seal_of_approval = "No"
display image "no_seal.jpg"

(Yay, Pseudocode). Problem: I have no idea where to start / where to look, with the Redmine Plugin Tutorial offering little help.

Any hints / suggestions appreciated.


Replies (6)

RE: "Seal of approval" plugin - Added by Mischa The Evil about 13 years ago

Tim Lobitz wrote:

[...]

Is there any plugin that does such a thing? If not, can redmine (or a plugin) be modified to behave that way?

As far as I know there isn't any plugin which provides such specific feature. Because of it's specificness I don't think this is something that should be done by the Redmine core. Besides that: there are API hooks available on the projects show view, thus a plugin solution would be the best. As I've said, there isn't any plugin yet which provides (kind of) this feature, thus making extending something rather difficult... ;)

I have zero knowledge about Ruby / Rails and Redmine Plugin Development but am very willing to learn. Shouldn't be too hard, I guess, something like

...

Problem: I have no idea where to start / where to look, with the Redmine Plugin Tutorial offering little help.

If you are not that skilled it can be difficult to start writing a plugin, although the plugin tutorial covers most basic parts. Basic steps include:
  1. create plugin
  2. extend chosen API hook with HTML (as in e.g. adding a new project overview box which will serve as a placeholder for the images based on project_custom-field value)

For the usage of the API hooks see Hooks and some real-life examples of API hook usage like e.g. https://github.com/planio/redmine_spent_time_column.

HTH...

RE: "Seal of approval" plugin - Added by Tim Lobitz about 13 years ago

If you are not that skilled it can be difficult to start writing a plugin, although the plugin tutorial covers most basic parts.

The plugin tutorial isn't really helping - I generated a new plugin, it shows up in the plugin list and that's it. Everything beyond that doesn't seem to be relevant for me, I don't need new sites or new menu entries, I just need this one minor addition to the Projects Overview site.

I wonder - do I really need to create a plugin for that?

I'm currently looking into how redmine implements the my-projects-fav.png-star, as this is simliar to the way I want the seal of approval to be displayed. However, instead of the current function it should react to the mentioned custom field.

I don't know... I'm just poking around in the code right now (with a look on my face like a kid who lost its parents in the supermarket) and I'm only slowly (really slowly) beginning to understand how Ruby/Rails/Redmine works.

RE: "Seal of approval" plugin - Added by Mischa The Evil about 13 years ago

Tim Lobitz wrote:

[...]

I wonder - do I really need to create a plugin for that?

No, you can do this by hacking the Redmine core. Though, this has major drawbacks when it comes to maintainability of your Redmine instance over time which isn't something that can be advised unless your familiar with the whole stack on top of which Redmine runs, including Redmine itself (as in Ruby, Ruby on Rails, Redmine core) and have lots of hours to spent when it comes to upgrades, conflicts etc.

Note: I took a second look at your request and it seems I misinterpreted it in my earlier note. Therein I wrote about a plugin that could utilize the hooks available in the projects show view. That is not what you want, as I understand now.

I thought about adding a new "box" to the projects show view which should then function as a container for an image which is selected based upon the projects custom field value.
The above should be possible via a plugin pretty easy. In contrast: you want the (small) images added to the the individual projects in the project hierarchy on the projects index view. That view doesn't have any API hooks to insert new HTML cleanly (as in not having to overload the whole view).

Summarizing:
  1. reconsider your request (since it's not easy to actually implement it, both as core hack and as plugin, as it is now)
  2. boost your Ruby/Rails/Redmine skills ánd familiarity (so you become able to maintain a self-created Redmine core patch/plugin yourself)
  3. take your wallet and buy some commercial support/development

I suggest the given order of the items... :)

RE: "Seal of approval" plugin - Added by Tim Lobitz about 13 years ago

Successfully implemented this today. After reading through a few Ruby basics and finally finding a place to start it was surprisingly easy. I modified the projects_helper_patch.rb from the redmine_project_filtering plugin to display the seal of approval depending on the custom field value, only took a few cases and ifs, about 10 lines of code.

See attached image for screenshot. Images are placeholder graphics and change according to the value of "Gütesiegel" (= seal of approval). Need to move them to a more convenient position next to the text though, but that won't be a problem.

(And yes, the projects are named after ponies. Nothing wrong with that :D)

RE: "Seal of approval" plugin - Added by Terence Mill about 13 years ago

Would be great if you share on github with us. Tx for contributing!

RE: "Seal of approval" plugin - Added by Tim Lobitz about 13 years ago

Wouldn't make sense at the moment as the modifications contain hard coded references to specific custom fields. For now at least.

However, showing the seal of approval on the projects overview site was only the beginning of this patch/plugin. The seal of approval custom field is only supposed to be editable/accessible by a newly created dedicated role (some sort of certification authority), not even by the respective project manager.

To achieve this, I created a new plugin that shows a new project tab only viewable by said role. Now I need to remove the seal of approval custom field from the Project -> Settings -> Information Tab and put it into the new project tab. Couldn't find the file(s) responsible for rendering the Project -> Settings -> Information Tab yet, though.

Another approach would be to set different permissions to different custom fields, I'll test that later.

Still new to this, so any hints appreciated :>.

    (1-6/6)