Sha256: f57bddcafd979fc593cefeb0f15286196d5f5f90677455d7da2578a7b97592b9
Contents?: true
Size: 1.72 KB
Versions: 1
Compression:
Stored size: 1.72 KB
Contents
## # PublishingHelper # # Some shared code for rendering alerts, and toggling fields # class outpost.PublishingHelper defaults: statusPending: "3" statusPublished: "5" constructor: (@options={}) -> _.defaults @options, @defaults @statusPending = @options.statusPending @statusPublished = @options.statusPublished # Elements @form = $ @options.form @container = $ @options.container, @form # Wrapper for the fields @statusField = $ @options.statusField, @form # Status select @notifications = $ @options.notifications, @form # Notification bucket # Event for when the status field is changed @statusField.on change: (event) => @setStatus() @notify() #---------- # Get the current status from the dropdown setStatus: -> @status = $("option:selected", @statusField).val() #---------- # Helpers for finding current and original status isPending: -> @status is @statusPending isPublished: -> @status is @statusPublished wasPending: -> @originalStatus is @statusPending wasPublished: -> @originalStatus is @statusPublished #---------- # Handles scenarios notify: -> # Override me #---------- # Render the notification alert: (key) -> @alerts[key].render() #---------- # Mass-Detach all of the alerts clearAlerts: -> alert.detach() for name,alert of @alerts #---------- showFields: -> @container.show() #---------- hideFields: -> @container.hide()
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
outpost-publishing-1.0.0 | lib/assets/javascripts/outpost/publishing_helper.js.coffee |