Skip to content

Commit 7bef747

Browse files
committed
Bug Fix: Fix tags
1 parent 5de64cd commit 7bef747

File tree

6 files changed

+55
-53
lines changed

6 files changed

+55
-53
lines changed

_layouts/default.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,9 @@
108108
</div>
109109
<script src="/assets/js/lib/jquery/jquery.js"></script>
110110
<script src="/assets/js/bootstrap.min.js"></script>
111-
{% if layout.tag_app %}
112111
<script src="/assets/js/lib/handlebars/handlebars.js"></script>
113112
<script src="/assets/js/lib/ember/ember.js"></script>
114113
<script src="/assets/js/tags.js"></script>
115-
{% endif %}
116-
{% unless layout.nocomments %}
117114
<script type="text/javascript">
118115
setTimeout(function() {
119116
var disqus_shortname = 'mattjmorrison';
@@ -122,7 +119,6 @@
122119
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
123120
}, 1000);
124121
</script>
125-
{% endunless %}
126122
<script>
127123
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
128124
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

archive/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
layout: default
33
title: mattjmorrison.com
4-
nocomments: true
54
---
65

76
<ul class="nav nav-tabs nav-stacked">

assets/js/tags.coffee

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

assets/js/tags.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
var App = Ember.Application.create({
2+
rootElement: '#tags-application'
3+
});
4+
5+
6+
App.Router.map(function() {
7+
this.resource("index", {path: "/"}, function() {
8+
this.resource("tag", {path: "/:tag"});
9+
});
10+
});
11+
12+
13+
App.TagRoute = Ember.Route.extend({
14+
model: function(params) {
15+
return this.modelFor('index').filter(function(item) {
16+
if(params.tag == item.tag) {
17+
item.set('selected', true);
18+
return item;
19+
}
20+
item.set('selected', false);
21+
return;
22+
})[0];
23+
}
24+
});
25+
26+
27+
App.IndexRoute = Ember.Route.extend({
28+
model: function(params) {
29+
return App.Tag.find();
30+
}
31+
});
32+
33+
34+
App.Tag = Ember.Object.extend({
35+
selected: false
36+
}).reopenClass({
37+
find: function(){
38+
return new Ember.RSVP.Promise(function(resolve, reject) {
39+
$.ajax({
40+
url: '/tags/data.js',
41+
dataType: 'json'
42+
}).done(function(response){
43+
Ember.run(function(){
44+
var tags = Ember.A([]);
45+
response.forEach(function(result) {
46+
tags.pushObject(App.Tag.create(result));
47+
});
48+
resolve(tags);
49+
});
50+
}).fail(function(response){
51+
reject(reesponse);
52+
});
53+
});
54+
}
55+
});

index.markdown

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
layout: default
33
title: mattjmorrison.com
4-
nocomments: true
54
---
65

76
<div class="well">

tags/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
layout: default
33
title: mattjmorrison.com tags
4-
nocomments: true
5-
tag_app: true
64
---
75

86
{% raw %}

0 commit comments

Comments
 (0)