Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialog #366

Closed
myrss opened this issue Nov 15, 2013 · 17 comments
Closed

Dialog #366

myrss opened this issue Nov 15, 2013 · 17 comments

Comments

@myrss
Copy link

myrss commented Nov 15, 2013

Очень нравятся ваши работы!
Пытаюсь потестить, подскажите в чем проблема с dialog
выдает вот такою ошибку
Uncaught ReferenceError: addTouchEvents is not defined
...и если я правильно понимаю обработка форм и прочее можно размещать, здесь: onShow: function(_dialog){
Спасибо!

@olton
Copy link
Owner

olton commented Nov 15, 2013

функция addTouchEvents определена в metro-touch-handler.js ее надо включить в проект

@myrss
Copy link
Author

myrss commented Nov 16, 2013

Действительно, не подумал.
И все же после подключения, ошибка указывает в metro-dialog.js
на строку console.log( $(window).height());
вроде у вас уже указано по-умолчанию: height: 'auto',

@olton
Copy link
Owner

olton commented Nov 16, 2013

Без кода я не могу сказать, почему у Вас вылезает ошибка. К сожалению я читать мысли не умею :(
console.log() можно и закоментировать она не несет для Вас смысловой нагрузки.

@rafaelurrutia
Copy link

how i can send information from ajax in a box dialog?

@olton
Copy link
Owner

olton commented Jan 15, 2014

Use $.Dialog.content()

@rafaelurrutia
Copy link

dialog

i try to display just a simple alert inside var content in a event "onclick" on a button, but i can't to show the message. i'm sorry if the question is very basic.

@myrss
Copy link
Author

myrss commented Jan 17, 2014

It`s maybe help

$(document).ready(function(){
    $(".keepDialog").on('click', function(){
        $.Dialog({
            overlay: true,
            shadow: true,
            flat: true,
            icon: '<span class="icon-mail"></span>',
            title: 'Contact',
            content: $("#contactDialog").html(),
            padding: 10,
            onShow: function(_dialog){
                $('.window input[type="submit"]').click(function() {
                    var name1 = $('.window input[name=name]').val();
                    var tel1 = $('.window input[name=tel]').val();
                    var email1 = $('.window input[name=email]').val();
                    var mess1 = $('.window textarea[name=mess]').val();
                    var data_html = '';
                    var error_text = '';

                    if (name1 == "") {
                        var n = $('.window input[name=name]');
                        n.parent('div.input-control').addClass('warning-state');
                        n.attr('placeholder','Input name');
                    }
                    if (mess1 == "") {
                        var m = $('.window textarea[name=mess]');
                        m.attr('placeholder','Input message').css('border-color', '#fa6800');
                    }
                    if (error_text != '') {
                        $('.window .alarm_no').show().html(error_text);
                        $('.window .alarm_no').fadeTo(500, 1);
                    } else {
                    data_html = $('.window form').serialize();
                    $.ajax({
                        type: 'POST',
                        url: '/contacts/',
                        data: data_html,
                        success: function(msg) {
                        if (msg == 'sent') {
                            $.Dialog.close();
                            $.Dialog({
                                overlay: true,
                                padding: 10,
                                width: 400,
                                flat: true,
                                content: '<div class="text-center"><h2>Sent</h2><button class="command-button"><i class="icon-cancel-2 on-left"></i>Close<small>Thank you!</small></button></div>',
                                onShow: function(_dialog1){
                                    $('button.command-button').click(function() {
                                        $.Dialog.close();
                                    });
                                }
                            });
                        } else {
                          $('.window .alarm_no').show().html('Error. Again!');
                          $('.window .alarm_no').fadeTo(500, 1, function() {
                            $('.window .alarm_no').delay(500).fadeTo(500, 0, function() {
                              $('.window .alarm_no').hide();});
                          });
                        }
                        }
                        });
                    }
                    return false;
                });
            }
        });
    });
});

Еще один глупый вопрос, как сделать, чтобы при нажатии отправить, не происходило перезагрузки страницы, как это было раньше... Спасибо, стало вообще круто!

@olton
Copy link
Owner

olton commented Jan 17, 2014

вернуть false

@muxahuk
Copy link

muxahuk commented Jan 17, 2014

Правильнее будет, я думаю:

element.on('click', function( e ) {
e.preventDefault();
/* code */
});

@olton
Copy link
Owner

olton commented Jan 17, 2014

можно и так

@rafaelurrutia
Copy link

thank's so much guys

i hope to learn more

@rafaelurrutia
Copy link

and as I can do to "modal false" in the popup window so it does not disappear?

@olton
Copy link
Owner

olton commented Jan 24, 2014

In 2.* version Dialog d’s not have non-modal state

@rafaelurrutia
Copy link

ok thanks

@vicenco
Copy link

vicenco commented Feb 8, 2014

Any idea on how to position Dialog? Because 'position' attribute seems to be obsolete, it doesn't work.

Maybe something like this:

onShow: function (_dialog) {
$(this).css('top','50px');
}

also doesn't work.

@greensolid
Copy link

The position attribute hasn't been implemented yet and is unappropriated or obsolete.
But you can try to modify the METRO_DIALOG object which is returned by $.Dialog().
So try this:

var dialog = $.Dialog({params}).css("top", '100px');
dialog.animate({top: 150});

You can use any jQuery methods on it.

@vicenco
Copy link

vicenco commented Feb 9, 2014

Thank you very much! This works great!

@olton olton closed this as completed Apr 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants