jspdf-autotable prevent linebreak over pages - jspdf

Is there a way to prefer a new page over a linebreak? So when a linebreak would cause a new page, instead the entire row is put on the new page?
So to prevent this:

Related

Redirect_to a part of a page that is initially collapsed, but with collapsed part opened?

I have a redirect_to and need the user to be placed at the specific anchor (can do that much), but with the collapsed portion of the page already opened up.
I tried
giving an element inside the collapsable portion an id, then redirecting to that id using anchor, but that doesn't open the collapsed portion of the page, so the user doesn't see what they're supposed to, and they may get confused
Running some javascript after the redirect, but it may not be possible
How can this be achieved?
I solved this by using a session variable (e.g. collapse = 'show'), accessing that in the view to append that value to the bootstrap collapse class so it looks like this when it should be collapsed collapse, and it should look like this when it should load the page not collapsed collapse show
This approach could be better if using query params for the action being redirected to (either way will work, but the second method won't clutter the user's session)

Shared content between templates

I would like to share content (essentially blocks of html) between templates.
For example, suppose I have a common footer section with a graphic or two, text and links to 'about us', 'contact us' and so on.
I have different templates for different page layouts, but they all require this footer.
So far I can think of three ways :
Nesting templates : ie have a master one which has the footer content, then a child one for each layout, then the actual page template, but this could get tricky if some pages need a different footer
Using a Partial View to hold the footer content and using #Html.Partial() to pull in the partial view on the various templates
Create a settings document with the footer content and use Umbraco.Content() to fetch the footer property
Is any of these the recommended process (and are there any pitfalls?) or is there a better way?
I would normally do one of the following:
Have properties on the homepage for the footer links etc (in a separate tab) and pull in the values into the footer partial, this way you only have to set it once, rather than having it on every page
Have a Site Settings node at the same level as the home page and pull the values from there into the footer partial
That seems to be fairly standard from most of the Umbraco sites that I've worked on. I wouldn't have all of the properties on each page, unless you need a unique footer each page for some reason.
For example, lets say you add a tab called "Footer Settings" to the Home Page DocType with a single string property with the alias "copyRightNotice" and then you want to display that in a partial, your partial might look something like:
#inherits Umbraco.Web.Mvc.UmbracoTemplatePage
#{
var rootPage = Model.Content.AncestorOrSelf(1);
<h3>#rootPage.GetPropertyValue("copyRightNotice")</h3>
}

How to start new pages automatically whenever the text string cannot fit on the current page in prawn

I am trying to generate a PDF invoice using prawn with header, body and footer. The content of the body may change. I'm using bounding_box to place content in the body. If the content cannot fit on the current page body, it should automatically place the remaining content in body portion of the new page. Please help me with the coding.
Use the span() method rather than bounding_box(). This will allow you to set the width of your text block, but it will reflow to the top of the page when you start a new page.

One page website: Rewrite URL in address-bar when clicking an anchor-link

I have set up a one-page, horizontal scrolling website with several anchors combined with DIV-id's. The website has five pages side-by-side that automatically render full-page based on the visitors browser-window.
The menu contains seven hyperlinks that address different anchors (div-id's) on the page (for example: http://www.url.com/#partsix). When they are clicked, the visitor will automatically be scrolled to the anchor part of the page. This works fine and really smooth.
The problem i'm dealing with is that, since the page is not being reloaded, the address-bar is not updated. So if a visitor wants to link to a page, or, for example, like the URL with a facebook button, it will be very difficult.
Is there a way to rewrite the address bar with the anchorlink without reloading the page?
EDIT: I have found out that i can user the action onclick="window.location.hash = hash;" on the hyperlinks. This will return the hash of the anchor it is scrolling to in the address bar. Works like a charm. But: my menu plugin does not let me add this action to the hyperlinks. So i wanted to check if i can use javascript to apply this action to all hyperlinks in the same li class. Does anyone know how?
The li class that contains all menu links is 'mc_menu mc_depth_2'

prawn pdf table generation breaking a new page too early?

I'm using Prawn to generate pdf's and displaying data in a table. My problem is if a row is to large the page breaks and adds this entire row on a new page. With continuing rows underneath it. Hence I'm being left with big empty spaces under certain pages. Like 5 rows listed and then a large empty space - page break - on new page show large row(That wouldn't fit in its entirety on the page before) + continue showing other rows.
Prawn::Document.generate("#{filename}", :page_layout => :portrait) do
#table
table_rows_count = statement_table.size
table(statement_table) do |s_table|
all the code to format table contents
end
What I'm trying to do, is have the row break a new page when it reaches the end of that page and then display the rest of that row on the other page. i.e making full use of the space available on a specific page before creating a new one.
I have tried grouping the entire table. But that doesn't work - prawn won't allow it.
Any ideas? I'd very much appreciate your help.

Resources