Rename files to have slug

master
Buddy Sandidge 10 years ago
parent 180ea98786
commit 5325e50274

@ -10,12 +10,7 @@ define(['underscore', 'backbone'], function SlideModelDefine(_, Backbone) {
_.extend(SlideModel.prototype, { _.extend(SlideModel.prototype, {
url: function url() { url: function url() {
var id = this.get('id'); return '/slide/' + this.get('id');
if (id < 10) {
return '/slide/0' + id;
} else {
return '/slide/' + id;
}
} }
}); });

@ -61,7 +61,7 @@ function getMarkdownFiles(cb) {
} }
files.sort(); files.sort();
var markdownFiles = _.filter(files, function (file) { var markdownFiles = _.filter(files, function (file) {
return /^\d+\.md$/.test(file); return /\.md$/.test(file);
}); });
cb(null, markdownFiles); cb(null, markdownFiles);
}); });

@ -6,7 +6,7 @@ define(['widgets/slide/model'], function (SlideModel) {
describe('→ url', function () { describe('→ url', function () {
it('→ with slide id 1', function () { it('→ with slide id 1', function () {
expect((new SlideModel({id: 1})).url()).toBe('/slide/01'); expect((new SlideModel({id: 1})).url()).toBe('/slide/1');
}); });
it('→ with slide id 10', function () { it('→ with slide id 10', function () {

Loading…
Cancel
Save