panel.html 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. {% from 'base/panel.html' import base %}
  2. {% from 'base/panel.html' import count %}
  3. {% macro tag_list() -%}
  4. {{ base() }}
  5. {%- endmacro %}
  6. {% macro tag(tag) -%}
  7. {{ base() }}
  8. <div class="panel panel-default hidden-xs" style="font-size:13px;">
  9. {{ parents(tag) }}
  10. {{ relation(tag) }}
  11. {{ children(tag) }}
  12. </div>
  13. {{ count() }}
  14. {%- endmacro %}
  15. {% macro parents(tag) -%}
  16. <div class="panel-body" style="padding:10;margin:0;">
  17. <strong>父节点</strong>
  18. </div>
  19. {% if tag.parent_id -%}
  20. {{ link(tag.parent.name) }}
  21. {% else %}
  22. {{ link('honmaple') }}
  23. {%- endif %}
  24. <div style="border-bottom:1px solid #eee"></div>
  25. {%- endmacro %}
  26. {% macro relation(tag) -%}
  27. {% set relates = tag.related_tags %}
  28. {% if relates -%}
  29. <div class="panel-body" style="padding:10;margin:0;">
  30. <strong>相关节点</strong>
  31. </div>
  32. {% for child in relates -%}
  33. {{ link(child.name) }}
  34. {%- endfor %}
  35. {%- endif %}
  36. {%- endmacro %}
  37. {% macro children(tag) -%}
  38. {% set children = tag.children.all() %}
  39. {% if children -%}
  40. <div class="panel-body" style="padding:10;margin:0;">
  41. <strong>子节点</strong>
  42. </div>
  43. {% for child in children -%}
  44. {{ link(child.name) }}
  45. {%- endfor %}
  46. {%- endif %}
  47. {%- endmacro %}
  48. {% macro link(name) -%}
  49. <div class="panel-body" style="padding:10px;margin-top:0;padding-top:0">
  50. <img alt="" src="{{ url_for('avatar',text=name)}}" style="width:24px;"/>
  51. <a class="text-capitalize" href="{{ url_for('tag.tag',name=name)}}" style="color:#555;">{{ name }}</a>
  52. </div>
  53. {%- endmacro %}