This module provides functionality to create a single page website.
It allows you to automatically create a single page from a menu. The module will render all the content from the links, that are configured in the menu, on one page. It will then override the menu links so that they refer to an anchor instead of a new page.
Configuration
- Choose the menu which you want to create a single page for
- Define the class/id of the menu wrapper
- Define the class(es) of the menu items that should implement the single page navigation. (Maybe you don't want all the menu items to be overwritten by an anchor, eg. contact form on seperate page.)
- Go to structure -> menus -> "your single page menu" and give all the menu links that have to appear on the single page the class you defined in step 3
- Goto /one-page-site and anjoy your one-pager
This module is not a duplicate of Singe Page Website. This module isn't dependent on the (sub)theme you are using. The reason Singe Page Website module is dependent on Bartik/Zen is that it applies already lots of CSS and JS for users who don't have a lot of HTML/CSS/JS knowledge. I used it before and it's a great module if you are using bartik/zen as a theme!
Project page
Git Clone Command
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/robin.ingelbrecht/2346267.git single_page_site
Requirements
Menu Attributes
Pareview page
Reviews
[D7] webform_country_list
[D7] Read only node
[D7] Custom template suggestions
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | single_page_site_XSS.png | 19.55 KB | pushpinderchauhan |
| #33 | menu_XSS.jpg | 68.64 KB | pushpinderchauhan |
| #6 | Untitled.png | 10.63 KB | gaurav.pahuja |
| #6 | Single Page Site Settings 10.209.11.26.png | 12.54 KB | gaurav.pahuja |
Comments
Comment #1
robin.ingelbrecht commentedComment #2
robin.ingelbrecht commentedComment #3
PA robot commentedProject 1: https://www.drupal.org/node/2346321
Project 2: https://www.drupal.org/node/2205693
As successful completion of the project application process results in the applicant being granted the 'Create Full Projects' permission, there is no need to take multiple applications through the process. Once the first application has been successfully approved, then the 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. With this in mind, your secondary applications have been marked as 'closed(duplicate)', with only one application left open (chosen at random).
If you prefer that we proceed through this review process with a different application than the one which was left open, then feel free to close the 'open' application as a duplicate, and re-open one of the project applications which had been closed.
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #4
PA robot commentedWe 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 #5
gaurav.pahuja commentedFixed GIT clone link.
Comment #6
gaurav.pahuja commentedSome of the initial review comments:
No error while cloning the module and then enabling it.
Strip tags for all input fields:

JS error on configuration page:
Comment #7
robin.ingelbrecht commentedgaurav.pahuja,
thanks for the feedback!
Now all tags are stripped from the input fields with filter_xss(). That fixed the JS errors.
Comment #8
robin.ingelbrecht commentedComment #9
robin.ingelbrecht commentedComment #10
robin.ingelbrecht commentedadded review
Comment #11
robin.ingelbrecht commentedAdded review
Comment #12
robin.ingelbrecht commentedComment #13
f0ns commentedWhen a menu link item with url
<front>is used I get an error.Comment #14
robin.ingelbrecht commented@f0ns ,
Issue is fixed.
'<front>'will be ignored, thus will not be rendered. Keep in mind to change the status of this issue when you review the project.Thanks!
Comment #15
f0ns commented@Robin
When using a vhosts installation the use of
var basePath = Drupal.settings.basePath;returns "/",
This should resolve this issue:
http://data.agaric.com/get-complete-base-url-drupal-site#comment-1630
Comment #16
robin.ingelbrecht commented@fons,
Issue is solved! Thanks!
Comment #17
f0ns commentedEverything seems to work just oké now, also tested on a multilingual website.
Comment #18
maartendeblock commentedTested and works as expected.
Possible improvement would be using a theming function or a rendrable array.
Comment #19
iampuma- Typo in some files. 'singe page' should be 'single page' of course.
- A menu item single-page-site has its access callback to TRUE. Permission on that page would make sense (eg. View single page).
- Just return the output array in your page callback. Use a template file or theming function.
The module else works like it should, no hiccups in configuration or whatsoever.
Comment #20
robin.ingelbrecht commented@iampuma,
- Typos are fixed
- Added a permission to the page
- Just returning the output array
- All HTML is rendered in a TPL file now
Thanks for the feedback!
Comment #21
robin.ingelbrecht commentedAdded review
Comment #22
robin.ingelbrecht commentedComment #23
robin.ingelbrecht commentedComment #24
shaxa commentedNice work, i've tested it and also started the jQuery update module to test your javascript when both modules are working. Everything seems fine.
I saw that you have fixed the problem with path, but ... if possible make some validation on the configuration page so it would not let you select a menu which has a menu item with as path.
I saw also one not so important thing in the code. You should consider to give this to a t() function maybe ...
$output .= "
An error '" . $page_callback_result . "' occurred for " . $item['#href'] . '
'; it is line 168 in single_page_site.module.
And btw add also to your project page info about "Module attributes" dependency.
Comment #25
robin.ingelbrecht commented@ShaxA,
Thanks for the review.
- I won't implement your first remark. It is possible that users want to use a menu where '' is included.
- I made the error message translatable.
- Added to project page
Comment #26
iampumaNo remarks. All remarks sees to be implemented correctly. It would be awesome though, if there would be a possibility to have multiple single pages in a single Drupal website, but perhaps this is out of the scope of your module.
Comment #27
iampumaNo remarks. All remarks sees to be implemented correctly. It would be awesome though, if there would be a possibility to have multiple single pages in a single Drupal website, but perhaps this is out of the scope of your module.
Comment #28
robin.ingelbrecht commentediampuma,
You can always add an issue in the issue queue of the sandbox project.
Thanks for the feedback!
Comment #29
mpdonadioAssigning to myself for my next review.
Comment #30
mpdonadioI am taking my name off of this, as I have gotten swamped and can not complete this review. My partial review is below. The single_page_site_callback() function needs some very close attention for both API issues and security problems. The filter-on-save, though, would have been a blocking issuue anyway, as this falls under the Major API problems.
Automated Review
Review of the 7.x-1.x branch (commit df0cb7b):
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
(*) Your single_page_site_settings_form_submit() is filtering on save. This is not the Drupal way. See https://www.drupal.org/node/28984 and https://www.drupal.org/node/263002
You may want to validate some of those settings, like the menu.
(+) All of your behaviors should use the context and settings variables that get passed in.
Why does Drupal.behaviors.scrolltoanchors have a $(document).ready() in it? This is what the .attach does.
You may want to put single_page_site_callback() in an include. This can help reduce memory footprint.
#attached is preferred over drupal_add_js and drupal_add_css().
(+) Your link usage in the error message at the top of single_page_site_callback() is incorrect. See https://api.drupal.org/api/drupal/includes%21common.inc/function/l/7
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.
This review uses the Project Application Review Template.
Comment #31
robin.ingelbrecht commentedmpdonadio,
Thanks for reviewing my module.
I implemented your suggestions. I tried to add the js files in hook_page_build like this:
But the js files won't load... So I'm still using drupal_add_js. The JS and CSS files that are included in my callback are included with '#attached'.
Comment #32
pushpinderchauhan commentedAssigning to myself for next review.
Comment #33
pushpinderchauhan commentedAutomated Review
Best practice issues identified by pareview.sh / drupalcs / coder. Yes, http://pareview.sh/pareview/httpgitdrupalorgsandboxrobiningelbrecht23462... reported some issues that need to be fix. See https://www.drupal.org/coding-standards/docs#inline.
Manual Review
<script>alert('XSS');</script>in the Single Page Site Settings form, it break the final output page (single-page-site) because user input directly rendered. You need to sanitize this before rendering, make sure to read https://www.drupal.org/node/28984 again.You should sanitize following code and handle the output text in proper manner:
`in Single Page Site Settings form, it break the js code. IMHO, either you escape the html tag and special character in JS or prevent the same on form submission.You should use #attached as given below.
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.
Please don't remove the security tag, we keep that for statistics and to show examples of security problems.
Comment #34
robin.ingelbrecht commenteder.pushpinderrana,
Thanks for your extended review!
- All pareview notices/errors are gone now.
- I followed your advice " the golden rule is to store exactly what the user typed". Everywhere I use data inputted by a user, I have wrapped it with check_plain().
- JS is now attched with '#attached', drupal_add_js is gone. Thanks for the example code!
Comment #35
gaurav.pahuja commentedStill this issue exist in your updated code, tested on drupal 7.32 vanilla js still break on admin page.
Still same behavior exist as filter_xss() is there. I would recommend you, prevent these html tags and special character
'at form submission time using validation See https://api.drupal.org/api/drupal/modules!node!node.api.php/function/hoo....Comment #36
robin.ingelbrecht commentedgaurav.pahuja,
User input gets validated on special chars now on hook_form_validate.
Thanks for the review!
Comment #37
klausimanual review of 7.x-1.x:
But that are not critical application blockers, otherwise looks RTBC to me. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Assigning to er.pushpinderrana as he might have time to take a final look at this.
Comment #38
robin.ingelbrecht commentedklausi,
Thanks for your review! I implemented your recommendations and tips.
The only thing I didn't change (yet) is "5". When the module gets approved I'll check into that, but for now I don't want to break anything :).
Thanks again.
Comment #39
pushpinderchauhan commentedAutomated Review
Best practice issues identified by pareview.sh / drupalcs / coder. None
Review of the 7.x-1.x branch (commit 1b0fe0d):
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
All blocking issues mentioned in #33 have been addressed. But as Kalusi's mentioned,
"drupal_set_title(t('!title', array('!title' => $settings['title'])));":still there that looks awkward to me as well but this is not a blocker.I also tested functionality of this module and it worked as intended so...
Thanks for your contribution, robin.ingelbrecht!
I updated your account so you can promote this to a full project and also 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.