fix(examples): Small fixes to QuickSchedule plugin

This commit is contained in:
Drew Regitsky 2015-12-01 15:35:14 -08:00
parent 0ab5886423
commit a6ddbae498
2 changed files with 23 additions and 16 deletions

View file

@ -5,11 +5,11 @@
<title></title>
<link rel='stylesheet' href='bootstrap.min.css'/>
<link rel='stylesheet' href='fullcalendar/fullcalendar.css'/>
<script src='nylas://N1-Quick-Schedule/fullcalendar/lib/jquery.min.js'></script>
<script src='nylas://N1-Quick-Schedule/fullcalendar/lib/moment.min.js'></script>
<script src='nylas://N1-Quick-Schedule/fullcalendar/lib/moment-timezone-with-data.min.js'></script>
<script src='nylas://N1-Quick-Schedule/fullcalendar/fullcalendar.js'></script>
<script src='nylas://N1-Quick-Schedule/bootstrap.min.js'></script>
<script src='fullcalendar/lib/jquery.min.js'></script>
<script src='fullcalendar/lib/moment.min.js'></script>
<script src='fullcalendar/lib/moment-timezone-with-data.min.js'></script>
<script src='fullcalendar/fullcalendar.js'></script>
<script src='bootstrap.min.js'></script>
<script>

View file

@ -77,8 +77,14 @@ module.exports =
# `DraftStoreExtension`.
DraftStore.registerExtension AvailabilityDraftExtension
# Subscribe to the ipc event `fromRenderer`, which will be published
# elsewhere in the package.
# Register a protocol that allows the calendar window to pass data back to the plugin
# with web requests
if NylasEnv.isMainWindow()
# First unregister the protocol, in case it has already been registered with a callback that's no
# longer valid (e.g. if the main window has reloaded). If the protocol is not registered, this line
# does nothing.
protocol.unregisterProtocol('quick-schedule')
# Now register the new protocol
protocol.registerStringProtocol 'quick-schedule', (request, callback) =>
{host:event,query:rawQuery} = url.parse(request.url)
stringArgs = qs.parse(rawQuery)
@ -100,7 +106,8 @@ module.exports =
#
deactivate: ->
ComponentRegistry.unregister CalendarButton
DraftStore.unregister AvailabilityDraftExtension
DraftStore.unregisterExtension AvailabilityDraftExtension
if NylasEnv.isMainWindow()
protocol.unregisterProtocol('quick-schedule')
### Internal Methods ###