diff --git a/tools/redmine_devdesc/config/locales/de.yml b/tools/redmine_devdesc/config/locales/de.yml new file mode 100644 index 0000000000..27f4aa9bd5 --- /dev/null +++ b/tools/redmine_devdesc/config/locales/de.yml @@ -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" \ No newline at end of file diff --git a/tools/redmine_devdesc/config/locales/en.yml b/tools/redmine_devdesc/config/locales/en.yml new file mode 100644 index 0000000000..6a51f31c4d --- /dev/null +++ b/tools/redmine_devdesc/config/locales/en.yml @@ -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" \ No newline at end of file diff --git a/tools/redmine_devdesc/db/migrate/20100808230000_create_devdescs.rb b/tools/redmine_devdesc/db/migrate/20100808230000_create_devdescs.rb new file mode 100644 index 0000000000..7a37dfbd93 --- /dev/null +++ b/tools/redmine_devdesc/db/migrate/20100808230000_create_devdescs.rb @@ -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 diff --git a/tools/redmine_devdesc/init.rb b/tools/redmine_devdesc/init.rb new file mode 100644 index 0000000000..2dc2792c43 --- /dev/null +++ b/tools/redmine_devdesc/init.rb @@ -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 "

" + end + + return '' + end + + def view_issues_show_description_bottom(context = { }) + if(User.current.allowed_to?(:devdesc_show, context[:issue].project)) + return "

#{l(:field_devdesc)}

#{textilizable context[:issue].dev_description}
" + end + + return '' + end + + def controller_issues_new_before_save(context = { }) + context[:issue].dev_description = context[:params][:issue][:devdesc] + end +end \ No newline at end of file diff --git a/tools/redmine_devdesc/lang/de.yml b/tools/redmine_devdesc/lang/de.yml new file mode 100644 index 0000000000..27f4aa9bd5 --- /dev/null +++ b/tools/redmine_devdesc/lang/de.yml @@ -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" \ No newline at end of file diff --git a/tools/redmine_devdesc/lang/en.yml b/tools/redmine_devdesc/lang/en.yml new file mode 100644 index 0000000000..6a51f31c4d --- /dev/null +++ b/tools/redmine_devdesc/lang/en.yml @@ -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" \ No newline at end of file diff --git a/tools/redmine_devdesc/lib/issuePatch.rb b/tools/redmine_devdesc/lib/issuePatch.rb new file mode 100644 index 0000000000..e555c76418 --- /dev/null +++ b/tools/redmine_devdesc/lib/issuePatch.rb @@ -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 \ No newline at end of file