Repository: fossasia/open-event-server

Issue:
Improve Design: Event Area of Front Page
Please improve the event area of the front page as below.
![screenshot from 2016-06-28 12 47 42](https://cloud.githubusercontent.com/assets/1583873/16412858/bdd8341e-3d2e-11e6-9869-0dde5421dfd6.png)

Include:
- [x] 3 column layout with Event Image (4 rows)
- [x] Short form of location
- [x] Category and Event Type



Discussion:
@niranjan94 are you working on this? Otherwise I would like to take this up.

I'm working on this

You could take up https://github.com/fossasia/open-event-orga-server/issues/1296 . haven't started that yet.

Great..


Resolving patch:
diff --git a/open_event/__init__.py b/open_event/__init__.py
--- a/open_event/__init__.py
+++ b/open_event/__init__.py
@@ -25,7 +25,7 @@
 from urllib import urlencode
 from urlparse import parse_qs, urlsplit, urlunsplit
 
-from open_event.helpers.flask_helpers import SilentUndefined
+from open_event.helpers.flask_helpers import SilentUndefined, camel_case
 from open_event.helpers.helpers import string_empty
 from open_event.models import db
 from open_event.models.user import User
@@ -143,6 +143,10 @@ def pretty_name_filter(s):
     s = s.title()
     return s
 
+@app.template_filter('camel_case')
+def camel_case_filter(s):
+    return camel_case(s)
+
 @app.template_filter('humanize')
 def humanize_filter(time):
     return arrow.get(time).humanize()
diff --git a/open_event/helpers/flask_helpers.py b/open_event/helpers/flask_helpers.py
--- a/open_event/helpers/flask_helpers.py
+++ b/open_event/helpers/flask_helpers.py
@@ -38,3 +38,7 @@ def slugify(text, delim=u'-'):
 
 def deslugify(text, delim='-'):
     return text.replace(delim, " ")
+
+def camel_case(text):
+    text = deslugify(slugify(text))
+    return ''.join(x for x in text.title() if not x.isspace())
diff --git a/open_event/views/admin/home.py b/open_event/views/admin/home.py
--- a/open_event/views/admin/home.py
+++ b/open_event/views/admin/home.py
@@ -23,12 +23,6 @@
 def intended_url():
     return request.args.get('next') or url_for('.index')
 
-def chunks(l, n):
-    """Yield successive n-sized chunks from l."""
-    for i in xrange(0, len(l), n):
-        yield l[i:i + n]
-
-
 def record_user_login_logout(template, user):
     req_stats = get_request_stats()
     record_activity(
@@ -37,17 +31,15 @@ def record_user_login_logout(template, user):
         **req_stats
     )
 
-
 class MyHomeView(AdminIndexView):
 
     @expose('/')
     def index(self):
-        call_for_papers_evs = DataGetter.get_call_for_speakers_events().all()
-        published_events = DataGetter.get_all_published_events().all()
-        # Provide data as chunks of 6 for the UI to render in a proper way
+        call_for_speakers_events = DataGetter.get_call_for_speakers_events().limit(12).all()
+        upcoming_events = DataGetter.get_all_published_events().limit(12).all()
         return self.render('gentelella/index.html',
-                           call_for_papers_evs=list(chunks(call_for_papers_evs, 6)),
-                           published_events=list(chunks(published_events, 6)))
+                           call_for_speakers_events=call_for_speakers_events,
+                           upcoming_events=upcoming_events)
 
     @expose('/login/', methods=('GET', 'POST'))
     def login_view(self):


Test patch: