1
0
mirror of https://github.com/adobe/brackets.git synced 2024-11-20 09:53:00 +01:00

Adding protocol badge to remote files (#14330)

* Using as class provider to add protocol badges to files in Working set view and recent files list

* Fixing UI issues

* Removing explicit removal of classes, as it causes valid classes to be removed. jquery addClass already has this check

* Show badge even if file extension not present
This commit is contained in:
Shubham Yadav 2018-05-15 18:05:59 +05:30 committed by Swagatam Mitra
parent 64ffb198f5
commit a813265d14
3 changed files with 39 additions and 2 deletions

View File

@ -30,13 +30,28 @@ define(function (require, exports, module) {
PathUtils = brackets.getModule("thirdparty/path-utils/path-utils"),
CommandManager = brackets.getModule("command/CommandManager"),
Commands = brackets.getModule("command/Commands"),
Menus = brackets.getModule("command/Menus"),
ExtensionUtils = brackets.getModule("utils/ExtensionUtils"),
WorkingSetView = brackets.getModule("project/WorkingSetView"),
Menus = brackets.getModule("command/Menus"),
RemoteFile = require("RemoteFile");
var HTTP_PROTOCOL = "http:",
HTTPS_PROTOCOL = "https:";
ExtensionUtils.loadStyleSheet(module, "styles.css");
function protocolClassProvider(data) {
if (data.fullPath.startsWith("http://")) {
return "http";
}
if (data.fullPath.startsWith("https://")) {
return "https";
}
return "";
}
/**
* Disable context menus which are not useful for remote file
*/
@ -89,6 +104,8 @@ define(function (require, exports, module) {
}
}
);
WorkingSetView.addClassProvider(protocolClassProvider);
});
});

View File

@ -0,0 +1,21 @@
.http a:after,
.https a:after {
margin-left: 5px;
border: 1px solid;
border-radius: 2px;
padding: 0px 5px;
font-size: 11px;
color: #adb9bd;
}
.http a:after {
content: "http";
}
.https a:after {
content: "https";
}

View File

@ -1120,7 +1120,6 @@ define(function (require, exports, module) {
data = {fullPath: file.fullPath,
name: file.name,
isFile: file.isFile};
$li.removeAttr("class");
_classProviders.forEach(function (provider) {
$li.addClass(provider(data));
});