base.html 3.0 KB

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