|
@@ -246,10 +246,20 @@
|
|
|
</div>--}}
|
|
|
@foreach($note->sections as $section)
|
|
|
<div class="p-3 border-bottom note-section">
|
|
|
- <a class="font-weight-bold mb-2 d-flex align-items-center c-pointer edit-trigger">
|
|
|
- {{$section->sectionTemplate->title}}
|
|
|
- <span class="d-none if-not-edit"><i class="fa fa-edit ml-2"></i></span>
|
|
|
- </a>
|
|
|
+ <div class="d-flex align-items-start">
|
|
|
+ <a class="font-weight-bold mb-2 d-flex align-items-center c-pointer edit-trigger">
|
|
|
+ {{$section->sectionTemplate->title}}
|
|
|
+ <span class="d-none if-not-edit"><i class="fa fa-edit ml-2"></i></span>
|
|
|
+ </a>
|
|
|
+ <?php
|
|
|
+ if(file_exists(storage_path('sections/'.$section->sectionTemplate->internal_name.'/templates.json'))) {
|
|
|
+ echo '<span class="position-relative d-none if-edit ml-3">' .
|
|
|
+ '<a href="#" class="note-templates-trigger">Templates</a>';
|
|
|
+ renderNoteTemplates(storage_path('sections/'.$section->sectionTemplate->internal_name.'/templates.json'));
|
|
|
+ echo '</span>';
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </div>
|
|
|
<div class="d-none if-not-edit inset-comment">{!! !empty($section->summary_html) ? $section->summary_html : '-' !!}</div>
|
|
|
<div class="d-none if-edit">@include('sections/'.$section->sectionTemplate->internal_name.'/form')</div>
|
|
|
</div>
|
|
@@ -374,6 +384,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div class="note-templates-underlay"></div>
|
|
|
<script>
|
|
|
(function() {
|
|
|
function init() {
|
|
@@ -434,18 +445,34 @@
|
|
|
$('.edit-trigger')
|
|
|
.off('click.edit-trigger')
|
|
|
.on('click.edit-trigger', function() {
|
|
|
- $(this).parent().toggleClass('edit');
|
|
|
- if($(this).parent().is('.edit')) {
|
|
|
- $(this).parent().siblings('.edit').removeClass('edit');
|
|
|
- if($(this).parent().find('[contenteditable]').length) {
|
|
|
- $(this).parent().find('[contenteditable]').first().focus();
|
|
|
+ let editParent = $(this).closest('.note-section');
|
|
|
+ editParent.toggleClass('edit');
|
|
|
+ if(editParent.is('.edit')) {
|
|
|
+ editParent.siblings('.edit').removeClass('edit');
|
|
|
+ if(editParent.find('[contenteditable]').length) {
|
|
|
+ editParent.find('[contenteditable]').first().focus();
|
|
|
}
|
|
|
else {
|
|
|
- $(this).parent().find('textarea:visible').first().focus();
|
|
|
+ editParent.find('textarea:visible').first().focus();
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
- })
|
|
|
+ });
|
|
|
+
|
|
|
+ $('.note-templates-trigger')
|
|
|
+ .off('click.note-templates-trigger')
|
|
|
+ .on('click.note-templates-trigger', function() {
|
|
|
+ $('.note-templates-underlay').show();
|
|
|
+ $(this).closest('.note-section').find('.note-template-container').show();
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+
|
|
|
+ $('.note-templates-underlay')
|
|
|
+ .off('click.note-templates-underlay')
|
|
|
+ .on('click.note-templates-underlay', function() {
|
|
|
+ $(this).hide();
|
|
|
+ $('.note-template-container').hide();
|
|
|
+ });
|
|
|
}
|
|
|
addMCInitializer('note-single', init);
|
|
|
})();
|