Fix failing examples
Manuel authored 4 years ago
James committed 4 years ago
46 | 46 | |
47 | 47 | // Header Section |
48 | 48 | headerText := slack.NewTextBlockObject("mrkdwn", "You have a new request:\n*<fakeLink.toEmployeeProfile.com|Fred Enriquez - New device request>*", false, false) |
49 | headerSection := slack.NewSectionBlock(headerText, nil, nil, nil) | |
49 | headerSection := slack.NewSectionBlock(headerText, nil, nil) | |
50 | 50 | |
51 | 51 | // Fields |
52 | 52 | typeField := slack.NewTextBlockObject("mrkdwn", "*Type:*\nComputer (laptop)", false, false) |
62 | 62 | fieldSlice = append(fieldSlice, reasonField) |
63 | 63 | fieldSlice = append(fieldSlice, specsField) |
64 | 64 | |
65 | fieldsSection := slack.NewSectionBlock(nil, fieldSlice, nil, nil) | |
65 | fieldsSection := slack.NewSectionBlock(nil, fieldSlice, nil) | |
66 | 66 | |
67 | 67 | // Approve and Deny Buttons |
68 | 68 | approveBtnTxt := slack.NewTextBlockObject("plain_text", "Approve", false, false) |
97 | 97 | |
98 | 98 | // Header Section |
99 | 99 | headerText := slack.NewTextBlockObject("mrkdwn", "You have a new request:\n*<google.com|Fred Enriquez - Time Off request>*", false, false) |
100 | headerSection := slack.NewSectionBlock(headerText, nil, nil, nil) | |
100 | headerSection := slack.NewSectionBlock(headerText, nil, nil) | |
101 | 101 | |
102 | 102 | approvalText := slack.NewTextBlockObject("mrkdwn", "*Type:*\nPaid time off\n*When:*\nAug 10-Aug 13\n*Hours:* 16.0 (2 days)\n*Remaining balance:* 32.0 hours (4 days)\n*Comments:* \"Family in town, going camping!\"", false, false) |
103 | 103 | approvalImage := slack.NewImageBlockElement("https://api.slack.com/img/blocks/bkb_template_images/approvalsNewDevice.png", "computer thumbnail") |
104 | 104 | |
105 | fieldsSection := slack.NewSectionBlock(approvalText, nil, slack.NewAccessory(approvalImage), nil) | |
105 | fieldsSection := slack.NewSectionBlock(approvalText, nil, slack.NewAccessory(approvalImage)) | |
106 | 106 | |
107 | 107 | // Approve and Deny Buttons |
108 | 108 | approveBtnTxt := slack.NewTextBlockObject("plain_text", "Approve", false, false) |
141 | 141 | |
142 | 142 | // Header Section |
143 | 143 | headerText := slack.NewTextBlockObject("plain_text", "Looks like you have a scheduling conflict with this event:", false, false) |
144 | headerSection := slack.NewSectionBlock(headerText, nil, nil, nil) | |
144 | headerSection := slack.NewSectionBlock(headerText, nil, nil) | |
145 | 145 | |
146 | 146 | // Schedule Info Section |
147 | 147 | scheduleText := slack.NewTextBlockObject("mrkdwn", "*<fakeLink.toUserProfiles.com|Iris / Zelda 1-1>*\nTuesday, January 21 4:00-4:30pm\nBuilding 2 - Havarti Cheese (3)\n2 guests", false, false) |
148 | 148 | scheduleAccessory := slack.NewImageBlockElement("https://api.slack.com/img/blocks/bkb_template_images/notifications.png", "calendar thumbnail") |
149 | schedeuleSection := slack.NewSectionBlock(scheduleText, nil, slack.NewAccessory(scheduleAccessory), nil) | |
149 | schedeuleSection := slack.NewSectionBlock(scheduleText, nil, slack.NewAccessory(scheduleAccessory)) | |
150 | 150 | |
151 | 151 | // Conflict Section |
152 | 152 | conflictImage := slack.NewImageBlockElement("https://api.slack.com/img/blocks/bkb_template_images/notificationsWarningIcon.png", "notifications warning icon") |
159 | 159 | |
160 | 160 | // Proposese Text |
161 | 161 | proposeText := slack.NewTextBlockObject("mrkdwn", "*Propose a new time:*", false, false) |
162 | proposeSection := slack.NewSectionBlock(proposeText, nil, nil, nil) | |
162 | proposeSection := slack.NewSectionBlock(proposeText, nil, nil) | |
163 | 163 | |
164 | 164 | // Option 1 |
165 | 165 | optionOneText := slack.NewTextBlockObject("mrkdwn", "*Today - 4:30-5pm*\nEveryone is available: @iris, @zelda", false, false) |
166 | optionOneSection := slack.NewSectionBlock(optionOneText, nil, slack.NewAccessory(chooseBtnEle), nil) | |
166 | optionOneSection := slack.NewSectionBlock(optionOneText, nil, slack.NewAccessory(chooseBtnEle)) | |
167 | 167 | |
168 | 168 | // Option 2 |
169 | 169 | optionTwoText := slack.NewTextBlockObject("mrkdwn", "*Tomorrow - 4-4:30pm*\nEveryone is available: @iris, @zelda", false, false) |
170 | optionTwoSection := slack.NewSectionBlock(optionTwoText, nil, slack.NewAccessory(chooseBtnEle), nil) | |
170 | optionTwoSection := slack.NewSectionBlock(optionTwoText, nil, slack.NewAccessory(chooseBtnEle)) | |
171 | 171 | |
172 | 172 | // Option 3 |
173 | 173 | optionThreeText := slack.NewTextBlockObject("mrkdwn", "*Tomorrow - 6-6:30pm*\nSome people aren't available: @iris, ~@zelda~", false, false) |
174 | optionThreeSection := slack.NewSectionBlock(optionThreeText, nil, slack.NewAccessory(chooseBtnEle), nil) | |
174 | optionThreeSection := slack.NewSectionBlock(optionThreeText, nil, slack.NewAccessory(chooseBtnEle)) | |
175 | 175 | |
176 | 176 | // Show More Times Link |
177 | 177 | showMoreText := slack.NewTextBlockObject("mrkdwn", "*<fakelink.ToMoreTimes.com|Show more times>*", false, false) |
178 | showMoreSection := slack.NewSectionBlock(showMoreText, nil, nil, nil) | |
178 | showMoreSection := slack.NewSectionBlock(showMoreText, nil, nil) | |
179 | 179 | |
180 | 180 | // Build Message with blocks created above |
181 | 181 | msg := slack.NewBlockMessage( |
215 | 215 | |
216 | 216 | // Header Section |
217 | 217 | headerText := slack.NewTextBlockObject("mrkdwn", "*Where should we order lunch from?* Poll by <fakeLink.toUser.com|Mark>", false, false) |
218 | headerSection := slack.NewSectionBlock(headerText, nil, nil, nil) | |
218 | headerSection := slack.NewSectionBlock(headerText, nil, nil) | |
219 | 219 | |
220 | 220 | // Option One Info |
221 | 221 | optOneText := slack.NewTextBlockObject("mrkdwn", ":sushi: *Ace Wasabi Rock-n-Roll Sushi Bar*\nThe best landlocked sushi restaurant.", false, false) |
222 | optOneSection := slack.NewSectionBlock(optOneText, nil, slack.NewAccessory(voteBtnEle), nil) | |
222 | optOneSection := slack.NewSectionBlock(optOneText, nil, slack.NewAccessory(voteBtnEle)) | |
223 | 223 | |
224 | 224 | // Option One Votes |
225 | 225 | optOneVoteText := slack.NewTextBlockObject("plain_text", "3 votes", true, false) |
227 | 227 | |
228 | 228 | // Option Two Info |
229 | 229 | optTwoText := slack.NewTextBlockObject("mrkdwn", ":hamburger: *Super Hungryman Hamburgers*\nOnly for the hungriest of the hungry.", false, false) |
230 | optTwoSection := slack.NewSectionBlock(optTwoText, nil, slack.NewAccessory(voteBtnEle), nil) | |
230 | optTwoSection := slack.NewSectionBlock(optTwoText, nil, slack.NewAccessory(voteBtnEle)) | |
231 | 231 | |
232 | 232 | // Option Two Votes |
233 | 233 | optTwoVoteText := slack.NewTextBlockObject("plain_text", "2 votes", true, false) |
235 | 235 | |
236 | 236 | // Option Three Info |
237 | 237 | optThreeText := slack.NewTextBlockObject("mrkdwn", ":ramen: *Kagawa-Ya Udon Noodle Shop*\nDo you like to shop for noodles? We have noodles.", false, false) |
238 | optThreeSection := slack.NewSectionBlock(optThreeText, nil, slack.NewAccessory(voteBtnEle), nil) | |
238 | optThreeSection := slack.NewSectionBlock(optThreeText, nil, slack.NewAccessory(voteBtnEle)) | |
239 | 239 | |
240 | 240 | // Option Three Votes |
241 | 241 | optThreeVoteText := slack.NewTextBlockObject("plain_text", "No votes", true, false) |
290 | 290 | overflow := slack.NewOverflowBlockElement("", overflowOptionOne, overflowOptionTwo, overflowOptionThree) |
291 | 291 | |
292 | 292 | // Create the header section |
293 | headerSection := slack.NewSectionBlock(headerText, nil, slack.NewAccessory(overflow), nil) | |
293 | headerSection := slack.NewSectionBlock(headerText, nil, slack.NewAccessory(overflow)) | |
294 | 294 | |
295 | 295 | // Shared Divider |
296 | 296 | divSection := slack.NewDividerBlock() |
303 | 303 | hotelOneImage := slack.NewImageBlockElement("https://api.slack.com/img/blocks/bkb_template_images/tripAgent_1.png", "Windsor Court Hotel thumbnail") |
304 | 304 | hotelOneLoc := slack.NewTextBlockObject("plain_text", "Location: Central Business District", true, false) |
305 | 305 | |
306 | hotelOneSection := slack.NewSectionBlock(hotelOneInfo, nil, slack.NewAccessory(hotelOneImage), nil) | |
306 | hotelOneSection := slack.NewSectionBlock(hotelOneInfo, nil, slack.NewAccessory(hotelOneImage)) | |
307 | 307 | hotelOneContext := slack.NewContextBlock("", []slack.MixedElement{locationPinImage, hotelOneLoc}...) |
308 | 308 | |
309 | 309 | // Second Hotel Listing |
311 | 311 | hotelTwoImage := slack.NewImageBlockElement("https://api.slack.com/img/blocks/bkb_template_images/tripAgent_2.png", "Ritz-Carlton New Orleans thumbnail") |
312 | 312 | hotelTwoLoc := slack.NewTextBlockObject("plain_text", "Location: French Quarter", true, false) |
313 | 313 | |
314 | hotelTwoSection := slack.NewSectionBlock(hotelTwoInfo, nil, slack.NewAccessory(hotelTwoImage), nil) | |
314 | hotelTwoSection := slack.NewSectionBlock(hotelTwoInfo, nil, slack.NewAccessory(hotelTwoImage)) | |
315 | 315 | hotelTwoContext := slack.NewContextBlock("", []slack.MixedElement{locationPinImage, hotelTwoLoc}...) |
316 | 316 | |
317 | 317 | // Third Hotel Listing |
319 | 319 | hotelThreeImage := slack.NewImageBlockElement("https://api.slack.com/img/blocks/bkb_template_images/tripAgent_3.png", "https://api.slack.com/img/blocks/bkb_template_images/tripAgent_3.png") |
320 | 320 | hotelThreeLoc := slack.NewTextBlockObject("plain_text", "Location: French Quarter", true, false) |
321 | 321 | |
322 | hotelThreeSection := slack.NewSectionBlock(hotelThreeInfo, nil, slack.NewAccessory(hotelThreeImage), nil) | |
322 | hotelThreeSection := slack.NewSectionBlock(hotelThreeInfo, nil, slack.NewAccessory(hotelThreeImage)) | |
323 | 323 | hotelThreeContext := slack.NewContextBlock("", []slack.MixedElement{locationPinImage, hotelThreeLoc}...) |
324 | 324 | |
325 | 325 | // Action button |
372 | 372 | |
373 | 373 | // Header Section |
374 | 374 | headerText := slack.NewTextBlockObject("mrkdwn", ":mag: Search results for *Cata*", false, false) |
375 | headerSection := slack.NewSectionBlock(headerText, nil, nil, nil) | |
375 | headerSection := slack.NewSectionBlock(headerText, nil, nil) | |
376 | 376 | |
377 | 377 | // Result One |
378 | 378 | resultOneTxt := slack.NewTextBlockObject("mrkdwn", "*<fakeLink.toYourApp.com|Use Case Catalogue>*\nUse Case Catalogue for the following departments/roles...", false, false) |
379 | resultOneSection := slack.NewSectionBlock(resultOneTxt, nil, slack.NewAccessory(availableOption), nil) | |
379 | resultOneSection := slack.NewSectionBlock(resultOneTxt, nil, slack.NewAccessory(availableOption)) | |
380 | 380 | |
381 | 381 | // Result Two |
382 | 382 | resultTwoTxt := slack.NewTextBlockObject("mrkdwn", "*<fakeLink.toYourApp.com|Customer Support - Workflow Diagram Catalogue>*\nThis resource was put together by members of...", false, false) |
383 | resultTwoSection := slack.NewSectionBlock(resultTwoTxt, nil, slack.NewAccessory(availableOption), nil) | |
383 | resultTwoSection := slack.NewSectionBlock(resultTwoTxt, nil, slack.NewAccessory(availableOption)) | |
384 | 384 | |
385 | 385 | // Result Three |
386 | 386 | resultThreeTxt := slack.NewTextBlockObject("mrkdwn", "*<fakeLink.toYourApp.com|Self-Serve Learning Options Catalogue>*\nSee the learning and development options we...", false, false) |
387 | resultThreeSection := slack.NewSectionBlock(resultThreeTxt, nil, slack.NewAccessory(availableOption), nil) | |
387 | resultThreeSection := slack.NewSectionBlock(resultThreeTxt, nil, slack.NewAccessory(availableOption)) | |
388 | 388 | |
389 | 389 | // Result Four |
390 | 390 | resultFourTxt := slack.NewTextBlockObject("mrkdwn", "*<fakeLink.toYourApp.com|Use Case Catalogue - CF Presentation - [June 12, 2018]>*\nThis is presentation will continue to be updated as...", false, false) |
391 | resultFourSection := slack.NewSectionBlock(resultFourTxt, nil, slack.NewAccessory(availableOption), nil) | |
391 | resultFourSection := slack.NewSectionBlock(resultFourTxt, nil, slack.NewAccessory(availableOption)) | |
392 | 392 | |
393 | 393 | // Result Five |
394 | 394 | resultFiveTxt := slack.NewTextBlockObject("mrkdwn", "*<fakeLink.toYourApp.com|Comprehensive Benefits Catalogue - 2019>*\nInformation about all the benfits we offer is...", false, false) |
395 | resultFiveSection := slack.NewSectionBlock(resultFiveTxt, nil, slack.NewAccessory(availableOption), nil) | |
395 | resultFiveSection := slack.NewSectionBlock(resultFiveTxt, nil, slack.NewAccessory(availableOption)) | |
396 | 396 | |
397 | 397 | // Next Results Button |
398 | 398 | // Suggestions Action |