|
40 | 40 | {% endfor %} |
41 | 41 |
|
42 | 42 | {% block content %} |
43 | | - |
44 | | - {% if configOverride %} |
45 | | - <p class="first warning"> |
46 | | - <span class="icon" aria-hidden="true"></span> |
47 | | - <span class="visually-hidden">{{ "Warning"|t('entry-type-rules') }}: </span> |
48 | | - {{ "The Entry Type Rules plugin settings are being overridden in the 'config/entry-type-rules.php' file."|t('entry-type-rules') }} |
49 | | - </p> |
50 | | - <hr /> |
51 | | - {% endif %} |
52 | | - |
53 | | - {{ actionInput('entry-type-rules/settings/save-settings') }} |
54 | | - |
55 | | - {{ forms.hidden({ |
56 | | - name: 'pluginHandle', |
57 | | - value: 'entry-type-rules'}) |
58 | | - }} |
59 | | - |
60 | | - {% for section in sections | filter(section => section.type != 'single') %} |
61 | | - |
62 | | - {% if not loop.first %}<hr />{% endif %} |
63 | | - |
64 | | - <section> |
65 | | - <h2 class="text-xl">{{ section.name ~ ' ' ~ section.type|capitalize ~ ' ' ~ "Section"|t('entry-type-rules') }}</h2> |
66 | | - <table class="data fullwidth collapsible"> |
67 | | - <thead> |
68 | | - <tr> |
69 | | - <th> |
70 | | - <span class="nowrap"> |
71 | | - {{ "Entry Type"|t('entry-type-rules') }} |
72 | | - <span class="info">{{ "The entry type and its current total entry count."|t('entry-type-rules') }}</span> |
73 | | - </span> |
74 | | - </th> |
75 | | - <th> |
76 | | - <span class="nowrap"> |
77 | | - {{ "Limit"|t('entry-type-rules') }} |
78 | | - <span class="info"> |
79 | | - {{ "Limit the number of entries for the entry type."|t('entry-type-rules') }}<br /> |
80 | | - <em>{{ "Leave blank or set to zero to remove limits for the entry type."|t('entry-type-rules') }}</em> |
81 | | - </span> |
82 | | - </span> |
83 | | - </th> |
84 | | - <th> |
85 | | - <span class="nowrap"> |
86 | | - {{ "User Groups"|t('entry-type-rules') }} |
87 | | - <span class="info"> |
88 | | - {{ "Limit which user groups can add new entries for the entry type."|t('entry-type-rules') }}<br /> |
89 | | - <em>{{ "Admin users will always be able to add new entries."|t('entry-type-rules') }}</em> |
90 | | - </span> |
91 | | - </span> |
92 | | - </th> |
93 | | - </tr> |
94 | | - </thead> |
95 | | - <tbody> |
96 | | - {% for entryType in section.entryTypes %} |
97 | | - {% set entryTypeCount = craft.entries.section(section.handle).type(entryType.handle).count %} |
98 | | - {% set limitValue = settings.sections[section.handle][entryType.handle].limit|default('') %} |
99 | | - <tr class="entryTypeRulesLimit" data-count="{{ entryTypeCount }}"> |
100 | | - <td> |
101 | | - <strong>{{ entryType.name }}</strong> <i>{{ entryType.handle }}</i><br/> |
102 | | - <span class="entryTypeRulesLimit__count inline-block"> |
103 | | - {{ "Entries"|t('entry-type-rules') }}: {{ entryTypeCount }} |
104 | | - </span> |
105 | | - <span class="entryTypeRulesLimit__warning inline-block ml-2 warning hidden" style="margin-top: -3px; margin-left: 5px;"> |
106 | | - <span class="icon" aria-hidden="true"></span> |
107 | | - <span class="visually-hidden">{{ "Warning"|t('entry-type-rules') }}: </span> |
108 | | - </span> |
109 | | - </td> |
110 | | - <td> |
111 | | - <div class="entryTypeRulesLimit__input"> |
112 | | - {{ forms.textField({ |
113 | | - id: (entryType.handle ~ '_limit'), |
114 | | - name: ('sections[' ~ section.handle ~ ']['~ entryType.handle ~ '][limit]'), |
115 | | - type: 'number', |
116 | | - size: 5, |
117 | | - min: 0, |
118 | | - value: limitValue, |
119 | | - placeholder: '0', |
120 | | - unit: "Entries"|t('entry-type-rules'), |
121 | | - }) }} |
122 | | - </div> |
123 | | - </td> |
124 | | - <td> |
125 | | - {{ forms.checkboxSelectField({ |
126 | | - id: (entryType.handle ~ '_userGroups'), |
127 | | - name: ('sections[' ~ section.handle ~ ']['~ entryType.handle ~ '][userGroups]'), |
128 | | - options: groupOptions, |
129 | | - showAllOption: true, |
130 | | - allValue: '', |
131 | | - values: settings.sections[section.handle][entryType.handle].userGroups|default('') |
132 | | - }) }} |
133 | | - </td> |
134 | | - </tr> |
135 | | - {% endfor %} |
136 | | - </tbody> |
137 | | - </table> |
138 | | - </section> |
139 | | - |
140 | | - {% endfor %} |
| 43 | + {% if sections is empty %} |
| 44 | + <div class="zilch"> |
| 45 | + <p>{{ 'configureSections'|t('entry-type-rules', {'url' : sectionsUrl })|raw }}</p> |
| 46 | + </div> |
| 47 | + {% elseif not craft.entries.count() %} |
| 48 | + <div class="zilch"> |
| 49 | + <p>{{ 'configureEntries'|t('entry-type-rules', {'url' : entriesUrl })|raw }}</p> |
| 50 | + </div> |
| 51 | + {% else %} |
| 52 | + |
| 53 | + {% if configOverride %} |
| 54 | + <p class="first warning"> |
| 55 | + <span class="icon" aria-hidden="true"></span> |
| 56 | + <span class="visually-hidden">{{ "Warning"|t('entry-type-rules') }}: </span> |
| 57 | + {{ "The Entry Type Rules plugin settings are being overridden in the 'config/entry-type-rules.php' file."|t('entry-type-rules') }} |
| 58 | + </p> |
| 59 | + <hr /> |
| 60 | + {% endif %} |
| 61 | + |
| 62 | + {{ actionInput('entry-type-rules/settings/save-settings') }} |
| 63 | + |
| 64 | + {{ forms.hidden({ |
| 65 | + name: 'pluginHandle', |
| 66 | + value: 'entry-type-rules'}) |
| 67 | + }} |
| 68 | + |
| 69 | + {% for section in sections | filter(section => section.type != 'single') %} |
| 70 | + |
| 71 | + {% if not loop.first %}<hr />{% endif %} |
| 72 | + |
| 73 | + <section> |
| 74 | + <h2 class="text-xl">{{ section.name ~ ' ' ~ section.type|capitalize ~ ' ' ~ "Section"|t('entry-type-rules') }}</h2> |
| 75 | + <table class="data fullwidth collapsible"> |
| 76 | + <thead> |
| 77 | + <tr> |
| 78 | + <th> |
| 79 | + <span class="nowrap"> |
| 80 | + {{ "Entry Type"|t('entry-type-rules') }} |
| 81 | + <span class="info">{{ "The entry type and its current total entry count."|t('entry-type-rules') }}</span> |
| 82 | + </span> |
| 83 | + </th> |
| 84 | + <th> |
| 85 | + <span class="nowrap"> |
| 86 | + {{ "Limit"|t('entry-type-rules') }} |
| 87 | + <span class="info"> |
| 88 | + {{ "Limit the number of entries for the entry type."|t('entry-type-rules') }}<br /> |
| 89 | + <em>{{ "Leave blank or set to zero to remove limits for the entry type."|t('entry-type-rules') }}</em> |
| 90 | + </span> |
| 91 | + </span> |
| 92 | + </th> |
| 93 | + <th> |
| 94 | + <span class="nowrap"> |
| 95 | + {{ "User Groups"|t('entry-type-rules') }} |
| 96 | + <span class="info"> |
| 97 | + {{ "Limit which user groups can add new entries for the entry type."|t('entry-type-rules') }}<br /> |
| 98 | + <em>{{ "Admin users will always be able to add new entries."|t('entry-type-rules') }}</em> |
| 99 | + </span> |
| 100 | + </span> |
| 101 | + </th> |
| 102 | + </tr> |
| 103 | + </thead> |
| 104 | + <tbody> |
| 105 | + {% for entryType in section.entryTypes %} |
| 106 | + {% set entryTypeCount = craft.entries.section(section.handle).type(entryType.handle).count %} |
| 107 | + {% set limitValue = settings.sections[section.handle][entryType.handle].limit|default('') %} |
| 108 | + <tr class="entryTypeRulesLimit" data-count="{{ entryTypeCount }}"> |
| 109 | + <td> |
| 110 | + <strong>{{ entryType.name }}</strong> <i>{{ entryType.handle }}</i><br/> |
| 111 | + <span class="entryTypeRulesLimit__count inline-block"> |
| 112 | + {{ "Entries"|t('entry-type-rules') }}: {{ entryTypeCount }} |
| 113 | + </span> |
| 114 | + <span class="entryTypeRulesLimit__warning inline-block ml-2 warning hidden" style="margin-top: -3px; margin-left: 5px;"> |
| 115 | + <span class="icon" aria-hidden="true"></span> |
| 116 | + <span class="visually-hidden">{{ "Warning"|t('entry-type-rules') }}: </span> |
| 117 | + </span> |
| 118 | + </td> |
| 119 | + <td> |
| 120 | + <div class="entryTypeRulesLimit__input"> |
| 121 | + {{ forms.textField({ |
| 122 | + id: (entryType.handle ~ '_limit'), |
| 123 | + name: ('sections[' ~ section.handle ~ ']['~ entryType.handle ~ '][limit]'), |
| 124 | + type: 'number', |
| 125 | + size: 5, |
| 126 | + min: 0, |
| 127 | + value: limitValue, |
| 128 | + placeholder: '0', |
| 129 | + unit: "Entries"|t('entry-type-rules'), |
| 130 | + }) }} |
| 131 | + </div> |
| 132 | + </td> |
| 133 | + <td> |
| 134 | + {{ forms.checkboxSelectField({ |
| 135 | + id: (entryType.handle ~ '_userGroups'), |
| 136 | + name: ('sections[' ~ section.handle ~ ']['~ entryType.handle ~ '][userGroups]'), |
| 137 | + options: groupOptions, |
| 138 | + showAllOption: true, |
| 139 | + allValue: '', |
| 140 | + values: settings.sections[section.handle][entryType.handle].userGroups|default('') |
| 141 | + }) }} |
| 142 | + </td> |
| 143 | + </tr> |
| 144 | + {% endfor %} |
| 145 | + </tbody> |
| 146 | + </table> |
| 147 | + </section> |
| 148 | + |
| 149 | + {% endfor %} |
| 150 | + {% endif %} |
141 | 151 |
|
142 | 152 | {% endblock %} |
143 | 153 |
|
|
0 commit comments