Displaying 6 results from an estimated 6 matches for "uses_component_template_root".
2005 Oct 10
0
[BUG ??] 'uses_component_template_root' problems with implementation in component
...nder ''shared/header'' %>
</html
I then have a component [ /app/components/admin/ ] that has a
controller called login_controller.rb and contains this:
# This controller provides actions to log a user in and out.
class Admin::LoginController < ApplicationController
uses_component_template_root
layout ''../app/views/layouts/application''
# will show the login box html
def index
end
end
PROBLEM::
When I visit [ http://localhost:3000/ ] the shared header view shows
up fine, but when I then try to visit the [ http://localhost:3000/
admin/login ] URL I get...
2006 Feb 19
2
instance variables in components not read by component view?
...ying to write a sidebar menu with dynamic menus, and to do so I
would like to define a list of menus to display within my sidebar
component controller code and pass that list to the component display
view, like so:
# menu_controller.rb
class Sidebar::MenuController < ActionController::Base
uses_component_template_root
@menus = %w{admin user help}
def display
@display_menu = params[:menu]
render(:layout => false)
end
end
# menu/display.rhtml
<div class="menu">
<% @menus.each do |menu| %>
<%= link_to_remote "#{menu}",:url => { :controller => "sideba...
2006 Jun 07
6
Links on the left hand side - are components necessary?
...controllers.
main.rhtml has, amongst all the other HTML stuff:
<%= render_component :controller=> ''dli/extras'', :action=>
''show_lookup_links''%>
This is the component to display the links:
class Dli::ExtrasController < ApplicationController
uses_component_template_root
Link=Struct.new(:name,:controller,:action)
def show_lookup_links
@links=[]
@links << Link.new("Channels", "/lookup/channel", "index")
@links << Link.new("Password durations",
"/lookup/password_duration", "index&quo...
2006 May 29
0
using components to reuse code
the following is the code of the controller, under the dir
components/test/:
class Test::GroupsManController < ApplicationController
uses_component_template_root
def add_to_group
@account = Account.find_by_nick(@params[:nick])
# render :text => "#{session[:account_id]}
#{Group.find(session[:group_id]).owner_id}"
if (session[:account_id] == Group.find(session[:group_id]).owner_id)
Account.join_group(@account.id, session[:group_id])
#...
2006 Feb 03
0
component/ajax variable access problem
...v id="easel"><%= render_component(:controller =>
''tiny_gallery/album'', :action => ''show_photo'', :params =>{:context=>
:home }) %></div>
Component Controller:
class TinyGallery::AlbumController < ActionController::Base
uses_component_template_root
def show_photo
case
when params[:context] == :home
@images = [''/images/1.jpg'', ''/images/2.jpg'']
else
@images = [''/images/test.gif'']
end
end
end
Component View:
<%
# p is always 0 when it comes in th...
2006 Jan 14
0
testing template components
...e_record/fixtures.rb:523:in
`setup''
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/fixtures.rb:521:in
`setup''
Here is the controller if that is of interest (basically copied out of the
book)
class Navigation::SidebarController < ActionController::Base
uses_component_template_root
Link = Struct.new(:name, :url)
def self.find(*ignored)
[Link.new("people","/person"),
Link.new("home","/")]
end
def menu
@links = self.class.find(:all)
render(:layout => false)
end
end
So, what is a good way to test components...