[tor-commits] [pups/master] restricting comments in tokens.html

colin at torproject.org colin at torproject.org
Fri May 23 00:37:09 UTC 2014


commit 705ced583c61570bfba46f71e0e8745f5da44504
Author: Sherief Alaa <sheriefalaa.w at gmail.com>
Date:   Thu May 22 20:12:08 2014 +0300

    restricting comments in tokens.html
---
 webchat/templates/tokens.html |   32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/webchat/templates/tokens.html b/webchat/templates/tokens.html
index b8aaf8c..be24b3b 100644
--- a/webchat/templates/tokens.html
+++ b/webchat/templates/tokens.html
@@ -8,6 +8,18 @@
 {% block script %}
   <script type="text/javascript" src="/static/js/jquery.min.js"></script>
   <script src="/static/js/bootstrap.min.js"></script>
+  <script type="text/javascript">
+  $(document).ready (function (){
+    $(".comment").html(function(){
+      $(this).html($(this).text().substring(0,35) 
+        + ' <span data-toggle="modal" data-target="#comment-modal" style="color:blue; font-size:80%;"> Read more..</span>');
+    });
+  });
+
+    function full_comment(id){
+      $(".comment-modal-body").html($("#full-comment-" + id).val());
+    }
+  </script>
 {% endblock script %}
 {% block content %}
 {% include "nav_bar.html" %}
@@ -42,12 +54,30 @@
       <td><input name="selected_list" type="checkbox" value="{{token.token}}"></td>
       <td>https://{{url}}/chat/{{token.token}}</td>
       <td>{{token.expires_at|date:"Y-m-d G:i"}}</td>
-      <td>{{token.comment}}</td>
+      <td class="comment" onclick="full_comment({{token.t_id}});">{{token.comment}}</td>
     </tr>
+    <input id="full-comment-{{token.t_id}}" type="hidden" value="{{token.comment}}">
  {% endfor %}
   </table>
  <input name="revoke" type="submit" class="btn btn-default" value="Revoke Selected">
 </form>
 
+<div class="modal fade" id="comment-modal" tabindex="-1" role="dialog" aria-labelledby="Comment" aria-hidden="true">
+  <div class="modal-dialog">
+    <div class="modal-content">
+      <div class="modal-header">
+        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+        <h4 class="modal-title" id="myModalLabel">Comment</h4>
+      </div>
+      <div>
+        <p class="comment-modal-body"></p>
+      </div>
+      <div class="modal-footer">
+        <button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
+      </div>
+    </div>
+  </div>
+</div>
+
 {% include "footer.html" %}
 {% endblock content %}
\ No newline at end of file





More information about the tor-commits mailing list