Skip to content

Commit

Permalink
fix favicons and add an option to enable svg
Browse files Browse the repository at this point in the history
  • Loading branch information
karlprieb committed Jan 13, 2017
1 parent 74d1fd0 commit 31b8090
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 33 deletions.
1 change: 1 addition & 0 deletions packages/rocketchat-assets/server/assets.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ RocketChat.Assets = new class


RocketChat.settings.addGroup 'Assets'
RocketChat.settings.add 'Assets_SvgFavicon_Enable', true, { type: 'boolean', group: 'Assets', i18nLabel: 'Enable_Svg_Favicon' }
for key, value of assets
do (key, value) ->
RocketChat.settings.add "Assets_#{key}", {defaultUrl: value.defaultUrl}, { type: 'asset', group: 'Assets', fileConstraints: value.constraints, i18nLabel: value.label, asset: key, public: true }
Expand Down
3 changes: 2 additions & 1 deletion packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@
"Enable": "Enable",
"Enable_Desktop_Notifications": "Enable Desktop Notifications",
"Enabled": "Enabled",
"Enable_Svg_Favicon": "Enable SVG favicon",
"Encrypted_message": "Encrypted message",
"End_OTR": "End OTR",
"Enter_a_regex": "Enter a regex",
Expand Down Expand Up @@ -1539,4 +1540,4 @@
"your_message_optional": "your message (optional)",
"Your_password_is_wrong": "Your password is wrong!",
"Your_push_was_sent_to_s_devices": "Your push was sent to %s devices"
}
}
14 changes: 6 additions & 8 deletions packages/rocketchat-ui-admin/admin/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
<h2>
<span class="room-title">{{#with group}}{{label}}{{/with}}</span>
</h2>
{{#unless $eq group._id 'Assets'}}
<div class="submit">
{{#if hasChanges}}
<button class="button danger discard"><i class="icon-send"></i><span>{{_ "Cancel"}}</span></button>
{{/if}}
<button class="button primary save" disabled="{{not hasChanges}}"><i class="icon-send"></i><span>{{_ "Save_changes"}}</span></button>
</div>
{{/unless}}
<div class="submit">
{{#if hasChanges}}
<button class="button danger discard"><i class="icon-send"></i><span>{{_ "Cancel"}}</span></button>
{{/if}}
<button class="button primary save" disabled="{{not hasChanges}}"><i class="icon-send"></i><span>{{_ "Save_changes"}}</span></button>
</div>
</header>

<div class="content background-transparent-dark">
Expand Down
14 changes: 6 additions & 8 deletions packages/rocketchat-ui-master/master/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="msapplication-TileImage" content="images/logo/mstile-144x144.png?v=3" />
<meta name="msapplication-config" content="images/logo/browserconfig.xml?v=3" />
<link rel="manifest" href="images/logo/manifest.json?v=3" />
<meta name="msapplication-TileImage" content="assets/tile_144.png" />
<meta name="msapplication-config" content="images/browserconfig.xml" />
<link rel="manifest" href="images/manifest.json" />
<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/nocfbnnmjnndkbipkabodnheejiegccf" />
<link rel="icon" sizes="any" type="image/svg+xml" href="assets/favicon.svg?v=3" />
<link rel="icon" sizes="32x32" type="image/png" href="/images/logo/favicon-32x32.png?v=3" />
<link rel="icon" sizes="16x16" type="image/png" href="/images/logo/favicon-16x16.png?v=3" />
<link rel="mask-icon" href="/images/logo/safari-pinned-tab.svg" color="#04436a">
<link rel="apple-touch-icon" sizes="180x180" href="images/logo/apple-touch-icon-180x180.png?v=3" />
<link rel="mask-icon" href="assets/safari_pinned.svg" color="#04436a">
<link rel="apple-touch-icon" sizes="180x180" href="assets/touchicon_180.png" />
<link rel="apple-touch-icon-precomposed" href="assets/touchicon_180_pre.png">
</head>

<body class="global-font-family color-primary-font-color">
Expand Down
14 changes: 14 additions & 0 deletions packages/rocketchat-ui-master/server/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ if (process.env.DISABLE_ANIMATION || process.env.TEST_MODE === 'true') {
`);
}

RocketChat.settings.get('Assets_SvgFavicon_Enable', (key, value) => {
const standardFavicons = `
<link rel="icon" sizes="16x16" type="image/png" href="assets/favicon_16.png" />
<link rel="icon" sizes="32x32" type="image/png" href="assets/favicon_32.png" />`;

if (value) {
Inject.rawHead(key,
`${standardFavicons}
<link rel="icon" sizes="any" type="image/svg+xml" href="assets/favicon.svg" />`);
} else {
Inject.rawHead(key, standardFavicons);
}
});

RocketChat.settings.get('theme-color-primary-background-color', (key, value = '#04436a') => {
Inject.rawHead(key, `<style>body { background-color: ${value};}</style>` +
`<meta name="msapplication-TileColor" content="${value}" />` +
Expand Down
6 changes: 3 additions & 3 deletions packages/rocketchat-ui/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ Package.onUse(function(api) {
api.addFiles('lib/fileUpload.coffee', 'client');
api.addFiles('lib/fireEvent.js', 'client');
api.addFiles('lib/iframeCommands.js', 'client');
api.addFiles('lib/jquery.swipebox.min.css', 'client');
api.addFiles('lib/jquery.swipebox.min.js', 'client');
api.addFiles('lib/jquery.swipebox.init.js', 'client');
// api.addFiles('lib/jquery.swipebox.min.css', 'client');
// api.addFiles('lib/jquery.swipebox.min.js', 'client');
// api.addFiles('lib/jquery.swipebox.init.js', 'client');
api.addFiles('lib/menu.coffee', 'client');
api.addFiles('lib/modal.coffee', 'client');
api.addFiles('lib/Modernizr.js', 'client');
Expand Down
11 changes: 11 additions & 0 deletions public/images/browserconfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="assets/tile_150.png"/>
<square310x310logo src="assets/tile_310_square.png"/>
<wide310x150logo src="assets/tile_310_wide.png"/>
<TileColor>#04436a</TileColor>
</tile>
</msapplication>
</browserconfig>
11 changes: 0 additions & 11 deletions public/images/logo/browserconfig.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"name": "Rocket.Chat",
"icons": [
{
"src": "\/images\/logo\/android-chrome-192x192.png?v=3",
"src": "assets\/favicon_192.png",
"sizes": "192x192",
"type": "image\/png"
},
{
"src": "\/images\/logo\/512x512.png?v=3",
"src": "assets\/favicon_512.png",
"sizes": "512x512",
"type": "image\/png"
}
Expand Down

0 comments on commit 31b8090

Please sign in to comment.