diff options
author | Jayaram R Pai | 2014-07-30 18:12:23 +0530 |
---|---|---|
committer | Jayaram R Pai | 2014-07-30 18:12:23 +0530 |
commit | f83ffd87d4decbbe05a4c8a26c4c9860c223e72e (patch) | |
tree | f4b765d76b5c431b563134f15caa6f0e4ad80179 | |
parent | c446c2b1a27df3e38ad788f2ed5cd4d0415b58d3 (diff) | |
download | job_portal-f83ffd87d4decbbe05a4c8a26c4c9860c223e72e.tar.gz job_portal-f83ffd87d4decbbe05a4c8a26c4c9860c223e72e.tar.bz2 job_portal-f83ffd87d4decbbe05a4c8a26c4c9860c223e72e.zip |
added quick_links for jobs page
-rw-r--r-- | css/main.css | 5 | ||||
-rw-r--r-- | job_portal.module | 28 | ||||
-rw-r--r-- | js/smooth_scroll.js | 26 |
3 files changed, 54 insertions, 5 deletions
diff --git a/css/main.css b/css/main.css index 1617b3d..661dfe6 100644 --- a/css/main.css +++ b/css/main.css @@ -11,3 +11,8 @@ #job-application legend { text-align: center; } +#quick-links { + position: fixed; + left: 45px; + top: 250px; +} diff --git a/job_portal.module b/job_portal.module index bc98aa5..667e8e6 100644 --- a/job_portal.module +++ b/job_portal.module @@ -185,9 +185,11 @@ FOSSEE Team } function job_portal_page() { - $result = get_jobs_available(); - $output = ""; + $output = ""; + $quick_links = ""; $i = 1; + + $result = get_jobs_available(); foreach($result as $row) { $collapser_header = "#{$i} - {$row->project} - Job Details"; $collapser_content = " @@ -205,11 +207,17 @@ FOSSEE Team "html" => TRUE, )); $collapser_content .= "</center>"; - $output .= collapser($collapser_header, $collapser_content); + $output .= collapser($collapser_header, $collapser_content, "", $i); + $quick_links .= "<a class='badge quick' data-toggle='tooltip' data-placement='right' title='{$row->project}' href='#fieldset-id-{$i}'>{$i}</a><br>"; $i++; } $output = array( + "quick_links" => array( + "#prefix" => "<div id='quick-links'>", + "#markup" => $quick_links, + "#suffix" => "</div>", + ), "job_description" => array( "#prefix" => "<div id='job-description'>", "#markup" => $output, @@ -302,12 +310,22 @@ FOSSEE Team function job_portal_init() { drupal_add_js("misc/form.js"); drupal_add_js("misc/collapse.js"); + drupal_add_js( + drupal_get_path('module', 'job_portal') . '/js/smooth_scroll.js', + array( + 'group' => JS_THEME, + 'weight' => 20, + 'every_page' => TRUE, + 'cache' => TRUE, + 'scope' => 'header', + ) + ); } /* helper functions */ - function collapser($title="", $content="", $description="") { + function collapser($title="", $content="", $description="", $key="") { return " - <fieldset id='fieldset-id' class='collapsible'> + <fieldset id='fieldset-id-{$key}' class='collapsible'> <legend> <a class='fieldset-title' href='#'> <span class='fieldset-legend'>{$title}</span> diff --git a/js/smooth_scroll.js b/js/smooth_scroll.js new file mode 100644 index 0000000..d16dc1a --- /dev/null +++ b/js/smooth_scroll.js @@ -0,0 +1,26 @@ +(function($) { + $(document).ready(function() { + $('a[href*=#]:not([href=#])').click(function() { + if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') + || location.hostname == this.hostname) { + + var target = $(this.hash); + target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); + if (target.length) { + $('html,body').animate({ + scrollTop: target.offset().top + }, 1000); + return false; + } + } + }); + $(".quick").click(function() { + $(".quick").removeClass("badge-success"); + $(this).addClass("badge-success"); + setTimeout(function() { + $(".quick").removeClass("badge-success"); + }, 4000); + }); + $('.quick').tooltip(); + }); +})(jQuery); |