panel.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. {% macro base() -%}
  2. {% if g.user.is_authenticated %}
  3. <ul class="list-group">
  4. <a class="list-group-item list-group-item-info" href="{{ ask_url or url_for('topic.ask')}}">
  5. <span class="btn btn-info btn-block">{{ _('Ask Questions') }}</span>
  6. </a>
  7. </ul>
  8. <div class="list-group">
  9. <a href="{{ url_for('collect.list')}}" class="list-group-item">
  10. {{ _('Collects')}}
  11. </a>
  12. <a href="{{ url_for('follow.topic')}}" class="list-group-item">
  13. {{ _('Followings')}}
  14. </a>
  15. </div>
  16. {% else %}
  17. <div class="panel panel-default">
  18. <div class="panel-heading">
  19. Honmaple
  20. </div>
  21. <div class="panel-body text-center">
  22. <a class="btn btn-primary" href="{{ url_for('auth.register')}}">
  23. <i class="icon-user"></i>
  24. {{ _('now register')}}
  25. </a>
  26. </div>
  27. <div class="panel-footer text-center">
  28. {{ _('If you have a account,please') }}<a href="{{ url_for('auth.login')}}"> {{ _('login') }}</a>
  29. </div>
  30. </div>
  31. {% endif %}
  32. {%- endmacro %}
  33. {% macro board_list() -%}
  34. {{ base() }}
  35. {{ count() }}
  36. {%- endmacro %}
  37. {% macro board() -%}
  38. {{ base() }}
  39. {{ count() }}
  40. {%- endmacro %}
  41. {% macro collect() -%}
  42. {{ base() }}
  43. {{ count() }}
  44. {%- endmacro %}
  45. {% macro follow() -%}
  46. {{ base() }}
  47. {{ count() }}
  48. {%- endmacro %}
  49. {% macro tag_list() -%}
  50. {{ base() }}
  51. {{ count() }}
  52. {%- endmacro %}
  53. {% macro tag_panel() -%}
  54. {{ base() }}
  55. {{ count() }}
  56. {%- endmacro %}
  57. {% macro topic_list() -%}
  58. {{ base() }}
  59. {{ count() }}
  60. {%- endmacro %}
  61. {% macro index() -%}
  62. {{ base() }}
  63. {{ tags_panel(_('Hot Tags'),hot_tags) }}
  64. {{ tags_panel(_('Recent Tags'),recent_tags) }}
  65. {{ count() }}
  66. {%- endmacro %}
  67. {% macro tags_panel(text,tags) -%}
  68. <div class="panel panel-default">
  69. <div class="panel-heading">
  70. <h3>{{ text }}</h3>
  71. </div>
  72. <div class="panel-body text-center tags">
  73. {% set tags = tags() %}
  74. {% for tag in tags -%}
  75. <a href="{{ url_for('tag.tag',name=tag.name)}}" class="item_node">{{ tag.name }}</a>
  76. {%- endfor %}
  77. </div>
  78. </div>
  79. {%- endmacro %}
  80. {% macro count() -%}
  81. <div class="panel panel-default">
  82. <div class="panel-heading">
  83. {{ _('Forums Count') }}
  84. </div>
  85. <ul class="list-group">
  86. <li class="list-group-item">{{ _('Total number of registered users:')}} 0</li>
  87. <li class="list-group-item">{{ _('Total number of topics:') }} 0 </li>
  88. <li class="list-group-item">{{ _('Total number of posts:') }} 0 </li>
  89. </ul>
  90. </div>
  91. {%- endmacro %}
  92. {% macro panel(heading,body) -%}
  93. <div class="panel panel-default">
  94. <div class="panel-heading">
  95. {{ heading }}
  96. </div>
  97. <div class="panel-body text-center">
  98. {{ body }}
  99. </div>
  100. </div>
  101. {%- endmacro %}