changed number of items on front page
authorAndrew Engelbrecht <sudoman@ninthfloor.org>
Wed, 8 Mar 2017 18:09:04 +0000 (13:09 -0500)
committerAndrew Engelbrecht <sudoman@ninthfloor.org>
Wed, 8 Mar 2017 18:09:04 +0000 (13:09 -0500)
... including the "all videos/photos" sections. also changed the default
amount to 10.

mediagoblin_libreplanet/__init__.py

index d9c8716..2533be4 100644 (file)
@@ -35,7 +35,10 @@ SUPPORTED_LICENSES[cc_by_sa_4.uri] = cc_by_sa_4
 
 PLUGIN_DIR = os.path.dirname(__file__)
 
 
 PLUGIN_DIR = os.path.dirname(__file__)
 
-MAX_HOME_ITEMS = 20
+MAX_HOME_ITEMS_DEFAULT = 10
+
+MAX_HOME_ALL_VIDEO_ITEMS = 10
+MAX_HOME_ALL_PHOTO_ITEMS = 20
 MAX_HOME_FEATURED_ITEMS = 10
 MAX_HOME_LP_ITEMS = 10
 
 MAX_HOME_FEATURED_ITEMS = 10
 MAX_HOME_LP_ITEMS = 10
 
@@ -55,7 +58,7 @@ def setup_plugin():
     # Register the template path.
     register_template_path(os.path.join(PLUGIN_DIR, 'templates'))
 
     # Register the template path.
     register_template_path(os.path.join(PLUGIN_DIR, 'templates'))
 
-def lp_media_for_type(db, type, tag=None, max_items=MAX_HOME_ITEMS):
+def lp_media_for_type(db, type, tag=None, max_items=MAX_HOME_ITEMS_DEFAULT):
     if (tag == None):
         cursor = MediaEntry.query
     else:
     if (tag == None):
         cursor = MediaEntry.query
     else:
@@ -69,8 +72,8 @@ def lp_media_for_type(db, type, tag=None, max_items=MAX_HOME_ITEMS):
 
 @user_not_banned
 def frontpage_view(request):
 
 @user_not_banned
 def frontpage_view(request):
-    images          = lp_media_for_type(request.db, u'mediagoblin.media_types.image')
-    videos          = lp_media_for_type(request.db, u'mediagoblin.media_types.video')
+    images          = lp_media_for_type(request.db, u'mediagoblin.media_types.image', None, MAX_HOME_ALL_PHOTO_ITEMS)
+    videos          = lp_media_for_type(request.db, u'mediagoblin.media_types.video', None, MAX_HOME_ALL_VIDEO_ITEMS)
 
     lp2016_videos   = lp_media_for_type(request.db, u'mediagoblin.media_types.video', LATEST_LP_VIDEO_TAG, MAX_HOME_LP_ITEMS)
 
 
     lp2016_videos   = lp_media_for_type(request.db, u'mediagoblin.media_types.video', LATEST_LP_VIDEO_TAG, MAX_HOME_LP_ITEMS)