From 020c1b1d92b293fdbc42c5aa670ed6e9c45c7503 Mon Sep 17 00:00:00 2001 From: Jerry Jalava Date: Wed, 27 Feb 2008 16:22:56 +0200 Subject: [PATCH] Added some safety checks --- js/views/system.js | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/js/views/system.js b/js/views/system.js index b215c52..7f30ce6 100644 --- a/js/views/system.js +++ b/js/views/system.js @@ -56,7 +56,7 @@ }); $.each($.ajatus.preferences.client.content_types, function(key,type){ - if ( !type.views['list'] + if ( typeof type.views['list'] == 'undefined' || type.on_frontpage == false) { return false; } @@ -135,7 +135,7 @@ $.ajatus.views.system.tags.get_items(); }, - render_results: function(tags, items) { + render_results: function(tags, items, total_items) { var type = $.ajatus.preferences.client.content_types['tag']; $.ajatus.toolbar.add_item($.ajatus.i10n.get('New %s', [type.name]), { @@ -170,7 +170,8 @@ renderer.render_item(doc, x); x+=1; }); - + + renderer.items_added(total_items); renderer.enable_sorting(); $.ajatus.views.system.tags.get_duplicates(items); @@ -371,7 +372,7 @@ on_success = $.ajatus.views.system.tags.render_results; } - on_success(tags, items); + on_success(tags, items, data.total_rows); return data; }; @@ -845,26 +846,27 @@ } ); + renderer.set_actions( + [ + { + name: 'view', + title: $.ajatus.i10n.get('View'), + icon: 'view.png', + click_action: '$.ajatus.views.system.item.render(doc);' + }, + { + name: 'unarchive', + title: $.ajatus.i10n.get('Unarchive'), + icon: 'undo.png', + click_action: '$.ajatus.document.actions.execute("unarchive", doc);' + } + ] + ); + $.each(rows, function(i,doc){ if (doc.value._type == type.name) { var doc = new $.ajatus.document(doc); - renderer.set_actions( - [ - { - name: 'view', - title: $.ajatus.i10n.get('View'), - icon: 'view.png', - click_action: '$.ajatus.views.system.item.render(doc);' - }, - { - name: 'unarchive', - title: $.ajatus.i10n.get('Unarchive'), - icon: 'undo.png', - click_action: '$.ajatus.document.actions.execute("unarchive", doc);' - } - ] - ); renderer.render_item(doc, i); } }); @@ -1095,7 +1097,9 @@ var md_renderer = new $.ajatus.renderer.metadata(doc, metadata_sb.element); - if (typeof doc.value.tags != 'undefined') { + if ( typeof doc.value.tags != 'undefined' + && doc.value.tags.val.length > 0) + { var rel_docs = $.ajatus.tags.related(doc.value.tags.val, [doc._id]); var related_sb = new $.ajatus.renderer.blocks.sub('related_objects'); -- 2.11.4.GIT