Displaying 20 results from an estimated 3000 matches similar to: "content_tag can not work?"
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 ) +
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
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
2004 Aug 06
2
Metadata once more...with Ices
I use Ices with the perl module. I would like to know how to use the
function supposed to return metadata, for example to read Id Tag.
I didn't find anything in the documentation. Are there commands to get
all the fields provided by the IdTag ?
I also had strange results when commenting this function (in that case
it is supposed to stream the name of the song, by reading the IdTag). With
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 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
2006 Feb 27
0
Example code for select_from_db (a.k.a. combo box)
I''m not asking for help this time! :) :) In almost every Rails
project I create, I find that I want a select() popup menu that is
pre-populated by data from the database. Also, I want an "Other..."
option that presents a text_field_tag to input another (not
presented) option (basically a combo-box). In an attempt to be as
DRY as possible, I''ve come up with
2007 Nov 10
3
Wrapper Helper Help Please
Hi all. I''m hoping this is a simple one that someone can put me right
on.
I have a view that ''wraps'' some div''s around a Page Header and Page
Content, for formatting reasons:
<div id="LHS">
<div class="Page">
<div class="PageHeader">
''Header Here''
</div>
<div
2009 May 20
2
prototype.js insert issue
Hi,
I am trying to use the following lines in my RJS and have a problem
page.insert_html :bottom,:list,"<ul>"
#some conditions checks
page.insert_html :bottom,:list,"<li>Hello item</li>"
#some more code to add <li>s
page.insert_html :bottom,:list,"</ul>"
The problem I am having is the first line <<page.insert_html
2006 Jul 26
3
insert_html inserting fragment twice
Has anyone had trouble with inline RJS insert_html with the latest
version of Rails?
My problem is that insert_html inserts the html fragment twice. For
example,
render :update do |page|
page.insert_html :top, "some_list", "<li>booyow</li>"
end
would render "<li>booyow</li>" twice.
Thanks.
--
Posted via
2006 Apr 05
2
RJS and remote forms
I''ve run into what I think is a browser bug related to using
remote_forms pushed in an RJS update.
In my controller, I have an action that creates a new model and returns
a form for one of its children:
def create_party
party = Party.create
render :update do |page|
page.insert_html :top, ''party-list'', :partial => ''party_header'',
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 =>
2008 Sep 22
3
syntax error in RJS
I''m new to Ruby on Rails and came across a problem I could not solve
alone.
I''ve a pretty simple RJS file that looks like the following:
3.times do
page.insert_html :bottom, ''messages'', ''test''
end
page.call ''updateMessageWindow''
However this snippet gives a syntax error:
ActionView::TemplateError (compile error
D:/Eigene
2006 Apr 19
4
RJS replace_html auto-closing tags
I''m using the following RJS template to spit out a div containing a
list of projects:
page.replace_html ''results'', ''<div>''
@projects.each do |p|
page.insert_html :bottom, ''results'', p.name + "<br/>"
end
page.insert_html :bottom, ''searchresults'', ''</div>''
page.show
2006 Jul 03
6
Rjs $("aaa").insertHtml is not a function error
Hi,
I''ve searched the list and found that someone had the same problem as me
http://lists.rubyonrails.org/pipermail/rails/2006-May/043760.html
I''m have in my page a link like this
<%= link_to_remote ("Add
#{image_tag(''add.png'')}",:url=>{:action=>''addProduct''})%>
and in my controller
def addProduct
..................
2006 Dec 17
0
unterminated string literal
Hello,
I am not able to solve this problem on my own.
I have a nested Div tag like this:
<div id="training" >
<div id="daytraining" >Training
</div>
</div>
Some other elements should insert content here by:
<%= content_tag("div" ,"Training",:id => "#{training.date.day}" ,
:onmouseover =>
2006 Apr 16
11
RJS templates not found
I am running Rails 1.10 and wanted to check out the RJS templates.
Rails doesn''t seem to find them.
I did issue the rake comment update_javascripts and that did not correct
the problem. RJS is part of 1.1 right?
Any ideas?
Thanks.
--
Posted via http://www.ruby-forum.com/.
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