similar to: using partials in a for loop

Displaying 20 results from an estimated 2000 matches similar to: "using partials in a for loop"

2008 Sep 22
2
Variables visible in all actions in a controller
Hello, I want make a variable visible to all actions in a controller. Everytime user submits a parameter "school_class_id" on the basis of which I assign a variable which I want to make available to all the actions in controller. I used before_filter: set_class_id where set_class_id is defined as def set_class_id @currentClassid = session[:currentclassid] if
2006 May 26
4
shouldn''t this work? - session[:array_of_objects].delete_if {|x| x.id == params[:id]}
I am saving an array of active record objects (college courses) in the session as session[:course_list]. This is the cart for a registration controller. If a student chooses to delete the course from the list I get the :id as params[:id]. However if I do session[:course_list].delete_if {|x| x.id ==params[:id]} does not work. session[:course_list].delete_at(idx) works. Ocourse to do this I have
2010 Aug 31
6
ajax and partials
Hello all, I am still very new to programming and wonder if I could get some help. I have tried to figure this out myself but still having trouble with some of the concepts. I’ll do my best to explain the problem and include the code. I may be completely off track, so ANY direction offered would be deeply appreciated. I have a question model / object which consists of a question, answers, and
2006 Apr 15
0
form_for, partials, and rjs
Hi there! Im trying to use rjs templates to add form fields to an existing form. So for example a user could fill out a form and optionally hit a link_to_remote and get another set of identical fields to fill before sending. This would mean he/she could add ex. more than one record in the same form. The original form was rendered with form_for and using a partial: <% form_for :example,
2006 May 13
5
Ajax Checkbox using Rails
Hi, I''m trying to have a checkbox, that when clickes sends an update to the server and in turn modify the UI with feedback on the success of the operation. The main difficulty I''m encountering is that I can''t pass the checkbox value if I use the standard PrototypeHelpers. I''m using remote_function to build the function call, but it doesn''t allow
2006 Aug 01
2
Partial Naming Madness
Hi, I am having the following issue with a partial. During initial page load, I am doing a "render_partial_collect ''foo'', @foos", and all goes well. Each foo partial makes use of a variable inside called ''foo'' (and can get foo.id etc). After all the partials are loaded, I need to :update a div corresponding to one of the partials (ie re-load the
2008 May 08
0
stub sub partials when testing partial with rspec
Hello all I prefer to use many partials. It makes my code more DRY Also I use rspec, and when I have to test partial with sub partials I have a problem. if I stub render, then my partial will not be rendered. If i do not stub render it tries to render sub partial (and i don''t need this) Not very long googling did not bring the answer, so I made very dirty and IMHO dangerous function
2006 Apr 15
1
Right way to pass conditionals to partials
Hi All, I have some partials that need to be rendered a bit differently depending on the context. To make matters worse, sometimes these partials are including other partials, that I''d like to control from the main template. These partials are templates that look similar in different contexts, but have different controls depending on where they''re being rendered. I
2006 Jun 24
3
Staying DRY -- can views share partials?
Let''s say I have a "main" controller/view and a "sub" controller/view. If I have defined a partial in "main" for the site header (_site_header.rhtml) can I share it with "sub" or does "sub" have to duplicate it, use a symbolic link to the file, or convert the cool partial into an ugly helper? It would be nice to have a shared placed
2006 Mar 09
4
calling partials from public/*.html?
Can I call partials from html files in public? Is this wise? I''ve got a bunch of html files and I''d like to let them have access to pieces of Rails, but I''d like to manage them through Contribute or some such. I *could* wiki them up, but that seems like a lot of work for pages that don''t get updated that often (yearly or so). Thanks in advance! - Dave --
2006 Nov 04
1
Partials shared between multiple controllers
(Just getting started w rails, web app dev for a long time...) I have some partials that are common across multiple controllers. They''re not universal, so they don''t belong to be part of these controllers'' layouts. It appears that I can put them at the root of /views/, and render them using a relative path, like so: <%= render :partial => "./footer"
2006 Jun 19
2
Partials from a master layout?
Hi I am using a ''master'' layout in my project by putting "layout ''main''" in my application controller so that the same layout is applied to every controller and I would like to use partials in the layout file (obeying DRY, of course!) but if I render a partial in the layout then whenever the layout is rendered by a controller the layout looks for
2005 Dec 13
1
Locals and partials
Since i can''t figure out how to use heredocs with erb. im looking at solving my problem with partials, but since partials seem to have a completely separate namespace/scope im looking for a way to pass the entire scope of the calling rhtml to the partial. ------------------------------------------------------------------------ Hunter Peress
2010 Jul 15
2
Can partials be accessed from two views?
For me to keep my application DRY i need to be able to have partials that can be accessed from two views. How is would I go about doing this? Many thanks, jakx12 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2008 Oct 16
1
Modularisation: Using helper generating HTML output vs. using partials
Hey, I''ve got a general question: when do I use helper and when I do use partials to modularise certain gui elements? For example: I''ve got a faq list. Each item can be folded and unfolded using ajax. FAQ foo -> question 1 -> question 2 -> question 3 So, I wrote a helper "faq_li_tag(args)" which takes the question and answer for parameters and generates the
2012 Sep 05
2
Partials and helpers
Hi, Is there any reason why helpers cannot render partials? I would like to do something like this in the layout: <body> <%= magic_header %> <%= yield %> </body> and then have a magic_header helper def magic_helper ...do some magic... render partial: "magic_helper" end Why is this wrong? Cumprimentos, Luís Ferreira -- You received this
2006 Jun 25
4
Zebra Striping a Collection of Partials
I''m using render to display a collection of partials, where each partial is a table row. Is it possible to zebra-stripe the table using this method i.e. alternate table rows get a different CSS class? I can''t work out how each row partial would know whether it was odd or even. In the normal scheme of things I could do: <% odd_or_even = 0 for asset in @assets
2006 Jun 27
2
Render partials in folders
Right now I have partials in a view folder corresponding with my controller. ie: controller: example, view: example/_partial.rhtml and I call it with render :partial => ''partial'' How do I add the partial to another folder and call it? ie: controller: example, view: example/new_folder/_partial.rhtml render :partial => ''new_folder/partial'' # does NOT work
2006 Mar 22
3
Rendering partials in ActionMailer?
Hello, Is anyone out there rendering partials successfully in ActionMailer templates? I am having trouble with this, and wasn''t sure if it was my configuration or something with a version of Rails I''m running. We''ve got over 15 mailer templates, all working like a charm. But we have a piece of shared code, that we''d really like to not have to copy &
2006 Jan 29
1
Rendering partials with ActionMailer
Can ActionMailer render partials (like .sigs, for example)? When I try to render :partial, I get an error: undefined method `controller_path'' for SomeNotify:Class I also tried putting the partial within /shared, but it likes that even less -- it can''t seem to find the template. Jake -- Posted via http://www.ruby-forum.com/.