base.html 2.8 KB

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