diff --git a/amadeus/static/js/mural.js b/amadeus/static/js/mural.js
index 7fca9ab..fdf9925 100644
--- a/amadeus/static/js/mural.js
+++ b/amadeus/static/js/mural.js
@@ -24,9 +24,47 @@ $(function () {
});
postHeightLimits();
+ setUserDataPopover();
});
+function setUserDataPopover() {
+ $('[data-toggle="popover"]').popover({
+ html: true,
+ content: function () {
+ return $(this).parent().find(".popover").html();
+ }
+ }).on('show.bs.popover', function (e) {
+ $('[data-toggle="popover"]').not(e.target).popover('hide');
+ }).on('shown.bs.popover', function (e) {
+ if($(this).is(e.target)){
+ var popover = $(".popover.fade.in"),
+ buttons = popover.parent().find('a'),
+ close = popover.parent().find('.close:visible');
+
+ popover.animate({
+ 'max-width': '330px',
+ }, 0);
+
+ popover.find('.popover-content').animate({
+ padding: '9px 5px',
+ }, 0);
+
+ popover.find('h4').animate({
+ 'font-size': '16px',
+ }, 0);
+
+ close.on("click", function () {
+ popover.popover('hide');
+ });
+
+ buttons.on("click", function () {
+ popover.popover('hide');
+ })
+ }
+ });
+}
+
function postHeightLimits() {
$('.post-body').each(function () {
if ($(this).outerHeight() > 500) {
@@ -77,6 +115,7 @@ function setPostFormSubmit(post = "") {
$('.no-subjects:visible').attr('style', 'display:none');
}
+ setUserDataPopover();
setTimeout(function () { postHeightLimits() }, 100);
$('#post-modal-form').modal('hide');
@@ -325,6 +364,8 @@ function loadComments (btn) {
btn.show();
btn.after(response.loaded);
+
+ setUserDataPopover();
}
});
}
diff --git a/amadeus/static/js/mural_ungeneral.js b/amadeus/static/js/mural_ungeneral.js
index 15e0fe4..e784f23 100644
--- a/amadeus/static/js/mural_ungeneral.js
+++ b/amadeus/static/js/mural_ungeneral.js
@@ -35,7 +35,8 @@ $('.mural-ungeneral').on('shown.bs.collapse', function(e) {
mural.data('pages', data.num_pages);
mural.data('page', data.num_page);
- setTimeout(function () { postHeightLimits() }, 100);
+ setUserDataPopover();
+ setTimeout(function () { postHeightLimits(); }, 100);
if (data.num_page < data.num_pages) {
more.show();
@@ -112,7 +113,8 @@ $('.mural-ungeneral').on('shown.bs.collapse', function(e) {
mural.data('pages', data.num_pages);
mural.data('page', data.num_page);
- setTimeout(function () { postHeightLimits() }, 100);
+ setUserDataPopover();
+ setTimeout(function () { postHeightLimits(); }, 100);
if (data.num_page < data.num_pages) {
more.show();
@@ -168,7 +170,8 @@ $('.mural-ungeneral').on('shown.bs.collapse', function(e) {
more.hide();
}
- setTimeout(function () { postHeightLimits() }, 100);
+ setUserDataPopover();
+ setTimeout(function () { postHeightLimits(); }, 100);
without.hide();
} else {
diff --git a/chat/migrations/0003_auto_20170407_2154.py b/chat/migrations/0003_auto_20170407_2154.py
new file mode 100644
index 0000000..052741c
--- /dev/null
+++ b/chat/migrations/0003_auto_20170407_2154.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.4 on 2017-04-08 00:54
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('chat', '0002_auto_20170402_2207'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='talkmessages',
+ name='text',
+ field=models.TextField(blank=True, verbose_name='Message'),
+ ),
+ ]
diff --git a/mural/templates/mural/_view.html b/mural/templates/mural/_view.html
index 69c814c..47bfd11 100644
--- a/mural/templates/mural/_view.html
+++ b/mural/templates/mural/_view.html
@@ -7,7 +7,37 @@
- {{ post.user }}
+ {% if not post.user == request.user %}
+ {% is_online post.user as status %}
+
+ {{ post.user }}
+
+
+
+
×
+
+
+
+
+
+
+
+
+
+
+ {% else %}
+ {{ post.user }}
+ {% endif %}
+
{{ post.get_action_display }}
@@ -63,4 +93,4 @@
-
+
\ No newline at end of file
diff --git a/mural/templates/mural/_view_comment.html b/mural/templates/mural/_view_comment.html
index 21f8d57..db2dbe4 100644
--- a/mural/templates/mural/_view_comment.html
+++ b/mural/templates/mural/_view_comment.html
@@ -8,7 +8,37 @@
+
+
+
+
+
+
{% endblock %}
\ No newline at end of file
diff --git a/mural/templates/mural/list_category.html b/mural/templates/mural/list_category.html
index 601135e..5c2c4fb 100644
--- a/mural/templates/mural/list_category.html
+++ b/mural/templates/mural/list_category.html
@@ -155,7 +155,12 @@
+
+
+
+
+
{% endblock %}
\ No newline at end of file
diff --git a/mural/templates/mural/list_subject.html b/mural/templates/mural/list_subject.html
index 10be2bc..fd17fbb 100644
--- a/mural/templates/mural/list_subject.html
+++ b/mural/templates/mural/list_subject.html
@@ -154,7 +154,13 @@
+
+
+
+
+
+
diff --git a/mural/templatetags/mural_filters.py b/mural/templatetags/mural_filters.py
index 58b620c..9dcbcf7 100644
--- a/mural/templatetags/mural_filters.py
+++ b/mural/templatetags/mural_filters.py
@@ -1,6 +1,11 @@
from django import template
+from django.conf import settings
+from django.utils import timezone
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
+from django.contrib.sessions.models import Session
+
+from log.models import Log
from mural.models import MuralFavorites, MuralVisualizations
@@ -105,4 +110,45 @@ def has_resource(post):
if post.subjectpost.resource:
return _("about") + " " + str(post.subjectpost.resource) + " "
- return ""
\ No newline at end of file
+ return ""
+
+@register.assignment_tag(name = 'is_online')
+def is_online(user):
+ expire_time = settings.SESSION_SECURITY_EXPIRE_AFTER
+ now = timezone.now()
+
+ activities = Log.objects.filter(user_id = user.id).order_by('-datetime')
+
+ if activities.count() > 0:
+ last_activity = activities[0]
+
+ if last_activity.action != 'logout':
+ if (now - last_activity.datetime).total_seconds() < expire_time:
+ return "active"
+ else:
+ return "away"
+
+ return ""
+
+@register.filter(name = 'status_text')
+def status_text(status):
+ if status == "active":
+ return _("Online")
+ elif status == "away":
+ return _('Away')
+ else:
+ return _("Offline")
+
+@register.filter(name = 'chat_space')
+def chat_space(post):
+ if post._my_subclass == "subjectpost":
+ return post.subjectpost.space.id
+
+ return 0
+
+@register.filter(name = 'chat_space_type')
+def chat_space_type(post):
+ if post._my_subclass == "subjectpost":
+ return "subject"
+
+ return "general"
\ No newline at end of file
diff --git a/news/migrations/0001_initial.py b/news/migrations/0001_initial.py
new file mode 100644
index 0000000..f638f71
--- /dev/null
+++ b/news/migrations/0001_initial.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.4 on 2017-04-08 00:54
+from __future__ import unicode_literals
+
+import autoslug.fields
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+import news.models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='News',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('title', models.CharField(max_length=200, unique=True, verbose_name='Name')),
+ ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='title', unique=True, verbose_name='Slug')),
+ ('image', models.ImageField(upload_to='news/', validators=[news.models.validate_img_extension], verbose_name='News Image')),
+ ('content', models.TextField(verbose_name='News Content')),
+ ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Create Date')),
+ ('creator', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='news_creator_user', to=settings.AUTH_USER_MODEL, verbose_name='Creator')),
+ ],
+ options={
+ 'verbose_name_plural': 'News',
+ 'verbose_name': 'News',
+ },
+ ),
+ ]
--
libgit2 0.21.2
- {{ comment.user }} + {% if not post.user == request.user %} + {% is_online comment.user as status %} + + {{ comment.user }} + +
+
+
+
+
+
+
+
+
+
+
+
+ {% trans 'See Profile' %}
+
+
+ {% trans 'Send Message' %}
+
+
+
+ {% else %}
+ {{ comment.user }}
+ {% endif %}
+
{% trans 'Comment' context "view" %}
diff --git a/mural/templates/mural/list.html b/mural/templates/mural/list.html
index 5aa76de..4357ebf 100644
--- a/mural/templates/mural/list.html
+++ b/mural/templates/mural/list.html
@@ -91,7 +91,13 @@
+ +
{{ comment.user }}
+