REFACTORING #1880 @4h30m: another ugly refactoring commit
This commit is contained in:
@@ -40,7 +40,7 @@ class ContactForm extends Handler implements ContentTitles, AdvancedContentModif
|
||||
];
|
||||
|
||||
// save settings
|
||||
$content->module_settings = json_encode($settings);
|
||||
$content->moduleSettings = json_encode($settings);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ class ContactForm extends Handler implements ContentTitles, AdvancedContentModif
|
||||
*
|
||||
* @return int number of edited fields
|
||||
*/
|
||||
public static function edit(Content &$content, Request $request, $revisionID)
|
||||
public static function edit(Content $content, $request)
|
||||
{
|
||||
$fields = [
|
||||
'phone' => 'phone',
|
||||
@@ -70,7 +70,7 @@ class ContactForm extends Handler implements ContentTitles, AdvancedContentModif
|
||||
|
||||
// get data and try to save them
|
||||
$data = EditContent::getFields($request, $fields);
|
||||
list($revision, $changedColumns) = $content->updateWithHistory($fields, $data, $revisionID);
|
||||
list($revision, $changedColumns) = $content->updateWithHistory($fields, $data);
|
||||
|
||||
// return amount of changed columns
|
||||
return $changedColumns;
|
||||
|
||||
@@ -21,22 +21,22 @@ class CreateNewMessage extends Controller
|
||||
public function postMessage(SendNewEmailRequest $request, $formId)
|
||||
{
|
||||
// load form settings
|
||||
$form = Content::where('module_handler', config('contactform.handler'))
|
||||
$form = Content::where('moduleHandler', config('contactform.handler'))
|
||||
->findOrFail($formId);
|
||||
|
||||
$form->module_settings = json_decode($form->module_settings);
|
||||
$form->moduleSettings = json_decode($form->moduleSettings);
|
||||
|
||||
// select template
|
||||
$template = isset($form->module_settings->emailTemplate) ? $form->module_settings->emailTemplate : 'contactform::emails.default';
|
||||
$template = isset($form->moduleSettings->emailTemplate) ? $form->moduleSettings->emailTemplate : 'contactform::emails.default';
|
||||
|
||||
// send email
|
||||
$status = Mail::send(Template::name($template), ['data' => $request], function (Message $message) use ($request, $form) {
|
||||
$message->from($request->email, $request->name);
|
||||
|
||||
// get message subject
|
||||
$subject = isset($form->module_settings->subject) ? $form->module_settings->subject : trans('contactform::admin/contents.defaultSubject');
|
||||
$subject = isset($form->moduleSettings->subject) ? $form->moduleSettings->subject : trans('contactform::admin/contents.defaultSubject');
|
||||
|
||||
$message->to($form->module_settings->email)
|
||||
$message->to($form->moduleSettings->email)
|
||||
->subject($subject);
|
||||
});
|
||||
|
||||
|
||||
@@ -55,11 +55,11 @@
|
||||
|
||||
@if($module->support_categories && count($categories))
|
||||
<div class="col-lg-12">
|
||||
<select class="form-control" name="category">
|
||||
<select class="form-control" name="categoryId">
|
||||
<option value="">@lang('admin/contents.noCategory')</option>
|
||||
@foreach($categories as $category)
|
||||
<option value="{{$category->id}}"
|
||||
@if($category->id == old('category', $page->category_id)) selected @endif>
|
||||
@if($category->id == old('categoryId', $page->categoryId)) selected @endif>
|
||||
{{str_repeat(' - ', $category->real_depth)}} {{$category->name}}
|
||||
</option>
|
||||
@endforeach
|
||||
@@ -77,26 +77,26 @@
|
||||
@lang('contactform::admin/content.email')
|
||||
</label>
|
||||
|
||||
<input class="form-control" type="email" name="email" value="{{$page->module_settings->email or ""}}" />
|
||||
<input class="form-control" type="email" name="email" value="{{$page->moduleSettings->email or ""}}" />
|
||||
|
||||
<label class="label-control">
|
||||
@lang('contactform::admin/content.phone')
|
||||
</label>
|
||||
|
||||
<input class="form-control" type="tel" name="phone" value="{{$page->module_settings->phone or ""}}" />
|
||||
<input class="form-control" type="tel" name="phone" value="{{$page->moduleSettings->phone or ""}}" />
|
||||
|
||||
<label class="label-control">
|
||||
@lang('contactform::admin/content.compName')
|
||||
</label>
|
||||
|
||||
<input class="form-control" type="text" name="companyName"
|
||||
value="{{$page->module_settings->companyName or ""}}" />
|
||||
value="{{$page->moduleSettings->companyName or ""}}" />
|
||||
|
||||
<label class="label-control">
|
||||
@lang('contactform::admin/content.address')
|
||||
</label>
|
||||
|
||||
<textarea rows="3" class="form-control" name="address">{{$page->module_settings->address or ""}}</textarea>
|
||||
<textarea rows="3" class="form-control" name="address">{{$page->moduleSettings->address or ""}}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="column col-lg-6">
|
||||
@@ -105,14 +105,14 @@
|
||||
</label>
|
||||
|
||||
<input class="form-control" type="email" name="contactEmail"
|
||||
value="{{$page->module_settings->contactEmail or \Auth::user()->email}}" />
|
||||
value="{{$page->moduleSettings->contactEmail or \Auth::user()->email}}" />
|
||||
|
||||
<label class="label-control">
|
||||
@lang('contactform::admin/content.subject')
|
||||
</label>
|
||||
|
||||
<input class="form-control" type="text" name="subject"
|
||||
value="{{$page->module_settings->subject or trans('contactform::admin/content.defaultSubject')}}" />
|
||||
value="{{$page->moduleSettings->subject or trans('contactform::admin/content.defaultSubject')}}" />
|
||||
|
||||
<div class="row">
|
||||
<div class="column col-lg-6">
|
||||
@@ -120,7 +120,7 @@
|
||||
@lang('contactform::admin/content.gpsLat')
|
||||
</label>
|
||||
|
||||
<input class="form-control" type="text" value="{{$page->module_settings->gpsLat or ""}}"
|
||||
<input class="form-control" type="text" value="{{$page->moduleSettings->gpsLat or ""}}"
|
||||
name="gpsLat" />
|
||||
</div>
|
||||
<div class="column col-lg-6">
|
||||
@@ -128,7 +128,7 @@
|
||||
@lang('contactform::admin/content.gpsLng')
|
||||
</label>
|
||||
|
||||
<input class="form-control" type="text" value="{{$page->module_settings->gpsLng or ""}}"
|
||||
<input class="form-control" type="text" value="{{$page->moduleSettings->gpsLng or ""}}"
|
||||
name="gpsLng" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -24,7 +24,7 @@ class Presenter implements WidgetRenderer
|
||||
if (!$form)
|
||||
return null;
|
||||
|
||||
$formData = json_decode($form->module_settings);
|
||||
$formData = json_decode($form->moduleSettings);
|
||||
|
||||
$code = '<div class="address-widget ' . e($widget->container_class) . '"';
|
||||
if ($widget->container_id) {
|
||||
@@ -47,7 +47,7 @@ class Presenter implements WidgetRenderer
|
||||
*/
|
||||
public static function renderAddForm(WidgetType $type)
|
||||
{
|
||||
$contactForms = Content::where('module_handler', config('contactform.handler'))
|
||||
$contactForms = Content::where('moduleHandler', config('contactform.handler'))
|
||||
->get();
|
||||
|
||||
return view('contactform::admin.widgets.address.new', [
|
||||
@@ -66,7 +66,7 @@ class Presenter implements WidgetRenderer
|
||||
*/
|
||||
public static function renderEditForm(Widget $widget)
|
||||
{
|
||||
$contactForms = Content::where('module_handler', config('contactform.handler'))
|
||||
$contactForms = Content::where('moduleHandler', config('contactform.handler'))
|
||||
->get();
|
||||
return view('contactform::admin.widgets.address.edit', [
|
||||
'widget' => $widget,
|
||||
|
||||
@@ -32,7 +32,7 @@ class Presenter implements WidgetRenderer
|
||||
return null;
|
||||
}
|
||||
|
||||
$form->module_settings = json_decode($form->module_settings);
|
||||
$form->moduleSettings = json_decode($form->moduleSettings);
|
||||
|
||||
return view(self::$template, ['widget' => $widget, 'form' => $form]);
|
||||
}
|
||||
@@ -46,7 +46,7 @@ class Presenter implements WidgetRenderer
|
||||
*/
|
||||
public static function renderAddForm(WidgetType $type)
|
||||
{
|
||||
$contactForms = Content::where('module_handler', config('contactform.handler'))
|
||||
$contactForms = Content::where('moduleHandler', config('contactform.handler'))
|
||||
->get();
|
||||
|
||||
return view('contactform::admin.widgets.form.new', [
|
||||
@@ -65,7 +65,7 @@ class Presenter implements WidgetRenderer
|
||||
*/
|
||||
public static function renderEditForm(Widget $widget)
|
||||
{
|
||||
$contactForms = Content::where('module_handler', config('contactform.handler'))
|
||||
$contactForms = Content::where('moduleHandler', config('contactform.handler'))
|
||||
->get();
|
||||
return view('contactform::admin.widgets.address.edit', [
|
||||
'widget' => $widget,
|
||||
|
||||
Reference in New Issue
Block a user