From 786a2dc0bd59aa2039f0cf28a2018c9722c4c739 Mon Sep 17 00:00:00 2001 From: Taru Airola Date: Sun, 20 Oct 2019 20:37:14 +0300 Subject: [PATCH] Add description field to workshops --- app/assets/stylesheets/partials/_admin_workshop.scss | 3 +++ app/controllers/admin/workshops_controller.rb | 2 +- app/views/admin/workshops/_edit_form.html.haml | 10 ++++++++++ app/views/admin/workshops/_form.html.haml | 10 ++++++++++ app/views/admin/workshops/show.html.haml | 3 +++ app/views/workshops/show.html.haml | 4 +++- config/locales/de.yml | 2 ++ config/locales/en.yml | 2 ++ config/locales/en_AU.yml | 2 ++ config/locales/en_GB.yml | 2 ++ config/locales/en_US.yml | 2 ++ config/locales/es.yml | 2 ++ config/locales/fi.yml | 2 ++ config/locales/fr.yml | 2 ++ config/locales/no.yml | 2 ++ 15 files changed, 48 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/partials/_admin_workshop.scss b/app/assets/stylesheets/partials/_admin_workshop.scss index 333f57f52..c6925c20e 100644 --- a/app/assets/stylesheets/partials/_admin_workshop.scss +++ b/app/assets/stylesheets/partials/_admin_workshop.scss @@ -2,3 +2,6 @@ padding-top: 10px; } +#workshop_description { + height: 150px; +} diff --git a/app/controllers/admin/workshops_controller.rb b/app/controllers/admin/workshops_controller.rb index 70c7b8ed8..6b4ec62fe 100644 --- a/app/controllers/admin/workshops_controller.rb +++ b/app/controllers/admin/workshops_controller.rb @@ -100,7 +100,7 @@ def destroy def workshop_params params.require(:workshop).permit(:local_date, :local_time, :chapter_id, :invitable, :seats, :rsvp_open_local_date, - :rsvp_open_local_time, :ends_at, sponsor_ids: []) + :rsvp_open_local_time, :ends_at, :description, sponsor_ids: []) end def chapter_id diff --git a/app/views/admin/workshops/_edit_form.html.haml b/app/views/admin/workshops/_edit_form.html.haml index 4f7013ecb..f2aeb1dfa 100644 --- a/app/views/admin/workshops/_edit_form.html.haml +++ b/app/views/admin/workshops/_edit_form.html.haml @@ -13,10 +13,20 @@ .row .large-6.columns = f.input :host, as: :select, collection: Sponsor.all, include_blank: true, selected: (@workshop.host.id rescue '') + %br .row .large-6.columns = f.association :sponsors %br + .row + .large-6.columns + %h6 Default description text: + %small= t("workshops.lead") + .row + .large-6.columns + = f.input :description, as: :text, label: 'Additional description (supports HTML)', + placeholder: 'Use this space to write a description of the workshop.' + %br .row .large-6.columns .panel.callout diff --git a/app/views/admin/workshops/_form.html.haml b/app/views/admin/workshops/_form.html.haml index b0075142e..f4eddb33b 100644 --- a/app/views/admin/workshops/_form.html.haml +++ b/app/views/admin/workshops/_form.html.haml @@ -17,6 +17,16 @@ .medium-6.columns.admin_margin = f.association :sponsors, required: true %br + .row + .large-6.columns + %h6 Default description text: + %p + %small= t("workshops.lead") + .row + .large-6.columns + = f.input :description, as: :text, label: 'Additional description (supports HTML)', + placeholder: 'Use this space to write a description of the workshop.' + %br .row .large-6.columns .panel.callout diff --git a/app/views/admin/workshops/show.html.haml b/app/views/admin/workshops/show.html.haml index c5891ad54..d3fb30da2 100644 --- a/app/views/admin/workshops/show.html.haml +++ b/app/views/admin/workshops/show.html.haml @@ -47,6 +47,9 @@ %strong.label.round.primary #{@workshop.venue.seats} student spots, #{@workshop.venue.coach_spots} coach spots - unless @workshop.spaces? %label.label.round.warning Full + %p.description + %br + = sanitize(@workshop.description) %br .row .large-3.small-6.columns#host diff --git a/app/views/workshops/show.html.haml b/app/views/workshops/show.html.haml index 7b56bd7b2..6f53cfff9 100644 --- a/app/views/workshops/show.html.haml +++ b/app/views/workshops/show.html.haml @@ -18,7 +18,9 @@ .row .medium-12.columns %p.lead - Attend our workshops to learn programming in a safe and supportive environment at your own pace, or to share your knowledge and coach our students. + = t("workshops.lead") + %p.description + = sanitize(@workshop.description) - unless current_user and current_user.banned? = render 'workshop_actions' diff --git a/config/locales/de.yml b/config/locales/de.yml index 5c7c21107..66515d12f 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -123,6 +123,8 @@ de: paper: "Benutze Stift und Papier oder ein Whiteboard! Viele der Lernenden haben keine Vorgeschichte mit der Informatik. Zeichnungen und visuelle Hilfen können sehr nützlich sein." stubling: "Lasse zu, dass die Lernenden auch mal stolpern. Wir lernen aus Fehlern, indem wir unseren eigenen Weg von der Frustration zur Lösung des Problems finden. Stehe den Lernenden unterstützend zur Seite, aber lass sie selbständig erkunden." suggestions: "Hast du noch Vorschläge? Eröffne einen pull request oder erstelle eine issue\"" + workshops: + lead: "Attend our workshops to learn programming in a safe and supportive environment at your own pace, or to share your knowledge and coach our students." events: title: "Veranstaltungen" past: "Vergangene" diff --git a/config/locales/en.yml b/config/locales/en.yml index 28cb1033b..c8b4b5fee 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -125,6 +125,8 @@ en: paper: "Use pen and paper or go to a whiteboard! Often students are coming from a non-technical background. Drawing and explaining with visual material is really helpful." stubling: "Let them stumble. We learn by making mistakes, getting frustrated, and working through problem in our own way. Be supportive, but let them explore." suggestions: "Do you have something to suggest? Make a pull request or create an issue" + workshops: + lead: "Attend our workshops to learn programming in a safe and supportive environment at your own pace, or to share your knowledge and coach our students." events: title: "Events" past: "Past" diff --git a/config/locales/en_AU.yml b/config/locales/en_AU.yml index ece44eaed..74c52f2e4 100644 --- a/config/locales/en_AU.yml +++ b/config/locales/en_AU.yml @@ -123,6 +123,8 @@ en-AU: paper: "Use pen and paper or go to a whiteboard! Often students are coming from a non-technical background. Drawing and explaining with visual material is really helpful." stubling: "Let them stumble. We learn by making mistakes, getting frustrated, and working through problem in our own way. Be supportive, but let them explore." suggestions: "Do you have something to suggest? Make a pull request or create an issue" + workshops: + lead: "Attend our workshops to learn programming in a safe and supportive environment at your own pace, or to share your knowledge and coach our students." events: title: "Events" past: "Past" diff --git a/config/locales/en_GB.yml b/config/locales/en_GB.yml index 1c4c27425..9969ef354 100644 --- a/config/locales/en_GB.yml +++ b/config/locales/en_GB.yml @@ -123,6 +123,8 @@ en-GB: paper: "Use pen and paper or go to a whiteboard! Often students are coming from a non-technical background. Drawing and explaining with visual material is really helpful." stubling: "Let them stumble. We learn by making mistakes, getting frustrated, and working through problems in our own ways. Be supportive, but let them explore." suggestions: "Do you have something to suggest? Make a pull request or create an issue" + workshops: + lead: "Attend our workshops to learn programming in a safe and supportive environment at your own pace, or to share your knowledge and coach our students." events: title: "Events" past: "Past" diff --git a/config/locales/en_US.yml b/config/locales/en_US.yml index ff4b19511..1c409b090 100644 --- a/config/locales/en_US.yml +++ b/config/locales/en_US.yml @@ -123,6 +123,8 @@ en-US: paper: "Use pen and paper or go to a whiteboard! Often students are coming from a non-technical background. Drawing and explaining with visual material is really helpful." stubling: "Let them stumble. We learn by making mistakes, getting frustrated, and working through problem in our own way. Be supportive, but let them explore." suggestions: "Do you have something to suggest? Make a pull request or create an issue" + workshops: + lead: "Attend our workshops to learn programming in a safe and supportive environment at your own pace, or to share your knowledge and coach our students." events: title: "Events" past: "Past" diff --git a/config/locales/es.yml b/config/locales/es.yml index 7f1377ebe..4caed5b73 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -123,6 +123,8 @@ es: paper: "Use pen and paper or go to a whiteboard! Often students are coming from a non-technical background. Drawing and explaining with visual material is really helpful." stubling: "Let them stumble. We learn by making mistakes, getting frustrated, and working through problem in our own way. Be supportive, but let them explore." suggestions: "Do you have something to suggest? Make a pull request or create an issue" + workshops: + lead: "Attend our workshops to learn programming in a safe and supportive environment at your own pace, or to share your knowledge and coach our students." events: title: "Events" past: "Past" diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 87ededfa9..0358205d2 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -123,6 +123,8 @@ fi: paper: "Use pen and paper or go to a whiteboard! Often students are coming from a non-technical background. Drawing and explaining with visual material is really helpful." stubling: "Let them stumble. We learn by making mistakes, getting frustrated, and working through problem in our own way. Be supportive, but let them explore." suggestions: "Do you have something to suggest? Make a pull request or create an issue" + workshops: + lead: "Attend our workshops to learn programming in a safe and supportive environment at your own pace, or to share your knowledge and coach our students." events: title: "Events" past: "Past" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 876434be7..acc6fc8cf 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -123,6 +123,8 @@ fr: paper: "Use pen and paper or go to a whiteboard! Often students are coming from a non-technical background. Drawing and explaining with visual material is really helpful." stubling: "Let them stumble. We learn by making mistakes, getting frustrated, and working through problem in our own way. Be supportive, but let them explore." suggestions: "Do you have something to suggest? Make a pull request or create an issue" + workshops: + lead: "Attend our workshops to learn programming in a safe and supportive environment at your own pace, or to share your knowledge and coach our students." events: title: "Events" past: "Past" diff --git a/config/locales/no.yml b/config/locales/no.yml index 69634038e..0b1eb139e 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -123,6 +123,8 @@ paper: "Use pen and paper or go to a whiteboard! Often students are coming from a non-technical background. Drawing and explaining with visual material is really helpful." stubling: "Let them stumble. We learn by making mistakes, getting frustrated, and working through problem in our own way. Be supportive, but let them explore." suggestions: "Do you have something to suggest? Make a pull request or create an issue" + workshops: + lead: "Attend our workshops to learn programming in a safe and supportive environment at your own pace, or to share your knowledge and coach our students." events: title: "Events" past: "Past"