mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Start to seperate versioning into its own app
This commit is contained in:
@@ -58,6 +58,7 @@ INSTALLED_APPS = (
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.humanize',
|
||||
'versioning',
|
||||
'RIGS',
|
||||
'assets',
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
__author__ = 'ghost'
|
||||
|
||||
import unittest
|
||||
from importer import fix_email
|
||||
|
||||
|
||||
class EmailFixerTest(unittest.TestCase):
|
||||
def test_correct(self):
|
||||
e = fix_email("tom@ghost.uk.net")
|
||||
self.assertEqual(e, "tom@ghost.uk.net")
|
||||
|
||||
def test_partial(self):
|
||||
e = fix_email("psytp")
|
||||
self.assertEqual(e, "psytp@nottingham.ac.uk")
|
||||
|
||||
def test_none(self):
|
||||
old = None
|
||||
new = fix_email(old)
|
||||
self.assertEqual(old, new)
|
||||
|
||||
def test_empty(self):
|
||||
old = ""
|
||||
new = fix_email(old)
|
||||
self.assertEqual(old, new)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -5,7 +5,8 @@ from django.views.decorators.clickjacking import xframe_options_exempt
|
||||
from django.views.generic import RedirectView
|
||||
from PyRIGS.decorators import (api_key_required, has_oembed,
|
||||
permission_required_with_403)
|
||||
from RIGS import finance, ical, models, rigboard, versioning, views
|
||||
from RIGS import finance, ical, models, rigboard, views
|
||||
from versioning import versioning
|
||||
|
||||
urlpatterns = [
|
||||
path('', login_required(views.Index.as_view()), name='index'),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
from assets import views, models
|
||||
from RIGS import versioning
|
||||
from versioning import versioning
|
||||
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.views.decorators.clickjacking import xframe_options_exempt
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import simplejson
|
||||
from assets import forms, models
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.http import JsonResponse
|
||||
from django.http import HttpResponse, Http404
|
||||
from django.db.models import Q
|
||||
from django.http import Http404, HttpResponse, JsonResponse
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views import generic
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.urls import reverse
|
||||
from django.db.models import Q
|
||||
from django.shortcuts import get_object_or_404
|
||||
from assets import models, forms
|
||||
from RIGS import versioning
|
||||
|
||||
import simplejson
|
||||
from versioning import versioning
|
||||
|
||||
|
||||
@method_decorator(csrf_exempt, name='dispatch')
|
||||
|
||||
@@ -77,7 +77,7 @@ function browserSyncReload(done) {
|
||||
function watchFiles() {
|
||||
gulp.watch("RIGS/static/scss/**/*", styles);
|
||||
gulp.watch("RIGS/static/js/**/*", scripts);
|
||||
gulp.watch(['templates/**/*.html', 'RIGS/templates/**/*.html', 'assets/templates/**/*.html'], browserSyncReload);
|
||||
gulp.watch(['templates/**/*.html', 'RIGS/templates/**/*.html', 'assets/templates/**/*.html', 'versioning/templates/**/*.html'], browserSyncReload);
|
||||
//gulp.watch("gulpfile.js", gulp.parallel(styles, scripts)); TODO This causes a reload loop
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
{% load static %}
|
||||
|
||||
{% block js %}
|
||||
<script src="{% static 'js/tooltip.js' %}"></script>
|
||||
<script src="{% static 'js/popover.js' %}"></script>
|
||||
{% include 'version_scripts.html' %}
|
||||
<script>
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
})
|
||||
</script>
|
||||
<script>
|
||||
$(function () {
|
||||
$('[data-toggle="popover"]').popover().click(function(){
|
||||
if($(this).attr('href')){
|
||||
window.location.href = $(this).attr('href');
|
||||
}
|
||||
});
|
||||
})
|
||||
$(document).ready(function() {
|
||||
$(function () {
|
||||
$( "#activity" ).hide();
|
||||
@@ -1,28 +1,11 @@
|
||||
{% extends request.is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
|
||||
{% load static %}
|
||||
{% load paginator from filters %}
|
||||
{% load to_class_name from filters %}
|
||||
|
||||
{% block title %}Rigboard Activity Stream{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
<script src="{% static "js/tooltip.js" %}"></script>
|
||||
<script src="{% static "js/popover.js" %}"></script>
|
||||
<script src="{% static "js/moment.js" %}"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
$('[data-toggle="popover"]').popover().click(function(){
|
||||
if($(this).attr('href')){
|
||||
window.location.href = $(this).attr('href');
|
||||
}
|
||||
});
|
||||
$('.date').each(function (index, dateElem) {
|
||||
var $dateElem = $(dateElem);
|
||||
var formatted = moment($dateElem.attr('data-date')).fromNow();
|
||||
$dateElem.text(formatted);
|
||||
});
|
||||
})
|
||||
</script>
|
||||
{% include 'version_scripts.html' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
@@ -1,9 +1,9 @@
|
||||
{% if version.changes.item_changes or version.changes.field_changes or version.changes.old == None %}
|
||||
{% for change in version.changes.field_changes %}
|
||||
<a tabindex="0" title="Changes to {{ change.field.verbose_name }}" type="button" class="badge badge-secondary" 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 }}</a>
|
||||
<span title="Changes to {{ change.field.verbose_name }}" class="badge badge-info p-2" 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 }}</span>
|
||||
{% endfor %}
|
||||
{% for itemChange in version.changes.item_changes %}
|
||||
<a tabindex="0" title="Changes to item '{% if itemChange.new %}{{ itemChange.new.name }}{% else %}{{ itemChange.old.name }}{% endif %}'" type="button" class="badge badge-secondary" data-container="body" data-html="true" data-trigger='hover' data-toggle="popover" data-content='{% spaceless %}
|
||||
<span title="Changes to item '{% if itemChange.new %}{{ itemChange.new.name }}{% else %}{{ itemChange.old.name }}{% endif %}'" class="badge badge-info p-1" 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">
|
||||
@@ -12,7 +12,7 @@
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endspaceless %}'>item '{% if itemChange.new %}{{ itemChange.new.name }}{% else %}{{ itemChange.old.name }}{% endif %}'</a>
|
||||
{% endspaceless %}'>item '{% if itemChange.new %}{{ itemChange.new.name }}{% else %}{{ itemChange.old.name }}{% endif %}'</span>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
nothing useful
|
||||
@@ -1,22 +1,11 @@
|
||||
{% extends request.is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
|
||||
{% load to_class_name from filters %}
|
||||
{% load paginator from filters %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{{object|to_class_name}} {{ object.pk|stringformat:"05d" }} - Revision History{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
<script src="{% static "js/tooltip.js" %}"></script>
|
||||
<script src="{% static "js/popover.js" %}"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
$('[data-toggle="popover"]').popover().click(function(){
|
||||
if($(this).attr('href')){
|
||||
window.location.href = $(this).attr('href');
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
{% include 'version_scripts.html' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
20
versioning/templates/version_scripts.html
Normal file
20
versioning/templates/version_scripts.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{% load static %}
|
||||
<script src="{% static "js/tooltip.js" %}"></script>
|
||||
<script src="{% static "js/popover.js" %}"></script>
|
||||
<script src="{% static "js/moment.js" %}"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
$(function() {
|
||||
$('[data-toggle="popover"]').popover({whiteList: whiteList});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
var whiteList = $.fn.tooltip.Constructor.Default.whiteList
|
||||
whiteList.ins = []
|
||||
whiteList.del = []
|
||||
$(document).ready(function() {
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -1,18 +1,14 @@
|
||||
|
||||
|
||||
import logging
|
||||
import datetime
|
||||
import logging
|
||||
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.views import generic
|
||||
from django.utils.functional import cached_property
|
||||
from django.db.models import IntegerField, EmailField, TextField
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
|
||||
from reversion.models import Version, VersionQuerySet
|
||||
from diff_match_patch import diff_match_patch
|
||||
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.db.models import EmailField, IntegerField, TextField
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.functional import cached_property
|
||||
from django.views import generic
|
||||
from reversion.models import Version, VersionQuerySet
|
||||
from RIGS import models
|
||||
|
||||
logger = logging.getLogger('tec.pyrigs')
|
||||
Reference in New Issue
Block a user