Permalink
Browse files

Separated category view into single file to include when needed

  • Loading branch information...
1 parent 68a235e commit c5fad80b2ac53675db5db264016a29ab4bb71789 @SlashmanX committed Apr 1, 2013
View
@@ -15,7 +15,10 @@ module.exports = function(app, exp) {
app.set('views', app.root + '/server/views');
app.set('view engine', 'jade');
app.set('view options', { doctype : 'html', pretty : true });
- app.use(exp.bodyParser());
+ var bundle = browserify().use(browserijade(app.root + '/server/views/partials'));
+ bundle.addEntry(app.root + '/public/js/app.js');
+ app.use(bundle);
+ app.use(exp.bodyParser());
app.use(expressValidator);
app.use(exp.cookieParser('I am not wearing any pants'));
app.use(exp.session({
File renamed without changes.
View
@@ -1,5 +1,4 @@
extends layout
-
block content
.span3.bs-docs-sidebar
ul.nav.nav-list.bs-docs-sidenav
@@ -15,29 +14,8 @@ block content
span.sidenav-badge= forum.unRead
| !{forum.name}
.span9.home-categories.xforum
- .home-category
- .row(id = 'cat-' + category.slug).display-head
- a(href= '/category/'+ category.slug+'/').display-title #{category.name}
- .row.display-headings
- .span9
- .span1 Status
- .span4 Forum
- .span1 Topics
- section.home-category-forums
- each forum in category.forums
- if forum.parent == null
- .row.display-row(id = 'forum-' + forum.slug)
- .span9
- .span1
- if forum.isRead
- i.icon-folder-open
- else
- i.icon-folder-close
- .span4
- a(href = '/forum/'+forum.slug+'/') #{forum.name}
- p.help-block.display-subtitle= forum.desc
- .span1.home-category-num-topics= forum.topics.length
+ include partials/category
block append scripts
- script(src='/js/views/home.js')
+ script(src='/js/views/category.js')
script(src='/js/controllers/homeController.js')
View
@@ -18,47 +18,9 @@ block content
| !{forum.name}
.span9.home-categories.xforum
- for cat in categories
- if cat.forums.length
- .home-category
- .row(id = 'cat-' + cat.slug).display-head
- a(href= '/category/'+ cat.slug+'/').display-title #{cat.name}
-
- .row.display-headings
- .span9
- .span1 Status
- .span4 Forum
- .span1 Topics
- .span2 Last Post
-
- section.home-category-forums
- each forum in cat.forums
- if forum.parent == null
- .row.display-row(id = 'forum-' + forum._id)
- .span9
- .span1.forum-read-status
- if forum.isRead
- i.icon-folder-open
- else
- i.icon-folder-close
-
- .span4
- a(href = '/forum/'+ forum.slug +'/') #{forum.name}
- p.help-block.display-subtitle= forum.desc
-
- .span1.home-category-num-topics= forum.topics.length
-
- .span2.topic-last-post
- if(forum.lastPostTopic)
- abbr.timeago.home-category-last-post-time(title = forum.lastPostTopic.lastPost)= forum.lastPostTopic.lastPost
- br
- b In: 
- a(href = '/topic/'+ forum.lastPostTopic.slug +'/#post-'+ forum.lastPostTopic.replies[0]._id).home-category-last-post-link
- span.home-category-last-post-topic= forum.lastPostTopic.title
- br
- b By: 
- span.home-category-last-post-author= forum.lastPostTopic.replies[0].author.username
+ for category in categories
+ include partials/category.jade
block append footer-scripts
- script(src='/js/views/home.js')
+ script(src='/js/views/category.js')
script(src='/js/controllers/homeController.js')
@@ -0,0 +1,39 @@
+if category.forums.length
+ .home-category
+ .row(id = 'cat-' + category.slug).display-head
+ a(href= '/category/'+ category.slug+'/').display-title #{category.name}
+
+ .row.display-headings
+ .span9
+ .span1 Status
+ .span4 Forum
+ .span1 Topics
+ .span2 Last Post
+
+ section.home-category-forums
+ each forum in category.forums
+ if forum.parent == null
+ .row.display-row(id = 'forum-' + forum._id)
+ .span9
+ .span1.forum-read-status
+ if forum.isRead
+ i.icon-folder-open
+ else
+ i.icon-folder-close
+
+ .span4
+ a(href = '/forum/'+ forum.slug +'/') #{forum.name}
+ p.help-block.display-subtitle= forum.desc
+
+ .span1.home-category-num-topics= forum.topics.length
+
+ .span2.topic-last-post
+ if(forum.lastPostTopic)
+ abbr.timeago.home-category-last-post-time(title = forum.lastPostTopic.lastPost)= forum.lastPostTopic.lastPost
+ br
+ b In: 
+ a(href = '/topic/'+ forum.lastPostTopic.slug +'/#post-'+ forum.lastPostTopic.replies[0]._id).home-category-last-post-link
+ span.home-category-last-post-topic= forum.lastPostTopic.title
+ br
+ b By: 
+ span.home-category-last-post-author= forum.lastPostTopic.replies[0].author.username

0 comments on commit c5fad80

Please sign in to comment.