similar to: From the Agile book, page 144 regarding a div tag helper

Displaying 20 results from an estimated 300 matches similar to: "From the Agile book, page 144 regarding a div tag helper"

2007 Mar 23
1
How does this helper work? (agile book)
Hello, Im trying to understand how this helper method works: def hidden_div_if(condition, attributes = {}) if condition attributes["style"] = "display: none" end attrs = tag_options(attributes.stringify_keys) "<div #{attrs}>" end This is how they are calling it: <%= hidden_div_if(@cart.items.empty?, :id => "cart") %>
2008 Jul 14
1
question about method "hidden_div_if" in AWDR 2
I followed the sample code in AWDR 2 like this: store_helper.rb def hidden_div_if(conditions, attributes = {}) if conditions attributes["style"] = "display:none" else attr = tag_options(attributes.stringify_keys) "<div #{attr}>" end end store.html.erb <%= hidden_div_if(@cart.items.empty?, :id => "cart") %> <%=
2006 Mar 25
0
in_place_collection_editor
Hi, I''m trying to write a helper for Scriptaculous'' InPlaceCollectionEditor component. I''ve already submitted a patch (http://dev.rubyonrails.org/ticket/4302). This was a drunk patch; it needs a bit of work (Don''t drink & code!). So far I''ve gotten it to work correctly with normal collections, but I want to use it for belongs_to relations as
2008 Dec 28
1
escape character problem
Hi, i need to construct a link as following "<a href=\"#{CONFIG[''URLS''][''Xyz'']}\#{url}\"#{tag_options}>#{name || url}</a>" But here due to escape character #{url} not give actual value it treated as a string. how to solve this ? if i do "<a
2006 Jul 24
2
InPlaceSelectEditor question
I''m attempting to use the example given in the Rails Recipes book chapter 2, to create a select drop-down using the InPlaceEditor function (modified to be InPlaceSelectEditor. The example given works (a country list drop-down), but I''m attempting to use it to display a list of items generated from an object in another table that is linked to the table that I''m editing.
2006 Jan 06
3
Where to place a global function
Hi all, I have a little function called format_price(price) that simply formats the argument as a dollar sign, dollar amount, dot and penny amount. Then, in a .rhtml file, I could do this: <%= format_price(item.unit_price * item.quantity) %> But where do I put the format_price() function definition? The app couldn''t find it in app/controllers/application.rb. Where do I put it
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 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 Mar 01
2
In_place_editor in a For loop
I''m using Ajax to create a list of items. Once these items have been created the user can edit in place and delete them. I''ve got the ajax working for delete and removing the element from the page, but the in_place_editor_field doesn''t seem to like being in a for loop. I''ve got in_place_editor working for single items, but what''s the syntax
2008 Jun 15
11
[PATCH] helper to create fb css stylized table
I attached a rails helper implementation of the fb_table described here: http://wiki.developers.facebook.com/index.php/Facebook_Styles I included testing and comments. I hope you find it useful. Curiously, it''s really a small extension of FBML. Richard -------------- next part -------------- Index: test/rails_integration_test.rb
2006 Aug 02
2
Passing Ajax.InPlaceEditor options
I''ve followed the instructions in the Rails Recipe #1 and have the in_place_editor_field working but now I want to tweak how it looks and behaves. I''d like to be able to override the default yellow highlight color, which is done using the highlightcolor param according to the scriptaculous documentation (unless I''m missing something). I''m new to Ruby and Rails
2005 Nov 29
0
undefined method `link_to'
Hi, all I''m trying call link_to from another helper but got this error: undefined method `link_to'' for module `UserHelper'' how can I get access to helper from another helper? this is my users_helper.rb: module UsersHelper alias ink_to_original link_to alias link_to link_to_permission def link_to_permission(name, options = {}, html_options = nil,
2006 Nov 04
2
in_place_editor_field submitOnBlur & okButton=false options?
I have a few in_place_editor_fields working fine. I can access some of the script.aculo.us options such as :cols, :save_text, :cancel_text, but how do I access the okButton = false & submitOnBlur options? Basically, I want no submit button, a cancel button, and the ability to submit when I tab out of the field. Is this doable without writing a helper? (avoiding digging that deep so
2006 May 10
2
session[:return_to] for going back.
Hi, Is session[:return_to] something Rails maintains to quickly go back to the previous uri without having to keep track of the action name? Or, do we have to actually set it in our actions? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060510/7e36a528/attachment.html
2006 Jul 21
4
Autocompleting InPlaceEditor
Hi, I''ve created some extensions to script.aculo.us InPlaceEditor, allowing the use of either server-driven, or local autocompletion. I''ve also created new helper methods in Rails for this functionality. My question is, is there any interest that I package this and make it available as a plugin, or something like that? Regards -- Ola Bini (http://ola-bini.blogspot.com)
2006 Apr 20
4
JavaScriptGenerator Dead End
Hi All, I posted earlier about a problem I was having with the various remote view methods escaping all the javascript in my callbacks. I was quickly informed that that''s just what they do, and offered some workarounds. However, in actually working with this, I''m finding that this one little thing is forcing me to write some REALLY ugly code. Where I thought I could
2006 Jun 16
2
DISABLE auto-escaping in image_tag helper
Is there any way to disable image_tag''s automatic escaping of special html entities in it''s :alt tag? Example: >From the controller: @sale[''title''] = ''My Company Product&copy;'' In the view: <%= image_tag(''path/to/file.png'', :alt => @sale[''title'']) %> Output: <img alt="My Company
2007 Dec 01
3
Rails 2 problem with compute_public_path
I''m trying to migrate to Rails 2, but keep getting these errors all over the place: ActionView::TemplateError: wrong number of arguments (2 for 3) On line #61 of users/new.rhtml 58: <% if @captcha_error -%><div class="fieldWithErrors">< % end -%> 59: <table class="signup"><tr> 60: <td
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,
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