;(function($,_,undefined){"use strict";ips.controller.register('suggesttopic.showForm',{initialize:function(){this.on('click',this.showSuggestionForm);this.setup();},setup:function(){$('.suggesttopic_container div a.ipsDialog_close').on('click',function(e){e.preventDefault();$('.suggesttopic_container').css('left','-10000px');})},showSuggestionForm:function(e){$(e.currentTarget).next('div').css('left','0');}});}(jQuery,_));;
;(function($,_,undefined){"use strict";ips.controller.register('suggesttopic.submit',{initialize:function(){this.on('submit',this.submitForm);},submitForm:function(e){e.preventDefault();if(!this.validateForm())return;var url=this.scope.attr('action');var data=this.scope.serialize();var self=this;ips.getAjax()(url,{type:'post',data:data,showLoading:true}).done(function(response){ips.ui.flashMsg.show(response.status=='success'?'Suggestion Sent':'Oops! Something went wrong.',{escape:false});if(response.status=='success'){setTimeout(self.resetForm(),1000);}});},validateForm:function(){var send=true;if(!$('[name="suggesttopic_new_checkbox"]').is(':checked')&&!$('[name="suggesttopic_existing"]').val()){$('[name="suggesttopic_existing"]').css('background','#ff000017');send=false;}else{$('[name="suggesttopic_existing"]').css('background','#FFF');}
if(!$('[name="suggesttopic_details"]').val()){$('[name="suggesttopic_details"]').css('background','#ff000017');send=false;}else{$('[name="suggesttopic_details"]').css('background','#FFF');}
return send;},resetForm:function(){$('.suggesttopic_container').css('left','-10000px');$('[name="suggesttopic_details"], [name="suggesttopic_existing"]').val('');}});}(jQuery,_));;