Example #1
0
class SlackEditForm(ActionEditForm):
    """An edit form for the slack action."""

    schema = ISlackAction
    label = _("Edit Slack Action")
    description = _("Action to post a message to a Slack channel.")
    form_name = _("Configure element")

    # custom template will allow us to add help text
    template = ViewPageTemplateFile("slack.pt")
Example #2
0
class SlackAddForm(ActionAddForm):
    """An add form for the Slack Action."""

    schema = ISlackAction
    label = _("Add Slack Action")
    description = _("Action to post a message to a Slack channel.")
    form_name = _("Configure element")
    Type = SlackAction

    # custom template will allow us to add help text
    template = ViewPageTemplateFile("slack.pt")
Example #3
0
class ISlackAction(Interface):
    """Definition of the configuration available for a slack action."""

    webhook_url = schema.URI(
        title=_("Webhook url"),
        description=_(
            "URL configuration for this integration. "
            'i.e.:"https://hooks.slack.com/services/T00000000/B00000000/YYYYYYYYYYYYYYYYYYYYYYYY"',
        ),
        required=True,
    )
    channel = schema.TextLine(
        title=_("Channel"),
        description=_('Channel to receive the message. eg.:"#plone-rulez"'),
        required=True,
    )
    pretext = schema.TextLine(
        title=_("Pretext"),
        description=_(
            "This is optional text that appears above the message attachment block.",
        ),
        required=False,
    )
    title = schema.TextLine(
        title=_("Title"),
        description=_(
            "The title is displayed as larger, bold text near the top of a message attachment.",
        ),
        required=True,
    )
    title_link = schema.TextLine(
        title=_("Title Link"),
        description=_('Link to be added to the title. i.e.: "${absolute_url}"'),
        default="${absolute_url}",
        required=False,
    )
    text = schema.TextLine(
        title=_("Text"),
        description=_("This is the main text in a message attachment."),
        required=True,
    )
    color = schema.TextLine(
        title=_("Color"),
        description=_(
            'Color of the message. Valid values are "good", "warning", "danger" or '
            "any hex color code (eg. #439FE0)",
        ),
        required=False,
    )
    icon = schema.TextLine(
        title=_("Icon"),
        description=_('Icon to be displayed on the message. eg:":flag-br:"'),
        required=False,
    )
    username = schema.TextLine(
        title=_("Username"),
        description=_("Name to be displayed as the author of this message."),
        default="Plone CMS",
        required=True,
    )
    fields = schema.Text(
        title=_("Fields"),
        description=_(
            "Fields are added to the bottom of the Slack message like a small table."
            'Please add one definition per line in the format:"title|value|Short", i.e:'
            '"Review State|${review_state_title}|True"',
        ),
        required=False,
    )
Example #4
0
 def summary(self):
     return _(
         "Post a message on channel ${channel}", mapping=dict(channel=self.channel),
     )