Skip to content
Browse files

Small bug fixes

  • Loading branch information...
1 parent 7cd4366 commit 9abe0a670674871c90f2f6bad94d1504c7657ace Claude Bossy committed with pferreir Jun 13, 2012
Showing with 17 additions and 3 deletions.
  1. +12 −2 indicomobile/events.py
  2. +1 −1 indicomobile/static/js/routes.js
  3. +4 −0 indicomobile/templates/events.html
View
14 indicomobile/events.py
@@ -15,6 +15,7 @@
events = Blueprint('events', __name__, template_folder='templates')
+query_session = MongoSession.connect('library')
def get_event_info(event_id):
@@ -201,17 +202,24 @@ def eventInfo(event_id):
return json.dumps(event_db.fields())
-@events.route('/searchEvent', methods=['GET'])
+@events.route('/searchEvent/', methods=['GET'])
def search_event():
search = urllib.quote(request.args.get('search'))
+ pageNumber = int(request.args.get('page',1))
url = current_app.config['SERVER_URL'] + \
'/export/event/search/' + search + \
'.json?ak=' + \
current_app.config['API_KEY']
req = urllib2.Request(url)
opener = urllib2.build_opener()
f = opener.open(req)
- return json.dumps(json.load(f)['results'])
+ results = json.load(f)['results']
+ results= sorted(results,
+ key=lambda k: datetime.combine(datetime.strptime(k['startDate']['date'], "%Y-%m-%d"),
+ datetime.strptime(k['startDate']['time'], "%H:%M:%S").time()))
+ results.reverse()
+ first_element = (pageNumber-1)*20
+ return json.dumps(results[first_element:first_element+20])
@events.route('/searchSpeaker/<event_id>', methods=['GET'])
@@ -239,6 +247,8 @@ def search_speaker(event_id):
@events.route('/searchContrib/event/<event_id>/day/<day_date>', methods=['GET'])
def search_contrib(event_id, day_date):
search = urllib.quote(request.args.get('search'))
+ pageNumber = int(request.args.get('page',1))
+ offset = int(request.args.get('offset', 20))
words = search.split('%20')
regex = ''
for word in words:
View
2 indicomobile/static/js/routes.js
@@ -433,7 +433,7 @@ myAgenda.getInstance = function() {
return this.instance;
}
-$('a[rel="external"]').live('tap', function(e){
+$('a[rel="external"]').live('click', function(e){
$.mobile.showPageLoadingMsg("a", "Loading...", true);
});
View
4 indicomobile/templates/events.html
@@ -33,10 +33,14 @@
</div>
<div data-role="content">
<div class="leftSide">
+ <h4>Ongoing events</h4>
<ul id="ongoingEventList" data-role="listview" data-inset="true"></ul>
+ <div class="loader"><h4>Loading...</h4><img src="static/style/images/ajax-loader2.gif"/></div>
</div>
<div class="rightSide">
+ <h4>Future events</h4>
<ul id="futureEventList" data-role="listview" data-inset="true"></ul>
+ <div class="loader"><h4>Loading...</h4><img src="static/style/images/ajax-loader2.gif"/></div>
</div>
</div>
<div data-role="footer" data-id="bar" data-position="fixed" data-theme="c">

0 comments on commit 9abe0a6

Please sign in to comment.
Something went wrong with that request. Please try again.