Changeset c8bbd6aea277a946dfc6cd0379b26aa9125bd33d


Ignore:
Timestamp:
31.07.2013 13:02:31 (8 years ago)
Author:
Stanislaw Klekot <dozzie@…>
Branches:
b66903eafbcb1d49112014abc82c8bf683413db0
Children:
9d6939db8ddaed6c5807da3611e6b64d56ddefd3
Parents:
0f22660ae601b23c4744e4739c77a44e4edcbd20
git-author:
Stanislaw Klekot <dozzie@…> (31.07.2013 13:02:31)
git-committer:
Stanislaw Klekot <dozzie@…> (31.07.2013 13:02:31)
Message:

Moved macro editing messages to Django messages.

Location:
dashwiki/macros
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • dashwiki/macros/templates/create_macro.html

    re91ffc rc8bbd6  
    66 
    77<h2>Create new macro</h2> 
    8  
    9 {% if error %} 
    10 <p class="error"> 
    11   {{ error }} 
    12 </p> 
    13 {% endif %} 
    14  
    15 {% if message %} 
    16 <p class="message"> 
    17   {{ message }} 
    18 </p> 
    19 {% endif %} 
    20  
    218{% if created %} 
    229<p> 
     
    3926</form> 
    4027{% endif %} 
    41  
    4228{% endblock %} 
  • dashwiki/macros/templates/edit_macro.html

    re91ffc rc8bbd6  
    44 
    55{% block body %} 
    6  
    76<h2>Edit macro <i>{{ form.instance.name }}</i></h2> 
    8  
    9 {% if error %} 
    10 <p class="error"> 
    11   {{ error }} 
    12 </p> 
    13 {% endif %} 
    14  
    15 {% if message %} 
    16 <p class="message"> 
    17   {{ message }} 
    18 </p> 
    19 {% endif %} 
    207 
    218{% if created %} 
     
    3926</form> 
    4027{% endif %} 
    41  
    4228{% endblock %} 
  • dashwiki/macros/templates/list_macros.html

    re91ffc rc8bbd6  
    44 
    55{% block body %} 
    6  
    76<h2>List of defined macros</h2> 
    87 
     
    3736  <a href="{% url dashwiki.macros.views.create_macro %}">Create new macro</a> 
    3837</div> 
    39  
    4038{% endblock %} 
  • dashwiki/macros/templates/remove_macro.html

    re91ffc rc8bbd6  
    44 
    55{% block body %} 
    6  
    7 <h2>Removing macro {{ name }}</h2> 
     6<h2>Removing macro <i>{{ name }}</i></h2> 
    87 
    98{% if not confirmed %} 
     
    2120{% else %} 
    2221<p> 
    23 Macro <i>{{ name }}</i> was successfully removed. 
    24 </p> 
    25 <p> 
    2622Go back to <a href="{% url dashwiki.macros.views.list_macros %}">list of macros</a>. 
    2723</p> 
    28  
    2924{% endif %} 
    30  
    3125{% endblock %} 
  • dashwiki/macros/views.py

    r1b550f rc8bbd6  
    88from models import Macro, MacroResultType, MacroProtocol 
    99from django.contrib.auth.decorators import login_required 
     10from django.contrib import messages 
    1011 
    1112from dashwiki.decorators import on_cancel 
     
    5051      context = RequestContext(request, { 
    5152        'form': macro_form, 
    52         'message': 'macro created', 
    5353        'created': True, 
    5454      }) 
     55      messages.success(request, 'macro created') 
    5556    else: 
    5657      context = RequestContext(request, { 
    5758        'form': macro_form, 
    58         'error': 'macro contains some errors', 
    5959      }) 
     60      messages.error(request, 'macro contains some errors') 
    6061  else: 
    6162    context = RequestContext(request, { 
     
    8889      context = RequestContext(request, { 
    8990        'form': macro_form, 
    90         'message': 'macro updated', 
    9191        'created': True, 
    9292      }) 
     
    9595      if macro_form.data['name'] != macro_name: 
    9696        Macro.objects.filter(name = macro_name).delete() 
    97         context['message'] = 'macro updated (renamed)' 
     97        messages.success(request, 'macro updated (renamed)') 
     98      else: 
     99        messages.success(request, 'macro updated') 
    98100    else: 
    99101      context = RequestContext(request, { 
    100102        'form': macro_form, 
    101         'error': 'macro contains some errors', 
    102103      }) 
     104      messages.error(request, 'macro contains some errors') 
    103105  else: 
    104106    context = RequestContext(request, { 
     
    126128                      user = request.user.username)) 
    127129 
     130  messages.success(request, 'macro successfully removed') 
    128131  context = RequestContext(request, { 
    129132    'name': macro_name, 
Note: See TracChangeset for help on using the changeset viewer.