summaryrefslogtreecommitdiff
path: root/static/website
diff options
context:
space:
mode:
authorJayaram Pai2013-12-11 15:31:24 +0530
committerJayaram Pai2013-12-11 15:31:24 +0530
commit3a680b5d2442268ab117c0f98f21a039d4544bd8 (patch)
treead3b7e40a99cea53d63d0dc9e5fe216178dff7b9 /static/website
parent0dd964ec05401809a408ab55d5517d3b2fba3a85 (diff)
downloadFOSSEE-Forum-3a680b5d2442268ab117c0f98f21a039d4544bd8.tar.gz
FOSSEE-Forum-3a680b5d2442268ab117c0f98f21a039d4544bd8.tar.bz2
FOSSEE-Forum-3a680b5d2442268ab117c0f98f21a039d4544bd8.zip
base one
Diffstat (limited to 'static/website')
-rw-r--r--static/website/css/main.css42
-rw-r--r--static/website/js/thread-user.js32
-rw-r--r--static/website/templates/base.html14
-rw-r--r--static/website/templates/get-question.html23
-rw-r--r--static/website/templates/index.html30
-rw-r--r--static/website/templates/notifications.html33
-rw-r--r--static/website/templates/notify.html7
-rw-r--r--static/website/templates/user-questions.html36
-rw-r--r--static/website/templates/user-replies.html36
9 files changed, 219 insertions, 34 deletions
diff --git a/static/website/css/main.css b/static/website/css/main.css
index 7a58a4c..a5f8c81 100644
--- a/static/website/css/main.css
+++ b/static/website/css/main.css
@@ -1,3 +1,8 @@
+/* override bootstrap */
+.navbar>.container .navbar-brand {
+ margin-left: 0;
+}
+/* main styles */
.container {
max-width: 970px;
}
@@ -22,7 +27,7 @@
}
#content .editable {
padding: 15px 5px 15px 5px;
- background: lightyellow;
+ background: #F0F0F0;
}
#content .question .title a{
padding: 0 0 7px 0;
@@ -60,12 +65,14 @@
background: #f5f5f5;
color: #424242;
}
-#content .question .user {
+#content .question .meta{
position: absolute;
right: 0px;
bottom: 0px;
- padding: 2px 7px;
+}
+#content .question .user{
background: #f5f5f5;
+ padding: 2px 7px;
}
#similar-link {
display: none;
@@ -92,7 +99,8 @@
#content .reply {
position: relative;
border-bottom: 1px solid #f5f5f5;
- padding: 20px 0;
+ padding-top: 20px;
+ padding-bottom: 20px;
margin: 10px 0px;
}
#content .reply .body {
@@ -114,3 +122,29 @@
.field_error {
border: 1px solid red;
}
+.notification {
+ position: relative;
+ padding: 15px;
+ margin: 10px 0;
+ border-left: 2px solid #424242;
+ background: #f7f7f7;
+}
+.notification .remove {
+ position: absolute;
+ right: 10px;
+ top: 15px;
+}
+.my-question,
+.my-reply {
+ position: relative;
+ margin: 10px auto;
+ padding: 15px;
+ border-left: 2px solid #424242;
+ background: #f7f7f7;
+}
+.my-question .date,
+.my-reply .date {
+ position: absolute;
+ right: 5px;
+ bottom: 5px;
+}
diff --git a/static/website/js/thread-user.js b/static/website/js/thread-user.js
index 698a946..a8e7eee 100644
--- a/static/website/js/thread-user.js
+++ b/static/website/js/thread-user.js
@@ -21,7 +21,7 @@ $(document).ready(function() {
$questionInstance = $("#questionInstance");
/* make the question editable and show modify */
- $question.addClass("editable");
+ //$question.addClass("editable");
$question_modify.show();
/* edit and save click events */
@@ -43,8 +43,9 @@ $(document).ready(function() {
$(this).prev().css("display", "block");
/* make the ajax call */
- var id_length = $question_save.attr("id").length;
- var question_id = parseInt($question_save.attr("id").substr(id_length-1));
+ //var id_length = $question_save.attr("id").length;
+ //var question_id = parseInt($question_save.attr("id").substr(id_length-1));
+ var question_id = parseInt($question_save.data("qid"));
console.log(question_id);
var question_body = $questionInstance.html();
$.ajax({
@@ -76,9 +77,9 @@ $(document).ready(function() {
replyNicEditor.panelInstance('replyNicPanel');
$reply_edit.click(function() {
- var reply_body = $(this).data("target");
- console.log(reply_body);
- replyNicEditor.addInstance(reply_body);
+ var target = $(this).data("target");
+ console.log(target);
+ replyNicEditor.addInstance(target);
$(this).parents("div.reply").prepend($replyPanelWrapper);
$replyPanelWrapper.show();
$('#replyPanelWrapper .nicEdit-panelContain').parent().width('100%');
@@ -88,12 +89,27 @@ $(document).ready(function() {
});
$reply_save.click(function() {
- var reply_body = $(this).data("target");
- replyNicEditor.removeInstance(reply_body);
+ var target = $(this).data("target");
+ replyNicEditor.removeInstance(target);
$replyPanelWrapper.hide();
$('#replyPanelWrapper .nicEdit-panelContain').parent().width('100%');
$(this).hide();
$(this).prev().show();
+
+ var reply_id = parseInt($(this).data("rid"));
+ var reply_body = $("#"+target).html();
+
+ $.ajax({
+ url: "/ajax-reply-update/",
+ type: "POST",
+ data: {
+ reply_id: reply_id,
+ reply_body: reply_body
+ },
+ success: function(data) {
+ console.log(data);
+ }
+ });
});
});
diff --git a/static/website/templates/base.html b/static/website/templates/base.html
index 5e397e8..c71e3ef 100644
--- a/static/website/templates/base.html
+++ b/static/website/templates/base.html
@@ -39,9 +39,17 @@
{{ user }}<b class="caret"></b>
</a>
<ul class="dropdown-menu">
- <li><a href="#">My Questions</a></li>
- <li><a href="#">My Replies</a></li>
- <li><a href="#">Notifications</a></li>
+ <li><a href="{% url 'website:user_questions' user.id %}">My Questions</a></li>
+ <li><a href="{% url 'website:user_replies' user.id %}">My Replies</a></li>
+ <li>
+ <a href="{% url 'website:user_notifications' user.id %}">
+ Notifications
+ <span class="badge" style="background:#a26dc8; color:#ffffff;">
+ {% load notify %}
+ {% notification_count user.id %}
+ </span>
+ </a>
+ </li>
<li class="divider"></li>
<li><a href="{% url 'user_logout' %}">Logout</a></li>
</ul>
diff --git a/static/website/templates/get-question.html b/static/website/templates/get-question.html
index 5e68aed..bd63d02 100644
--- a/static/website/templates/get-question.html
+++ b/static/website/templates/get-question.html
@@ -2,13 +2,13 @@
{% load static %}
{% load widget_tweaks %}
{% block content %}
-<div class="question">
+<div class="question {% ifequal question.user|stringformat:'s' user|stringformat:'s' %}editable{% endifequal %}">
<div class="title">
<a href=""> {{ question.title }} </a>
</div>
<div id="questionNicPanel"></div>
- <div id="questionInstance" class="body">
+ <div id="{% ifequal question.user|stringformat:'s' user|stringformat:'s' %}questionInstance{% endifequal %}" class="body">
{{ question.body|safe }}
</div>
<br>
@@ -48,7 +48,7 @@
<span class="modify">
{% ifequal question.uid|stringformat:'s' user.id|stringformat:'s' %}
<a class="edit btn btn-xs btn-info" href="#">Edit</a>
- <a id="save-{{ question.id }}" class="save btn btn-xs btn-success" href="#">Save</a>
+ <a class="save btn btn-xs btn-success" data-qid="{{ question.id }}" href="#">Save</a>
{% endifequal %}
</span>
@@ -65,7 +65,7 @@
</div>
{% for reply in replies %}
- <div class="reply {% ifequal reply.uid|stringformat:'s' user.id|stringformat:'s' %}editable{% endifequal %}">
+ <div class="reply {% ifequal reply.uid|stringformat:'s' user.id|stringformat:'s' %}editable{% endifequal %}" id="reply{{reply.id}}">
<div class="body" id="body{{ reply.id }}">
{{ reply.body|safe }}
@@ -78,7 +78,7 @@
{% ifequal reply.uid|stringformat:'s' user.id|stringformat:'s' %}
<span class="modify" style="display:block">
<a class="edit btn btn-xs btn-info vs" href="#body{{ reply.id}}" data-target="body{{ reply.id }}">Edit</a>
- <a id="save-{{ question.id }}" class="save btn btn-xs btn-success vs" href="#" data-target="body{{ reply.id }}">Save</a>
+ <a class="save btn btn-xs btn-success vs" data-target="body{{ reply.id }}" data-rid="{{ reply.id }}" href="#">Save</a>
</span>
{% endifequal %}
</div> <!-- /.reply -->
@@ -111,16 +111,5 @@
{% endblock %}
{% block javascript %}
- {% if user.is_authenticated %}
- {% ifequal question.user|stringformat:"s" user|stringformat:"s" %}
- <script src="{% static 'website/js/thread-user.js' %}"></script>
- {% else %}
- <script src="{% static 'website/js/thread-user.js' %}"></script>
- <script type="text/javascript">
- $(document).ready(function() {
- $(".question .body").removeAttr("id");
- });
- </script>
- {% endifequal %}
- {% endif %}
+ <script src="{% static 'website/js/thread-user.js' %}"></script>
{% endblock %}
diff --git a/static/website/templates/index.html b/static/website/templates/index.html
index 43d98f0..ef840bc 100644
--- a/static/website/templates/index.html
+++ b/static/website/templates/index.html
@@ -1,5 +1,6 @@
{% extends 'website/templates/base.html' %}
{% block content %}
+{% load count_tags %}
<h4><u>Recent Questions</u></h4>
{% for question in questions %}
<div class="question">
@@ -39,9 +40,34 @@
</small>
</span>
- <span class="user">
- {{ question.user }}
+ <span class="meta">
+ <small>
+ <i>
+ {{ question.date_created }}
+ </i>
+ </small>
+
+ <span class="user">
+ {{ question.user }}
+ </span>
</span>
</div> <!-- /.question -->
{% endfor %}
+
+ {% if total > 10 %}
+ <ul class="pagination pull-right">
+ {% for i in total|get_range:"0,10" %}
+ <li>
+ <a href="{% url 'website:home' %}?marker={{ i }}">
+ {% if i == marker %}
+ <strong>{{ i|div:"10"|inc }}</strong>
+ {% else %}
+ {{ i|div:"10"|inc }}
+ {% endif %}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+
{% endblock %}
diff --git a/static/website/templates/notifications.html b/static/website/templates/notifications.html
new file mode 100644
index 0000000..aa3adce
--- /dev/null
+++ b/static/website/templates/notifications.html
@@ -0,0 +1,33 @@
+{% extends 'website/templates/base.html' %}
+{% load notify %}
+{% block content%}
+ <h4 class="pull-left">Notifications</h4>
+ <a class="btn btn-xs btn-warning pull-right" href="{% url "website:clear_notifications" %}" style="margin-top: 7px;">
+ Clear All
+ </a>
+ <div class="clearfix"></div>
+ {% for notification in notifications %}
+ {% get_notification notification.id %}
+ {% endfor %}
+{% endblock %}
+
+{% block javascript %}
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $(".remove").click(function() {
+ $(this).parent(".notification").slideUp();
+ var notification_id = $(this).data("nid");
+ $.ajax({
+ url: "/ajax-notification-remove/",
+ type: "POST",
+ data: {
+ notification_id: notification_id
+ },
+ success: function(data) {
+ console.log(data);
+ }
+ });
+ });
+ });
+ </script>
+{% endblock %}
diff --git a/static/website/templates/notify.html b/static/website/templates/notify.html
new file mode 100644
index 0000000..7251f1b
--- /dev/null
+++ b/static/website/templates/notify.html
@@ -0,0 +1,7 @@
+<div class="notification">
+ <a href=""><strong>{{ reply.user }}</strong> replies to <strong>{{ question.title }}</strong></a> /
+ {{ reply.body|safe }}
+ <a class="remove" data-nid="{{ notification.id }}" href="#">
+ <span class="glyphicon glyphicon-remove-circle"></span>
+ </a>
+</div> <!-- /.notification -->
diff --git a/static/website/templates/user-questions.html b/static/website/templates/user-questions.html
new file mode 100644
index 0000000..e3d2ab6
--- /dev/null
+++ b/static/website/templates/user-questions.html
@@ -0,0 +1,36 @@
+{% extends 'website/templates/base.html' %}
+{% load count_tags %}
+{% block content %}
+ <h4>My Questions</h4>
+ {% for question in questions %}
+ <div class="my-question">
+ <span class="title">
+ {{ question.title }}
+ </span>
+ <br>
+ <span class="date">
+ <small>
+ Asked on:
+ {{ question.date_created }}
+ </small>
+ </span>
+ </div>
+ {% endfor %}
+
+ {% if total > 10 %}
+ <ul class="pagination pull-right">
+ {% for i in total|get_range:"0,10" %}
+ <li>
+ <a href="{% url 'website:user_questions' user.id %}?marker={{ i }}">
+ {% if i == marker %}
+ <strong>{{ i|div:"10"|inc }}</strong>
+ {% else %}
+ {{ i|div:"10"|inc }}
+ {% endif %}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+
+{% endblock %}
diff --git a/static/website/templates/user-replies.html b/static/website/templates/user-replies.html
new file mode 100644
index 0000000..c31b854
--- /dev/null
+++ b/static/website/templates/user-replies.html
@@ -0,0 +1,36 @@
+{% extends 'website/templates/base.html' %}
+{% load count_tags %}
+{% block content %}
+ <h4>My Replies</h4>
+ {% for reply in replies%}
+ <div class="my-reply">
+ <span class="body">
+ {{ reply.body|safe }}
+ </span>
+ <br>
+ <span class="date">
+ <small>
+ Replied on:
+ {{ reply.date_created }}
+ </small>
+ </span>
+ </div>
+ {% endfor %}
+
+ {% if total > 10 %}
+ <ul class="pagination pull-right">
+ {% for i in total|get_range:"0,10" %}
+ <li>
+ <a href="{% url 'website:user_replies' user.id %}?marker={{ i }}">
+ {% if i == marker %}
+ <strong>{{ i|div:"10"|inc }}</strong>
+ {% else %}
+ {{ i|div:"10"|inc }}
+ {% endif %}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+
+{% endblock %}