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:
parent
64ffb198f5
commit
a813265d14
@ -30,13 +30,28 @@ define(function (require, exports, module) {
|
|||||||
PathUtils = brackets.getModule("thirdparty/path-utils/path-utils"),
|
PathUtils = brackets.getModule("thirdparty/path-utils/path-utils"),
|
||||||
CommandManager = brackets.getModule("command/CommandManager"),
|
CommandManager = brackets.getModule("command/CommandManager"),
|
||||||
Commands = brackets.getModule("command/Commands"),
|
Commands = brackets.getModule("command/Commands"),
|
||||||
Menus = brackets.getModule("command/Menus"),
|
ExtensionUtils = brackets.getModule("utils/ExtensionUtils"),
|
||||||
WorkingSetView = brackets.getModule("project/WorkingSetView"),
|
WorkingSetView = brackets.getModule("project/WorkingSetView"),
|
||||||
|
Menus = brackets.getModule("command/Menus"),
|
||||||
RemoteFile = require("RemoteFile");
|
RemoteFile = require("RemoteFile");
|
||||||
|
|
||||||
var HTTP_PROTOCOL = "http:",
|
var HTTP_PROTOCOL = "http:",
|
||||||
HTTPS_PROTOCOL = "https:";
|
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
|
* Disable context menus which are not useful for remote file
|
||||||
*/
|
*/
|
||||||
@ -89,6 +104,8 @@ define(function (require, exports, module) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
WorkingSetView.addClassProvider(protocolClassProvider);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
21
src/extensions/default/RemoteFileAdapter/styles.css
Normal file
21
src/extensions/default/RemoteFileAdapter/styles.css
Normal 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";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1120,7 +1120,6 @@ define(function (require, exports, module) {
|
|||||||
data = {fullPath: file.fullPath,
|
data = {fullPath: file.fullPath,
|
||||||
name: file.name,
|
name: file.name,
|
||||||
isFile: file.isFile};
|
isFile: file.isFile};
|
||||||
$li.removeAttr("class");
|
|
||||||
_classProviders.forEach(function (provider) {
|
_classProviders.forEach(function (provider) {
|
||||||
$li.addClass(provider(data));
|
$li.addClass(provider(data));
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user