diff options
author | Jayaram R Pai | 2014-09-15 16:30:47 +0530 |
---|---|---|
committer | Jayaram R Pai | 2014-09-15 16:30:47 +0530 |
commit | 88c0dd884cdd18d6f6e8ee833c0f34cb9b4e1107 (patch) | |
tree | f2cc16693231a9e94c8d9e6f6dcc747d6de22ff6 | |
parent | b0dffe5326819ec6a76e623727dd4e3ca47703e6 (diff) | |
download | job_portal-88c0dd884cdd18d6f6e8ee833c0f34cb9b4e1107.tar.gz job_portal-88c0dd884cdd18d6f6e8ee833c0f34cb9b4e1107.tar.bz2 job_portal-88c0dd884cdd18d6f6e8ee833c0f34cb9b4e1107.zip |
added option to shortlist
-rwxr-xr-x | css/main.css | 3 | ||||
-rwxr-xr-x | job_portal.module | 55 | ||||
-rwxr-xr-x | js/main.js | 17 |
3 files changed, 66 insertions, 9 deletions
diff --git a/css/main.css b/css/main.css index 661dfe6..8e0c0f6 100755 --- a/css/main.css +++ b/css/main.css @@ -16,3 +16,6 @@ left: 45px; top: 250px; } +.sync-msg { + font-size: .8em; +} diff --git a/job_portal.module b/job_portal.module index 4fe3a9f..249f226 100755 --- a/job_portal.module +++ b/job_portal.module @@ -5,8 +5,6 @@ "title" => t("Access Job Portal"), "description" => t("Allows users to view job postings.") ), - - "manage job_portal" => array( "title" => t("Manage Job Portal"), "description" => t("Allows users to manage job postings.") @@ -46,6 +44,12 @@ "type" => MENU_CALLBACK ); + $items["jobs/ajax"] = array( + "title" => "Ajax callbacks", + "page callback" => "job_portal_ajax", + "access arguments" => array("manage download_application"), + "type" => MENU_CALLBACK + ); return $items; } @@ -267,7 +271,7 @@ FOSSEE Team ->condition("position_id", $position_id) ->execute()->fetchAll(); $headers = array( - "#", "Name", "Time", "Download" + "#", "Name", "Time", "Download", "Select" ); $rows = array(); $i = 1; @@ -276,16 +280,21 @@ FOSSEE Team $i, $row->name, $row->time, - - l(str_replace('.', '_',str_replace(' ', '_',strtolower("{$row->id}_{$row->name}"))) . '.pdf', "uploads/resumes/{$row->id}/{$row->resume}") - + l(str_replace('.', '_',str_replace(' ', '_',strtolower("{$row->id}_{$row->name}"))) . '.pdf', "uploads/resumes/{$row->id}/{$row->resume}", array("attributes" => array("target" => "_blank",))), ); - + + if($row->selected) { + $check = "<input class='shortlist' type='checkbox' data-aid='{$row->id}' checked>"; + } else { + $check = "<input class='shortlist' type='checkbox' data-aid='{$row->id}'>"; + } + array_push($item, $check); + $job = db_select("job_portal_positions") ->fields("job_portal_positions") ->condition("id", $position_id) ->execute()->fetchObject(); - + $base_path= $_SERVER['DOCUMENT_ROOT'] . base_path(); $downloads_dir = "uploads/resumes/{$row->id}/{$row->resume}"; $files = $downloads_dir; @@ -359,11 +368,39 @@ FOSSEE Team readfile($zipname); } + function job_portal_ajax($item="", $key="") { + $data = ""; + if($item == "shortlist") { + $query = " + UPDATE job_portal_applications + SET selected = !selected + WHERE id = :aid + "; + $args = array( + ":aid" => $key + ); + db_query($query, $args); + $data = "updated"; + } + echo $data; + exit(); + } + 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', + drupal_get_path("module", "job_portal") . '/js/main.js', + array( + 'group' => JS_THEME, + 'weight' => 20, + 'every_page' => TRUE, + 'cache' => TRUE, + 'scope' => 'header', + ) + ); + drupal_add_js( + drupal_get_path('module', 'job_portal') . '/js/smooth_scroll.js', array( 'group' => JS_THEME, 'weight' => 20, diff --git a/js/main.js b/js/main.js new file mode 100755 index 0000000..6cf7da0 --- /dev/null +++ b/js/main.js @@ -0,0 +1,17 @@ +$(document).ready(function() { + var basePath = Drupal.settings.basePath; + var modPath = basePath + "jobs/"; + + $shortlist = $(".shortlist"); + $shortlist.click(function (e) { + $(".sync-msg").remove(); + $(this).after("<span class='sync-msg'>Saving...</span>"); + $.ajax({ + url: modPath + "ajax/shortlist/" + $(this).data("aid"), + success: function() { + $(".sync-msg").remove(); + console.log("success"); + } + }); + }); +}); |