Extending the Blog Extension

  • Hi Guys,


    I want to extend slightly the Pagekit Blog Extension to be some more GDPR compliant. Well long story short, i have created a branch and started as total noob to extend it and failed hard, tried again and again still failing but making progress. I'm sure it is only a small thing to get this working as i have already configureable Object in the Backend and when i look into vue devtool i can see that the object is configured and set to true but i still can't get it visible in the frontend. Simple checkbox with some text on the right side like: I agree to the terms. Probably someone has some time to watch into it and give me a small hint where i should look closer next to make some more progress?


    https://github.com/Fosphatic/extension-blog/tree/gdpr-branch


    I see in vue dev tools data -> config: Object -> requiregdpr: true and showGdpr: true so logicaly the object should be rendered right? Sorry in advance for bothering you guys and thanks in advance for any hints. :)

  • It's hard to see without testing it myself. But did you clear your cache, server and client side. Or just try a "hard" reload with Ctrl+F5?

    Just a tip, as I already was wondering why changes did not apply, then I found out, that vue templates are cached, even in debug mode.

    The LORD is my strength and my shield; in him my heart trusts, and I am helped; my heart exults, and with my song I give thanks to him. Psalm 28,7

  • It's hard to see without testing it myself. But did you clear your cache, server and client side. Or just try a "hard" reload with Ctrl+F5?

    Just a tip, as I already was wondering why changes did not apply, then I found out, that vue templates are cached, even in debug mode.

    Well i guess this time it was a layer 8 problem, it sits generally 30 centimeters infront of a monitor. :)


    Big thanks to yns.wtf he opened my eyes as it was working with simple code that i tried similiar way before at his screen directly. Well i should have known better that if a template override happens due using not the default one template, then it was not possible that this Checkbox was shown before. Now is the question how to make this little extension more comfortable to work with any template and of course configureable form extension settings menu to enable or disable it. :)

  • SAB & yns.wtf


    Well now the first test release is done and is configureable from the settings menu of the blog extension. Is there any possibility to override an element somehow that i will be shown in on top following templates? Those bring often their own blog extension comments.php with them and do hide the changes yns.wtf and me made on the original blog extension.


    Those are pretty small actually in the comments.php:



    In the settings.php:


    Code
    1. <p class="uk-form-controls-condensed">
    2.     <label><input type="checkbox" v-model="config.posts.term_enabled"> {{ 'Enable Require Term Agreement' | trans }}</label>
    3. </p>


    Reply seciton in the comments.js:


    Last but not least the one liner in the SiteController.php:


    Code
    1. 'requireterm' => $this->blog->config('posts.term_enabled'),

    Well over all it was a nice progress even not the easy one till now but a good learn effect that'S for sure.


    However i don't think i can manage to get if possible this override done by myself that's why i'm asking you guys as you have already way more experience in coding for pagekit. I would like to ask Roman too, but unfortinately he is way too busy actually somehow. Many thanks in advance for any hints and tips as usual.

  • SPQRInc Why you is busy? :D I want to help Fosphatic Duke but I'm can speak english too bad. I'm not understand :D


    Fosphatic Duke In short, if you can write what you want easily, I can understand.

    Hello guys, my name is Yunus and I'm a backend developer. If you have a problem just drop me a message, but unfortinately I can't understand everything as I'm using google translator and many things gets lost in translation. So there is a language barrier and I'm sorry about this. Be patient and we will find a solution for sure. Thank you in advance.

  • yns.wtf


    That it works with other templates then pagekit one!

    Hımmm. Do you want to extension?

    Hello guys, my name is Yunus and I'm a backend developer. If you have a problem just drop me a message, but unfortinately I can't understand everything as I'm using google translator and many things gets lost in translation. So there is a language barrier and I'm sorry about this. Be patient and we will find a solution for sure. Thank you in advance.

  • Hımmm. Do you want to extension?

    The default template of pagekit is called one, there the changes we both made are working fine. When I switch on an another template like cards or aurora then the changes we both made are not working. It is because those templates bring their own comments.php.

  • Take a look at the comment.js and try to figure out how to append the html when and where needed. That's just a tip, I don't have time right now.


    Or you just do an http prompt (uikit offers such a function) and ask like this for the term agreement, that wouldn't need any html.

    The LORD is my strength and my shield; in him my heart trusts, and I am helped; my heart exults, and with my song I give thanks to him. Psalm 28,7

  • I meant that one: https://getuikit.com/v2/docs/modal.html#native-dialogs


    Probably, you can do it like this:

    OR (more complicated, but should also work)


    Code: comment.js
    1. this.replyForm = new this.$options.components['reply']({
    2. data: {config: this.config, parent: parent.comment && parent.comment.id || 0},
    3. parent: parent
    4. }).$mount().$appendTo(parent.$els.reply);

    Here the reply form is appended to the comment. Now, you can edit the reply comment (which is a child component, line 120), so it uses a custom template, which again uses the given original template. You just add a new "template-layer" in between, where you put your stuff.

    The LORD is my strength and my shield; in him my heart trusts, and I am helped; my heart exults, and with my song I give thanks to him. Psalm 28,7

  • Thanks SAB, tried that but it is actually too much i guess for a beginner like me. I have to try code simpler things first. At Line 120 itz starts for me with:


    I guess you mean the line 164 where it starts with:


    But how to put a between layer for a template there is deffo too much actually. But thanks anyway i will try simpler things and edit the templates comments php with the additional part of the code already works with the one template then come back to it when few more bulps were on in my brain. :)