Created
August 3, 2015 14:01
-
-
Save vs0uz4/f4a57dae040e3d240520 to your computer and use it in GitHub Desktop.
JS view Link, using modal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function($) | |
{ | |
'use strict'; | |
$(document).ready(function() { | |
/* | |
Link View - link.js | |
*/ | |
window.console.log('Link View - link.js'); | |
/* | |
linkCreateModal Show Function | |
*/ | |
$('#linkCreateModal').on('shown.bs.modal', function (event) { | |
var button = $(event.relatedTarget) // Botão que acionou o modal | |
var href = button.data('href') // Conteúdo do atributo data-href | |
var modalTitle = button.data('modal-title') // Conteúdo do atributo data-modal-title | |
var modal = $(this) // Modal que foi acionado | |
modal.find('.modal-title').text(modalTitle) // Change h4.modalTitle text | |
modal.find('.modalForm').attr('action', href) // Change action form attribute | |
$('#description').focus() | |
}) | |
/* | |
linkDeleteModal Show Function | |
*/ | |
$('#linkDeleteModal').on('shown.bs.modal', function (event) { | |
var button = $(event.relatedTarget) // Botão que acionou o modal | |
var href = button.data('href') // Conteúdo do atributo data-href | |
var modalTitle = button.data('modal-title') // Conteúdo do atributo data-modal-title | |
var modal = $(this) // Modal que foi acionado | |
modal.find('.modal-title').text(modalTitle) // Change h4.modalTitle text | |
modal.find('.modalForm').attr('action', href) // Change action form attribute | |
}) | |
}) | |
})(window.jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment