first commit

This commit is contained in:
Daniel Seifert 2010-08-02 20:25:34 +02:00
commit 9076294bbf
9 changed files with 151 additions and 0 deletions

27
README.rdoc Normal file
View File

@ -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.

BIN
assets/images/important.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
assets/images/note.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
assets/images/tip.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
assets/images/warning.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -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);
}

39
init.rb Normal file
View File

@ -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

View File

@ -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

37
lib/wiki_notes_macros.rb Normal file
View File

@ -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 = '<div class="noteclassic">'
o << args[0]
o << '</div>'
o
end
macro :tip do |obj, args|
o = '<div class="notetip">'
o << args[0]
o << '</div>'
o
end
macro :important do |obj, args|
o = '<div class="noteimportant">'
o << args[0]
o << '</div>'
o
end
macro :warning do |obj, args|
o = '<div class="notewarning">'
o << args[0]
o << '</div>'
o
end
end
end