From 5664b269ad3bf0a5cfb52e21f16e8728563563fc Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Fri, 25 Oct 2013 14:35:18 +0100 Subject: [PATCH] Auto-generate 'thumbnail' previews of themes in settings applet --- client/assets/src/app.js | 2 +- client/assets/src/applets/settings.js | 40 ++++++------ client/assets/src/index.html.tmpl | 26 +++----- client/assets/src/themes/basic/theme.json | 4 ++ client/assets/src/themes/cli/theme.json | 4 ++ client/assets/src/themes/mini/theme.json | 4 ++ client/assets/src/themes/relaxed/theme.json | 4 ++ server/httphandler.js | 67 ++++++++++++++++----- 8 files changed, 101 insertions(+), 50 deletions(-) create mode 100644 client/assets/src/themes/basic/theme.json create mode 100644 client/assets/src/themes/cli/theme.json create mode 100644 client/assets/src/themes/mini/theme.json create mode 100644 client/assets/src/themes/relaxed/theme.json diff --git a/client/assets/src/app.js b/client/assets/src/app.js index 7002e0b..d70e0ab 100644 --- a/client/assets/src/app.js +++ b/client/assets/src/app.js @@ -116,7 +116,7 @@ _kiwi.global = { if (opts.server_settings.client.themes) { _.each(opts.server_settings.client.themes, function (theme) { - link = $.parseHTML(''); + link = $.parseHTML(''); link.disabled = true; $(link).appendTo($('head')); }); diff --git a/client/assets/src/applets/settings.js b/client/assets/src/applets/settings.js index 32bf855..6fb7cb1 100644 --- a/client/assets/src/applets/settings.js +++ b/client/assets/src/applets/settings.js @@ -8,24 +8,28 @@ }, initialize: function (options) { - var text = { - tabs: _kiwi.global.i18n.translate('client_applets_settings_channelview_tabs').fetch(), - list: _kiwi.global.i18n.translate('client_applets_settings_channelview_list').fetch(), - large_amounts_of_chans: _kiwi.global.i18n.translate('client_applets_settings_channelview_list_notice').fetch(), - join_part: _kiwi.global.i18n.translate('client_applets_settings_notification_joinpart').fetch(), - timestamps: _kiwi.global.i18n.translate('client_applets_settings_timestamp').fetch(), - mute: _kiwi.global.i18n.translate('client_applets_settings_notification_sound').fetch(), - emoticons: _kiwi.global.i18n.translate('client_applets_settings_emoticons').fetch(), - scroll_history: _kiwi.global.i18n.translate('client_applets_settings_history_length').fetch(), - languages: _kiwi.app.translations, - default_client: _kiwi.global.i18n.translate('client_applets_settings_default_client').fetch(), - make_default: _kiwi.global.i18n.translate('client_applets_settings_default_client_enable').fetch(), - locale_restart_needed: _kiwi.global.i18n.translate('client_applets_settings_locale_restart_needed').fetch(), - default_note: _kiwi.global.i18n.translate('client_applets_settings_default_client_notice').fetch('chrome://settings/handlers'), - html5_notifications: _kiwi.global.i18n.translate('client_applets_settings_html5_notifications').fetch(), - enable_notifications: _kiwi.global.i18n.translate('client_applets_settings_enable_notifications').fetch() - }; - this.$el = $(_.template($('#tmpl_applet_settings').html().trim(), text)); + var template_vars = { + tabs: _kiwi.global.i18n.translate('client_applets_settings_channelview_tabs').fetch(), + list: _kiwi.global.i18n.translate('client_applets_settings_channelview_list').fetch(), + large_amounts_of_chans: _kiwi.global.i18n.translate('client_applets_settings_channelview_list_notice').fetch(), + join_part: _kiwi.global.i18n.translate('client_applets_settings_notification_joinpart').fetch(), + timestamps: _kiwi.global.i18n.translate('client_applets_settings_timestamp').fetch(), + mute: _kiwi.global.i18n.translate('client_applets_settings_notification_sound').fetch(), + emoticons: _kiwi.global.i18n.translate('client_applets_settings_emoticons').fetch(), + scroll_history: _kiwi.global.i18n.translate('client_applets_settings_history_length').fetch(), + languages: _kiwi.app.translations, + default_client: _kiwi.global.i18n.translate('client_applets_settings_default_client').fetch(), + make_default: _kiwi.global.i18n.translate('client_applets_settings_default_client_enable').fetch(), + locale_restart_needed: _kiwi.global.i18n.translate('client_applets_settings_locale_restart_needed').fetch(), + default_note: _kiwi.global.i18n.translate('client_applets_settings_default_client_notice').fetch('chrome://settings/handlers'), + html5_notifications: _kiwi.global.i18n.translate('client_applets_settings_html5_notifications').fetch(), + enable_notifications: _kiwi.global.i18n.translate('client_applets_settings_enable_notifications').fetch(), + theme_thumbnails: _.map(_kiwi.app.server_settings.client.themes, function (theme) { + return _.template($('#tmpl_theme_thumbnail').html().trim(), theme); + }) + }; + + this.$el = $(_.template($('#tmpl_applet_settings').html().trim(), template_vars)); if (!navigator.registerProtocolHandler) { this.$el.find('.protocol_handler').remove(); diff --git a/client/assets/src/index.html.tmpl b/client/assets/src/index.html.tmpl index 61c6efc..ba206e4 100644 --- a/client/assets/src/index.html.tmpl +++ b/client/assets/src/index.html.tmpl @@ -173,28 +173,22 @@ + +