django-intercom Documentation

Similar documents
Django-frontend-notification Documentation

Creating a Navigation Bar with a Rollover Effect

django simple pagination Documentation

django-image-cropping Documentation

Assignments (4) Assessment as per Schedule (2)

<style type="text/css"> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page***

alphafilter Documentation

Django-CSP Documentation

Wanted! Introduction. Step 1: Styling your poster. Activity Checklist. In this project, you ll learn how to make your own poster.

WEBSITE PROJECT 2 PURPOSE: INSTRUCTIONS: REQUIREMENTS:

CS 350 Internet Applications I Name: Exam II (CSS) October 29, 2013

Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS. 8 Oct 2015

Web Recruitment Module Customisation

GIMP WEB 2.0 MENUS WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR CREATING AN HTML LIST

Create a Web Page with Spry Navigation Bar. March 30, 2010

Styles, Style Sheets, the Box Model and Liquid Layout

Cascading Style Sheets (CSS)

CSS: The Basics CISC 282 September 20, 2014

Appendix D CSS Properties and Values

django-messages Documentation

Introduction to CSS. 2 Sep 13. Derek Peacock. An introduction to defining CSS style rules using tags, classes and ids.

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

Getting Started with Eric Meyer's CSS Sculptor 1.0

django-selenium Documentation

COMP519 Web Programming Lecture 6: Cascading Style Sheets: Part 2 Handouts

CSS3 Basics. From & CSS Visual Dictionary Learning Curve Books, LLC

Adding CSS to your HTML

ACSC 231 Internet Technologies

Using Dreamweaver CS6

django-model-report Documentation

django-slim Documentation

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar

Introducing Cascading Style Sheets. Cascading Style Sheet Basics Creating Styles Using Styles Manipulating Styles Text Formatting with CSS

Chapter 7 BMIS335 Web Design & Development

DAY 4. Coding External Style Sheets

django-mongonaut Documentation

Review Question 1. Which tag is used to create a link to another page? 1. <p> 2. <li> 3. <a> 4. <em>

Gargoyle Documentation

django-reinhardt Documentation

django-cms-search Documentation

django-dynamic-db-router Documentation

CSS for Styling CS380

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference

CSS Quiz Result. 2) Where in an HTML document is the correct place to refer to an external style sheet?

Easy-select2 Documentation

Django Map Widgets Documentation

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2)

Web Structure and Style. MB2030 Section 2 Class 4

django-avatar Documentation

CSS Selectors. element selectors. .class selectors. #id selectors

django-avatar Documentation

django-antispam Documentation

CSS Cascading Style Sheets

django-osm-field Release 0.3.1

2005 WebGUI Users Conference

Click the Options link in the upper right corner of the Outlook Web Access window (see illustration below).

Three Ways to Use CSS:

In the early days of the Web, designers just had the original 91 HTML tags to work with.

Using Dreamweaver. 6 Styles in Websites. 1. Linked or Imported Stylesheets. 2. Embedded Styles. 3. Inline Styles

Lab Introduction to Cascading Style Sheets

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar with Dynamic Background Image

CSS FOUNDATIONS IN-DEPTH. The nitty-gritty of css...

Deccansoft Software Services

django-baton Documentation

Page Layout. 4.1 Styling Page Sections 4.2 Introduction to Layout 4.3 Floating Elements 4.4 Sizing and Positioning

Writing Modular Stylesheets With CSS Modules.

Your Inbox Unread messages have a white background while read ones are gray.

Nuit Documentation. Release Ben Cardy

Lesson 5 Introduction to Cascading Style Sheets

<body bgcolor=" " fgcolor=" " link=" " vlink=" " alink=" "> These body attributes have now been deprecated, and should not be used in XHTML.

Web Development & Design Foundations with HTML5, 8 th Edition Instructor Materials Chapter 3 Test Bank

Django Forme Documentation

CSS cont. October 5, Unit 4

HTML + CSS. ScottyLabs WDW. Overview HTML Tags CSS Properties Resources

COSC 2206 Internet Tools. CSS Cascading Style Sheets

Reading 2.2 Cascading Style Sheets

ADOBE 9A Adobe Dreamweaver CS4 ACE.

COMS 359: Interactive Media

Using Dreamweaver CC. 6 Styles in Websites. Exercise 1 Linked Styles vs Embedded Styles

First Name Last Name CS-081 March 23, 2010 Midterm Exam

django-baton Documentation

django-embed-video Documentation

Bambu API Documentation

micawber Documentation

Web Development & Design Foundations with HTML5

django-notifier Documentation

ADDING CSS TO YOUR HTML DOCUMENT. A FEW CSS VALUES (colour, size and the box model)

django-subdomains Documentation

Django with Python Course Catalog

django-renderit Documentation

Web Development & Design Foundations with HTML5

UNIVERSITI TEKNOLOGI MALAYSIA TEST 1 SEMESTER II 2012/2013

Fundamentals of Web Technologies. Agenda: CSS Layout (Box Model) CSS Layout: Box Model. All HTML elements can be considered as a box or a container

Getting Started with CSS Sculptor 3

django-fluent-dashboard Documentation

Web Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh

The CSSSave package. Extending the built-in HTMLSave function with style sheets. Reinhold Kainhofer. Abstract

Templated-docs Documentation

django-dajax Documentation

Transcription:

django-intercom Documentation Release 0.0.12 Ken Cochrane February 01, 2016

Contents 1 Installation 3 2 Usage 5 3 Enable Secure Mode 7 4 Intercom Inbox 9 5 Custom Data 11 6 Settings 13 6.1 INTERCOM_APPID........................................... 13 6.2 INTERCOM_SECURE_KEY...................................... 13 6.3 INTERCOM_INCLUDE_USERID................................... 13 6.4 INTERCOM_ENABLE_INBOX.................................... 14 6.5 INTERCOM_ENABLE_INBOX_COUNTER............................. 14 6.6 INTERCOM_INBOX_CSS_SELECTOR................................ 14 6.7 INTERCOM_CUSTOM_DATA_CLASSES.............................. 14 7 People who have worked on this project 15 8 TODO 17 9 Indices and tables 19 i

ii

django-intercom Documentation, Release 0.0.12 Contents: Contents 1

django-intercom Documentation, Release 0.0.12 2 Contents

CHAPTER 1 Installation 1. Install django-intercom using pip: pip install django-intercom 2. Add intercom to your INSTALLED_APPS in your django settings file: INSTALLED_APPS = ( # all # other # apps 'intercom', ) 3. Add INTERCOM_APPID setting to your django settings file with your intercom application Id. in settings.py: INTERCOM_APPID = "your appid" 3

django-intercom Documentation, Release 0.0.12 4 Chapter 1. Installation

CHAPTER 2 Usage Add the template tag code into your base template before the body tag. At the top of the page put this: {% load intercom %} At the bottom of the page before the </body> tag put this: {% intercom_tag %} 5

django-intercom Documentation, Release 0.0.12 6 Chapter 2. Usage

CHAPTER 3 Enable Secure Mode This is optional, if it isn t set, then you will not use secure mode. If you want to turn on secure mode, you can add INTERCOM_SECURE_KEY to your settings.py with the private key you can get from your intercom->app->security page. in settings.py: INTERCOM_SECURE_KEY = "your security_code" You will need to look in the code samples to find the security key. You will also need to make sure you check the Enable secure mode check box on the security page before this will work correctly. 7

django-intercom Documentation, Release 0.0.12 8 Chapter 3. Enable Secure Mode

CHAPTER 4 Intercom Inbox Intercom has the ability to add an inbox link to your app so that people can contact you, and for you to let them know when they have a message waiting. If you would like to use these features you need to do the following. 1. Add the intercom css id to any inline element containing text, for example: <a id="intercom" href="#">support</a> 2. Add the appropriate CSS to your style sheet. No Icon: #Intercom { display: inline-block; text-decoration: underline; padding: 0; } White Envelope (white text on black background): #Intercom { display: inline-block; text-decoration: underline; padding: 0 0 0 24px; background: transparent url(https://www.intercom.io/images/white_env.png) no-repeat left center; } Black Envelope (black text on white/grey background): #Intercom { display: inline-block; text-decoration: underline; padding: 0 0 0 24px; background: transparent url(https://www.intercom.io/images/black_env.png) no-repeat left center; } If you want to show the unread message count then also add the following: #Intercom em { display: inline-block; font-style: normal; text-decoration: underline; } 3. Configure your settings. Add the following to your django settings if you would like to change the defaults. 9

django-intercom Documentation, Release 0.0.12 INTERCOM_ENABLE_INBOX Default: True In settings.py: INTERCOM_ENABLE_INBOX = True INTERCOM_ENABLE_INBOX_COUNTER Default: True In settings.py: INTERCOM_ENABLE_INBOX_COUNTER = True INTERCOM_INBOX_CSS_SELECTOR Default: #Intercom In settings.py: INTERCOM_INBOX_CSS_SELECTOR = '#Intercom' 10 Chapter 4. Intercom Inbox

CHAPTER 5 Custom Data Intercom.io allows you to send them your own custom data, django-intercom makes this easy. All you need to do it create a Class with a custom_data method that accepts a Django User model as an argument and returns a dictionary. Here is an example: from thepostman.models import message class IntercomCustomData: """ Custom data class located anywhere in your project This one is located in thepostman/utils/custom_data.py """ def custom_data(self, user): """ Required method, same name and only accepts one attribute (django User model) """ num_messages = message.objects.filter(user=user).count() num_unread = messages.objects.filter(user=user, read=false).count() return { 'num_messages' : num_messages, 'num_unread' : num_unread, } Once you have your classes built, you will need to register them with django-intercom so that it knows where to find them. You do this by adding the class to the INTERCOM_CUSTOM_DATA_CLASSES setting. It is important to note that if you have the same dict key returned in more then one Custom Data Class the last class that is run (lower in the list) will overwrite the previous ones. INTERCOM_CUSTOM_DATA_CLASSES Default = None in settings.py: INTERCOM_CUSTOM_DATA_CLASSES = [ 'thepostman.utils.custom_data.intercomcustomdata', ] 11

django-intercom Documentation, Release 0.0.12 12 Chapter 5. Custom Data

CHAPTER 6 Settings These are the settings that you can add to your django settings file to control django-intercom. 6.1 INTERCOM_APPID Required Default: None Example: INTERCOM_APPID = "your appid" 6.2 INTERCOM_SECURE_KEY Optional Default: None example: INTERCOM_SECURE_KEY = "your security_code" 6.3 INTERCOM_INCLUDE_USERID Optional Whether to include the user_id in the intercom settings. Turn this off if you want to use the email as the key to identify a user. Default: True example: INTERCOM_INCLUDE_USERID = False 13

django-intercom Documentation, Release 0.0.12 6.4 INTERCOM_ENABLE_INBOX Optional Default: True example: INTERCOM_ENABLE_INBOX = True 6.5 INTERCOM_ENABLE_INBOX_COUNTER Optional Default: True example: INTERCOM_ENABLE_INBOX_COUNTER = True 6.6 INTERCOM_INBOX_CSS_SELECTOR Optional Default: #Intercom example: INTERCOM_INBOX_CSS_SELECTOR = '#Intercom' 6.7 INTERCOM_CUSTOM_DATA_CLASSES Optional Default = None example: INTERCOM_CUSTOM_DATA_CLASSES = [ 'thepostman.utils.custom_data.intercomcustomdata', ] 14 Chapter 6. Settings

CHAPTER 7 People who have worked on this project Ken Cochrane (@KenCochrane) 15

django-intercom Documentation, Release 0.0.12 16 Chapter 7. People who have worked on this project

CHAPTER 8 TODO Adding unit tests 17

django-intercom Documentation, Release 0.0.12 18 Chapter 8. TODO

CHAPTER 9 Indices and tables genindex search 19