Permalink
Browse files

tags

  • Loading branch information...
1 parent f3a077a commit c33fcfa43fc46ba162b20c9e152442a89efcb62d sunxinyu committed Aug 7, 2015
Showing with 54 additions and 2 deletions.
  1. +1 −1 controllers/index.js
  2. +8 −0 controllers/tag.js
  3. +10 −0 filters/tag/all-tags-index.js
  4. +1 −1 filters/tag/all-tags.js
  5. +4 −0 models/tags.js
  6. +30 −0 views/index.jade
@@ -580,7 +580,7 @@
get: ['checkLogin', "checkCard"]
},
"/": {
- get: ['freshLogin', "index/actives", "index/recent_articles", "index/recent_questions", "index/recent_topics", 'index/recent_columns', 'index/all_tags', 'index/all_topic_tags', 'index/recent_users', 'all_count', 'index/article_top_users', 'index/answer_top_users', 'index/topic_top_users']
+ get: ['freshLogin', "index/actives", "index/recent_articles","tag/all-tags-index", "index/recent_questions", "index/recent_topics", 'index/recent_columns', 'index/all_tags', 'index/all_topic_tags', 'index/recent_users', 'all_count', 'index/article_top_users', 'index/answer_top_users', 'index/topic_top_users']
},
"/card/:id/zan": {
post: ['checkLoginJson']
View
@@ -14,6 +14,11 @@
return res.render('tag/index.jade');
}
},
+ '.json': {
+ get: function(req, res, next) {
+ return res.send(res.locals.tags)
+ }
+ },
"/add": {
get: function(req, res, next) {
return res.render('tag/add.jade');
@@ -120,6 +125,9 @@
"/": {
get: ['freshLogin', 'tag/all-tags']
},
+ ".json": {
+ get: [ 'tag/all-tags']
+ },
"/:id": {
get: ['freshLogin']
},
@@ -0,0 +1,10 @@
+// Generated by CoffeeScript 1.9.3
+(function() {
+ module.exports = function(req, res, next) {
+ return (__F('tag')).getAll(1, 200, null, "sort desc,id desc", function(error, tags) {
+ res.locals.index_tags = tags;
+ return next();
+ });
+ };
+
+}).call(this);
@@ -1,7 +1,7 @@
// Generated by CoffeeScript 1.9.3
(function() {
module.exports = function(req, res, next) {
- return (__F('tag')).getAll(1, 200, null, "qa_count desc,id desc", function(error, tags) {
+ return (__F('tag')).getAll(1, 200, null, "sort desc,id desc", function(error, tags) {
res.locals.tags = tags;
return next();
});
View
@@ -19,6 +19,10 @@
comment_count: {
type: "int",
defaultValue: 0
+ },
+ sort:{
+ type:"int",
+ defaultValue:10
}
};
View
@@ -8,6 +8,32 @@ html
#bdshare a{}
.textwidget div{float:left;line-height: 30px;font-size:14px;margin-right: 20px;}
.textwidget div em{font-style:normal;color:#999;font-weight: bold;}
+ .tags-mod{
+ overflow:hidden;
+ height:35px;
+ padding:4px;
+ margin:20px 0;
+ margin-bottom:0;
+ border:1px solid #ddd;
+ background:#fff;
+ border-bottom:0;
+ }
+ .tags-mod .tag{
+ display:inline-block;
+ padding:0px 20px;
+ line-height:35px;
+ font-size:13px;
+ background:#fff;
+ color:#444;
+ }
+ .tags-mod .tag:hover{
+ background:#ef6f67;
+ text-decoration:none;
+ color:#fff;
+ }
+ #content .article-mod{
+ border-top:1px solid #efefef;
+ }
script(src='#{assets_head}/js/bootstrap/bootstrap-tooltip.js')
script(src='#{assets_head}/js/lazyload.js')
@@ -34,6 +60,10 @@ html
//- .module(style="padding:0;background:none;border:none;margin-top:10px;")
//- a(href="https://talk.ai/site/?utm_source=html-js&utm_medium=banner",target="_blank")
//- img(src="http://htmljs.b0.upaiyun.com/uploads/1432604103852-422192f75540b8cc37518bdbff89efc8.jpg",style="width:100%;")
+ if locals.index_tags
+ .tags-mod
+ each tag in index_tags
+ a.tag(href="/tag/#{tag.id}/articles") #{tag.name}
if locals.articles
.module.article-mod.mod
.lft

0 comments on commit c33fcfa

Please sign in to comment.