mirror of
https://github.com/mirror/jdownloader.git
synced 2024-11-26 21:40:38 +00:00
redmine developer description plugin
git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@12278 ebf7c1c2-ba36-0410-9fe8-c592906822b4
This commit is contained in:
parent
df3c36b13f
commit
a4f363ceab
5
tools/redmine_devdesc/config/locales/de.yml
Normal file
5
tools/redmine_devdesc/config/locales/de.yml
Normal 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"
|
5
tools/redmine_devdesc/config/locales/en.yml
Normal file
5
tools/redmine_devdesc/config/locales/en.yml
Normal 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"
|
@ -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
|
42
tools/redmine_devdesc/init.rb
Normal file
42
tools/redmine_devdesc/init.rb
Normal 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
|
5
tools/redmine_devdesc/lang/de.yml
Normal file
5
tools/redmine_devdesc/lang/de.yml
Normal 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"
|
5
tools/redmine_devdesc/lang/en.yml
Normal file
5
tools/redmine_devdesc/lang/en.yml
Normal 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"
|
20
tools/redmine_devdesc/lib/issuePatch.rb
Normal file
20
tools/redmine_devdesc/lib/issuePatch.rb
Normal 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
|
Loading…
Reference in New Issue
Block a user