weiterleitung

This commit is contained in:
Martin Müller 2014-05-07 11:24:31 +02:00
parent 41bfcca04b
commit 25dbbfc155
3 changed files with 21 additions and 6 deletions

View File

@ -54,7 +54,7 @@ class JobController extends AppController {
$this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $c['AppUser']['id']; $this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $c['AppUser']['id'];
if ($this->DreamjobJobOpening->save()) { if ($this->DreamjobJobOpening->save()) {
$this->MiconwareSession->setFlash(__('dreamjob.opening.save.add'), 'flash', array('alert' => 'success')); $this->MiconwareSession->setFlash(__('dreamjob.opening.save.add'), 'flash', array('alert' => 'success'));
return $this->redirect(array('action' => 'applicationByOpening','id'=>$this->DreamjobJobOpening->id)); return $this->redirect(array('action' => 'openingGet','id'=>$this->DreamjobJobOpening->id));
} else { } else {
$this->MiconwareSession->setFlash(__('dreamjob.opening.save.error'), 'flash', array('alert' => 'danger')); $this->MiconwareSession->setFlash(__('dreamjob.opening.save.error'), 'flash', array('alert' => 'danger'));
} }
@ -92,7 +92,7 @@ class JobController extends AppController {
$this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $cid; $this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $cid;
if ($this->DreamjobJobOpening->save($this->DreamjobJobOpening->data)) { if ($this->DreamjobJobOpening->save($this->DreamjobJobOpening->data)) {
$this->MiconwareSession->setFlash(__('dreamjob.opening.save'), 'flash', array('alert' => 'success')); $this->MiconwareSession->setFlash(__('dreamjob.opening.save'), 'flash', array('alert' => 'success'));
return $this->redirect(array('action' => 'applicationByOpening','id'=>$this->request->params['id'])); return $this->redirect(array('action' => 'openingGet','id'=>$this->request->params['id']));
} else } else
$this->MiconwareSession->setFlash(__('dreamjob.opening.save.error'), 'flash', array('alert' => 'danger')); $this->MiconwareSession->setFlash(__('dreamjob.opening.save.error'), 'flash', array('alert' => 'danger'));
} }

View File

@ -159,7 +159,14 @@ body.loading #container{
color:white; color:white;
text-decoration: none; text-decoration: none;
} }
/*
*
*/
#alert.old .alert{
background-color: #E9E9E9;
border-color: #BABABA;
color: #9B9B9B;
}
/* /*
* Main * Main
*/ */

View File

@ -144,14 +144,17 @@
}); });
//$(where+" form label.has-error").parent(".form-group").addClass("has-error") //$(where+" form label.has-error").parent(".form-group").addClass("has-error")
} }
function setContent(data,back,tab){ function setContent(data,back,tab,backignore){
alert = data.split('<!-- alert -->')[1].split('<!-- /alert -->')[0]; alert = data.split('<!-- alert -->')[1].split('<!-- /alert -->')[0];
$('#alert').removeClass('old');
if( alert.trim().length > 0){ if( alert.trim().length > 0){
$('#alert').html(alert); $('#alert').html(alert);
}else if(!backignore){
$('#alert').addClass('old');
} }
if(back){ if(back){
load(back,{},tab); load(back,{'backignore':true},tab);
}else if(tab){ }else if(tab){
navbar = data.split('<!-- tab -->')[1].split('<!-- /tab -->')[0]; navbar = data.split('<!-- tab -->')[1].split('<!-- /tab -->')[0];
$('#tab').html(navbar); $('#tab').html(navbar);
@ -182,6 +185,7 @@
alert = "<div class=\"alert alert-danger\">"+data.statusText+ alert = "<div class=\"alert alert-danger\">"+data.statusText+
"<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>"
+ "</div>"; + "</div>";
$('#alert').removeClass('old');
$('#alert').html(alert); $('#alert').html(alert);
event("#alert"); event("#alert");
$('#container').html(data.responseText); $('#container').html(data.responseText);
@ -191,6 +195,7 @@
data = {}; data = {};
typemethode = "GET"; typemethode = "GET";
back = false; back = false;
backignore = false;
history = true; history = true;
if(conf['data']) if(conf['data'])
data = conf['data']; data = conf['data'];
@ -198,14 +203,17 @@
typemethode = conf['type']; typemethode = conf['type'];
if(conf['back'] && conf['back'].indexOf("logout")== -1 && conf['back'].indexOf("login")== -1 ) if(conf['back'] && conf['back'].indexOf("logout")== -1 && conf['back'].indexOf("login")== -1 )
back = conf['back']; back = conf['back'];
if(conf['backignore'])
backignore = conf['backignore'];
if(conf['history']) if(conf['history'])
history = conf['history']; history = conf['history'];
//e.preventDefault(); //e.preventDefault();
/* /*
if uncomment the above line, html5 nonsupported browers won't change the url but will display the ajax content; if uncomment the above line, html5 nonsupported browers won't change the url but will display the ajax content;
if commented, html5 nonsupported browers will reload the page to the specified link. if commented, html5 nonsupported browers will reload the page to the specified link.
*/ */
$.ajax({url:pageurl,data:data,type:typemethode,success:function(data){setContent(data,back,tab);} ,error:function(data){setContentError(data,back,tab);}}); $.ajax({url:pageurl,data:data,type:typemethode,success:function(data){setContent(data,back,tab,backignore);} ,error:function(data){setContentError(data,back,tab);}});
if(history && pageurl!=window.location){ if(history && pageurl!=window.location){
window.history.pushState({path:pageurl},'',pageurl); window.history.pushState({path:pageurl},'',pageurl);
} }