Giter VIP home page Giter VIP logo

piranha.core.templates's People

Contributors

eloekset avatar filipmatsman avatar i-love-code avatar tidyui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

piranha.core.templates's Issues

Remove CMS Controllers from Swagger docs

If you call these apis

image
Piranha 8.3
the system crash becasue this error:
Eccezione generata: 'System.NullReferenceException' in System.Private.CoreLib.dll
Object reference not set to an instance of an object.

Incorrect reference to SetupController

Project templates has instructions to delete the ~\seed directory and the SeedController, but the controller is actually named SetupController.

Just fix the view to mention the controller by its correct name.

Webpack and NPM

Hi,
I started to work with templates. I suggest to switch them to Webpack and NPM instead of gulp, libman, etc.

The result is more clear in my opinion.

I changed my project using NPM and Webpack, releasing jQuery, Bootstrap, custom css, etc. and it's seems better that the current one. If can be useful I can share code (but I'm not a real expert with webpack).
I also created a FancyBox Image Block that is similar to Image Block but uses FancyBox, and it's more easy using NPM and Webpack to add it to the project.

anyway, thanks for the code

Create new blocks fail

Seems tapping + for new blocks does not do anything in 8.4.x Razor Template
Pages can be added but not blocks of existing ones

Stack trace:

      Connection id "0HM24SEFA3ORG", Request id "0HM24SEFA3ORG:00000003": An unhandled exception was thrown by the application.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Piranha.Runtime.AppDataList`2.GetByType(String typeName)
   at Piranha.Manager.Services.ContentTypeService.GetBlockTypes(String parentType)
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Piranha.AspNetCore.SitemapMiddleware.Invoke(HttpContext context, IApi api, IApplicationService service)
   at Piranha.AspNetCore.IntegratedMiddleware.Invoke(HttpContext context, IApi api, IApplicationService service)
   at Piranha.AspNetCore.Security.SecurityMiddleware.InvokeAsync(HttpContext ctx, IApplicationService service)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)```

Hero image 404 if file name contains space

Hi,

I have uploaded an image into the page hero that contains a space and that image returns a 404.

The filename is "Test 1024.jpeg"

This localhost page can’t be foundNo webpage was found for the web address:
http://localhost:50353/uploads/5b20ec7d-03d7-44ff-b3f3-d32ac1ee25e2-test

The same image load if used in image block. In image block the path is:

/uploads/5b20ec7d-03d7-44ff-b3f3-d32ac1ee25e2-test 1024.jpg

The code in the Hero image doesn't seem different then the Image block code.

Hero:
return $"style=background-image:url({Url.Content(Model.Hero.PrimaryImage)})";

Image block:
<img src="@Url.Content(Model.Body)">

Expected behavior:

  • sanitize filenames during upload or allow spaces in URL

dotnet new piranha flags not working

This is an FYI Ticket
I'm new to Piranha and wanted to check out the samples.
Went here: https://piranhacms.org/docs/master/basics/project-templates

Windows 10: dotnet new piranha.mvc --database SQLServer --storage FileStorage
Creates a project using SQLLite and Blob storage. I tried lowercasing them: -d sqlserver --database sqlserver no effect

I know I can change all the references in the project, but it would be nice if the examples just worked right out of the box. I'm just browsing so I ran it using SQLLite anyway.

Nowhere on the page does it list the default login for the maintenance page. Have to search for that now too so I can see the admin.

Add template parameters

Add parameters for creating a project with the suitable packages, like database and storage provider.

Add category to PostBlock

When the DisplayTemplate for the PostBlock renders a linked post it would be nice to render the selected Category.

launchSettings.json missing from Razor Pages and MVC templates - Breaks dotnet watch run

When you create a new default .NET Core Razor Pages web app using dotnet new webapp a launchSettings.json file is created automatically. This file facilitates the use of dotnet watch run which automatically opens up a new browser window with whatever is specified for applicationUrl in launchSettings.json.

If you do the same but using the Piranha CMS templates (e.g. dotnet new piranha.razor) instead no launchSettings.json is created:

Screenshot 2022-06-10 at 19 01 24

Work-around: Manually copy the launchSettings.json file from a new default .NET Core Razor Pages web app to your own app.

Paging runs over edge of screen on Page Archive

When there are a lot of entries in an archive, the pager runs off the edge of the screen on both sides. You can scroll to the right to get to the end of the pager but it won't allow you to scroll all the way to the left to get to the first set of pages. I'm attaching a screenshot below to illustrate (you can see the scrollbar can scroll right, but not left). I tested in Edge & FireFox.

image

My workaround currently is to increase the page size so that there are less pages.

Seeding Error for Piranha.Web Template Version 8.2

Clicking on the seed button on Start Page results in an error loading the website. The error is caused by the missing attribute (highlighted in bold letters) of the Hero property of class StartPage (StartPage.cs).

[Region(Display = RegionDisplayMode.Setting)]
public Hero Hero { get; set; }

Handling of unpublished blog posts in Archive.cshtml

Stumbled across the following lines, which I found misleading:
https://github.com/PiranhaCMS/piranha.core/blob/2cf3647caf7a0fdc4bd248051554fc4b6fe570f2/examples/RazorWeb/Pages/Archive.cshtml#L73-L78

Because to my understanding, the model
https://github.com/PiranhaCMS/piranha.core/blob/2cf3647caf7a0fdc4bd248051554fc4b6fe570f2/examples/RazorWeb/Pages/Archive.cshtml#L2
does not include posts with PostInfo.Published == false. (And if it would, the post shouldn't be shown at all?)

To resume: Isn't the if statement above redundant, and to be removed for more clarity?

Null reference exception in blog.razor when following links of categories and tags

I've only tried this using dotnet/publish and using debug in VS on Mac, but both fail the same way.

Steps to reproduce:

  1. Get published piranha templates
  2. Create a new project using the razor version of the blog template
  3. Restore, build and run
  4. Use seed or create blog and a blog post with categories and tags
  5. Try click a link of a category or tag

NullReferenceException: Object reference not set to an instance of an object. Piranha.Services.PostService.GetCategoryByIdAsync(Guid id) Piranha.Services.ArchiveService.GetByIdAsync<T>(Guid archiveId, Nullable<int> currentPage, Nullable<Guid> categoryId, Nullable<Guid> tagId, Nullable<int> year, Nullable<int> month, Nullable<int> pageSize) RazorBlog.Pages.ArchiveModel.OnGet(Guid id, Nullable<int> year, Nullable<int> month, Nullable<int> page, Nullable<Guid> category, Nullable<Guid> tag) in Archive.cshtml.cs + Data.Archive = await _api.Archives.GetByIdAsync(id, page, category, tag, year, month);
Or am I missing something here (quite possible, new to using Piranha and dotnet core)? I can provide more details if needed.

Meta data

For the Razor based templates I needed to change

@if (Model is Piranha.Models.IMeta) {
        <partial name="Partial/_Meta.cshtml" />
    }

to

 @if (Model.Data is Piranha.Models.IMeta)
 {
     <partial name="Partial/_Meta.cshtml" model="Model.Data" />
 }

to get the meta data in the header

Improve project templates?

Since it's almost 2020 I thought it would be a good time do improve and do some redesign of the project templates. Please leave feedback on:

  • What you would like to be included in a good template
  • What different types of templates you would like to see

New CMS Instance: Site information Null exception

If you create a new project from the template piranha.blog.razor and do not seed it, there is no "Information" tab added to the editor for you to configure site logo and other site details.

  • Non-Seeded Site Editor:
    image

  • Seeded Site Editor
    image

This results in a null exception on the default layout template:
image

I suggest moving the migration portion of the site information fields into the main migration as opposed to the seeding portion otherwise the default template has this issue.

Teaser Page - video Hero (Enhancement)

Change the "Hero" table to allow Primary Media (instead of Primary Image).

The current code base (28th March) has video support added.

In the "+" Primary Image section of the Hero tab, you can select a video to upload, but only images are displayed.

The ability to add a hero/background video would be a nice enhancement.

Assuming a couple of tweaks are required.

  • Allow "Select Media" dialog to display videos
  • Modify video to allow "video" tag

Add authentication to web templates

To showcase the new simplified security features, add to the templates:

  • Custom group for web users
  • Page for authenticated users
  • Login page

Add validation (where applicable) of fields to prevent unhandled exception

Add some basic input validation to the templates. Would not only prevent Piranha from crashing if invalid input is made but also provide a good example of how to do it.

For instance, an invalid e-mail address of a comment will cause an exception that will crash the application. I assume this is the proper behavior of Piranha.Core but it would be both pedagogical and better if application/templates won't crash upon quite normal 'misbehavior' of a site visitor.

Steps to reproduce the exception:

  1. Create a new project from Razor Template
  2. Run the project and enter an invalid (ie 'ThisIsAnInvalidEmailAdress') e-mail address on any comment and submit it

Output of application:

fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
      An unhandled exception has occurred while executing the request.
System.ComponentModel.DataAnnotations.ValidationException: The Email field is not a valid e-mail address.
   at System.ComponentModel.DataAnnotations.Validator.ValidationError.ThrowValidationException()
   at System.ComponentModel.DataAnnotations.Validator.ValidateObject(Object instance, ValidationContext validationContext, Boolean validateAllProperties)
   at Piranha.Services.PostService.SaveCommentAsync(Guid postId, Comment model, Boolean verify)
   at Piranha.AspNetCore.Models.SinglePostWithComments`1.OnPostSaveComment(Guid id, Boolean draft)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Convert[T](Object taskAsObject)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync()
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync()
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Piranha.AspNetCore.SitemapMiddleware.Invoke(HttpContext context, IApi api, IApplicationService service)
   at Piranha.AspNetCore.IntegratedMiddleware.Invoke(HttpContext context, IApi api, IApplicationService service)
   at Piranha.AspNetCore.Security.SecurityMiddleware.InvokeAsync(HttpContext ctx, IApplicationService service)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.