diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-04-13 18:30:24 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-04-13 18:32:27 -0400 |
| commit | 58b62a1d76298a568aa0ded39f986477f889b793 (patch) | |
| tree | 09748866101c59b3c5d4c4ffaa9555210793f81b /themes/okadmin/public/js/app.js | |
| parent | d45f617dc74a07beb352d04537d47a77193f487f (diff) | |
use type and id for frontend lookups
Diffstat (limited to 'themes/okadmin/public/js/app.js')
| -rw-r--r-- | themes/okadmin/public/js/app.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/themes/okadmin/public/js/app.js b/themes/okadmin/public/js/app.js index 009fe4c..b53d21f 100644 --- a/themes/okadmin/public/js/app.js +++ b/themes/okadmin/public/js/app.js @@ -51,7 +51,7 @@ var OKAdmin = function(){ // fix post indexing in list-driven inputs $(".main.resource form").submit(function(e){ - var $id = $("[name=id]"), $title = $("[name=title]") + var $id = $("[name=id]"), $title = $("[name=title]"), $shortname = $("[name=shortname]") if ($title.length && ! $title.val()) { alert("Please enter a title") @@ -60,6 +60,11 @@ var OKAdmin = function(){ return } + if ($shortname.length && ! $shortname.val()) { + $shortname.val( $title.val() ) + return + } + var slug = slugify( $title.val() ) $id.val( slug ) @@ -136,4 +141,4 @@ $(function(){ }) -function slugify (s){ return (s || "").toLowerCase().replace(/\s/g,"-").replace(/[^-_a-zA-Z0-9]/g, '-').replace(/-+/g,"-") } +function slugify (s){ return (s || "").toLowerCase().replace(/\s/g,"-").replace(/[^-_a-zA-Z0-9]/g, '-').replace(/-+/g, "-") } |
