Piranha.core: Lots of Questions (When you've got time)

Created on 9 Oct 2018  路  6Comments  路  Source: PiranhaCMS/piranha.core

Hello! @tidyui

Important 馃挴

Appreciated

  • Firstly, I just wanted to thank you for the fast response last time (hyperlink buttons). Not that I am abusing this, but I have some questions because I am not really sure how to work out specific things that I am trying to do.

Documentation

  • Before submitting this issue, I have looked at other issues (open&closed) and did see some useful information, which is not included in the documentation though. Why is that? Not that I am judging you, but until today, I thought the only source of information for Piranha could be found at the Wiki of this repository.

_[The following are connected]_

  1. Migration Error
    Trying to use MySQL (or any other database) returns some kind of migration error. I saw a similar issue, but it did not help me.

  2. New Database
    I need to add a NoSQL database to my project. I should probably add it in the Startup.cs file, but then should I create new controller or model for it?

  3. HTTP Post/Forms/File submission/Ajax
    I need to make an HTTP Post to a database. As I already said, I am using the jQuery plugin for validation, then reCAPTCHA, after which the form is being submitted. That's the part I just cannot figure out. I have watched many tutorials about MVC and ASP.NET, read Microsoft's API, but still not able to make it work.
    2018-10-09 17_48_16-window
    This is what I've got at the moment. It submits the data, then it shows it as text on a blank page (just to test it). I can use string for name, email and etc. but what do I use for submitting a file? Should I open a FileStream, use Web Client or? I have been trough your files, but the way you do it (asp-for) does not cover my needs. Any help on this? Will be grateful :)

Less Important

Manager Access

  • Since it is not included, I wondered how am I able to reach the (localhost)/manager site? Does it get it from Nuget?

Block Templates

  • Views/Shared/DisplayTemplates - What is it for and why is it in that place of the project when you have it on manager view?

External URL

  • Is there such a field (similar to HtmlField) but allowing you only to put an external URL?

Validation Scripts

  • Currently I am using jQuery Validation plugin for my forms, but I have noticed that there is this file _ValidationScriptsPartial.cshtml under the _Layout.cshtml and wondered if it could be of any use? Or is is only when you validate the fields through a separate model/controller?

Image Formats

  • I have manually added image formats. The .SVG one is being rendered as a document (which is fine), but I cannot get the dimensions? I don't know much about the vector graphics, just thought I should let you know that the Width/Height columns in the database were empty.

Not Found

  • Is there another way to have my own "Not found" (Status code: 404) page, except using web.config? Like including something in the Startup.cs?

GULP

  • I have to compile some .less and .js files, should I just add the path to every single one of them? You used it only for .scss (sass). I know this will increase the performance, but not sure how to do it.

License

  • I have noticed that on some files you have placed the following comment:
    2018-10-09 17_45_31-window
    Is it okay if I remove it? Or at least from my files? Not that familiar with the MIT conditions.

Unsafe Port

  • Tried to set the application port in launch settings to: 6000, but it is saying that is unsafe, do you know anything about that? How come you are able to use 5000 but not this one?

Potential Bug

  • BUG? Html.DisplayFor(m => m.Blocks) shows a text block/field as Piranha.Extend.Fields.TextField or it displays &nbsp.

Sorry for the long post :(

Thanks in advance again 馃憤

Best Regards,
Chris

question

All 6 comments

Hi there! For clarity it's better to add one issue per question instead of making a long one. Regarding the documentation we are rewriting it as we speak and when it's done it will be published to the official website. Also I will only answer questions that are actually related to Piranha since I don't have enough time to give general asp.net core support!

Migration error

In what part do you get an error. Which DbContext, which database and which version of the packages?

NoSql database

Can't give support on this, but generally you set everything up in Startup.cs.

HTTP Post

If you want to POST to your Piranha CMS page AND want it to pass through the routing you need to post it to the Permalink of the current page you're on and not the route of the controller. Also, your post action will need to load the Page Model if you want to display something for the user.

Manager Access

The manager is included in the project templates and is embedded in the package Piranha.Manager. You need to activate it in your Startup.cs. For reference, create a new project from one of the templates and examine the startup code.

Block Templates

I'm not quite sure I understood this question correctly, so please clarify.

These are the templates that eventually gets called by @Html.DisplayFor(m => m.Blocks)

External URL Block

No, but your can create your own blocks and register. This will be better covered in the new documentation.

jQuery validation

No part of Piranha uses jQuery validation at the moment so I can't give support on the matter.

SVG Images

Calculating dimensions, resizing and cropping is handled by the external package SixLabors.ImageSharp. I'm not sure they handle .svg correctly.

404 Pages

Can't give support on this.

GULP

Can't give support on this.

License

Generally you should not remove license or copyright, but you can remove it from the template files in the project templates you got when you ran dotnet new. I will remove them from these projects piranha.core.basicweb & piranha.core.blog. If you are running against source code you should not remove license & copyright from the core libraries.

Unsafe port

Can't give support on this.

Missing view for TextBlock

There must be a view missing from the DisplayTemplates directory you mentioned earlier. I'll take a look at the project templates before releasing 5.2.

Best regards

H氓kan

I too got an error while the migrations were running on my MySQL database. The error occurs (at least for me) at this line.

The problem seems to be that normal quotes (") aren't valid in the MySQL dialect in its default configuration (it uses backticks (`) for this purpose instead), unless you enable the ANSI_QUOTES sql mode in the mysqld.cnf file.

More info about ANSI_QUOTES.

Thank you again! I will know for future posts now :)

Migration error

  • The current packages in piranha.core and UseMySQL/SQLServer

For the manager access, I did not say I don't have it. Just wondered how it gets it (Startup). You kinda answered all my questions and I understand for the ones that you can't give support, no worries.

Block Templates

  • Well, I have this folder in my project. I use only regions, so my thought is do I really need it after all?

License

  • I have not included the license comment on my own pages/models, but also I did not touch any source code comments of the type.

Missing view for TextBlock

  • I think the view was not missing (could be wrong), maybe it is the way it is rendered. You could be calling only the field name, not the actual value

Cheers,
Chris :)

Thanks @PaddySe, I found an issue relating to this that got closed and didn't get reopened (#375). The initial migration broke for Postgres, so I got a PR with a fix for it, unfortunately the fix obviously broke it for MySql :)

I'll see if I can rewrite the migration in some other way because I refuse to have different sets of migrations for different databases, it's too much to maintain and I just don't have the environments to test it properly!

Hi again @aneff-official!

Migration error

I can see from @PaddySe comment and #375 that you can get a migration error on MySql, however SqlServer seem highly unlikely since the migrations were created for it and we use it on SQLite & SqlServer almost every day. What version of SqlServer are you running?

Block Templates

If you only use regions you can remove these .cshtml views from your project.

Missing TextBlock

If you've used the template dotnet new piranha I can see there's an issue in that repo (https://github.com/PiranhaCMS/piranha.core.basicweb/issues/6) that the DisplayTemplate is missing. We'll try to fix it for 5.2

Regards

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stefanolsenn picture stefanolsenn  路  4Comments

tidyui picture tidyui  路  6Comments

stefanolsenn picture stefanolsenn  路  3Comments

baibhavs picture baibhavs  路  3Comments

peppelorum picture peppelorum  路  3Comments