| {# |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| #}\ |
| {% python import difflib %}\ |
| {% python from allura.model import User %}\ |
| {% for key, values in changelist %}\ |
| {% choose %}\ |
| {% when key in ['description', 'attachments'] %}\ |
| - ${key.capitalize()} has changed: |
| |
| Diff: |
| |
| ~~~~ |
| |
| ${'\n'.join(difflib.unified_diff( |
| a=values[0].splitlines(), |
| b=values[1].splitlines(), |
| fromfile='old', |
| tofile='new', |
| lineterm=''))} |
| |
| ~~~~ |
| |
| {% end %}\ |
| {% otherwise %}\ |
| {% with oldv, newv = values %}\ |
| {% choose %}\ |
| {% when key == 'assigned_to' or isinstance(oldv, User) or isinstance(newv, User) %}\ |
| - **${key}**: {% if oldv %}${oldv.get_pref('display_name')} --> {% end %}{% choose %}{% when newv %}${newv.get_pref('display_name')}{% end %}{% otherwise %} nobody {% end %}{% end %} |
| {% end %}\ |
| {% when key == 'labels' %}\ |
| - **${key}**: ${', '.join(oldv)} --> ${', '.join(newv)} |
| {% end %}\ |
| {% otherwise %}\ |
| - **${key}**: ${oldv} --> ${newv} |
| {% end %}\ |
| {% end %}\ |
| {% end %}\ |
| {% end %}\ |
| {% end %}\ |
| {% end %}\ |
| {% if comment %}- **Comment**: |
| |
| ${comment} |
| {% end %}\ |