Skip to content

Commit

Permalink
Merge pull request #1521 from himdel/custom-favicon
Browse files Browse the repository at this point in the history
Support custom favicons
  • Loading branch information
AllenBW committed Jan 31, 2019
2 parents 4be9a49 + 9f449a8 commit 60e4a9d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
4 changes: 3 additions & 1 deletion client/app/core/appliance-info.service.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint comma-dangle: 0 */
import gitHash from '../../version/version.json'

/** @ngInject */
Expand Down Expand Up @@ -28,7 +29,8 @@ export function ApplianceInfo ($sessionStorage) {
asyncNotify: data.settings.asynchronous_notifications || true,
nameFull: data.product_info.name_full,
brand: data.product_info.branding_info.brand,
logo: data.product_info.branding_info.logo
favicon: data.product_info.branding_info.favicon,
logo: data.product_info.branding_info.logo,
}

$sessionStorage.applianceInfo = applianceInfo
Expand Down
7 changes: 5 additions & 2 deletions client/app/core/appliance-info.service.spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint comma-dangle: 0 */
/* global ApplianceInfo */
describe('Appliance Info Service', () => {
const applianceInfoData = {
Expand All @@ -7,7 +8,8 @@ describe('Appliance Info Service', () => {
'support_website_text': 'ManageIQ.org',
'branding_info': {
'brand': 'ManageIQ',
'logo': 'ManageIQ'
'favicon': 'ManageIQ',
'logo': 'ManageIQ',
}
},
'identity': {
Expand Down Expand Up @@ -47,7 +49,8 @@ describe('Appliance Info Service', () => {
'server': 'EVM',
'asyncNotify': 'true',
'brand': 'ManageIQ',
'logo': 'ManageIQ'
'favicon': 'ManageIQ',
'logo': 'ManageIQ',
}
ApplianceInfo.set(applianceInfoData)
const currentApplianceInfo = ApplianceInfo.get()
Expand Down
6 changes: 4 additions & 2 deletions client/app/core/navigation/navigation-controller.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/** @ngInject */
export function NavigationController (Text, Navigation, Session, API_BASE, ShoppingCart, $scope, $uibModal, $state,
EventNotifications, ApplianceInfo, CollectionsApi, RBAC, Language, lodash) {
export function NavigationController (Text, Navigation, Session, API_BASE, ShoppingCart, $scope, $uibModal, $state, EventNotifications, ApplianceInfo, CollectionsApi, RBAC, Language, lodash, $rootScope) {
const vm = this
vm.language = ''
const destroy = $scope.$on('shoppingCartUpdated', refresh)
Expand Down Expand Up @@ -36,7 +35,10 @@ export function NavigationController (Text, Navigation, Session, API_BASE, Shopp
return EventNotifications.state().toastNotifications
},
refreshToast, true)

const applianceInfo = ApplianceInfo.get()
$rootScope.favicon = applianceInfo.favicon

vm.language = Language.chosen.code

$scope.$on('destroy', function () {
Expand Down
4 changes: 2 additions & 2 deletions client/app/states/login/login.state.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ function getStates () {
}

/** @ngInject */
function StateController ($window, $state, Text, RBAC, API_LOGIN, API_PASSWORD, AuthenticationApi, Session,
$rootScope, Notifications, Language, ApplianceInfo, CollectionsApi) {
function StateController ($window, $state, Text, RBAC, API_LOGIN, API_PASSWORD, AuthenticationApi, Session, $rootScope, Notifications, Language, ApplianceInfo, CollectionsApi) {
const vm = this

getBrand()
Expand Down Expand Up @@ -90,6 +89,7 @@ function StateController ($window, $state, Text, RBAC, API_LOGIN, API_PASSWORD,
function getBrand () {
CollectionsApi.query('product_info').then((response) => {
vm.brandInfo = response.branding_info
$rootScope.favicon = vm.brandInfo.favicon
})
}
}
Binary file removed client/assets/images/favicon.ico
Binary file not shown.
4 changes: 2 additions & 2 deletions client/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
<meta http-equiv="Content-Security-Policy"
content="default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src * data: 'unsafe-inline'; font-src 'self' data:; connect-src *;">
<link rel="shortcut icon" href="images/favicon.ico"/>
<link rel="icon" href="images/favicon.ico"/>
<link rel="shortcut icon" ng-href="{{favicon}}" />
<link rel="icon" ng-href="{{favicon}}" />
<base href="<%= htmlWebpackPlugin.options.base %>">
<style>
[ng-cloak] {
Expand Down

0 comments on commit 60e4a9d

Please sign in to comment.