Blazor Server App, Razor View is open in blank page instead like Weather forecast example - razor-pages

I'm suffering since weeks to solve the problem. I know that I miss something, but I don't know what. Seeing other examples, it just works for them.
I created a new "Blazor Server App". And a StudentsController.
[ActionName("Index")]
public IActionResult Index()
{
return View(GetStudents());
}
Clicking "Add View" in the Controller, I've created a new Scaffolded Item "Razor View". This will create Index.cshtml in "/Views/Students"
In Startup.cs I've added:
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Students}/{action=Index}");
And in NavMenu.razor I added it to the menu:
<li class="nav-item px-3">
<NavLink class="nav-link" href="/Students">
<span class="oi oi-list-rich" aria-hidden="true"></span> Students
</NavLink>
</li>
This is the result starting it:
Navigation etc. is gone, but should look similar to Weather forecast example:

Related

Empty Space element on WPBakery breaks on mobile

I have various empty space boxes on a page I am building and they work until on mobile view, only when the page is refreshed in mobile view though, not if one just resizes the window to tiny.
On desktop the html appears like this:
<div data-original-height="560" class="vc_empty_space" style="height: 560px;" 560px"="">
<span class="vc_empty_space_inner"></span></div>
Refreshed on mobile view:
<div data-original-height="560" class="vc_empty_space" style=""height:" 560px"="">
<span class="vc_empty_space_inner"></span></div>
Its the same on all my pages.
I used this as a quick fix if anyone has the same issue:
jQuery('.vc_empty_space').each(function() {
var heightspace = jQuery(this).attr('data-original-height');
jQuery(this).css('height', heightspace);
});

Get title of an HTML Widget in OrchardCMS

How do I get title of a HTML widget (in this case the "default" TripelFirst) in Orchard CMS? Newbie question, but I can't figure it out.
This is the code, I just can't figure out how to get the title into the "panel-heading" div.
#if (Model.TripelFirst != null || Model.TripelSecond != null || Model.TripelThird != null) {
<div class="row">
#if (Model.TripelFirst != null) {
<div class="col-md-4 panel panel-success" runat="server" id="TripelFirst">
<div class="panel-heading">#Model.TripelFirst.Title()</div>
<div class="panel-body">#Model.TripelFirst.Body</div>
</div>
}
#if (Model.TripelSecond != null) {
<div class="col-md-4 panel panel-success" runat="server" id="TripelSecond">#Display(Model.TripelSecond)</div>
}
#if (Model.TripelThird != null) {
<div class="col-md-4 panel panel-success" runat="server" id="TripelThird">#Display(Model.TripelThird)</div>
}
</div>
}
First, it seems you are confusing zone and widget. TripelFirst is a zone, not a widget (see "So what are zones really?" for a more in-depth explanation of what a zone is). A zone should be seen as a placeholder, a container to which the widgets will be added. Orchard has a rich composition model where many decoupled services participate in the rendering of the page. The zone itself knows almost nothing about what's inside of it, it will just delegate rendering to its contents (such as widgets) when time comes. As such, the zone will not provide the easiest way to get to the title of the widgets it contains.
By far the easiest way to customize the rendering in Orchard is to do it from the right place :D Case in point, in this case, you might want to override the specific template for the widget, or a template for its wrapper (all shapes in Orchard can have wrappers which are templates that render around the shape itself).
This may look a little intimidating at first, but Orchard provides a marvelous tool out of the box that makes it easy to discover the shape structure of the page. Enable the "shape tracing" feature from the designer tools module on your dev machine (never activate this in production of course), and you'll get a nice Firebug-like debugging panel on the bottom of the page, that you can use to explore the tree of shapes/templates, the model for each of them, etc.
Another concept that is essential to understand rendering in Orchard is the placement file, which primarily describes in what order shapes representing a content item should get rendered.
In the end, to control the rendering of the title of a widget that goes into the TripelFirst zone, find the what template you need to override in your theme using shape tracing, then modify the rendering in this template to be exactly what you need.
Here's an example of code that you can put in a content part template override (such as Parts.Title.cshtml), that first finds the content item for the current part, then gets to the Title part, and displays it as a link.
#{
Orchard.ContentManagement.ContentItem contentItem =
Model.ContentPart.ContentItem;
string title = Model.Title.ToString();
}
<h2>#Html.ItemDisplayLink(title, contentItem)</h2>
Using the Shape Tracing tool, it helped me understand the model structure. Now I'm not saying this is the way the Orchard team wants this done, but this is how I ended up solving the problem.
#if (Model.SideItems != null)
{
<div class="col-md-12"> </div>
var sideWidgetItems = ((IEnumerable<dynamic>)Model.SideItems.Items).Where(x => x.ContentItem.ContentType == "HtmlWidget");
if (sideWidgetItems.Any())
{
foreach (var item in sideWidgetItems)
{
<div class="col-md-12">
<div class="panel panel-success">
<div class="panel-heading">#Html.Raw(item.ContentItem.Content.Parts[3].Title)
</div>
<div class="panel-body">#Html.Raw(item.ContentItem.Content.Parts[1].Text)
</div>
</div>
</div>
}
}
}

MetisMenue does not collapse well on mobile view SB Admin 2

I use the "SB Admin 2" Theme for a project.
The integratet Metis Menu works very well on desktop, also on tablet.
But when I visit the page with my phone, the menu doesn't hide completely.
Only when I scroll the page.
You can visit https://blackrockdigital.github.io/startbootstrap-sb-admin-2/pages/index.html to test ist.
If you shrink the browser as far as its like a mobile screen, the menu does not hide.
I tried to do it on the bottom of my index.html file with $('#side-menu').metisMenu('collapse'); but it does not work. This is also defined in the sb-admin-2.js file. But it doenst work either.
Can you help me to get the menu hide completly, even on mobile devices?
Try downgrading the JQuery version to 2.1.3:
https://code.jquery.com/jquery-2.1.3.min.js
There are issues with metismenu with newer Jquery versions:
https://github.com/onokumus/metismenu/issues/128
You can do this with hiding it with css only
.navbar-top-links {
display: none
}
Or if you don't want to hide it always only on button click. Create a new button with these attributes before your current unordered list (ul)
<button type="button" class="collapse-2" data-toggle="collapse" href="#collapse2" aria-expanded="true">
And replace this code
<ul class="nav navbar-top-links navbar-right">
With this code
<ul class="nav navbar-top-links navbar-right navbar-expand-sm navbar-collapse panel-collapse collapse" id="collapse2">
I managed to get it working like this only you have to style the button and place it in the correct position.

How to link to an entry in a channel in expressionengine?

I have the following code
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
{exp:channel:entries channel="static" sort="asc" dynamic="off"}
<li>{title}</li>
{/exp:channel:entries}
</ul>
</div><!--/.nav-collapse -->
Which is looping through a channel I have for static pages on my website. Technically it is showing all the stuff it should do. This is the code it outputs:
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li>Small Builders</li>
</ul>
</div>
However, when I click the link it gives me a white page. I have the htaccess from the documentation set up. I'm new to ExpressionEngine. Am I missing something completely obvious? I just want to link the the entry I've created.
If you try to go to abc.com/index/small-builders does it work? (added index)
I don't know if you're hiding index in the url or not but that can cause it.
The way I fixed this was the enable the Pages plugin on ExpressionEngine. Where I'm using ExpressionEngine 3.0.5 the plugin isn't installed/activated by default like it is on EE2.
Once this was activated I was able to assign templates and url structure no problem.
guess your post would be better on the expressionengine.stackexchange.com site.
Post it there and i´ll have a look if i can explain this to you

Why isn't my list displaying in Orchard?

In Orchard 1.3.10 when I create a list it gets assigned a permalink such as /people. When I add a person to the list and go to /people the person does not display. I see
When I add a widget to display people the person displays.
Am I doing something wrong, or is this Orchard working as designed?
Using the shape tracing module I see this In my content zone:
<div class="zone zone-content"> <div class="content-control">
<div class="manage-actions">Edit</div>
<article class="content-item list">
<header>
</header>
</article>
</div>
</div>
Creating a new site fixed my issue.
On my debug site I'm able to work around the issue by changing my list sort order, but not on my real site.
I filed a bug here: http://orchard.codeplex.com/workitem/18421

Resources