summaryrefslogtreecommitdiffstats
path: root/lib/redmine/views/my_page/block.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-26 16:36:56 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-26 16:36:56 +0000
commitd40bf201310e5f2bbb0c7a2a3e33b4957708c495 (patch)
tree6f45891876a6e454153c3b2fb6c8ba8a5cedfa8c /lib/redmine/views/my_page/block.rb
parent5b96d1b083a82d3ae68072c77af9521e720a3af8 (diff)
downloadredmine-d40bf201310e5f2bbb0c7a2a3e33b4957708c495.tar.gz
redmine-d40bf201310e5f2bbb0c7a2a3e33b4957708c495.zip
Allow My Page blocks to be added to from a plugin (#2840).
Partials must be placed under the app/views/my/blocks directory of the plugin. An example can be found in the sample plugin. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2529 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/views/my_page/block.rb')
-rw-r--r--lib/redmine/views/my_page/block.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/redmine/views/my_page/block.rb b/lib/redmine/views/my_page/block.rb
new file mode 100644
index 000000000..a9a52a052
--- /dev/null
+++ b/lib/redmine/views/my_page/block.rb
@@ -0,0 +1,32 @@
+# Redmine - project management software
+# Copyright (C) 2006-2009 Jean-Philippe Lang
+#
+# 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.
+
+module Redmine
+ module Views
+ module MyPage
+ module Block
+ def self.additional_blocks
+ @@additional_blocks ||= Dir.glob("#{RAILS_ROOT}/vendor/plugins/*/app/views/my/blocks/_*.{rhtml,erb}").inject({}) do |h,file|
+ name = File.basename(file).split('.').first.gsub(/^_/, '')
+ h[name] = name
+ h
+ end
+ end
+ end
+ end
+ end
+end