Skip to content

How restart slugify after edit column slug #15

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

Closed
Iyongbudiarso opened this issue Oct 6, 2017 · 4 comments
Closed

How restart slugify after edit column slug #15

Iyongbudiarso opened this issue Oct 6, 2017 · 4 comments
Labels

Comments

@Iyongbudiarso
Copy link

Iyongbudiarso commented Oct 6, 2017

That slugify is in modal, after I edit column slugify and I open again modal, that slugify not automatically again. So, how to restart that slugify again?

My code is like this

$('body').on('click', '#add-bloggerUser', function(e){
            $('#blogger_slug').slugify('#blogger_name');
            $('#popup_blogger-form').modal('show');
            e.preventDefault();
});

$('body').on('click', '.update-bloggerUser', function(e){
            $('#blogger_slug').slugify('#blogger_name');
            $('#popup_blogger-form').modal('show');
            e.preventDefault();
});

Thank you

@madflow
Copy link
Owner

madflow commented Oct 6, 2017

Sorry - I do not quite understand the use case here. Can you create a plunkr (http://plnkr.co/) with a minimal use case?

@Iyongbudiarso
Copy link
Author

Sorry my bad english
can you check this video please
https://s.nimbus.everhelper.me/share/1162347/9p661q3bl8f03n1ad5pa

@Iyongbudiarso Iyongbudiarso reopened this Oct 6, 2017
@madflow madflow added the bug label Oct 6, 2017
@madflow madflow closed this as completed in 4bc8876 Oct 6, 2017
madflow added a commit that referenced this issue Oct 6, 2017
fix #15, empty targets cannot be locked
@madflow
Copy link
Owner

madflow commented Oct 6, 2017

@Iyongbudiarso Thanks for the cool video 👍 I blindly fixed the issue - since I assumed that it was due to the fact, that the content of your modal is not destroyed when you click away when the modal closes.

Whenever you change the slugified field yourself - altering the source will have no effect on the slugified field.

This is done by setting a .data field like $target.data('locked', true); . This stays the same - since the DOM does not change. After that - your changes will have no effect when you re-open the modal.

I commited a test and a fix into master branch. I just asserted that a target field can never be "locked" when it is empty and the source field is changed...

Since I am not sure how you include the script: You can use the latest master for testing or:

https://cdn.rawgit.com/madflow/jquery-slugify/master/dist/slugify.min.js

Please test my changes if this resolves your issue. Maybe I missed something...

@Iyongbudiarso
Copy link
Author

Iyongbudiarso commented Oct 7, 2017

Thats perfect. ok @madflow thanks for the advice 🥇 My problem is solved.

For information i setting $('#target_slug').data('locked', false); when opening my modal

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants