OSDN Git Service

更新がわかる変更
authoryamat0jp <terukohietori@gmail.com>
Sun, 16 Jun 2019 09:41:58 +0000 (18:41 +0900)
committeryamat0jp <terukohietori@gmail.com>
Sun, 16 Jun 2019 09:41:58 +0000 (18:41 +0900)
pybbs.py
templates/top.htm

index bccd441..e81a891 100644 (file)
--- a/pybbs.py
+++ b/pybbs.py
@@ -132,7 +132,7 @@ class NaviHandler(web.RequestHandler):
             return
         coll = self.application.coll()
         na = table['info name']
-        self.render('top.htm',coll=coll,name=na,full=self.full)
+        self.render('top.htm',coll=coll,name=na,full=self.full,new=self.new)
 
     def full(self,dbname):
         if dbname in self.application.coll():
@@ -142,6 +142,17 @@ class NaviHandler(web.RequestHandler):
                 return True
         return False
 
+    def new(self,dbname):
+        if dbname in self.application.coll():
+            table = self.application.db[dbname]
+            i = table.count()
+            if i == 0:
+                return False
+            rec = sorted(table.find(),key=lambda x:x['date'])
+            time = rec[i-1]['date']
+            delta = datetime.now()-datetime.strptime(time,'%Y/%m/%d %H:%M')
+            return delta.total_seconds() < 24*3600
+
 class TitleHandler(NaviHandler):
     def get(self):
         rec = sorted(self.title(),key=lambda x: x['date2'])
index 338c359..37f83ed 100755 (executable)
        <img src={{static_url('img/slide{0}.jpg'.format(1+d//i))}} style=float:right;height:465px>
        {% end %}
        {% set d += 1 %}
-       {% if full(x) == True %}
-       <p><a href=/{{x}} style=color:red target=_blank>{{x}}</a>
+       {% if new(x) == True %}
+       {% set s = "background-color:aqua" %}
        {% else %}
-       <p><a href=/{{x}} target=_blank>{{x}}</a>
+       {% set s = "" %}
+       {% end %}
+       {% if full(x) == True %}
+       {% set s = s + "color:red;" %}
        {% end %}
+       <p><a href=/{{x}} style=;{{s}} target=_blank>{{x}}</a>
        {% if d % i == 0 %}
                </div>
        {% end %}
@@ -51,6 +55,7 @@
        </div>
        <div class=slideshow-indicator></div>
 </div>
+ <p><em style="background-color:aqua">    </em>・・・・new!
 {% if name != '' %}
        <p>[ <a href=/{{name}}>{{name}}</a> ] <=お知らせ
 {% end %}