base.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. <script type="text/javascript" src="{{ url_for('static',filename='assets/home.js')}}"></script>
  10. <!-- <script src="http://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> -->
  11. {%- endblock script %}
  12. {% block style -%}
  13. {{ super() }}
  14. <link href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  15. <link rel="stylesheet" href="{{ url_for('static',filename='assets/home.css')}}" type="text/css" media="screen" />
  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. {% else %}
  55. <a href="{{ url_for('auth.register') }}" class="btn btn-sm btn-primary pull-right">{{ _('Register') }}</a>
  56. <a href="{{ url_for('auth.login') }}" class="btn btn-sm btn-primary pull-right">{{ _('Login') }}</a>
  57. {% endif %}
  58. <a href="{{ url_for('tag.list') }}" class="btn btn-sm btn-primary pull-right">{{ _('TagList') }}</a>
  59. <a href="{{ url_for('user.list') }}" class="btn btn-sm btn-primary pull-right">{{ _('UserList') }}</a>
  60. {%- endmacro %}