@atomist/slack-messages
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -129,5 +129,16 @@ "use strict"; | ||
exports.listItem = listItem; | ||
var ButtonSpec = (function () { | ||
function ButtonSpec() { | ||
} | ||
return ButtonSpec; | ||
}()); | ||
exports.ButtonSpec = ButtonSpec; | ||
/** Construct Slack button that will execute provided rug instruction. */ | ||
function rugButtonFrom(action, command) { | ||
var button = { text: action.text }; | ||
var button = { | ||
text: action.text, | ||
type: "button", | ||
name: "rug", | ||
value: command.id, | ||
}; | ||
for (var attr in action) { | ||
@@ -138,5 +149,2 @@ if (action.hasOwnProperty(attr)) { | ||
} | ||
button.type = "button"; | ||
button.name = "rug"; | ||
button.value = command.id; | ||
return button; | ||
@@ -143,0 +151,0 @@ } |
@@ -10,6 +10,16 @@ # Change Log | ||
[Unreleased]: https://github.com/atomist/slack-messages/compare/0.2.0...0.1.0 | ||
[Unreleased]: https://github.com/atomist/slack-messages/compare/0.3.0...HEAD | ||
## [0.2.0]: - 2017-05-09 | ||
## [0.3.0] - 2017-05-10 | ||
[0.3.0]: https://github.com/atomist/slack-messages/compare/0.2.0...0.3.0 | ||
### Changed | ||
- **BREAKING** `Action` fields `name` and `type` are now required in order | ||
to match Slack required fields | ||
## [0.2.0] - 2017-05-09 | ||
[0.2.0]: https://github.com/atomist/slack-messages/compare/0.1.0...0.2.0 | ||
### Added | ||
@@ -24,7 +34,7 @@ - Add `renderError` and `renderSuccess` generic success and error rug messages | ||
## [0.1.0]: - 2017-05-09 | ||
## [0.1.0] - 2017-05-09 | ||
Initial release | ||
[0.1.0] https://github.com/atomist/slack-messages/releases/tag/0.1.0 | ||
[0.1.0]: https://github.com/atomist/slack-messages/releases/tag/0.1.0 | ||
@@ -31,0 +41,0 @@ ### Added |
{ | ||
"name": "@atomist/slack-messages", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"author": "Atomist, Inc", | ||
@@ -5,0 +5,0 @@ "directories": { |
@@ -168,4 +168,4 @@ import { Presentable } from "@atomist/rug/operations/Handlers"; | ||
text: string; | ||
name?: string; | ||
type?: ActionType; | ||
name: string; | ||
type: ActionType; | ||
value?: string; | ||
@@ -186,5 +186,16 @@ style?: string; | ||
export class ButtonSpec { | ||
public text: string; | ||
public style?: string; | ||
public confirm?: ActionConfirmation; | ||
} | ||
/** Construct Slack button that will execute provided rug instruction. */ | ||
export function rugButtonFrom(action: Action, command: Presentable<any>): Action { | ||
const button: Action = { text: action.text }; | ||
export function rugButtonFrom(action: ButtonSpec, command: Presentable<any>): Action { | ||
const button: Action = { | ||
text: action.text, | ||
type: "button", | ||
name: "rug", | ||
value: command.id, | ||
}; | ||
for (const attr in action) { | ||
@@ -195,6 +206,3 @@ if (action.hasOwnProperty(attr)) { | ||
} | ||
button.type = "button"; | ||
button.name = "rug"; | ||
button.value = command.id; | ||
return button; | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97300
793