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
8
votes
1 answer

Conditionally displaying partial views based on active page

I'm trying to get familiar with ASP.net MVC5 and am porting over an existing website. I have defined a default shared layout view that contains several partials for things like the header, navigation, footer, etc... The only difference between my…
on3al
  • 2,090
  • 4
  • 20
  • 19
7
votes
4 answers

Asp.Net MVC 3 - @Html.Action won't render/return any HTML

I've been moving a fairly new project from ViewPages to Razor today, and all seems to be going well. Except I'm trying to use Html.Action to render a user control and it won't render anything. So I have a Shared/_Layout.cshtml file which is…
Steve Owen
  • 2,022
  • 1
  • 20
  • 30
7
votes
1 answer

How to rendering partials within a partials in middleman

I have some Haml partials, many of which contain the boilerplate .container .row .col-lg-12 When I try to abstract that out ala = partial "site_section", I get: syntax error, unexpected keyword_end, expecting end-of-input…
Walrus the Cat
  • 2,314
  • 5
  • 35
  • 64
7
votes
2 answers

Modular Zend Framework with a base of partials

Currently I'm finding I have to keep duplicating partials for different modules. I would like to have a case directory for all partials to be accessed. Does anyone have a good way of doing this? Thanks
azz0r
  • 3,283
  • 7
  • 42
  • 85
7
votes
1 answer

How can I access the :locals hash from inside a partial instead of the local variables with the same name?

Apart from being a good idea or not, I would like to know how to access the :locals hash from inside a partial instead of the local variables with the same name? I'm attempting to try to explore a potentially more efficient approach to a pattern I…
pixelearth
  • 13,674
  • 10
  • 62
  • 110
7
votes
1 answer

Rails rendering instance variable from application.html.erb

I am following the Agile Web Development with Rails 4 book and I'm a bit confused on a part about rendering. The simple version of the question is... within the application.html.erb file there it says render @cart This is confusing because I…
natecraft1
  • 2,737
  • 9
  • 36
  • 56
6
votes
1 answer

rendering a partial in a flash message in Rails 3

So I'm just trying to add some social networking share links (facebook, g+, addthis ect) to one of my flash messages when a user successfully uploads a file. I have all the code in a partial so I thought I could just render that but I just get a…
rugbert
  • 11,603
  • 9
  • 39
  • 68
6
votes
11 answers

CodeIgniter or PHP Equivalent of Rails Partials and Templates

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. I could have a common navbar.php view that I could point to the inside my homepage.php…
Wayne Kao
  • 8,125
  • 5
  • 30
  • 25
6
votes
5 answers

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

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…
Tony
  • 18,776
  • 31
  • 129
  • 193
6
votes
1 answer

Rendering content inside a partial via =yield

I'm creating an application with ruby on rails where I have an items/_item.html.erb. Inside the partial is a yield statement so i can add extra content as needed. In this case, I want to add a specific button to item depending on what view calls…
roloenusa
  • 761
  • 1
  • 10
  • 19
6
votes
2 answers

Passing instance variable to js.erb file (Rails 3 / jQuery)

I have an "index.html.erb" file with the following: <%= render @users %> This renders "_user.html.erb" and outputs a button for performing a certain action on each user: <%= link_to "action", action_path(user), :id => "#{user.id}_action", :remote…
neon
  • 2,811
  • 6
  • 30
  • 44
6
votes
4 answers

Using javascript code in Jade views - if(variable) shows undefined instead of passing

So this is a recurring issue I have and haven't found another example on SO so here goes: When rendering Jade templates I get 'variableName' undefined even when using -if(variableName) in the template. Example (I'm using this as a partial for 'info'…
JohnAllen
  • 7,317
  • 9
  • 41
  • 65
6
votes
1 answer

Handlebars partial documentation unclear

So I've read the offical documentation regarding Handlebars partials. It states: In order to use a partial, it must be registered via Handlebars.registerPartial. Handlebars.registerPartial('myPartial', '{{name}}') This call will register the…
connexo
  • 53,704
  • 14
  • 91
  • 128
6
votes
1 answer

Handlebars @partial-block usage

I have been trying to pass a template to a partial as explained here: https://handlebarsjs.com/guide/partials.html#partial-blocks. For instance I have a file hello.hbs that contains: Hello {{> @partial-block }} that I am trying to include inside…
helenej
  • 331
  • 4
  • 15
6
votes
2 answers

Haml render multiple partials in layout

How can I make the code indent correctly? app/views/layouts/shared.html.haml: = render :partial => "shared/head" = yield = render :partial => "shared/footer" app/views/shared/_head.html.haml: !!!XML !!!1.1 %html{"xml:lang" => "pl", :xmlns =>…
astropanic
  • 10,800
  • 19
  • 72
  • 132
1 2
3
50 51