Skip to content

Commit c4a440a

Browse files
committed
Using initialization config instead of json file
1 parent 432da73 commit c4a440a

File tree

4 files changed

+55
-44
lines changed

4 files changed

+55
-44
lines changed

hicbrowser/client/html/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,15 @@
6262
<!-- build:js /static/js/App.js -->
6363
<script src="../static/js/App.js"></script>
6464
<!-- /build -->
65+
66+
<script>
67+
68+
App.init({
69+
browser_example: 'X:3800000-4340000',
70+
gene_example: 'mof',
71+
icon: '/static/img/fly.svg'
72+
});
73+
74+
</script>
75+
6576
</html>

hicbrowser/client/index.js

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,56 +12,46 @@ var GeneView = require('./js/views/gene');
1212
var BrowserView = require('./js/views/browser');
1313
var Intro = require('./js/views/intro-header');
1414

15-
function initViews(){
16-
// Render initial views
17-
App.views.intro.render(App.config);
18-
App.views.search.render(App.config);
19-
}
20-
2115
App = {};
2216

23-
App.init = function(){
24-
25-
//Views
26-
App.views = {};
27-
App.views.loading = new Loading({el:'body'});
28-
App.views.search = new Search({el:'#search'});
29-
App.views.index = new Index({el:'#content'});
30-
App.views.gene = new GeneView({el:'#content'});
31-
App.views.browser = new BrowserView({el:'#content'});
32-
App.views.intro = new Intro({el:'.intro-header'});
33-
34-
// Models
35-
App.models = {};
36-
App.models.Gene = require('./js/models/gene');
37-
App.models.Browser = require('./js/models/browser');
38-
App.models.Config = require('./js/models/config');
39-
40-
// Init config with defaults
17+
//Views
18+
App.views = {};
19+
App.views.loading = new Loading({el:'body'});
20+
App.views.search = new Search({el:'#search'});
21+
App.views.index = new Index({el:'#content'});
22+
App.views.gene = new GeneView({el:'#content'});
23+
App.views.browser = new BrowserView({el:'#content'});
24+
App.views.intro = new Intro({el:'.intro-header'});
25+
26+
// Models
27+
App.models = {};
28+
App.models.Gene = require('./js/models/gene');
29+
App.models.Browser = require('./js/models/browser');
30+
App.models.Config = require('./js/models/config');
31+
32+
//Router
33+
App.router = require('./js/router');
34+
35+
// listen to ajax
36+
$(document).ajaxStart(function() {
37+
App.views.loading.show();
38+
}).ajaxStop(function() {
39+
setTimeout(App.views.loading.hide, 800);
40+
});
41+
42+
App.init = function(config){
43+
44+
// Init config
4145
App.config = new App.models.Config();
42-
43-
// See if there is a config file defined.
44-
// If not, load app with defaults
45-
App.config.fetch({
46-
success: initViews,
47-
error: initViews
48-
});
49-
50-
//Router
51-
App.router = require('./js/router');
52-
53-
// listen to ajax
54-
$(document).ajaxStart(function() {
55-
App.views.loading.show();
56-
}).ajaxStop(function() {
57-
setTimeout(App.views.loading.hide, 800);
58-
});
46+
App.config.set(config);
5947

6048
// Render loading
6149
App.views.loading.render();
6250

6351
// Select all elements with data-toggle="tooltips" in the document
6452
$('[data-toggle="tooltip"]').tooltip();
65-
};
6653

67-
App.init();
54+
// Render initial views
55+
App.views.intro.render(App.config);
56+
App.views.search.render(App.config);
57+
};

hicbrowser/static/json/config.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

hicbrowser/templates/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,15 @@
5656

5757
</body>
5858
<script src="/static/js/App.js"></script>
59+
60+
<script>
61+
62+
App.init({
63+
browser_example: 'X:3800000-4340000',
64+
gene_example: 'mof',
65+
icon: '/static/img/fly.svg'
66+
});
67+
68+
</script>
69+
5970
</html>

0 commit comments

Comments
 (0)