Skip to content

Commit

Permalink
Hide timestamps until rendering is complete.
Browse files Browse the repository at this point in the history
  • Loading branch information
colekettler committed Aug 5, 2015
1 parent c649cf8 commit a5d312f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions flask_moment.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def include_moment(version='2.10.3', local_js=None):
moment.locale("en");
function flask_moment_render(elem) {
$(elem).text(eval('moment("' + $(elem).data('timestamp') + '").' + $(elem).data('format') + ';'));
$(elem).removeClass('flask-moment');
$(elem).removeClass('flask-moment').show();
}
function flask_moment_render_all() {
$('.flask-moment').each(function() {
Expand Down Expand Up @@ -68,7 +68,8 @@ def _timestamp_as_iso_8601(self, timestamp):
def _render(self, format, refresh=False):
t = self._timestamp_as_iso_8601(self.timestamp)
return Markup(('<span class="flask-moment" data-timestamp="%s" ' +
'data-format="%s" data-refresh="%d">%s</span>') %
'data-format="%s" data-refresh="%d" ' +
'style="display: none">%s</span>') %
(t, format, int(refresh) * 60000, t))

def format(self, fmt, refresh=False):
Expand Down

0 comments on commit a5d312f

Please sign in to comment.