How can I remove body from a Page in OrchardCMS? - asp.net-mvc

I currently have 2 page types in my Orchard CMS setup. One is for the front page, one for a detail page. On the front page, I have removed the body from being displayed, so that it just shows 2 HTML widgets.
Is there a way so that when someone edits this page, they don't get a body section?

A placement file might also do the trick: placement also works for the admin ui... That could enable you to make it show or not without requiring two different content types.

You can remove the Body Part from the page content type you use for the front page. This way people who edit this page won't see the editor for body content and the body won't be rendered at all.
HTH

Related

How to accomplish this MVC layout

Being relatively new to MVC I have been struggling for the past several weeks getting my layout to work.
I have managed to get myself really twisted into knots. So instead of trying to explain and unravel my mess perhaps instead someone could explain how I would accomplish the following at a high level.
_Layout this would have all the css js etc. It would also have basic structure.
Of course HTML tags not allowed in code block....each render is in a div.
#RenderPartial(Header)</div>
#RenderBody()</div>
#RenderPartial(Footer)</div>
RenderBody is Index.cshtml and it would be broken into three pieces
#
#Html.Partial(NavMenu, model)</div>
#Html.Partial(SubNavMenu, model)</div>
#Html.Partial(MainContent, model)</div>
I have this basic layout and it looks fine until you click one of the menu items.
The menu items render as:
<a class="k-link" href="/stuffroute">Stuff</a>
That route goes to a controller that returns a view and that navigates away from the above arrangement in Index.cshtml. So I end up with the header, footer, and subdash nav....
So the question is...
How do I route / orchestrate my layout to not lose the differing pieces?
Partials don't do anything for you here. You're essentially asking about how to create SPA (single page application), although in this case your application will have other pages, it's just that the index view will act like a SPA.
That requires JavaScript, specifically AJAX, to make requests to endpoints that will return HTML fragments you can use to replace portions of the DOM with. For example, clicking "Stuff 1" causes an AJAX request to be made to the URL that routes to FooController.GetSubNav([stuff identifier]). That action then would use what was passed to it to retrieve the correct sub-nav and return a partial view that renders that sub-nav. Your AJAX callback will then take this response, select a portion of the DOM (specifically the parent of the sub-nav) and insert the new HTML as its innerHTML.
If you're going to be doing a lot of this, you'll want to make use of some client-side MVC-style JavaScript library, like Angular for example. These make it trivial to wire everything up.

How to navigate?

Say I create an HTML file with two .page on it. In the first .page, I'd like to have a link to the second .page.
Is there a way to navigate between pages without having to write my own JS? This seems to suggest I do have to write JS: http://view.jquerymobile.com/1.3.2/dist/demos/widgets/navigation/.
However, I'd would rather set an id attribute for one of the pages, then maybe define some data attribute in the link to tell jQuery mobile where to go. Possible?
I'd also like to specify what kind of transition effect to use.
You can use standard anchor links, just give an id to your page and set the transition via the data attribute
Link to Page 2

Print web page with original look

I want to achieve print functionality such that user can print out the web form and use it as paper form for the same purpose. Of course I do not need all the web page header and footer to be printed, just content of a div which take most of the page. I did play around with media print css and menage print result to look almost as original page. But the I tried to print it in another browser(Chrome) and it is all messed. (before I tried Mozilla).
For the web form I user css framework Twitter Bootstrap and I had to override its css (in print media) for almost each element individually to get some normal look in the print result.
My question is is there some way (framework/plugin) to print just what you see on the page, maybe as an image or something?
Any other suggestions are welcome.
Thanks.
If you are familiar with PHP you can try the PHP class files of TCPDF or those of FPDF.
Or there is also dompdf which renders HTML to PDF, but this will include more than just the information of one div.
And for further info here is a post on Stack where users are discussing which they think is best.

load all "jquery mobile pages" within a html document fetched via ajax

Please let me know how to load all the "pages" in a html document into the current page dom.
I tried using $.mobile.loadPage, but only the first "page" of the document is loaded.
I want to load all the "pages" in that html document.
While googling for this i found two plugins ToddThomson/jQuery-Mobile-Subpage-Widget and a multiview plugin. But i could not find the basic "how to use" section for these two plugins.
Is there any links which shows how to use these plugins.
It can be done easily.
Lets say you have 2 html files. First one has a one jQM page and second html has two pages. Also lets say first html page is called test1.html and second one is called test2.html, test1.html is first page to open.
Only thing you need to do (to load every page from test2.html) is to add an attribute data-prefetch to a a tag link leading to the second page.
Here's an example:
<a href="test2.html" class="ui-btn-right" data-prefetch>Next</a>
If you wish, go to my profile and send me an email, and I will send you a working example.
Here you can find more about data prefetch in jQM: http://jquerymobile.com/test/docs/pages/page-cache.html
If you are changing your page with a changePage function you can still prefetch it with a :
pageContainerElement.page({ domCache: true });

RAILS: Tracking content with /#foo in the address bar

Just like in Gmail, I want to create a div which when loaded with ajax would output a #foo in the address bar to track what content would be loaded.
If you go to https://mail.google.com/mail/?shva=1#sent gmail, if signed in, will take you straight to your sent box.
I want to do the same. For example. I have a div that loads a list of recipes. Once a recipe on the list has been clicked content gets loaded from db in the same div and the address bar would say http://site.com/#recipe-permalink. If this link gets passed to a friend and the friend goes to http://site.com/#recipe-permalink the div would load appropriate content with that recipe.
Also is there a way to control more than one div? For example if url is http://site.com/#recipe-permalink#blue app would load recipe in one div and appropriate content in another div for #blue (what ever it may be).
Is there a way to make cells or apotomo have this functionality?
Are there any SEO concerns with doing this as well? Would the crawlers be able to pick up content through #foo links?
Probably not a full answer to your question but I believe this episode of railscasts would be interesting to you.
http://railscasts.com/episodes/246-ajax-history-state

Resources