{% extends "base.html" %}

{% block custom_head %}
	<script src="{{ url_for('static', filename='custom_js/search.js') }}"></script>
{% endblock %}


{% block main %}
<div class='col-md-8 col-md-offset-2'>
	<div class='center-block search'>
		<h1 class='title'>Add data to Malcom</h1>
		<form class="form-horizontal" action='{{ url_for("add_data") }}' method='POST'>
		  <div class="form-group">
		    <label for="value" class="col-md-1 control-label col-md-offset-2">Value</label>
		    <div class="col-md-7">
		      <input name="value" class="form-control" id="value" placeholder="google.com" autofocus>
		    </div>
		  </div>
		  <div class="form-group">
		    <label for="tags" class="col-md-1 control-label col-md-offset-2">Tags</label>
		    <div class="col-md-7">
		      <input name="tags" class="form-control" id="tags" placeholder="tag1, tag2, tag3">
		    </div>
		  </div>
		  <input class='btn btn-primary btn-lg' type='submit' value='Add'>
		</form>
	</div>
</div>

<div class='col-md-4 col-md-offset-1'>
	<h3>Bulk add - upload file</h3>
	<form action='{{ url_for("add_data") }}' method='POST' enctype=multipart/form-data>
		<div class="input-group">
          <span class="input-group-btn">
            <input class='btn btn-primary btn-sm' type='submit' value='Upload'>
          </span>
          <input name='bulk-file' type="file" class="form-control">
        </div>
	</form>
	<p class="help-block">File must have one element per line, followed by eventual tags.<br/>Example:</p>
	<pre id='bulk-example'>&lt;element&gt;;&lt;tag1&gt;,&lt;tag2&gt;,&lt;tag3&gt;
google.com
http://evildrop.me/drop.php; citadel, evil
127.0.0.1; localhost, home</pre>

</div>
<div class='col-md-6'>
	<h3>Bulk add - copy &amp; paste raw text</h3>
	<p class="help-block">Enter one element per line, followed by eventual tags. Format is the same than for file uploads.</p>
	<form action='{{ url_for("add_data") }}' method='POST'>
		<div class="form-group">
			<textarea class="form-control" name='bulk-text' rows=8></textarea>
			<br />
			<input class='btn btn-primary btn-sm' type='submit' value='Add'>
		</div>
	</form>
</div>

<div class='col-md-4 col-md-offset-4' style='margin-top:20px;'>
	<div class='center-block'>
		<p class="alert alert-success">See <a href="https://github.com/tomchop/malcom/wiki" target="_blank">the wiki</a> for best practices on how to add data.<br />For automated adding of data, check out the <a href='{{ url_for("feeds")}}'>feeds</a></p>
	</div>
</div>


{% endblock %}
