From e708c0363e858e89e704301450a7939cad2b83ad Mon Sep 17 00:00:00 2001
From: gplane <g-plane@hotmail.com>
Date: Sat, 22 Apr 2017 09:17:39 +0800
Subject: [PATCH] Add default value when renaming closet item

---
 resources/assets/src/scripts/user.js    | 3 ++-
 resources/views/vendor/closet-items.tpl | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/resources/assets/src/scripts/user.js b/resources/assets/src/scripts/user.js
index b3138b1d..9ed9685e 100644
--- a/resources/assets/src/scripts/user.js
+++ b/resources/assets/src/scripts/user.js
@@ -81,10 +81,11 @@ function showPlayerTexturePreview(pid) {
     });
 }
 
-function renameClosetItem(tid) {
+function renameClosetItem(tid, oldName) {
     swal({
         title: trans('user.renameClosetItem'),
         input: 'text',
+        inputValue: oldName,
         showCancelButton: true,
         inputValidator: function(value) {
             return new Promise(function(resolve, reject) {
diff --git a/resources/views/vendor/closet-items.tpl b/resources/views/vendor/closet-items.tpl
index 1bbb9dac..6f0f4bf4 100644
--- a/resources/views/vendor/closet-items.tpl
+++ b/resources/views/vendor/closet-items.tpl
@@ -12,7 +12,7 @@
         <span title="{{ trans('user.closet.more') }}" class="more" data-toggle="dropdown" aria-haspopup="true" id="more-button"><i class="fa fa-cog"></i></span>
 
         <ul class="dropup dropdown-menu" aria-labelledby="more-button">
-            <li><a href="javascript:renameClosetItem({{ $item->tid }});">{{ trans('user.closet.rename.title') }}</a></li>
+            <li><a href="javascript:renameClosetItem({{ $item->tid }}, '{{ $item->name }}');">{{ trans('user.closet.rename.title') }}</a></li>
             <li><a href="javascript:removeFromCloset({{ $item->tid }});">{{ trans('user.closet.remove.title') }}</a></li>
             <li><a href="javascript:setAsAvatar({{ $item->tid }});">{{ trans('user.closet.set-avatar') }}</a></li>
         </ul>