@@ -33,7 +33,8 @@ ui <- fluidPage(
3333 4 ,
3434 actionButton(" sample_1" , " Sample Review 1" ),
3535 actionButton(" sample_2" , " Sample Review 2" ),
36- actionButton(" sample_3" , " Sample Review 3" )
36+ actionButton(" sample_3" , " Sample Review 3" ),
37+ actionButton(" sample_4" , " Sample Review 4" )
3738 )
3839 ),
3940 shiny :: fluidRow(
@@ -47,11 +48,62 @@ server <- function(input, output, session) {
4748 req(input $ raw_title , input $ raw_review )
4849
4950 raw_html(
50- div(
51- build_pretty_output(input $ raw_title , input $ raw_review ),
52- style = htmltools :: css(" text-align" = " center" )
51+ build_pretty_output(input $ raw_title , input $ raw_review )
52+ )
53+ })
54+
55+ observeEvent(input $ sample_1 , {
56+ raw_html(
57+ build_pretty_output(
58+ " The Incredibles" ,
59+ paste(
60+ " This movie was well named - incredible!" ,
61+ " So much excitement and fun, along with quality" ,
62+ " heroes and hearty laughter. I recommend this movie highly!"
63+ )
64+ )
65+ )
66+ })
67+
68+ observeEvent(input $ sample_2 , {
69+ raw_html(
70+ build_pretty_output(
71+ " The Not So Incredibles" ,
72+ paste(
73+ " What were the writers thinking?" ,
74+ " It's almost like they forgot what their job" ,
75+ " was, or how to make a movie entertaining. This" ,
76+ " movie was bores-ville from start to finish, simply" ,
77+ " awful. Don't waste your time going to see this one!"
5378 )
5479 )
80+ )
81+ })
82+
83+ observeEvent(input $ sample_3 , {
84+ raw_html(
85+ build_pretty_output(
86+ " Questionable Questioners" ,
87+ paste(
88+ " The Questionable Questioners will make you question..." ,
89+ " Why are we here? What are we doing? Why am I writing this review?" ,
90+ " I don't know where I stand. Maybe it was not so great," ,
91+ " or maybe it was pretty good after all." ,
92+ " I think you will just have to see for yourself."
93+ )
94+ )
95+ )
96+ })
97+
98+ observeEvent(input $ sample_4 , {
99+ raw_html(
100+ build_pretty_output(
101+ " Briefing Briefers" ,
102+ paste(
103+ " What did I just watch? It was ok."
104+ )
105+ )
106+ )
55107 })
56108
57109 output $ review <- renderUI(raw_html())
@@ -120,6 +172,13 @@ build_pretty_output <- function(title, review) {
120172 shiny :: wellPanel(tags $ blockquote(review ))
121173 )
122174 }
175+
176+ return (
177+ div(
178+ ui_output ,
179+ style = htmltools :: css(" text-align" = " center" )
180+ )
181+ )
123182}
124183
125184
0 commit comments