Browse files

...

  • Loading branch information...
1 parent 53728ce commit 8f6608808b613a3911672db54f8014f7adfe1af2 @wendal wendal committed Feb 24, 2012
Showing with 4 additions and 4 deletions.
  1. +1 −1 ROOT/js/application.js
  2. +0 −2 conf/mongo_js/tags.js
  3. +3 −1 src/org/nutz/ngqa/module/CoreModule.java
View
2 ROOT/js/application.js
@@ -130,7 +130,7 @@ function tagsInfoHTML() {
var tagsTemplate = '<div class="box">\
<ul>\
{{#tags}}\
- <li><a href="./tags/{{ name }}">{{ name }}</a>({{ count }})</li>\
+ <li><a href="./tag/{{ name }}">{{ name }}</a>({{ count }})</li>\
{{/tags}}\
</ul>\
</div>';
View
2 conf/mongo_js/tags.js
@@ -3,8 +3,6 @@ function() {
db.question.find().forEach(
function(obj) {
if (obj['tags'].length > 0) {
- print(obj['tags']);
- print(typeof(obj['tags']));
for (var i = 0; i <obj['tags'].length; i++) {
var tag = obj['tags'][i] ;
if (result[tag]) {
View
4 src/org/nutz/ngqa/module/CoreModule.java
@@ -49,7 +49,8 @@ public AjaxReturn createQuestion(final @Param("..")Question question, @Attr("me"
question.setUser(user);
question.setCreatedAt(new Date());
question.setUpdatedAt(new Date());
- question.setTags(new String[0]);
+ if (question.getTags() == null)
+ question.setTags(new String[0]);
question.setAnswers(new Answer[0]);
dao.runNoError(new Callback<DB>() { //以安全方式执行,其实就是执行完毕后,执行getError来确保顺利完成
public void invoke(DB arg0) {
@@ -155,6 +156,7 @@ public Object update(String questionId, @Param("..")Question question, @Attr("me
/**统计全体Tag的数量*/
@At("/tags")
@Ok("smart:/tag")
+ @Filters() //查询无需任何权限
public Object tags() {
final Object[] objs = new Object[1];
dao.run(new Callback<DB>() {

0 comments on commit 8f66088

Please sign in to comment.