puphpet/puphpet

View on GitHub
src/PuphpetBundle/Resources/views/vagrantfile-digitalocean/machine.html.twig

Summary

Maintainability
Test Coverage
{% set uniqid = uniqid ?? uniqid('machine_') %}
{% set idBase = "vagrantfile-vm-provider-digitalocean-machines-#{uniqid}" %}
{% set nameBase = "vagrantfile[vm][provider][digitalocean][machines][#{uniqid}]" %}

<div id="{{ idBase }}" data-uniqid="{{ uniqid }}" data-name="{{ nameBase }}"
     class="tab-pane {{ active is defined and active ? 'active' }}">
    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-id">
            Internal Identifier
        </label>
        <input type="text" id="{{ idBase }}-id"
               name="{{ nameBase }}[id]"
               placeholder="digitalocean1" class="form-control"
               value="{{ machine.id }}" />
        <div class="help-block">
            This is the ID used within the <code>Vagrantfile</code>. It is only used
            for your internal identification.
        </div>
    </div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-hostname">
            Hostname
        </label>
        <input type="text" id="{{ idBase }}-hostname"
               name="{{ nameBase }}[hostname]"
               placeholder="digitalocean1.puphpet" class="form-control"
               value="{{ machine.hostname }}" />
        <div class="help-block">
            The hostname the machine should have.
            <a href="http://stackoverflow.com/a/3523068/446766"
               target="_blank">This answer lists all valid characters.</a>
        </div>
    </div>

    <div class="clearfix"></div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-region">
            Datacenter Location
        </label>
        <select id="{{ idBase }}-region"
               name="{{ nameBase }}[region]"
               class="form-control select-tag">
            {% for region in regions %}
                <option value="{{ region }}"
                    {% if region == machine.region %}selected{% endif %}>{{ region }}</option>
            {% endfor %}
        </select>
        <div class="help-block">
            Choose the one closest to you, or your target audience!
        </div>
    </div>

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-size">
            Server Size
        </label>
        <select id="{{ idBase }}-size"
               name="{{ nameBase }}[size]"
               class="form-control select-tag">
            {% for size, name in sizes %}
                <option value="{{ size }}"
                    {% if size == machine.size %}selected{% endif %}>{{ name }}</option>
            {% endfor %}
        </select>
        <div class="help-block">
            <a href="https://www.digitalocean.com/pricing" target="_blank">Pricing information</a>.
            Digital Ocean charges by the hour, but also shows what a full month would cost.
        </div>
    </div>

    <div class="clearfix"></div>
</div>