Displaying 20 results from an estimated 1200 matches similar to: "Rails and Partials"
2006 Dec 17
12
Best practices for conditional display in views?
Hi.
I am writing an application that has a lot of boolean conditional
display logic, like this:
<% if user.description then %>
<p class="css_class"><%= user.description %></p>
<% end %>
Often the displayed content is more complex than the above, and to clean
up my views I am trying to pull a lot of this sort of thing into
partials.
However, the problem
2006 Apr 22
3
rjs woes, any hints?
I''ve pared my rjs experiment down to what seems a bare minimum. When I click
on my link_to_remote, the rjs executes, returns the correct javascript to
the browser, but it doesn''t update the div I''ve specified. What appears to
be coming back from the controller is:
Element.update("my_form", "hello, rjs");
I''m tearing my hair out.
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,
2012 Oct 06
0
rails 3.2 question/answer with a through table
I have a person has many questions through person_questions. I have an
extra column in the join table for the answer. The section below works for
a new submit but when I edit I get 3 each with the first 2 of each selected
tand the third not so I get 6 check boxes some selected some not. Is there
a way to get this to work properly os just the questions in the db show up
once each with the
2012 Sep 29
0
rails 3.2 nested form names not correct
I have a person has many questions model, I have accepts_nested_Attributes
set up properly. the question from the db show up, but the index is not
incrementing:
<%= f.fields_for :person_questions do |pregunta| %>
Questions: <br/>
<% Question.all.each do |question| %>
<%= render ''questions/question_type'', :pregunta =>
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 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
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
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
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
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
--
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 =>
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 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 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
2007 Dec 08
2
Assigning submit handler to form
Hi folks,
A quick question for somebody. I''m adding a simple validation JS to my
form by attaching it like so:
$(''my_form'').observe(''submit'', function(e) { return
view_ns.validate_form(Event.element(e)); });
The validate_form() function returns true or false. But regardless of
it''s return value, the form is always submitted. ''sup wi
2007 Jul 24
2
reusing partials
Might be asking a daft question or missing something obvious here as
I''m a bit of noob at this, I''ve got the code below in a partial and am
using it to display and attach skills to degrees which is working
fine, I now need to do exactly the same thing for interests and was
wondering if there is any way to pass the partial a parameter which I
can then some how be used to replace
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/