View | Details | Raw Unified | Return to bug 36815
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (+50 lines)
Lines 132-137 Link Here
132
        </div> <!-- /.modal-dialog -->
132
        </div> <!-- /.modal-dialog -->
133
    </div> <!-- /#preview_template -->
133
    </div> <!-- /#preview_template -->
134
134
135
    <!-- Sample display modal -->
136
    <div class="modal" id="noticeSampleModal" tabindex="-1" aria-labelledby="noticeSampleModalLabel" aria-hidden="true">
137
        <div class="modal-dialog modal-lg">
138
            <div class="modal-content">
139
                <div class="modal-header">
140
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
141
                        <span aria-hidden="true">&times;</span>
142
                    </button>
143
                    <h3 class="modal-title" id="noticeSampleModalLabel">Default template</h3>
144
                </div>
145
                <div class="modal-body">
146
                    <pre class="template-body"></pre>
147
                </div>
148
                <div class="modal-footer">
149
                    <button type="button" class="btn btn-primary copy">Copy to template</button>
150
                    <button type="button" class="btn btn-default deny cancel" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
151
                </div>
152
            </div> <!-- /.modal-content -->
153
        </div> <!-- /.modal-dialog -->
154
    </div> <!-- /.modal -->
155
135
    [% IF add_form or copy_form %]
156
    [% IF add_form or copy_form %]
136
        <div class="main container-fluid">
157
        <div class="main container-fluid">
137
            <div class="row">
158
            <div class="row">
Lines 673-678 Link Here
673
                                    <a href="/cgi-bin/koha/svc/letters/preview" class="preview_template btn btn-default btn-xs" title="Preview this notice template" data-mtt="[% letter.message_transport_type | html %]" data-lang="[% lang | html %]"><i class="fa-solid fa-eye"></i> Preview</a>
694
                                    <a href="/cgi-bin/koha/svc/letters/preview" class="preview_template btn btn-default btn-xs" title="Preview this notice template" data-mtt="[% letter.message_transport_type | html %]" data-lang="[% lang | html %]"><i class="fa-solid fa-eye"></i> Preview</a>
674
                                </li>
695
                                </li>
675
                            [% END %]
696
                            [% END %]
697
                            [% IF letter.sample %]
698
                            <li>
699
                                <button data-noticeid="[% letter.id | html %]" data-replace="content_[% letter.message_transport_type | html %]_[% lang | html %]" class="notice-sample btn btn-default btn-sm"><i class="fa-solid fa-eye"></i> View default</button>
700
                                <textarea class="hidden" id="notice[% letter.id | html %]">[% letter.sample | html %]</textarea>
701
                            </li>
702
                            [% END %]
676
                        </ol>
703
                        </ol>
677
                    </fieldset> <!-- /.rows.mtt -->
704
                    </fieldset> <!-- /.rows.mtt -->
678
                [% END %]
705
                [% END %]
Lines 761-766 Link Here
761
                    '}';
788
                    '}';
762
                });
789
                });
763
            });
790
            });
791
792
            $(".notice-sample").on("click", function(e){
793
                e.preventDefault();
794
                var noticeid = $(this).data("noticeid");
795
                var replaceid = $(this).data("replace");
796
                var body = $("#notice" + noticeid ).val();
797
                $("#noticeSampleModal .template-body").text(body);
798
                $("#noticeSampleModal").attr("data-replaceid", replaceid);
799
                $("#noticeSampleModal").modal("show");
800
            });
801
802
            $("#noticeSampleModal").on("hide.bs.modal", function(){
803
                $("#noticeSampleModalLabel").text("");
804
                $("#noticeSampleModal .template-body").text("");
805
                $("#noticeSampleModal").attr("data-replaceid", '');
806
            });
807
808
            $("#noticeSampleModal").on("click", ".copy", function(){
809
                var content = $('#noticeSampleModal .template-body').text();
810
                var replaceid = $('#noticeSampleModal').data('replaceid');
811
                $('#'+replaceid).val(content);
812
                $('#noticeSampleModal').modal('hide');
813
            });
764
        });
814
        });
765
     </script>
815
     </script>
766
    [% Asset.js("js/letter.js") | $raw %]
816
    [% Asset.js("js/letter.js") | $raw %]
(-)a/tools/letter.pl (-1 / +4 lines)
Lines 227-232 sub add_form { Link Here
227
                tt_error   => $letter->{tt_error},
227
                tt_error   => $letter->{tt_error},
228
            };
228
            };
229
            $letters{ $lang }{params} = $letter;
229
            $letters{ $lang }{params} = $letter;
230
231
            my $object = Koha::Notice::Templates->find( { id => $letter->{id} } );
232
            $letters{ $lang }{templates}{$mtt}{sample} = $object->get_default;
233
            $letters{ $lang }{templates}{$mtt}{id} = $letter->{id};
230
        }
234
        }
231
    }
235
    }
232
    else {
236
    else {
233
- 

Return to bug 36815