From c18045af41398ea7c0d91911884ae800e663663c Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Tue, 29 Apr 2014 09:38:46 -0500 Subject: [PATCH] notes: Hide new note box when editing a note --- include/staff/templates/notes.tmpl.php | 2 ++ include/staff/templates/user.tmpl.php | 2 ++ scp/css/scp.css | 4 ++++ scp/js/scp.js | 6 ++++-- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/staff/templates/notes.tmpl.php b/include/staff/templates/notes.tmpl.php index 360c519fe..1991c03b7 100644 --- a/include/staff/templates/notes.tmpl.php +++ b/include/staff/templates/notes.tmpl.php @@ -5,8 +5,10 @@ foreach ($notes as $note) { include STAFFINC_DIR."templates/note.tmpl.php"; } ?> </div> +<div id="new-note-box"> <div class="quicknote" id="new-note" data-url="<?php echo $create_note_url; ?>"> <div class="body"> <a href="#"><i class="icon-plus icon-large"></i> Click to create a new note</a> </div> </div> +</div> diff --git a/include/staff/templates/user.tmpl.php b/include/staff/templates/user.tmpl.php index 2aabe3ba5..7fa74fd68 100644 --- a/include/staff/templates/user.tmpl.php +++ b/include/staff/templates/user.tmpl.php @@ -93,6 +93,7 @@ if ($info['error']) { foreach ($notes as $note) include STAFFINC_DIR . 'templates/note.tmpl.php'; ?> +<div id="new-note-box"> <div class="quicknote no-options" id="new-note" data-url="users/<?php echo $user->getId(); ?>/note"> <div class="body"> @@ -100,6 +101,7 @@ foreach ($notes as $note) </div> </div> </div> +</div> </div> <div id="user-form" style="display:<?php echo $forms ? 'block' : 'none'; ?>;"> diff --git a/scp/css/scp.css b/scp/css/scp.css index 416ee3850..ffa7a31f6 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -1718,6 +1718,10 @@ tr.disabled th { background-color: rgba(255, 145, 0, 0.05); border-radius: 3px; } +.quicknote a.action.save-note, +.floating-options a.action.save-note { + background-color: #bbeebb; +} #new-note { margin-top: 10px; } diff --git a/scp/js/scp.js b/scp/js/scp.js index 40e77866d..02cc813c4 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -680,6 +680,7 @@ $('.quicknote .action.edit-note').live('click.note', function() { note.find('.action.edit-note').hide(); note.find('.action.save-note').show(); note.find('.action.cancel-edit').show(); + $('#new-note-box').hide(); return false; }); $('.quicknote .action.cancel-edit').live('click.note', function() { @@ -692,6 +693,7 @@ $('.quicknote .action.cancel-edit').live('click.note', function() { note.find('.action.save-note').hide(); note.find('.action.cancel-edit').hide(); note.find('.action.edit-note').show(); + $('#new-note-box').show(); }); return false; }); @@ -707,6 +709,7 @@ $('.quicknote .action.save-note').live('click.note', function() { note.find('.action.save-note').hide(); note.find('.action.cancel-edit').hide(); note.find('.action.edit-note').show(); + $('#new-note-box').show(); }, 'html' ); @@ -728,7 +731,6 @@ $('.quicknote .delete').live('click.note', function() { }); $('#new-note').live('click', function() { var note = $(this).closest('.quicknote'), - top = note.parent(), T = $('<textarea>'), button = $('<input type="button">').val('Create'); button.click(function() { @@ -736,7 +738,7 @@ $('#new-note').live('click', function() { { note: T.redactor('get'), no_options: note.hasClass('no-options') }, function(response) { $(T).redactor('destroy').replaceWith(note); - $(response).show('highlight').insertBefore(note); + $(response).show('highlight').insertBefore(note.parent()); $('.submit', note.parent()).remove(); }, 'html' -- GitLab