Coder Social home page Coder Social logo

baumrock / rockfrontend Goto Github PK

View Code? Open in Web Editor NEW
33.0 33.0 6.0 4.13 MB

Take your ProcessWire Frontend Development to the Next Level ๐Ÿš€๐Ÿš€

License: MIT License

PHP 73.62% CSS 2.48% JavaScript 14.71% Less 5.36% Latte 3.72% Hack 0.11%

rockfrontend's Introduction

baumrock.github.io

Github Pages Repo

rockfrontend's People

Contributors

bernhardbaumrock avatar gebeer avatar gs-chofmann avatar jmartsch avatar webmanufaktur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

rockfrontend's Issues

Feature Idea: Include livereload code in error report pages

I don't know how easy this would be - but could the livereload JS be included in error report pages (inc tracy) when in debug mode?

This would allow a change to the code that fixes the error to cause the page to reload - if the change doesn't fix the error, or produces a different one, then the error page will be suitably regenerated anyway.

Alert message about missing Less module in the backend

After installing the module into a clean/new ProcessWire instance while using the blank profile (blank profile for RockFrontend) an alert message pops up telling me to install the Less module.

This alert would be fine in the frontend but in the backend (on each page load) is a bit off.

2022-08-10_21-40

Alfred CSS/JS even without Alfred enabled

The Alfred CSS and JS files were added to the source even though alfred($page) isn't used anymore anywhere.

This only happens when logged in (only superuser tested). Guest won't see anything from Alfred.

Could be a decision that was made but looks like an unwanted feature for now.

2022-08-11_00-19

did new version alter behavior or LESS files being parsed?

I have Rockfrontend 2.1.4 in a Processwire install and it seems to catch all the individual .less files in the /templates/sections folder automatically with this declaration in _main.php

$rockfrontend
	->styles()->setOptions(['autoload'=>true])
	->add("/site/templates/uikit-3.15.10/src/less/uikit.theme.less")
	->add("/site/templates/styles/custom.less")
	;

I have another Processwire site with Rockfrontend 2.12 and it doesn't catch any .less files unless I add with the addAll method.

$rockfrontend
	->styles()->setOptions(['autoload'=>true])
	->add("/site/templates/uikit-3.15.20/src/less/uikit.theme.less")
	->addAll("/site/templates/sections")
	->add("/site/templates/styles/custom.less")
	;

How come it works in the first example but only with addAll in newer version ?
Thanks

Intermittent live reload issues

@BernhardBaumrock Hi Bernhard. Not sure if this is actually an issue or not, but I'm seeing intermittent issues with livereloads on the front end. Seems to be correlated with these notices in the console...

image

I will keep an eye out for more occurances and investigate further - but I'm starting to wonder if this is related to not being logged in to the admin interface at the same time as seeing these in the front end.

.editorconfig or similar

Could you please add an .editorconfig file or something to define code formatting.
Otherwise submitting code changes could in a total reformatting-whitespace-disaster.

Ajax endpoints serving json as text/html, not application/json.

If you make a non-ajax call to an ajax endpoint as a guest user (so the helpful debug view is off) then the json that is returned has the Content-Type header set to text/html - which is incorrect as it's a json string.

However, if these are ajax endpoints, and the superuser debug display doesn't kick in, then would it be better to reply with a 403 or 404 status code? Anyway, the correct content type should be used here regardless of this decision, which devs may want some control over.

If the json has embedded html strings, then there can be issues. For example: create a file in ajax/foo.php and put the following in it:

<?php
return [
    '<h1>baz</h1>',
];

Make sure you are logged out (or use an incognito tab) and visit your site's ajax/foo endpoint in a browser.

possible to specify more than one template in the renderIf method?

Hi,

Looking to see if I can specify more than a single template in renderIf method:
<?= $rockfrontend->renderIf("sections/includes/related-items.latte", "template=template1") ?>

would you simply rewrite the template declaration?

<?= $rockfrontend->renderIf("sections/includes/related-items.latte", "template=template1, template=template2") ?>

Thanks,

Alfred ignores field overrides when called from repeater matrix template

Hi Bernhard,

  • I have an image field named image_content_half. Let's say I have filled its note field with value "Foo".
  • I have a Repeater Matrix type text_image which is using this image field. From the fields list for text_image I have overriden the notes of the image_content_half field to "Bar".
  • I am rendering my matrix field as suggested: {$rockfrontend->render($page->matrix)}
  • Inside the template for my Repeater Matrix type (/site/templates/fields/matrix/text_image.latte) I am calling Alfred for the particular field:
...
<div class="bla" {alfred($page, ['fields'=> 'image_content_half'])|noescape}>
  <img ...>
</div>
...

  • I would expect the field notes of image_content_half to show the override value "Bar" but instead it shows the original value "Foo"
  • (this is not only the case with notes, but basically with any override including e.g. required property)
  • (when editing via ProcessWire admin the field overrides work correctly)

RockFrontend 2.9.1, RepeaterMatrix 0.0.8, ProcessWire 3.0.200

Am I missing something or is this a bug?

Thank you in advance.

Tell the user which profile was used for RockFrontend

It would be nice to see which profile was installed for RockFrontend.

2022-08-10_21-45

This is the settings page of RockFrontend after installation using the blank profile. Noone would ever know what might have been installed at some point.

Uncaught Error: Class "RockFrontend\ScriptsArray" not found

Hello and thanks for your awesome module!

I'm getting the following error message inside ProcessWire error logs and am not sure how to proceed debugging it.
The error occurs permanently on every request.

I'm adding only one script inside _main.php like this:

...
<?= $rockfrontend->scripts('body')->add('/site/templates/assets/main.js')->render(); ?>
</html>
Fatal Error: Uncaught Error: Class "RockFrontend\ScriptsArray" not found in /site/modules/RockFrontend/RockFrontend.module.php:1545 Stack trace:
1. /site/modules/RockFrontend/RockFrontend.module.php(306): RockFrontend->scripts('head')
2. /site/modules/RockFrontend/RockFrontend.module.php(1107): RockFrontend->addLiveReloadScript()
3. /site/modules/RockFrontend/RockFrontend.module.php(205): RockFrontend->livereload()
4. /wire/core/Modules.php(722): RockFrontend->ready()
5. /wire/core/Modules.php(823): Modules->readyModule(Object(RockFrontend))
6. /wire/core/ProcessWire.php(766): Modules->triggerReady()
7. /wire/core/Wire.php(414): ProcessWire->___ready()
8. /wire/core/WireHooks.php(951): Wire->_callMethod('___ready', Array)
9. /wire/core/Wire.php(485): WireHooks->runHooks(Object(ProcessWire), 'ready', Array)
10. /wire/core/ProcessWire.php(888): Wire->__call('ready', Array)
11. /wire/core/ProcessWire.php(647): ProcessWire->__call('ready', Array)
12. /wire/modules/Process/ProcessPageView.module(511): ProcessWire->setStatus(4, Array)
13. /wire/core/Wire.php(414): ProcessPageView->___ready()
14. /wire/core/WireHooks.php(951): Wire->_callMethod('___ready', Array)
15. /wire/core/Wire.php(485): WireHooks->runHooks(Object(ProcessPageView), 'ready', Array)
16. /wire/modules/Process/ProcessPageView.module(165): Wire->__call('ready', Array)
17. /wire/modules/Process/ProcessPageView.module(114): ProcessPageView->renderPage(Object(HomePage), Object(PagesRequest))
18. /wire/core/Wire.php(417): ProcessPageView->___execute(true)
19. /wire/core/WireHooks.php(951): Wire->_callMethod('___execute', Array)
20. /wire/core/Wire.php(485): WireHooks->runHooks(Object(ProcessPageView), 'execute', Array)
21. /var/www/html/processwire/index.php(55): Wire->__call('execute', Array) #21 {main} thrown
Line 1545 of /site/modules/RockFrontend/RockFrontend.module.php

CSS and Less files get autoloaded

Existing CSS and Less files within /site/templates/sections/ get autoloaded even though $rockfrontend->styles()->... isn't used anywhere.

2022-08-11_00-09

While this autoload feature is nice in general, right now and in this way it ends up in really unexpected results.

Page not available in AutoPrepend.php

I think this is the same thing that GornyCreative mentioned in

https://processwire.com/talk/topic/27417-rockfrontend-%F0%9F%9A%80%F0%9F%9A%80-the-powerful-toolbox-for-processwire-frontend-development/?do=findComment&comment=238061

but I thought it worth logging here as well.

When I installed RockFrontend just now on an up to date version of PW (although a duplicated site rather than a fresh install) it dies with a fatal error 'Call to member function getFiles() on null' (screenshot attached).

Just wrapping the foreach loop in a conditional that checks for page lets me continue with no obvious problems ... so far :-)

if(isset($page) && $page){ foreach ($page->getFields() as $field) { if (!array_key_exists($field->name, $vars)) continue; unset($vars[$field->name]); } }

autoprepend_error

Thanks for all your work on this and all things PW of course.

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.