Shrink or expand sections of content when visitors click the titles of sections. It's very convenient for reading. It's for Drupal 6 currently.

http://drupal.org/sandbox/henry/1457180

git clone --branch master henry@git.drupal.org:sandbox/henry/1457180.git shrinksections

A demo page:
http://mynoteweb.com/en/node/13326

Comments

mkadin’s picture

Status: Needs review » Needs work

Here's the results of the automated review, you've got some work to do to make your module meet Drupal's coding standards.:
http://ventral.org/pareview/httpgitdrupalorgsandboxhenry1457180git
You can click on "repeat review" there once you've committed any changes and pushed them to drupal.org.

This module seems to collapse any header tags h2-h6 within the .content section and make the content beneath them collapsible by clicking on that header. This is a good idea, but I think for a generic drupal module, you should have more control over what is collapsible and what isn't. Maybe themers could add a class to the headers to make them collapsible with your module?

Also, from a usability perspective, you may want to add "cursor:pointer" to your css for the headers, to make sure that people realize that the headers are clickable. Consider adding a little triangle or something (like drupal core's fieldsets) to indicate to the user that there's content hidden beneath the header.

Speaking of which, given the collasible fieldsets in drupal core, is this module repeating existing core behavior?

farald’s picture

Hey!
I did an online code review of your sandbox here. Take a look at this page.

First of all, you should fix the errors with branches, creating 6.x-1.x branch and deleting everything but readme in master. Then you should fix the coding errors. After pushing the changes, do a review of your own at http://ventral.org/pareview to check that stuff is OK. :)

henryhu’s picture

Status: Needs work » Needs review

Thanks a lot for your reviewing. I've fixed it. Please check it out again.

anilbhatt’s picture

Hey,
I did a manual review of your code, and found :-
1) This module is too short, we can easily do this by adding a simple Js file, so why we require this module?
2) You had fixed the Tags in your JS file ( $('.content h2, .content h3, .content h4, .content h5, .content h6') ), in this manner you are binding user for using specific Tag.
3) I think you have to extend your module by creating admin form.
4) Add package information in .info file, don't give other, try to find out which package suits your module.

anilbhatt’s picture

Status: Needs review » Needs work
patrickd’s picture

This is really short, but at least a single project promotion should be OK.

This project is too short to approve you as git vetted user. We are currently discussing how much code we need, but everything with less than 120 lines of code or less than 5 functions cannot be seriously reviewed. However, we can promote this single project manually to a full project.

As there are currently many applications in queue we need more reviewers,
so think about getting a review bonus and we will come back to your application sooner.

henryhu’s picture

Status: Needs work » Needs review

Thanks for your reviewing.

1. I do not suppose that the functionality of the module is just limited to what it can do currently. In my plan, it will provide more configurable settings, including a cck field for setting default shrinked level. And it will provide more friendly clues, like plus/minus or hand icons.

2. Now it has a configuration page and a plus icon for shrunk sections.

3. Package has been changed to User interface.

nmudgal’s picture

Status: Needs review » Needs work

After a quick look over the code, I found these :

  • You don't really need to wrap menu title & description from t() in hook_menu(), check -> http://drupal.org/node/140311
  • Another thing is try defining your own permissions using hook_perm() & use them in access arguments.

Thanks.

henryhu’s picture

Status: Needs work » Needs review

1. Removed t() from menu itmes.
2. There is an 'access arguments' for configuration. Due to no new content that allows use to manipulate, I suppose there is no need to use hook_perm(). If you don't think so, please tell me the reason.

Thanks for your reviewing.

chhavik’s picture

Status: Needs review » Needs work
henryhu’s picture

Status: Needs work » Needs review

Thanks a lot!

  • Added .install file.
  • Added another feature that double clicking content would shrink the section that it was within.

I can't find the link of system_settings_form() you gave. And now customized submit works well.

chhavik’s picture

Status: Needs review » Needs work

Refer system_settings_form

Just add - return system_settings_form($form); in your setting form, line 57 and remove the submit handler.

henryhu’s picture

Status: Needs work » Needs review

Thanks chhavik.

I've got a question: if using system_settings_form(), does it mean there is no need to use .install file to delete variables? Or, which variables are supposed to delete in .install file?

chhavik’s picture

system_settings_form saves the variables automatically which you were doing in your submit handler. But you do need a .install file to delete them from variable table when you uninstall the module.

Made the above suggested changes and enable your module by uninstalling it first. Then you can have a look in your variable table, that how this work.

henryhu’s picture

Thank you, chhavik. I've used system_settings_form() instead of submit handler.

chhavik’s picture

Status: Needs review » Reviewed & tested by the community

Hi,

Your module is working fine, thus marking it RTBC. You can also improve the options value in the admin form as h1,h2... instead of just 2, 3, 4. It is just a suggestion and a minor change.

Regards.

patrickd’s picture

Status: Reviewed & tested by the community » Fixed

Let's get this done.

  1. Please take a moment to make your project page follow tips for a great project page.
  2. It would be good if you'd make use of existing resources, there's already a "plus" image in core (/misc/ui/images) if possible you should use that one.
  3. A submit button will automatically be added when using system_settings_form(), you don't have to add your own one.
  4. It's a common practice to append _form to functions containing form code.
  5. Add a @file documentation block to your .install file (you can have a look at core .install files, they've a good default text)

But this module looks good enough for me to be promoted.

Thanks for your contribution!

I've promoted this module to a full project and now your able to create releases.

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.

As you continue to work on your module, keep in mind: Commit messages - providing history and credit and Release naming conventions.

Thanks to the dedicated reviewer(s) as well.

New URL: http://drupal.org/project/shrinksections

New URL
Now that this experimental project has been promoted, you'll need to update the URL of your remote repository or reclone it.

git remote set-url origin henry@git.drupal.org:project/shrinksections.git
henryhu’s picture

Thanks everyone!

@chhavik
I intended to make h2, h3, ..., h6 shrinkable, no h1, because I suppose that nobody would like to shrink all article, just left the title(h1) shown. Thank you again.

@patrickd

I'll do what you've mentioned as soon as possible. Thank you.

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Add demo info