diff options
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/metadata_edits.py | 12 | ||||
-rw-r--r-- | wqflask/wqflask/templates/case_attributes.html | 50 |
2 files changed, 61 insertions, 1 deletions
diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py index b2a23f69..664e441c 100644 --- a/wqflask/wqflask/metadata_edits.py +++ b/wqflask/wqflask/metadata_edits.py @@ -708,6 +708,18 @@ def show_case_attribute_columns(): for _, diff in diff_data.items(): diff = json.loads(diff) if (m_ := diff.get("Modifications")): + if m_.get("description"): + m_["description"]["Diff"] = "\n".join( + difflib.ndiff( + [m_.get("description")["Original"]], + [m_.get("description")["Current"]] + )) + if m_.get("name"): + m_["name"]["Diff"] = "\n".join( + difflib.ndiff( + [m_.get("name")["Original"]], + [m_.get("name")["Current"]] + )) modifications.append(m_) if (d_ := diff.get("Deletions")): deletions.append(d_) diff --git a/wqflask/wqflask/templates/case_attributes.html b/wqflask/wqflask/templates/case_attributes.html index 7aa6ee73..d64efd0f 100644 --- a/wqflask/wqflask/templates/case_attributes.html +++ b/wqflask/wqflask/templates/case_attributes.html @@ -114,7 +114,55 @@ {% endfor %} </tbody> </table> -</div> + + <h2>Please Review This Changes</h2> + + {% if modifications %} + <h2>Modified Data:</h2> + + <table class="table table-responsive table-hover table-striped cell-border" id="table-modifications"> + <thead> + <th scope="col">Case Attribute Edits</th> + <th scope="col"></th> + </thead> + <tbody> + {{ modifications }} + {% for data in modifications %} + {% set reject_url = "" %} + {% set approve_url = "" %} + <tr> + <td> + {% if data.get("name")%} + <b>Name:</b><br/> + <small>Original: </small> {{ data["name"].get("Original") }}<br/> + <small>Current: </small>{{ data["name"].get("Current") }} <br/> + <small>Diff:</small><br/> + <pre>{{data["name"].get("Diff")}}</pre> + {% elif data.get("description")%} + <b>Description:</b><br/> + <small>Original: </small> {{ data["description"].get("Original") }}<br/> + <small>Current: </small>{{ data["description"].get("Current") }} <br/> + <small>Diff:</small><br/> + <pre>{{data["description"].get("Diff")}}</pre> + {% endif %} + </td> + <td> + <button type="button" + class="btn btn-secondary btn-sm"> + <a href="{{ reject_url }}">Reject</a> + </button> + <button type="button" + class="btn btn-warning btn-sm"> + <a href="{{ approve_url }}">Approve</a> + </button> + </td> + </tr> + {% endfor %} + </tbody> + </table> + + {% endif %} + </div> {%endblock%} {% block js %} |