mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-06 13:01:50 +02:00
Remove moment.js
This commit is contained in:
parent
470f2e58d2
commit
ddd2600f61
7 changed files with 9 additions and 30 deletions
|
@ -90,7 +90,7 @@ def get_history(project, human_readable_names=True):
|
|||
object_str = describe_version(version)
|
||||
|
||||
common_properties = {
|
||||
"time": version.transaction.issued_at,
|
||||
"time": version.transaction.issued_at.strftime("%Y-%m-%dT%H:%M:%SZ"),
|
||||
"operation_type": version.operation_type,
|
||||
"object_type": object_type,
|
||||
"object_desc": object_str,
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
from jinja2 import Markup
|
||||
|
||||
|
||||
class momentjs(object):
|
||||
def __init__(self, timestamp):
|
||||
self.timestamp = timestamp
|
||||
|
||||
def render(self, format):
|
||||
return Markup(
|
||||
'<script>\ndocument.write(moment("%s").%s);\n</script>'
|
||||
% (self.timestamp.strftime("%Y-%m-%dT%H:%M:%S Z"), format)
|
||||
)
|
||||
|
||||
def format(self, fmt):
|
||||
return self.render('format("%s")' % fmt)
|
||||
|
||||
def calendar(self):
|
||||
return self.render("calendar()")
|
||||
|
||||
def fromNow(self):
|
||||
return self.render("fromNow()")
|
|
@ -20,7 +20,6 @@ from ihatemoney.utils import (
|
|||
from ihatemoney.web import main as web_interface
|
||||
|
||||
from ihatemoney import default_settings
|
||||
from ihatemoney.momentjs import momentjs
|
||||
|
||||
|
||||
def setup_database(app):
|
||||
|
@ -147,7 +146,6 @@ def create_app(
|
|||
app.jinja_env.globals["static_include"] = static_include
|
||||
app.jinja_env.globals["locale_from_iso"] = locale_from_iso
|
||||
app.jinja_env.filters["minimal_round"] = minimal_round
|
||||
app.jinja_env.globals["momentjs"] = momentjs
|
||||
|
||||
# Translations
|
||||
babel = Babel(app)
|
||||
|
|
|
@ -5,3 +5,7 @@ function selectCheckboxes(value){
|
|||
els[i].checked = value;
|
||||
}
|
||||
}
|
||||
|
||||
function localizeTime(utcTimestamp) {
|
||||
return new Date(utcTimestamp).toLocaleString()
|
||||
}
|
||||
|
|
1
ihatemoney/static/js/moment.min.js
vendored
1
ihatemoney/static/js/moment.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -142,8 +142,8 @@
|
|||
{% if history %}
|
||||
<table id="history_table" class="split_bills table table-striped">
|
||||
<thead><tr>
|
||||
<th style="width: 20%">{{ _("Time") }}</th>
|
||||
<th style="width: 60%">{{ _("Event") }}</th>
|
||||
<th style="width: 15%">{{ _("Time") }}</th>
|
||||
<th style="width: 65%">{{ _("Event") }}</th>
|
||||
<th style="width: 20%">
|
||||
<span data-toggle="tooltip" title="{{_('IP address recording can be') }}
|
||||
{% if current_log_pref != LoggingMode.RECORD_IP %}
|
||||
|
@ -154,7 +154,7 @@
|
|||
<tbody>
|
||||
{% for event in history %}
|
||||
<tr>
|
||||
<td>{{ momentjs(event.time).calendar() }}</td>
|
||||
<td><script>document.write(localizeTime("{{ event.time }}"));</script></td>
|
||||
<td >
|
||||
<div class="history_icon">
|
||||
<i {% if event.operation_type == OperationType.INSERT %}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
<script src="{{ url_for("static", filename="js/popper.min.js") }}"></script>
|
||||
<script src="{{ url_for("static", filename="js/tagsinput.js") }}"></script>
|
||||
<script src="{{ url_for("static", filename="js/bootstrap.min.js") }}"></script>
|
||||
<script src="{{ url_for("static", filename="js/moment.min.js") }}"></script>
|
||||
{%- if request.path == "/dashboard" %}
|
||||
<link rel=stylesheet type=text/css href="{{ url_for("static", filename='css/datatables.min.css') }}">
|
||||
<script src="{{ url_for("static", filename="js/datatables.min.js") }}"></script>
|
||||
|
|
Loading…
Reference in a new issue