Add permalink field in poi new form
This commit is contained in:
@@ -118,12 +118,34 @@
|
||||
updateForm($(this).prev().val());
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<p id="abstract"></p>
|
||||
<div id="specific_form"></div>
|
||||
|
||||
<? if(isset($new) AND $new==1) { ?>
|
||||
<input type="text" name="permalink" id="permalink" placeholder="Lien permanent" required>
|
||||
<? } ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$( "#name" ).keyup(function() {
|
||||
permalink = $( "#name" ).val();
|
||||
permalink = permalink.replace(/ /g,'_');
|
||||
permalink = permalink.toLowerCase();
|
||||
permalink = permalink.replace(/[^a-z0-9_]/g,'-');
|
||||
permalink = permalink.replace(/[_-]+$/g,'');
|
||||
$( "#permalink" ).val(permalink);
|
||||
});
|
||||
$( "#name" ).change(function() {
|
||||
permalink = $( "#name" ).val();
|
||||
permalink = permalink.replace(/ /g,'_');
|
||||
permalink = permalink.toLowerCase();
|
||||
permalink = permalink.replace(/[^a-z0-9_]/g,'-');
|
||||
permalink = permalink.replace(/[_-]+$/g,'');
|
||||
$( "#permalink" ).val(permalink);
|
||||
});
|
||||
</script>
|
||||
|
||||
<input name="submit" id="submit" type="submit" value="Ajouter l'hébergement">
|
||||
</form>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user