commit 9076294bbf1f6192baa00844c02a6f457b04cbbd Author: Daniel Seifert Date: Mon Aug 2 20:25:34 2010 +0200 first commit diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..cd384d3 --- /dev/null +++ b/README.rdoc @@ -0,0 +1,27 @@ += Redmine Wiki Notes Plugin + +== Plugin installation + +1. Copy the plugin directory into the vendor/plugins directory +2. Restart Redmine + +== Usage + +The following macros are added: + +* {{note(text)}} +* {{tip(text)}} +* {{important(text)}} +* {{warning(text)}} + +This displays a block in the wiki page with a corresponding +icon and the specified text. + +== Credits + +The icons and the stylesheet were taken from the DokuWiki Note-Plugin ((c) Olivier +Cortès and others, http://www.dokuwiki.org/plugin:note (GPLv2)). + +== License + +This plugin is released under the GPLv2. diff --git a/assets/images/important.png b/assets/images/important.png new file mode 100644 index 0000000..dc8c8a4 Binary files /dev/null and b/assets/images/important.png differ diff --git a/assets/images/note.png b/assets/images/note.png new file mode 100644 index 0000000..df1e0a9 Binary files /dev/null and b/assets/images/note.png differ diff --git a/assets/images/tip.png b/assets/images/tip.png new file mode 100644 index 0000000..2000f20 Binary files /dev/null and b/assets/images/tip.png differ diff --git a/assets/images/warning.png b/assets/images/warning.png new file mode 100644 index 0000000..3c8a37d Binary files /dev/null and b/assets/images/warning.png differ diff --git a/assets/stylesheets/wiki_notes.css b/assets/stylesheets/wiki_notes.css new file mode 100644 index 0000000..cb4d6ff --- /dev/null +++ b/assets/stylesheets/wiki_notes.css @@ -0,0 +1,41 @@ +.noteclassic, .noteimportant, .notewarning, .notetip { + margin: 2em; + margin-left: auto; + margin-right: auto; + width: 70% !important; + min-height: 40px; + clear: both; + text-align: justify; + vertical-align: middle; + border-collapse: collapse; + padding: 15px 20px 15px 80px; + background-position: 20px 50%; + background-repeat: no-repeat; + -moz-border-radius: 20px; + -khtml-border-radius: 20px; + border-radius: 20px; +} + +.noteclassic { + /*border: 1px solid #99D;*/ + background-color: #eef; + background-image: url(../images/note.png); +} + +.noteimportant { + /*border: 1px solid #ff0;*/ + background-color: #ffc; + background-image: url(../images/important.png); +} + +.notewarning { + /*border: 1px solid #d99;*/ + background-color: #fdd; + background-image: url(../images/warning.png); +} + +.notetip { + /*border: 1px solid #9d9;*/ + background-color: #dfd; + background-image: url(../images/tip.png); +} diff --git a/init.rb b/init.rb new file mode 100644 index 0000000..15f4b8a --- /dev/null +++ b/init.rb @@ -0,0 +1,39 @@ +# Wiki Notes plugin for Redmine +# Copyright (C) 2010 Daniel Seifert +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +require 'redmine' +begin + require 'config/initializers/session_store.rb' + rescue LoadError +end + +Dir::foreach(File.join(File.dirname(__FILE__), 'lib')) do |file| + next unless /\.rb$/ =~ file + require file +end + +require 'redcloth3' +Redmine::Plugin.register :redmine_wiki_notes do + name 'Redmine Wiki Notes plugin' + author 'Daniel Seifert' + description 'Allows adding different kinds of notes into a wiki page' + url "http://www.github.com/dseifert/redmine_wiki_notes" if respond_to?(:url) + version '0.0.1' + requires_redmine :version_or_higher => '0.9.0' + + RedCloth3::ALLOWED_TAGS << "div" +end diff --git a/lib/wiki_notes_application_hooks.rb b/lib/wiki_notes_application_hooks.rb new file mode 100644 index 0000000..984da86 --- /dev/null +++ b/lib/wiki_notes_application_hooks.rb @@ -0,0 +1,7 @@ +require 'redmine' +class WikiNotesApplicationHooks < Redmine::Hook::ViewListener + def view_layouts_base_html_head(context = {}) + # beware of http://www.redmine.org/issues/3935 + return stylesheet_link_tag("wiki_notes.css", :plugin => "redmine_wiki_notes", :media => "all") + end +end diff --git a/lib/wiki_notes_macros.rb b/lib/wiki_notes_macros.rb new file mode 100644 index 0000000..6709346 --- /dev/null +++ b/lib/wiki_notes_macros.rb @@ -0,0 +1,37 @@ +module WikiNotesMacro + Redmine::WikiFormatting::Macros.register do + desc "Adds a note to the wiki page:\n\n" + + " @!{{note(text)}}@\n" + + " @!{{tip(text)}}@\n" + + " @!{{important(text)}}@\n" + " @!{{warning(text)}}@\n" + + macro :note do |obj, args| + o = '
' + o << args[0] + o << '
' + o + end + + macro :tip do |obj, args| + o = '
' + o << args[0] + o << '
' + o + end + + macro :important do |obj, args| + o = '
' + o << args[0] + o << '
' + o + end + + macro :warning do |obj, args| + o = '
' + o << args[0] + o << '
' + o + end + end +end