From c13c41d6f07044fc6e3f09239b4e18554458f3e1 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 25 Mar 2017 13:06:55 +0800 Subject: [PATCH] add remove button in rpc setting tab, modify rpc setting tab style --- src/langs/zh_CN.txt | 2 +- src/scripts/config/defaultLanguage.js | 2 +- src/scripts/controllers/settings-ariang.js | 8 +++++++- src/scripts/services/ariaNgCommonService.js | 4 ++-- src/styles/core/extend.css | 16 ++++++++++++++++ src/styles/theme/default.css | 10 ++++++++++ src/views/settings-ariang.html | 12 +++++++----- 7 files changed, 44 insertions(+), 10 deletions(-) diff --git a/src/langs/zh_CN.txt b/src/langs/zh_CN.txt index 7814947..596e7b5 100644 --- a/src/langs/zh_CN.txt +++ b/src/langs/zh_CN.txt @@ -138,7 +138,7 @@ Aria2 RPC Address=Aria2 RPC 地址 Set Default=设为默认 Delete RPC Setting=删除 RPC 设置 Add New RPC Setting=添加新 RPC 配置 -Are you sure you want to remove this rpc setting?=您是否要删除当前 RPC 设置? +Are you sure you want to remove rpc setting "{{rpcName}}"?=您是否要删除 RPC 设置 "{{rpcName}}"? Global Stat Refresh Interval=全局状态刷新间隔 Download Task Refresh Interval=下载任务刷新间隔 Supported Placeholder=支持的占位符 diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index 9d9bf7e..f8d29ae 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -142,7 +142,7 @@ 'Set Default': 'Set Default', 'Delete RPC Setting': 'Delete RPC Setting', 'Add New RPC Setting': 'Add New RPC Setting', - 'Are you sure you want to remove this rpc setting?': 'Are you sure you want to remove this rpc setting?', + 'Are you sure you want to remove rpc setting "{{rpcName}}"?': 'Are you sure you want to remove rpc setting "{{rpcName}}"?', 'Global Stat Refresh Interval': 'Global Stat Refresh Interval', 'Download Task Refresh Interval': 'Download Task Refresh Interval', 'Supported Placeholder': 'Supported Placeholder', diff --git a/src/scripts/controllers/settings-ariang.js b/src/scripts/controllers/settings-ariang.js index 08a126a..5126909 100644 --- a/src/scripts/controllers/settings-ariang.js +++ b/src/scripts/controllers/settings-ariang.js @@ -129,7 +129,9 @@ }; $scope.removeRpcSetting = function (setting) { - ariaNgCommonService.confirm('Confirm Remove', 'Are you sure you want to remove this rpc setting?', 'warning', function () { + var rpcName = (setting.rpcAlias ? setting.rpcAlias : setting.rpcHost + ':' + setting.rpcPort); + + ariaNgCommonService.confirm('Confirm Remove', 'Are you sure you want to remove rpc setting "{{rpcName}}"?', 'warning', function () { var index = $scope.context.rpcSettings.indexOf(setting); ariaNgSettingService.removeRpcSetting(setting); $scope.context.rpcSettings.splice(index, 1); @@ -137,6 +139,10 @@ if (index >= $scope.context.rpcSettings.length) { $scope.changeRpcTab($scope.context.rpcSettings.length - 1); } + }, false, { + textParams: { + rpcName: rpcName + } }); }; diff --git a/src/scripts/services/ariaNgCommonService.js b/src/scripts/services/ariaNgCommonService.js index 657fe32..67d718f 100644 --- a/src/scripts/services/ariaNgCommonService.js +++ b/src/scripts/services/ariaNgCommonService.js @@ -25,10 +25,10 @@ showOperationSucceeded: function (text) { this.showDialog('Operation Succeeded', text, 'success'); }, - confirm: function (title, text, type, callback, notClose) { + confirm: function (title, text, type, callback, notClose, extendSettings) { var options = { title: $translate.instant(title), - text: $translate.instant(text), + text: $translate.instant(text, (extendSettings !== null ? extendSettings.textParams : null)), type: type, showCancelButton: true, showLoaderOnConfirm: !!notClose, diff --git a/src/styles/core/extend.css b/src/styles/core/extend.css index 6707d15..1762143 100644 --- a/src/styles/core/extend.css +++ b/src/styles/core/extend.css @@ -3,6 +3,22 @@ padding: 0 4px 0 4px; } +.nav-tabs-custom .nav-tabs > li > a { + display: inline-block; +} + +.nav-tabs-custom .nav-tabs > li > a.nav-tab-close { + padding-left: 0; + margin-left: -12px; +} + +.nav-tabs-custom .nav-tabs > li.nav-tab-title-rpcname > a { + max-width: 180px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + /* font-awesome extend */ .fa-half { font-size: 0.5em; diff --git a/src/styles/theme/default.css b/src/styles/theme/default.css index fb0b318..2ef674b 100644 --- a/src/styles/theme/default.css +++ b/src/styles/theme/default.css @@ -343,6 +343,16 @@ color: #208fe5; } +.skin-aria-ng .nav-tabs-custom > .nav-tabs > li > a.nav-tab-close:hover { + color: #dd4b39 !important; + margin-left: -14px; +} + +.skin-aria-ng .nav-tabs-custom > .nav-tabs > li > a.nav-tab-close:hover > .fa-times:before { + content:"\f057"; /* The same as .fa-times-circle:before */ + font-size: 1.1em; +} + .skin-aria-ng .nav-tabs-custom > .nav-tabs > li > div.btn-group { padding-top: 5px; padding-bottom: 5px; diff --git a/src/views/settings-ariang.html b/src/views/settings-ariang.html index 4ff5786..acd0a59 100644 --- a/src/views/settings-ariang.html +++ b/src/views/settings-ariang.html @@ -4,8 +4,13 @@
  • Global
  • -
  • - RPC +
  • @@ -212,9 +217,6 @@ -