Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resubmission of PR for Red updates #23

Merged
merged 29 commits into from Feb 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
adaf927
Add Counter task.
greggirwin Apr 26, 2017
25b30e1
Add Temperature task.
greggirwin Apr 26, 2017
cd83e05
Add Timer task.
greggirwin Apr 26, 2017
74b7795
Add alt Timer task implementation.
greggirwin Apr 26, 2017
6d0b2b9
Add flight booking task.
greggirwin Apr 26, 2017
e58b095
Second flight booking task approach.
greggirwin Apr 26, 2017
977baa1
Put Book button enabling back where it was.
greggirwin Apr 26, 2017
8bdd54e
Add CRUD task.
greggirwin Apr 26, 2017
b570a52
Add readme.
greggirwin Apr 26, 2017
b7b5cd4
Change `function` to `has`. More idiomatic.
greggirwin Apr 26, 2017
c6e463a
Add type checking to `parse-date` for clarity, since it casts.
greggirwin Apr 26, 2017
7b1141f
Add slightly minified CRUD task.
greggirwin Apr 26, 2017
9986716
Start on circle-drawer task.
greggirwin Apr 26, 2017
16af650
Rename %timer-1.red
greggirwin Apr 27, 2017
0df90e2
Add launcher.
greggirwin Apr 27, 2017
f117429
Sort DB.
greggirwin Apr 27, 2017
889cc07
Add author in header.
greggirwin Apr 27, 2017
d2eac97
Add first complete circle-drawer.
greggirwin Apr 27, 2017
ffd7f30
Add circle-drawer with internals viz.
greggirwin Apr 27, 2017
83f704a
Use x/y for pair values in `distance`.
greggirwin Apr 27, 2017
51d7c54
Prevent moving past last command when redoing.
greggirwin Apr 28, 2017
1f559be
Use MAX_RADIUS constant.
greggirwin Apr 28, 2017
101e23a
Add quick remote execution and description
maximvl May 1, 2017
c991178
Merge pull request #1 from maximvl/master
greggirwin May 2, 2017
4d52c0c
Add Max's credit, change repo, refactor slightly.
greggirwin May 2, 2017
5c16bde
Update readme.md.
greggirwin May 2, 2017
ab562dc
Merge branch 'master' of https://github.com/eugenkiss/7guis
greggirwin Jun 14, 2017
704c08e
Update `enabled?` facet name for new Red releases and style/date chan…
greggirwin Nov 15, 2017
c90eb56
New version of flight booker, that uses date! datatype.
greggirwin Nov 15, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions Red/flight-booking-2.red
Expand Up @@ -37,18 +37,18 @@ ok-to-book?: does [
]
]
view [
style field: field 150 "2017-12-24" on-change [
style field: field 150 on-change [
face/color: either any [date-valid? face empty? face/text] [none][red]
dates/(face/extra): parse-date face
book-it/enable?: ok-to-book?
book-it/enabled?: ok-to-book?
]
below
flight-type: drop-list 150 data ["one-way flight" "return flight"] select 1 on-change [
return-date/enable?: not one-way?
book-it/enable?: ok-to-book?
return-date/enabled?: not one-way?
book-it/enabled?: ok-to-book?
]
text italic snow navy "Enter dates in yyyy-mm-dd format"
depart-date: field extra 'depart hint "depart date"
return-date: field extra 'return hint "return date" disabled
depart-date: field "2017-12-24" extra 'depart hint "depart date"
return-date: field "2017-12-24" extra 'return hint "return date" disabled
book-it: button "Book" [book-ticket]
]
56 changes: 56 additions & 0 deletions Red/flight-booking-3.red
@@ -0,0 +1,56 @@
Red [
author: "Gregg Irwin"
notes: "Uses date! datatype, which includes time support."
]

def-date: 24-Dec-2017
dates: reduce ['depart def-date 'return def-date]

;return-before-depart?: does [attempt [dates/return < dates/depart]]
depart-before-return?: does [all [both-dates-OK? dates/return > dates/depart]]
one-way?: does [flight-type/selected = 1]
;return-flight?: does [flight-type/selected = 2]
flight-desc: does [pick flight-type/data flight-type/selected]
flight-date: does [either one-way? [dates/depart][dates/return]]

book-ticket: has [str][
str: form reduce ["You have booked a" flight-desc "on" flight-date]
view/flags [below text str button "OK" [unview]] [modal popup]
]

load-date: func [input [string! object!]][
if object? input [input: input/text]
attempt [load input]
]

; Only allow current or future dates
date-valid?: func [input /local d][
all [date? d: load-date input d >= now]
]

; OK as long as they're not none
both-dates-OK?: does [all [dates/depart dates/return]]

ok-to-book?: does [
to logic! either one-way? [dates/depart][
all [both-dates-OK? depart-before-return?]
]
]

view [
style field: field 150 "24-Dec-2017" on-change [
face/color: either any [date-valid? face empty? face/text] [none][red]
dates/(face/extra): load-date face
book-it/enabled?: ok-to-book?
]
below
flight-type: drop-list 150 data ["one-way flight" "return flight"] select 1 on-change [
return-date/enabled?: not one-way?
book-it/enabled?: ok-to-book?
]
text italic snow navy "Enter dates in dd-mmm-yyyy format"
text italic snow navy "Time is optional: dd-mmm-yyyy/hh:mm:ss"
depart-date: field extra 'depart hint "depart date"
return-date: field extra 'return hint "return date" disabled
book-it: button "Book" [book-ticket]
]
10 changes: 5 additions & 5 deletions Red/flight-booking.red
Expand Up @@ -31,16 +31,16 @@ ok-to-book?: does [
]
]
view [
style field: field 150 "2017-12-24" on-change [
style field: field 150 on-change [
face/color: either date-valid? face [none][red]
book-it/enable?: ok-to-book?
book-it/enabled?: ok-to-book?
]
below
flight-type: drop-list 150 data ["one-way flight" "return flight"] select 1 on-change [
return-date/enable?: not one-way?
return-date/enabled?: not one-way?
]
text italic snow navy "Enter dates in yyyy-mm-dd format"
depart-date: field hint "depart date"
return-date: field hint "return date" disabled
depart-date: field "2017-12-24" hint "depart date"
return-date: field "2017-12-24" hint "return date" disabled
book-it: button "Book" [book-ticket]
]