Add permalink field in poi new form
This commit is contained in:
parent
5c2f9dda2a
commit
f0b82ddb3d
|
@ -158,6 +158,10 @@ form.form input[type=radio]+label img {
|
|||
font-style: italic;
|
||||
}
|
||||
|
||||
#permalink {
|
||||
width: calc(100% - 20px);
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
Controls of the map
|
||||
*****************************************/
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue