Skip to content

Commit a426ab5

Browse files
author
Matt Karl
committed
Externalized default template
1 parent cd134c6 commit a426ab5

File tree

14 files changed

+78
-86
lines changed

14 files changed

+78
-86
lines changed

.gitignore

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,16 @@ docs
66
*.log
77
*.map
88
deploy/assets/js/captions.js
9-
109
deploy/assets/js/main.js
11-
1210
deploy/assets/js/remote.js
13-
1411
deploy/tasks-test.html
15-
1612
deploy/assets/js/tasks.js
17-
1813
deploy/assets/js/libraries.js
19-
2014
deploy/assets/css/tasks.css
21-
2215
deploy/assets/css/remote.css
23-
2416
deploy/assets/css/main.css
25-
2617
deploy/assets/css/libraries.css
27-
2818
deploy/assets/css/captions.css
29-
3019
deploy/assets/css/new.css
31-
3220
deploy/assets/js/new.js
21+
deploy/assets/templates/default

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"wavesurfer.js": "*",
1212
"underscore": "~1.7.0",
1313
"node-webkit-app": "*",
14-
"sortable": "farhadi/html5sortable"
14+
"sortable": "farhadi/html5sortable",
15+
"default": "https://github.com/SpringRoll/SpringRollTemplate.git"
1516
}
1617
}
Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1-
# _className_ (*_name_*)
1+
# SpringRollTemplate
22

3-
This project was started using [SpringRoll Studio](https://github.com/springroll/SpringRollStudio) with template _templateName_ (_templateVersion_).
3+
Default template for the [SpringRoll Studio](https://github.com/SpringRoll/SpringRollStudio) application.
4+
5+
## Extending
6+
7+
You create your own Template based on the default template. Create **springroll-template.json** within your project (example below).
8+
9+
```js
10+
{
11+
// The human-readible name of the template
12+
"name" : "Custom Template",
13+
14+
// A unique bundle id for the template
15+
"id" : "com.example.customtemplate",
16+
17+
// The version of the template
18+
"version" : "1.0.0",
19+
20+
// Tagged releases will get auto-updated
21+
// from Github if the username/repo is set
22+
"github": "username/CustomTemplate",
23+
24+
// This is required to extend!
25+
"extend": "io.springroll.default"
26+
}
27+
```

deploy/assets/templates/default/bower.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

deploy/assets/templates/default/springroll-template.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
"name" : "Default",
33
"id" : "io.springroll.default",
44
"version" : "1.2.0",
5+
"github": "SpringRoll/SpringRollTemplate",
56
"rename" : {
67
"gitignore" : ".gitignore",
7-
"bowerrc" : ".bowerrc"
8+
"bowerrc" : ".bowerrc",
9+
"project.md": "README.md",
10+
"bower": "bower.json"
811
},
912
"required": ["springroll.Core"],
1013
"modules": [
@@ -135,4 +138,4 @@
135138
"default": false
136139
}
137140
]
138-
}
141+
}

package.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
2-
"name": "SpringRollStudio",
3-
"private": true,
4-
"version": "0.2.0-alpha.4",
5-
"dependencies": {
6-
"grunt": "~0.4.5",
7-
"grunt-exec": "~0.4.6",
8-
"grunt-node-webkit-builder": "~1.0.0",
9-
"lodash": "~3.0.0",
10-
"project-grunt": "*"
11-
}
12-
}
2+
"name": "SpringRollStudio",
3+
"private": true,
4+
"version": "0.2.0-alpha.4",
5+
"dependencies": {
6+
"grunt": "~0.4.5",
7+
"grunt-contrib-copy": "^0.7.0",
8+
"grunt-exec": "~0.4.6",
9+
"grunt-node-webkit-builder": "~1.0.0",
10+
"lodash": "~3.0.0",
11+
"project-grunt": "*"
12+
}
13+
}

src/springroll/captions/Captions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
};
167167

168168
// Reference to the prototype
169-
var p = Captions.prototype = Object.create(Module.prototype);
169+
var p = extend(Captions, Module);
170170

171171
/**
172172
* The default width of a new caption in ms

src/springroll/new/NewProject.js

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
this.namespace.val(localStorage.getItem('namespace') || "");
114114

115115
// Restrict the input
116-
$('input[data-restrict]').keyup(function(e){
116+
$('input:data(restrict)').keyup(function(e){
117117
var input = $(this),
118118
restrict = new RegExp("[^" + input.data('restrict') + "]"),
119119
value = input.val(),
@@ -124,41 +124,10 @@
124124
input.val(newValue);
125125
}
126126
});
127-
128-
// Hide the unsupported modules for native display
129-
/*var noNative = $('.no-native input');
130-
var optional = $('.optional input');*/
131-
132-
/*this.displays = $(".display:checkbox").change(function(){
133-
134-
// Get the selected displays
135-
var displays = this.getDisplays();
136-
137-
optional.removeAttr('disabled')
138-
.prop('checked', true)
139-
.parent()
140-
.removeClass('disabled');
141-
142-
// Display modules if only the native display is selected
143-
if (displays.length === 1 && $("#native").prop('checked'))
144-
{
145-
noNative.prop('checked', false)
146-
.attr('disabled', true)
147-
.parent()
148-
.addClass('disabled');
149-
}
150-
else if (displays.length === 0)
151-
{
152-
optional.attr('disabled', true)
153-
.prop('checked', false)
154-
.parent()
155-
.addClass('disabled');
156-
}
157-
}.bind(this));*/
158127
};
159128

160129
// Reference to the prototype
161-
var p = NewProject.prototype = Object.create(Module.prototype);
130+
var p = extend(NewProject, Module);
162131

163132
Object.defineProperty(p, 'enabled', {
164133
set : function(enabled)

src/springroll/new/Template.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@
8484
*/
8585
this.extend = data.extend || null;
8686

87+
/**
88+
* The username/repo for github
89+
* @property {string} github
90+
*/
91+
this.github = data.github || null;
92+
8793
/**
8894
* The parent template
8995
* @property {springroll.new.Template} parent

src/springroll/new/TemplateManager.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -401,15 +401,13 @@
401401
}
402402
}
403403

404+
// First-Time run, copy the default template
405+
// to the setting folder
404406
if (!this.templates)
405407
{
406-
// Create the default template
407-
var template = new Template(path.join('assets','templates','default'));
408-
409-
// Create the templates object
410408
this.templates = {};
411-
this.templates[template.id] = template;
412-
this.save();
409+
this.addTemplate(path.join('assets','templates','default'));
410+
return;
413411
}
414412

415413
// Load the existing templates
@@ -461,7 +459,7 @@
461459
* @param {array} tags List of github tag objects
462460
*/
463461
p.getTemplateTags = function(template, tags)
464-
{
462+
{
465463
var message = "A new version of " + template.name + " is available, update?";
466464
for (var i = 0; i < tags.length; i++)
467465
{

0 commit comments

Comments
 (0)