N2CMS MVC - new page under Trash - asp.net-mvc

I am using N2 CMS (taken templates Dinamico MVC project). I created a new model "TextPage" and respective controller as well. I registered page with "TextPageRegistration" class. And I set parent type for this type as Start Page. But when I run the site, I see this page under Trash instead of under Start Page.
How can I solve it?

Those things only controls what types of pages can be created under what kind of pages (i.e. you can create a page of type "TextPage" as a child to pages of type "Start Page" in the structure.
If something is in the trashcan, it's there because you (or someone else) deleted the page.
Try moving it back, or create a new page?

Related

Changing page asset definiton

I am on Oracle WebCenter Sites 11gR1.
I have an asset page that is on the tree of a site.
The page requirements and presentation have changed, so a new definition is needed to hold the references to other assets (the original definition can not be changed since is used in other pages). The page to change its definition is linked/referenced from other assets/URLs, so it is not possible to replace it with a new page.
Is it possible to change the page definition? How can this be achieved?
When i edit the page, the definition field is only a link to the definition, but not an editable field.
Thank you
You cannot change the page definition of an existing page instance.
You can change the existing page definition, that is being used in your page instances.
Go to Admin Perspective > Search > Page Definition > Search by your Page Definition > Click on Edit (pencil) and make your changes (eg: add or remove attributes).
If you want to add new page attributes, you should create the page attributes before edit the page definition.

How do I add a new menu to an aspnetboilerplate based project?

This has been asked before but I'm going to be more precise with my question to hopefully get a better answer:
I have figured out how to add views to the PageNames class:
public const string WorkOrders = "WorkOrders";
and then to the projectNavigationProvider class to get them in to the navbar:
.AddItem(
new MenuItemDefinition(
PageNames.WorkOrders,
L("WorkOrders"),
url: "WorkOrders",
icon: "business",
requiredPermissionName: PermissionNames.Pages_WorkOrders
)
To get my main views added to the main navbar and working properly.
However, I have not figured out how to create a totally new menu to be used elsewhere. In the app I'm working on we have several pages that display all of the records in a particular table, Work Orders for example. But each record in each table should have several links to other pages for create, edit, details and delete.
One of my partners seems to have solved this problem on other pages by using modals and ajax calls to the controllers endpoints. It works fine for the Customers, which only require name and contact info., but I don't think a modal will work for creating, viewing or editing a Work Order becuse it requires adding line items and the associated data for each one of them etc... There's a lot to it. Lastly, it doesn't seem like the template is set up to be used that was as he wrote a lot of his own js to get it working.
Currently, the create, edit, and details views exist and I have links to them next to each record but I get errors when I try to use the link. Maybe I don't understand how the routing works? In the normal mvc template from VS the links have properties for specifying the controller and method and mvc handles the rest.
<a asp-action="Edit" asp-route-id="#item.WorkOrderID">Edit</a> |
<a asp-action="Details" asp-route-id="#item.WorkOrderID">Details</a> |
<a asp-action="Delete" asp-route-id="#item.WorkOrderID">Delete</a>
I'm getting the same error I had when trying to get the Work Orders page to load but had not added it to pagenames or navigationprovider, which makes me thing I just need to add the links to the navigationprovider class but I don't want a link the the WordOrders create page on the main menu, I want it on a mini menu next to the corresponding record. I have added the page to the pagenames class but am not sure how to create a separate menu for my main page.
public const string CreateWorkOrders = "CreateWorkOrders";
In reviewing the navigationprovider class I see:
context.Manager.MainMenu
and I'm thinking I must be able to create another menu and add items to it like this:
context.Manager.NewMenu.AddItem(....
but it looks like MainMenu is referenced in a class that I can't find or edit. Should I be creating another class defining the NewMenu so I would be able to configure it in the existing navigationprovider class or should I be creating a separate navigationprovider class for it?
Hopefully I've convinced everyone who looks at this that I have done plenty of research before reaching out for help. Even a link to some more detailed documentation would helpful.
You can add a new menu like this:
context.Manager.Menus.Add(WorkOrders, new MenuDefinition(WorkOrders, L(WorkOrders)));
Usage:
context.Manager.Menus[WorkOrders].AddItem(...)

Can't select page layout when creating a new page in Rails alchemy-cms

I'm new to alchemy-cms.
I created a fresh install from the guides. I did not add any concept or structure.
Going to localhost:3000 I have to add the first user and after that I have a clean site.
When trying to add a new page, I have to select a type (page-layout?) and type in a name.
The Type combobox remains empty, and therefore the website don't allow me to add a page. What am I doing wrong? I think I'm missing something very obvious here.
I have looked allready in the source code, and running the following:
rails console
Alchemy::PageLayout.all
and this results in:
=> [{"name"=>"index", "unique"=>true, "elements"=>["article"], "autogenerate"=>["article"]}]
So I would guess the combobox should be filled with this item.
The index page layout is marked as unique, so it can only be added once per language. And as the so called language root page (the first most page in your page tree) already has this page layout, no new page can be created using this page layout.
In order to fix your problem you need to add another page layout to your page_layouts.yml file. It is good practice to add an standard page layout that is not unique (default) and can therefore be added multiple times per language.

Change CSS style using drop down menu in MVC

I'm trying to make a drop down menu that has a bunch of items (Amelia, Cerulean, Cosmo, Cyborg, Flatly, Journal). Each of these items represent a css file.
When one of them is selected I want my website to take this selected css file and apply it to the website.
I would like the drop down menu to interact with jquery, meaning when a item is selected jquery takes over and makes a asyn/ajax call to some mvc actionresult.
By the way I'm using MVC 5.
I hope someone can help me sketch the initial groundwork.
I've implemented this in my application.
I'm not sure what to tell you though. It's easier when we have an attempted solution to fix.
Here's an overview of how mine works:
I have created a controller called SharedController. The purpose of it is to contain various actions that render common actions. All of the actions are considered ChildActionOnly.
My _Layout uses RenderAction to render the action NavbarPartial which is in my SharedController.
More importantly the Navbar partial then uses RenderAction to render the action ThemeListPartial. This action is responsible for getting a list of available themes. The list of available themes is determined at applications startup. I've created a ThemeFinder class and ThemeRepository class that are responsible for finding and storing themes. The ThemeFinder finds themes by expressions that you give it. In a new class called App_Start/ThemeConfig I've given it only one expression - "~/Content/themes/{name}.bootstrap.css". This will find all themes with that naming convention in that location.
My razor code will take the ViewModel and display a dropdown menu in the navbar.
To get the themes to change my dropdown menu contains an AJAX link to an action called SaveTheme in ThemeController. This action takes a theme name as a string and tries to save it in a cookie for the user.
If the theme is found and saved successfully, the action responds with a success message.
jQuery then changes the theme by finding the associated link attribute and changing the HREF contents to the new theme. It knows the new theme relative URL because I have it stored in data attributes.
I completed this before I made the switch to AngularJs. The one thing I plan to go back and change is to cut out as much (maybe all) jQuery as possible and replace it with better code.

ASP.NET, MVC, C# website pass a value though out the application

This is a bit of a puzzle for me.
I need to capture the URI Query string passed to the Home page.
As a user travels to different pages on the web site, I have a partial view that needs that URI query string.
I need a dynamicly created link in the partial view, that equals the original call to the home page.
Example -
If the user goes to - http://www.mysite.com?mode=Joe , I need the dynamicly created link to equal - Http://www.mysite.com?mode=Joe
If the user goes to - http://www.mysite.com?mode=Tommy , I need the dynamicly created link to equal - Http://www.mysite.com?mode=Tommy
FYI - The partial view is used in the _Layout.cshtml file. the call inside - _Layout.cshtml looks like this -
#Html.Partial("MyPartial")
Thanks!
There are a number of ways to do this, but probably the simplest would be to save it to the session on your home page, and then access that session variable from your partial.
You will need to decide what to do if the session expires.
Another possible way would be to write it to a cookie on the home page request and then access the request cookie in your partial. Again, you'd need to decide on an approach for cookies disabled, or wiped out during browsing.
Alternatively, you could look at something like the approach being used in the link below to set a language across the site. Exact implementation would differ, but concept is the same:
Howto automatically add a specific value from current route to all generated links?

Resources