From ff69a878662aab690ce367c4e5565681136795df Mon Sep 17 00:00:00 2001 From: LeandroNunes Date: Thu, 2 Aug 2007 14:09:49 +0000 Subject: [PATCH] ActionItem0: updating tests and making refactoring of desgin plugin --- app/controllers/edit_template_controller.rb | 31 +++++++++++++++---------------- app/models/list_block.rb | 2 +- test/functional/edit_template_controller_test.rb | 6 ++++-- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/app/controllers/edit_template_controller.rb b/app/controllers/edit_template_controller.rb index 1d5d18e..a353e49 100644 --- a/app/controllers/edit_template_controller.rb +++ b/app/controllers/edit_template_controller.rb @@ -1,24 +1,23 @@ class EditTemplateController < ApplicationController - design_editor :holder => 'virtual_community', :autosave => true, :block_types => :block_types - - #TODO Implements the available blocks here - #TODO implements available helpers + design_editor :holder => 'virtual_community', :autosave => true, :block_types => :block_types, :block_helper_types => :block_helper_types + + def block_types + { + 'ListBlock' => _("List Block"), + 'LinkBlock' => _("Link Block"), + } + end + + def block_helper_types + { + 'list_content' => _("Simple List Content"), + 'plain_content' => _("Link Block"), + } + end def index redirect_to :action => 'design_editor' end - FLEXIBLE_TEMPLATE_AVAILABLE_BLOCKS = { - 'ListBlock' => _("List Block"), - 'LinkBlock' => _("Link Block"), - } - - -#TODO add your own helpers here -# FLEXIBLE_TEMPLATE_BLOCK_HELPER = { -# 'list_content' => _("Simple List Content"), -# } - - end diff --git a/app/models/list_block.rb b/app/models/list_block.rb index b03a5de..464a961 100644 --- a/app/models/list_block.rb +++ b/app/models/list_block.rb @@ -1,4 +1,4 @@ -class ListBlock < Block +class ListBlock < Design::Block def content Profile.find(:all).map{|p|p.name} diff --git a/test/functional/edit_template_controller_test.rb b/test/functional/edit_template_controller_test.rb index 343812a..fb047d0 100644 --- a/test/functional/edit_template_controller_test.rb +++ b/test/functional/edit_template_controller_test.rb @@ -14,8 +14,10 @@ class EditTemplateControllerTest < Test::Unit::TestCase @response = ActionController::TestResponse.new end - def test - flunk 'FIXME: nothing tested yet' + def test_redirect_to_design_editoe_when_index_action_is_called + get :index + assert_response :redirect + assert_redirected_to :action => 'design_editor' end end -- libgit2 0.21.2