def view_project(auth, node, **kwargs): primary = '/api/v1' not in request.path ret = _view_project(node, auth, primary=primary, embed_contributors=True, embed_descendants=True) ret['addon_capabilities'] = settings.ADDON_CAPABILITIES # Collect the URIs to the static assets for addons that have widgets ret['addon_widget_js'] = list( collect_addon_js(node, filename='widget-cfg.js', config_entry='widget')) ret.update(rubeus.collect_addon_assets(node)) access_request = node.requests.filter(creator=auth.user).exclude( machine_state='accepted') ret['user']['access_request_state'] = access_request.get( ).machine_state if access_request else None addons_widget_data = { 'wiki': None, 'mendeley': None, 'zotero': None, 'forward': None, 'dataverse': None } if 'wiki' in ret['addons']: addons_widget_data['wiki'] = serialize_wiki_widget(node) if 'dataverse' in ret['addons']: addons_widget_data['dataverse'] = serialize_dataverse_widget(node) if 'forward' in ret['addons']: addons_widget_data['forward'] = serialize_forward_widget(node) if 'zotero' in ret['addons']: node_addon = node.get_addon('zotero') zotero_widget_data = ZoteroCitationsProvider().widget(node_addon) addons_widget_data['zotero'] = zotero_widget_data if 'mendeley' in ret['addons']: node_addon = node.get_addon('mendeley') mendeley_widget_data = MendeleyCitationsProvider().widget(node_addon) addons_widget_data['mendeley'] = mendeley_widget_data ret.update({'addons_widget_data': addons_widget_data}) return ret
def view_project(auth, node, **kwargs): primary = '/api/v1' not in request.path ret = _view_project(node, auth, primary=primary, embed_contributors=True, embed_descendants=True ) ret['addon_capabilities'] = settings.ADDON_CAPABILITIES # Collect the URIs to the static assets for addons that have widgets ret['addon_widget_js'] = list(collect_addon_js( node, filename='widget-cfg.js', config_entry='widget' )) ret.update(rubeus.collect_addon_assets(node)) access_request = node.requests.filter(creator=auth.user).exclude(machine_state='accepted') ret['user']['access_request_state'] = access_request.get().machine_state if access_request else None addons_widget_data = { 'wiki': None, 'mendeley': None, 'zotero': None, 'forward': None, 'dataverse': None } if 'wiki' in ret['addons']: addons_widget_data['wiki'] = serialize_wiki_widget(node) if 'dataverse' in ret['addons']: addons_widget_data['dataverse'] = serialize_dataverse_widget(node) if 'forward' in ret['addons']: addons_widget_data['forward'] = serialize_forward_widget(node) if 'zotero' in ret['addons']: node_addon = node.get_addon('zotero') zotero_widget_data = ZoteroCitationsProvider().widget(node_addon) addons_widget_data['zotero'] = zotero_widget_data if 'mendeley' in ret['addons']: node_addon = node.get_addon('mendeley') mendeley_widget_data = MendeleyCitationsProvider().widget(node_addon) addons_widget_data['mendeley'] = mendeley_widget_data ret.update({'addons_widget_data': addons_widget_data}) return ret