Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:File Summary: Difference between revisions

Template page
Blossom (talk | contribs)
Undo revision 1606 by Blossom (talk)
Tag: Undo
Blossom (talk | contribs)
No edit summary
Line 1: Line 1:
<html>
<div class="file-summary-box" style="width:100%;border:1px solid #aaa;background:#f9f9f9;margin:1em 0;"><table style="width:100%;border:none;"><tr><th colspan="2" style="background:#e6e6e6;text-align:left;padding:5px;">File Summary</th></tr><tr><td style="background:#eef;width:20%;padding:5px;">Description</td><td style="padding:5px;">{{#if: {{{description|}}} | {{{description}}} | <i>This file has no description. Please provide one.</i>}}</td></tr><tr><td style="background:#eef;width:20%;padding:5px;">Source</td><td style="padding:5px;">{{#if: {{{source|}}} | {{{source}}} | <i>This file is lacking source information. Please provide one.</i>}}</td></tr><tr><td style="background:#eef;width:20%;padding:5px;">Author</td><td style="padding:5px;">{{#if: {{{author|}}} | {{{author}}} | <i>This file is lacking author information. Please provide one.</i>}}</td></tr>{{#if: {{{license|}}} | <tr><td style="background:#eef;width:20%;padding:5px;">License</td><td style="padding:5px;">{{{license}}}</td></tr>}}{{#if: {{{date|}}} | <tr><td style="background:#eef;width:20%;padding:5px;">Date</td><td style="padding:5px;">{{{date}}}</td></tr>}}</table></div>
<head>
  <style>
    table {
      border: 1px solid #aaa;
      background-color: #f9f9f9;
      border-collapse: collapse;
      width: 100%;
      font-size: 90%;
      margin-bottom: 1em;
    }
    th {
      background-color: #e6e6e6;
      border-bottom: 1px solid #aaa;
      text-align: left;
      padding: 5px 10px;
    }
    td {
      padding: 5px 10px;
      border-bottom: 1px solid #ddd;
    }
  </style>
</head>
<body>
  <table id="dynamicTable">
    <tr>
      <th colspan="2">Summary</th>
    </tr>
  </table>
 
  <script>
    // Data (add only fields you want to show)
    const data = {
      Description: "Custom description for Bhikitia",
      Date: "16 September 2023",
      Source: "Own work",
      Author: "Chabe01",
    };
 
    // Render the table dynamically
    const table = document.getElementById("dynamicTable");
 
    for (const [key, value] of Object.entries(data)) {
      if (value) { // Only include rows where the value is not empty
        const row = document.createElement("tr");
        const cellKey = document.createElement("td");
        const cellValue = document.createElement("td");
        cellKey.textContent = key;
        cellValue.textContent = value;
        row.appendChild(cellKey);
        row.appendChild(cellValue);
        table.appendChild(row);
      }
    }
  </script>
</body>
</html>

Revision as of 23:17, 3 December 2024

File Summary
DescriptionThis file has no description. Please provide one.
SourceThis file is lacking source information. Please provide one.
AuthorThis file is lacking author information. Please provide one.