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
Alberto Jesu
@albjerto
Hi @tidyui ! Is it still not possible to use a custom Vue component to render a BlockGroup in the manager?
Chris Jones
@GangsterGeek89

@spacecat

So to start with I used the Vue Developer tools which are a massive help if you haven't already got them installed they can be found Here

By default, the manager serializes the data within fields and blocks etc when being saved and restores the object from the stored JSON when they are loaded, from my understanding of it anyway, @tidyui may be able to correct me here if I've misunderstood it.

With this in mind, I know that whatever I use within a custom field class will be saved and restored through the manager without any intervention from myself.

After looking at the documentation for the VueQueryBuilder plugin I can see that the v-model only needs a blank object for the binding. So to start with I just created an empty object within the fields Vue script and then used the Vue developer tools to see what was being added to this object from the query builder component.

At this point, I had a few options to choose from

  • use a blank c# object for storing the query
  • Create a custom class with the relevant properties etc
  • Use a JObject

I went with the JObject mainly for preference and time as creating a custom class and ensuring it has all relevant properties etc could be time-consuming as there is little to no documentation on what the model could contain.

Hope this helps clarify it a little

spacecat
@spacecat
Thank you @GangsterGeek89 for the thorough explanation. CSS look OK now and the query persist after saving the page.
Chris Jones
@GangsterGeek89
@spacecat no problem glad to see you have it working :)
Ryan Jackson
@ryj12__twitter
Hi all, I'm trying to display some posts from my archive page on a standard page - what's the best way for me to do this, I'm not having much luck pulling the posts through!
jensbrak
@jensbrak
Hi @GangsterGeek89 , long time no see! All good?
And Hi @tidyui ! :)
Chris Jones
@GangsterGeek89
@jensbrak hey how are you? Yeah all good here just busy busy lol
@ryj12__twitter you have a few ways of going about it, depending what you are trying to achieve. Is it a particular post(‘s) you want to show?
magnuskarlssonhm
@magnuskarlssonhm
Hey! ImageSharp support webp since v2. "What's new since V1 #
Some major features!
WebP support - People have been after this for a while! We provide comprehensive support for decoding and encoding WebP images."
Any plans to implement this?
Noticed Piranha is on ImageSharp 1.0.4 at the moment.
PageSpeed insight no1 complaint is lack of webp images at the moment for our new site.
Håkan Edling
@tidyui
@magnuskarlssonhm Yes, add an issue for it at GitHub! As the ImageSharp processor is an independent package it’s also super easy to update just this package and use your own version of it until the next version of Piranha is released! https://github.com/PiranhaCMS/piranha.core/tree/master/core/Piranha.ImageSharp
1 reply
jensbrak
@jensbrak
@GangsterGeek89 - head up feet down, but not much more. However, combined with optimistic look forward I think I'll manage just fine.
spacecat
@spacecat

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;

magnuskarlssonhm
@magnuskarlssonhm
How does multi tenancy work in Azure App Services? In the documentation it defines howto with a host file. https://github.com/PiranhaCMS/piranha.core.docs/blob/master/src/08.%20Tutorials/03.%20How%20to%20use%20multitenancy.md
Håkan Edling
@tidyui
@magnuskarlssonhm In Azure you should be able to bind any number of domains to the same app service!
zedjr
@zedjr
@tidyui I am pulling my hair out trying to get piranha integrated into asp.net projects the way i want to integrate piranha. I chose piranha cause it fits the kind of projects i do. Small to medium sites for smaller businesses. I know i can't get the help on gitter i need and really need a tutor i can pay for a couple hr lessons to get me started. Is there anyone on here willing to do that that knows piranha relatively well.
Chris Jones
@GangsterGeek89
@zedjr what is it you're trying to achieve?
zedjr
@zedjr
@GangsterGeek89 haha, well. That is quite a confusing story in itself. Been messing around with piranha for a while now trying to better understand on how to use it in my projects. I started by using piranha.mvc template and then just add the stuff i want. I couldnt get that to work teh way i wanted to so then i tried adding piranha to an existing asp.net mvc project. Which i think is the way to go actually as the home page opens like i expect it and i can go to teh manager like expected. I really jsut am trying to get more use to piranha and am jsut hitting alto of frustrating road blocks. I erally need a tutor for a couple hours to walk me thru some things.
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);