Sha256: 68c53f5b320b31050d11f1d4a1396d70088f87fa4dece0f676d59a658d62b4fd
Contents?: true
Size: 1.98 KB
Versions: 1
Compression:
Stored size: 1.98 KB
Contents
#= require outpost/publishing_helper ## # ContentAlarm # # Show/hide ContentAlarm fields based on status. # Also renders messages based on status & timestamp # class outpost.ContentAlarm extends outpost.PublishingHelper constructor: (@options={}) -> super # The actual datetime input @datetimeField = @container.find("input.datetime") # Alerts @alerts = isScheduled: new outpost.Notification(@notifications, "success", "This content is <strong>scheduled</strong> to be published.") isNotScheduled: new outpost.Notification(@notifications, "info", "This content is <strong>not scheduled</strong> to be published.") # Notify the scheduled status @originalStatus = @setStatus() # also sets @status @hideFields() # Hidden by default. @setTimestamp() @notify() # Event for when the timestamp field is changed @datetimeField.on update: (event) => @setTimestamp() @notify() #---------- # Set @timestamp to the current value of the timestamp field setTimestamp: -> @timestamp = @datetimeField.val() #---------- notify: -> @clearAlerts() timestampFilled = !_.isEmpty(@timestamp) isPending = @isPending() isPublished = @isPublished() # Show the fields if it's pending. if isPending then @showFields() else @hideFields() # When it IS scheduled if isPending and timestampFilled return @alert 'isScheduled' # When it ISN'T scheduled if isPending and !timestampFilled return @alert 'isNotScheduled' # This one assumes that the PublishingUI script # will let the user know about Publishing Immediately. if !isPending and !isPublished and timestampFilled @hideFields() return @alert 'isNotScheduled'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
outpost-publishing-1.0.0 | lib/assets/javascripts/outpost/content_alarm.js.coffee |