Questions tagged [partials]

Partials are often synonym for templates, which can even also be called partial templates.

Partials are often synonym for templates, which can even also be called partial templates.

763 questions
0
votes
2 answers

Rails partials in controller

I've got a code that almost repeats itself in three of my controllers and i was wondering: is there a way to render partials inside controllers? I'll clarify, i want to write the same piece of ruby code and render it in each one of the controllers.…
Uri Klar
  • 3,800
  • 3
  • 37
  • 75
0
votes
2 answers

Rendering partials for Sets

Does the render partial function take any type of collection? I tried passing a Set (@dogs) in and it doesn't seem to work: <%= render(:partial => "dog", :collection => @dogs, :as => :dog) %> I tried looking it up on the docs…
anNA
  • 330
  • 1
  • 2
  • 9
0
votes
1 answer

Passing Variable to Partial - Page Displays symbol instead of string

Here is the code in my view to call the partial: <%= render :partial => "/divbox", :locals => { :smush => "Science" } %> and now here is what's in _divbox.html.erb:

<%= :smush %>

I expect HTML output of:

Science…

0
votes
1 answer

Rails: Nested views or partials or..?

I new to Ruby on Rails, and I am coming from Drupal/PHP background. I am trying to do something simple. A "Static" controller for some pages like about us, disclaimer etc. and a "Video" controller for videos. The whole application has same look. I…
0
votes
1 answer

shared partials error undefined method `empty?' for nil:NilClass

I've create a partial (views/cart/_cart.html.erb) for my applications shopping cart. I'm rendering it in only in my views/layouts/application.html.erb file. But when I run it I'm getting a NoMethodError on every page other than the…
0
votes
1 answer

ruby rails print specific elements from multiple partial files residing in a directory

I have a directory filled with partials. I'm looking to list ONLY the first h1 tags in each partial. The methods to accomplish this task could probably be modified to grab other elements as well. Right now I use ruby to open each file, print out…
twinturbotom
  • 1,504
  • 1
  • 21
  • 34
0
votes
2 answers

rails navigation and partial refresh

Thanks for your time! I get some reports data on my hand and I want to present these data on the web. The view of the HTML will be divided into two parts, the left part and the right part. There's a tree view in the left part consisting of the…
mCY
  • 2,731
  • 7
  • 25
  • 43
0
votes
3 answers

How to stay MVC and have dynamic partials calls in rails?

I was wondering if it was correct to do the following in the model: get_partial #logic... return "_partial_name1" #more logic return "_partial_name2" #more logic return "_partial_name3" else …
Syl
  • 3,719
  • 6
  • 35
  • 59
0
votes
2 answers

zf2 cant render partial navigation

I'm trying to do ` $partial = array(DIR.'/menu.phtml', 'default'); echo $this->navigation()->menu()->setPartial($partial);` and im getting error Fatal error: Zend\View\Exception\RuntimeException: Zend\View\Renderer\PhpRenderer::render: Unable to…
Cawa
  • 1,269
  • 3
  • 25
  • 44
0
votes
1 answer

Django Loading data independantly in a partial

I have some partial templates which I load in on various pages and sometimes the inclusion of these partials is dynamic, these have their own related models. At present I am passing models via views to the main page, but is there not a way to load…
KevTuck
  • 113
  • 8
0
votes
1 answer

Rails Partial Local Variables

I have the following code inside a js.erb file :: var title = $('#kase_listing_title_show_determinator').attr('data-known-title-display'); $('#kase_list_core').fadeOut('slow'); $('#kase_list_core').html("<%= escape_javascript(render :partial =>…
deepinder
  • 131
  • 2
  • 8
0
votes
3 answers

Correct way to share a view in the index page

I'm a Ruby-on-Rails newbie, just starting out. I have an MVC called "account_types", generated via scaffold to produce: controllers/account_types_controller.rb helpers/account_types_helper.rb models/account_type.rb views/account_types/_form, edit,…
Hellfire
  • 25
  • 4
0
votes
1 answer

View Models (ViewData), UserControls/Partials and Global variables - best practice?

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…
elado
  • 8,510
  • 9
  • 51
  • 60
0
votes
1 answer

HAML partials - partial does not recognized object which I queried for in the controller

I have this controller: def index @disclosures = Disclosure.where(:user_id => current_user.id) respond_to do |format| format.html{} format.js{} end end and with the help of the good folks at StackOverflow I am now able…
GeekedOut
  • 16,905
  • 37
  • 107
  • 185
0
votes
1 answer

Mobile version of symfony app - partials

I want to make sth like this Mobile version of my Symfony project when file xxxSuccess.mobile.php does not exist, it should load xxxSuccess.php. It works OK. But it doesn't work with partials. I want to load _partialfilename.mobile.php but if it…
latata
  • 1,703
  • 5
  • 27
  • 57
1 2 3
50
51