Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zouchaoqun committed Jun 23, 2009
0 parents commit 60e54fd
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
=== ezSidebar Plugin 0.1.0

This is a plugin to make it easy to add content(like google ads) to redmine' right sidebar.
ONLY compatible with Redmine 0.9 or last devel.
Maybe compatible with Redmine 0.8.4 but not tested.

=== Plugin installation

1. Copy the plugin directory(redmine_ezsidebar) into the vendor/plugins directory
NOTE: The plugin directory must be redmine_ezsidebar!

2. Start Redmine

Installed plugins are listed on 'Admin -> Plugin' screen.

=== Usage

1. Input content's html code you want to display in sidebar in plugin's setting page.

2. Now the content will be displayed in every page's sidebar.

=== Roadmap

1. Able to choose projects and modules where to add the content.

2. Able to input distinct content for different projects.

=== Contact info

Homepage -> http://ezwork.techcon.thtf.com.cn/projects/ezwork powered by redmine
Email -> zouchaoqun@gmail.com
4 changes: 4 additions & 0 deletions app/views/settings/_settings.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<p>
<label><%= l(:label_sidebar_content) %></label>
<%= text_area_tag 'settings[sidebar_content]', @settings['sidebar_content'], :rows => 10, :cols => 80 %>
</p>
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
en:
label_sidebar_content: "Sidebar Content(HTML)"
2 changes: 2 additions & 0 deletions config/locales/zh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
zh:
label_sidebar_content: "边栏内容(HTML)"
33 changes: 33 additions & 0 deletions init.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# ezSidebar plugin for redMine
# Copyright (C) 2008-2009 Zou Chaoqun
#
# 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'

# Hooks
require_dependency 'ezsidebar_layouts_hook'

Redmine::Plugin.register :redmine_ezsidebar do
name 'Redmine ezSidebar plugin'
author 'Zou Chaoqun'
description 'This is a plugin for Redmine to make easy to insert content to its sidebar'
version '0.1.0'
url 'http://ezwork.techcon.thtf.com.cn/projects/ezwork'
author_url 'mailto:zouchaoqun@gmail.com'
settings :default => {'sidebar_content' => '[input html code here]'}, :partial => 'settings/settings'


end
2 changes: 2 additions & 0 deletions lang/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
en:
label_sidebar_content: "Sidebar Content(HTML)"
2 changes: 2 additions & 0 deletions lang/zh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
zh:
label_sidebar_content: "边栏内容(HTML)"
10 changes: 10 additions & 0 deletions lib/ezsidebar_layouts_hook.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Hooks to attach to the Redmine base layouts(for right sidebar).
class EzsidebarLayoutHook < Redmine::Hook::ViewListener

def view_layouts_base_sidebar(context = { })
if !Setting.plugin_redmine_ezsidebar['sidebar_content'].empty?
"<p>#{Setting.plugin_redmine_ezsidebar['sidebar_content']}</p>"
end
end

end
5 changes: 5 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Load the normal Rails helper
require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper')

# Ensure that we are using the temporary fixture path
Engines::Testing.set_fixture_path

0 comments on commit 60e54fd

Please sign in to comment.