#17 Show event dates
Merged 3 years ago by frantisekz. Opened 3 years ago by frantisekz.

file modified
+18 -1
@@ -19,6 +19,7 @@ 

  

  import re

  import json

+ import datetime

  from flask import Blueprint, render_template, redirect, url_for, flash, session

  

  import resultsdb_api
@@ -47,7 +48,23 @@ 

  @main.route('/events')

  def events():

      events = db.session.query(Event).order_by(Event.created_at.desc())

-     return render_template('list_events.html', events=events)

+     processed_events = []

+     upcoming_or_active_events = []

+     for event in events:

+         single_event = {"name": event.name, "id": event.id, "dates": "N/A", "active": False, "upcoming_or_active": False}

+         if not event.testday_start == datetime.datetime(1900, 1, 1, 0, 0):

+             start = str(event.testday_start.date().strftime("%b %d, %Y"))

+             end = str(event.testday_end.date().strftime("%b %d, %Y"))

+             single_event["dates"] = "%s - %s" % (start, end) if start != end else "%s" % start

+             date_now = datetime.datetime.utcnow().date()

+             if date_now <= event.testday_end.date():

+                 single_event["upcoming_or_active"] = True

+                 if date_now >= event.testday_start.date():

+                     single_event["active"] = True

+                 upcoming_or_active_events.append(single_event)

+         processed_events.append(single_event)

+ 

+     return render_template('list_events.html', events=processed_events, upcoming_or_active_events=upcoming_or_active_events)

  

  

  # TODO: use Memcached instead of SimpleCache

@@ -1,2 +1,8 @@ 

- //body { padding-top: 70px; }

- 

+ .fa-check {color: green;}

+ .fa-times {color: red;}

+ .fa-exclamation {color: blue;}

+ .footer {padding-top: 3rem !important; padding-bottom: 3rem !important;}

+ thead th {width: 15% !important;}

+ .navbar {margin-bottom: 1em;}

+ .white-color {color: white;}

+ h1 {font-size: 2rem;} 

\ No newline at end of file

empty or binary file added
file modified
+45 -31
@@ -4,36 +4,20 @@ 

      <title>{{ title|default('testdays') }}</title>

        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <!-- Bootstrap -->

-       <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

+       <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">

        <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css') }}">

+ 

+       <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">

+       <link rel="apple-touch-icon" href="{{ url_for('static', filename='td-icon-128x128.png') }}">

+       <meta property="og:image" content="{{ url_for('static', filename='td-icon-128x128.png') }}" />

    </head>

  

    <body>

  

-   {#    <div class="navbar navbar-default navbar-fixed-top">

-       <div class="container-fluid">

-         <div class="navbar-header">

-           <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">

-             <span class="icon-bar"></span>

-             <span class="icon-bar"></span>

-             <span class="icon-bar"></span>

-           </button>

-           <span class="navbar-brand"><b>testdays</b></span>

-         </div>

-         <div class="navbar-collapse collapse">

- 

-           <ul class="nav navbar-nav">

-               <li><a href="{{ url_for('admin.admin_index') }}">Admin</a></li>

-           </ul>

- 

- <!--         <div class="navbar-right">

-              <input type="button" class="btn btn-default navbar-btn" value="Search" onclick="location.href='';">

-          </div> -->

- 

-         </div><!--/.nav-collapse -->

-       </div><!--/.container -->

-     </div><!--/.navbar --> #}

- 

+     <nav class="navbar navbar-dark bg-dark">

+       <a class="navbar-brand" href="{{ url_for('main.index') }}"><i class="fas fa-vial"></i> Fedora Testdays</a>

+       <a href="https://fedoraproject.org/wiki/QA/Test_Days" target="_blank"><i class="fas fa-question-circle white-color"></i></a>

+     </nav>

  

      <div class="container-fluid">

      {% for category, message in get_flashed_messages(with_categories=True) %}
@@ -44,24 +28,54 @@ 

      {% endfor %}

      </div>

  

- 

- 

      <div class="container-fluid">

      {% block body %}

         <h1> My First Flask Application! </h1>

      {% endblock %}

      </div>

  

- 

- 

      <div class="container-fluid">

      {% block footer %}

      {% endblock %}

      </div>

  

+     <div class="footer bg-dark">

+       <div class="container">

+         <p class="text-light text-center">Copyright © 2015-2020 Red Hat, Inc. and others.</p>

+         <p class="text-light text-center">

+           <a href="https://pagure.io/fedora-qa/testdays-web" class="text-white-50">Testdays</a>&nbsp;and&nbsp;

+           <a href="https://pagure.io/taskotron/resultsdb" class="text-white-50">ResultsDB (results back-end)</a> are Free Software under GPL.

+         </p>

+         <p class="text-light text-center">

+           Please <a href="https://pagure.io/fedora-qa/testdays-web/issues" class="text-white-50">file issues and PRs</a>&nbsp;if you have ideas.

+         </p>

+         <p class="text-light text-center">

+           <span>•</span>&nbsp;<a href="https://fedoraproject.org/wiki/Legal:Main" class="text-white-50">Legal</a>&nbsp;

+           <span>•</span>&nbsp;<a href="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" class="text-white-50">Privacy policy</a>&nbsp;

+         </p>

+       </div>

+     </div>

+ 

      <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->

-     <script src="//code.jquery.com/jquery.js"></script>

+     <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>

      <!-- Include all compiled plugins -->

-     <script src="//netdna.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>

+     <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>

+     <!-- FontAwesome Icons -->

+     <script src="https://kit.fontawesome.com/ab19c0c775.js" crossorigin="anonymous"></script>

+     <!-- DataTables -->

+     <script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script>

+     <script src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script>

+     <script>

+       $(document).ready(function() {

+         $('#all_events_table').DataTable( {

+             "paging":       true,

+             "ordering":     false,

+             "info":         false,

+             "searching":    false,

+             "lengthChange": false,

+             "pageLength":   15

+         } );

+     } );

+     </script>

    </body>

  </html>

@@ -2,9 +2,52 @@ 

  

  {% block body %}

  

- <h1>All Events</h1>

+ <h1>Upcoming & Current Events</h1>

+ {% if upcoming_or_active_events[0] is defined %}

+ <table class="table">

+     <thead>

+         <tr>

+             <th>Name</th>

+             <th>Dates</th>

+         </tr>

+     </thead>

+     <tbody>

+         {% for event in upcoming_or_active_events %}

+         <tr>

+             <td>

+                 <a href="{{ url_for('main.show_event', event_id=event['id'])}}">

+                     {{ event["name"] }}

+                 </a>

+             </td>

+             <td>{{ event["dates"] }}</td>

+         </tr>

+         {% endfor %}

+     </tbody>

+ </table>

+ {% else %}

+ <p>No testdays are currently planned, be sure to check back later!</p>

+ {% endif %}

+ 

  

- {% for event in events %}

- <a href="{{ url_for('main.show_event', event_id=event.id)}}">{{ event.name }}</a><br />

- {% endfor %}

+ <h1>All Events</h1>

+ <table class="table" id="all_events_table">

+     <thead>

+         <tr>

+             <th>Name</th>

+             <th>Dates</th>

+         </tr>

+     </thead>

+     <tbody>

+         {% for event in events %}

+         <tr>

+             <td>

+                 <a {% if not event["active"] %} class="text-muted" {% endif %} href="{{ url_for('main.show_event', event_id=event['id'])}}">

+                     {{ event["name"] }}

+                 </a>

+             </td>

+             <td {% if not event["active"] %} class="text-muted" {% endif %}>{{ event["dates"] }}</td>

+         </tr>

+         {% endfor %}

+     </tbody>

+ </table>

  {% endblock %}

@@ -64,11 +64,11 @@ 

          <td>

            {% for result in results %}

              {%- if result[0] == 'PASSED' -%}

-               <span class="glyphicon glyphicon-ok text-success" aria-hidden="true"></span>

+               <i class="fas fa-check"></i>

              {%- elif result[0] == 'FAILED' -%}

-               <span class="glyphicon glyphicon-remove text-danger" aria-hidden="true"></span>

+               <i class="fas fa-times"></i>

              {%- elif result[0] == 'INFO' -%}

-               <span class="glyphicon glyphicon-warning-sign text-warning" aria-hidden="true"></span>

+               <i class="fas fa-exclamation"></i>

              {%- else -%}

                {{ result[0] }}

              {%- endif -%}
@@ -82,7 +82,7 @@ 

            {% for comment in line['comments'] %}

              {{loop.index}}.

              {% for bug in comment[0] %}

-               <a class="external" target="_blank" href="https://bugzilla.redhat.com/show_bug.cgi?id={{bug}}">#{{bug}}</a>, 

+               <a class="external" target="_blank" href="https://bugzilla.redhat.com/show_bug.cgi?id={{bug}}">#{{bug}}</a>,

              {% endfor %}

              {{comment[1]}}

              {% if comment[0] or comment[1] %}

  • Bump Bootstrap 3 to Bootstrap 4
  • Bit of an UI rework

1 new commit added

  • Moar tuning
3 years ago

2 new commits added

  • Moar tuning
  • Show event dates
3 years ago

2 new commits added

  • Moar tuning
  • Show event dates
3 years ago

1 new commit added

  • Even more goodness
3 years ago

3 new commits added

  • Even more goodness
  • Moar tuning
  • Show event dates
3 years ago

1 new commit added

  • Favicon
3 years ago

1 new commit added

  • PR Feedback
3 years ago

5 new commits added

  • PR Feedback
  • Favicon
  • Even more goodness
  • Moar tuning
  • Show event dates
3 years ago

1 new commit added

  • I should learn to read and think...
3 years ago

1 new commit added

  • Let's change all events number to show them all on normal displays
3 years ago

rebased onto 2c1dc80

3 years ago

Pull-Request has been merged by frantisekz

3 years ago