diff --git a/controllers/tag.js b/controllers/tag.js
index 1a17638..f88af59 100644
--- a/controllers/tag.js
+++ b/controllers/tag.js
@@ -31,8 +31,23 @@ exports.list_topic = function(req,res,next){
}
}
}
- res.render('tag/list_topic',{tag:tag,topics:topics,current_page:page,list_topic_count:limit,in_collection:collection,
- hot_topics:hot_topics,no_reply_topics:no_reply_topics,pages:pages});
+
+ if (tag.background=='') {
+ var style = null;
+ } else {
+ var style = '#wrapper {background-image: url("'+tag.background+'")}';
+ }
+
+ res.render('tag/list_topic',{
+ tag:tag,topics:topics,
+ current_page:page,
+ list_topic_count:limit,
+ in_collection:collection,
+ hot_topics:hot_topics,
+ no_reply_topics:no_reply_topics,
+ pages:pages,
+ extra_style:style
+ });
});
}
@@ -110,7 +125,7 @@ exports.add = function(req,res,next){
var description = sanitize(req.body.description).trim();
description = sanitize(description).xss();
var background = sanitize(req.body.background).trim();
- background = sanitize(description).xss();
+ background = sanitize(background).xss();
var order = req.body.order;
if(name == ''){
@@ -162,6 +177,8 @@ exports.edit = function(req,res,next){
var name = sanitize(req.body.name).trim();
name = sanitize(name).xss();
var order = req.body.order;
+ var background = sanitize(req.body.background).trim();
+ background = sanitize(background).xss();
var description = sanitize(req.body.description).trim();
description = sanitize(description).xss();
if(name == ''){
@@ -170,6 +187,7 @@ exports.edit = function(req,res,next){
}
tag.name = name;
tag.order = order;
+ tag.background = background;
tag.description = description;
tag.save(function(err){
if(err) return next(err);
diff --git a/views/layout.html b/views/layout.html
index 1703e6e..26b39d6 100644
--- a/views/layout.html
+++ b/views/layout.html
@@ -15,6 +15,11 @@
+ <% if (locals.extra_style) { %>
+
+ <% } %>