<commit_before>{{#contentFor "head"}}
	<script type='text/javascript'>

		/**
		 * @param {string} message
		 */
		$.fn.showMessage = function(message)
		{
			return this.each(function() { $(this).find('.message').html(message).show(); });
		};

		$(document).ready(function()
		{
			var $views = $('#views');
			var $viewItems = $views.find('input[type=checkbox]');
			var $models = $('#models');
			var $issues = $('#issues');
			var waiting = false;

			$views.find('.select-all').click(function()  { $viewItems.prop('checked', true); });
			$views.find('.select-none').click(function() { $viewItems.prop('checked', false); });

			$views.submit(function()
			{
				if (waiting) { return false; }

				var data = $views.serializeObject();

				$views.find('input, button').prop('disabled', true);
				waiting = true;

				$.post($views.attr('action'), {'contentType': 'application/json', 'data': data}, function(response)
				{
					$views.find('input, button').prop('disabled', false);
					waiting = false;

					if (response.success)
					{
						$views.find('input:checked').parent().remove();
						$views.showMessage('Done');
					}
					else
					{
						$views.showMessage('Failed')
					}
				});

				return false;
			});

			$models.find('button').click(function()
			{
				if (waiting) { return; }

				var $button = $(this);

				$button.prop('disabled', true);
				waiting = true;

				$.post('/admin/' + $button.data('url'), function(response)
				{
					$button.prop('disabled', false);
					waiting = false;
					$models.showMessage((response.success) ? 'Reloaded' : 'Failed');
				});
			});


			$issues.find('select').change(function()
			{
				var $selected = $issues.find('option:selected');

				$('#issue-doc').val($selected.val());
				$('#issue-slug').val($selected.text());
			});

			$issues.find('button').click(function()
			{
				var $selected = $issues.find('option:selected');
				var action = $(this).data('action');
				var slug = $('#issue-slug').val();
				var docID = $('#issue-doc').val();

				$.ajax({
					dataType: 'json',
					url: '/admin/issue/'+action+'/',
					data: {'slug': slug, 'docID': docID, 'oldSlug': $selected.text() },
					success: function(response)
					{
						if (response.success)
						{
							switch (action)
							{
								case 'save':
									if ($selected.text() == 'New')
									{
										// add option
										$issues.showMessage('Added ' + slug).find('select').append($('<option/>').val(docID).html(slug));
									}
									else
									{
										// update option
										$selected.text(slug);
										$selected.val(docID);
										$issues.showMessage('Updated ' + slug);
									}
									break;
								case 'delete':
									$issues.showMessage('Deleted ' + slug).find('li[value=' + docID + ']').remove();
									break;
							}
						}
						else
						{
							$issues.showMessage('Failed to ' + action + ' ' + slug);
						}
					}
				});
			});
		});
	</script>
{{/contentFor}}

<div id="logs">
	<table>
		<tbody>
		{{#each logs}}
			<tr class='head'><td colspan='2'>{{@key}}</td></tr>
			{{#this}}
			<tr class='{{level}}'><td>{{message}}</td><td class='timestamp'>{{timestamp}}</td></tr>
			{{/this}}
		{{/each}}
		</tbody>
	</table>
</div>

<div id="body">

	<fieldset id="statistics">
		<legend>Statistics</legend>
		<ul>
			<li><a href='https://www.google.com/analytics/web/#report/visitors-overview/a{{setting.google.analyticsID}}w43724061p43759940/'>Google Analytics</a></li>
			<li><a href='https://www.google.com/webmasters/tools/dashboard?hl=en&siteUrl=http://trailimage.com/&authuser=0'>Google Webmaster</a></li>
			<li><a href='https://www.facebook.com/insights/?sk=wo_{{setting.facebook.siteID}}'>Facebook Insights</a></li>
		</ul>
		<div class="message"></div>
	</fieldset>

	<fieldset id="api-keys">
		<legend>API Keys</legend>
		<ul>
			<li><a href='https://cloud.google.com/console#/project/{{setting.google.projectID}}'>Map API</a></li>
		</ul>
		<div class="buttons">
			<button>Flickr Token</button>
		</div>
		<div class="message"></div>
	</fieldset>

	<fieldset id="models">
		<legend>Cached Models</legend>
		<button data-url="library/reload">Reload Library</button><button data-url="photo-tag/reload">Reload Photo Tags</button>
		<div class="message"></div>
	</fieldset>

	<form id="views" action="/admin/view/delete">
		<fieldset>
			<legend>Cached Views</legend>
			<div class="buttons">Select <button type="button" class="select-all">All</button><button type="button" class="select-none">None</button></div>
			<div class="scroll">
				<ul>
			{{#views}}
					<li><label><input name='post{{@index}}' value='{{this}}' type='checkbox'/>{{this}}</label></li>
			{{/views}}
				</ul>
			</div>
			<div class="buttons"><button type="submit">Delete</button></div>
			<div class="message"></div>
		</fieldset>
	</form>

	<form id="issues" method="post">
		<fieldset>
			<legend>Issues</legend>
			<select>
				<option>New</option>
				{{#each issues}}
					<option value="{{this}}">{{@key}}</option>
				{{/each}}
			</select>
			<input type="text" id="issue-slug" placeholder="Slug"/>
			<input type="text" id="issue-doc" placeholder="Document ID"/>
			<div class="buttons">
				<button type="submit" data-action="delete">Delete</button>
				<button type="submit" data-action="save">Save</button>
			</div>
			<div class="message"></div>
		</fieldset>
	</form>

</div><commit_msg>link to flickr statistics<commit_after>{{#contentFor "head"}}
	<script type='text/javascript'>

		/**
		 * @param {string} message
		 */
		$.fn.showMessage = function(message)
		{
			return this.each(function() { $(this).find('.message').html(message).show(); });
		};

		$(document).ready(function()
		{
			var $views = $('#views');
			var $viewItems = $views.find('input[type=checkbox]');
			var $models = $('#models');
			var $issues = $('#issues');
			var waiting = false;

			$views.find('.select-all').click(function()  { $viewItems.prop('checked', true); });
			$views.find('.select-none').click(function() { $viewItems.prop('checked', false); });

			$views.submit(function()
			{
				if (waiting) { return false; }

				var data = $views.serializeObject();

				$views.find('input, button').prop('disabled', true);
				waiting = true;

				$.post($views.attr('action'), {'contentType': 'application/json', 'data': data}, function(response)
				{
					$views.find('input, button').prop('disabled', false);
					waiting = false;

					if (response.success)
					{
						$views.find('input:checked').parent().remove();
						$views.showMessage('Done');
					}
					else
					{
						$views.showMessage('Failed')
					}
				});

				return false;
			});

			$models.find('button').click(function()
			{
				if (waiting) { return; }

				var $button = $(this);

				$button.prop('disabled', true);
				waiting = true;

				$.post('/admin/' + $button.data('url'), function(response)
				{
					$button.prop('disabled', false);
					waiting = false;
					$models.showMessage((response.success) ? 'Reloaded' : 'Failed');
				});
			});


			$issues.find('select').change(function()
			{
				var $selected = $issues.find('option:selected');

				$('#issue-doc').val($selected.val());
				$('#issue-slug').val($selected.text());
			});

			$issues.find('button').click(function()
			{
				var $selected = $issues.find('option:selected');
				var action = $(this).data('action');
				var slug = $('#issue-slug').val();
				var docID = $('#issue-doc').val();

				$.ajax({
					dataType: 'json',
					url: '/admin/issue/'+action+'/',
					data: {'slug': slug, 'docID': docID, 'oldSlug': $selected.text() },
					success: function(response)
					{
						if (response.success)
						{
							switch (action)
							{
								case 'save':
									if ($selected.text() == 'New')
									{
										// add option
										$issues.showMessage('Added ' + slug).find('select').append($('<option/>').val(docID).html(slug));
									}
									else
									{
										// update option
										$selected.text(slug);
										$selected.val(docID);
										$issues.showMessage('Updated ' + slug);
									}
									break;
								case 'delete':
									$issues.showMessage('Deleted ' + slug).find('li[value=' + docID + ']').remove();
									break;
							}
						}
						else
						{
							$issues.showMessage('Failed to ' + action + ' ' + slug);
						}
					}
				});
			});
		});
	</script>
{{/contentFor}}

<div id="logs">
	<table>
		<tbody>
		{{#each logs}}
			<tr class='head'><td colspan='2'>{{@key}}</td></tr>
			{{#this}}
			<tr class='{{level}}'><td>{{message}}</td><td class='timestamp'>{{timestamp}}</td></tr>
			{{/this}}
		{{/each}}
		</tbody>
	</table>
</div>

<div id="body">

	<fieldset id="statistics">
		<legend>Statistics</legend>
		<ul>
			<li><a href='https://www.google.com/analytics/web/#report/visitors-overview/a{{setting.google.analyticsID}}w43724061p43759940/'>Google Analytics</a></li>
			<li><a href='https://www.google.com/webmasters/tools/dashboard?hl=en&siteUrl=http://trailimage.com/&authuser=0'>Google Webmaster</a></li>
			<li><a href='https://www.facebook.com/insights/?sk=wo_{{setting.facebook.siteID}}'>Facebook Insights</a></li>
			<li><a href='https://www.flickr.com/photos/trailimage/stats/'>Flickr Statistics</a></li>
		</ul>
		<div class="message"></div>
	</fieldset>

	<fieldset id="api-keys">
		<legend>API Keys</legend>
		<ul>
			<li><a href='https://cloud.google.com/console#/project/{{setting.google.projectID}}'>Map API</a></li>
		</ul>
		<div class="buttons">
			<button>Flickr Token</button>
		</div>
		<div class="message"></div>
	</fieldset>

	<fieldset id="models">
		<legend>Cached Models</legend>
		<button data-url="library/reload">Reload Library</button><button data-url="photo-tag/reload">Reload Photo Tags</button>
		<div class="message"></div>
	</fieldset>

	<form id="views" action="/admin/view/delete">
		<fieldset>
			<legend>Cached Views</legend>
			<div class="buttons">Select <button type="button" class="select-all">All</button><button type="button" class="select-none">None</button></div>
			<div class="scroll">
				<ul>
			{{#views}}
					<li><label><input name='post{{@index}}' value='{{this}}' type='checkbox'/>{{this}}</label></li>
			{{/views}}
				</ul>
			</div>
			<div class="buttons"><button type="submit">Delete</button></div>
			<div class="message"></div>
		</fieldset>
	</form>

	<form id="issues" method="post">
		<fieldset>
			<legend>Issues</legend>
			<select>
				<option>New</option>
				{{#each issues}}
					<option value="{{this}}">{{@key}}</option>
				{{/each}}
			</select>
			<input type="text" id="issue-slug" placeholder="Slug"/>
			<input type="text" id="issue-doc" placeholder="Document ID"/>
			<div class="buttons">
				<button type="submit" data-action="delete">Delete</button>
				<button type="submit" data-action="save">Save</button>
			</div>
			<div class="message"></div>
		</fieldset>
	</form>

</div>
{'fraction_non_alphanumeric': 0.2273476112026359, 'fraction_numerical': 0.0032948929159802307, 'mean_word_length': 3.245143745143745, 'pattern_counts': {'":': 0, '<': 239, '<?xml version=': 0, '>': 239, 'https://': 9, 'lorem ipsum': 0, 'www.': 7, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4365737', 'n_tokens_mistral': 4747, 'n_tokens_neox': 3629, 'n_words': 583}