Project

General

Profile

Basic plugin development questions

Added by Dominic Bou-Samra over 12 years ago

I spent this morning creating a basic plugin that allows the user to see branches an issues git commit resides on. It basically calls "git branch --contains #commit_hash". Very basic stuff.

At the moment, all that logic resides in the _changesets.erb view in the issues folder. So my plugin folder structure looks like this:

pluginname:
  app:
    views:
      issues:
        _changesets.erb                     
      settings:
        _pluginname_settings
  config:
    locales:
      en.yml
  lang
    en.yml
  init.rb

I want to refactor this so my logic is NOT contained directly in the view. I literally have functions. Now my understanding of Rails is that you have a controller for each view. But I don't think it's directly possible to use a controller here is it, because one already exists for the issue.

How best do I achieve SOME sort of decoupling of the view and logic?

Never mind I figured it out. This guy helped immensely:

http://theadmin.org/articles/how-to-modify-core-redmine-classes-from-a-plugin/