From 1987d87da8e7274a3a6a7826e899158f85ab2351 Mon Sep 17 00:00:00 2001 From: LeandroNunes Date: Sat, 20 Oct 2007 06:12:24 +0000 Subject: [PATCH] ActionItem85: adding block --- app/controllers/profile_admin/profile_editor_controller.rb | 4 ++-- app/models/enterprises_block.rb | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 app/models/enterprises_block.rb diff --git a/app/controllers/profile_admin/profile_editor_controller.rb b/app/controllers/profile_admin/profile_editor_controller.rb index 1793591..6f24301 100644 --- a/app/controllers/profile_admin/profile_editor_controller.rb +++ b/app/controllers/profile_admin/profile_editor_controller.rb @@ -9,9 +9,9 @@ class ProfileEditorController < ProfileAdminController def block_types { - 'ListBlock' => _("List Block"), + 'ListBlock' => _("List of People"), + 'EnterprisesBlock' => _("List of Enterprises"), 'LinkBlock' => _("Link Block"), - 'Design::MainBlock' => _('Main content block'), 'RecentDocumentsBlock' => _("Recent documents block") } end diff --git a/app/models/enterprises_block.rb b/app/models/enterprises_block.rb new file mode 100644 index 0000000..dc116f8 --- /dev/null +++ b/app/models/enterprises_block.rb @@ -0,0 +1,21 @@ +class EnterprisesBlock < Design::Block + + def content + + lambda do + content_tag( + 'ul', + Enterprise.find(:all).map do |p| + content_tag( + 'li', + content_tag( + 'span', + link_to( p.name, :profile => p.identifier) + )) + end + ) + end + + end + +end -- libgit2 0.21.2