This module allows to configure flexibly the internal links of your site, which will update the appointed regions using ajax, instead of full page refresh.
You have to set JSON-object with list of regions (which have to be updated by click) to links with certain selectors. All the options are collected on one page of module configuration - admin/config/system/ajax_regions.
The main difference from the Ajax Regions 7.x-1.x:
The main difference of 2.0 is that all module configurations are now gathered on admin page (admin/config/system/ajax_regions).
And all js-scripts were rewritten in such a way that they work according to module settings. Using this module you can configure the usual ajax-menu without writing a line of code. This is the main difference from the 7.x-1.x version.
Additionally, there is some integration with reload views-content.
Full description on the project page: https://drupal.org/project/ajax_regions
Repo: http://git.drupal.org/project/ajax_regions.git
Clone link: git clone --branch 7.x-2.x http://git.drupal.org/project/ajax_regions.git
Drupal 7.x
Reviews of other projects:
https://drupal.org/comment/8595463#comment-8595463
https://drupal.org/comment/8601355#comment-8601355
https://drupal.org/comment/8602179#comment-8602179
Comments
Comment #1
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxFeintEars2220489git
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #2
szubkov commentedComment #3
szubkov commentedComment #4
szubkov commentedComment #5
szubkov commentedComment #6
szubkov commentedComment #7
szubkov commentedComment #8
szubkov commentedComment #9
szubkov commentedComment #10
szubkov commentedComment #11
szubkov commentedComment #12
alinouman commentedHi Feint,
Nice module,it works as you have written but some points in code review.
1- You are adding javascript in hook_init and that javascript will add on all pages (Even on pages where it doesn't need).
2- You are using eval in javascript which can be a security concern and its very bad practice.
Thanks!
Comment #13
szubkov commentedHi alinouman.
1- js is needed on every page. For example, I set some selector for ajaxify, and I don't know beforehand, what pages contain a link with it selector. Maybe I'll add it selector in content, or through the block. Any ideas? In general, the search for the availability of this selector implemented in js. As for me, the js-file is needed on all pages.
2- Thanks. I will think how to avoid it.
Thanks for review.
Comment #14
szubkov commented2- I replaced format of list-regions from js-object to JSON-object. It will be much more correct, thanks again. So, now instead of eval() will $.parseJSON(). Fixed.
Comment #15
dahousecat commentedHi FeintEars,
I think this is a great idea for a module and mostly found it pretty easy to use.
For testing I created a load of pages that link to each other that were in the content region and gave them all links to each other with a class of .ajax-link.
After this setting the link selector was obvious to me however the "Ajax-regions" field wasn't quite so clear. I didn't understand why I could just put the CSS selector or the region I wanted replaced in the same way the #wrapper property is used when using ajax as part of the Drupal form API. Can this field either be simplified, or explained more fully to tell users what the roles of the key are value (in the object) are.
I found the Update document title feature didn't always work. For example:
Page 1, page title: Decet Facilisi, doc title: Decet Facilisi
Page 2, page title: Pertineo Uxor, doc title: Decet Facilisi
Page 3, page title: Blandit, doc title: Blandit
Page 4, page title: Bene Valetudo Voco, doc title: Blandit
Page 5: page title: Decet Facilisi, doc title: Decet Facilisi
I then disabled this feature by unchecking the box and saving the settings, however upon navigating my pages I found that the document title was still getting updated.
Looking into this further I've found that only every other link is loaded via ajax. It seems that when content is loaded via ajax with ajax enabled links in the click event is not getting bound to the link.
To try and test the "Set loading-indicator" feature I created a link to an external slow site, but when I clicked the link I did not see a loading indicator appear, and also the site did not get loaded into the region. Should it work with external links? If it doesn't think I think this should be mentioned in the documentation.
Because of the bug where click events are not bound to link loaded via ajax disabaling the "Update current address" only worked every second link.
I had a play with "Update active links" feature but could not get it to do anything. I can see in your readme file that is says "setting to new link class = "active" (this class is used
in menu of the theme appearance Bartik)" but did not actually see any links that were given the active class. I think maybe I don't quite understand what is meant to happen here.
Comment #16
dahousecat commentedComment #17
szubkov commentedHi dahousecat, thank you for review! I apologize for keeping you waiting
The key is region-name. For example, module can load content-region to header, just providing the object {"content": "#header"}. The key is - what, the value is - where.
What is page title ?
I tried to do likewise. http://ajaxregion.2st.biz/ login:admin pass:qwerty . Please feel free to change anything
Yes. Thanks.
Working on it.
No, it doesn't work with external links. Because external links doesn't contain drupal-regions. (In general)
I left this one setting in http://ajaxregion.2st.biz/ enabled . It work for main menu which use the active classes for links. (Bartik theme, or some others)
Thanks!
Comment #18
szubkov commented> It seems that when content is loaded via ajax with ajax enabled links in the click event is not getting bound to the link.
Fixed
Comment #19
prabeen.giri commentedI did a quick review and found one area where you can do some adjustments:
On hook_init you are loading javascript using drupal_add_js, You dont wan't to run 'drupal_add_js' on drush commands. Therefore you can use it on the "hook_page_build()".
Comment #20
szubkov commented> Therefore you can use it on the "hook_page_build()".
okay. Fixed
Comment #21
dahousecat commentedI added a clone link into your description as will make it easier for others to clone your project.
Comment #22
dahousecat commentedHi FeintEars,
I'm still not really understanding the logic around the Ajax-regions field...
I tried using this value:
{"header": "#header", "content": ".region-content", "footer": "#footer"}When I clicked a link the header disappeared, the content was loaded into .region-content and nothing happened to the footer.
I think this need to be better documented as this is the second time I've had a play with the module and I just can't grasp the concept.
Comment #23
szubkov commented> The document title was not updated after loading new content into the ajax region.
Fixed. Thanks again
> In ajax_region.admin.inc using the #attached property is preferable to using drupal_add_js().
There is no js in ajax_region.admin.inc
> What is the purpose of being able to pass in multiple regions?
Maybe some pages must be loaded with different blocks in right (or left) sidebar. In this case you need to use something like {"content": ".region-content", "sidebar_second": ".region-sidebar-second"}
> Why does each region need a name? Wouldn't just a selector be sufficient?
One region has different selectors in different themes. Region name uniquely identifies the region, but not selector (in general case).
Maybe task will be to use a special region, specially created for the Ajax content, and loaded into the selector inside the region content, for example. {"ajaxregion_name": ".region_content .wrapper_for_ajax"}
Something cleared up?
Comment #24
dahousecat commentedCan we work though an example? I think that will be the easiest way to fully understand it...
Lets say I have a link on a page, and upon clicking that link I want to load the content specified by the href of the link into the content region, and I also want to load a new block into the sidebar, and replace a block in the footer region.
How to I specify which blocks will be loaded into the sidebar and the footer?
Comment #25
szubkov commentedSure. The basic idea is that you first need to configure all without Ajax:
> to load the content specified by the href of the link into the content region
It content should be loaded without ajax by href
> and I also want to load a new block into the sidebar
In this case sidebar must consist of all blocks with added new block
Well, analogically the footer.
> and replace a block in the footer region
It must consist of only new block specified by the href
And then you can enable the module and use (for Bartik theme)
{"content": ".region_content", "sidebar_first": ".region-sidebar-first", "footer": ".region-footer"}
Comment #26
szubkov commentedAnd there is a second way to load a new block into sidebar (without replace other sidebar-blocks):
1. Create the empty wrapper for new block inside sidebar
<div id="new_sidebar_block"></div>
2. Create the region "ajax_block"
3. Set the block to region "ajax_block". Set href for this block
4. And set JSON :
{"content": ".region_content", "ajax_block": "#new_sidebar_block", "footer": ".region-footer"}
The module should load block from "ajax_block" region and place it to the wrapper #new_sidebar_block.
P.S. Sorry for my english
Comment #27
szubkov commentedComment #28
dahousecat commentedHow can you set an href for a block?
Do you mean a link inside the block? What if the block doesn't contain any links?
Comment #29
szubkov commentedI mean the option "Show block on specific pages"
Comment #30
heddnIf that fails for whatever reason please get back to us and set this back to "needs review".
Comment #31
szubkov commentedI need your advice. I have opened the issue ( https://drupal.org/node/2265733 ) and tried to get in contact with the maintainer. I could not reach the maintainer.
Shall I begin the abandoned project process? What's your opinion? Thanks.
Comment #32
heddnGive it a week, then go for the abandoned process. The current maintainer might be on vacation or swamped with a project but a week should give enough time.
Comment #33
heddnComment #34
szubkov commentedCan I do something in this situation?
https://www.drupal.org/node/2265733
Sounds like a vicious circle. To pick up a module, I need to enter the community. And to enter the community, I need to have the module.
Comment #35
szubkov commentedComment #36
gisleI hope this "Catch 22"-like situation is just a simple misunderstanding.
From the look of, it the "project ownership" team is not aware of that taking over an abandoned project is one of the things the reviewers here ask applicants to do, and that this is legitimate one route towards permission to create full projects.
I've posted a comment where I try to explain the situation. It may help if heddn also commented on this in the "project ownership" thread.
Comment #37
heddnCross-posting:
@FeintEars, once you become owner of the project, please provide an update to your project application as per https://www.drupal.org/node/894256#unsupported-module.
Comment #38
heddn@FeintEars, and thanks for your patience in this process.
Comment #39
klausiCool, please update the issue summary once you adapted all your code and pushed it to the ajax_regions repository.
Comment #40
szubkov commented@gisle, @heddn, @klausi
thanks!
Should I use hook_update_N in the new version of the module?
The structure of the module is completely different.
If the main js-function of reload region was called
Drupal.ajaxRegions.load(href, {}, regions);
Then now it is private function ajaxregion_load(link, url), which executing as per module-settings.
Comment #41
heddn@FeintEars, if you are upgrading that module, then hook_update_N is in order if you wish to provide an upgrade path. Ideally you do provide an upgrade. re: javascript. You should use standard Drupal behaviors unless you find some good reason to the contrary.
Comment #42
szubkov commented@heddn
> once you become owner of the project, please provide an update to your project application
https://www.drupal.org/node/2296665
Comment #43
szubkov commentedDid I miss something?
Comment #44
szubkov commentedShould I close this issue?
https://www.drupal.org/node/1271484
Comment #45
gisleUnfortunately, yes.
According to the Ajax Regions project page, you've gone ahead and created a
full release 7.x-2.0of the module without being fully through the review process (before passing code review and being given the RTBC + final review by a git vetted admin). In other words, you've short-circuited the entire review process and issued an official release of your module before it has been properly reviewed and checked for security. It shows an blatant ignorance on your part about how the release system on Drupal.org works. AFAIK, this is something that is not easily reversed, since there is no way to "take back" a full release once it is official.That is up to you. It is a feature request. If you don't want to support that feature, then you close it. If you consider the suggested feature useful and may implement it later, when you can find the time, then you change the version to 7.x-2.x and keep it open as a placeholder.
Comment #46
szubkov commented> In other words, you've short-circuited the entire review process and issued an official release of your module before it has been properly reviewed and checked for security.
> Your issue summary links to your sandbox project and not to the 7.x-2.x development branch of Ajax Regions.
> Your git clone command clones your sandbox
At what stage should I rename php-functions from ajax_region_... to ajax_regions_...? (My sandbox-project was called ajax region, not ajax_regions)
> It shows an blatant ignorance on your part about how the release system on Drupal.org works.
I'm sorry, I'm really confused. I return the project page and release
> Also explain for current users how to migrate from 7.x-1.x to 7.x-2-x (or just say that there is no support for migration.
it turned out that they just update the module, I left them the first version of the function
and implement hook_update_n. It should work
Comment #47
gisleRenaming the PHP functions is OK and have nothing to do with this.
What was wrong was that you created official tagged release with the tag
7.x-2.0.You should not have created this tagged release before the project had passed review. You create official tagged releases at the end of the review process, not in the middle of it.
Try the following two commands in your local repo:
I am not sure if the last of these (it is supposed to delete it at the origin) will work. If it fails, you probably need help from a webmaster to get rid of that release.
Comment #48
szubkov commentedgit error: The tag "7.x-2.0" is tied to a release on Drupal.org, and therefore cannot be relocated or deleted.
I have created appropriate issue to webmasters
https://www.drupal.org/node/2297195
Comment #49
gisleManual Review
The default branch set up in the repo is the "master" branch in git. You should really be working from the
7.x-2.xversion specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.In addition, the legacy
7.x-1.xbranch is missing from the repo. When taking over an abandoned project, it is important that the the new maintainer does not erase history by by erasing legacy branches. The legacy7.x-1.xbranch must be restored in the repo.Do the following:
The project page diffs shows that you've just replaced the entire content of the project page. You're supposed to retain history when you take over an abandoned project. The project page should still mention the 7.x-1.x branch and what it does. It should then go on and explain that as the new maintainer, you've discontinued support of that branch, and that the branch maintained in the future will be the 7.x-2.x branch. Also explain for current users how to migrate from 7.x-1.x to 7.x-2-x.
Please read tips for a great project page for more about what the content you need to include on the project page.
administer ajax_regionsinject JavaScript via the admin interface, the project has obvious security implications. There is no way of blocking XSS exploits (inserted via the admin GUI) without crippling the module. Anyone granted the permission toadminister ajax_regionscan post inject arbitrary JavaScript (including XSS exploits). This role has severe security implicatons that need to made explicit several places (project page, README.txt and in the description of the permission grant).administer ajax_regions) for access to the administration form for the module, but nohook_permission, so this permission cannot be granted.hook_helpto provide instructions on top of a form is (AFAIK) unusual. Instead, you use the Form API with#markupto provide inline help with a form. I see no benefit in having the help text for a specific form in a separate hook. The most common use ofhook_helpto display a brief text about the module under the help meny in the admin bar. This is missing from this module.The starred item (*) warrant going back to Needs Work. The rest of the comments in the code walkthrough are recommendations.
Comment #50
szubkov commentednow I should to fix it and create new release 2.0 without tag. Right?
Comment #51
gisleNot right, I am afraid.
You need to understand the difference between branches and releases.
As long as the project is not ready for release, please do not try to create any releases.
What you do is to continue working on the
7.x-2.xbranch, which eventually (when you're done) will become the7.x-2.0release.You can check what branch you're working on with the command:
it should say:
On branch 7.x-2.x.When you've done all the changes you want to do, you commit them to the local repo and then give the following command:
That will push your changes to the HEAD of the 7.x-2.x branch of the remote repo, making your latest version available for everyone to review, just by cloning the HEAD of that branch using the exact git clone command you have put in your issue summary.
Right after pushing, you usually request a new review.
Comment #52
szubkov commentedComment #53
szubkov commentedComment #54
szubkov commentedComment #55
szubkov commentedComment #56
szubkov commentedFixed.
> In addition, the legacy 7.x-1.x branch is missing from the repo.
7.x-1.x is available:
git clone --branch 7.x-1.x http://git.drupal.org/project/ajax_regions.git
When I try git push origin 7.x-1.x, I get
Everything up-to-date
Did I miss it again?
Comment #57
gisleNo, that looks OK. I can toggle between
7.x-1.xand7.x-2.x.Can you try the following again:
I believe that tag is no longer tied to a release on Drupal.org, so it should be deletable.
(You need to delete that tag, so that you can use it again later when the time is ripe for a release.)
Comment #58
szubkov commented> Can you try the following again
Yes. Fixed
Comment #59
gisleManual Review
The default branch set up in the repo is the "7.x-1.x" branch in git, but should really be the
7.x-2.xbranch. This is not a blocker tho'.However, it now have information about both the legacy branch and the new branch, which is good. Layout and readability can be improved, and information about the legacy branch should be shortened (a brief mention that it exists and how it differs may be enough). It would be nice if it included more information about the project, as suggested in tips for a great project page, but this is not a blocker.
However, the module allows for XSS injection through the admin GUI, and this must be said clearly on the project page, so that site managers that are concerned about security knows that this module is not for them.
It now have a paragraph about the security implications of this project, which is good. As with the project page: Layout and readability can be improved, but not a blocker.
administer ajax_regionsinject JavaScript via the admin interface, the project has security implications. There is no way of blocking XSS exploits without crippling the module. Anyone granted the permission toadminister ajax_regionscan post inject arbitrary JavaScript (including XSS exploits). This role has severe security implicatons that need to made explicit several places. It is already in the README.txt, but should also be explicitly part of the description of the permission grant and on the project page.hook_help(). It is good practice to display a brief help text under the help menu in the admin bar for every enabled module, but this is not a blocker.There are IMHO no more blockers. Moving to RTBC. Note that promotion will not happen until a git administrator has given this a second set of eyeballs.
Comment #60
szubkov commentedFixed again
Comment #61
szubkov commented@gisle
Thank you very much! It was a very pleasure to work with you
Comment #62
heddnAutomated Review
Manual Review
Help text wrapped in t() within ajax_regions_admin should not include html tags. That kinda makes translation difficult.
Don't adjust module weights. It is very brittle. Instead using hook_module_implements_alter() to push the module's hook to the head of the list (as necessary).
The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.
Comment #63
heddnThanks for your contribution, FeintEars!
I updated your account so you can create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well. And thanks for your extra patience in the process.
Comment #64
gisleThe problem is that the README.txt uses depreciated ISO-8859-1 encoding rather than UTF-8, so the double arrows (») in the breadcrumbs show up as "�" on a system that expects UTF-8.
You can fix it by:
s/»/>/g).Comment #65
gisleUploaded
README.txtwith UTF-8 encoding (converted using iconv).Use this instead (but remember to rename it back to
README.txt).Comment #66
szubkov commented> It seems odd that you are inserting javascript inline rather than from a file. Why isn't is possible to load it from a single file? Especially when the after script doesn't have any logic in it anyway.
"before" and "after" functions need Drupal.ajax_regions, and they are stored in database (see "after" and "before" fields in admin module page), therefore they should be inline and under ajax_regions.js . But they may be created by the user to bypass the admin page in a custom js-file.
Fixed all.
@heddn, gisle
All right? Can I create a full release?
Comment #67
gisleYup!
Go ahead, and congratulations with completing the process.
Comment #68
szubkov commentedThanks! last question: should/can I remove the master branch ?
http://pareview.sh/pareview/httpgitdrupalorgprojectajaxregionsgit
Comment #69
gisleIf you can, you should remove it. However, I suspect that it may be tied to some release in the past, so git will just give you an error if you try to remove it on the origin.
If you get an error, just leave it alone, it does no harm.
What you need to do now is to create a tagged release with the tag
7.x-2.0(just like you did earlier, before the project was ready for release), push it, and then use the links at the bottom of the project page to make that release public. Expect around five minutes delay from creating a release until it appears on the project page.Comment #70
szubkov commented> If you can, you should remove it.
It went well
Done!