Browse Source

Put url info into appconfig, make more modular with Makefile

master
wes 9 years ago
parent
commit
e4d3b20855
  1. 14
      Makefile
  2. 2
      src/appconfig
  3. 4
      src/scripts/search.js
  4. 2
      src/scripts/search.tag
  5. 10
      src/search.py
  6. 16
      src/templates/search.html

14
Makefile

@ -0,0 +1,14 @@
default:
mkdir build;
mkdir build/scripts;
mkdir build/styles;
mkdir build/templates;
riot ./src/scripts/ ./build/scripts/tags.js;
cp -r ./src/scripts/search.js ./build/scripts/;
cp -r ./src/styles/* ./build/styles/;
cp -r ./src/templates/search.html ./build/templates/;
cp -r ./src/{archive.py,openlibrary.py,predictions.py,search.py,website.py,textbookExceptions.py} ./build/;
cp ./src/appconfig ./build/;
clean:
rm -r ./build;

2
src/appconfig

@ -0,0 +1,2 @@
SERVER_NAME="localhost:8001"
APPLICATION_ROOT="/"

4
src/scripts/search.js

@ -1,5 +1,3 @@
var root = "mgoal.ca/search";
function makeResourceGetter(self) {
function getResources(ev) {
ev.preventDefault();
@ -9,7 +7,7 @@ function makeResourceGetter(self) {
"title" : this.booktitle,
"author" : this.bookauthor
};
var url = "https://"+root+"/resources";
var url = "/resources";
console.log(params);
$.getJSON(url, {
data : JSON.stringify(params)

2
src/scripts/search.tag

@ -21,7 +21,7 @@
function submit(ev) {
console.log("submitted");
var params = $(ev.currentTarget).serialize();
$.getJSON("https://"+root+"/fc?"+params,
$.getJSON("/fc?"+params,
function(courses) {
var fcourses = filterCourses(courses);
var cgroups = groupsof(4, fcourses);

10
src/search.py

@ -12,8 +12,6 @@ from hashlib import sha1
from textbookExceptions import UnIndexable
from mcmaster.classes import allCourses
# Generic instance of elasticsearch right now
es = elasticsearch.Elasticsearch()
@ -228,11 +226,3 @@ searchers = {
"prof" : search("prof"),
"day" : search("day"),
}
#print searchTerms({"title" : "PHILOS"})
#createIndex("oersearch")
#for c in imap(classToJSON, allCourses()):
#try:
#print indexListing(c)
#except UnIndexable as e:
##print e

16
src/templates/search.html

@ -27,21 +27,17 @@
</footer>
{% block styles %}
{{super()}}
<link rel="stylesheet" href="/search{{ url_for('send_style', filename='spectre.min.css') }}">
<link rel="stylesheet" href="/search{{ url_for('send_style', filename='search.css') }}">
<link rel="stylesheet" href="{{ url_for('send_style', filename='spectre.min.css') }}">
<link rel="stylesheet" href="{{ url_for('send_style', filename='search.css') }}">
{% endblock %}
{{ url_for('send_script', filename='') }}
{% block scripts %}
{{super()}}
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/riot/2.4.1/riot+compiler.min.js"></script>
<script type="text/javascript" src="{{ url_for('send_script', filename='jquery-ui-1.11.4.custom/jquery-ui.min.js') }}"></script>
<script type="riot/tag" src="/search{{ url_for('send_script', filename='search.tag') }}"></script>
<script type="riot/tag" src="/search{{ url_for('send_script', filename='book.tag') }}"></script>
<script type="riot/tag" src="/search{{ url_for('send_script', filename='class.tag') }}"></script>
<script type="riot/tag" src="/search{{ url_for('send_script', filename='row.tag') }}"></script>
<script type="riot/tag" src="/search{{ url_for('send_script', filename='results.tag') }}"></script>
<script type="text/javascript" src="/search{{ url_for('send_script', filename='search.js') }}"></script>
<script type="text/javascript" src="{{ url_for('send_script', filename='tags.js') }}"></script>
<script type="text/javascript" src="{{ url_for('send_script', filename='search.js') }}"></script>
{% endblock %}
</body>
</html>

Loading…
Cancel
Save