base.html 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 script -%}
  8. {{ super() }}
  9. {%- endblock script %}
  10. {% block style -%}
  11. {{ super() }}
  12. <link href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  13. {%- endblock style %}
  14. {% block main %}
  15. {% include "base/header.html" %}
  16. <div class="col-md-offset-1 col-md-10" style="padding:0;margin-top:60px">
  17. {% with messages = get_flashed_messages(with_categories=true) %}
  18. {% if messages %}
  19. {% for category,message in messages %}
  20. {% if category == 'message' -%}
  21. {% set category = 'info' %}
  22. {%- endif %}
  23. <div class="alert alert-{{ category }}" style="padding:8px">
  24. <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  25. <span aria-hidden="true">&times;</span>
  26. </button>
  27. <ul>
  28. <li>{{ message }} </li>
  29. </ul>
  30. </div>
  31. {% endfor %}
  32. {% endif %}
  33. {% endwith %}
  34. {{ dropdown() }}
  35. {% block content %}{% endblock %}
  36. </div>
  37. {% endblock %}
  38. {% macro dropdown() -%}
  39. {% if g.user.is_authenticated %}
  40. <div class="btn-group pull-right">
  41. <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  42. {{ g.user.username }} <span class="caret"></span>
  43. </button>
  44. <ul class="dropdown-menu">
  45. <li><a href="{{ url_for('user.user',username=g.user.username) }}">{{ _('Home Page') }}</a></li>
  46. <li><a href="{{ url_for('setting.setting') }}">{{ _('Setting')}}</a></li>
  47. <li role="separator" class="divider"></li>
  48. <li><a href="{{ url_for('auth.logout') }}">{{ _('Logout')}}</a></li>
  49. </ul>
  50. </div>
  51. {% else %}
  52. <a href="{{ url_for('auth.register') }}" class="btn btn-sm btn-primary pull-right">{{ _('Register') }}</a>
  53. <a href="{{ url_for('auth.login') }}" class="btn btn-sm btn-primary pull-right">{{ _('Login') }}</a>
  54. {% endif %}
  55. <a href="{{ url_for('tag.list') }}" class="btn btn-sm btn-primary pull-right">{{ _('TagList') }}</a>
  56. <a href="{{ url_for('user.list') }}" class="btn btn-sm btn-primary pull-right">{{ _('UserList') }}</a>
  57. {%- endmacro %}