jrtechs / NodeJSBlog

Personal blog written from scratch using Node.js, Bootstrap, and MySQL.
https://jrtechs.net
Mozilla Public License 2.0
4 stars 5 forks source link

Template Engine Upgrade #41

Closed jrtechs closed 5 years ago

jrtechs commented 5 years ago

Upgraded blog to use the Whiskers template engine.

jrtechs commented 5 years ago

This code is so much cleaner than what I was previously doing for the admin pages.

    <div class="col-md-6">
        <div class='blogPost'>
            <h1 class="text-center">Downloads</h1>
            <div class="">
                <table class="table table-striped">
                    <thead class="thead-dark">
                        <tr>
                            <td>Download Name</td>
                            <td>File</td>
                            <td>Download Count</td>
                            <td>Delete</td>
                        </tr>
                    </thead>

                    <tbody>
                        {for download in downloads}
                            <tr>
                                <td>
                                    {download.name}
                                </td>
                                <td>
                                    {download.file}
                                </td>
                                <td>
                                    {download.download_count}
                                </td>
                                <td>
                                    <form action="/admin/downloads/" method ="post" >
                                        <input type="submit" name="submit" value="Delete" class="btn btn-secondary"/>
                                        <input type='hidden' name='delete_download' value='{download.download_id}' />
                                    </form>
                                </td>
                            </tr>
                        {/for}
                    </tbody>
                </table>
            </div>
        </div>
    </div>