diff --git a/13-testimonials-grid-section/build.sbt b/13-testimonials-grid-section/build.sbt index 679b96e..29e616c 100644 --- a/13-testimonials-grid-section/build.sbt +++ b/13-testimonials-grid-section/build.sbt @@ -10,6 +10,6 @@ lazy val root = (project in file(".")) libraryDependencies ++= Seq( "com.lihaoyi" %% "cask" % "0.9.1", "com.lihaoyi" %% "mainargs" % "0.5.0", - "org.thymeleaf" % "thymeleaf" % "3.1.1.RELEASE" + "org.thymeleaf" % "thymeleaf" % "3.1.1.RELEASE", ) ) diff --git a/13-testimonials-grid-section/src/main/java/testimonialsgrid/JTestimonial.java b/13-testimonials-grid-section/src/main/java/testimonialsgrid/JTestimonial.java new file mode 100644 index 0000000..4227b89 --- /dev/null +++ b/13-testimonials-grid-section/src/main/java/testimonialsgrid/JTestimonial.java @@ -0,0 +1,40 @@ +package testimonialsgrid; + +public class JTestimonial { + private String author; + private String text; + private int age; + + // Constructor + public JTestimonial(String author, String text, int age) { + this.author = author; + this.text = text; + this.age = age; + } + + // Getters + public String getAuthor() { + return author; + } + + public String getText() { + return text; + } + + public int getAge() { + return age; + } + + // Setters + public void setAuthor(String author) { + this.author = author; + } + + public void setText(String text) { + this.text = text; + } + + public void setAge(int age) { + this.age = age; + } +} diff --git a/13-testimonials-grid-section/src/main/resources/templates/index.html b/13-testimonials-grid-section/src/main/resources/templates/index.html index 66bdc73..4e8f330 100644 --- a/13-testimonials-grid-section/src/main/resources/templates/index.html +++ b/13-testimonials-grid-section/src/main/resources/templates/index.html @@ -5,8 +5,10 @@ + - + + Frontend Mentor | [Challenge Name Here] @@ -15,59 +17,82 @@ .attribution a { color: hsl(228, 45%, 44%); } - - Daniel Clifford - Verified Graduate + +
+ some unconditional text +

Daniel Clifford

+ +
- I received a job offer mid-course, and the subjects I learned were current, if not more so, - in the company I joined. I honestly feel I got every penny’s worth. +

+ "Hello" +

+ - “ I was an EMT for many years before I joined the bootcamp. I’ve been looking to make a - transition and have heard some people who had an amazing experience here. I signed up - for the free intro course and found it incredibly fun! I enrolled shortly thereafter. - The next 12 weeks was the best - and most grueling - time of my life. Since completing - the course, I’ve successfully switched careers, working as a Software Engineer at a VR startup. ” +
+ author and the text + +
+
+ Jonathan Walters + Verified Graduate - Jonathan Walters - Verified Graduate + The team was very supportive and kept me motivated - The team was very supportive and kept me motivated + “ I started as a total newbie with virtually no coding skills. I now work as a mobile engineer + for a big company. This was one of the best investments I’ve made in myself. ” +
- “ I started as a total newbie with virtually no coding skills. I now work as a mobile engineer - for a big company. This was one of the best investments I’ve made in myself. ” +
+ Jeanette Harmon + Verified Graduate - Jeanette Harmon - Verified Graduate + An overall wonderful and rewarding experience - An overall wonderful and rewarding experience + “ Thank you for the wonderful experience! I now have a job I really enjoy, and make a good living + while doing something I love. ” +
- “ Thank you for the wonderful experience! I now have a job I really enjoy, and make a good living - while doing something I love. ” +
+ Patrick Abrams + Verified Graduate - Patrick Abrams - Verified Graduate + Awesome teaching support from TAs who did the bootcamp themselves. Getting guidance from them and + learning from their experiences was easy. - Awesome teaching support from TAs who did the bootcamp themselves. Getting guidance from them and - learning from their experiences was easy. + “ The staff seem genuinely concerned about my progress which I find really refreshing. The program + gave me the confidence necessary to be able to go out in the world and present myself as a capable + junior developer. The standard is above the rest. You will get the personal attention you need from + an incredible community of smart and amazing people. ” +
- “ The staff seem genuinely concerned about my progress which I find really refreshing. The program - gave me the confidence necessary to be able to go out in the world and present myself as a capable - junior developer. The standard is above the rest. You will get the personal attention you need from - an incredible community of smart and amazing people. ” +
+ Kira Whittle + Verified Graduate - Kira Whittle - Verified Graduate + Such a life-changing experience. Highly recommended! - Such a life-changing experience. Highly recommended! - - “ Before joining the bootcamp, I’ve never written a line of code. I needed some structure from - professionals who can help me learn programming step by step. I was encouraged to enroll by a former - student of theirs who can only say wonderful things about the program. The entire curriculum and staff - did not disappoint. They were very hands-on and I never had to wait long for assistance. The agile team - project, in particular, was outstanding. It took my learning to the next level in a way that no tutorial - could ever have. In fact, I’ve often referred to it during interviews as an example of my developent - experience. It certainly helped me land a job as a full-stack developer after receiving multiple offers. - 100% recommend! ” + “ Before joining the bootcamp, I’ve never written a line of code. I needed some structure from + professionals who can help me learn programming step by step. I was encouraged to enroll by a former + student of theirs who can only say wonderful things about the program. The entire curriculum and staff + did not disappoint. They were very hands-on and I never had to wait long for assistance. The agile team + project, in particular, was outstanding. It took my learning to the next level in a way that no tutorial + could ever have. In fact, I’ve often referred to it during interviews as an example of my developent + experience. It certainly helped me land a job as a full-stack developer after receiving multiple offers. + 100% recommend! ” +
Challenge by Frontend Mentor. diff --git a/13-testimonials-grid-section/src/main/scala/testimonialsgrid/Main.scala b/13-testimonials-grid-section/src/main/scala/testimonialsgrid/Main.scala index 425c18b..d3bce98 100644 --- a/13-testimonials-grid-section/src/main/scala/testimonialsgrid/Main.scala +++ b/13-testimonials-grid-section/src/main/scala/testimonialsgrid/Main.scala @@ -7,6 +7,8 @@ import org.thymeleaf.context.Context import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver import org.thymeleaf.TemplateEngine +import scala.jdk.CollectionConverters._ + object Main { @main def run( @arg( @@ -42,7 +44,54 @@ object Main { @cask.get("/") def index() = { val context = new Context() - context.setVariable("name", s"Johny") + + import scala.beans.BeanProperty + final case class Testimonial( + @BeanProperty var author: String, + @BeanProperty var text: String, + @BeanProperty var age: Int + ) + + class CompatTestimonial { + @BeanProperty var author: String = _ + @BeanProperty var text: String = _ + @BeanProperty var age: Int = _ + + // Auxiliary constructor + def this(author: String, text: String, age: Int) = { + this() // Call to the primary constructor + this.author = author + this.text = text + this.age = age + } + } + val yo = new CompatTestimonial("Leopold", "Miawu", 188) + // val yo = Testimonial("Leopold", "Miawu", 188) + + // let's experiment. ugh + class Person( + @BeanProperty var firstName: String, + @BeanProperty var lastName: String, + @BeanProperty var age: Int + ) { + override def toString: String = + return String.format("%s, %s, %d", firstName, lastName, age) + } + val p = new Person("Efim", "Nefedov", 31) + println(p) + // println(p.getFirstName) + + val ugh = new JTestimonial("Hell", "lala", 1234) + + context.setVariable("justString", "oh why oh why") + context.setVariable("oneTestimonial", ugh) + context.setVariable( + "testimonials", + List( + new JTestimonial("Leopold", "Miawu", 91), + new JTestimonial("Aragorn", "And my sword!", 55) + ).asJava + ) val result = templateEngine.process("index", context) cask.Response( result,