eZ Community » Forums » eZ Platform » Extended Platform UI : viewservice...
expandshrink

Extended Platform UI : viewservice never loaded

Extended Platform UI : viewservice never loaded

Sunday 21 August 2016 10:18:28 pm - 1 reply

Hello

Inspired from Damine Pobel "Extending Platform UI" https://github.com/ezsystems/ExtendingPlatformUIConferenceBundle

I've tried to add new entry menu in "Content" section, right to "Media Library".New menu added correctly, at click, yui viewservice and view for this new entry are called, my Controller is called and i display correctly the view

In this view, i've just tried to add a form like that

Resources/config/yui.yml

system:
    default:
        yui:
            modules:
                edgarezsb-sbapplugin:
                    requires: ['ez-pluginregistry', 'plugin', 'base', 'edgarezsb-sbview', 'edgarezsb-sbviewservice']
                    dependencyOf: ['ez-platformuiapp']
                    path: %edgar_ez_site_builder.public_dir%/js/apps/plugins/edgarezsb-sbappplugin.js
                edgarezsb-installviewservice:
                    requires: ['ez-serversideviewservice']
                    path: %edgar_ez_site_builder.public_dir%/js/views/services/edgarezsb-installviewservice.js
                edgarezsb-installview:
                    requires: ['ez-serversideview']
                    path: %edgar_ez_site_builder.public_dir%/js/views/edgarezsb-installview.js

 

Resources/public/js/app/apps/plugins.js

YUI.add('edgarezsb-sbapplugin', function (Y) {
    Y.namespace('edgarEzSb.Plugin');
 
    Y.edgarEzSb.Plugin.SbAppPlugin = Y.Base.create('edgarezsbSbAppPlugin', Y.Plugin.Base, [], {
        initializer: function () {
            var app = this.get('host'); // the plugged object is called host
 
            app.views.edgarezsbInstallView = {
                type: Y.edgarEzSb.InstallView
            };
 
            app.route({
                name: "edgarEzSbInstall",
                path: "/sb/install",
                view: "edgarezsbInstallView",
                service: Y.edgarEzSb.InstallViewService,
                sideViews: {'navigationHub': false, 'discoveryBar': false},
                callbacks: ['open', 'checkUser', 'handleSideViews', 'handleMainView']
            });
        }
    }, {
        NS: 'edgarezsbTypeApp'
    });
 
    Y.eZ.PluginRegistry.registerPlugin(
        Y.edgarEzSb.Plugin.SbAppPlugin, ['platformuiApp']
    );
});

 

Resources/public/js/views/services/edgarezsb-installviewservice.js

YUI.add('edgarezsb-installviewservice', function (Y) {
    Y.namespace('edgarEzSb');
 
    Y.edgarEzSb.InstallViewService = Y.Base.create('edgarezsbInstallViewService', Y.eZ.ServerSideViewService, [], {
        initializer: function () {
            this.on('*:navigateTo', function (e) {
                this.get('app').navigateTo(
                    e.routeName,
                    e.routeParams
                );
            });
        },
 
        _load: function (callback) {
            console.log('foo');
        }
    });
});

 

Resources/public/js/views/edgarezsb-installview.js

...

Resources/config/routing.yml

edgarezsb_install_post:
    path: /sb/install
    methods: [POST]
    defaults: { _controller: edgar_ez_site_builder.controller.sb:postInstallAction }

 

Controller/SbController.php

...

form view

<form name="edgarezsb_install" method="post" action="/sb/install" id="yui_3_18_1_1_1471806745585_2160">
<input type="text" id="edgarezsb_install_name" name="edgarezsb_install[name]" required="required"></td>
<button type="submit" id="edgarezsb_install_install" name="edgarezsb_install[install]" class="pure-button ez-button ez-install-button ez-font-icon ez-button-install">install.button</button>
<input type="hidden" id="edgarezsb_install_ezxform_token" name="edgarezsb_install[ezxform_token]" value="Be8eAReSgufRUyOCkmAOcpVw62EZHGVvfGGn5m-KwGU">
</form>

 

By submitting this form, log 'foo' never displayed, my 'edgarezsb_install_post' is automatically called.

I'm not YUI fluent, and i've tried a lot of modification but nothing resolve my problem :

  • adding <section class="ez-serverside-content" over <form
  • replacing POST with GET (not a solution, i need POST)
  • prefixing my route with /pjax
  • trying to replace "navigateTo" from "this.on('*:navigateTo'" with other keyword founded in platform-ui-bundle
  •  ...

Détail of Request/Reponse at this time

Request :

Content-Type:application/x-www-form-urlencoded
Host:ezplatform.lxc
Origin:http://ezplatform.lxc
Referer:http://ezplatform.lxc/ez
...

 

Response:

Content-Type:text/html; charset=UTF-8
PJAX-Location:/sb/install
...

 

I've tried to adapt my code like section/edit, my viewservice never loaded

If anymone has a custom example of a simple form in PlatformUI (just a form, not linked with eZ Content)

Wednesday 24 August 2016 5:55:52 pm

It's ok,

I've study from platform-ui-bundle ez-*serversideview.js and understand my mistakes.

I will post an explanation later, after validating my code

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from