Displaying 20 results from an estimated 900 matches similar to: "Wrapper Helper Help Please"
2007 Sep 30
2
Outputing to the browser, how?
Hello,
I''m writting some helper methods to write forms, so I have this working code:
class TableFormBuilder < ActionView::Helpers::FormBuilder
["file_field", "password_field", "text_field"].each do |name|
define_method(name) do |label, *args|
@template.content_tag(:tr,
@template.content_tag(:td,
@template.content_tag(:label,
2006 Apr 11
1
content_tag can not work?
the tag helper "content_tag" can not work correnctedly on my enviroment:
page.insert_html :bottom, ''body'', content_tag("div","id"=>"tag")
then in body,i can only get "idtag" as the text!
but if i use : content_tag("p","hello world")
I can get it worked. From the rails 1.1 api document,i can find the
2006 Jun 19
2
content_tag question
Am trying to insert a link to delete via ajax in my RJS template.
Can one use content_tag and link_to_remote like this in a RJS template?
a = content_tag(''a'', link_to_remote("Delete", :update => "categories",
:url => {:action => "delete", :name => category.name}))
-Thanks.
--
Posted via http://www.ruby-forum.com/.
2007 Jan 24
1
Removing empty class attribute from @template.content_tag
Hey all,
I have a quick question regarding the @template.content_tag methos when
creating a custom form builder.
Currently have the following method in my AccessibleBuilder class:
def datetime_select(field, options = {})
required = options.delete :required
label = options.delete :label
@template.content_tag("div",
@template.content_tag( "span", Example Label ) +
2006 Jul 13
1
From the Agile book, page 144 regarding a div tag helper
Hi. in the Rails Agile book here''s what was happening:
>>>
module StoreHelper
def hidden_div_if(condition, attributes = {})
if condition
attributes["style" ] = "display: none"
end
attrs = tag_options(attributes.stringify_keys)
"<div #{attrs}>"
end
# format_price method ...
end
Note that we cheated slightly here. We copied code from the Rails
2010 Mar 24
3
flash error & fade away
this is my current code:
#notice {
border: solid 1px #99cc99;
background-color: #e2f9e3;
color: #006600;
padding: 5px;
margin-bottom: 5px;
}
#notice.error {
border-color: #e2f9e3;
background-color: #eeaaaa;
color: #cc0000;
}
<% flash.each do |key, msg| %>
<%= content_tag :div, flash[:error] || flash[:notice], :id => ''notice'',
:class =>
2002 Jul 12
0
Problem with checksums
I'm trying to write a program that reads an ogg stream and check all the
CRC values along the way. But I have big trouble with computing the
checksum, or at least I never got checksums that match the one that is in
the ogg file.
I do set the CRC field in the header to 0 before calculating it. I start
with 0 and have no xor at the end. I feed page header with all lacing
values and the page
2010 Aug 17
3
Rails 3 flash message problems
The following code in my application_helper.rb class either eats the
flash message or escapes it and does not display properly:
# Outputs the corresponding flash message if any are set
def flash_messages
messages = []
%w(notice warning error).each do |msg|
messages << content_tag(:div, content_tag(:p,
html_escape(flash[msg.to_sym])), :class => "message
2006 Nov 28
2
Partial matches in expectations
Hi !
I would like to ascertain the following in a test case:
@template.expects(:content_tag).with(:fieldset, :__any_arguments__i_dont_care)
Is it possible to do so ? If so how ? If not, is it something the
community wants ? Is it useful ?
Thanks !
--
Fran?ois Beausoleil
http://blog.teksol.info/
http://piston.rubyforge.org/
2010 May 17
6
Should an blank string be html_safe?
Just trying to implement a simple helper over the past few days had me
really confused.
messages = ''''
messages << content_tag(:p, ''dave'')
#=> <p>dave<\p%;gt;
Eventually I realised the original empty string was not html_safe
message = ''''.html_safe
message << content_tag(:p, ''dave'')
#=>
2011 Sep 04
4
same html elements rendering twice on page
hey all,
My index.html.haml:
- wrap do
- page_title "Teams List View"
application_helper.rb:
def page_title(title)
content_tag :h1, title
end
def wrap(&block)
concat(content_tag(:div, capture(&block), :class =>
"generic_header"))
end
I load in browser and get:
<div class="generic_header"><h1>Teams List
2011 Nov 01
2
Railscast 262 different partial in helper
Hi RoR Community,
in Ryan Bates Railscasts Episode #262 he put the index code
<% for message in @messages %>
<div class="message">
<div class="created_at"><%= message.created_at.strftime("%B %d, %Y")
%></div>
<div class="content">
<%= message.content %>
</div>
<div
2006 Mar 04
13
Using helpers from controllers ?
There is a solution to use helpers from controllers ?
I have an error :
|undefined method `content_tag''|
class ApplicationController < ActionController::Base
def test
return content_tag("a","test")
end
end
2007 Jan 25
2
Need help for Helper
I need a helper, which will render a table in my customized style.
I wrote a code like this:
template.rhtml:
<% @column_names = ["Name", "Age", "Sex"] %>
<%= table_show @column_name %>
helper.rb
def table_show(names)
for name in names
content_tag ( :div, name, :class => ''table_header'' )
end
end
Which should give me an output
2005 Jan 21
2
collection_select
I''m trying to use collection_select, but it''s not working as I expect. The
list populates correctly but the current value is not selected.
@question contains a topic (via topic_id), and @topics is the list of all
topics. Here''s my attempt to create a drop-down list of the topics.
form("question") do | form |
form << content_tag("b",
2005 Dec 20
1
Can''t use mouseover with auto_complete_field
Good afertnoon.
I''m trying to use a mouse over event:
Event.observe("name_auto_complete", "mouseover",
function(){alert("auto_complete")} );
with the auto_complete_field bellow.
<%= text_field_tag("name") %>
<%= content_tag("div", "", "id" => "name_auto_complete") %>
<%=
2007 Mar 15
1
Helper content_tag and Blocks
The content_tag helper allows you to do things like:
content_tag(:p, "Hello world!")
# => <p>Hello world!</p>
It can take in blocks, for functionality like this:
<% content_tag :div, :class => "strong" do -%>
Hello world!
<% end -%>
# => <div class="strong"><p>Hello world!</p></div>
Unfortunately blocks
2008 Mar 31
2
Rails and Partials
Excuse my ignorance on partials but.....
I am trying to use partials to create a uniform display box built with
html tables. The only way I have thought about accomplishing this is to
create two partials:
_start_box.erb
----------------
<table id="box" width="<%= width %>"><tr><th><%= h(label_text)
%></th></tr><tr><td>
2005 Dec 25
5
RJS not working?
I''ve been attempting to add a simple rjs ''delete'' method to my
project. However, no matter what I try, it simply doesn''t work. Even
the easy, easy stuff seems broken. (Yes, <%=
javascript_include_tag :defaults %> is being included in the template.)
For example, from:
http://www.codyfauser.com/articles/2005/11/20/rails-rjs-templates
VIEW:
<h1
2005 Dec 23
1
Overloading error_message_on method in ActiveRecordHelper
Hello all
I would like to overload the error_message_on method in the
ActiveRecordHelper module in order to emit a span tag instead of a div
tag. I try to achieve this by way of plugins: Under vendor/plugins
I''ve made a error_messages_on_fix directory, containing init.rb like
this:
---
require ''active_record_helper_fix''
---
..and a lib directory with