I have a rails app that has picked up a bit of traction, but I have a serious headache to deal with. It's a basic sort of asset manager application - users upload their photos, .pdfs, videos, etc., and the system allows them to manage how that asset is presented.
I started with a fairly standard rails view - just what gets generated by...
I am using attribute_fu to render a nice block of rows for a particular table.
<%= f.render_associated_form(@foo.bars, :new => 5) %>
I would like to have the bar partial have some notion of a bit of state. (Because the notion is specific to the view, I do not want to externalize this to the Bar model itself and calculate it in the co...
I am having issues using the :collection command for a partial within a form I am creating in rails. I would ideally like to use the :collection command, so I can easily manipulate this section in my .rjs templates (the form will submit and reload the form when the check box is changed, it's a to-do list).
This code works:
<% for...
Hi There,
(My first question, so hello all!) I am using C# and the ASP.NET MVC Framework Beta 1 and was wondering if this was the most efficient way to achieve two, form posting scenarios using a single partial and also how to get the edit mode working. The partial contains my html form code so it can be recycled in both an add and edit...
In a rails application, in which situation would you use a partial and when would you use a helper? I find both very similar, since they represent markup fragments.
Is there a convention around this? which is the 'rails way' of using them?
Thanks!
...
I'm currently re-using a partial on two different views.
View A
View B
The partial belongs to Model A but has an association with Model B so it is applicable to Model B as well.
It contains a form and when data is submitted, it always redirects the user to View A. However, when I submit the form from View B, I would like to...
I want to implement a user control which represents a list of the current items in a user's shopping cart, and which is included from within the a master page.
I want to add a product to the shopping cart; the shopping cart should be automatically updated with an asynchronous call (JavaScript framework is jQuery) when a user adds a prod...
having a problem passing ViewData.Model to the partial views. It always is defaulting to null even if I equate it to a result query. I cannot access the strongly typed data because the Model is null. My current code is this,
ViewPage
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<% Html.RenderPartia...
I'm new to VB .NET, and if possible, I'd like something like Rails partials - bits of HTML template that can be referenced in a page's script, possibly within a loop. I know there might not be anything like that.
...
My app has a select box for users to choose a "venue". This select box is, as you would expect, in a form. I also have an action somewhere on the page that creates a new venue via AJAX. After the new venue is created, I would like to updated the venue select box to reflect this.
My solution was to put the select box in a partial and ...
In CodeIgniter or core PHP is there an equivalent of Rails's view partials and templates?
A partial would let me render another view fragment inside my view, like have a common navbar.php view that I could point to inside my homepage.php view. Templates would let define the overall shell of an HTML page in one place, and let each view ...
Hey, I just began to learn ruby/rails. At the moment, I try to do an example of a german book "Praxiswissen Ruby on Rails", which is pretty old and written for Ruby on Rails 1. Anyway, I tried to do the examples with Rails 2. Now I have had problem for over a week.
According to the book (Rails 1) I have to write in my controller:
pa...
Hi
I'm trying to figure out a good way to have 'global' members (such as CurrentUser, Theme etc.) in all of my partials as well as in my views.
I don't want to have a logic class that can return this data (like BL.CurrentUser) I do think it needs to be a part of the Model in my views So I tried inheriting from BaseViewData with these m...
If I declare local variables in a partial and then render the partial from another erb template, will the latter also have accces to those local variables?
...
I have a collection that contains instances of several different classes, and I want to render the partial for each instance. I can do this using the following code:
<%= render @results %>
My question is: How can I render the different partials in a different base directory? The above code will look for app/views/stories/_story.html.e...
Hey guys, first post here, hope you can help me out.
We're generating a newsletter automatically every 24 hours using a rake task. There's a section at the top of the newsletter where an admin can put a customized message. The screen that the admin uses has a live preview of the newsletter (they were insistent on this), rendered using...
I've figured out how to get models into partialLoops using the setObjectKey method of the PartialLoop helper. What I'm wondering if there is a way to specify that specific partial loops use the model key and other ones don't. Right now I think I have to do something like this:
// sets the object key for ALL partialLoops
$this->partialLo...
If we want to pass a collection to partial, we do like this:
<%= render :partial => "post", :collection => @posts %>
If we want to pass a single object within a custom variable, we do this:
<%= render :partial => "item", :locals => { :item => @advertisement } %>
Now what should I do to to pass a collection, "proxying" it through a ...
I'm reformulating this question as I'm understanding the issue better now.
I have an application with four models: Users, Products, Varieties and Seasons.
User
has_many :seasons
has_many :products, :through => :seasons
has_many :varieties, :through => :seasons
Product
has_many :seasons
has_many :users, :through => :seasons
has...
First off, let me say that I am familiar with content_for. It's not really what I'm looking for here.
I want to allow a template and any number of partials to build up, say, a list of JavaScript files I want to load, and pass them up to the layout for it to process and add to the <head> area. I only want to load the files if the page ac...