what is the best way of making a filter pre every page in vaadin - spring-boot

hi i wanna have a filter pre every web pages that check someting and if that thing was incorrect show me an error page
and if it was fine just show me the page

Vaadin is mostly based on individual interactions such as clicking buttons or scrolling in a grid, rather than viewing pages. What you can still do is to use UI::addBeforeEnterListener to get an event before navigating to a new target. You can use a VaadinServiceInitListener to register that listener for all your UI instances.
For more information, have a look at this blog post that I've written on the topic.

Related

Change Sidedrawer content dynamically

I´m at that point on my app, where the user Logged in, receive the data from the server and now i need to make same changes. One of the changes is change the button that appears on my Sidedrawer saying Log In to Log Out and vice-versa when the user Logs Out...I could talk about other changes but i think the main thing is...
How do I access the Sidedrawer content in order to change/add buttons. I already entered the app-root.xml and made same testing adding the navigatingTo="onNavigatingTo" function and also in the .js file just to see if it responds, but it doesn´t...
How do i perform this?
You can show/hide your button via visibility, text binding or via a structural directive like *ngIf (if using Angular). For example, take a look here - I am showing/hiding a button based on whether the user is logged in or not (here is the related code-behind code).
The above example is using an Angular directive and can be applied only in Angular based applications, but with the same logic, you can substitute ****ngIf*** with visibility and achieve the same in TypeScript or plain JavaScript app.
The easiest way to do it is put the frame inside drawer content area, then navigate frame to another page.

How do I get the Router navigate extra "replaceUrl" to work correctly?

I have a contact addition form that can be navigated to from multiple screens in our application.
Once the form is submitted, I then take the user to a screen to view the contact that was added.
When the user then makes use of the back button it should take them back to the screen that they originated from.
This might be the Android back button or one that calls the RouterExtensions back function.
I have made use of the navigate extra replaceUrl when navigating away from the form to the view page.
I have also tried using the skipLocationChange extra when navigating to the form but this creates more issues.
I have created a simple playground page flow that creates not quite the same issue but does throw an error that I don't know what to do with either:
https://play.nativescript.org/?template=play-ng&id=BfVcGZ&v=2
In our app, by making use of the replaceUrl extra, the back button does take the user to the correct page.
However, there is a brief moment where they see the form again. This isn't an ideal user experience.
In the linked Playground I do get an error:
Cannot reattach ActivatedRouteSnapshot created from a different route.
This seems to tell me that replaceUrl is indeed removing the page from the route table.
However, the page isn't destroyed yet and so the app is trying to show a page that it shouldn't.
replaceUrl is not yet supported by Page Router Outlet, there is an open feature request, you might want to register your vote on the feature and follow up there for further updates.

Issue with GTM and asp.net webforms with two submit buttons

Just wanted to share a discovery when using Google Tag Manager (GTM) and two submit buttons in a form-tag (common legacy asp.net Webforms tech).
GTM is used by website editors. So the developers doesnt need to be involved when other scripts or event needs to be implemented or traced.
The problem is that something in GTM is making our form to always trigger the default submit button (the first in order is default).
Example problem/how to reproduce: in a wizard scenario, with back and next submit buttons, which are triggering a postback. Click on next is triggering the back button.
Removing the GTM code, and it works.
This is a legacy site. Maybe a legacy issue, but the site worked until we implemented GTM.
You may ask me now, what components are we using in GTM. Well google analytics is one, then i don't know.
Regards.
Work-around solution: I had to rebuild the HTML to NOT use "input type=submit".
Instead use buttons without submit behavior. eg not use "postbacks" on one of the buttons.
Probably something for the GTM team to look at or inform.

ClickFunnels integration with rails2 app

Is there a way to create a page in ClickFunnels(https://www.clickfunnels.com/) website and when I submit that page, I need to store the form details in my rails app(into a particular table). Which means I want to display my database in the clickfunnels integrations list. I googled hours but couldn't get much information on this.
can anyone suggest me if you have done this. A reference link also much appreciated.
We couldn't find any way to do this inside clickfunnels itself, if there is a easy way to add custom systems to their integrations I too look forward to seeing those answers. Until then, here's what we did: We just put our custom form on their page and used ajax to send it back out the end point in our system it needed to hand that data too.
Then, since we also needed to submit the same info to click funnels, we build a fake CF form(I think we actually put one on the page, but used CSS to hide it, then filled it out dynamically from our custom form), and call submit on that form, sending the user through the normal click funnels submission process and sending them to the next page in the funnel.

AddToAny reload after Ajax

I have a website where I am switching from addThis to addToAny for social sharing buttons. The problem is that the share buttons are contained in content that is loaded dynamically with jquery Waypoints infinite scroll feature (which uses Ajax). When the page first loads (so no Ajax called yet) everything works great, but when a user scrolls and more content is added that contain the share buttons, the new buttons don't work in that they don't show the share options on hover or click.
There are supposedly fixes for this if using templates from the likes of Drupal or Wordpress, but my site is not built using any of these templates. This was also a known issue with addThis, and to get around the problem you simply need to add 'addthis.toolbox('.addthis_toolbox')' into the success portion of the ajax call and things would work.
I haven't had any success getting addToAny to work after ajax returns. They have something that looked promising: a2a.init('page'), but that doesn't work. Has anyone had this problem and have any suggestions on how to fix it? Thanks!
If there so many share button on one page you can call this after ajax success:
$(".a2a_dd").each(function() {
a2a.init('page');
});
Or if there only one share button, you can use this after ajax success:
a2a.init('page');
If want to know more details go through this document
According to the AddToAny API (https://www.addtoany.com/buttons/api/), you should use a2a.init_all(); if you are loading a number of new share button sets at once via AJAX.
Using a2a.init('page'); only initializes the last uninitialized buttons instance on the page. That might be fine for you, depending on how many new buttons that you load at a time.
Example: you have a blog site that loads new posts when the user scrolls to the end of the page. If you are only loading one new set of share buttons for the new content, a2a.init('page'); should work. If instead, you are loading a few new posts at a time, that each get their own set of share buttons, you will want to use a2a.init_all();
Hope this helps someone!

Resources