Displaying 20 results from an estimated 4000 matches similar to: "Right way to pass conditionals to partials"
2008 Mar 31
2
Rails and Partials
Excuse my ignorance on partials but.....
I am trying to use partials to create a uniform display box built with
html tables. The only way I have thought about accomplishing this is to
create two partials:
_start_box.erb
----------------
<table id="box" width="<%= width %>"><tr><th><%= h(label_text)
%></th></tr><tr><td>
2006 Apr 26
0
partials or helpers: which to use?
Hi,
Just wondering: when do people use a helper and when a partial? I''ve
just converted a bunch of partials into helpers because I didn''t like
the syntax of partials where I can had to pass in a :locals hash every
time. I wonder what advantages a partial has over a helper and vice
versa. I guess a partial has easier access to the controller and various
assigned variables,
2006 May 25
0
Partials question
Hiall,
I have a question concerning the use of local variables in partials.
Given that obviously all instance variables of the invoking controller
are available to the partial (as they are available to the normal
template), what situations are there in which to use local variables?
Another question concerns the :object parameter in render :partial =>
"xxx", :object => @foo. Is it
2008 Jun 10
3
newbie nls question
I'm tyring to fit a relatively simple nls model to some data, but keep coming up against the same error (code follows):
Oto=nls(Otolith ~ Linf*(1-exp(-k(AGE-to))),
data = ages,
start = list(Linf=1000, k=0.1, to=0.1),
trace = TRUE)
The error message I keep getting is "Error in eval(expr, envir, enclos) : could not find function "k"". I've used this
2006 Sep 08
2
NPTL problem on Centos 4.4
Not sure where to ask this, I've been googling and not finding much that
is helpful.
At work I've got a multi-threaded program targeted at Linux. It compiles
on RHEL 2.1 and 3, and is targeted at 2.1, 3, and 4. UP until today, the
binary built on 3 has worked fine on 4.
But on RHEL4 update 4 it dies a horrible death in pthread_create. I have
reproduced the problem on Centos 4.4, where I
2007 May 17
2
state plugin
hi,
I saw that Mike Dransfield tried to port 'state' plugin from beryl.
What does it do? It should be able to place windows, based on name,
class etc., to specific viewports. I recently converted to compiz window
manager from WindowMaker (used it for 8 years), and I miss automatic
'pinning' of specific windows to particular workspace (or viewport in
this case).
Mike's
2005 Aug 25
5
Samba PDC, ldap or mysql????
Hi all,
I'm under the gun to rid ourselves of the nt4 PDC which we
currently use. options are A/D, samba, pgina. I really dig pgina,
but dont think I can pass citrix credentials properly :( So I'm
left with samba vs A/D. A/D is well,, ummmmm A/D, so tyring to
avoid it.
Currently have used Samba file servers for years.
Have played with Samba PDC with2.2
Now, going to try
2006 Jul 24
2
BIG JS limit? Using replace_html with partials containing JS
Hello,
It''s pretty hard giving a practical example on this one.
I have a partial which contains some generated Javascript.
Something like:
order_screen.rhtml
-------------------------------------------
<h1>Order</h1>
<div id="order_part">
<%=render :partial=>''order_new'' %>
</div>
<h1>Ordered products</h1>
2006 Mar 08
4
scrollbar doesn''t show on the right place when using partial( )
Hi,
I''m using partial() to connect ours pages togother,
however, one of the partials is larger than the other,
when it happens, instead of create a scrollbar on the
browser, a scrollbar appears at the end of the
partial, since the partial is in the middle of the web
site. it isn''t really good... So does some one know
how to remove the scrollbar on the partial and put it
on the
2009 Feb 06
2
Using partials with form_for
hi all
i was wondering whether it is possible to use partials along with form_for
and form_field. following code is not working. is there some error or this
case is impossible..??
*#new.html.erb*
<h1>Enter Details for new Partner:</h1>
<% form_for(@partner) do |f| %>
<%= render :partial => ''form'', :locals => {:partner => f} %>
<p>
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 12
4
CSS and Javascript with partials and layouts
Hi,
I''m developing an application that uses a layout called main on every
page. Most of the individual pages are represented with a single partial
template, but there are several pages that are composed of multiple
partials.
My main layout looks something like this:
Code:
<html>
<head>
<title><%= @title %></title>
<%= stylesheet_link_tag
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
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
2011 Apr 15
0
Suppressing log line for partials
I have a lot of partials, so I find that my production.log file gets
pretty cluttered and large quickly and it makes it more difficult to
use. I like most of the messages, I just don''t see a need for taking
up a line for each partial that is rendered. The logging is done in
action_pack in the log_subscriber file here:
class LogSubscriber < ActiveSupport::LogSubscriber
def
2007 Jul 16
0
Partials vs. Helpers
I have several partials containing dynamic codes (already memcached all
the fragments as best I could), which I reuse ( render :partial =>
"stuff.rhtml" ) a lot within a single action call. For example, I have a
partial which defines how an entry is to be formated in HTML. I have 40
entries on a page, so the partial is rendered 40 times in a single
action.
Not knowing the
2004 Sep 10
1
upcoming 1.0.1...
--- Matt Zimmerman <mdz@debian.org> wrote:
> On Tue, Oct 30, 2001 at 03:23:05PM -0800, Josh Coalson wrote:
>
> > 1. support for wrapping FLAC streams in Ogg. thanks to Matt for
> the
> > initial work. I have taken his patch and worked it into flac 1.0,
> > which I will be checking in this week.
>
> Very cool. Did you just wrap the FLAC format in Ogg as I
2006 Mar 22
2
Theora streaming from windows
We run an icecast server that several people in Louisville use for audio streaming. A
number of people have expressed an interest in video streaming through it, too, but
cringe when I talk about setting up a linux server for streaming. Has anyone managed
to get streaming working from Windows media encoder using the directshow plug ins?
I'd like to be able to tell people they can encode the