diff options
Diffstat (limited to 'sugar_network_webui/templates')
8 files changed, 53 insertions, 34 deletions
diff --git a/sugar_network_webui/templates/_context-artifact-list.html b/sugar_network_webui/templates/_context-artifact-list.html index 1d42359..c6ea51c 100644 --- a/sugar_network_webui/templates/_context-artifact-list.html +++ b/sugar_network_webui/templates/_context-artifact-list.html @@ -36,7 +36,11 @@ </a> </div> <div class="mtime"> - {{_('by %(author)s on %(date)s', author=item['author'][0]['name'], date=item['mtime']|timedelta)}} + {% if (session['connected'] or False) %} + {{_('by %(author)s on %(date)s', author=item['author'][0]['name'], date=item['mtime']|timedelta)}} + {% else %} + {{_('by %(author)s on %(date)s', author=sugar_nick, date=item['mtime']|timedelta)}} + {% endif %} </div> <div class="resource-meta"> {%- for tag in item['tags'] %} diff --git a/sugar_network_webui/templates/_context-comment-list.html b/sugar_network_webui/templates/_context-comment-list.html index 36175ce..5772363 100644 --- a/sugar_network_webui/templates/_context-comment-list.html +++ b/sugar_network_webui/templates/_context-comment-list.html @@ -6,7 +6,13 @@ <img class="comment-icon" src="/static/icons/comments.png" /> <div class="comment-content">{{item['message']}}</div> </div> - <div class='mtime mtime-comment'>{{_('by %(author)s on %(date)s', author=item['author'][0]['name'], date=item['mtime']|timedelta)}} + <div class='mtime mtime-comment'> + {% if (session['connected'] or False) %} + {{_('by %(author)s on %(date)s', author=item['author'][0]['name'], date=item['mtime']|timedelta)}} + {% else %} + {{_('by %(author)s on %(date)s', author=sugar_nick, date=item['mtime']|timedelta)}} + {% endif %} + {%- if item.is_author -%} <span class="delete-comment-button has_tooltip" title="{{_('delete')}}" data-guid="{{item['guid']}}"><img class="action-button" src="/static/icons/edit-delete.png"></img></span> {%- endif -%} diff --git a/sugar_network_webui/templates/_context-resource-list.html b/sugar_network_webui/templates/_context-resource-list.html index 08a9b1b..72ba7bb 100644 --- a/sugar_network_webui/templates/_context-resource-list.html +++ b/sugar_network_webui/templates/_context-resource-list.html @@ -36,7 +36,11 @@ </a> </div> <div class="mtime"> + {% if (session['connected'] or False) %} {{_('by %(author)s on %(date)s', author=item['author'][0]['name'], date=item['mtime']|timedelta)}} + {% else %} + {{_('by %(author)s on %(date)s', author=sugar_nick, date=item['mtime']|timedelta)}} + {% endif %} </div> <div class="resource-meta"> {%- for tag in item['tags'] %} diff --git a/sugar_network_webui/templates/_context-review-list.html b/sugar_network_webui/templates/_context-review-list.html index 2e20efe..4fc0fe2 100644 --- a/sugar_network_webui/templates/_context-review-list.html +++ b/sugar_network_webui/templates/_context-review-list.html @@ -31,7 +31,11 @@ {{item['content']}} </div> <div class='mtime'> - {{_('by %(author)s on %(date)s', author=item['author'][0]['name'], date=item['mtime']|timedelta)}} + {% if (session['connected'] or False) %} + {{_('by %(author)s on %(date)s', author=item['author'][0]['name'], date=item['mtime']|timedelta)}} + {% else %} + {{_('by %(author)s on %(date)s', author=sugar_nick, date=item['mtime']|timedelta)}} + {% endif %} </div> <div class="resource-meta"> {%- for tag in item['tags'] %} diff --git a/sugar_network_webui/templates/_context-solution-list.html b/sugar_network_webui/templates/_context-solution-list.html index 4177222..7703c20 100644 --- a/sugar_network_webui/templates/_context-solution-list.html +++ b/sugar_network_webui/templates/_context-solution-list.html @@ -11,7 +11,12 @@ <div class="resource-content"> <pre>{{resource['content']|safe}}</pre> </div> - <div class='mtime'>{{_('by %(author)s on %(date)s', author=resource['author'][0]['name'], date=resource['mtime']|timedelta)}} + <div class='mtime'> + {% if (session['connected'] or False) %} + {{_('by %(author)s on %(date)s', author=resource['author'][0]['name'], date=resource['mtime']|timedelta)}} + {% else %} + {{_('by %(author)s on %(date)s', author=sugar_nick, date=resource['mtime']|timedelta)}} + {% endif %} </div> <div class="resource-meta"> {%- for tag in resource['tags'] %} @@ -61,7 +66,11 @@ {{item['content']|safe}} </div> <div class='mtime'> - {{_('by %(author)s on %(date)s', author=item['author'][0]['name'], date=item['mtime']|timedelta)}} + {% if (session['connected'] or False) %} + {{_('by %(author)s on %(date)s', author=item['author'][0]['name'], date=item['mtime']|timedelta)}} + {% else %} + {{_('by %(author)s on %(date)s', author=sugar_nick, date=item['mtime']|timedelta)}} + {% endif %} </div> <div class="resource-meta"> {%- for tag in item['tags'] %} diff --git a/sugar_network_webui/templates/_resource-list.html b/sugar_network_webui/templates/_resource-list.html index 246a125..3877ce3 100644 --- a/sugar_network_webui/templates/_resource-list.html +++ b/sugar_network_webui/templates/_resource-list.html @@ -29,7 +29,12 @@ {{item['content']}}</a> </div> <div class="resource-meta"> - {{_('by %(author)s on %(date)s', author=item['author'][0]['name'], date=item['mtime']|timedelta)}} + {% if (session['connected'] or False) %} + {{_('by %(author)s on %(date)s', author=item['author'][0]['name'], date=item['mtime']|timedelta)}} + {% else %} + {{_('by %(author)s on %(date)s', author=sugar_nick, date=item['mtime']|timedelta)}} + {% endif %} + {%- for tag in item['tags'] %} <span class="tag">{{tag}}</span> {%- endfor %} diff --git a/sugar_network_webui/templates/base.html b/sugar_network_webui/templates/base.html index bdd1d5d..8063d6d 100644 --- a/sugar_network_webui/templates/base.html +++ b/sugar_network_webui/templates/base.html @@ -9,8 +9,8 @@ <script src="/static/js/jquery.history.js"></script> <script src="/static/js/jquery-ui-1.8.16.sugar.min.js" type="text/javascript"></script> <script src="/static/js/jquery.livequery.min.js" type="text/javascript" charset="utf-8"></script> - <!--script src="/static/js/toastr.js"></script--> - <!--link href="/static/css/toastr.css" rel="stylesheet"/--> + <script src="/static/js/toastr.js"></script> + <link href="/static/css/toastr.css" rel="stylesheet"/> <!--script src="/static/js/sticky.full.js" type="text/javascript"></script--> <!--link rel="stylesheet" href="/static/css/sticky.full.css" type="text/css" /--> <style> @@ -398,28 +398,31 @@ }; $(document).ready( function() { - /* - sse = new EventSource('/my_event_source'); + sse = new EventSource('/my_event_source'); sse.onmessage = function(message) { data = $.parseJSON(message.data); if (data.event=="inline" && data.state=="offline") { toastr.info('Your are now in offline mode.'); $('#sn-button-img').removeClass('sugar-network-online'); + location.reload(); + // TODO: proper ajaxy reload } if (data.event=="inline" && data.state=="online") { toastr.info('Your are now in online mode.'); $('#sn-button-img').addClass('sugar-network-online'); + location.reload(); + // TODO: proper ajaxy reload } + /* TODO: Handle these if (data.event=="push") { toastr.info('Sugar Network is synchronized.'); } if (data.event=="create") { toastr.warning('New ' + data.props.type[0]); } - console.log('A message has arrived!'); + console.log('A message has arrived!');*/ } - */ $( "#sn-button" ).tooltip({position:"bottom right", offset:[-3,-60], predelay:500}); $( "#browser-button" ).tooltip({position:"bottom right", offset:[-3,-60], predelay:500}); @@ -483,22 +486,6 @@ var term = $('#query').val(); if(e.keyCode == 13 && _selected==false) { location='/context/search/'+term; - /* For adding tag filters */ - /** if (term[0]=='#') { - /* Send the data using post * - $('#query').val('{{query or ''}}'); - $.post( '/_tags', { tag:term }, - function( data ) { - $( "#tags-section" ).empty().append( data ); - /* bind_del(); * - location.reload(); - } - ); - } - else { - /* location='/resource/{{resource_type}}s/'+term; * - location='/context/search/'+term; - }*/ return false; //prevents form from being submitted. } } diff --git a/sugar_network_webui/templates/toolbar.html b/sugar_network_webui/templates/toolbar.html index eae5fa8..0e3bf10 100644 --- a/sugar_network_webui/templates/toolbar.html +++ b/sugar_network_webui/templates/toolbar.html @@ -89,6 +89,12 @@ <img class="toolbar-icon" src="/static/icons/list-add.png" /> </div> </li--> + <!-- TODO: useful until properly updating cursor on events --> + <li class="toolbar-items" onclick="location.href='/reload'+location.pathname;"> + <div class="toolbar-button has_tooltip" title="{{_('reload')}}"> + <img class="toolbar-icon" src="/static/icons/reload.png" /> + </div> + </li> <li class="toolbar-items" onclick="location='/project/new?returnto=' + location.href"> <div class="toolbar-button has_tooltip" title="{{_('create new context')}}"> <img class="toolbar-icon" src="/static/icons/go-up.png" /> @@ -99,11 +105,5 @@ <img class="toolbar-icon" src="/static/icons/activity-about.png" /> </div> </li> - - <!--li class="toolbar-items" onclick="location.href='/reload'+location.pathname;"> - <div class="toolbar-button has_tooltip" title="{{_('reload')}}"> - <img class="toolbar-icon" src="/static/icons/reload.png" /> - </div> - </li--> </ul> </div> |