FriendsOfShopware / friendsofshopware.github.io

FriendsOfShopware website
MIT License
10 stars 1 forks source link

Staging Warning/Notification #2

Closed JoshuaBehrens closed 4 years ago

JoshuaBehrens commented 6 years ago

1. What is the benefit from your shopware extension to the community?

This small plugin is useful for shopware staging environments that look similar too the production environment. Although this is a small modification this is reoccuring, therefore it is worth a plugin in my opinion.

2. Link to to current Github repository

This is on a private bitbucket so I can't link it. But as author I can show you the main content: A simple subscriber.

class Html implements SubscriberInterface
{
    /**
     * @return string[]
     */
    public static function getSubscribedEvents()
    {
        return [
            'Enlight_Plugins_ViewRenderer_FilterRender' => 'filterRenderedView',
        ];
    }

    /**
     * @param Enlight_Event_EventArgs $args
     */
    public function filterRenderedView(Enlight_Event_EventArgs $args)
    {
        /** @var Enlight_Controller_Plugins_ViewRenderer_Bootstrap $bootstrap */
        $bootstrap = $args->get('subject');
        $moduleName = $bootstrap->Front()->Request()->getModuleName();
        if ($moduleName === 'widget') {
            return;
        }

        $args->setReturn(str_replace('</body>', '<div style="position: fixed;top: 10px;right: 10px;border-radius: 5px;padding: 15px;color: white;background: red;font-weight: bold;z-index: 9999999999;font-size: 1.2em;pointer-events: none;">Das ist eine Stagingumgebung</div></body>', $args->getReturn()));
    }
}

3. Checklist

4. Comment

This plugin renders on every page (even backend) that this is a staging environment.

Frontend: grafik Backend: grafik

This plugin is not yet compliant to the rules but I would submit a plugin that is. And is more customizable (maybe the red badge is not annoying enough on a red page, so you can make it :blue_heart: instead)

shyim commented 6 years ago

Very usefull, i guess everybody know that feeling when you click on a banner and your a on the live site 😆

Crease29 commented 6 years ago

I also find it very useful! :+1: Would you transform it in a plugin that meets our rules? :smile:

JoshuaBehrens commented 6 years ago

@Crease29 that is the plan. But I would not rework it, if the Frosh community does not like the idea. If this is approved, I will work on it and post it on https://github.com/niemand-online/ for deeper investigations.

JoshuaBehrens commented 6 years ago

While working on it on the weekend, I totally made an overkill project out of it. So stay tuned :pager:

https://github.com/niemand-online/FroshEnvironmentNotice

shyim commented 6 years ago

I added some comments to this repository 😄

shyim commented 6 years ago

@JoshuaBehrens any updates here?

xndrdev commented 6 years ago

@JoshuaBehrens any updates here?

JoshuaBehrens commented 6 years ago

I am struggling with https://github.com/FriendsOfShopware/FroshEnvironmentNotice/pull/6 as I am not that familiar to work with ExtJs to finish the editor :worried: