It would be great to have the option to display full node body on the same page by clicking 'Read more' link.

Comments

Alan D.’s picture

Component: Code » Documentation
Category: Feature request » Support request

Sorry, this would be outside the scope of this module. And from a 2 min search, there does not appear to be a module that handles this :(

Re: Feature itself: Like these ideas?

https://github.com/seanbuscay/drupal-ajax-demo
http://seanbuscay.com/ajax-reader-demo
http://www.drupalgardens.com/content/use-ajax-display-full-content-conte...
http://drupal.stackexchange.com/questions/16055/replacing-a-teaser-theme...
...
https://www.google.com.au/search?q=drupal+ajax+teaser+full+view

Note that of the first 10 examples I found via google, I have not seen any that take node_access() into account. The menu callbacks should use the access callback node_access and the access arguments ('view', 1) where 1 is the position of %node in the menu callback.

Then to integrate back to this module, in the node preprocessor, use this flag to remove the ajax action if there is nothing to read:

if (empty($node->readmore_required)) {
  ?? remove or change element / class / anchor|url / whatever that attaches the behaviour.
}

This works on the other entities too, $user->readmore_required, etc, (only if the user entity had fields and the the read more control module was enabled on users).

quotesBro’s picture

Status: Active » Closed (fixed)

Thank you, I guess I need something like

jQuery('#node-NID .read-more-link').click(function() {
  jQuery('#node-NID .field-name-body .field-item').load('/node/NID .field-name-body .field-item');
});