diff --git a/config.py b/config.py index ba3b90976..5a8b24b42 100644 --- a/config.py +++ b/config.py @@ -19,7 +19,8 @@ def build_requests_session(): CLIENT_WHITELIST = ['SERVER_HOSTNAME', 'PREFERRED_URL_SCHEME', 'GITHUB_CLIENT_ID', 'GITHUB_LOGIN_CLIENT_ID', 'MIXPANEL_KEY', 'STRIPE_PUBLISHABLE_KEY', 'ENTERPRISE_LOGO_URL', 'SENTRY_PUBLIC_DSN', 'AUTHENTICATION_TYPE', - 'REGISTRY_TITLE', 'REGISTRY_TITLE_SHORT', 'GOOGLE_LOGIN_CLIENT_ID'] + 'REGISTRY_TITLE', 'REGISTRY_TITLE_SHORT', 'GOOGLE_LOGIN_CLIENT_ID', + 'CONTACT_INFO'] def getFrontendVisibleConfig(config_dict): @@ -48,6 +49,12 @@ class DefaultConfig(object): REGISTRY_TITLE = 'Quay.io' REGISTRY_TITLE_SHORT = 'Quay.io' + CONTACT_INFO = [ + 'mailto:support@quay.io', + 'irc://chat.freenode.net:6665/quayio', + 'tel:+1-888-930-3475', + 'https://twitter.com/quayio', + ] # Mail config MAIL_SERVER = '' diff --git a/endpoints/common.py b/endpoints/common.py index 37ae80ee8..d778e552e 100644 --- a/endpoints/common.py +++ b/endpoints/common.py @@ -170,6 +170,10 @@ def render_page_template(name, **kwargs): external_styles = get_external_css(local=not app.config.get('USE_CDN', True)) external_scripts = get_external_javascript(local=not app.config.get('USE_CDN', True)) + contact_href = None + if len(app.config.get('CONTACT_INFO', [])) == 1: + contact_href = app.config['CONTACT_INFO'][0] + resp = make_response(render_template(name, route_data=json.dumps(get_route_data()), external_styles=external_styles, external_scripts=external_scripts, @@ -186,6 +190,7 @@ def render_page_template(name, **kwargs): show_chat=features.OLARK_CHAT, cache_buster=cache_buster, has_billing=features.BILLING, + contact_href=contact_href, **kwargs)) resp.headers['X-FRAME-OPTIONS'] = 'DENY' diff --git a/static/css/quay.css b/static/css/quay.css index 2cc21f610..58e53af60 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -3974,7 +3974,7 @@ pre.command:before { color: #00b0ed; } -.contact-options .option-phone .fa-circle { +.contact-options .option-tel .fa-circle { color: #1dd924; } @@ -3982,10 +3982,14 @@ pre.command:before { color: #e52f00; } -.contact-options .option-email .fa-circle { +.contact-options .option-mailto .fa-circle { color: #1b72f1; } +.contact-options .option-url .fa-circle { + color: #F1A51B; +} + .about-us .row { margin-bottom: 30px; } diff --git a/static/js/app.js b/static/js/app.js index f7d3bbcba..0cb133b67 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -6474,6 +6474,14 @@ quayApp.directive('ngVisible', function () { }; }); +quayApp.config( [ + '$compileProvider', + function( $compileProvider ) + { + $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|irc):/); + } +]); + quayApp.run(['$location', '$rootScope', 'Restangular', 'UserService', 'PlanService', '$http', '$timeout', 'CookieService', 'Features', '$anchorScroll', function($location, $rootScope, Restangular, UserService, PlanService, $http, $timeout, CookieService, Features, $anchorScroll) { diff --git a/static/js/controllers.js b/static/js/controllers.js index 42512ed53..ffec020b7 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -8,7 +8,49 @@ function GuideCtrl() { function SecurityCtrl($scope) { } -function ContactCtrl($scope) { +function ContactCtrl($scope, Config) { + $scope.Config = Config; + $scope.colsize = Math.floor(12 / Config.CONTACT_INFO.length); + + $scope.getKind = function(contactInfo) { + var colon = contactInfo.indexOf(':'); + var scheme = contactInfo.substr(0, colon); + if (scheme == 'https' || scheme == 'http') { + if (contactInfo.indexOf('//twitter.com/') > 0) { + return 'twitter'; + } + + return 'url'; + } + + return scheme; + }; + + $scope.getTitle = function(contactInfo) { + switch ($scope.getKind(contactInfo)) { + case 'url': + return contactInfo; + + case 'twitter': + var parts = contactInfo.split('/'); + return '@' + parts[parts.length - 1]; + + case 'tel': + return contactInfo.substr('tel:'.length); + + case 'irc': + // irc://chat.freenode.net:6665/quayio + var parts = contactInfo.substr('irc://'.length).split('/'); + var server = parts[0]; + if (server.indexOf('freenode') > 0) { + server = 'Freenode'; + } + return server + ': #' + parts[parts.length - 1]; + + case 'mailto': + return contactInfo.substr('mailto:'.length); + } + } } function PlansCtrl($scope, $location, UserService, PlanService, $routeParams) { diff --git a/static/partials/contact.html b/static/partials/contact.html index bdc7dd159..df988f9d8 100644 --- a/static/partials/contact.html +++ b/static/partials/contact.html @@ -5,40 +5,21 @@
-
+
- + -

Email Us

-

support@quay.io

-
- -
- - - + +

Email

+

IRC

+

Call

+

Tweet

+

Help System

-

IRC

-

Freenode: #quayio

-
- -
- - - - -

Call Us

-

888-930-3475

-
- -
- - - - -

Tweet Us

-

@quayio

+

{{ getTitle(info) }}

\ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 44238190c..2bb2ab618 100644 --- a/templates/base.html +++ b/templates/base.html @@ -116,7 +116,7 @@ mixpanel.init("{{ mixpanel_key }}", { track_pageview : false, debug: {{ is_debug
  • Privacy
  • Security
  • About
  • -
  • Contact
  • +
  • Contact
  • Service Status