1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Added Quill to email signature

This commit is contained in:
Hillel Coren 2015-11-05 12:02:14 +02:00
parent e18ae1aac0
commit 0953fbe7cd
3 changed files with 80 additions and 37 deletions

View File

@ -1,5 +1,12 @@
@extends('header')
@section('head')
@parent
<link href="{{ asset('css/quill.snow.css') }}" rel="stylesheet" type="text/css"/>
<script src="{{ asset('js/quill.min.js') }}" type="text/javascript"></script>
@stop
@section('content')
@parent
@ -28,24 +35,24 @@
</div>
<div class="panel-body form-padding-right">
{!! Former::text('name') !!}
{!! Former::text('id_number') !!}
{!! Former::text('vat_number') !!}
{!! Former::text('work_email') !!}
{!! Former::text('work_phone') !!}
{!! Former::textarea('email_footer')->label(trans('texts.signature'))->rows(4) !!}
{!! Former::file('logo')->max(2, 'MB')->accept('image')->inlineHelp(trans('texts.logo_help')) !!}
{!! Former::text('name') !!}
{!! Former::text('id_number') !!}
{!! Former::text('vat_number') !!}
{!! Former::text('work_email') !!}
{!! Former::text('work_phone') !!}
{!! Former::file('logo')->max(2, 'MB')->accept('image')->inlineHelp(trans('texts.logo_help')) !!}
@if ($account->hasLogo())
<center>
{!! HTML::image($account->getLogoPath().'?no_cache='.time(), 'Logo', ['width' => 200]) !!} &nbsp;
<a href="#" onclick="deleteLogo()">{{ trans('texts.remove_logo') }}</a>
</center><br/>
@endif
@if ($account->hasLogo())
<center>
{!! HTML::image($account->getLogoPath().'?no_cache='.time(), 'Logo', ['width' => 200]) !!} &nbsp;
<a href="#" onclick="deleteLogo()">{{ trans('texts.remove_logo') }}</a>
</center><br/>
@endif
{!! Former::select('size_id')->addOption('','')->fromQuery($sizes, 'name', 'id') !!}
{!! Former::select('industry_id')->addOption('','')->fromQuery($industries, 'name', 'id') !!}
{!! Former::select('size_id')->addOption('','')->fromQuery($sizes, 'name', 'id') !!}
{!! Former::select('industry_id')->addOption('','')->fromQuery($industries, 'name', 'id') !!}
</div>
</div>
@ -55,18 +62,33 @@
</div>
<div class="panel-body form-padding-right">
{!! Former::text('address1') !!}
{!! Former::text('address2') !!}
{!! Former::text('city') !!}
{!! Former::text('state') !!}
{!! Former::text('postal_code') !!}
{!! Former::select('country_id')->addOption('','')
->fromQuery($countries, 'name', 'id') !!}
{!! Former::text('address1') !!}
{!! Former::text('address2') !!}
{!! Former::text('city') !!}
{!! Former::text('state') !!}
{!! Former::text('postal_code') !!}
{!! Former::select('country_id')->addOption('','')
->fromQuery($countries, 'name', 'id') !!}
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.signature') !!}</h3>
</div>
<div class="panel-body">
<div class="col-md-10 col-md-offset-1">
{!! Former::textarea('email_footer')->style('display:none')->raw() !!}
<div id="signatureEditor" class="form-control" style="min-height:160px" onclick="focusEditor()"></div>
@include('partials/quill_toolbar', ['name' => 'signature'])
</div>
</div>
</div>
</div>
</div>
@ -82,15 +104,37 @@
<script type="text/javascript">
$(function() {
$('#country_id').combobox();
});
function deleteLogo() {
if (confirm("{!! trans('texts.are_you_sure') !!}")) {
$('.removeLogoForm').submit();
}
}
var editor = false;
$(function() {
$('#country_id').combobox();
editor = new Quill('#signatureEditor', {
modules: {
'toolbar': { container: '#signatureToolbar' },
'link-tooltip': true
},
theme: 'snow'
});
editor.setHTML($('#email_footer').val());
editor.on('text-change', function(delta, source) {
if (source == 'api') {
return;
}
var html = editor.getHTML();
$('#email_footer').val(html);
NINJA.formIsChanged = true;
});
});
function focusEditor() {
editor.focus();
}
function deleteLogo() {
if (confirm("{!! trans('texts.are_you_sure') !!}")) {
$('.removeLogoForm').submit();
}
}
</script>

View File

@ -1,5 +1,5 @@
<div role="tabpanel" class="tab-pane {{ isset($active) && $active ? 'active' : '' }}" id="{{ $field }}">
<div class="panel-body">
<div class="panel-body" style="padding-bottom: 0px">
@if (isset($isReminder) && $isReminder)
<div class="row">
<div class="col-md-6">
@ -65,6 +65,7 @@
var html = editors['{{ $field }}'].getHTML();
$('#email_template_{{ $field }}').val(html);
refreshPreview();
NINJA.formIsChanged = true;
});
editors['{{ $field }}'] = editor;
});

View File

@ -1,6 +1,5 @@
<div class="quill-wrapper">
<div id="toolbar-toolbar" class="toolbar ql-toolbar ql-snow">
<div id="{{ $field }}Toolbar" class="toolbar" style="padding-left: 0px">
<div id="{{ $name }}Toolbar" class="toolbar" style="padding-left: 0px">
<span class="ql-format-group">
<select title="Font" class="ql-font">
<option value="sans-serif" selected="">Sans Serif</option>
@ -116,5 +115,4 @@
<span title="Link" class="ql-format-button ql-link"></span>
</span>
</div>
</div>
</div>