Overview
The head bar module will provide a header bar above the body of the page.
It used to attract the viewer as the header bar will appear after some seconds as configured.
It used to highlight any special thing in site like.
- Event
- New article
- Contact us
- Social media link

Features
- HTML code could be added.
- Color of the bar and mouse hover of the show icon can be configure from drupal.
- Delaytime can be customized.

Project Page : http://drupal.org/sandbox/j2r/1673526
Git Clone: git clone --recursive --branch 7.x-1.x http://git.drupal.org/sandbox/j2r/1673526.git headbar
Drupal Version 7.x

Reviewed the modules:
- http://drupal.org/node/1670352#comment-6193774
- http://drupal.org/node/1660466#comment-6163194
- http://drupal.org/node/1699468#comment-6272338
- http://drupal.org/node/1679472#comment-6225494

CommentFileSizeAuthor
headbar.jpg30.4 KBj2r

Comments

sanchi.girotra’s picture

1. Add direct link to your git repository (git clone ...) and detailed description of what your project does in the issue summary refer:http://drupal.org/node/1011698.
2. There is still a master branch, make sure to remove it.
3. Create a proper menu link to access the Header bar settings page as we have to call the menu(admin/config/administration/headbar) directly on the browser to access the settings page.
For doing this,change menu link from "admin/config/administration/headbar " to "admin/config/people/headbar" then header bar settings link will start appearing on configuration page under people tag.

eyal shalev’s picture

Status: Needs review » Needs work

You should also change your default branch to 7.x-1.x (currently master).

And also edit this issue description to include the new git clone command (will be helpful to new reviewers).

eyal shalev’s picture

Suggestions:

  • Select what role should see the message
  • Use a renderable array for the message html & allow 3rd party themes to preprocess and override the tpl.
  • Add the configure property to the info file (configure = admin/config/administration/headbar).

Questions:

  • How is this better than using a custom block with javascript configurations?
j2r’s picture

Issue summary: View changes

added git clone url

j2r’s picture

Status: Needs work » Needs review

Hey sanchi.girotra and Eyal Shalev thanks for review.

  • In master branch i have added only README.txt file and i think its a standard way untill the module is approved.
  • The module has been added under user-interface in configuration and added configure link in info file as well.
  • 2 permission has been added "view headbar" and "administrate headbar".
  • To do any theme/css related changes its all there in the backend configuration.

Please review the module.

Thanks
J2R

sanchi.girotra’s picture

Status: Needs review » Needs work

Hey J2R,
Please see the automated review report here.
Manual Review:
.module file:
Suggestion : You can declare variable as
$form['headbar_text] = array(
'#title' => t('Text'),
'#type' => 'textarea',
'#description' => t('Insert text which will come in the bar'),
'#default_value' => variable_get('headbar_text', 'This text will appear on header bar'),
);
rather than creating and declaring them twice in hook_init() as headbar_text and headbar_admin_settings() as msg_text.This will reduce no of variables declared but without this also project is working fine.

j2r’s picture

Done all the changes accordingly. Please review the module.

sanchi.girotra’s picture

Status: Needs work » Needs review

Changing the status from needs work to needs review.
Remove error related to master branch by
make sure active branch(git branch) is not master then run
git branch -d master
git push origin :master

bartlantz’s picture

I tested the module and with one exception it worked as intended. (The close arrow doesn't work in the lastest version of Opera.)

I have the following suggestions:
1. The following internal function should be renamed with an underscore:
headbar_output --> _headbar_output
Naming internal functions with an underscore, tells other devs that this is an internal function and not a call to a hook.

2. Use Drupal.behaviors API instead of jQuery(document).ready()
change the
jQuery(document).ready(function() {

to:
Drupal.behaviors.headbar = {
attach: function (context, settings) {

3. As mentioned above, I tested it in firefox, chrome and opera. The close functionality does not
work on Opera. I do not know the policy on this, perhaps switching to Drupal.behaviors will fix this.

4. You probably want to disable the headbar on admin pages. Or at least offer that option on
the configuration page.

Thanks,
Bart

j2r’s picture

Thanks for the review bartlantz.

I have updated all the 3 changes that you have mansion and now the headbar is working in opera as well. About the point no 4 , Can you suggest a way to check the page is admin page or backend page?

bartlantz’s picture

Hey j2r,

the changes look good! That's great it's working in Opera too!

With point #4, I think you could add something as simple as the following to line #36 in headbar.module:

if (strpos($_GET['q'], 'js/') === 0 || strpos($_GET['q'], 'admin/') === 0) {

I only mentioned disabling on admin pages because with the admin menu, you can't see the headbar anyway. So it would seem to make sense to disable it there so that it doesn't interfere with the admin menu.

Thanks,
Bart

j2r’s picture

Done all the changes accordingly. Please review the module.

a_thakur’s picture

Status: Needs review » Needs work

some manual review.
All the admin related code should go in a differen file. In this case it would be headbar.admin.inc so the corresponding change in the implementation of hook_menu() would be.

**
 * Implements of hook_menu().
 */
function headbar_menu() {
  $items['admin/config/user-interface/headbar'] = array(
    'title' => 'Header bar settings',
    'description' => 'Change how the header bar appear and the text',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('headbar_admin_settings'),
    'access arguments' => array('administer headbar'),
    file' => 'headbar.admin.inc, // This is a new line.
    'type' => MENU_NORMAL_ITEM,
  );
  return $items;
}

And the function headbar_admin_settings() would go in the file headbar.admin.inc. All the descriptions shoudl end in a full stop.
Would be great in case you could include validation function for the textfield so the user can enter only the correct input.

Happy coding :)

j2r’s picture

Status: Needs work » Needs review

Hello a_thakur, Thanks for the review.

Added headbar.admin.inc file and moved all backend code in it and added form validation for delaytime as number and all the field must not be empty.

Please review

j2r’s picture

Done all the changes accordingly. Please review the module.

Anonymous’s picture

You might want to change the documentation on headbar_admin_settings_submit function.

Also even if the project is small I would recommend setting up a css folder where you can put your css file and images.
Again about css I would recommend to rewrite this function :

function _headbar_output() {
 <del> $path = drupal_get_path('module', 'headbar');</del>
  $text = variable_get('headbar_text', 'This text will appear on header bar');

  $content = '<div class="headbar" <del>style="display:none"</del>>
   <span>' . $text . '</span>
   <a class="close-notify" ><img class="headbar-up-arrow" <del>src="' . $path .
   '/headbar-up-arrow.png"</del>></a></div>
   <div class="headbar-stub" <del>style="display:none"</del>>
    <a class="show-notify" ><img class="headbar-down-arrow"
    <del>src="' . $path . '/headbar-down-arrow.png"</del>></a></div>';
  return $content;
}

Indeed you could include a lot of css related content directly into the css file.

j2r’s picture

Hey Quentin Albrand thanks for the review.

Done all the changes. Please review.

j2r’s picture

Done with all the changes. Please review the module.

patrickd’s picture

I'm sorry for the delay!
There are about 100 other applications waiting for review and only a hand full of active reviewers.
We do really need more hands in the application queue and highly recommend to get a review bonus so we can come back to your application sooner.

patrickd’s picture

Issue summary: View changes

Added some reviewed modules link

pjcdawkins’s picture

Issue summary: View changes

Changed git command so it's accessible for non-maintainers.

pjcdawkins’s picture

Status: Needs review » Needs work

Automatic review

There is still a master branch, make sure to set the correct default branch: http://drupal.org/node/1659588 . Then remove the master branch, see also step 6 and 7 in http://drupal.org/node/1127732.

Manual review

General
There are a few grammatical and typographical errors, for example the module's description makes little sense: "Create a header bar which will appear on the header of the page after extend of time".

You also haven't answered the question in comment #3: "How is this better than using a custom block with javascript configurations?"

headbar.admin.inc
Instead of _headbar_is_empty, you should set #required => TRUE on the form elements you don't want to be left empty.

You also don't need to say "Error: " at the beginning of the strings you pass to form_set_error().

I suggest renaming _headbar_is_numeric() to something like _headbar_validate_delaytime(), to show more clearly that the validation function is specific to that element.

README.txt
This says the configuration page is at admin/config/administration/headbar, but it's actually at admin/config/user-interface/headbar.

headbar.module
_headbar_output() should make use of the Drupal Theme API, probably as a template file for a custom theme hook. See docs at http://drupal.org/node/933976.

j2r’s picture

Thanks for the review pjcdawkins,

Will update all the changes.

j2r’s picture

Hello

Done all the other changes locally. I am littlebit stuck with Drupal Theme API. Can any one help me out how can i shift my html code to theme API.

Thanks.

klausi’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. Feel free to reopen if you are still working on this application.

klausi’s picture

Issue summary: View changes

Changed git command so 7.x-1.x branch is selected...

avpaderno’s picture

Title: Headbar » [D7] Headbar
Issue summary: View changes