Questions tagged [partial]

Existing only in part; incomplete.

Existing only in part; incomplete.

1478 questions
138
votes
5 answers

Rails render partial with block

I'm trying to re-use an html component that i've written that provides panel styling. Something like:

Some Title

.. content goes here …
brad
  • 31,987
  • 28
  • 102
  • 155
127
votes
11 answers

How do I render a partial of a different format in Rails?

I'm trying to generate a JSON response that includes some HTML. Thus, I have /app/views/foo/bar.json.erb: { someKey: 'some value', someHTML: "<%= h render(:partial => '/foo/baz') -%>" } I want it to render /app/views/foo/_baz.html.erb, but it…
James A. Rosen
  • 64,193
  • 61
  • 179
  • 261
103
votes
8 answers

Is there any Rails function to check if a partial exists?

When I render a partial which does not exists, I get an Exception. I'd like to check if a partial exists before rendering it and in case it doesn't exist, I'll render something else. I did the following code in my .erb file, but I think there should…
Daniel Cukier
  • 11,502
  • 15
  • 68
  • 123
81
votes
7 answers

Partial class in different namespaces

Can I create partial class in different namespaces? Will it work correct? e.x.: class1.cs namespace name1 { public partial class Foo { Bar1(){ return 10; } } } class2.cs namespace name1.name2 { public…
RAMe0
  • 1,415
  • 2
  • 19
  • 31
67
votes
4 answers

Rails: Should partials be aware of instance variables?

Ryan Bates' nifty_scaffolding, for example, does this edit.html.erb <%= render :partial => 'form' %> new.html.erb <%= render :partial => 'form' %> _form.html.erb <%= form_for @some_object_defined_in_action %> That hidden state makes me feel…
Alexandre
  • 5,035
  • 7
  • 29
  • 36
59
votes
2 answers

AngularJs (1.X) Include Partial Template

I've this in my main layout file
I've a header.html partial template in my directory structure. How to include this template in my…
user3403716
  • 613
  • 1
  • 5
  • 5
55
votes
2 answers

Usefulness (as in practical applications) of Currying v.s. Partial Application in Scala

I'm trying to understand the advantages of currying over partial applications in Scala. Please consider the following code: def sum(f: Int => Int) = (a: Int, b: Int) => f(a) + f(b) def sum2(f: Int => Int, a: Int, b: Int): Int = f(a) + f(b) …
Hugo Sereno Ferreira
  • 8,600
  • 7
  • 46
  • 92
54
votes
5 answers

Trouble merging upstream changes back into my branch

I'm running into conflicts while trying to merge upstream changes back into my branch and I'm not sure how to resolve them. I created my own fork. I cloned it. I made changes to the branch on my fork, committed, and pushed. But then the main fork…
anonymous
  • 551
  • 1
  • 4
  • 5
48
votes
5 answers

python equivalent of functools 'partial' for a class / constructor

I want to create a class that behaves like collections.defaultdict, without having the usage code specify the factory. EG: instead of class Config(collections.defaultdict): pass this: Config = functools.partial(collections.defaultdict,…
Evan Benn
  • 1,571
  • 2
  • 14
  • 20
44
votes
2 answers

How can I render Partial views in asp.net mvc 3?

I have some data in ViewData.Model, and in my views I want to write a partial view and to pass their current model I have in my page. How I can pass their current ViewData.Model and render them through the location of partials?
delete my account
44
votes
3 answers

How to extend DbContext with partial class and partial OnModelCreating method in EntityFramework Core

I'm using EF Core and DatabaseFirst approach. My dbContext is created automatically by Scaffold-DbContext command. I need to add some new DbSets into a dbContext and add into OnModelCreating method some additional code but after each scaffolding…
44
votes
10 answers

Modifying MVC 3 ViewBag in a partial view does not persist to the _Layout.cshtml

I am using MVC 3 with the Razor view engine. I want to set some values in the ViewBag inside a Partial View and want retrieve those values in my _Layout.cshtml. For example, when you setup a default ASP.NET MVC 3 project you get a _Layout.cshtml…
Zoran
  • 844
  • 1
  • 7
  • 15
42
votes
5 answers

How to implement TypeScript deep partial mapped type not breaking array properties

Any ideas as to how might apply TypeScript's Partial mapped type to an interface recursively, at the same time not breaking any keys with array return types? The following approaches have not been sufficing: interface User { emailAddress:…
Allan Simoyi
  • 423
  • 1
  • 5
  • 9
41
votes
2 answers

Jekyll: Include HTML partial inside Markdown file

Is there a way to include an HTML partial from a Markdown file with Jekyll? Example: File index.md: --- layout: default title: Home --- This is a [Markdown](http://daringfireball.net/projects/markdown/) file. {% include foobar.html %} File…
François Beaune
  • 4,270
  • 7
  • 41
  • 65
32
votes
3 answers

Angular JS and partials

Is it possible to embed html page in another one in angular js? If so, how to do it? Here in their tutorial, the partial is not embedded in the page but it's like different page where you go when you click on one of the items. (see demo)
ParPar
  • 7,355
  • 7
  • 43
  • 56
1
2 3
98 99