<commit_before><!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorator="clients/_base">
<head>
	<title th:text="#{client.create}">_Create Client_</title>
	<link rel="stylesheet" th:href="@{/resources/bower_components/select2/select2.css}"
	      href="/resources/bower_components/select2/select2.css"/>
	<link rel="stylesheet" th:href="@{/resources/bower_components/select2/select2-bootstrap.css}"
	      href="/resources/bower_components/select2/select2-bootstrap.css"/>
    <style>
        .sub-cb {
        margin-left: 20px;
        }
    </style>
</head>
<body>
<main layout:fragment="main">
	<div class="row">
		<div class="col-md-8 col-md-offset-2 mrgn-tp-lg wb-frmvld">
			<form role="form" action="/clients/create"
			      th:action="@{/clients/{id}/edit(id=${client.id})}" method="post">
				<section class="panel panel-default">
					<div class="panel-heading">
						<h3 class="panel-title" th:text="#{client.edit.title(${client.clientId})}">_Edit Client_</h3>
					</div>
					<div class="panel-body">
						<div class="form-group">
							<label class="control-label" th:text="#{client.clientid}" for="clientId">_Client_id_</label>

							<div th:if="${#maps.containsKey(errors, 'clientId')}" th:text="${errors.clientId}"
							     class="alert alert-warning">_Client ID Error_
							</div>
							<input type="text" class="form-control input-full"
							       disabled="disabled" th:value="${client.clientId}"/>
						</div>

						<div class="form-group">
							<label class="control-label" th:text="#{client.details.tokenValidity}" for="tokenValidity">_Token
								Validity_</label>

							<div th:if="${#maps.containsKey(errors, 'tokenValidity')}" th:text="${errors.tokenValidity}"
							     class="alert alert-warning">_Token Validity Error_
							</div>

							<select id="tokenValidity" name="accessTokenValiditySeconds"
							        class="form-control input-full">
								<option class="tokenValidityInSeconds" th:each="time : ${available_token_validity}"
								        th:value="${time}" th:text="${time}" th:selected="${time == client.accessTokenValiditySeconds}"/>
							</select>

						</div>

						<div class="form-group">
							<label class="control-label" th:text="#{client.grant-types}" for="authorizedGrantTypes">_Grant
								Types_</label>

							<div id="grant-error" th:if="${#maps.containsKey(errors, 'grant')}"
							     th:text="${errors.grant}" class="alert alert-warning">_Role Error_
							</div>
							<select id="authorizedGrantTypes" name="authorizedGrantTypes"
							        class="form-control input-full" required="required">
								<option th:each="grant : ${available_grants}" th:value="${grant}" th:text="${grant}" th:selected="${grant == selectedGrant}"/>
							</select>
						</div>

						<div class="form-group">
							<div class="col-md-12">
								<div class="checkbox">

									<label for="new_secret"> <input type="checkbox" id="new_secret" name="new_secret" value="new_secret"/>
										<span th:text="#{client.edit.new-secret}">_NEW SECRET_</span> </label>
								</div>
							</div>

						</div>

						<div class="form-group" ng-app="">
							<label class="control-label" th:text="#{client.scopes}">_Scopes_</label>

							<div id="scope-error" th:if="${#maps.containsKey(errors, 'scope')}"
							     th:text="${errors.scope}" class="alert alert-warning">_Scope Error_
							</div>
							<div class="col-md-12">
								<div class="checkbox">

									<label for="scope_read">
										<input type="checkbox" id="scope_read" name="scope_read" th:attr="ng-init='readSwitch=\''+${given_scope_read}+'\''" ng-checked="readSwitch" value="read" ng-model="readSwitch"/>
										<span th:text="#{client.scope.read}">Read</span> </label>
								</div>
							</div>
                            <div class="col-md-12" ng-show="readSwitch">
                                <div class="checkbox sub-cb">
                                    <label for="scope_auto_read">
                                        <input type="checkbox" id="scope_auto_read" name="scope_auto_read" th:checked="${given_scope_auto_read}" value="read"/>
                                        <span th:text="#{client.scope.autoApprove}">Auto-approve read access</span>
                                    </label>
                                </div>
                            </div>
							<div class="col-md-12">
								<div class="checkbox">
									<label for="scope_write">
										<input type="checkbox" id="scope_write" name="scope_write" th:attr="ng-init='writeSwitch=\''+${given_scope_write}+'\''" ng-checked="writeSwitch" value="write" ng-model="writeSwitch"/>
										<span th:text="#{client.scope.write}">Write</span> </label>
								</div>
							</div>
                            <div class="col-md-12" ng-show="writeSwitch">
                                <div class="checkbox sub-cb">
                                    <label for="scope_auto_write">
                                        <input type="checkbox" id="scope_auto_write" name="scope_auto_write" th:checked="${given_scope_auto_write}" value="write"/>
                                        <span th:text="#{client.scope.autoApprove}">Auto-approve write access</span>
                                    </label>
                                </div>
                            </div>
						</div>

					</div>
					<div class="panel-footer text-right">
						<a type="reset" class="btn btn-default" href="#" th:href="@{/clients/{id}(id=${client.id})}">Cancel</a>
						<button id="edit-client-submit" type="submit" th:text="#{client.edit.button}"
						        class="btn btn-primary submit">_EDIT_CLIENT_
						</button>
					</div>
				</section>
			</form>
		</div>
	</div>
</main>

<th:block layout:fragment="pageScripts" th:inline="javascript">
	<script th:src="@{/resources/bower_components/select2/select2.min.js}"
	        src="/resources/bower_components/select2/select2.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function () {
			$("#tokenValidity").select2().select2("val", [[${given_tokenValidity}]]);
			$("#authorizedGrantTypes").select2();
		});

	</script>
</th:block>
</body>
</html><commit_msg>Fixed checkbox selection for editing client<commit_after><!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorator="clients/_base">
<head>
	<title th:text="#{client.create}">_Create Client_</title>
	<link rel="stylesheet" th:href="@{/resources/bower_components/select2/select2.css}"
	      href="/resources/bower_components/select2/select2.css"/>
	<link rel="stylesheet" th:href="@{/resources/bower_components/select2/select2-bootstrap.css}"
	      href="/resources/bower_components/select2/select2-bootstrap.css"/>
    <style>
        .sub-cb {
        margin-left: 20px;
        }
    </style>
</head>
<body>
<main layout:fragment="main">
	<div class="row">
		<div class="col-md-8 col-md-offset-2 mrgn-tp-lg wb-frmvld">
			<form role="form" action="/clients/create"
			      th:action="@{/clients/{id}/edit(id=${client.id})}" method="post">
				<section class="panel panel-default">
					<div class="panel-heading">
						<h3 class="panel-title" th:text="#{client.edit.title(${client.clientId})}">_Edit Client_</h3>
					</div>
					<div class="panel-body">
						<div class="form-group">
							<label class="control-label" th:text="#{client.clientid}" for="clientId">_Client_id_</label>

							<div th:if="${#maps.containsKey(errors, 'clientId')}" th:text="${errors.clientId}"
							     class="alert alert-warning">_Client ID Error_
							</div>
							<input type="text" class="form-control input-full"
							       disabled="disabled" th:value="${client.clientId}"/>
						</div>

						<div class="form-group">
							<label class="control-label" th:text="#{client.details.tokenValidity}" for="tokenValidity">_Token
								Validity_</label>

							<div th:if="${#maps.containsKey(errors, 'tokenValidity')}" th:text="${errors.tokenValidity}"
							     class="alert alert-warning">_Token Validity Error_
							</div>

							<select id="tokenValidity" name="accessTokenValiditySeconds"
							        class="form-control input-full">
								<option class="tokenValidityInSeconds" th:each="time : ${available_token_validity}"
								        th:value="${time}" th:text="${time}" th:selected="${time == client.accessTokenValiditySeconds}"/>
							</select>

						</div>

						<div class="form-group">
							<label class="control-label" th:text="#{client.grant-types}" for="authorizedGrantTypes">_Grant
								Types_</label>

							<div id="grant-error" th:if="${#maps.containsKey(errors, 'grant')}"
							     th:text="${errors.grant}" class="alert alert-warning">_Role Error_
							</div>
							<select id="authorizedGrantTypes" name="authorizedGrantTypes"
							        class="form-control input-full" required="required">
								<option th:each="grant : ${available_grants}" th:value="${grant}" th:text="${grant}" th:selected="${grant == selectedGrant}"/>
							</select>
						</div>

						<div class="form-group">
							<div class="col-md-12">
								<div class="checkbox">

									<label for="new_secret"> <input type="checkbox" id="new_secret" name="new_secret" value="new_secret"/>
										<span th:text="#{client.edit.new-secret}">_NEW SECRET_</span> </label>
								</div>
							</div>

						</div>

						<div class="form-group">
							<label class="control-label" th:text="#{client.scopes}">_Scopes_</label>

							<div id="scope-error" th:if="${#maps.containsKey(errors, 'scope')}"
							     th:text="${errors.scope}" class="alert alert-warning">_Scope Error_
							</div>
							<div class="col-md-12">
								<div class="checkbox">

									<label for="scope_read">
										<input type="checkbox" id="scope_read" name="scope_read" th:checked="${given_scope_read}" value="read" />
										<span th:text="#{client.scope.read}">Read</span> </label>
								</div>
							</div>
                            <div class="col-md-12" id="scope_auto_read_div" th:if="${given_scope_read}">
                                <div class="checkbox sub-cb">
                                    <label for="scope_auto_read">
                                        <input type="checkbox" id="scope_auto_read" name="scope_auto_read" th:checked="${given_scope_auto_read}" value="read"/>
                                        <span th:text="#{client.scope.autoApprove}">Auto-approve read access</span>
                                    </label>
                                </div>
                            </div>
							<div class="col-md-12">
								<div class="checkbox">
									<label for="scope_write">
										<input type="checkbox" id="scope_write" name="scope_write" th:checked="${given_scope_write}" value="write"/>
										<span th:text="#{client.scope.write}">Write</span> </label>
								</div>
							</div>
                            <div class="col-md-12" id="scope_auto_write_div" th:if="${given_scope_write}">
                                <div class="checkbox sub-cb">
                                    <label for="scope_auto_write">
                                        <input type="checkbox" id="scope_auto_write" name="scope_auto_write" th:checked="${given_scope_auto_write}" value="write"/>
                                        <span th:text="#{client.scope.autoApprove}">Auto-approve write access</span>
                                    </label>
                                </div>
                            </div>
						</div>

					</div>
					<div class="panel-footer text-right">
						<a type="reset" class="btn btn-default" href="#" th:href="@{/clients/{id}(id=${client.id})}">Cancel</a>
						<button id="edit-client-submit" type="submit" th:text="#{client.edit.button}"
						        class="btn btn-primary submit">_EDIT_CLIENT_
						</button>
					</div>
				</section>
			</form>
		</div>
	</div>
</main>

<th:block layout:fragment="pageScripts" th:inline="javascript">
	<script th:src="@{/resources/bower_components/select2/select2.min.js}"
	        src="/resources/bower_components/select2/select2.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function () {
			$("#tokenValidity").select2().select2("val", [[${given_tokenValidity}]]);
			$("#authorizedGrantTypes").select2();
			$("#scope_read").change(function() {
				handleChecked(this,"#scope_auto_read_div")
			});
			$("#scope_write").change(function() {
				handleChecked(this,"#scope_auto_write_div")
			});
			handleChecked = function(item, itemToShow) {
				if(item.checked) {
					$(itemToShow).show();
					}
			    else {
			    	$(itemToShow).hide();
			    }
			}
		});

	</script>
</th:block>
</body>
</html>
{'fraction_non_alphanumeric': 0.1818534015186735, 'fraction_numerical': 0.004803967147063382, 'mean_word_length': 2.603294249022892, 'pattern_counts': {'":': 0, '<': 241, '<?xml version=': 0, '>': 241, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4997981', 'n_tokens_mistral': 4931, 'n_tokens_neox': 3908, 'n_words': 594}