mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Don't refresh page when sending 'contact us' message
This commit is contained in:
parent
381184652c
commit
b37f2ff96c
@ -138,18 +138,17 @@ class HomeController extends BaseController
|
||||
*/
|
||||
public function contactUs()
|
||||
{
|
||||
Mail::raw(request()->message, function ($message) {
|
||||
Mail::raw(request()->contact_us_message, function ($message) {
|
||||
$subject = 'Customer Message';
|
||||
if (! Utils::isNinja()) {
|
||||
$subject .= ': v' . NINJA_VERSION;
|
||||
}
|
||||
$message->to(CONTACT_EMAIL)
|
||||
$message->to(env('CONTACT_EMAIL'))
|
||||
->from(CONTACT_EMAIL, Auth::user()->present()->fullName)
|
||||
->replyTo(Auth::user()->email, Auth::user()->present()->fullName)
|
||||
->subject($subject);
|
||||
});
|
||||
|
||||
return redirect(Request::server('HTTP_REFERER'))
|
||||
->with('message', trans('texts.contact_us_response'));
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -2275,7 +2275,7 @@ $LANG = array(
|
||||
'marked_sent_invoices' => 'Successfully marked invoices sent',
|
||||
'invoice_name' => 'Invoice',
|
||||
'product_will_create' => 'product will be created',
|
||||
'contact_us_response' => 'Your message has been sent',
|
||||
'contact_us_response' => 'Thank you for your message! We\'ll try to respond as soon as possible.',
|
||||
'last_7_days' => 'Last 7 Days',
|
||||
'last_30_days' => 'Last 30 Days',
|
||||
'this_month' => 'This Month',
|
||||
|
@ -1,7 +1,10 @@
|
||||
{!! Former::vertical_open('/contact_us')->rules([
|
||||
'from' => 'required',
|
||||
'message' => 'required',
|
||||
]) !!}
|
||||
{!! Former::vertical_open()
|
||||
->onsubmit('return onContactUsFormSubmit()')
|
||||
->addClass('contact-us-form')
|
||||
->rules([
|
||||
'contact_us_from' => 'required',
|
||||
'contact_us_message' => 'required',
|
||||
]) !!}
|
||||
|
||||
<div class="modal fade" id="contactUsModal" tabindex="-1" role="dialog" aria-labelledby="contactUsModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
@ -11,21 +14,33 @@
|
||||
<h4 class="modal-title">{{ trans('texts.contact_us') }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="container" style="width: 100%; padding-bottom: 0px !important">
|
||||
<div class="panel panel-default" style="margin-bottom: 0px">
|
||||
<div class="panel-body">
|
||||
|
||||
{!! Former::plaintext('from')
|
||||
<div class="input-div">
|
||||
{!! Former::plaintext('contact_us_from')
|
||||
->label('from')
|
||||
->value(Auth::user()->present()->email) !!}
|
||||
|
||||
{!! Former::textarea('message')
|
||||
{!! Former::textarea('contact_us_message')
|
||||
->label('message')
|
||||
->rows(10) !!}
|
||||
|
||||
</div>
|
||||
<div class="response-div" style="display: none; font-size: 16px">
|
||||
{{ trans('texts.contact_us_response') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<div class="input-div">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.cancel') }}</button>
|
||||
<button type="submit" class="btn btn-success" onclick="submitContactUs()">{{ trans('texts.submit') }}</button>
|
||||
<button type="submit" class="btn btn-success">{{ trans('texts.submit') }}</button>
|
||||
</div>
|
||||
<div class="response-div" style="display: none;">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.close') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -41,8 +56,25 @@
|
||||
|
||||
$(function() {
|
||||
$('#contactUsModal').on('shown.bs.modal', function() {
|
||||
$("#message").focus();
|
||||
$('#contactUsModal .input-div').show();
|
||||
$('#contactUsModal .response-div').hide();
|
||||
$("#contact_us_message").focus();
|
||||
})
|
||||
})
|
||||
|
||||
function onContactUsFormSubmit() {
|
||||
$('#contactUsModal .modal-footer button').attr('disabled', true);
|
||||
|
||||
$.post("{{ url('/contact_us') }}", $('.contact-us-form').serialize(), function(data) {
|
||||
$('#contactUsModal .input-div').hide();
|
||||
$('#contactUsModal .response-div').show();
|
||||
$('#contact_us_message').val('');
|
||||
$('#contactUsModal .modal-footer button').attr('disabled', false);
|
||||
}).fail(function(data) {
|
||||
$('#contactUsModal .modal-footer button').attr('disabled', false);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user