base.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. {% extends 'maple/base.html' %}
  2. {% from 'base/paginate.html' import paginate%}
  3. {% from 'base/paginate.html' import footer as p_footer %}
  4. {% import 'base/link.html' as link %}
  5. {% import 'base/panel.html' as panel_base %}
  6. {% from 'base/head.html' import breadcrumb %}
  7. {% block main %}
  8. {% include "base/header.html" %}
  9. <div class="col-md-offset-1 col-md-10" style="padding:0;margin-top:60px">
  10. {% with messages = get_flashed_messages(with_categories=true) %}
  11. {% if messages %}
  12. {% for category,message in messages %}
  13. {% if category == 'message' -%}
  14. {% set category = 'info' %}
  15. {%- endif %}
  16. <div class="alert alert-{{ category }}" style="padding:8px">
  17. <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  18. <span aria-hidden="true">&times;</span>
  19. </button>
  20. <ul>
  21. <li>{{ message }} </li>
  22. </ul>
  23. </div>
  24. {% endfor %}
  25. {% endif %}
  26. {% endwith %}
  27. {{ dropdown() }}
  28. {% block content %}{% endblock %}
  29. </div>
  30. {% endblock %}
  31. {% macro dropdown() -%}
  32. {% if g.user.is_authenticated %}
  33. <div class="btn-group pull-right">
  34. <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  35. {{ g.user.username }} <span class="caret"></span>
  36. </button>
  37. <ul class="dropdown-menu">
  38. <li><a href="{{ url_for('user.user',username=g.user.username) }}">{{ _('Home Page') }}</a></li>
  39. <li><a href="{{ url_for('setting.setting') }}">{{ _('Setting')}}</a></li>
  40. <li role="separator" class="divider"></li>
  41. <li><a href="{{ url_for('auth.logout') }}">{{ _('Logout')}}</a></li>
  42. </ul>
  43. </div>
  44. {% else %}
  45. <a href="{{ url_for('auth.register') }}" class="btn btn-sm btn-primary pull-right">{{ _('Register') }}</a>
  46. <a href="{{ url_for('auth.login') }}" class="btn btn-sm btn-primary pull-right">{{ _('Login') }}</a>
  47. {% endif %}
  48. <a href="{{ url_for('tag.list') }}" class="btn btn-sm btn-primary pull-right">{{ _('TagList') }}</a>
  49. <a href="{{ url_for('user.list') }}" class="btn btn-sm btn-primary pull-right">{{ _('UserList') }}</a>
  50. {%- endmacro %}