search for: content_tag

Displaying 20 results from an estimated 85 matches for "content_tag".

2007 Sep 30
2
Outputing to the browser, how?
...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, label.to_s.humanize)) + @template.content_tag(:td, super)) end end end From the documentation of content_tag, I see it has two styles: content_tag(tag, content) or <% content_tag(tag) do %>content&l...
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...
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...
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=&quo...
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( "s...
2007 Nov 10
3
Wrapper Helper Help Please
...''Header Here'' </div> <div class="PageContent"> ''Content Here'' </div> </div> </div> I use this ''wrapper'' a lot, so I thought I''d put it into a helper, thus: def lhs_block(title) content_tag(:div, content_tag(:div, content_tag(:div,title,:class=>''PageHeader'') + content_tag(:div,yield,:class=>''PageContent''), :class=>''Page''), :id=>''LHS'') end This works fine in the view w...
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>
2008 Jan 31
3
presenting validation errors via fbml?
Hi Facebookers, Is there a helper or suggested approach for presenting validation errors on an fbml form? Something to translate rails error markup to fbml:error markup? thanks Joel
2006 Apr 30
0
Using a DIV or SPAN for a content_tag (link_to_remote)
I was wondering if there was an easy way to over ride the <a> tag that is used as the content_tag() value when using link_to_remote(), perhaps using a SPAN or DIV. I see follow the chain in the source code and I guess I could write my own helper, but I was wondering if there was a way to do this already? I know already that SPAN''s and DIV''s are not supported onclick c...
2011 Feb 09
16
rails 3.0.4 broke yield :javascript ?
hello, I have today updated my rails app to 3.0.4 security release but now this yield :javascripts fails in the layout and I get my custom js escaped as text in the view. anybody seeing this also? tia, jk -- www.least-significant-bit.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to
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 => (''error'' if flash[:error]) %> <% content_tag :script, :type => "text/javascript" do %> $(''<%= key %>'').style.display = ''none'&...
2006 Jul 13
1
From the Agile book, page 144 regarding a div tag helper
..., 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 standard helper called content_tag( ); that?s how we knew to call tag_options( ) the way we did.And how did we find the source code of the content_tag( ) method? We brought up the RDoc documentation in a browser and clicked the View Source link. >>> This just flew gracefully over my head..(duuugh).. I was at the RDDoc s...
2006 Aug 07
1
Override flash message - help
How can I modify the flash message that is displayed on a validates_* check? I used the :message => "" parameter, but it still gives me an annoying "Test : Please ensure you have entered the test message". I wanted to get rid of the "Test: " and the above "6 errors prohibited this table from being saved" I looked at the source of
2006 Jun 13
7
help with ''error_messages_for''
Greetings, I''m in the throws of deploying an app on site5, and I''m getting strange errors. I think I might need to understand how error_messages_for works. I get a pretty standard looking error: " You have a nil object when you didn''t expect it! You might have expected an instance of ActiveRecord::Base. The error occured while evaluating nil.errors Extracted
2006 Apr 23
3
custom form builder
In the API docs I found this: "You can also build forms using a customized FormBuilder class. Subclass FormBuilder and override or define some more helpers, then use your custom builder " I couldn''t find any further documentation on this. Where can I read more about this formbuilder class? For starters, where would I define a subclass of this class? TIA, Jeroen --
2005 May 27
0
tag, content_tag: are nil-valued options ever useful?
In a number of places in my code I pass options whose value are '''' or nil to one of the tag-generation helper methods. In the HTML this shows up as, e.g. <span class=""> Now, this can be pretty wasteful, but I don''t want to change my evil ways. Thus I''d rather have the framework throw out these options than do it myself. AFAICT, all tag
2006 Dec 12
2
Error message translation
I have a problem with translation of english phrase when an input error occurs. When I put: error_messages_for("registratie") above my view. I get the error: "xx errors prohibited this registratie from being saved". The problem now is, the site is for dutch customers and I would like to translate this to a dutch phrase. I know I can translate the individual fields with the
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'') #=> &lt;p&gt;dave&lt;\p%;gt; Eventually I realised the original empty string was not html_safe message = ''''.html_safe message << content_tag(:p, ''dave'') #=> <p>dave</p> Is this intentional behav...
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 #{msg}") unless flash[msg.to_sym].blank? end messages end I am not sure how to make it html_safe so that Rails 3 renders it properly. No problems with Rails 2.3.8, but I had to mark the entire method...