Giter Club home page Giter Club logo

history.nette.ajax.js's People

Contributors

enumag avatar hranicka avatar jiripudil avatar ne0-cz avatar vojtech-dobes avatar vysinsky avatar zipper 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  avatar  avatar

history.nette.ajax.js's Issues

Problem with loading last item in history

Hi, I have a problem with history. My steps:

  1. Load page 1 (url /page-1)
  2. Load page 2 by AJAX (url /page-2)
  3. Load page 3 by AJAX (url /page-3)
  4. Go back in history: url changes to /page-2, content of the page changes to page 2
  5. Go back in history: ISSUE: url changes to /page-1, BUT content of the page is not changed and remains content of page 2

So moving in history works as expected, but not with the oldest page (the page I load in normal way - not AJAX way).

Are the snippets from the oldest page saved in the history?

Option to prevent changing URL

I would appreciate if I can decide weather the URL will be updated or not.

My scenario: I have ajax image gallery and each picture has delete icon (anchor with href to signal deleteImage!) hitting this button is properly ajax handled, image is deleted and snippet with gallery is redrawed and its fine but I ended up with URL containing &do=handleDeleteImage but I would like to have URL without this parameter. I can use redirect but I dont see any reason why.

Hashtag in redirect is lost

Hi, when I add a hastag into redirect like this:

$this->redirect('Presenter:action#HASH');

the browser receives a correct url but wihout the #HASH. Found out the problem is caused be generating the url again here. After some debugging I discovered the method __invoke is called twice;

  1. first time the payload contains correct redirect
  2. and second time there're only snippets and state objects
    Can you please explain why's it like that?

I need that hashtag to open a bootstrap modal so I've tried to workaround this by writing own extension that opens modals by showModal property in the payload but when I set it in a presenter like this:

$this->payload->showModal = 'ModalID';
$this->redirect('Presenter:action');

It doesn't work either. The browser receives only snippets and a wrong redirect.

[bug] broken flash messages

If I use sth. like this in presenter

$this->flashMessage('test');
$this->redirect('this');

the flash message will not show up as corresponding snippet (flashes) is not set to be redrawn after forwarding.

The workaround is to check for _fid in startup method

if (!empty($this->params[self::FLASH_KEY])) {
    $this->redrawControl('flashes');
}

but I lost more than hour to track this down..would be nice to mention this at least somewhere

popstate doesn't handle redirects because of disabled history extension

When I hit back button in browser that goes to temporary accessible page such as some thankyou page which is no longer valid and I'm redirected somewhere, URL doesn't change due to this line.

What is the reason for disabling history extension for such cases? I've tried to remove this line and I'm not facing any issues. May I send PR?

redirectUrl() doesn't reload the snippet

A have a signal.

If I use $this->redirect('Article:default', ["id" => 22]), it works.

But if I use $this->redirectUrl('/article/22'), URL will change, but snippet doesn't reload.

The response contains only redirect: "/general/comment/22", nothing more.

Tag new version?

Would be nice if we can ge master as it is now as new version so we don't have to depend on dev-master, and that we can throw away unnedded nette packages (specially nette/deprecated)

ajax redirect při vypršení doby přihlášení

Ahoj,
mám problém, pokud vyprší session u uživatele, tak v baseSecuredPresenteru přesměrovávám na sign.in, url se mě změní, ale stránka se nerefreshne. Pokud zakomentuji přilinkování history.nette.ajax.js tak se stránka redirectne a vše funguje správně. Něco jsem o tom sepsal na nette foru
Je možnost nějak využívat jak tento addon, tak i redirect?

Extension is not working in Firefox 26

When using Firefox 26, there're two glitches.

1) TypeError: invalid 'in' operand window.history
[Break On This Error]
this.popped = !!('state' in window.history) && !!window.history.state;

After fixing this line to not use in operand, another glitch occurs.
2) window.history is undefined

Is there any way you can make this work (at least graceful degradation)?

Thanks

Add way how to force real redirect

Hi, what is the purpose of assigning redirect value to this.href? I've used old redirect function from nette.ajax and after session is expired, it was redirecting to login page. Now after implementation of history.nette.ajax, there is a problem, because it is not redirecting because of this condition.

if (redirect) {
        var regexp = new RegExp('//' + window.location.host + '($|/)');
        if ((redirect.substring(0,4) === 'http') ? regexp.test(redirect) : true) {
            this.href = redirect;
        } else {
            window.location.href = redirect;
        }
    }

Tag new version

I'd like to use this package in stable version and last tag is from March.
Could I ask you to release new tag?

Is it possible to use data-ajax-append?

It looks that is not. But I would like to create some effect on page change, like slide. If it would be appended, I could hide new content and then slide it on the old one.

Or, maybe you know better how to create some effects, when snippet is loaded?

initialPop detection in Safari fails after refresh

As known, Safari triggers popstate event on window after page has been loaded. Current detection of initialPop (popstate not caused by history manipulation - back/forward button) works fine only for the first page load and traversing using links. But when the current page is refreshed, the initialPop is not recognized and its value here is false.

Because of that, updateSnippets function is called (via handleUI from history extension) after refresh and some JS could break as the DOM changes (attached events are lost for instance). This happens only in Safari (specifically tested Safari 8.0.4 on OS X Yosemite, but the bug could be reproduced on El Capitan aswell) as no other browser triggers popstate on page load.

Nette 2.2 config.neon inlegal char "-"

in config.neon

from:
extensions:
ajax-history: VojtechDobes\NetteAjax\HistoryExtension

to
extensions:
ajaxHistory: VojtechDobes\NetteAjax\HistoryExtension

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.