This module simply responsifies vertical tabs in admin pages. The result is similar to what we see on Drupal 8:
- For desktop resolutions vertical tabs will appear in a right sidebar. However, you can also choose vertical tabs to appear on left sidebar through module's administration page.
- For mobile resolutions vertical tabs will appear at the bottom of the page.
You can choose following options on module's administration form:
- Which side the vertical tabs will be on wider screens.
- Width of content and vertical tabs (in percentage).
It has been tested with these administration themes:
Finally, this module is compatible with add/edit node forms that use "Fieldsets" and "Horizontal tabs group" of Field Group module.
Similar modules
- D7 sandbox module: Responsive Vertical Tabs (sandbox). This module does the same as mine except that it doesn't allow configuration of content & vertical tabs width. I found CSS code of this module too much complicated (for me): I tried to fix it to be compatible with fieldsets and horizontal tab groups and I wasn't able. However, I guess the way it does some things is much better than mine's
The problem is that I found out there are no more alternatives to have responsive vertical tabs on drupal 7. Maybe my module is too simple but I think It can do the job while there is no stable release of Responsive Vertical Tabs.
Homepage
https://www.drupal.org/sandbox/rcodina/2301115
Git
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/rcodina/2301115.git vertical_tabs_responsive
Manual reviews of other projects
Comment | File | Size | Author |
---|---|---|---|
#57 | cant_promote.png | 54.71 KB | rcodina |
#20 | bootstrap_theme_edit.png | 132.32 KB | rcodina |
#20 | bootstrap.patch | 7.13 KB | rcodina |
#19 | content_div_overflow.png | 159.4 KB | rcodina |
#17 | t_hook_menu.png | 210.88 KB | rcodina |
Comments
Comment #1
EthanTHey, @rcodina. You have given the command to your personal repo. The command for everyone else should be something like:
git clone http://git.drupal.org/sandbox/rcodina/2301115.git
Also, this module doesn't contain much code - 16 lines of php that are used to unset two files, and then one very small js function, so I don't think this qualifies for evaluation.
Comment #2
rcodina CreditAttribution: rcodina commentedThank you @EthanT! I just changed the git clone command.
Comment #3
rcodina CreditAttribution: rcodina commentedI think now it's correct, isn't it?
Comment #4
EthanTYes, @rcodina, but I still don't think this is eligible for review, or at least not to allow you to receive the "promote to full project" permission. The rule is that a module should contain at least 5 functions, and 80 + lines of code, minimum, iirc.
Comment #5
rcodina CreditAttribution: rcodina commented@EthanT, where can I find these rules? Sorry but I'm newbie and I can't find them. If I count php, css and js files, the module has far more than 80 lines of code. Finally, what do you mean by iirc? Thank you!
Comment #6
rcodina CreditAttribution: rcodina commentedAlthough this module is quite small in terms of lines of code, I think it does quite well his job. There is no need for more code. I think it may be handy for a lot of people until a stable release of Responsive Vertical Tabs is out.
Comment #7
EthanTHave a look here, @rcodina: https://groups.drupal.org/node/195848
I misspoke when I said 80 lines - the rule of thumb is 120. I'm pretty sure that css doesn't count towards this tally, as you aren't building functions and making use of drupal api's when styling. What is needed is a certain amount of php, first and foremost, and then if you want to use some js towards this requirement, that *may* work (not sure). Either way, there really isn't anywhere near enough here to evaluate your level of ability and adherence to drupal logic and best coding practices.
"IIRC" = "If I remember correctly."
All of this said, this module may be promoted to a full project if there is a community need, but this module does not meet the minimum requirements for you to be given the permission to promote your projects from sandbox to full projects.
Comment #8
rcodina CreditAttribution: rcodina commentedOk, I understand why this module will remain as a sandbox for now.
You can see which level of ability I have If you take a look at this custom modules I've written for some of my projects:
https://github.com/rogercodina?tab=repositories
Comment #9
PA robot CreditAttribution: PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxrcodina2301115git
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 #10
rcodina CreditAttribution: rcodina commentedI have just modified the module so now it passes pareview.sh test.
Comment #11
rcodina CreditAttribution: rcodina commented@EthanT, I have updated the module with a new feature: You can configure via administration page which side vertical tabs will show on desktop resolutions. Now the module has 105 lines of PHP, JS code. Is now ok?
Comment #12
rcodina CreditAttribution: rcodina commented@EthanT, Do you already think this doesn't qualify for evaluation?
Comment #13
EthanTHey @rcodina - you are still kind of code light, imho, but I like the idea of building out your admin form a little bit more to overcome this. You should add more form options, as opposed to a simple on off kind of toggle. Adding some logic to said form will quickly get you over the lack of code hump.
Comment #14
rcodina CreditAttribution: rcodina commented@EthanT, I have added two new fields on module's administration form to allow user to select width of content and vertical tabs width. Now I count 185 lines of PHP + Javascript. Could you please take a look on module's code? Thank you!
Comment #15
EthanT1) PAReview is clean
2) Functionally works as expected, although you might consider some css cleanup (widths, etc.)
3) Please use t() for text in .module lines 15, 16, 26, 27
4) Not a show stopper, but you could make your .js file more concise. For example:
Instead of:
Do:
Comment #16
rcodina CreditAttribution: rcodina commentedComment #17
rcodina CreditAttribution: rcodina commented@EthanT, I answer point by point:
1) :)
2) Done
3) I did, but I rolled back this change because PAReview told me I can't use "t" function on hook_menu!
4) Done
I have also fixed an error (container sizes on mobile resolutions were wrong) by adding a little bit of CSS for screens under 960px.
See commit for details.
Do you think this module needs more clean up?
Thank you!
Comment #18
EthanTYep, my bad. Looks good to me.
Comment #19
rcodina CreditAttribution: rcodina commented@EthanT, I have added again two rules of CSS I erased because I found out in my project are necessary (see attached screenshot).
Well, now that this project is in state "Reviewed & tested by the community", what is the next step?
Thank you!
Comment #20
rcodina CreditAttribution: rcodina commented@EthanT, I just found out that on Bootstrap theme administration page there are Vertical Tabs which get full width. With my module active, this page looks really awful. To solve this issue, I think about changing selector body[class~="page-admin"] to body[class~="page-admin-structure"]. I have done some tests in local and it works ok. I enclose the patch. Do you think this change would be ok?
Thank you!
Comment #21
EthanTYes, those css changes are fine. Now you have to wait for others to review your module, and a git administrator to promote this to a full project. Looking through the issues queue, you'll see that this process can take a considerable amount of time.
Comment #22
rcodina CreditAttribution: rcodina commentedOk, thank you @EthanT! Just commited bootstrap.patch! Let's wait :)
Comment #23
rcodina CreditAttribution: rcodina commentedI've done some improvements to leave default vertical tabs CSS/JS on pages where I don't responsify them (for example, Bootstrap theme administration page).
Comment #24
rcodina CreditAttribution: rcodina commentedComment #25
er.pushpinderrana CreditAttribution: er.pushpinderrana commented@rcodina, thankyou for your contribution!
Automated Review
Best practice issues identified by pareview.sh / drupalcs / coder. None.
Manual Review
Just removed the extra submit function, it would work in similar as you required.
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.
As I am not a git administrator, so I would recommend you, please help to review other project applications to get a review bonus. This will put you on the high priority list, then git administrators will take a look at your project right away :-)
Thanks again for your hard work.
Comment #26
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedOne more point in vertical_tabs_responsive_page_build: you are passing php values in your js file using following code.
This is not a recommended approach in drupal, better to pass these variables in following way:
You can add variables in the Drupal.settings object like the following syntax :
drupal_add_js(array('module_name' => array('base_path' => base_path())), 'setting');
You can have the base_path variable in your js file as mentioned below :
alert(Drupal.settings.module_name.base_path);
For more information you can visit to following URLs:
Comment #27
rcodina CreditAttribution: rcodina commented@er.pushpinderrana
Thank you for all your suggestions and for recommending me. I have already done all changes you suggested except point number 3 on your first comment. Could you please take a look? I wonder If I have done all changes the right way.
On the other hand, I've read the doc of #attached but I don't figure out how to include my JS and CSS files using it because I don't have any forms (except the form to change module's configuration) Please, could you give me an idea of how I should apply this suggestion on my module?
Thank you so much for everything!
Comment #28
rcodina CreditAttribution: rcodina commented@er.pushpinderrana
I have just uploaded a new version of the module which uses #attached as you recommended. So now all changes you suggested are done.
Comment #29
pkamerakodi CreditAttribution: pkamerakodi commentedHi,
Thanks for the contribution, mean while some small suggestions if you like to update.
Manual Review
Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements
3rd party code
Yes: Follows the guidelines for 3rd party code.
README.txt/README.md
Yes
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
YES
Coding style & Drupal API usage
1) Not sure what the second paramter does
system_settings_form($form, TRUE), becuase in drupal 7 it excepts only one paramter
2) If you are creating a local scope $ variable for Jquery then i think it is better to use $ than jquery
(function ($) {
})(jQuery);
3) General practice is that
if (left != undefined) we use
if (tyepeof left != 'undefined')
4) Is there any reason why you are using json encode on a string?
drupal_json_encode(variable_get('vertical_tabs_responsive_content_width', 70))
5) is it really necessary to create invisible fieldset as below
$form['vertical_tabs_responsive'] = array(
'#type' => 'fieldset',
'#title' => t('Vertical tabs responsive'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#tree' => TRUE,
'#weight' => 99,
'#group' => 'additional_settings',
'#attached' => vertical_tabs_responsive_get_attached(),
'#attributes' => array('class' => array('element-invisible')),
);
Instead cant we use as mentioned in the documentation.
$form['#attached']['css'] = array(
drupal_get_path('module', 'ajax_example') . '/ajax_example.css',
);
$form['#attached']['js'] = array(
drupal_get_path('module', 'ajax_example') . '/ajax_example.js',
);
$form['#attached']['css'][] = array(
'data' => 'YOUR_INLINE_CODES',
'type' => 'inline',
)
$form['#attached']['js'][] = array(
'data' => 'YOUR_INLINE_CODES',
'type' => 'inline',
)
6) is it necessary to check if (path_is_admin(current_path()) && vertical_tabs_responsive_should_responsify_vt()) { inside vertical_tabs_responsive_get_attached becuase if you are calling the function vertical_tabs_responsive_get_attached only after that check in the parent function.
7) Not sure if the below code is really necessary in hook_help
default:
$out = '';
break;
8) I think it would be better if you could combine these 3 array elements into 1 array element.
$attached['js'][] = array(
'data' => array('vertical_tabs_responsive' => $left),
'type' => 'setting',
);
$attached['js'][] = array(
'data' => array('vertical_tabs_responsive' => $content_width),
'type' => 'setting',
);
$attached['js'][] = array(
'data' => array('vertical_tabs_responsive' => $vt_width),
'type' => 'setting',
);
Prajwal
Comment #30
rcodina CreditAttribution: rcodina commented@pkamerakodi Thank you so much for your suggestions!!! I answer them one by one:
1) Done
2) Done
3) Done
4) Yes, because if I don't use it, the module doesn't work properly. I don't know why, I just saw it in other module source code ;)
5) Done
6) Fixed
7) It is, pareview.sh asked me to do that.
8) Done
So, all it's done. I'm learning a lot with community suggestions ;)
Comment #31
pkamerakodi CreditAttribution: pkamerakodi commentedThanks looks to good to me. We all are learning. Keep up the good work
Comment #32
joachim CreditAttribution: joachim commentedAll admin items MUST be below one of the config sub-sections.
If these two settings MUST add up to 100%, then why ask the user for both? Surely you can ask me for just one and calculate the other!
This is not a good UI pattern. Checkboxes should be used for 'on/off' states, but this doesn't fit that case. Here you force the user to think about what 'off' means. It would be better to have a dropdown with two options: left and right.
Missing form builder params.
The word 'render' is redundant.
Needs a @return.
Also, if you're calling arg() lots, just call arg() without the parameter and look in the returned array yourself.
Lastly, you're calling this function at least 3 times in a single request. Statically cache the return result so you don't have to calculate it each time.
Though if your aim is to always change vertical tabs, can't you just assume that if $javascript['misc/vertical-tabs.js'] is set, then you should unset it?
The 'implements' line should always be first.
Finally, I tried enabling this module with my own custom theme, and it doesn't work! Vertical tabs get turned off and I just see fieldgroups.
Comment #33
rcodina CreditAttribution: rcodina commented@joachim, thanks for your suggestions!!! I have done all you have said. I just want to answer these two issues:
No, I can't because I only responsify them in node add/edit pages and pages under admin/structure.
Could I have the code of theme to test it together with my module? Without it I can't do anything more. Just now my module is only compatible with following administration themes: Seven, Adminimal and Commerce Kickstart Admin Theme.
Comment #34
joachim CreditAttribution: joachim commented> Just now my module is only compatible with following administration themes: Seven, Adminimal and Commerce Kickstart Admin Theme
I'm not a themer, so this might be a stupid question, but why does it only work with specific themes?
> No, I can't because I only responsify them in node add/edit pages and pages under admin/structure.
Also maybe a stupid question, but can't it change all vertical tabs?
Comment #35
rcodina CreditAttribution: rcodina commented@joachim
Because not all themes have same HTML tags, attributes, classes, etc.. So, some CSS/JS tuning may be required in order to get this module running on more themes.
No because I discovered that some modules/themes use "full width" vertical tabs as form. In theses cases, my module would mess the form and turn into an unusable thing. Just install bootstrap theme and go to theme preferences. You will see an example of this kind of forms.
Comment #36
rcodina CreditAttribution: rcodina commented@joachim
I have done some changes to my module: I found out the way I was attaching CSS/JS files I was losing CSS/JS from other modules. Could you please try again my module on your custom theme?
Thank you!
Comment #37
rcodina CreditAttribution: rcodina commented@all and specially @joachim
I have done some changes in code to improve compatibility with field_group module and with Drupal Commerce Kickstart and Shiny theme. Please, tell me if it works for you.
Thank you so much!
Comment #38
rcodina CreditAttribution: rcodina commentedI think this module is already ok for a first beta release. I wait for full project permission and more reviews. Thanks!
Comment #39
rcodina CreditAttribution: rcodina commented@all I have just updated the module:
Now it responsifies all vertical tabs in admin pages (not only on node add/edit and admin/structure pages). The module detects automatically if vertical tabs of forms must be responsified: there are some forms that are full width vertical tabs and this module avoids them (bootstrap theme admin page, and forms build with field_group module for example).
Comment #40
rcodina CreditAttribution: rcodina commented@joachim
Now I always unset this. If it is necessary, I restablish normal vertical tabs behaviour.
Please, try it again.
Now I detect "full width" vertical tabs forms in order to apply normal behaviour on them. So now I can responsify all forms, not only under node add/edit and admin/structure pages.
Comment #41
rcodina CreditAttribution: rcodina commentedJust done a few changes to improve theming and javascript of module.
Comment #42
joachim CreditAttribution: joachim commented> No because I discovered that some modules/themes use "full width" vertical tabs as form. In theses cases, my module would mess the form and turn into an unusable thing. Just install bootstrap theme and go to theme preferences. You will see an example of this kind of forms.
I've had a look at this, and I'm not sure what you mean by 'full width'. How is the Bootstrap theme settings use of vertical tabs different from node edit?
Comment #43
rcodina CreditAttribution: rcodina commented@joachim
The difference is:
Node edit: there is a form and under it there are vertical tabs.
Bootstrap theme settings page: whole form are vertical tabs.
My module should not do anything on forms which are 100% vertical tabs (aka full width forms).
Comment #44
joachim CreditAttribution: joachim commented> whole form are vertical tabs
Is it possible to detect this form structure from the form array? That would mean you can drop the specific form ID detection.
Comment #45
rcodina CreditAttribution: rcodina commentedYes, it is. With latest changes I done to the module (commited a few days ago) I already handle both cases well. I also simplified CSS selectors a bit.
Check this commit (it is not the latest one).
Comment #46
rcodina CreditAttribution: rcodina commentedI have done all I have been told to improve the module. Why no one marks this as RTBC?
I know my module may need more improvements, but this improvements will come form users that will try the first beta version. A lot of users don't use modules that are sandboxes because they want to just download a zip (they don't want to use git or simply they don't know what git is).
Comment #47
hoosk CreditAttribution: hoosk commentedIt works for me. I think he can do a beta version because then a lot of more users will give him feedback.
Comment #48
rcodina CreditAttribution: rcodina commentedI just have done a few improvements to the module regarding the code responsible for deciding on which forms vertical tabs should be responsified.
@joachim With this change I have dropped the specific form ID detection
Can anyone tell me why this issue is taking sooooo long?
Comment #49
stBorchertSince we are quite busy handling all the project applications you should take part in the Review bonus system. This system rewards people who are willing to help out with a bonus in the form of a prioritized application queue.
Thanks.
Comment #50
rcodina CreditAttribution: rcodina commentedComment #51
rcodina CreditAttribution: rcodina commentedComment #52
rcodina CreditAttribution: rcodina commentedComment #53
klausifixing tag.
Comment #54
rcodina CreditAttribution: rcodina commentedOk, thanks! What's the difference between two?
Comment #55
klausimanual review:
But otherwise looks good to me, so ...
Thanks for your contribution, rcodina!
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.
Comment #56
rcodina CreditAttribution: rcodina commentedThank you so much Klausi!
I will make help text to pass through t() before doing a release. Also, I will checkout all the readings you suggested.
Thanks!
Comment #57
rcodina CreditAttribution: rcodina commented@Klausi I have already done the changes you suggested on hook_help. Also, I just tried to promote my sandbox to a full project but I can't see the button which is shown here in this help page. I've attached an image just to show you the tab "Promote" doesn't appear for me.
Thanks!
Comment #58
klausiYou have the git vetted user role, so that seems to be in order. Please open a webmaster issue at https://www.drupal.org/node/add/project-issue/webmasters
Comment #59
rcodina CreditAttribution: rcodina commentedThanks @Klausi, I just created an issue as you suggested.
Comment #60
rcodina CreditAttribution: rcodina commentedRelease done!
https://www.drupal.org/project/vertical_tabs_responsive