base.html 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 title -%}
  8. {{ title }} {{ SITE['title'] }} - {{ _(SITE['description']) }}
  9. {%- endblock title %}
  10. {% block style -%}
  11. {{ super() }}
  12. <link href="https://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. {% block content %}{% endblock %}
  35. </div>
  36. {% endblock %}
  37. {% macro dropdown() -%}
  38. {% if g.user.is_authenticated %}
  39. <div class="btn-group pull-right">
  40. <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  41. {{ g.user.username }} <span class="caret"></span>
  42. </button>
  43. <ul class="dropdown-menu">
  44. <li><a href="{{ url_for('user.user',username=g.user.username) }}">{{ _('Home Page') }}</a></li>
  45. <li><a href="{{ url_for('setting.setting') }}">{{ _('Setting')}}</a></li>
  46. <li role="separator" class="divider"></li>
  47. <li><a href="{{ url_for('auth.logout') }}">{{ _('Logout')}}</a></li>
  48. </ul>
  49. </div>
  50. <a href="{{ url_for('message.list') }}" class="btn btn-sm btn-primary pull-right">
  51. {{ _('NoticeList') }}
  52. {%- set n = current_user.message_count -%}
  53. {%- if n and n != '0' -%}
  54. <span class="badge" style="padding:2px 5px;">
  55. {{ n }}
  56. </span>
  57. {%- endif -%}
  58. </a>
  59. {% else %}
  60. <a href="{{ url_for('auth.register') }}" class="btn btn-sm btn-primary pull-right">{{ _('Register') }}</a>
  61. <a href="{{ url_for('auth.login') }}" class="btn btn-sm btn-primary pull-right">{{ _('Login') }}</a>
  62. {% endif %}
  63. {%- endmacro %}