similar to: Using standard helper methods in my helpers

Displaying 20 results from an estimated 1100 matches similar to: "Using standard helper methods in my helpers"

2006 Feb 01
0
Using draggable_element doesnt work with update_element_function
Hi everyone, I am writing a ruby on rails application, and making heavy use of AJAX calls and evaluate_remote_response. In my remote responses I often have several update_element_function calls going on, to update several divs on the page. What I am doing is calling update_element_function, with the content as a block. Inside the block I usually have html, or make calls to other partials or
2006 Feb 05
0
Using javascript with update_element_function
Hi, I am using evaluate_remote_response and update_element_function, to update elements with blocks of content, something like this: <% update_element_function("div_id", :binding => binding) do %> <div id="newdiv_id"> This is a new div! </div> <%= draggable_element(''newdiv_id'') %> <% end %> That will update the
2005 Dec 24
2
Ajax Help: Multiple Updates - ?
Hi! Wondering if anyone can tell me what''s wrong with my code? I''m trying to use the onChange event of a select list to update multiple divs... Agile Web Development with Rails (p. 403) suggests using ":complete => eval(request.responseText) instead of :update" I''ve attempted the following test code: # in the view <select name="plist",
2006 Jun 14
3
problem trying to update multiple <DIV> elements with AJAX
I''ve been trying for days now to figure this out on my own, but I can''t, so this is my cry for help. Here''s my situation: I need to update multiple <DIV> elements on a page, each with its own HTML, but I just can''t figure out how to get it to work. That is, I want to replace everything within each <DIV> element with something new. When I try what
2005 Dec 27
0
update_field question
I''m using update_field to update a <div> with the contents of a text_area as it''s updated by the user (a-la-Typo preview style). I''m now trying to preload the <div> so that it shows the contents of the field being edited even if that field doesn''t get edited. In other words, update_field is only called if the field is updated, but I want the
2008 Mar 19
3
ApplicationHelper
When working with views, I use instance methods of ApplicationHelper: # app/helpers/application_helper.rb: module ApplicationHelper def distribute(total, min, cutof, list) [1,2,3] end end # app/views/planner/_mta_colors.rhtml: <td> <% ... dist = distribute(total_v_px, 4, 0, colors.collect{|color| color[1]}) ... %> So to test the distribute method in ApplicationHelper, I have
2006 Feb 21
0
components using helpers
Is it by design that my custom components aren''t able to pick up my custom helpers defined in module ApplicationHelper, or am I missing something? This doesn''t really make sense to me, as components are intended to function like sub-actions... so their views should automatically pick up ApplicationHelper. Thanks, Mike
2007 Jul 31
11
helper spec not finding rails core helpers
Hi, My helper specs were going ok until I added a call to a rails DateHelper method in one of my helpers http://api.rubyonrails.com/classes/ActionView/Helpers/ DateHelper.html#M000574 The helper runs fine from my view templates, just dies in the spec test. I boiled my question down to a simple (not too useful) example. I''m not sure what I''m missing. #
2005 Dec 07
3
update_element_function fail gracefully?
I am using the update_element_function to update the text in some elements. This works fine, however, if I try to update an element that is not on the page anymore, it fails silently and no further javascript statements will be executed within that same request.responseText. Is there a way to fail gracefully in this scenario and ignore the missing elements? Thanks, Tom
2007 Jul 24
4
spec''ing helpers that use controller
Hi all, I''m in the process of creating rspecs for my helpers. One of the helpers in app/helpers/application_helper.rb looks like this: def page_name @page_name || "Define @page_name in #{controller.controller_name}::#{controller.action_name}" end The rspec is simply: it "should something" do page_name end
2006 May 24
0
Javascript as content parameter for update_element_function?
Is there any way to do this? The goal is to have the update_element_function update a div with alternating strings. Is there a better way to do this? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060524/a99b90de/attachment.html
2006 Mar 25
3
Rails Plugins: Why to register your own functionality with send()?
Hi there, I have seen in the file column plugin ( http://www.kanthak.net/opensource/file_column/) from Sebastian Kanthak or David''s acts_as_taggable plugin that to register my functionality I need to do something like this: ApplicationHelper.send(:include, InPlaceEditAssociations) I am wondering why not: (a) module ApplicationHelper include InPlaceEditAssociatons end or: (b)
2006 Sep 29
2
ApplicationHelper is not a parent of SomeHelper?
i have: # file application_helper.rb module ApplicationHelper def load_components @right_sidebar = ''some stuffs'' end end # file user_public/blog_helper.rb module UserPublic::BlogHelper def load_components ApplicationHelper.load_components @right_sidebar += ''{blog archive}'' end end the problem is, i want to load the
2006 May 07
0
NoMethodError trying to get ApplicationHelper method from a functional test
I am a little confused by the includes I suspect. In the book, it states that runtime environment will load the directories app, app/models, app/controllers, app/helpers, app/apis, components, config, lib, vendor and vendor/rails/*. However, when I try to access my "current_project" public method, it fails with a NoMethodError. What is even stranger is that I can use reflection to find
2006 Apr 03
1
Helpers for ActiveMailer templates
What helpers, if any, should be available to a view for ActionMailer? Even ApplicationHelper methods don''t seem to be available. This is on Rails 1.0. David
2007 Aug 27
2
issue with edge rails and urls
I just switched our project over to Edge Rails, and I''m running into this problem with all of my helper methods that call _url methods: NoMethodError in ''ApplicationHelper home_link should generate a valid home link when User.current and Profile.current is not set'' You have a nil object when you didn''t expect it! You might have expected an instance of
2009 Jan 26
2
Cannot extend class in Application Helper
Looking for some help with extending existing classes. In a view I have <td><%=h bmevent.node %></td>. I need further processing on the output and added a helper: module ApplicationHelper class String def a self[ /^[^\0]*/ ] end end end and <td><%=h bmevent.node.a %></td> results in an undefined method `a'' for #<String:0xb6c8105c>
2006 May 13
1
undefined method `strftime'', being called from a partial.
Hi, I''m having an issue with calling a function that I''ve defined in ApplicationHelper called format_time: module ApplicationHelper def format_time(time) time.strftime("%a %b %d, %I:%M%p") end end I use this function in my views to format the Time.now that I would have stored in my tables as a DATETIME. I''m able to use this function, without any
2006 Mar 15
4
RJS template eating encoding
I was previously doing an update via .rhtml templates creating an AJAX :evaluate_remote_response. I use UTF-8 in my pages, and my app requires that I be able to, say, put Japanese characters in. The problem is that when I switched this over to an RJS template it started eating the encoding. I now get garbage characters where before I got the correct ones. The code for the RHTML: <%=
2006 Apr 11
2
link_to_remote to update multiple components
How would go about to update multiple components when using link_to_remote? I''ve got a button that lets you switch between languages and it has to update every component in my application (like, let''s say: the main screen, the top navigation bar and the search bar). Each component is created in a different DIV and whenever the language is switched, the entire application