Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 05 09:18
    tidyui closed #1902
  • Dec 05 09:18
    tidyui closed #1966
  • Dec 05 09:17
    tidyui milestoned #1902
  • Dec 05 07:11
    dnfadmin commented #1966
  • Dec 05 07:03
    dnfadmin commented #1966
  • Dec 05 07:03
    mbaneryd opened #1966
  • Nov 25 10:38
    joymon-jacob opened #1965
  • Nov 25 08:41
    hadrian625 edited #1964
  • Nov 25 08:40
    hadrian625 edited #1964
  • Nov 25 08:39
    hadrian625 edited #1964
  • Nov 25 08:39
    hadrian625 edited #1964
  • Nov 25 08:38
    hadrian625 edited #1964
  • Nov 25 08:37
    hadrian625 edited #1964
  • Nov 25 08:37
    hadrian625 opened #1964
  • Nov 23 07:55
    tidyui closed #1963
  • Nov 23 07:54
    tidyui opened #1963
  • Nov 23 07:54
    tidyui closed #1955
  • Nov 22 07:10
    mbaneryd commented #1902
  • Nov 18 16:17
    mrccarvalho opened #1962
  • Nov 16 09:23
    tidyui closed #1961
Chris Jones
@GangsterGeek89
@zedjr To be honest with you, I always start a project from the provided templates and then modify it as needed. This gives you an option on the first run to seed some example data, giving you an excellent basis to start from. I also have a copy of the source code downloaded that I have open to refer to when I am trying to figure out how things work. Unfortunately, I don't have a lot of free time but depending on the time difference between us I may be able to arrange an hour or so next weekend if you're still struggling.
zedjr
@zedjr
@GangsterGeek89 sure, how much would u charge?
@GangsterGeek89 The problem with using piranhas template and then going form tehre is i can't figure out how to just get the website to open from layout/home page. I only want to use the tinycme manager for clients to manipulate blocks, regions, fields nad media. I really have no need for the upper stuff like pages and sites.
zedjr
@zedjr
@GangsterGeek89 It always goes to the setup page first using the piranha template. I am now trying to figure out why.
Chris Jones
@GangsterGeek89
@zedjr I wouldn't charge but if you find the help useful you could make a donation to the guys working hard building piranha. I will say though I never really use piranha without the content types such as pages.
When it comes to the setup page, I believe that the routing middleware within piranha looks for registered routes and when non are present it then directs to routes within your Asp.net project such as ~/ which would default to the first index.cshtml it finds which does not have a set route, when using the piranha razor template this would be Views/Setup/Index.cshtml. @tidyui may be able to clear this part up though if I've overlooked something or misunderstood it
maetiskou
@maetiskou

Hello guys, i am looking forward to start using Piranha CMS but i am struggling with basics. Could one of you please help me with this issue? I´ve created new project from template and also created new empty module from template. I´ve tried to implement that module into my site like this:

using Microsoft.EntityFrameworkCore;
using Piranha;
using Piranha.AttributeBuilder;
using Piranha.AspNetCore.Identity.SQLServer;
using Piranha.Data.EF.SQLServer;
using Piranha.Manager.Editor;

var builder = WebApplication.CreateBuilder(args);

builder.AddPiranha(options =>
{
    /**
     * This will enable automatic reload of .cshtml
     * without restarting the application. However since
     * this adds a slight overhead it should not be
     * enabled in production.
     */
    options.AddRazorRuntimeCompilation = true;

    options.UseCms();
    options.UseManager();

    options.UseFileStorage(naming: Piranha.Local.FileStorageNaming.UniqueFolderNames);
    options.UseImageSharp();
    options.UseTinyMCE();
    options.UseMemoryCache();

    options.UseReservationModule();

    var connectionString = builder.Configuration.GetConnectionString("piranha");
    options.UseEF<SQLServerDb>(db => db.UseSqlServer(connectionString));
    options.UseIdentityWithSeed<IdentitySQLServerDb>(db => db.UseSqlServer(connectionString));

    /**
     * Here you can configure the different permissions
     * that you want to use for securing content in the
     * application.
    options.UseSecurity(o =>
    {
        o.UsePermission("WebUser", "Web User");
    });
     */

    /**
     * Here you can specify the login url for the front end
     * application. This does not affect the login url of
     * the manager interface.
    options.LoginUrl = "login";
     */
});

var app = builder.Build();

if (app.Environment.IsDevelopment())
{
    app.UseDeveloperExceptionPage();
}

app.UsePiranha(options =>
{
    // Initialize Piranha
    App.Init(options.Api);

    // Build content types
    new ContentTypeBuilder(options.Api)
        .AddAssembly(typeof(Program).Assembly)
        .Build()
        .DeleteOrphans();

    // Configure Tiny MCE
    EditorConfig.FromFile("editorconfig.json");

    options.UseManager();
    options.UseTinyMCE();
    options.UseIdentity();
});

app.Run();

line 28 to be exact. I´m able to see module in the manager under Modules tab. But there is this inside Module´s Init() function:

// Add manager menu items
            Menu.Items.Add(new MenuItem
            {
                InternalId = "ReservationModule",
                Name = "ReservationModule",
                Css = "fas fa-box"
            });
            Menu.Items["ReservationModule"].Items.Add(new MenuItem
            {
                InternalId = "ReservationModuleStart",
                Name = "Module Start",
                Route = "~/manager/reservationmodule",
                Policy = Permissions.ReservationModule,
                Css = "fas fa-box"
            });

But there are no new Menu items in the manager.

I´ll be more than happy to provide any more info. Thanks in advance for any help. :)

Chris Jones
@GangsterGeek89
@maetiskou just as a quick check have you logged the user out and back in again since registering the module? if not i believe this needs to be done to refresh the claims on the user
maetiskou
@maetiskou
@GangsterGeek89 Oh.. that was exactly it. Thank you very much.
Chris Jones
@GangsterGeek89
@maetiskou no problem buddy done it myself a few times lol
zedjr
@zedjr
@GangsterGeek89 Of course i can send a donation to them. I spent alot of time looking for the right cms to use. I went thru orchard, dotnetnuke, umbraco and a couple otehrs. Carefully studying waht would be best for my companies future in providing a cms to clients. I have never used a cms before so things were confusing at first and still are. I would hate for piranha to go under cause of lack of funding or interest. I just can't wait to understand piranha alto better so i can start pumping out piranha led sites. I wish i could pay for some weekend convention or something.
@GangsterGeek89 on the issue it going directly to setup.index page i am tracking down. It has been a year since i ahve used asp.net core mvc also, so some things like protocols i am rusty on.
magnuskarlssonhm
@magnuskarlssonhm
@tidyui Awsome, Thanks!
Håkan Edling
@tidyui
@zedjr_gitlab When you use the templates you get a SetupController which captures all requests to / and sends it to the setup page
@zedjr_gitlab Also, if you don’t want piranha to handle routes to the root of the application you need to disable startpage routing https://piranhacms.org/docs/master/basics/startup-options
maetiskou
@maetiskou
image.png
Hi guys.. could someone please explain to me how could it be that i cant see HTML Block here?
I'm using basically unmodified CMS Template site..
Håkan Edling
@tidyui
@maetiskou If you mean the Tiny MCE WYSIWYG editor it’s called “content” in the block list.
maetiskou
@maetiskou
@tidyui Ehm. i didn't get that.. Could you explain it a little more broadly please?
is it something i must specify in editorconfig.json or?
Håkan Edling
@tidyui
The HTML block is the one named “Content” in the screenshot you posted
maetiskou
@maetiskou

Oh. Sorry, you are right. My bad.. It's just that when using "Content" block then this text:

<div class="test">

Lorem Ipsum dolor sit amet

</div>

gets saved into DB like this:

<p>&lt;div class="test"&gt;</p>
<p>Lorem Ipsum dolor sit amet</p>
<p>&lt;/div&gt;</p>

I'll look more into this..

spacecat
@spacecat

Just bumping up my question. If anyone has done this before and would like to share how it would be really appreciated.

I've created a custom field. From within InitManager(), how can I get SiteId?

In a MVC controller I can get it like this:

public async Task<IActionResult> CategoryPage(Guid id, bool draft = false)
        {
                var categoryPage = await _loader.GetPageAsync<CategoryPage>(id, HttpContext.User, draft);
var siteId = categoryPage.SiteId;
Chris Jones
@GangsterGeek89
image.png
@spacecat If you want to get the default site id you could do something like this
But this probably wouldn't be an ideal solution if you had multiple sites. I think you may be able to set the site id for the request in the Vue component, not sure of another way you can do it through the InitManager() method though. What is it you're trying to achieve with the field?
spacecat
@spacecat
Thanks @GangsterGeek89 . We have multiple sites. The site id is needed for querying Azure Search index. So it must be unique for each site. From InitManager we need to do the following: var filterContext = await service.FilterProductsAsync(new FilterContext { SiteId = Guid.Parse("34570101-231c-4245-8a61-eb23a1561abc") }); From your example it looks like we're getting the site id for the default site? Do you have an example for how to set it in the Vue component?
Chris Jones
@GangsterGeek89
@spacecat I dont have a project setup with multiple sites I can test it works with but you should be able to grab the site id with something like this
var sId = this.$root.$data.siteId;
console.log("Site Id:" + sId);
Chris Jones
@GangsterGeek89
@spacecat just managed to have a quick test with a multitenancy setup and seems this will get you the site id for the page/post the field belongs too
Håkan Edling
@tidyui
@spacecat As you can’t inject the full page/post model into the field Init events have you tried the hooks for loading/saving models. In OnLoad you have access to the entire model. https://piranhacms.org/docs/master/application/hooks
Chris Jones
@GangsterGeek89
@tidyui I have defined a 'ContentGroup' and a 'content type' to go in that group. I can get blocks to work in the content type but can't figure out if there is a way to restrict which blocks can be used. Is there a way of doing it?
i tried doing it the same way as a block-group but didn't seem to work
spacecat
@spacecat
@tidyui are you referring to App.Hooks.Pages.RegisterOnLoad((page) => { ... });?
Håkan Edling
@tidyui
@spacecat Yes!
spacecat
@spacecat

Hi, is it possible to use System.Text.Json instead of Newtonsoft.Json for my Query property for my Vue Query Builder custom field?

It works when using Newtonsoft.Json.Linq.JObject but not when I try with System.Text.Json.Nodes.JsonObject or any of the other System.Text.Json apis. Any ideas?

[FieldType(Name = "Vue Query Builder Field", Component = "vue-query-builder-field")]
public class VueQueryBuilderField : IField
{
    public IList<VueQueryBuilderRule> Rules { get; set; }
    public JObject Query { get; set; } = new JObject(); // Works
    // public JsonObject Query { get; set; } = new JsonObject(); // Does not work

    public string GetTitle()
    {
        return "Vue Query Builder Field";
    }

    public async Task InitManager(.........
Håkan Edling
@tidyui
@spacecat Piranha configures the application to use Newtonsoft as the manager is dependent on certain features that are not available in System.Text.JSON
spacecat
@spacecat
Thanks @tidyui . So I guess it's best to stick with Newtonsoft then when adding/extending functionality in /manager?
Håkan Edling
@tidyui
@spacecat Yes! If would manage to exchange Newtonsoft in your application you would most likely end up breaking the entire manager interface!
spacecat
@spacecat
@tidyui OK! Thanks!
tashe
@tashe

I'm looking at scheduling a page publish in v10. I can't find much documentation about how it's implemented. I did some tests and looks like you can schedule a new page to be published at a future date by changing the Published data for the page to be in the future.

But when it comes to an already existing page and scheduling a change in the same way, the change is saved as a draft but it's never published even when the Published date becomes current.

Are my observations correct and is this by design?

Furkan Tokmak
@FurkanTokmak
Hi. I am making a web app that has SEO. I am currently using piranhaCMS for my content and I use razor pages for rendering. I want to use frontend frameworks with server side rendering In my future projects. And I think that means I need to get my data through piranhaWebApi ? Is this possible? Does that makes sense ? I am fairly new and I am not sure if my question makes sense but I would be glad if someone can clarify thanks!
admzvk
@admzvk
Hello, I would like to create tiniest possible ECommerce module for Piranha. Is there any tutorial, or doccumentation which will help me how to do it? I am now studying piranha source code, but it is quite slow approach and i am not sure, if my approaches are right. If there is not such a thing, would you find it useful if I will write something like that during my developement?
Håkan Edling
@tidyui
@admzvk There are so many approaches to doing what you’re talking about. Are you planning on using the built in content models or are you adding your own database structure and management pages for it? There’s also the possibility to integrate Piranha with one of the existing platforms for .NET Core, for example NopCommerce if you need a fully fledged commerce system
spacecat
@spacecat
@tidyui can you explain what the "Languages" dialog does and what it's used for? And what the "Default" setting does when setting it for one of the languages in the "Languages" list? (The same dialog)
Håkan Edling
@tidyui
@spacecat Piranha doesn't support multiple languages in the sense that a page or post can be in only one language, but it supports language in the sense that you can create multiple sites and create different languages with different culture settings that you assign to them. If you then create generic content types (i.e. Content<T>) these can be translated as the purpose with these content objects is that they should be reusable between different sites (which could use different languages).
tobylo
@tobylo:matrix.org
[m]

@tidyui: trying to add a DataSelectField to a block and was wondering if there's any way in the static GetList method to get a hold of the current context where the field is being used?

E.g. when adding a block, containing a DataSelectField, to a page, I'd like to get a hold of properties on that page to filter on the possible values fetched.

Håkan Edling
@tidyui
@tobylo client-side in the manager UI or server-side?
tobylo
@tobylo:matrix.org
[m]
server-side when GetList is being called on the DataSelectField<T> type
Håkan Edling
@tidyui
@tobylo:matrix.org The init mechanism doesn't know the model context when performing initialization on field level. I think you should add an issue/feature request for it at the GitHub repo. Just remember that even if this support existed, the first time the model was initialized (for a new model) all property values would be empty on the model and no filtering could be applied anyway. As the functionality would be server-side the filtering wouldn't take affect until the model was saved and reloaded into the UI.