Changeset 349 in main


Ignore:
Timestamp:
09/28/11 13:14:55 (8 years ago)
Author:
pcosquer
Message:

refactor some templates: add an "undoable form" snippet

Location:
trunk/openPLM
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/plmapp/base_views.py

    r348 r349  
    179179                revision=plmobject.revision, reference=plmobject.reference) 
    180180 
    181 def handle_errors(func=None, undo="."): 
     181def handle_errors(func=None, undo=".."): 
    182182    """ 
    183183    Decorators which ensures that the user is connected and handles exceptions 
     
    197197        @login_required 
    198198        def wrapper(request, *args, **kwargs): 
    199             if request.method == "POST" and \ 
    200                 request.POST.get("action") == "Undo": 
     199            if request.method == "POST" and request.POST.get("_undo"): 
    201200                return HttpResponseRedirect(undo) 
    202201            try: 
  • trunk/openPLM/plmapp/views/main.py

    r348 r349  
    459459 
    460460########################################################################################## 
    461 @handle_errors 
     461@handle_errors(undo="..") 
    462462def add_file(request, obj_type, obj_ref, obj_revi): 
    463463    """ 
  • trunk/openPLM/templates/DisplayDocCadAdd.htm

    r286 r349  
    55 
    66{% block content %} 
    7 {% trans "Connect new document :" %} 
    8 <form method="POST" action=""> 
    9     <table class="Content"> 
    10         {{add_doc_cad_form}} 
    11         <tr> 
    12             <td></td> 
    13             <td> 
    14                 <input type="submit" value="{% trans "Validate" %}" name="action"/> 
    15                 <input type="submit" value="{% trans "Undo" %}" name="action"/> 
    16             </td> 
    17         </tr> 
    18     </table> 
    19 </form> 
     7    {% trans "Connect new document :" %} 
     8    {% with add_doc_cad_form as form %} 
     9        {% include "snippets/undo_form.htm" %} 
     10    {% endwith %} 
    2011{% endblock %} 
    2112 
  • trunk/openPLM/templates/DisplayFileAdd.htm

    r286 r349  
    55 
    66{% block content %} 
    7 {% trans "Add new file / Check-in file :" %} 
    8 <form method="POST" action="." enctype="multipart/form-data"> 
    9     <table class="Content"> 
    10         {{add_file_form}} 
    11         <tr> 
    12             <td></td> 
    13             <td> 
    14                 <input type="submit" value="{% trans "Validate" %}" name="action"/> 
    15                 <input type="submit" value="{% trans "Undo" %}" name="action"/> 
    16             </td> 
    17         </tr> 
    18     </table> 
     7    {% trans "Add new file / Check-in file :" %} 
     8    {% with add_file_form as form %} 
     9        {% with  "enctype='multipart/form-data'" as form_attributes %} 
     10            {% include "snippets/undo_form.htm" %} 
     11        {% endwith %} 
     12    {% endwith %} 
    1913</form> 
    2014{% endblock %} 
  • trunk/openPLM/templates/DisplayObjectChildAdd.htm

    r286 r349  
    55 
    66{% block content %} 
    7 <form method="POST" action=""> 
    8     <table class="Content"> 
    9         {{add_child_form}} 
    10         <tr> 
    11             <td></td> 
    12             <td> 
    13             <input type="submit" value="{% trans "Validate" %}" name="action"/> 
    14             <input type="submit" value="{% trans "Undo" %}" name="action"/> 
    15             </td> 
    16         </tr> 
    17     </table> 
    18 </form> 
     7    {% with add_child_form as form %} 
     8        {% include "snippets/undo_form.htm" %} 
     9    {% endwith %} 
    1910{% endblock %} 
    2011 
  • trunk/openPLM/templates/DisplayObjectChildEdit.htm

    r286 r349  
    3838        {% endfor %} 
    3939    </table> 
    40     <input type="submit" value="{% trans "Validate" %}" name="action"/> 
    41     <input type="submit" value="{% trans "Undo" %}" name="action"/> 
     40    <input type="submit" value="{% trans "Validate" %}" name="_validate"/> 
     41    <input type="submit" value="{% trans "Undo" %}" name="_undo"/> 
    4242</form> 
    4343{% endblock %} 
  • trunk/openPLM/templates/DisplayObjectManagementReplace.htm

    r286 r349  
    55 
    66{% block content %} 
    7 {% trans "Select a user for your delegation as : " %}{{role}} 
    8 <form method="POST" action=""> 
    9     <table class="Content"> 
    10         {{replace_management_form}} 
    11         <tr> 
    12             <td> 
    13             </td> 
    14             <td> 
    15                 <input type="submit" value="{% trans "Validate" %}" name="action"/> 
    16                 <input type="submit" value="{% trans "Undo" %}" name="action"/> 
    17             </td> 
    18         </tr> 
    19     </table> 
    20 </form> 
     7    {% trans "Select a user for your delegation as : " %}{{role}} 
     8    {% with replace_management_form as form %} 
     9        {% include "snippets/undo_form.htm" %} 
     10    {% endwith %} 
    2111{% endblock %} 
    2212 
  • trunk/openPLM/templates/DisplayRelPartAdd.htm

    r286 r349  
    44<!-- Manage html display in the Content div which correspond to the "parts" menu + "add new"--> 
    55 
    6 {% block content %} 
    7 <form method="POST" action=""> 
    8     <table class="Content"> 
    9         {{add_rel_part_form}} 
    10         <tr> 
    11             <td> 
    12             </td> 
    13             <td> 
    14                 <input type="submit" value="{% trans "Validate" %}" name="action"/> 
    15                 <input type="submit" value="{% trans "Undo" %}" name="action"/> 
    16             </td> 
    17         </tr> 
    18     </table> 
    19 </form> 
     6{% block content %}  
     7    {% with add_rel_part_form as form %} 
     8        {% include "snippets/undo_form.htm" %} 
     9    {% endwith %} 
    2010{% endblock %} 
    2111 
  • trunk/openPLM/templates/groups/users.htm

    r342 r349  
    1010        {% if is_owner %} 
    1111            <span class="ButtonLeft"> 
    12                     <a class="Button" href="./add_user/">{% trans "Add another user" %}</a> 
     12                    <a class="Button" href="./add/">{% trans "Add another user" %}</a> 
    1313            </span> 
    1414            {% if user_formset.forms %} 
Note: See TracChangeset for help on using the changeset viewer.