[extensions-web] js: Only show the first line of the description in the list view
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] js: Only show the first line of the description in the list view
- Date: Mon, 2 Apr 2012 01:43:58 +0000 (UTC)
commit 69ad86823e9c613086313afd168183ce3155a047
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sun Apr 1 21:42:36 2012 -0400
js: Only show the first line of the description in the list view
sweettooth/static/js/extensions.js | 2 ++
sweettooth/static/js/paginator.js | 6 +++++-
.../js/templates/extensions/info_contents.mustache | 2 +-
sweettooth/static/js/templates/templatedata.js | 2 +-
4 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index 6b350e8..4311f69 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -232,6 +232,8 @@ function($, messages, dbusProxy, extensionUtils, templates) {
function renderExtension() {
extension.want_uninstall = true;
+ if (extension.description)
+ extension.first_line_of_description = extension.description.split('\n')[0];
$elem = $(templates.extensions.info(extension)).replaceAll($elem);
$elem.find('.uninstall').on('click', uninstall);
diff --git a/sweettooth/static/js/paginator.js b/sweettooth/static/js/paginator.js
index e5b5aaa..34ef863 100644
--- a/sweettooth/static/js/paginator.js
+++ b/sweettooth/static/js/paginator.js
@@ -54,9 +54,13 @@ define(['jquery', 'hashParamUtils', 'paginatorUtils', 'dbus!_', 'templates', 'jq
$afterPaginator = $paginator.clone().addClass('after-paginator');
$paginator.empty();
- // Serialize out the svm as we want it to be JSON in the data attribute.
$.each(result.extensions, function() {
+ // Serialize out the svm as we want it to be JSON
+ // in the data attribute.
this.shell_version_map = JSON.stringify(this.shell_version_map);
+
+ if (this.description)
+ this.first_line_of_description = this.description.split('\n')[0];
});
var $newContent = $(templates.extensions.info_list(result));
diff --git a/sweettooth/static/js/templates/extensions/info_contents.mustache b/sweettooth/static/js/templates/extensions/info_contents.mustache
index d574876..ac889ca 100644
--- a/sweettooth/static/js/templates/extensions/info_contents.mustache
+++ b/sweettooth/static/js/templates/extensions/info_contents.mustache
@@ -13,7 +13,7 @@
<span class="author">by <a href="{{creator_url}}"> {{creator}} </a></span>
{{/creator}}
<p class="description">
- {{description}}
+ {{first_line_of_description}}
</p>
{{#want_uninstall}}
<button class="uninstall" title="Uninstall">Uninstall</button>
diff --git a/sweettooth/static/js/templates/templatedata.js b/sweettooth/static/js/templates/templatedata.js
index 3615891..1af72d0 100644
--- a/sweettooth/static/js/templates/templatedata.js
+++ b/sweettooth/static/js/templates/templatedata.js
@@ -5,7 +5,7 @@ define({
"extensions": {
"error_report_template": "What's wrong?\n\n\n\nWhat have you tried?\n\n\n\nAutomatically detected errors:\n\n{{#errors}}\n {{.}}\n\n================\n{{/errors}}\n{{^errors}}\nGNOME Shell Extensions did not detect any errors with this extension.\n{{/errors}}\n\nVersion information:\n\n Shell version: {{sv}}\n Extension version: {{#ev}}{{ev}}{{/ev}}{{^ev}}Unknown{{/ev}}",
"info": "<div class=\"extension\" data-uuid=\"{{uuid}}\">\n {{>extensions.info_contents}}\n</div>",
- "info_contents": "<div class=\"switch\"></div>\n<div class=\"configure-button\"></div>\n<img class=\"icon\" src=\"{{icon}}\">\n<h3 class=\"extension-name\">\n {{#link}}\n <a href=\"{{link}}\" class=\"title-link\"> <img src=\"{{icon}}\" class=\"icon\"> {{name}} </a>\n {{/link}}\n {{^link}}\n {{name}}\n {{/link}}\n</h3>\n{{#creator}}\n <span class=\"author\">by <a href=\"{{creator_url}}\"> {{creator}} </a></span>\n{{/creator}}\n<p class=\"description\">\n {{description}}\n</p>\n{{#want_uninstall}}\n <button class=\"uninstall\" title=\"Uninstall\">Uninstall</button>\n{{/want_uninstall}}",
+ "info_contents": "<div class=\"switch\"></div>\n<div class=\"configure-button\"></div>\n<img class=\"icon\" src=\"{{icon}}\">\n<h3 class=\"extension-name\">\n {{#link}}\n <a href=\"{{link}}\" class=\"title-link\"> <img src=\"{{icon}}\" class=\"icon\"> {{name}} </a>\n {{/link}}\n {{^link}}\n {{name}}\n {{/link}}\n</h3>\n{{#creator}}\n <span class=\"author\">by <a href=\"{{creator_url}}\"> {{creator}} </a></span>\n{{/creator}}\n<p class=\"description\">\n {{first_line_of_description}}\n</p>\n{{#want_uninstall}}\n <button class=\"uninstall\" title=\"Uninstall\">Uninstall</button>\n{{/want_uninstall}}",
"info_list": "<ul class=\"extensions\">\n{{#extensions}}\n <li class=\"extension\" data-svm=\"{{shell_version_map}}\">\n {{>extensions.info_contents}}\n </li>\n{{/extensions}}\n</ul>",
"uninstall": "You uninstalled <b>{{name}}. <a href=\"#\">Undo?</a>"
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]