<commit_before><?php use_javascript('/../scripts/showdown.js'); ?>

<?php use_javascript('/../scripts/modern/autoresize.jquery.min.js'); ?>

<?php use_javascript('/../scripts/plupload.min.js'); ?>
<?php use_javascript('/../scripts/plupload.html5.min.js'); ?>
<?php use_stylesheet('/../styles/uploader.css'); ?>

<div class="row"><div class="span16">
<h1><?php echo __('New Post'); ?></h1>

<ul class="tabs" data-tabs="tabs" >
	<li class="active"><a href="#source"><?php echo __('Source'); ?></a></li>
	<li><a href="#preview"><?php echo __('Preview'); ?></a></li>
	<li><a href="#files"><?php echo __('Files'); ?></a></li>
</ul>

<div class="tab-content">
<div id="source" class="tab-pane active">

	<form action="<?php echo url_for('post_'.($form->getObject()->isNew() ? 'create' : 'update'), $form->getObject()); ?>" method="POST">
	<fieldset>
		<legend><?php echo __('Write your post'); ?></legend>
	
	<?php if ($form->hasGlobalErrors()) : ?>
		<div class="error"><?php echo $form->renderGlobalErrors(); ?></div>
	<?php endif; ?>
	
	<?php $checkboxes = array(); ?>
	<?php foreach ($form as $field) : ?>
		<?php if ($field->isHidden()) continue; ?>
		<?php 
			if (is_a($field->getWidget(), 'sfWidgetFormInputCheckbox')) {
				$checkboxes[] = $field;
				continue;
			}
		?>
		
		<div class="clearfix <?php echo $field->hasError() ? 'error' : ''?>">
			<?php echo $field->renderLabel(); ?>
			<div class="input">
				<?php echo $field->render(array('class' => 'xxlarge ' . ($field->hasError() ? 'error' : ''))); ?>
				<?php echo $field->renderError(); ?>
				<?php if($field->renderHelp() != "") : ?><span class="help-block"><?php echo $field->renderHelp(); ?></span><?php endif; ?>
			</div>
			
		</div>
	<?php endforeach; ?>
	
	<div class="clearfix">
		<label id="optionsCheckboxes"><?php echo __('Options'); ?></label>
			<div class="input">
				<ul class="inputs-list">
				<?php foreach ($checkboxes as $field) : ?>
					<li>
						<label>
							<?php echo $field->render(); ?>
							<span><?php echo $field->renderLabelName(); ?></span>
						</label>
					</li>
				<?php endforeach; ?>
				</ul>
		</div>
	</div>
	
	<div class="actions">
		<input type="submit" class="btn primary" value="<?php echo __('Post!'); ?>">
		<?php echo link_to(__('Abort'), 'post/index', array('class' => 'btn')) ?>
		
		<?php if (!$form->getObject()->isNew()) : ?>
			<?php echo link_to(__('Delete'), 'post_delete', $form->getObject(), array('method' => 'delete', 'confirm' => __('Really delete?'), 'class' => 'btn danger pull-right')) ?>
		<?php endif; ?>
	</div>	
	
	<?php echo $form->renderHiddenFields(); ?>
	
	</fieldset>
	</form>
	<script type="text/javascript">
	$(function() {
		$('textarea').autoResize();
	});
	</script>

</div>

<div id="preview" class="tab-pane">
</div>
<script type="text/javascript">
var mdConverter;
$(function() {
	mdConverter = new Showdown.converter();
	$('.tabs').bind('change', function (e) {
		if (e.target.href.slice(e.target.href.indexOf('#')) == "#preview") {
			$('div#preview')
				.empty()
				.append(
					mdConverter.makeHtml(
							"# " + $('input#blog_post_title').attr('value') + "\n\n" +
							$('textarea#blog_post_content').attr('value')
					)
				);
		}
	});
});<commit_msg>fix automatic height of textarea when editing posts<commit_after><?php use_javascript('/../scripts/showdown.js'); ?>

<?php use_javascript('/../scripts/modern/autoresize.jquery.min.js'); ?>

<?php use_javascript('/../scripts/plupload.min.js'); ?>
<?php use_javascript('/../scripts/plupload.html5.min.js'); ?>
<?php use_stylesheet('/../styles/uploader.css'); ?>

<div class="row"><div class="span16">
<h1><?php echo __('New Post'); ?></h1>

<ul class="tabs" data-tabs="tabs" >
	<li class="active"><a href="#source"><?php echo __('Source'); ?></a></li>
	<li><a href="#preview"><?php echo __('Preview'); ?></a></li>
	<li><a href="#files"><?php echo __('Files'); ?></a></li>
</ul>

<div class="tab-content">
<div id="source" class="tab-pane active">

	<form action="<?php echo url_for('post_'.($form->getObject()->isNew() ? 'create' : 'update'), $form->getObject()); ?>" method="POST">
	<fieldset>
		<legend><?php echo __('Write your post'); ?></legend>
	
	<?php if ($form->hasGlobalErrors()) : ?>
		<div class="error"><?php echo $form->renderGlobalErrors(); ?></div>
	<?php endif; ?>
	
	<?php $checkboxes = array(); ?>
	<?php foreach ($form as $field) : ?>
		<?php if ($field->isHidden()) continue; ?>
		<?php 
			if (is_a($field->getWidget(), 'sfWidgetFormInputCheckbox')) {
				$checkboxes[] = $field;
				continue;
			}
		?>
		
		<div class="clearfix <?php echo $field->hasError() ? 'error' : ''?>">
			<?php echo $field->renderLabel(); ?>
			<div class="input">
				<?php echo $field->render(array('class' => 'xxlarge ' . ($field->hasError() ? 'error' : ''))); ?>
				<?php echo $field->renderError(); ?>
				<?php if($field->renderHelp() != "") : ?><span class="help-block"><?php echo $field->renderHelp(); ?></span><?php endif; ?>
			</div>
			
		</div>
	<?php endforeach; ?>
	
	<div class="clearfix">
		<label id="optionsCheckboxes"><?php echo __('Options'); ?></label>
			<div class="input">
				<ul class="inputs-list">
				<?php foreach ($checkboxes as $field) : ?>
					<li>
						<label>
							<?php echo $field->render(); ?>
							<span><?php echo $field->renderLabelName(); ?></span>
						</label>
					</li>
				<?php endforeach; ?>
				</ul>
		</div>
	</div>
	
	<div class="actions">
		<input type="submit" class="btn primary" value="<?php echo __('Post!'); ?>">
		<?php echo link_to(__('Abort'), 'post/index', array('class' => 'btn')) ?>
		
		<?php if (!$form->getObject()->isNew()) : ?>
			<?php echo link_to(__('Delete'), 'post_delete', $form->getObject(), array('method' => 'delete', 'confirm' => __('Really delete?'), 'class' => 'btn danger pull-right')) ?>
		<?php endif; ?>
	</div>	
	
	<?php echo $form->renderHiddenFields(); ?>
	
	</fieldset>
	</form>
	<script type="text/javascript">
	$(function() {
		// activate autoresize
		$('textarea').autoResize();
		// trigger autoresize for initial height
		$('textarea').each(function() { $(this).change(); });
	});
	</script>

</div>

<div id="preview" class="tab-pane">
</div>
<script type="text/javascript">
var mdConverter;
$(function() {
	mdConverter = new Showdown.converter();
	$('.tabs').bind('change', function (e) {
		if (e.target.href.slice(e.target.href.indexOf('#')) == "#preview") {
			$('div#preview')
				.empty()
				.append(
					mdConverter.makeHtml(
							"# " + $('input#blog_post_title').attr('value') + "\n\n" +
							$('textarea#blog_post_content').attr('value')
					)
				);
		}
	});
});
{'fraction_non_alphanumeric': 0.2631738340399758, 'fraction_numerical': 0.0015142337976983646, 'mean_word_length': 4.16419077404222, 'pattern_counts': {'":': 0, '<': 191, '<?xml version=': 0, '>': 241, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2639254', 'n_tokens_mistral': 2527, 'n_tokens_neox': 2268, 'n_words': 462}