|
@@ -1,58 +1,124 @@
|
|
|
{% extends "layout.html" %}
|
|
|
{% block main %}
|
|
|
-<h1>{{ title }}</h1>
|
|
|
+<h1 class="h3"><i class="fas fa-pen mr-2"></i>{{ title }}</h1>
|
|
|
{% for content in contents %}
|
|
|
-<div>
|
|
|
-<form action="{{ url_for(form_url, page=page, section_class=content.sectionClass) }}" method="POST" enctype="multipart/form-data">
|
|
|
- <table id="example" class="table table-striped table-bordered" cellspacing="0" width="60%">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th>數量</th>
|
|
|
- <th>類型</th>
|
|
|
- <th>內容</th>
|
|
|
- <th style="text-align:center;width:100px;">
|
|
|
- <input class="btn btn-primary" type="submit" value="提交">
|
|
|
- </th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- {% for key, value in content.items() %}
|
|
|
- {% if key != 'sectionClass' %}
|
|
|
- {% for data in value %}
|
|
|
- <tbody>
|
|
|
- <tr>
|
|
|
- <td>{{ loop.index }}</td>
|
|
|
- {% if key == "img" %}
|
|
|
- <td><img src="http://127.0.0.1:1313/{{ data['src'] }}" width="80px" height="50px"></td>
|
|
|
- <td>
|
|
|
- <input id="image" name="image-{{ loop.index }}" type="file" value="{{ data['src'] }}">
|
|
|
- <input name="{{ key }}-{{ loop.index }}" type="hidden" value="{{ data }}">
|
|
|
- </td>
|
|
|
- {% elif key == "yt_video" %}
|
|
|
- <td>影片</td>
|
|
|
- <td>
|
|
|
- <input name="{{ key }}-{{ loop.index }}" class="form-control form-control-lg" value="{{ data['videoid'] }}">
|
|
|
- </td>
|
|
|
- {% else %}
|
|
|
- <td>文字</td>
|
|
|
- <td>
|
|
|
- <input name="{{ key }}-{{ loop.index }}" class="form-control form-control-lg" value="{{ data }}">
|
|
|
- </td>
|
|
|
- {% endif %}
|
|
|
- <td>
|
|
|
- <div>
|
|
|
- <form action="#" method="POST">
|
|
|
- <input class="btn btn-danger" type="submit" value="刪除">
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- </tbody>
|
|
|
+ <div class="table__block">
|
|
|
+ <h4 class="h4 mb-0">區塊{{ loop.index }}</h4>
|
|
|
+ <span class="btn__opentab"><i class="fas fa-chevron-down"></i></span>
|
|
|
+ <form action="{{ url_for(form_url, page=page, section_class=content.sectionClass) }}" method="POST" enctype="multipart/form-data" class="form__action">
|
|
|
+ {% set tabidx = loop.index %}
|
|
|
+ <table id="example" class="table table__content mb-0">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th class="table__head" width="80">順序</th>
|
|
|
+ <th class="table__head" width="120">類型</th>
|
|
|
+ <th class="table__head">內容</th>
|
|
|
+ <th style="width:150px;" class="table__head">
|
|
|
+ </th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ {% for key, value in content.items() %}
|
|
|
+ {% if key != 'sectionClass' %}
|
|
|
+ {% for data in value %}
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td class="table__data">{{ loop.index }}</td>
|
|
|
+ {% if key == "img" %}
|
|
|
+ <td class="table__data"><span class="badge badge-pill badge__img">圖片</span></td>
|
|
|
+ <td class="table__data" style="display:flex;justify-content:center">
|
|
|
+ <div class="img__table"><img src="http://127.0.0.1:1313/{{ data['src'] }}" width="100%" height="100%"></div>
|
|
|
+ </td>
|
|
|
+ <div class="modal fade" id="{{ tabidx }}-{{ key }}-{{ loop.index }}" tabindex="-1" role="dialog" aria-labelledby="{{ key }}-{{ loop.index }}Label" aria-hidden="true">
|
|
|
+ <div class="modal-dialog" role="document">
|
|
|
+ <div class="modal-content">
|
|
|
+ <div class="modal-header border-0">
|
|
|
+ <h5 class="modal-title modal__title" id="exampleModalLabel">編輯</h5>
|
|
|
+ <button type="button" class="close modal__close" data-dismiss="modal" aria-label="Close">
|
|
|
+ <span class="modal__close__back">
|
|
|
+ <span aria-hidden="true">×</span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <input id="image" name="image-{{ loop.index }}" type="file" value="{{ data['src'] }}">
|
|
|
+ <input name="{{ tabidx }}-{{ key }}-{{ loop.index }}" type="hidden" value="{{ data }}">
|
|
|
+ <div class="modal__img"><img src="http://127.0.0.1:1313/{{ data['src'] }}"></div>
|
|
|
+ <div class="modal-footer pb-0 border-0">
|
|
|
+ <button type="button" class="btn btn__cancel" data-dismiss="modal">取消</button>
|
|
|
+ <input class="btn btn__submitadd" type="submit" value="完成">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ {% elif key == "yt_video" %}
|
|
|
+ <td class="table__data"><span class="badge badge-pill badge__video">影片</span></td>
|
|
|
+ <td class="table__data">
|
|
|
+ {{ data['videoid'] }}
|
|
|
+ </td>
|
|
|
+ <div class="modal fade" id="{{ tabidx }}-{{ key }}-{{ loop.index }}" tabindex="-1" role="dialog" aria-labelledby="{{ key }}-{{ loop.index }}Label" aria-hidden="true">
|
|
|
+ <div class="modal-dialog" role="document">
|
|
|
+ <div class="modal-content">
|
|
|
+ <div class="modal-header border-0">
|
|
|
+ <h5 class="modal-title modal__title" id="exampleModalLabel">編輯</h5>
|
|
|
+ <button type="button" class="close modal__close" data-dismiss="modal" aria-label="Close">
|
|
|
+ <span class="modal__close__back">
|
|
|
+ <span aria-hidden="true">×</span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <input name="{{ tabidx }}-{{ key }}-{{ loop.index }}" class="form-control form-control-lg " value="{{ data }}">
|
|
|
+ <div class="modal-footer pb-0 border-0">
|
|
|
+ <button type="button" class="btn btn__cancel" data-dismiss="modal">取消</button>
|
|
|
+ <input class="btn btn__submitadd" type="submit" value="完成">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ {% else %}
|
|
|
+ <td class="table__data"><span class="badge badge-pill badge__txt">文字</span></td>
|
|
|
+ <td class="table__data txt__cut">
|
|
|
+ {{ data }}
|
|
|
+ </td>
|
|
|
+ <div class="modal fade" id="{{ tabidx }}-{{ key }}-{{ loop.index }}" tabindex="-1" role="dialog" aria-labelledby="{{ key }}-{{ loop.index }}Label" aria-hidden="true">
|
|
|
+ <div class="modal-dialog" role="document">
|
|
|
+ <div class="modal-content">
|
|
|
+ <div class="modal-header border-0">
|
|
|
+ <h5 class="modal-title modal__title" id="exampleModalLabel">編輯</h5>
|
|
|
+ <button type="button" class="close modal__close" data-dismiss="modal" aria-label="Close">
|
|
|
+ <span class="modal__close__back">
|
|
|
+ <span aria-hidden="true">×</span>
|
|
|
+ </span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <input name="{{ tabidx }}-{{ key }}-{{ loop.index }}" class="form-control form-control-lg modal__text__input" value="{{ data }}">
|
|
|
+ <div class="modal-footer pb-0 border-0">
|
|
|
+ <button type="button" class="btn btn__cancel" data-dismiss="modal">取消</button>
|
|
|
+ <input class="btn btn__submitadd" type="submit" value="完成">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ {% endif %}
|
|
|
+ <td class="table__data">
|
|
|
+ <div class="d-flex justify-content-center">
|
|
|
+ <button type="button" class="btn__edit m-1" data-toggle="modal" data-target="#{{ tabidx }}-{{ key }}-{{ loop.index }}"><i class="fas fa-edit"></i></button>
|
|
|
+ <form action="#" method="POST">
|
|
|
+ <button class="btn__delete m-1" type="submit" value="delete"><i class="fas fa-trash-alt"></i></button>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ {% endfor %}
|
|
|
+ {% endif %}
|
|
|
{% endfor %}
|
|
|
- {% endif %}
|
|
|
- {% endfor %}
|
|
|
- </table>
|
|
|
-</form>
|
|
|
-</div>
|
|
|
-
|
|
|
+ </table>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
{% endfor %}
|
|
|
{% endblock main %}
|