Git Product home page Git Product logo

jquery-impromptu's People

Contributors

a-v-k avatar amitdaswani avatar calumbrodie avatar trentrichardson avatar zalmoxisus 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

jquery-impromptu's Issues

$.prompt undefined in version 6.0.0

I have impromptu working fine using version 5.2.5. However, when I upgraded to version 6.0.0, in Firebug I'm getting a "TypeError: $.prompt ... is undefined" error.

Has anything changed in regards to how to reference Impromptu?
Thanks.

Fixed Header, impromptu does not always end up in the same place relative to the container

Hi,

We are using bootstrap as our main layout base, and using impromptu as the tour feature for new users. Currently, we set the container and the x/y in relation to that container. If the tour has scrolled the page for some reason, the x/y coordinates do not behave the same as they would if the user has not scrolled.

Additionally, if the tour scrolls the content, there are times where the impromptu window does not end up where it is supposed to in relation to the container.

Here is a tiny snippet of one of our tour's code:

{
  title: "Report Bugs",
  html: 'We are still testing this service extensively. Please help us find problems, so we can make this as awesome as possible for release!',
  buttons: {
    Prev: -1, 
    Next: 1
  },
  focus: 1,
  position: {
    container: '#btnTemplateBugReport', 
    x: -345, 
    y: -12, 
    width: 300, 
    arrow: 'rt'
  },
  submit: tourGoToMyProfileFunc
},
{
  title: 'Your Profile',
  html: 'You can click here to view your profile and wall.',
  buttons: {
    Prev: -1, 
    Next: 1
  },
  focus: 1,
  position: {
    container: '#userNavMenu',
    x: -350, 
    y: 50, 
    width: 300, 
    arrow: 'tr'
  },
  submit: tourGoToCommunityFunc
},
{
  title: 'Link Social',
  html: 'Make sure you link Facebook, Steam, and Youtube to unlock all the social aspects of GameWisp!',
  buttons: {
    Prev: -1, 
    Next: 1
  },
  focus: 1,
  position: {
    x: 440, 
    y: 205, 
    width: 300, 
    arrow: 'lt'
  },
  submit: tourSubmitFunc
},

Bower does not recognize 5.0

$ bower install
bower not-cached    git://github.com/trentrichardson/jQuery-Impromptu.git#5.0
bower resolve       git://github.com/trentrichardson/jQuery-Impromptu.git#5.0
bower ENORESTARGET  No tag found that was able to satisfy 5.0

Additional error details:
Available versions: 4.0.1, 4.0.0, 3.3.3

Why Does It Happen?

image

It works perfect, but sometimes it doesn't. I have to press f5 key and try again and It works again. :(

Greetings.

Submitted form values are lost when applying bootstrap style.

When the state html property is defined like suggested in the documentation, the form passes the values properly.

html: '<label>First <input type="text" name="fname" value=""></label><br />'+
      <label>Last <input type="text" name="lname" value=""></label><br />',

But when I am using the html layout that bootstrap requires to look nice, like

html: '<form class="form-horizontal" role="form">
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Email</label>
    <div class="col-sm-10">
      <input type="email" class="form-control" id="inputEmail3" placeholder="Email">
    </div>
  </div>
</form>',

my form values are lost and I get an empty object as a result.

Javascript error in IE8

Line 292 causes error after cancelling Impromptu window: 'data(...).position' is empty or no object

Solution:
change:
pos = $state.data('jqi').position,
to:
pos = ($state.data('jqi')==null?undefined:$state.data('jqi').position),

removeState not working properly

Hi there,

Thanks for this awesome plugin!

I just updated from a really old version from 2010. I'm having to redo everything to use states instead of multiple prompts like I used before but I really like it.

One issue I ran into is when I'm dynamically adding states and then removing them it doesn't appear to work properly. The html doesn't get removed from the page and it's also doing another strange thing and changing the state it's on.

Example

The states:
state0 - has a link in it's html
state1 - asks for a password
state2 - shows a success message
state3 - a dynamically added state
- html is set to a dynamic message which is why it has to get added and removed in the first place
- has a submit function that calls goToState('state0')
- has a submit function that calls removeState('state3')

The steps:

  1. I click a link on the page and it prompts to state0
  2. I click the link inside state0 which causes one of the following:
    • go to state1 if a password is required for the link
    • go to state2 if clicking the link was successful
    • add state3 if there is a different result and goToState('state3',true)
  3. I click the Ok button which causes the following to happen inside the submit function:
    • goToState('state0') - basically back to step 2
    • removeState('state3') - however state3 is never actually removed
  4. Back at step 2 after I click the link for the second time and it shows the sub state3 when I click the Ok button it will actually transition to state1

I propose adding a newState parameter to the removeState function that sends you to the new state you want to go to after the state is removed.

In this case in the state3 submit function/step 3 above I would just use:
removeState('state3','state0')

For example:

    /**
    * removeState - Removes a state from the promt
    * @param state String - Name of the state
    * @param newState String - Name of the state to go to
    * @return Boolean - returns true on success, false on failure
    */
    $.prompt.removeState = function(state, newState) {
        var $state = $.prompt.getState(state);

        if($state.length === 0){
            return false;
        }

        // transition away from it before deleting
        $.prompt.goToState(newState);
        $state.slideUp( "slow", function() {
            $state.remove();
        });

        return true;
    };

This would probably have to be modified more since it isn't going to the next or previous states anymore and requires the newState parameter but there is the general idea anyway.

How can I open a prompt in a certain state?

Sorry if this is obvious, but how can I open a multiple-state prompt in a specific state other than the first one in the states object? In other words, in the first statesdemo example, how can I open the prompt in state1 instead of state0?

I'm working on a login/logout/registration form with each of the three as a separate state and would like to start the prompt in either the "log in" or "log out" state depending on whether the user is currently logged in or not.

(I'm trying to work out the solution reading Impromptu's source code, but figured I'd also pose this question here for others like me to find in the future.)

Error sending Object vía Ajax

Hello, I'm using $.Ajax, and in the data parameter I'm sending the "f" object but I get an error message saying "Error JSON Primitive", Does anybody know what the problem is?

Thanks.

Can't edit textarea or input text when a jquery modal dialog is opened.

To reproduce the bug, add in the survey demo html file :

Head part :
<link rel="stylesheet" media="all" type="text/css" href="../themes/cupertino/jquery-ui-1.10.3.custom.min.css" />
<script type="text/javascript" src="../jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="../jquery-ui-1.10.3.custom.min.js"></script>

script part :
$(document).ready(function() {$('#test').dialog({modal:true});});

body part :
<div id="test"><a href="javascript:openprompt()">Test Impromptu States Survey</a></div>

Effect ignored when closing non-persistant prompt

Enhancement

When no effect is set for showing a non-persistent overlay, there is still a fast fadeOut effect used when closing the overlay by clicking anywhere else in the screen. Maybe the close event can also use the opts.show effect? (or maybe a separate opts.hide effect)

possible to NOT scroll for a state?

I have an impromptu walkthrough which works great. But one prompt points to an item that uses CSS to remain static on the page (like a jquery mobile header or footer). When I get to the prompt to point to that menu, the page scrolls, the prompt opens, but then the menu re-positions itself. Then the prompt is left hanging in the middle, pointing at nothing. I bought the ebook, but couldn't find a clue..is it possible to turn off scrolling for a specific state? That would solve the issue.
Thanks for the great plugin.

cannot use impromptu-jquery as confirmation modal dialog

I try to use your jquery library to replace the traditional confirmation modal dialog. I had the following code in a row deleting event of a ajax control. Basically, I use the following.

var continueDelete = $.prompt("Are you use to delete the row?",
{
title: 'Confirmation',
buttons: { "Ok": true, "Cancel": false },
submit: function(e, v, m, f) {
return v;
}
});
if (!continueDelete)
eventArgs.set_cancel(true);

However, I found that the $prompt is not shown yet and the statement if (!continueDelete) eventArgs.set_cancel(true); is already executed. The row will be deleted even though the user click Cancel to cancel. Do you know how I can achieve the confirmation like regular confirm? If I use the regular confirm, it works.

Impromtu is not working in IPAD

Hi,
I have implemented impromptu using asp.net. Everything is fine and working except on ipad. My function to call the plugin is as;

function ShowImromptu(caption, message, buttons, callBackFunction,focus)
{
if(callBackFunction != null && callBackFunction != 'null' && callBackFunction != "null" && callBackFunction!= '')
{
var temp =
{
init: {
html:'',
buttons: { }
},
ALR000:
{
html:'',
submit: callBackFunction,
buttons: buttons,
focus: focus
}
}
}
else
{

    var temp = 
        {
            init: {
                html:'',
                buttons: { }
            },
            ALR000: 
            {
                html:'',
                buttons: buttons,                       
                focus: focus
            }
        }
}       
var spinner = $('<div id="ajaxloader2"></div><div id="statecaption"></div>');
$.prompt(temp);
spinner.prependTo('#jqi');  
ShowCustomPromptAlert(caption, message,callBackFunction,300,false);
return false;

}

e.g My Parameters are;

var buttons = {OK:false};
var callBack = function(v,m,f){$('#ctl00_ContentPlaceHolder1_AmountField').focus();};
ShowImromptu('ALRT-EF-01', '_EntryForm_EmptyFields_Alert', buttons, callBack ,0);

But it never shows in IPAD.

Thanks

maybe jqifade css position fixed is better then absolute

use absolute will cause some bug when the scrollbar is not at the top

@@ -295,11 +295,11 @@
            left: 0,
            right: 0,
            bottom: 0
        });
        $.prompt.jqif.css({
-           position: "absolute",
+           position: "fixed",
            height: height,
            width: "100%",
            top: 0,
            left: 0,
            right: 0,

Pressing 'Enter' in sub-state causes page to hang and become unusable

I'm using the following code for a hotel booking engine:

var buttons = [];
buttons.push({title: "Existing Guest", value: "guest"});
buttons.push({title: "Existing Booking", value: "booking"});

$.prompt({
    init: {
        title: "Reservation Creation",
        html: '<p>Where should this reservation be assigned?</p>',
        buttons: buttons,
        focus: 1,
        submit: function(e,v,m,f) {
            e.preventDefault();
            if (v == 'guest' || v == 'booking') {
                $.prompt.goToState(v, true);
                return false;
            }
            $.prompt.close();
        }
    },
    guest: {
        html: '<label>Guest email address <input type="text" name="email" /></label>',
        buttons: {
            Confirm: 1,
            Cancel: -1
        },
        focus: "input[name='email']",
        submit:function(e,v,m,f){
            e.preventDefault();
            if (v == 1) {
                $.extend(ajax.data, {
                    reference: f.email
                });
                $.ajax(ajax);
                $.prompt.close();
            }
            else if (v == -1) {
                $.prompt.goToState('init');
            }
        }
    },
    booking: {
        html: '<label>Booking reference <input type="text" name="reference" /></label>',
        buttons: {
            Confirm: 1,
            Cancel: -1
        },
        focus: "input[name='reference']",
        submit:function(e,v,m,f){
            e.preventDefault();
            if (v == 1) {
                $.extend(ajax.data, {
                    reference: f.reference
                });
                $.ajax(ajax);
                $.prompt.close();
            }
            else if (v == -1) {
                $.prompt.goToState('init');
            }
        }
    }
});

When the user enters the sub-state (to enter an email address or existing booking reference) the focus is already on the input field. But hitting enter causes the page to hang and become completely unresponsive

image

Pressing escape, etc, doesn't do anything (the buttons bar on the prompt flash though, weirdly). The user is forced to do a page refresh to regain control.

No errors are raised in the console, and I even tried removing the onsubmit declaration in the form that it builds. This made no difference.

Show prompt if I pick yes then go to state1 and stay there

Hi, I'm using your amazing and comfortable plugin but have some doubts. This is my code so far:

$(".sell-product").click(function() {
        var current = $(this);

        var statesdemo = {
            state0: {
                title: "Este producto ya posee stock, quiere actualizarlo?",
                buttons: {"Sí": true, "No": false},
                submit: function(e, v, m, f) {
                    if (v == true) {
                        $.prompt.goToState('state1');
                    }
                }
            },
            state1: {
                title: 'Cantidad',
                html: '<label>Cantidad <input type="text" name="stock_qty" id="stock_qty" value=""></label><br />',
                buttons: {"Guardar": true, "Cancelar": false},
                focus: "input[name='stock_qty']",
                submit: function(e, v, m, f) {
                    console.log(f);
                    e.preventDefault();
                }
            }
        };

        var request = $.ajax({
            type: 'GET',
            url: Routing.generate('stock_exists', {company_id: company_id, product_upc: current.attr("data-id")}),
            success: function(data) {
                $("#layout-center").html();
                if (data.response === false) {
                    $.prompt(statesdemo);
                } else {
                    $("#product-search, #product_create").hide();
                    $("#sell-existent-product").load(Routing.generate('create_from_product', {company_id: company_id, product_upc: current.attr("data-id")}));
                    $("#sell-existent-product").show();
                }
            },
            error: function() {
                request.abort();
            }
        });
    });

What I'm trying to do here is:

1 - If data.response is false then show state0 this works
2 - when I click "Si" which value is true then go to state1 this do not work since prompt is closed and I can't see input
3 - After I introduce a value in the input in stock_qty input and click in "Guardar" which value is true once again then I should made a AJAX call

Can you help me to fix my code in order to get this work?

Valid form by Enter key with ajax call inside, call 2 times the submit callback !

When I use the enter key to valid a form and doing an ajax call in the submit callback. It call a second time the submit callback.

I build this small test with these files :
https://filesender.renater.fr/?vid=61d10bb3-1df0-37c9-2bef-000036df7ed9
I put the ajax async = false properties to reproduce easily this strange behaviour. When I click directly on "Work" button, it works fine. I used console.log function to trace calls.

submit function message parm

submit: function(event,value,message,form)
I know what all of the parms are except the 'message' which I know is an object but I can't seem to find what it contains. Just thought I'd ask so I can see if there is anything interesting in there to use.

Thanks in advance.

Impromptu looks strange on iPad iOS 4.x

impromptu 3.1

invocation as follows:

theprompt = $.prompt(txt, {
prefix:'cleanblue',
buttons: {Save:'Save', Close:'Close'},
submit:function(v,m,f){
if (v == 'Save') {

                return false;
            } else {
                $.prompt.close();
            }
        }
});

TypeError: stateobject is null

In function $.prompt.jqi.delegate, you said "for some reason we couldn't get the value", but i found for some reason the $state object will also is empty.
I found $t is the button object i clicked, but $t.parents('.jqistate') never reached, since they are at different DOM trees.

How to define the width of Impromptu box (when using states) ?

Hi,

Ho can I define the widht of impromptu box ?

I use impromptu to show text + image and the image is bigger than the width of the impromptu box.

I use the 'states' version to show multiple boxes each having a different widht (as they show different images).

I tried the code below but that did not work (note I added the widht:700px to it).

var statesdemo = {
                state0: {
                        width: '700px', 
                    html: "<%=trJS("explain-sign-step3-1.text",lg)%>",
                    buttons: { Cancel: false, Next: true },
                    focus: 1,
                    submit:function(e,v,m,f){
                        if(v){
                            e.preventDefault();
                            $.prompt.goToState('state1');
                            return false;
                        }
                        $.prompt.close();
                    }

...
The problem is the widht of the image is not taken into consideration when defining the widht of the Impromptu box, see example below. It is not problem to add the width manually but I can't find out how to do that:
sample_text_image

Box not centered by default

Hello,

I had a problem box not being centered, I found the problem, since jQ 1.9 the outerWidth() receives an argument if counts with margin or not.

So anyone having that problem:

L353: marginLeft: (($.prompt.jqi.outerWidth()/2)*-1)

to

L353: marginLeft: (($.prompt.jqi.outerWidth(false)/2)*-1)

And it will center.

Good plugin, by the way.

How to bind Orientation Change on iPad

Hello, thank you for the wonderful Impromptu.

I need to be able to detect orientation change when using this on iPad, normally it is fine.
But when using it with <input type="text"...>, when the iPad soft keypad shown, and I rotate the iPad, it would not allow the screen size to change.
I am thinking I may need to bind orientation change event to the script, and being quite new to this, I am not sure where to do that in the script.

Please help.
Thanks.

impromptu 4.1 issue

Hi,
first of all thanks for your plugin, we use it to build our filemanager.
I want to upgrade to 4.1 but I have a problem.

To illustrate it, I'll use the user_management sample you provided :

close: function(e,v,m,f){

                        if(v){                          
                            //Here is where you would do an ajax post to edit the user
                            //also you might want to print out true/false from your .php
                            //file and verify it has been removed before removing from the 
                            //html.  if false dont remove, $promt() the error.

                            //$.post('edituser.php',{userfname:f.editfname,userlname:f.editlname}, callback:function(data){
                            //  if(data == 'true'){

                                    user.find('.fname').text(f.editfname);
                                    user.find('.lname').text(f.editlname);
                                    $.prompt('Update is done');

                            //  }else{ $.prompt('An Error Occured while editing this user'); }                          
                            //});
                        }
                        else{}

I just added the $.prompt('Update is done'); instructions but that just doesn't work. Is that a bug? it was working on previous version?

Thanks for your reply

Thanks

Reproducable error: Uncaught TypeError: Cannot read property 'length' of undefined

Hi,
I just try to use you library but I discovered following error:

Uncaught TypeError: Cannot read property 'length' of undefined

when using your bootstrap example. The error also exsits on you website. Do as follows:

  1. Goto http://trentrichardson.com/Impromptu/demos/twitter_bootstrap.html
  2. Click on Test Impromptu States Survey link
  3. Click on the Cancel button
  4. Click again on the Test Impromptu States Survey link
  5. The box is empty and above error is generated (I'm using latest version of Chrome).

Can you fix this ?

Theme Usage

There is no real documentation on how to use the themes that are distributed. You do have two examples of using 'outside' themes plus you have two blogs showing two new themes.

I would really like to understand how you use the themes that are distributed.

Thanks...

Defining buttons as array issue

I've tried defining buttons as array (latest stable version - v5.2.4) by copy&paste of book example:

prompt("Would you like to proceed?", {
buttons: [
{ title: "Yes, I'm Sure", value: true },
{ title: "No, Abort", value: false }
]
});

But I get additional 20 or so buttons, 'each', 'eachSlice'...:

impromptu-buttons-as-array

Using buttons in 'normal' way ("Yes, I'm Sure": true) works normally. No js errors are thrown in Firebug. jQuery version is 1.11.1.

Any ideas?

timeout does not call close event

timeout has 2 issues.
1st is that when timeout is executed, the close event is not called.
the 2nd one is that if you set up a high value and you reopen the prompt, 1st timeout is still set.

Option to use no effects?

Thanks for a great plugin. I would like to display the prompt as fast as possible. I see that you are using slideUp() and slideDown() when displaying the prompt. Can you create an option for using no transition effects? Thanks.

Passing parameters to the submit callback

Would it be possible to set the initial forminputs data when creating the prompt, like this:

$.prompt("This customer will be removed. Are you sure?", {
title: "Delete Customer?",
formVals: { customerId: customerId },
buttons: { "Delete the customer": true, "Cancel": false },
submit: function(event, value, message, formVals){
var customerId = formVals.customerId;
...
}
});

This was my fix:

forminputs = stateobj.formVals;
...

.prompt.defaults = {
state: {
formVals: {},
}
}

v (clicked) value in callbacks wrong in edge case

If you use an object to configure the buttons for your modal AND the title you choose for your button contains an html entity

{title: 'Save &amp; Close', value: true}

Then the 'clicked' button will not be reported correctly ($.text() on clicked button does not match title attribute).
The upshot of this is that the second value in any callbacks (the value of the clicked button) will be undefined.

Bower support

Can you please add bower support to your package?
It would be really helpful, as bower is focused on front-end tools.
Thank you!

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.