Skip to content

Instantly share code, notes, and snippets.

@mnapthine
Last active October 16, 2018 12:54
Show Gist options
  • Save mnapthine/64c5eb45c196d1e6bfa831c97c5a0596 to your computer and use it in GitHub Desktop.
Save mnapthine/64c5eb45c196d1e6bfa831c97c5a0596 to your computer and use it in GitHub Desktop.

Fire up Lando!

Ensure all projects are up and running.

Seed data

You first need to put some users in the database. You do this by running this test command from inside your panda directory: lando yarn test:seed

This will out the users added to your screen.

GraphQL interface

Go to the Panda GraphQL interface where we can use anything that the backend has implemented directly: http://panda.lndo.site/graphql

Click the settings cog in the top right and change the request.credentials: "whateverItIs" value to: "request.credentials": "include"

Click Save setting in the top right.

Add a users query

Click the big plus icon.

Insert the following query into the left side:

{
  users {
    username
  }
}

Press the play button. This should respend back with the users that where created after running lando yarn test:seed inside of Puma.

Add a login mutation

Click the big plus icon.

Insert the following mutation into the left side:

# Try to write your query here
  mutation Login(
    $username: String
    $password: String!
  ) {
    login(
      username: $username
      password: $password
    ) {
      id
      username
      email
    }
  }

At the bottom of the left side we need to insert the variable valuses which are used/referanced in the above mutaion. Click 'Query Variables'

Insert the following but replace the username and password with one that was inserted into your local database, ensure it says something lie superuser as this will have the permissions you need :

{
  "username": "Test.Superuser.Queenie69",
  "password": "Test.Superuser.Queenie69"
}

Press play and this will log you in.

Add a addPage mutation

Click the big plus icon.

Insert the following mutation into the left side:

mutation AddPage(
    $language: String
    $type: String
  	$title: String
    $description: String
    $slug: String
    $imgUrl: String
    $imgUuid: String
    $imgCrop: String
    $ldJSON: JSON
    $metas: [MetaInput]
    $content: [ComponentInput]
  ) {
    addPage(
      input: {
        title:$title
        description:$description
        language: $language
        type: $type
        slug: $slug
        image: { url: $imgUrl, uuid: $imgUuid, crop: $imgCrop }
        meta: $metas
        ldJSON: $ldJSON
        content: $content
      }
    ) {
      id
      title
      description
      language
      author
      createdAt
      lastModified
      published
      type
      slug
      image {
        url
        uuid
        crop
      }
      meta {
        type
        value
        content
      }
      ldJSON
      content {
        id
        title
      }
    }
  }

At the bottom of the left side we need to insert the variable valuses which are used/referanced in the above mutaion. Click 'Query Variables and insert the following, this is the data or the page.

{
  "language": "en",
  "type": "ProductPage",
  "slug": "/puma-panda",
  "title": "myEnglish ",
  "description": "Experience the British Council classroom online, anytime, anywhere in India. This is some extra text to demonstrate that there is sometimes some truncation.",
  "ldJSON": {
   "@context":"http://schema.org",
   "@type":"Course",
   "name":"myEnglish",
   "description":"Experience the British Council classroom online from anywhere in India!",
   "image":"https://ucarecdn.com/052d0160-a3a0-41a8-9a60-1c8baac953f8/BCwomanfacingbuildings1260x708.jpg",
   "thumbnailUrl":"https://ucarecdn.com/052d0160-a3a0-41a8-9a60-1c8baac953f8/BCwomanfacingbuildings1260x708.jpg",
   "provider":{
      "@type":"Organization",
      "name":"British Council India",
      "sameAs":"https://britishcouncil.in"
   },
   "audience":[
      {
         "@type":"EducationalAudience",
         "audienceType":[
            "Pre Intermediate",
            "Intermediate",
            "Upper Intermediate"
         ],
         "geographicArea":"India",
         "educationalRole":"Student"
      }
   ],
   "educationalAlignment":{
      "@type":"AlignmentObject",
      "alignmentType":"educationalLevel",
      "educationalFramework":"CEF",
      "targetName":[
         "A2",
         "B1",
         "B2"
      ],
      "targetUrl":"https://www.coe.int/en/web/common-european-framework-reference-languages"
   },
   "offers":{
      "@type":"Offer",
      "availability":"http://schema.org/InStock",
      "price":"9,500",
      "priceCurrency":"INR"
  }
  },
  "content": [
    {
      "type": "ProductHero",
      "title": "myEnglish",
      "body": ["Experience the British Council classroom online, anytime, anywhere."],
      "media": {
        "type": "image",
        "mediaInfo": {
          "uuid": "e68ea356-e6e9-4823-ab42-f6e08f45185f",
          "cdnUrl": "https://ucarecdn.com/4b730b1a-f27e-4f62-a985-182559164a67/",
          "sourceInfo": {
            "source": "uploaded"
          }
        }
      },
      "actions": [
        {
          "text": "Book a free consultation",
          "url": "https://www.britishcouncil.in/english/register/book-a-consultation",
          "newWindow": false
        }
      ],
      "textItems": ["Online", "50 hours", "Six weeks", "INR 9,500"],
      "settings": [
        {
          "key": "theme",
          "value": "darkmode"
        },
        {
          "key": "backgroundColour",
          "value": "red"
        },
        {
          "key": "button",
          "value": "large"
        }
      ],
      "weight": 0
    },
    {
      "type": "FeatureTilesList",
      "items": [
        {
          "weight": 0,
          "type": "Animation",
          "title": "Flexible learning",
          "media": {
            "type": "animation",
            "mediaInfo": "springIcon"
          },
          "body": ["A combination of live online classes and guided self-study​."]
        },
        {
          "weight": 1,
          "type": "Animation",
          "title": "Personal support",
          "media": {
            "type": "animation",
            "mediaInfo": "lifeSaverIcon"
          },
          "body": ["Your teacher follows your progress and gives individual feedback and guidance."]
        },
        {
          "weight": 2,
          "type": "Animation",
          "title": "International recognition",
          "media": {
            "type": "animation",
            "mediaInfo": "twigIcon"
          },
          "body": ["British Council certificates are trusted by employers across the world."]
        }
      ],
      "settings": [
        {
          "key": "itemsMax",
          "value": 2
        },
        {
           "key": "uploaderTabs",
          "value": "icon"
        }
      ],
      "weight": 1
    },
    {
      "type": "ZigzagList",
      "title": "How it works",
      "items": [
        {
          "weight": 0,
          "type": "TDI",
          "title": "Live online classes",
          "media": {
            "type": "image",
            "alt": "A graphic showing an group chat with questions and answers.",
            "mediaInfo": {
              "uuid": "b2aea4f7-bab4-474e-a89b-588de1b748b6",
              "cdnUrl": "https://ucarecdn.com/b2aea4f7-bab4-474e-a89b-588de1b748b6/",
              "sourceInfo": {
                "source": "uploaded"
              }
            }
          },
          "body": [
            "Join your teacher and classmates for two hours each week.",
            "Develop your communication skills by participating in group discussions and practising real life scenarios."
          ]
        },
        {
          "weight": 1,
          "type": "TDI",
          "title": "Study at a time that suits you",
          "media": {
            "type": "image",
            "mediaInfo": {
              "uuid": "b26af91e-8f29-459f-b6fe-d23063b49814",
              "cdnUrl": "https://ucarecdn.com/b26af91e-8f29-459f-b6fe-d23063b49814/",
              "sourceInfo": {
                "source": "uploaded"
              }
            },
            "alt": "A light graphic depicting a desktop and a laptop in an Apple like finish."
          },
          "body": [
            "Work at your own pace through online activities, videos and forum discussions and improve your pronunciation, speaking, grammar and vocabulary."
          ]
        },
        {
          "weight": 2,
          "type": "TDI",
          "title": "Track your learning progress",
          "media": {
            "type": "image",
            "uuid": "",
            "mediaInfo": {
              "uuid": "ad61cb6c-f716-4616-86d1-05d311a0b245",
              "cdnUrl": "https://ucarecdn.com/ad61cb6c-f716-4616-86d1-05d311a0b245/",
              "sourceInfo": {
                "source": "uploaded"
              }
            },
            "alt": "A graphic depicting a bar chart with the myEnglish modules listed along the x-axis plotting a path to success."
          },
          "body": [
            "Learning is based on the Common European Framework of Reference for languages (CEFR) – an international standard for describing language ability, which allows you and your teacher to track your learning progress. You'll receive personalised feedback and guidance from your teacher on a regular basis."
          ]
        }
      ],
      "settings": [
        {
          "key": "itemsMax",
          "value": 5
        }
      ],
      "weight": 2
    },
    {
      "type": "FlipCardCarousel",
      "title": "What you will learn",
      "body": [
        "myEnglish has three levels based on the Common European Framework of Reference for languages (CEFR). Each level has three modules that can be taken in any order."
      ],
      "items": [
        {
          "weight": 0,
          "type": "TDI",
          "titleLead": "Pre-intermediate",
          "title": "Module 1",
          "textItems": [
            "describing your family",
            "writing emails",
            "delivering presentations",
            "time management",
            "numbers and statistics"
          ],
          "actions": [
            {
              "text": "Find class times"
            }
          ]
        },
        {
          "weight": 1,
          "type": "TDI",
          "titleLead": "Pre-intermediate",
          "title": "Module 1",
          "body": [
            "Starts every three weeks.<br />Next start date: 13 May 2018.",
            "Your two hour live class:<br />Sundays 11:30 to 13:30."
          ],
          "actions": [
            {
              "text": "Back to course outline"
            }
          ]
        },
        {
          "weight": 2,
          "type": "TDI",
          "titleLead": "Pre-intermediate",
          "title": "Module 2",
          "textItems": [
            "describing experiences",
            "making suggestions",
            "vocabulary for travelling",
            "developing a workplace schedule",
            "presentations to persuade others"
          ],
          "actions": [
            {
              "text": "Find class times"
            }
          ]
        },
        {
          "weight": 3,
          "type": "TDI",
          "titleLead": "Pre-intermediate",
          "title": "Module 2",
          "body": [
            "Starts every three weeks.",
            "Choose your two hour live class time before you register from a range of weekday or weekend options."
          ],
          "actions": [
            {
              "text": "Back to course outline"
            }
          ]
        },
        {
          "weight": 4,
          "type": "TDI",
          "titleLead": "Pre-intermediate",
          "title": "Module 3",
          "textItems": [
            "making plans and arrangements",
            "technology and the internet",
            "enquiries and bookings",
            "reviews of arts and entertainment",
            "preparing for job interviews"
          ],
          "actions": [
            {
              "text": "Find class times"
            }
          ]
        },
        {
          "weight": 5,
          "type": "TDI",
          "titleLead": "Pre-intermediate",
          "title": "Module 3",
          "body": [
            "Starts every three weeks.<br />Next start date: 22 April 2018.",
            "Your two hour live class option:<br />Sundays 11:30 to 13:30."
          ],
          "actions": [
            {
              "text": "Back to course outline"
            }
          ]
        },
        {
          "weight": 6,
          "type": "TDI",
          "titleLead": "Intermediate",
          "title": "Module 1",
          "textItems": [
            "describing places and things",
            "clothes and comparing items",
            "formal and informal conversations",
            "delivering presentations",
            "suggestions and complaints"
          ],
          "actions": [
            {
              "text": "Find class times"
            }
          ]
        },
        {
          "weight": 7,
          "type": "TDI",
          "titleLead": "Intermediate",
          "title": "Module 1",
          "body": [
            "Starts every three weeks.<br />Next start date: 21 April 2018.",
            "Your two hour live class:<br />Saturdays 09:00 to 11:00."
          ],
          "actions": [
            {
              "text": "Back to course outline"
            }
          ]
        },
        {
          "weight": 8,
          "type": "TDI",
          "titleLead": "Intermediate",
          "title": "Module 2",
          "textItems": [
            "money, travelling and shopping",
            "direct and indirect questions",
            "improving writing skills",
            "expressing your viewpoints",
            "writing a job application"
          ],
          "actions": [
            {
              "text": "Find class times"
            }
          ]
        },
        {
          "weight": 9,
          "type": "TDI",
          "titleLead": "Intermediate",
          "title": "Module 2",
          "body": [
            "Starts every three weeks.<br />Next start date: 21 April 2018.",
            "Your two hour live class:<br />Saturdays 14:00 to 16:00."
          ],
          "actions": [
            {
              "text": "Back to course outline"
            }
          ]
        },
        {
          "weight": 10,
          "type": "TDI",
          "titleLead": "Intermediate",
          "title": "Module 3",
          "textItems": [
            "crime and the law",
            "health and the body",
            "adventure sports",
            "using international English",
            "writing brief messages"
          ],
          "actions": [
            {
              "text": "Find class times"
            }
          ]
        },
        {
          "weight": 11,
          "type": "TDI",
          "titleLead": "Intermediate",
          "title": "Module 3",
          "body": [
            "Starts every three weeks.<br />Next start date: 13 May.",
            "Your two hour live classes:<br />Sundays 14:00 to 16:00."
          ],
          "actions": [
            {
              "text": "Back to course outline"
            }
          ]
        },
        {
          "weight": 12,
          "type": "TDI",
          "titleLead": "Upper-intermediate",
          "title": "Module 1",
          "textItems": [
            "festivals and celebrations",
            "clothes and costumes",
            "describing an event",
            "newspapers and media",
            "team working skills",
            "speaking in tenses"
          ],
          "actions": [
            {
              "text": "Find class times"
            }
          ]
        },
        {
          "weight": 13,
          "type": "TDI",
          "titleLead": "Upper-intermediate",
          "title": "Module 1",
          "body": [
            "Starts every three weeks.<br />Next start date: 24 April.",
            "Your two hour live classes:<br />Tuesdays and Thursdays 21:00 to 22:00."
          ],
          "actions": [
            {
              "text": "Back to course outline"
            }
          ]
        },
        {
          "weight": 14,
          "type": "TDI",
          "titleLead": "Upper-intermediate",
          "title": "Module 2",
          "textItems": [
            "describing people and places",
            "easily confused words and verbs",
            "vocabulary for adventure",
            "emails and time management",
            "describing problems"
          ],
          "actions": [
            {
              "text": "Find class times"
            }
          ]
        },
        {
          "weight": 15,
          "type": "TDI",
          "titleLead": "Upper-intermediate",
          "title": "Module 2",
          "body": [
            "Starts every three weeks.<br />Next start date: 12 May 2018.",
            "Your two hour live classes:<br />Saturdays 11:30 to 13:30."
          ],
          "actions": [
            {
              "text": "Back to course outline"
            }
          ]
        },
        {
          "weight": 16,
          "type": "TDI",
          "titleLead": "Upper-intermediate",
          "title": "Module 3",
          "textItems": [
            "money, finance and banking",
            "reviewing films and books",
            "making and declining requests",
            "mysteries and the unexplained",
            "speculating about the past​"
          ],
          "actions": [
            {
              "text": "Find class times"
            }
          ]
        },
        {
          "weight": 17,
          "type": "TDI",
          "titleLead": "Upper-intermediate",
          "title": "Module 3",
          "body": [
            "Starts every three weeks.<br />Next start date: 13 May 2018.",
            "Your two hour live class options:<br />Sundays 09:00 to 11:00 or<br />Wednesdays and Fridays 21:00 to 22:00."
          ],
          "actions": [
            {
              "text": "Back to course outline"
            }
          ]
        }
      ],
      "weight": 3
    },
    {
      "type": "ProductCTA",
      "media": {
        "type": "icon",
        "mediaInfo": "calendar"
      },
      "title": "Book a free consultation",
      "body": [
        "Arrange a time for us to call you. We will assess your English skills to help you start the course at the correct level."
      ],
      "actions": [
        {
          "text": "Book now",
          "url": "https://www.britishcouncil.in/english/register/book-a-consultation",
          "newWindow": false
        }
      ],
      "weight": 4,
      "settings": [
        {
          "key": "uploaderTabs",
          "value": "icon"
        }
      ]
    },
    {
      "type": "ProfilesList",
      "items": [
        {
          "type": "TDI",
          "media": {
            "type": "image",
            "alt": "Purbani Das, myEnglish teacher, Bangalore",
            "mediaInfo": {
              "uuid": "eda2fc7e-346b-4b39-806b-814a34c7ba6f",
              "cdnUrl": "https://ucarecdn.com/eda2fc7e-346b-4b39-806b-814a34c7ba6f/",
              "sourceInfo": {
                "source": "uploaded"
              }
            }
          },

          "title": "Meet Purbani Das",
          "subTitle": "English teacher, Bangalore",
          "weight": 0,
          "body": [
            "I’ve been teaching English for three years. I worked in England before joining the myEnglish team. My favourite thing about teaching online is the flexibility it offers. My interests include literature, pop culture and the fine arts."
          ]
        },
        {
          "weight": 1,
          "type": "TDI",
          "media": {
            "type": "image",
            "alt": "Avinash Govindarajan, myEnglish teacher, Gurgaon",
            "mediaInfo": {
              "uuid": "3fd61f73-d2c1-4260-aa72-919bf7905b57",
              "cdnUrl": "https://ucarecdn.com/3fd61f73-d2c1-4260-aa72-919bf7905b57/",
              "sourceInfo": {
                "source": "uploaded"
              }
            }
          },
          "title": "Meet Avinash Govindarajan",
          "subTitle": "English teacher, Gurgaon",
          "body": [
            "I love exploring how English use varies across cultures and countries, especially with humour. I am interested in music and the visual arts and when I'm not teaching I play the guitar or make movies."
          ]
        },
        {
          "weight": 2,
          "type": "TDI",
          "media": {
            "type": "image",
            "alt": "Rajul Goveas, myEnglish teacher, Mumbai",
            "mediaInfo": {
              "uuid": "1d93a37a-c9bd-424b-a839-a2f2a887db06",
              "cdnUrl": "https://ucarecdn.com/1d93a37a-c9bd-424b-a839-a2f2a887db06/",
              "sourceInfo": {
                "source": "uploaded"
              }
            }
          },
          "title": "Meet Rajul Goveas",
          "subTitle": "English teacher, Mumbai",
          "body": [
            "Before joining myEnglish, I taught English to underprivileged young learners and spoken English to young adults. I like the challenge of interacting with learners online while developing their language skills. I love travelling, jazz and yoga."
          ]
        }
      ],
      "weight": 5
    }
  ]
}

Press play and this will add the page.

Publish the page

Go to http://puma.lndo.site/admin/ (you should already be logged in but if not use the same credentials you did before). Click on the item and publish it. Copy the page id found in the url.

Update Rhino

Find the myenglish.js page inside Rhino and change the id to the one you have copied from your database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment