Skip to content

Commit

Permalink
Getting alphanum, lowercase titles.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Nov 28, 2011
1 parent 3782cc1 commit b98b750
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion views/Layer.bones
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,15 @@ view.prototype.browse = function(ev) {
model: model,
favorites: this.favorites,
change: function(uri) {
$('input[name=file], input[name=connection]', form).val(val);
$('input[name=file], input[name=connection]', form).val(uri);
if ($('input[name=id]', form).val() == '') {
// Get the 'basename' of the file, minus anything
// after the first dot, in alphanumeric
// and lowercase.
$('input[name=id]', form).val(
_(uri.split('/')).last().split('.')[0]
.replace(/[^a-z0-9]/gi,'').toLowerCase());
}
},
el: $('.browser', form)
});
Expand Down

0 comments on commit b98b750

Please sign in to comment.