diff --git a/amadeus/static/js/mural.js b/amadeus/static/js/mural.js index 6118e26..45f1f38 100644 --- a/amadeus/static/js/mural.js +++ b/amadeus/static/js/mural.js @@ -37,6 +37,8 @@ var loadPosts = function() { $(".posts").append(data); $('.mural').data('page', pageNum); + + setTimeout(function () { postHeightLimits() }, 10); }, complete: function(data, textStatus){ // Turn the scroll monitor back on @@ -77,8 +79,34 @@ $(function () { $(this).animate({scrollTop: height}, 0); }); + + postHeightLimits(); + }); +function postHeightLimits() { + $('.post-body').each(function () { + if ($(this).outerHeight() > 500) { + var post = $(this), + btn = post.parent().find('.see-complete'); + + post.attr('style', 'overflow:hidden;max-height:500px'); + + btn.attr('style', 'display:block'); + + btn.click(function () { + seeComplete($(this), post); + }); + } + }); +} + +function seeComplete(btn, post) { + post.attr('style', ''); + + btn.attr('style', 'display:none'); +} + function setPostFormSubmit(post = "") { var frm = $('#post-form'); @@ -100,12 +128,14 @@ function setPostFormSubmit(post = "") { old.remove(); } else { $('.posts').prepend(data.view); - + new_posts.push(data.new_id); $('.no-subjects').attr('style', 'display:none'); } + setTimeout(function () { postHeightLimits() }, 100); + $('#post-modal-form').modal('hide'); alertify.success(data.message); @@ -122,7 +152,7 @@ function setPostFormSubmit(post = "") { return false; }); } - + function favorite(btn) { var action = btn.data('action'), url = btn.data('url'); diff --git a/log/mixins.py b/log/mixins.py index 6ec2e63..221b487 100644 --- a/log/mixins.py +++ b/log/mixins.py @@ -11,16 +11,17 @@ class LogMixin(object): log_resource = "" def createLog(self, actor = None, component = '', log_action = '', log_resource = '', context = {}): - log = Log() - log.user = str(actor) - log.user_id = actor.id - log.user_email = actor.email - log.context = context - log.component = component - log.action = log_action - log.resource = log_resource + if actor.is_authenticated: + log = Log() + log.user = str(actor) + log.user_id = actor.id + log.user_email = actor.email + log.context = context + log.component = component + log.action = log_action + log.resource = log_resource - log.save() + log.save() def dispatch(self, request, *args, **kwargs): return super(LogMixin, self).dispatch(request, *args, **kwargs) \ No newline at end of file diff --git a/mural/templates/mural/_view.html b/mural/templates/mural/_view.html index 51f0532..49cde6e 100644 --- a/mural/templates/mural/_view.html +++ b/mural/templates/mural/_view.html @@ -43,6 +43,7 @@ {% endif %} +
@@ -61,4 +62,4 @@
- \ No newline at end of file + diff --git a/subjects/views.py b/subjects/views.py index 4509c4a..df19725 100644 --- a/subjects/views.py +++ b/subjects/views.py @@ -550,11 +550,8 @@ class SubjectSearchView(LoginRequiredMixin, LogMixin, ListView): if tags[0] == '': return HttpResponseRedirect(request.META.get('HTTP_REFERER')) - if request.method.lower() in self.http_method_names: - handler = getattr(self, request.method.lower(), self.http_method_not_allowed) - else: - handler = self.http_method_not_allowed - return handler(request, *args, **kwargs) + + return super(SubjectSearchView, self).dispatch(request, *args, **kwargs) def get_queryset(self): -- libgit2 0.21.2