-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Truncate extension descriptions #8282
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ define(function (require, exports, module) { | |
InstallExtensionDialog = require("extensibility/InstallExtensionDialog"), | ||
LocalizationUtils = require("utils/LocalizationUtils"), | ||
itemTemplate = require("text!htmlContent/extension-manager-view-item.html"); | ||
|
||
/** | ||
* Creates a view enabling the user to install and manage extensions. Must be initialized | ||
* with initialize(). When the view is closed, dispose() must be called. | ||
|
@@ -110,7 +110,7 @@ define(function (require, exports, module) { | |
* The individual views for each item, keyed by the extension ID. | ||
*/ | ||
ExtensionManagerView.prototype._itemViews = null; | ||
|
||
/** | ||
* @private | ||
* Attaches our event handlers. We wait to do this until we've fully fetched the extension list. | ||
|
@@ -154,6 +154,10 @@ define(function (require, exports, module) { | |
ExtensionManager.markForRemoval($target.attr("data-extension-id"), true); | ||
} else if ($target.hasClass("undo-update")) { | ||
ExtensionManager.removeUpdate($target.attr("data-extension-id")); | ||
} else if ($target.attr("data-toggle-desc") === "expand-desc") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to let you know, jQuery has a .data() method to get the data attributes, which makes the code look a bit cleaner. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but all the other code in that same if-else-if block uses Also, I can't seem to get There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't saw the use of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alrighty then. I'll leave it as-is. |
||
ExtensionManager.toggleDescription($target.attr("data-extension-id"), $target, true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} else if ($target.attr("data-toggle-desc") === "trunc-desc") { | ||
ExtensionManager.toggleDescription($target.attr("data-extension-id"), $target, false); | ||
} | ||
}) | ||
.on("click", "button.install", function (e) { | ||
|
@@ -206,7 +210,11 @@ define(function (require, exports, module) { | |
// (or registry is offline). These flags *should* always be ignored in that scenario, but just in case... | ||
context.isCompatible = context.isCompatibleLatest = true; | ||
} | ||
|
||
|
||
if (info.metadata.description !== undefined) { | ||
info.metadata.shortdescription = StringUtils.truncate(info.metadata.description, 200); | ||
} | ||
|
||
context.isMarkedForRemoval = ExtensionManager.isMarkedForRemoval(info.metadata.name); | ||
context.isMarkedForUpdate = ExtensionManager.isMarkedForUpdate(info.metadata.name); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,21 +26,25 @@ | |
{{/isCompatibleLatest}} | ||
{{/isCompatible}} | ||
{{/showInstallButton}} | ||
{{metadata.description}} | ||
{{^metadata.description}} | ||
<p class="muted"><em>{{Strings.EXTENSION_NO_DESCRIPTION}}</em></p> | ||
{{/metadata.description}} | ||
<span class="ext-full-description"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I looked up the Mustache syntax, and I think this how all this should work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is fine, but maybe a some indentation will make the code look better like:
|
||
{{#metadata.shortdescription}} | ||
{{metadata.shortdescription}} | ||
{{/metadata.shortdescription}} | ||
{{^metadata.shortdescription}} | ||
{{#metadata.description}} | ||
{{metadata.description}} | ||
{{/metadata.description}} | ||
{{^metadata.description}} | ||
<p class="muted"><em>{{Strings.EXTENSION_NO_DESCRIPTION}}</em></p> | ||
{{/metadata.description}} | ||
{{/metadata.shortdescription}} | ||
</span> | ||
{{#metadata.shortdescription}} | ||
<a data-extension-id="{{metadata.name}}" data-toggle-desc="expand-desc" title="{{Strings.VIEW_COMPLETE_DESCRIPTION}}" href="#">...</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The link must remain outside |
||
{{/metadata.shortdescription}} | ||
{{#metadata.homepage}} | ||
<p><a title="{{metadata.homepage}}" href="{{metadata.homepage}}">{{Strings.EXTENSION_MORE_INFO}}</a></p> | ||
{{/metadata.homepage}} | ||
{{#metadata.keywords.length}} | ||
<br/> | ||
<span class="ext-keywords">{{Strings.EXTENSION_KEYWORDS}}: | ||
{{#metadata.keywords}} | ||
{{.}} | ||
{{/metadata.keywords}} | ||
</span> | ||
{{/metadata.keywords.length}} | ||
{{#translated}} | ||
<br/> | ||
<span class="ext-translated" title="{{translatedLangs}}">{{extensionTranslated}}</span> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's usually one variable per line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use more than one in he first line. JSLint allows you to do that. I often do that so that you don't get lines with just a variable name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was unsure about this, so I checked and just double checked the coding conventions, and I found nothing about single/multiple variables per line. Should I leave it or initialize them as
null
or something?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is fine how it is now. Those are initialized to undefined by JavaScript anyway.