|
1 | 1 | <!--
|
2 | 2 | create a new matrix supporting subtechniques and cell colors.
|
3 |
| - Params: tactics: Tactic[] |
4 |
| -
|
5 |
| - Tactic object format: { |
6 |
| - id: uid of tactic |
7 |
| - name: display name of tactic |
8 |
| - url: url of the tactic page |
9 |
| - techniques: Technique[] |
10 |
| - } |
11 |
| -
|
12 |
| - Technique object format: { |
13 |
| - id: uid of technique |
14 |
| - name: technique name |
15 |
| - url: url of the technique page |
16 |
| - color: optional, the color with which to style the technique |
17 |
| - subtechniques: Technique[] or [] |
18 |
| - } |
19 |
| -
|
| 3 | + Params: |
| 4 | + matrices: Matrix[] of matrices to display on the page |
| 5 | + has_subtechniques: boolean, true if the matrix has subtechniques in it |
| 6 | + tour_technique: the technique to use in the sub-techniques tour |
| 7 | + isIndex: boolean, true if this matrix is going on the index page |
20 | 8 | -->
|
21 | 9 |
|
22 | 10 | {% macro matrices(matrices, has_subtechniques, tour_technique, isIndex) %}
|
|
52 | 40 | <div id="layouts-content">
|
53 | 41 | <div class="matrix-type side">
|
54 | 42 | {% for matrix in matrices %}
|
55 |
| - <div class="matrix-container p-3"> |
56 |
| - {% if matrices | length > 1%} |
57 |
| - <h3 class="text-center matrix-title">{{matrix.name}}</h3> |
58 |
| - {% endif %} |
59 |
| - <div class="overflow-x-auto pb-3"> |
60 |
| - {{ matrix_side(matrix.tactics, tour_technique) }} |
61 |
| - </div> |
62 |
| - {% if not isIndex %} |
63 |
| - <div class="timestamp deemphasis text-center pt-3">Last modified: {{matrix.timestamp}}</div> |
64 |
| - {% endif %} |
65 |
| - </div> |
| 43 | + {{ matrix_box('side', matrix, matrices | length, tour_technique, isIndex) }} |
66 | 44 | {% endfor %}
|
67 | 45 | </div>
|
68 | 46 | <div class="matrix-type flat d-none">
|
69 | 47 | {% for matrix in matrices %}
|
70 |
| - <div class="matrix-container p-3"> |
71 |
| - {% if matrices | length > 1%} |
72 |
| - <h3 class="text-center matrix-title">{{matrix.name}}</h3> |
73 |
| - {% endif %} |
74 |
| - <div class="overflow-x-auto pb-3"> |
75 |
| - {{ matrix_flat(matrix.tactics, tour_technique) }} |
76 |
| - </div> |
77 |
| - {% if not isIndex %} |
78 |
| - <div class="timestamp deemphasis text-center pt-3">Last modified: {{matrix.timestamp}}</div> |
79 |
| - {% endif %} |
80 |
| - </div> |
| 48 | + {{ matrix_box('flat', matrix, matrices | length, tour_technique, isIndex) }} |
81 | 49 | {% endfor %}
|
82 | 50 | </div>
|
83 | 51 | </div>
|
84 | 52 | {% else %}
|
85 | 53 | {% for matrix in matrices %}
|
86 |
| - <div class="matrix-container p-3"> |
87 |
| - {% if matrices | length > 1%} |
88 |
| - <h3 class="text-center matrix-title">{{matrix.name}}</h3> |
89 |
| - {% endif %} |
90 |
| - <div class="overflow-x-auto pb-3"> |
91 |
| - {{ matrix_side(matrix.tactics, tour_technique) }} |
92 |
| - </div> |
93 |
| - {% if not isIndex %} |
94 |
| - <div class="timestamp deemphasis text-center pt-3">Last modified: {{matrix.timestamp}}</div> |
95 |
| - {% endif %} |
96 |
| - </div> |
| 54 | + {{ matrix_box('side', matrix, matrices | length, tour_technique, isIndex) }} |
97 | 55 | {% endfor %}
|
98 | 56 | {% endif %}
|
99 | 57 | </div>
|
100 | 58 | {% endmacro %}
|
101 | 59 |
|
| 60 | +<!-- |
| 61 | + matrix container helper |
| 62 | + creates a matrix container with timestamp, overflow markers, and title |
| 63 | + params: |
| 64 | + whichmatrix: "flat" or "side" |
| 65 | + matrix: the matrix object to display |
| 66 | + num_matrices: number, the number of matrices on this page. Used to determine if title is necessary |
| 67 | + tour_technique: the technique to use in the matrix tour |
| 68 | + isIndex: boolean, is this matrix being displayed on the index page? |
| 69 | +--> |
| 70 | +{% macro matrix_box(whichmatrix, matrix, num_matrices, tour_technique, isIndex) %} |
| 71 | +<div class="matrix-container p-3"> |
| 72 | + {% if num_matrices >1 %} |
| 73 | + <h3 class="text-center matrix-title">{{matrix.name}}</h3> |
| 74 | + {% endif %} |
| 75 | + <div class="scroll-indicator-group"> |
| 76 | + <div class="scroll-indicator left"> |
| 77 | + <div class="cover"></div> |
| 78 | + </div> |
| 79 | + <div class="overflow-x-auto matrix-scroll-box pb-3"> |
| 80 | + {% if whichmatrix == 'side' %} |
| 81 | + {{ matrix_side(matrix.tactics, tour_technique) }} |
| 82 | + {% elif whichmatrix == 'flat' %} |
| 83 | + {{ matrix_flat(matrix.tactics, tour_technique) }} |
| 84 | + {% endif %} |
| 85 | + </div> |
| 86 | + <div class="scroll-indicator right"> |
| 87 | + <div class="cover"></div> |
| 88 | + </div> |
| 89 | + </div> |
| 90 | + {% if not isIndex %} |
| 91 | + <div class="timestamp deemphasis text-center pt-3">Last modified: {{matrix.timestamp}}</div> |
| 92 | + {% endif %} |
| 93 | +</div> |
| 94 | +{% endmacro %} |
| 95 | + |
102 | 96 |
|
103 | 97 | {% macro matrix_flat(tactics, tour) %}
|
104 | 98 | <table class="matrix flat">
|
|
0 commit comments