create: fix logic error with existing refs

The "existing" branch in the template is used on the repo select screen
to filter out repositories which already have a wiki created for them.
This change adds a short-circuit which avoids the check in other
situations.

While I'm here I also tweaked the appearance of this page a bit.
This commit is contained in:
Drew DeVault 2021-08-06 10:00:46 +02:00
parent cb0e0d1446
commit d842538a2f
2 changed files with 24 additions and 11 deletions

View File

@ -45,23 +45,23 @@
{{csrf_token()}}
<input type="hidden" name="{{ typename }}" value="{{ item.name }}" />
<h4>
{% if item.name not in existing %}
<button
type="submit"
class="pull-right btn btn-primary btn-lg"
>Select {{ typename_pretty }} {{ icon("caret-right") }}</button>
{% else %}
<button
class="pull-right btn btn-default btn-lg"
disabled
>Already created</button>
{% endif %}
<a
href="{{ item.url }}"
target="_blank"
rel="noopener"
>{{ item.name }}</a>
</h4>
{% if typename != "repo" or item.name not in existing %}
<button
type="submit"
class="btn btn-primary btn-lg"
>Select {{ typename_pretty }} {{ icon("caret-right") }}</button>
{% else %}
<button
class="pull-right btn btn-default btn-lg"
disabled
>Already created</button>
{% endif %}
</form>
{% endfor %}
</div>

View File

@ -67,6 +67,19 @@ h5 {
}
}
.configure {
.event {
display: flex;
flex-direction: row;
align-items: center;
h4 {
border: none;
flex-grow: 1;
}
}
}
code.grey {
background: $gray-200;
padding: 0 0.25rem;