Permalink
Browse files

Merge branch 'master' of github.com:howe/ngqa

  • Loading branch information...
wendal committed Feb 27, 2012
2 parents a19994b + 00bf8b2 commit aeefe31d3eaa5dc7adac5fad5373f0b8b0b8ccf2
Showing with 61 additions and 1 deletion.
  1. +1 −1 ROOT/js/application.js
  2. +29 −0 ROOT/js/tag.js
  3. +31 −0 ROOT/tag/one.jsp
View
@@ -21,7 +21,7 @@ function getTagsHTML(tags) {
var questionTags = [];
$.each(tags, function(index, value) {
value = $.trim(value.escapeHTML());
- questionTags.push(String.format('<a href="/tags/{0}">{1}</a>', value, value));
+ questionTags.push(String.format('<a href="./tag/{0}">{1}</a>', value, value));
});
return String.format("Question at {0}", questionTags.join(',&nbsp;'));
}
View
@@ -0,0 +1,29 @@
+$(function() {
+ $.get(window.location + '.json', function(data) {
+ if (data['ok']) {
+ var questionTemplate = '<tr>\
+ <td class="questioner-img">\
+ <img src="../img/img.jpeg" alt="{{ questioner_name }}">\
+ </td>\
+ <td>\
+ <p>{{ questioner_name }}&nbsp;(Question at&nbsp;{{ time }})</p>\
+ <p><a href="../question/{{ id }}">{{ title }}</a></p>\
+ <p>{{{ tags }}}</p>\
+ </td>\
+ </tr>';
+ ich.addTemplate("question", questionTemplate);
+ var question_info;
+ $.each(data['data']['data'], function (index, value) {
+ question_info = {
+ questioner_name : value['user']['id'],
+ time : value['createdAt'],
+ id : value['id'],
+ title : value['title'].escapeHTML(),
+ tags : getTagsHTML(value['tags'])
+ };
+
+ $("#questions").append(ich.question(question_info));
+ });
+ }
+ }, "json");
+});
View
@@ -0,0 +1,31 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@ page import="org.nutz.ngqa.Helpers" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link rel="stylesheet" type="text/css" media="screen" href="${base}/css/include/bootstrap.min.css" />
+<link rel="stylesheet" type="text/css" media="screen" href="${base}/css/login.css" />
+<link rel="stylesheet" type="text/css" media="screen" href="${base}/css/application.css" />
+<script type="text/javascript" src="${base}/js/include/jquery-1.7.1.min.js"></script>
+<script type="text/javascript" src="${base}/js/include/ICanHaz.min.js"></script>
+<script type="text/javascript" src="${base}/js/application.js"></script>
+<script type="text/javascript" src="${base}/js/tag.js"></script>
+<title>Question</title>
+</head>
+<body>
+ <div id="navbar"></div>
+ <div class="container-fluid">
+ <div class="row-fluid">
+ <div class="span8 box">
+ <table class="table" id="questions">
+ </table>
+ </div>
+ <div class="span3" id="infos">
+ <%= Helpers.getInfosHtml() %>
+ </div>
+ </div>
+ <div id="footer" class="footer"></div>
+ </div>
+</body>
+</html>

0 comments on commit aeefe31

Please sign in to comment.