Merge pull request #1033 from chrishunt/move-dynamic-favicon-to-user

Move 'dynamic favicon' setting to User preference
This commit is contained in:
Sam 2013-06-17 17:31:02 -07:00
commit 7abb20928b
14 changed files with 31 additions and 9 deletions

View File

@ -75,7 +75,7 @@ Discourse = Ember.Application.createWithMixins({
$('title').text(title);
var notifyCount = this.get('notifyCount');
if (notifyCount > 0 && !Discourse.SiteSettings.dynamic_favicon) {
if (notifyCount > 0 && !Discourse.User.current('dynamic_favicon')) {
title = "(" + notifyCount + ") " + title;
}
// chrome bug workaround see: http://stackoverflow.com/questions/2952384/changing-the-window-title-when-focussing-the-window-doesnt-work-in-chrome
@ -86,7 +86,7 @@ Discourse = Ember.Application.createWithMixins({
}.observes('title', 'hasFocus', 'notifyCount'),
faviconChanged: function() {
if(Discourse.SiteSettings.dynamic_favicon) {
if(Discourse.User.current('dynamic_favicon')) {
$.faviconNotify(
Discourse.SiteSettings.favicon_url, this.get('notifyCount')
);

View File

@ -153,6 +153,7 @@ Discourse.User = Discourse.Model.extend({
'email_digests',
'email_direct',
'email_private_messages',
'dynamic_favicon',
'digest_after_days',
'new_topic_duration_minutes',
'external_links_in_new_tab',
@ -160,8 +161,12 @@ Discourse.User = Discourse.Model.extend({
type: 'PUT'
}).then(function(data) {
user.set('bio_excerpt',data.user.bio_excerpt);
Discourse.User.current().set('enable_quoting', user.get('enable_quoting'));
Discourse.User.current().set('external_links_in_new_tab', user.get('external_links_in_new_tab'));
_.each([
'enable_quoting', 'external_links_in_new_tab', 'dynamic_favicon'
], function(preference) {
Discourse.User.current().set(preference, user.get(preference));
});
});
},

View File

@ -84,6 +84,16 @@
</div>
</div>
<div class="control-group">
<label class="control-label">{{i18n user.notifications}}</label>
<div class="controls">
<label>
{{view Ember.Checkbox checkedBinding="dynamic_favicon"}}
{{i18n user.dynamic_favicon}}
</label>
</div>
</div>
<div class="control-group other">
<label class="control-label">{{i18n user.other_settings}}</label>
<div class="controls">

View File

@ -51,7 +51,7 @@ class UsersController < ApplicationController
u.new_topic_duration_minutes = params[:new_topic_duration_minutes].to_i if params[:new_topic_duration_minutes]
[:email_digests, :email_direct, :email_private_messages,
:external_links_in_new_tab, :enable_quoting].each do |i|
:external_links_in_new_tab, :enable_quoting, :dynamic_favicon].each do |i|
if params[i].present?
u.send("#{i.to_s}=", params[i] == 'true')
end

View File

@ -79,7 +79,6 @@ class SiteSetting < ActiveRecord::Base
setting(:active_user_rate_limit_secs, 60)
setting(:previous_visit_timeout_hours, 1)
client_setting(:favicon_url, '/assets/default-favicon.ico')
client_setting(:dynamic_favicon, false)
setting(:apple_touch_icon_url, '/assets/default-apple-touch-icon.png')
setting(:ninja_edit_window, 5.minutes.to_i)

View File

@ -12,6 +12,7 @@ class CurrentUserSerializer < BasicUserSerializer
:topic_count,
:enable_quoting,
:external_links_in_new_tab,
:dynamic_favicon,
:trust_level,
:can_edit

View File

@ -48,6 +48,7 @@ class UserSerializer < BasicUserSerializer
:auto_track_topics_after_msecs,
:new_topic_duration_minutes,
:external_links_in_new_tab,
:dynamic_favicon,
:enable_quoting

View File

@ -175,6 +175,7 @@ de:
bio: "Über mich"
invited_by: "Eingeladen von"
trust_level: "Stufe"
dynamic_favicon: "Zeige eingehende Nachrichten im Favicon"
external_links_in_new_tab: "Öffne alle externen Links in neuen Tabs"
enable_quoting: "Markierten Text bei Antwort zitieren"

View File

@ -172,6 +172,8 @@ en:
bio: "About me"
invited_by: "Invited By"
trust_level: "Trust Level"
notifications: "Notifications"
dynamic_favicon: "Show incoming message notifications on favicon"
external_links_in_new_tab: "Open all external links in a new tab"
enable_quoting: "Enable quote reply for highlighted text"

View File

@ -205,6 +205,7 @@ ru:
bio: Обо мне
invited_by: Приглашен пользователем
trust_level: Уровень доверия
dynamic_favicon: Отображать события на favicon
external_links_in_new_tab: Открывать все внешние ссылки в новой вкладке
enable_quoting: Позволить отвечать с цитированием выделенного текста
moderator: '{{user}} - модератор'

View File

@ -456,7 +456,6 @@ de:
logo_url: "Das Logo deiner Seite, zum Beispiel: http://example.com/logo.png"
logo_small_url: "Kleines Logo deiner Seite, das beim Herunterscrollen in einem Thema gezeigt wird, zum Beispiel: http://example.com/logo-small.png"
favicon_url: "Das Favicon deiner Seite, siehe http://de.wikipedia.org/wiki/Favicon"
dynamic_favicon: "Zeige eingehende Nachrichten im Favicon"
apple_touch_icon_url: "Icon für berührungsempfindliche Apple Geräte. Empfohlene Grösse ist 144px auf 144px."
notification_email: "Die Antwortadresse, die in Systemmails (zum Beispiel zur Passwortwiederherstellung, neuen Konten, etc.) eingetragen wird."

View File

@ -459,7 +459,6 @@ en:
logo_url: "The logo for your site eg: http://example.com/logo.png"
logo_small_url: "The small logo for your site used when scrolling down on topics eg: http://example.com/logo-small.png"
favicon_url: "A favicon for your site, see http://en.wikipedia.org/wiki/Favicon"
dynamic_favicon: "Show incoming message notifications on favicon"
apple_touch_icon_url: "Icon used for Apple touch devices. Recommended size is 144px by 144px."
notification_email: "The return email address used when sending system emails such as notifying users of lost passwords, new accounts etc"

View File

@ -505,7 +505,6 @@ ru:
logo_url: 'Логотип вашего сайта, например: http://example.com/logo.png'
logo_small_url: 'Уменьшенный логотип вашего сайта, используется при прокрутке списка тем, например: http://example.com/logo-small.png'
favicon_url: 'favicon вашего сайта, дополнительная информация: http://en.wikipedia.org/wiki/Favicon'
dynamic_favicon: Отображать события на favicon
apple_touch_icon_url: Иконка используемая для тач-устройств Apple. Рекомендуемый размер 144 x 144 px.
notification_email: Обратный электронный адрес, используемый для отправки системных электронных писем пользователям, таких как оповещение пользователей о потерянном пароле, новой учетной записи и т.д.
use_ssl: Будет ли сайт доступен по SSL? (НЕ РЕАЛИЗОВАНО, ЭКСПЕРИМЕНТАЛЬНАЯ ФУНКЦИЯ)

View File

@ -0,0 +1,5 @@
class AddDynamicFaviconPreferenceToUser < ActiveRecord::Migration
def change
add_column :users, :dynamic_favicon, :boolean, default: false, null: false
end
end