FEATURE: add widget with address block

This commit is contained in:
Michal Kváček
2016-10-12 15:12:42 +02:00
parent af4edac469
commit b9d141c4f1
7 changed files with 208 additions and 0 deletions
@@ -0,0 +1,16 @@
<?php
return [
'address' => [
'name' => 'Address block',
'description' => 'Small widget for displaying address saved in selected contact form.',
'new' => 'New address block',
'edit' => 'Editing address block'
],
'form' => [
'name' => 'Contact form',
'description' => 'Display small contact form anywhere on website.',
'new' => 'New contact block widget'
],
'noContactForms' => 'You have not created any contact form. Try to create one before creating this widget.',
'selectContactForm' => 'Select contact form'
];
@@ -0,0 +1,19 @@
@extends('admin.layoutWithNavigation')
@section('pageHeading', @trans('contactform::admin/widgets.address.edit'))
@section('pageDescription', $widget->description)
@section('content')
@if(!count($forms))
<div class="alert alert-warning">@lang('contactform::admin/widgets.noContactForms')</div>
@else
<div class="col-md-10">
@include('contactform::admin.widgets.address.form', ['action' => route('widgets.postEdit', ['id' => $widget->id])])
</div>
<div class="col-md-2">
@widgetPreview($widget)
</div>
@endif
@endsection
@@ -0,0 +1,19 @@
<form action="{{$action}}" method="POST">
@include('admin.widgets.snippets.commonForm')
<label class="label-control">
@lang('contactform::admin/widgets.selectContactForm')
</label>
<select class="form-control" name="contactFormId">
@foreach($forms as $form)
<option @if(old('contactFormId', isset($widget->settings->contactFormId) ? $widget->settings->contactFormId : '') == $form->id) selected @endif value="{{$form->id}}">{{$form->title}}</option>
@endforeach
</select>
<button type="submit" class="btn btn-primary">
@lang('widgets/htmlCode.save')
</button>
</form>
@@ -0,0 +1,14 @@
@extends('admin.layoutWithNavigation')
@section('pageHeading', @trans('contactform::admin/widgets.address.new'))
@section('pageDescription', @trans($type->description))
@section('content')
@if(!count($forms))
<div class="alert alert-warning">@lang('contactform::admin/widgets.noContactForms')</div>
@else
@include('contactform::admin.widgets.address.form', ['action' => route('widgets.postNew', ['type' => $type])])
@endif
@endsection