Activity feed updates

This commit is contained in:
2020-03-15 10:33:08 +00:00
parent b8ea3d3d42
commit 6970c5c490
8 changed files with 24 additions and 19 deletions

View File

@@ -57,6 +57,7 @@ INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'RIGS',
'assets',

2
RIGS/static/js/konami.js Executable file → Normal file
View File

@@ -1 +1 @@
var Konami=function(t){var e={addEvent:function(t,e,n,i){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&(t["e"+e+n]=n,t[e+n]=function(){t["e"+e+n](window.event,i)},t.attachEvent("on"+e,t[e+n]))},input:"",pattern:"38384040373937396665",load:function(t){this.addEvent(document,"keydown",(function(n,i){if(i&&(e=i),e.input+=n?n.keyCode:event.keyCode,e.input.length>e.pattern.length&&(e.input=e.input.substr(e.input.length-e.pattern.length)),e.input==e.pattern)return e.code(t),e.input="",n.preventDefault(),!1}),this)},code:function(t){window.location=t},iphone:{start_x:0,start_y:0,stop_x:0,stop_y:0,tap:!1,capture:!1,orig_keys:"",keys:["UP","UP","DOWN","DOWN","LEFT","RIGHT","LEFT","RIGHT","TAP","TAP"],code:function(t){e.code(t)},load:function(t){this.orig_keys=this.keys,e.addEvent(document,"touchmove",(function(t){if(1==t.touches.length&&1==e.iphone.capture){var n=t.touches[0];e.iphone.stop_x=n.pageX,e.iphone.stop_y=n.pageY,e.iphone.tap=!1,e.iphone.capture=!1,e.iphone.check_direction()}})),e.addEvent(document,"touchend",(function(n){1==e.iphone.tap&&e.iphone.check_direction(t)}),!1),e.addEvent(document,"touchstart",(function(t){e.iphone.start_x=t.changedTouches[0].pageX,e.iphone.start_y=t.changedTouches[0].pageY,e.iphone.tap=!0,e.iphone.capture=!0}))},check_direction:function(t){x_magnitude=Math.abs(this.start_x-this.stop_x),y_magnitude=Math.abs(this.start_y-this.stop_y),x=this.start_x-this.stop_x<0?"RIGHT":"LEFT",y=this.start_y-this.stop_y<0?"DOWN":"UP",result=x_magnitude>y_magnitude?x:y,result=1==this.tap?"TAP":result,result==this.keys[0]&&(this.keys=this.keys.slice(1,this.keys.length)),0==this.keys.length&&(this.keys=this.orig_keys,this.code(t))}}};return"string"==typeof t&&e.load(t),"function"==typeof t&&(e.code=t,e.load()),e};
var Konami=function(t){var e={addEvent:function(t,e,n,o){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&(t["e"+e+n]=n,t[e+n]=function(){t["e"+e+n](window.event,o)},t.attachEvent("on"+e,t[e+n]))},removeEvent:function(t,e,n){t.removeEventListener?t.removeEventListener(e,n):t.attachEvent&&t.detachEvent(e)},input:"",pattern:"38384040373937396665",keydownHandler:function(t,n){if(n&&(e=n),e.input+=t?t.keyCode:event.keyCode,e.input.length>e.pattern.length&&(e.input=e.input.substr(e.input.length-e.pattern.length)),e.input===e.pattern)return e.code(e._currentLink),e.input="",t.preventDefault(),!1},load:function(t){this._currentLink=t,this.addEvent(document,"keydown",this.keydownHandler,this),this.iphone.load(t)},unload:function(){this.removeEvent(document,"keydown",this.keydownHandler),this.iphone.unload()},code:function(t){window.location=t},iphone:{start_x:0,start_y:0,stop_x:0,stop_y:0,tap:!1,capture:!1,orig_keys:"",keys:["UP","UP","DOWN","DOWN","LEFT","RIGHT","LEFT","RIGHT","TAP","TAP"],input:[],code:function(t){e.code(t)},touchmoveHandler:function(t){if(1===t.touches.length&&!0===e.iphone.capture){var n=t.touches[0];e.iphone.stop_x=n.pageX,e.iphone.stop_y=n.pageY,e.iphone.tap=!1,e.iphone.capture=!1,e.iphone.check_direction()}},touchendHandler:function(){if(e.iphone.input.push(e.iphone.check_direction()),e.iphone.input.length>e.iphone.keys.length&&e.iphone.input.shift(),e.iphone.input.length===e.iphone.keys.length){for(var t=!0,n=0;n<e.iphone.keys.length;n++)e.iphone.input[n]!==e.iphone.keys[n]&&(t=!1);t&&e.iphone.code(e._currentLink)}},touchstartHandler:function(t){e.iphone.start_x=t.changedTouches[0].pageX,e.iphone.start_y=t.changedTouches[0].pageY,e.iphone.tap=!0,e.iphone.capture=!0},load:function(t){this.orig_keys=this.keys,e.addEvent(document,"touchmove",this.touchmoveHandler),e.addEvent(document,"touchend",this.touchendHandler,!1),e.addEvent(document,"touchstart",this.touchstartHandler)},unload:function(){e.removeEvent(document,"touchmove",this.touchmoveHandler),e.removeEvent(document,"touchend",this.touchendHandler),e.removeEvent(document,"touchstart",this.touchstartHandler)},check_direction:function(){return x_magnitude=Math.abs(this.start_x-this.stop_x),y_magnitude=Math.abs(this.start_y-this.stop_y),x=this.start_x-this.stop_x<0?"RIGHT":"LEFT",y=this.start_y-this.stop_y<0?"DOWN":"UP",result=x_magnitude>y_magnitude?x:y,result=!0===this.tap?"TAP":result,result}}};return"string"==typeof t&&e.load(t),"function"==typeof t&&(e.code=t,e.load()),e};"undefined"!=typeof module&&void 0!==module.exports?module.exports=Konami:"function"==typeof define&&define.amd?define([],(function(){return Konami})):window.Konami=Konami;

View File

@@ -1,6 +1,8 @@
{% load static %}
{% block js %}
<script src="{% static 'js/tooltip.js' %}"></script>
<script src="{% static 'js/popover.js' %}"></script>
<script>
$(function () {
$('[data-toggle="popover"]').popover().click(function(){
@@ -8,7 +10,7 @@
window.location.href = $(this).attr('href');
}
});
moment().twitter();
//moment().twitter();
})
$(document).ready(function() {
$(function () {
@@ -20,11 +22,11 @@
$('#activity [data-toggle="popover"]').popover();
$('.date').each(function (index, dateElem) {
/*$('.date').each(function (index, dateElem) {
var $dateElem = $(dateElem);
var formatted = moment($dateElem.attr('data-date')).twitterLong();
$dateElem.text(formatted);
});
});*/
});
});

View File

@@ -1,15 +1,14 @@
{% extends request.is_ajax|yesno:"base_ajax_nomodal.html,base_rigs.html" %}
{% load static %}
{% load humanize %}
{% load paginator from filters %}
{% load to_class_name from filters %}
{% block content %}
<div class="list-group-item">
<div class="media">
{% for version in object_list %}
{% if not version.withPrevious %}
{% if not forloop.first %}
</div> {#/.media-body#}
@@ -18,7 +17,7 @@
<div class="list-group-item">
<div class="media">
{% endif %}
<div class="media-left">
<div class="align-self-start mr-3">
{% if version.revision.user %}
<a href="{% url 'profile_detail' pk=version.revision.user.pk %}" class="modal-href">
<img class="media-object img-rounded" src="{{ version.revision.user.profile_picture}}" />
@@ -26,10 +25,10 @@
{% endif %}
</div>
<div class="media-body">
<h5>{{ version.revision.user.name }}
<span class="pull-right"><small><span class="date" data-date="{{version.revision.date_created|date:"c"}}"></span></small></span>
<h5>
{{ version.revision.user.name }}
<span class="ml-3"><small>{{version.revision.date_created|naturaltime}}</small></span>
</h5>
{% endif %}
<p>
<small>

View File

@@ -1,12 +1,12 @@
{% if version.changes.item_changes or version.changes.field_changes or version.changes.old == None %}
{% for change in version.changes.field_changes %}
<button title="Changes to {{ change.field.verbose_name }}" type="button" class="badge badge-light" data-container="body" data-html="true" data-trigger='hover' data-toggle="popover" data-content='{% spaceless %}
<a title="Changes to {{ change.field.verbose_name }}" type="button" class="badge badge-light" data-container="body" data-html="true" data-trigger='hover' data-toggle="popover" data-content='{% spaceless %}
{% include 'version_changes_change.html' %}
{% endspaceless %}'>{{ change.field.verbose_name }}</button>
{% endspaceless %}'>{{ change.field.verbose_name }}</a>
{% endfor %}
{% for itemChange in version.changes.item_changes %}
<button title="Changes to item '{% if itemChange.new %}{{ itemChange.new.name }}{% else %}{{ itemChange.old.name }}{% endif %}'" type="button" class="badge badge-light" data-container="body" data-html="true" data-trigger='hover' data-toggle="popover" data-content='{% spaceless %}
<a title="Changes to item '{% if itemChange.new %}{{ itemChange.new.name }}{% else %}{{ itemChange.old.name }}{% endif %}'" type="button" class="badge badge-light" data-container="body" data-html="true" data-trigger='hover' data-toggle="popover" data-content='{% spaceless %}
<ul class="list-group">
{% for change in itemChange.field_changes %}
<li class="list-group-item">
@@ -16,7 +16,7 @@
{% endfor %}
</ul>
{% endspaceless %}'>item '{% if itemChange.new %}{{ itemChange.new.name }}{% else %}{{ itemChange.old.name }}{% endif %}'</button>
{% endspaceless %}'>item '{% if itemChange.new %}{{ itemChange.new.name }}{% else %}{{ itemChange.old.name }}{% endif %}'</a>
{% endfor %}
{% else %}
nothing useful

View File

@@ -73,10 +73,10 @@ urlpatterns = [
url(r'^rigboard/calendar/(?P<view>(month|week|day))/(?P<date>(\d{4}-\d{2}-\d{2}))/$',
login_required()(rigboard.WebCalendar.as_view()), name='web_calendar'),
url(r'^rigboard/archive/$', RedirectView.as_view(permanent=True, pattern_name='event_archive')),
url(r'^rigboard/activity/$',
path('rigboard/activity/',
permission_required_with_403('RIGS.view_event')(versioning.ActivityTable.as_view()),
name='activity_table'),
url(r'^rigboard/activity/feed/$',
path('rigboard/activity/feed/',
permission_required_with_403('RIGS.view_event')(versioning.ActivityFeed.as_view()),
name='activity_feed'),

View File

@@ -37,16 +37,18 @@ function scripts() {
'node_modules/jquery/dist/jquery.js',
'node_modules/ravenjs/ravenjs.js', //TODO Upgrade to Sentry
/* Bootstrap Plugins */
'node_modules/bootstrap/js/dist/tooltip.js',
'node_modules/bootstrap/js/dist/popover.js',
'node_modules/bootstrap/js/dist/dropdown.js',
'node_modules/bootstrap/js/dist/collapse.js',
'node_modules/bootstrap/js/dist/modal.js',
'node_modules/@fortawesome/fontawesome-free/js/all.js',
'node_modules/popper.js/**/popper.js',
'node_modules/moment/min/moment.min.js',
/*'node_modules/moment/min/moment.min.js',*/
'node_modules/fullcalendar/dist/fullcalendar.js',
'node_modules/ajax-bootstrap-select/dist/js/ajax-bootstrap-select.min.js',
'node_modules/konami/konami.js',
'node_modules/autocompleter/autocompleter.min.js',
'node_modules/autocompleter/autocomplete.min.js',
'node_modules/@activix/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js'])
.pipe(flatten())
.pipe(terser())
@@ -73,7 +75,7 @@ function browserSyncReload(done) {
function watchFiles() {
gulp.watch("RIGS/static/scss/**/*", sass);
gulp.watch("RIGS/static/js/**/*", scripts);
gulp.watch(['templates/**/*.html', 'RIGS/templates/**/*.html', 'assets/templates/**/*.html', /*TODO'RIGS/.py'*/], browserSyncReload);
gulp.watch(['templates/**/*.html', 'RIGS/templates/**/*.html', 'assets/templates/**/*.html'], browserSyncReload);
}
exports.watch = gulp.parallel(watchFiles, browserSync);

View File

@@ -22,6 +22,7 @@
{% endblock %}
<script src="{% static 'js/jquery.js' %}"></script>
<script src="{% static 'js/popper.js' %}"></script>
<script src="{% static 'js/ravenjs.js' %}"></script>
<script>Raven.config('{% sentry_public_dsn %}').install()</script>
{% block preload_js %}