renderpartial

ASP.NET MVC Returning Partial View as a full View Page

谁说胖子不能爱 提交于 2019-12-11 14:51:16
问题 I have a number of partial views that are used to render media in different formats (embedded video mainly). I now have a requirement that has me displaying these videos inside an iframe. Is there a way that I can return a minimal HTML page with the partial views embedded in it? 回答1: Check out these discussion about how to render a partial view to string. RenderPartial to String in ASP.NET MVC Beta RenderPartial to string 来源: https://stackoverflow.com/questions/767722/asp-net-mvc-returning

Rails - Rendering an edit form partial within another partial

霸气de小男生 提交于 2019-12-11 08:15:30
问题 I have a table that I am trying to make a bit more streamlined. In my view (this view is already a partial (_recipe_ingredient.html.erb), I have the following code, where rendering the partial is not working: <tr> <td><%= recipe_ingredient.ingredient.name %></td> <td><%= recipe_ingredient.ingredient.weight1*recipe_ingredient.quantity %></td> <td><%= recipe_ingredient.ingredient.description1 %></td> <td><%= recipe_ingredient.quantity %></td> <td><%= render(:partial => 'recipe_ingredients/edit'

Rails 3 ajax update partial doesnt work without page refresh

允我心安 提交于 2019-12-10 19:41:12
问题 I'm working on a Rails 3 shopping cart. I've a catalog page that displays all products and one partial that gives a gist of the shopping cart. So whatever product a user adds to the cart is displayed in this shopping cart partial. Now, this ain't working. I've to hit refresh after adding a product to cart, otherwise the partial doesn't update. Here's my code: Cart_Controller add method def add @cart = user_cart @deal = Deal.find(params[:id]) @item = @cart.add(params[:id]) flash[:notice] =

Is it possible to put just a rails form element in a partial?

耗尽温柔 提交于 2019-12-10 13:58:57
问题 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 render the partial from the create action in the controller. <div id="venue_select" style="clear: both;"> <%= render :partial => 'venue/venue_select_box' %> </div

render a partial from jquery and haml

霸气de小男生 提交于 2019-12-09 12:22:44
问题 The functionality I plan on doing is to insert some form elements depending on a number chosen from a select tag. I have a select tag called for number_of_passengers, and i plan to dynamically append new passenger fields for the number chosen. Say I select 2 from number_of_passengers, then 2 forms should appear in a fieldset. these forms contain name, age weight etc. I tried following this: call a rails function from jquery? and just converted it to haml-speak but I get errors whenever I use

rails: how to update a has_many :through relation via jQuery?

本小妞迷上赌 提交于 2019-12-08 03:43:17
问题 Sorry, if this is a noobish question, but I'm just getting started with Rails and jQuery. I have the following scenario: I have 3 classes: contacts , companies and contact_company_joins (ccj). For all three classes I created models , controller and views . Obviously, contacts and companies are connected via the join-table ccj (using has_many :through ). contacts <-> contact_company_joins <-> companies In my contact's "show" view I want to display a table that lists all companies that the

Render partial in Ruby on rails a collection is multiplying items

女生的网名这么多〃 提交于 2019-12-08 02:06:11
问题 I want to display a list of items in a page in Ruby-on-Rails. I use partials in my index.html.erb file I have: <%= @lista = News.find(:all, :order => Document::COL_DATE + ' DESC, id DESC') render :partial => "newsitem", :layout => "list_news", :spacer_template => "spacer", :collection => @lista %> in _list_news.html.erb I have: <div class="news"> <%= yield %> </div> in _spacer.html.erb I have <hr/> in _newsitem.html.erb I have <%= newsitem_counter + 1 %> <!-- Code to print details for one

rails 3 render partial with params

风流意气都作罢 提交于 2019-12-06 18:49:51
问题 I'm having a problem passing some parameters to a partial. No matter what I've tried the params don't pass when the partial is rendered. I am using a jquery tabbed layout, and each tab displays work orders in a particular status and also based on a range of dates. I am using the params :sort_filter and :status_filter to accomplish this. My original code is here, but I want to change this to render partials in the link_to's instead of the way it's listed here: <ul> <li><%= link_to "Active",

rails: how to update a has_many :through relation via jQuery?

假如想象 提交于 2019-12-06 10:56:04
Sorry, if this is a noobish question, but I'm just getting started with Rails and jQuery. I have the following scenario: I have 3 classes: contacts , companies and contact_company_joins (ccj). For all three classes I created models , controller and views . Obviously, contacts and companies are connected via the join-table ccj (using has_many :through ). contacts <-> contact_company_joins <-> companies In my contact's "show" view I want to display a table that lists all companies that the contact is connected to (and some additional info on the company itself e.g. phone-number). In my company's

How to use js file within view folder

只谈情不闲聊 提交于 2019-12-06 08:33:48
问题 I am using ruby on rails and I would like to render a partial on click (using jquery) an example of this being: $('#submit').on('click', function(){ $('#lol').append("<%= escape_javascript(render :partial => 'myPartial' ) %>"); } I basically want to submit a form then show the results (render partial) after in a read only format without the page refreshing. Problem is I can't use render in the asset pipeline. How do I include my JavaScript file from the view folder or what would be a good