This module is used to create or convert links to load content via JQuery Load
With this module you can either
- create link with this function l_ajax($title,$path,$target) or
- make any , be it menu item or any links by providing class="ajax_link"
Required
jquery_update (for Drupal 6)
Before you start (Important) :
STEP 1 : Copy page-ajax.tpl.php (page--ajax.tpl.php for drupal 7) (from module ajax_links_api/templates) to your theme.
STEP 2 : Open the page.tpl.php file for your theme, and search for $content ($page["content"] for drupal 7).This should be surrounded by a div with an id (or class).If no div, add the div yourself.
Example : <div id="content-content"><?php print $content; ?></div>
Drupal 7
<div id="content-content"><?php print $page["content"]; ?></div>
In this case, just enter "#content-content" in 'admin/settings/ajax_links_api'
How to use Ajax links API :
METHOD 1 : in your tpl =>
l_ajax($title, $path, $target)
* $title: Title.
* $path : Drupal path.
* $target (optional): ID or CLASS of DIV to be replaced. Default value is #content-content, you can change default value in admin page 'admin/settings/ajax_links_api'
Example : l_ajax("add page", "node/add/page", "#content-content")
METHOD 2 : Add class="ajax_link" to any link. Target div will be default CSS selector defined in module setting. You can override target by specifying rel="".
Example : <a class="ajax_link" href="node/add/page" rel="#content-content">Add page</a>
DEMO :
<YOUR SITE>/ajax_links_api/test
some codes inspired from code by Sun
Project page
Project page : http://drupal.org/sandbox/serjas/1713192
GIT Repo : http://drupalcode.org/sandbox/serjas/1713192.git
git clone http://git.drupal.org/sandbox/serjas/1713192.git ajax_links_api
Drupal 6, 7
Projects reviewed so far
http://drupal.org/node/1718722#comment-6328246
http://drupal.org/node/1689300#comment-6328286
http://drupal.org/node/1719892#comment-6328186
http://drupal.org/node/1717766#comment-6328046
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | drupalcs-result.txt | 2.02 KB | klausi |
Comments
Comment #1
klausiWelcome,
We are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and I'll take a look at your project right away :-)
Comment #2
serjas commentedHi, i didnt reviewed any other module yet, but will do from now on , any way i found some coding standard error for my module itself,
no idea how to fix it? please help
#error report
51 | ERROR | Missing parameter type at position 1
53 | ERROR | Missing parameter type at position 2
55 | ERROR | Missing parameter type at position 3
58 | ERROR | Data type of return value is missing
72 | ERROR | Concat operator must be surrounded by spaces
Also
used this name to make function simpler, otherwise for a developer he has to use
ajax_links_api_l($title, $path, $target). this change is a must?Comment #2.0
serjas commentedupdated desc and git repo link
Comment #3
klausiMake sure to do manual reviews of other project by reading through their source code and reporting issues that you find. Posting results of automated reviews is not enough. If you did that don't forget to add the "PAreview: review bonus" tag as described in #1410826: [META] Review bonus.
Regarding the errors: "@param $var" should be "@param string $var" where string is the parameter type. Same for "@return" vs. "@return int". See http://drupal.org/node/1354#functions
You can keep the short function name, I think that is a valid exception.
Comment #3.0
klausireview bonus links
Comment #3.1
serjas commentedfixed git link
Comment #4
serjas commentedComment #4.0
serjas commentedreview bonus links
Comment #5
patrickd commentedYour "manual review"'s are only pointing out single issues, most of them are minor others are simply wrong or just links to automated reports
sorry, removing review bonus, it would not be fair to others who really make efforts for their reviews
Comment #5.0
patrickd commentedreview bonus links
Comment #6
serjas commentedComment #6.0
serjas commentedreview bonus links
Comment #7
klausimanual review:
Otherwise this looks nearly ready. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #8
klausiThank your for your reviews. When finishing your review comment also set the issue status either to "needs work" (you found some problems with the project) or "reviewed & tested by the community" (you found no flaws) as indicated in #1410826: [META] Review bonus.
Comment #9
serjas commentedhi fixed all except 4
i want to print $scripts,$style,$content only for loaded content, how can i use hook_theme here?
Comment #10
patrickd commentedWith preprocessing for example
Comment #10.0
patrickd commentedproject description
Comment #10.1
serjas commentedreview bonus links
Comment #11
serjas commentedthis issue was posted earlier in forum http://drupal.org/node/1706098 .
This is the requirement
# display only $content for page loaded via ajax
already implemented using preprocess, but user has to copy tpl to default theme
anyway we can always do this in later releases. committed other changes. please review :)
Comment #12
serjas commentedported module to 7, but dont know how to create a branch
followed instruction here http://drupal.org/node/1066342
now a branch is created in drupal rep with same contents as 6.x-1.x! i supposed to get a blank tree! what went wrong?
Comment #13
patrickd commentednothing that's the normal behaviour.
Create your new branch while beeing in 6.x-1.x, make your changes that are required for your port, commit and push the branch
this way anyone can see what and how it was ported and it's easier to detect error that came due to the port.
Comment #13.0
patrickd commentedreview bonus links
Comment #13.1
serjas commentedported to drupal 7, made changes in description
Comment #14
serjas commentedported to drupal 7 :) please review
for those who wnat to refer how i ported 6 to 7 here
Comment #15
Milena commentedI do not understand why I should copy template files to my theme.
Many user use some of the default themes which should not be changed any way (as they are in Drupal core). I should use your module with such theme also without killing kittens ;)
You have settings form with defining selector. So why also changing theme?
In your .install file you have
That is not what file does. Of course it is not a bug, but probably better comment would be: "Delete unnecessary variables." or "Uninstall function for AJAX links API module."
In your .module file:
Why not to add these files into .info file? They will be properly aggregated then.
Do not use t() function in hook_menu.
Your .js function:
Try to use Drupal.behaviors instead of document.ready.
I think l_ajax() function is a good name, even if does not follow coding standards. I think that such API should not provide lengthy function names, it is simple and clean.
You can also add configure option to your .info file. It will display small icon on the admin/modules list.
With overlay enabled I cannot use your module properly. Link is appearing in overlay (demo page) rather than in my #content. You should provide information about how your module works with core overlay module.
If i do not have an access to the page it only shows loader and do not show access denied page for me. I do not know if it is something specific with my Drupal installation, but I think I should mention it.
I'm not sure if this issues should block your application into RTBC, I've also did a review of 7.x branch.
But for now it requires changing core in some situations, it does not like core overlay module and uses t() in hook_menu(), so I'm changing to need work.
If someone think that it should be needs review - feel free to change.
Comment #16
serjas commentedHi Milena,
Thanks for reviewing module
# I do not understand why I should copy template files to my theme.
This is to load only $content , if page-ajax.tpl is not in your theme, loaded content will have header, footer etc. I am still investigating a way to do it in module itself . check here
With overlay enabled I cannot use your module properly
tested with overlay. when access settings its displayed in an overlay (admin/config/development/ajax_links_api) and when click demo , demo page will open in new page , not in overlay!
If i do not have an access to the page it only shows loader
currently it wont show access denied error. will do in future . have to find a way to display access denied and not found error!
# Fixed other errors
Comment #16.0
serjas commenteddrupal 7
Comment #17
klausiReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
manual review:
But otherwise looks RTBC to me. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #18
serjas commentedHi Klausi,
In earlier code, i have used js and css in hook_init. But based on Milena's comment , added js and css to .info.
Now i am confused , which one i have to use , .info or hook_init?
Comment #19
Milena commentedYou were adding css and js file on every single request through hook-init(). It makes your files no aggregated when user enables aggregation so if you need your files on EVERY page you shoud add them to .info file.
Although I should have asked if you really need your files on every request before suggeting moving it into info .file. But it is not an application blocker, so I did only little harm ;)
Comment #20
serjas commentedHi Milena
Ofcourse i want it on every page as it should work with any links with class=ajax_link . So what should i do? include in .info or hook_init?
Comment #21
Milena commentedI do not have an access to your repository right now (using mobile phone), so I'm not able to give you full and right answer based on code, just talking about some theory for now.
Imagine situation where ajax link is only on one page - adding your files to every page might not be so good idea, because all other pages will not use your style and scripts. It would be better to add them only to pages that have your link.
But if you are sure that you really need your files on every request - I suggest .info file for proper aggregation.
I can look at your code later and we can work out the best solution if you will be having problems decide what option choose or how to implement it.
Comment #22
serjas commentedFixed issue #If i do not have an access to the page it only shows loader . Now it will show error message if page is no accessible
Comment #23
klausiComment #24
klausiComment #25
patrickd commentedComment #26
patrickd commentedIt appears that you have been granted the 'create full projects' permission:
Once their first application has been successfully approved, then an applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers ... which in turn results in longer wait times for everyone in the queue.
Comment #27
serjas commented@patrickd
my profile was updated to promote full project on this aug 22! though there was no messages updated in this post!
Comment #28
serjas commentedComment #29
wMarius commentedHi, i want to use this module but he is loading all css, js files after an ajax request is something wrong with how i use this module, because i just want to load at least just css,js files for loaded content and not for the entire page. Ty for the feedback.
Comment #30
patrickd commentedThis issue is not the right place for feedback or support requests.
Please create a support issue in the projects issue queue instead and leave closed issues closed.
Comment #30.0
patrickd commentedexplaining why page-ajax is required
Comment #31
rukya commentedHi,
I'm using ajax_links_api and every page is loading via ajax, except for the homepage. I can see response in "network" section of firebug, but it's not loading.
How can I debug that?
Thanks
Comment #32
aleinad commentedHello,
Ajax links API module and is working fine the problem is that is affecting other modules in the page
http://isafe.org/?q=content/design-home-page
I'm using a view to work as a search, in this view I'm not using Ajax
below that view I'm using the Ajax links API module to display some pages, the problem is when I click on a button to display the page the view above this section gets affected
I'm not very good with javascript and I'm very new in Drupal I'm using Drupal 7
Thank you for your help
Comment #33
avpaderno