]> Frank Brehm's Git Trees - pixelpark/puppetmaster-webhooks.git/commitdiff
Adding Stylesheets
authorFrank Brehm <frank.brehm@pixelpark.com>
Thu, 30 Aug 2018 09:34:23 +0000 (11:34 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Thu, 30 Aug 2018 09:34:23 +0000 (11:34 +0200)
lib/webhooks/base_app.py
lib/webhooks/show_modules.py

index 99825d12c4a94b3d92740719e75021662231e5d4..552648d7fdd886e4b068d166b7365f3e75db713d 100644 (file)
@@ -663,6 +663,43 @@ class BaseHookApp(BaseObject):
             <!doctype html>
             <html lang="de">
             <head>
+                <style>
+                    body {{
+                        font-family: sans-serif;
+                    }}
+                    h1 {{
+                        font-size: 1.4em;
+                    }}
+                    table {{
+                        border-collapse: collapse;
+                        background-color: WhiteSmoke;
+                    }}
+                    th {{
+                        font-size: 0.9em;
+                        border-width: 2px;
+                        border-color: Black;
+                        background-color: WhiteSmoke;
+                    }}
+                    td {{
+                        font-size: 0.8em;
+                        border-width: 2px;
+                        border-color: Black;
+                        background-color: WhiteSmoke;
+                    }}
+                    .l {{
+                        text-align: left;
+                    }}
+                    .h {{
+                        font-size: 0.9em;
+                        background-color: DarkGray;
+                    }}
+                    .even {{
+                        background-color: Silver;
+                    }}
+                    .odd {{
+                        background-color: LightGray;
+                    }}
+                </style>
                 <meta charset="utf-8">
                 <title>{t}</title>
             </head>
index a43fb0faf5ea9798252e08513244805536a21268..5e31d4bea06ed9acf215b9b968c1d4ebca5541b3 100644 (file)
@@ -225,42 +225,52 @@ class ShowModulesApp(BaseHookApp):
         self.print_out('  <colgroup span="9"></colgroup>')
         self.print_out('  <thead>')
         self.print_out('    <tr>')
-        self.print_out('      <th rowspan="2">Name</th>')
-        self.print_out('      <th rowspan="2">Vollständiger Name</th>')
-        self.print_out('      <th rowspan="2">Repository</th>')
-        self.print_out('      <th rowspan="2">Homepage bei Puppet Forge</th>')
-        self.print_out('      <th colspan="4">Version</th>')
-        self.print_out('      <th rowspan="2">Letzter Check</th>')
+        self.print_out('      <th rowspan="2" class="l h">Name</th>')
+        self.print_out('      <th rowspan="2" class="l h">Vollständiger Name</th>')
+        self.print_out('      <th rowspan="2" class="h">Repository</th>')
+        self.print_out('      <th rowspan="2" class="h">Homepage bei Puppet Forge</th>')
+        self.print_out('      <th colspan="4" class="h">Version</th>')
+        self.print_out('      <th rowspan="2" class="h">Letzter Check</th>')
         self.print_out('    </tr><tr>')
-        self.print_out('      <th>Puppet Forge</th>')
-        self.print_out('      <th>Development</th>')
-        self.print_out('      <th>Test</th>')
-        self.print_out('      <th>Production</th>')
+        self.print_out('      <th class="h">Puppet Forge</th>')
+        self.print_out('      <th class="h">Development</th>')
+        self.print_out('      <th class="h">Test</th>')
+        self.print_out('      <th class="h">Production</th>')
         self.print_out('    </tr>')
         self.print_out('  </thead>')
         self.print_out('  <tbody>')
 
         nr_modules = 0
 
+        line_class = 'even'
+
         for module_info in module_infos:
             nr_modules += 1
+            if nr_modules % 2:
+                line_class = 'odd'
+            else:
+                line_class = 'even'
             output_data = self.get_output_data(module_info)
             if not output_data['forge_version']:
                 output_data['forge_version'] = '~'
-            if not output_data['forge_homepage_url']:
+            if output_data['forge_homepage_url']:
+                o = '<a href="{u}">{u}</a>'.format(u=output_data['forge_homepage_url'])
+                output_data['forge_homepage_url'] = o
+            else:
                 output_data['forge_homepage_url'] = '~'
             if not output_data['repo']:
                 output_data['repo'] = '~'
+            output_data['line_class'] = line_class
             tpl = '    <tr>\n'
-            tpl += '      <th>{name}</th>\n'
-            tpl += '      <td>{full_name}</td>\n'
-            tpl += '      <td>{repo}</td>\n'
-            tpl += '      <td>{forge_homepage_url}</td>\n'
-            tpl += '      <td>{forge_version}</td>\n'
-            tpl += '      <td>{version_development}</td>\n'
-            tpl += '      <td>{version_test}</td>\n'
-            tpl += '      <td>{version_production}</td>\n'
-            tpl += '      <td>{date_checked}</td>\n'
+            tpl += '      <th class="l h">{name}</th>\n'
+            tpl += '      <td class="{line_class}">{full_name}</td>\n'
+            tpl += '      <td class="{line_class}">{repo}</td>\n'
+            tpl += '      <td class="{line_class}">{forge_homepage_url}</td>\n'
+            tpl += '      <td class="{line_class}">{forge_version}</td>\n'
+            tpl += '      <td class="{line_class}">{version_development}</td>\n'
+            tpl += '      <td class="{line_class}">{version_test}</td>\n'
+            tpl += '      <td class="{line_class}">{version_production}</td>\n'
+            tpl += '      <td class="{line_class}">{date_checked}</td>\n'
             tpl += '    </tr>'
             if self.verbose > 2:
                 LOG.debug("Row template:\n{}".format(tpl))