{{ define "page-styles"}}
    <style>
        div.share-user, div.share-login {
            margin-left: 2em;
            margin-top: .5em;
            font-style: italic;
        }

        a.share-add-user, a.share-add-login {
            margin-left: 2em;
            margin-top: .5em;
            font-style: italic;
        }

        div.share {
            margin-bottom: 2em;
        }

        :target {
            background-color: #c4e1ff;
        }
    </style>
{{ end }}

{{ define "page-content" }}
    <div id="shares">
        {{ range $share := .ShareInfos }}
            <div id="share-{{$share.UUID}}" class="share">
                UUID: {{ $share.UUID }} {{ if $share.IsAdmin }}
                <form style="display: inline-block;" action="delete-share" method="post">
                    <input type="hidden" name="share" value="{{ $share.UUID }}"/>
                    <input type="submit" value="Delete" class="delete"/>
                </form>{{ end }}
                <br/>
                Name: {{ $share.Name }}<br/>
                <hr/>
                {{ range $login := .Logins }}
                    <div id="login-{{$share.UUID}}-{{$login.LoginName}}" class="share-login">
                        Login {{ $login.LoginName }} {{ if $login.ReadOnly }}(ReadOnly){{ end }}
                        <form style="display: inline-block;" action="share-delete-login" method="post">
                            <input type="hidden" name="share" value="{{ $share.UUID }}"/>
                            <input type="hidden" name="login" value="{{ $login.LoginName }}"/>
                            <input type="submit" value="Delete" class="delete"/>
                        </form>
                    </div>
                {{ end }}
                <a href="share-add-login?share={{ $share.UUID }}" class="share-add-login">Add Login</a>
                <hr/>
                {{ if $share.IsAdmin }}
                    {{ range $user := .Users }}
                        <div id="user-{{$share.UUID}}-{{$user.Username}}" class="share-user">
                            User {{ $user.Username }} ({{ $user.Role }})
                            <form style="display: inline-block;" action="share-delete-user" method="post">
                                <input type="hidden" name="source" value="my-shares"/>
                                <input type="hidden" name="share" value="{{ $share.UUID }}"/>
                                <input type="hidden" name="user" value="{{ $user.Username }}"/>
                                <input type="submit" value="Delete" class="delete"/>
                            </form>
                        </div>
                    {{ end }}
                {{ end }}
                <a href="share-add-user?share={{ $share.UUID }}" class="share-add-user">Add User</a>
            </div>
        {{ end }}
        <a href="create-share" class="create-share">Create Share</a>
    </div>
{{ end }}