redmine developer description plugin

git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@12278 ebf7c1c2-ba36-0410-9fe8-c592906822b4
This commit is contained in:
botzi 2010-08-12 10:29:56 +00:00
parent df3c36b13f
commit a4f363ceab
7 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,5 @@
# English strings go here for Rails i18n
de:
field_devdesc: "Entwicklerbeschreibung"
permission_devdesc_show: "Zeige Entwicklerbeschreibung"
permission_devdesc_form: "Erlaube Eingabe von Entwicklerbeschreibung"

View File

@ -0,0 +1,5 @@
# English strings go here for Rails i18n
en:
field_devdesc: "Developer Description"
permission_devdesc_show: "Show Developer Description"
permission_devdesc_form: "Input Developer Description"

View File

@ -0,0 +1,9 @@
class CreateDevdescs < ActiveRecord::Migration
def self.up
add_column :issues, :dev_description, :string
end
def self.down
remove_column :issues, :dev_description
end
end

View File

@ -0,0 +1,42 @@
require 'redmine'
require 'dispatcher'
Redmine::Plugin.register :redmine_devdesc do
name 'Developer Description'
author 'Botzi'
description 'Allows to add additional information which are only shown for the developer.'
version '0.0.1'
author_url 'www.jdownloader.org'
project_module :devdesc do
permission :devdesc_show, :devdescShow => :show
permission :devdesc_form, :devdescForm => :form
end
end
require 'issuePatch'
Dispatcher.to_prepare do
Issue.send(:include, IssuePatch) unless Issue.included_modules.include? IssuePatch
end
class RedmineDevDescHook < Redmine::Hook::ViewListener
def view_issues_form_details_bottom(context = { })
if(User.current.allowed_to?(:devdesc_form, context[:issue].project))
return "<p><label>#{l(:field_devdesc)}</label><small><textarea id='issue_devdesc' name='issue[devdesc]' cols='60' rows='10' class='wiki-edit'></textarea></small>"
end
return ''
end
def view_issues_show_description_bottom(context = { })
if(User.current.allowed_to?(:devdesc_show, context[:issue].project))
return "<p><strong>#{l(:field_devdesc)}</strong></p><div class='wiki'>#{textilizable context[:issue].dev_description}</div>"
end
return ''
end
def controller_issues_new_before_save(context = { })
context[:issue].dev_description = context[:params][:issue][:devdesc]
end
end

View File

@ -0,0 +1,5 @@
# English strings go here for Rails i18n
de:
field_devdesc: "Entwicklerbeschreibung"
permission_devdesc_show: "Zeige Entwicklerbeschreibung"
permission_devdesc_form: "Erlaube Eingabe von Entwicklerbeschreibung"

View File

@ -0,0 +1,5 @@
# English strings go here for Rails i18n
en:
field_devdesc: "Developer Description"
permission_devdesc_show: "Show Developer Description"
permission_devdesc_form: "Input Developer Description"

View File

@ -0,0 +1,20 @@
require_dependency 'issue'
module IssuePatch
def self.included(base) # :nodoc:
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
# Same as typing in the class
base.class_eval do
acts_as_searchable :columns => ["#{table_name}.dev_description"]
end
end
module ClassMethods
end
module InstanceMethods
end
end