From 51f75031de629ef13fb491c28af54aad504d664b Mon Sep 17 00:00:00 2001 From: Michael Q Larson Date: Thu, 12 Feb 2015 15:21:48 -0800 Subject: [PATCH] add a bunch of padding and margin related courseware, and start bootstrap courseware --- seed_data/coursewares.json | 565 +++++++++++++++++++++++++++++++------ 1 file changed, 483 insertions(+), 82 deletions(-) diff --git a/seed_data/coursewares.json b/seed_data/coursewares.json index e6970aa28b..d42436c381 100644 --- a/seed_data/coursewares.json +++ b/seed_data/coursewares.json @@ -779,9 +779,9 @@ "name": "Adjusting the Padding of an Element", "difficulty" : "0.28", "description": [ - "Change the padding of the yellow box to 20 pixels.", + "Change the padding of the green box to match that of the red box.", "An element's padding controls the amount of space between an element and its border.", - "Here, we can see that the green box and the red box and the green box are nested within the blue box.", + "Here, we can see that the green box and the red box and the green box are nested within the yellow box. Note that the red box has more padding than the green box.", "When you increase the green box's padding, it will increase the distance between the word \"padding\" and the border around the text." ], "tests": [ @@ -801,8 +801,8 @@ " text-align: center;", " }", "", - " .blue-box {", - " background-color: blue;", + " .yellow-box {", + " background-color: yellow;", " padding:10px;", " }", " ", @@ -818,7 +818,7 @@ "", "
margin
", "", - "
", + "
", "
padding
", "
padding
", "
" @@ -826,38 +826,56 @@ "challengeType": 0 }, - { - "_id" : "bad87fee1348bd9aedf08821", - "name": "Add Padding to an Element", - "difficulty" : "0.29", - "description": [ - "", - "" - ], - "tests": [ - "expect($('h1')).to.have.class('text-center');", - "expect($('h1')).to.have.text('hello world');" - ], - "challengeSeed": [ - "

hello world

" - ], - "challengeType": 0 - }, - { "_id" : "bad87fee1348bd9aedf08822", - "name": "Add a Margin to an Element", + "name": "Adjust the Margin of an Element", "difficulty" : "0.30", "description": [ - "", - "" + "Change the margin of the green box to match that of the red box.", + "An element's margin controls the amount of space between an element's border and surrounding elements.", + "Here, we can see that the green box and the red box and the green box are nested within the yellow box. Note that the red box has more margin than the green box, making it appear smaller.", + "When you increase the green box's padding, it will increase the distance between its border and surrounding elements." ], "tests": [ - "expect($('h1')).to.have.class('text-center');", - "expect($('h1')).to.have.text('hello world');" + "expect($('.green-box')).to.have.css('margin', '20px')" ], "challengeSeed": [ - "

hello world

" + "", + "
margin
", + "", + "
", + "
padding
", + "
padding
", + "
" ], "challengeType": 0 }, @@ -867,69 +885,209 @@ "name": "Add a Negative Margin to an Element", "difficulty" : "0.31", "description": [ - "", - "" + "Change the margin of the green box to a negative value, so it fills the entire horizontal width of the blue box.", + "An element's margin controls the amount of space between an element's border and surrounding elements.", + "If you set an element's margin to a negative value, the element will grow larger.", + "Try to set the margin to a negative value like the one for the red box." ], "tests": [ - "expect($('h1')).to.have.class('text-center');", - "expect($('h1')).to.have.text('hello world');" + "expect($('.green-box')).to.have.css('margin', '-15px')" ], "challengeSeed": [ - "

hello world

" + "", + "", + "
", + "
padding
", + "
padding
", + "
" ], "challengeType": 0 }, { "_id" : "bad87fee1348bd9aedf08824", - "name": "Add Padding Only to the Top and Bottom of an Element", + "name": "Add Different Padding to Each Side of an Element TEST", "difficulty" : "0.32", "description": [ - "", - "" + "Give the green box a padding of 40 pixels on its top and left side, but only 20 pixels on its bottom and right side.", + "Sometimes you will want to customize an element so that it has different padding on each of its sides.", + "CSS allows you to control the padding of an element on all four sides with padding-top, padding-right, padding-bottom, and padding-left attributes." ], "tests": [ - "expect($('h1')).to.have.class('text-center');", - "expect($('h1')).to.have.text('hello world');" + "expect($('.green-box')).to.have.css('padding-bottom', '20px')", + "expect($('.green-box')).to.have.css('padding-left', '40px')" ], "challengeSeed": [ - "

hello world

" + "", + "
margin
", + "", + "
", + "
padding
", + "
padding
", + "
" ], "challengeType": 0 }, { - "_id" : "bad87fee1348bd9aedf08825", - "name": "Add Margin Only to the Left and Right of an Element", - "difficulty" : "0.33", + "_id" : "bad87fee1248bd9aedf08824", + "name": "Add Different a Margin to Each Side of an Element TEST", + "difficulty" : "0.32", "description": [ - "", - "" + "Give the green box a margin of 40 pixels on its top and left side, but only 20 pixels on its bottom and right side.", + "Sometimes you will want to customize an element so that it has a different margin on each of its sides.", + "CSS allows you to control the margin of an element on all four sides with margin-top, margin-right, margin-bottom, and margin-left attributes." ], "tests": [ - "expect($('h1')).to.have.class('text-center');", - "expect($('h1')).to.have.text('hello world');" + "expect($('.green-box')).to.have.css('margin-bottom', '20px')", + "expect($('.green-box')).to.have.css('margin-left', '40px')" ], "challengeSeed": [ - "

hello world

" + "", + "
margin
", + "", + "
", + "
padding
", + "
padding
", + "
" ], "challengeType": 0 }, { "_id" : "bad87fee1348bd9aedf08826", - "name": "Use Clockwise Padding Notation", + "name": "Use Clockwise Notation to Specify an Element's Padding", "difficulty" : "0.34", "description": [ - "", - "" + "Use Clockwise Notation to give an element padding of 40 pixels on its top and left side, but only 20 pixels on its bottom and right side.", + "Instead of specifying an element's padding-top, padding-right, padding-bottom, and padding-left attributes, you can specify them all in one line, like this: padding: 10px 20px 10px 20px;.", + "These four values work like a clock: top, right, bottom, left, and will produce the exact same result as using the side-specific padding instructions.", + "You can also use this notation for margins!" ], "tests": [ - "expect($('h1')).to.have.class('text-center');", - "expect($('h1')).to.have.text('hello world');" + "expect($('.green-box')).to.have.css('margin-bottom', '20px')", + "expect($('.green-box')).to.have.css('margin-left', '40px')" ], "challengeSeed": [ - "

hello world

" + "", + "
margin
", + "", + "
", + "
padding
", + "
padding
", + "
" ], "challengeType": 0 }, @@ -950,14 +1108,22 @@ ], "challengeSeed": [ "", - "

hello world

", - "

cat photo app

", - "

lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

", - "" + "

cat photo app

", + "", + "
", + "This is a link to Google", + "
" ], "challengeType": 0 }, @@ -967,25 +1133,25 @@ "name": "Center Text with Bootstrap", "difficulty" : "0.36", "description": [ - "Add Bootstrap's text-center class to your h1 and h2 elements.", - "Now that we're using Bootstrap, we can center our heading elements (h1 and h2) to make them look better. All we need to do is add the class text-center to the h1 and h2 elements.", + "Add Bootstrap's text-center class to your h2 element.", + "Now that we're using Bootstrap, we can center our heading elements (h2) to make them look better. All we need to do is add the class text-center to the h1 and h2 elements.", "Note that you can add several classes to the same element by seperating each of them with a space, like this: <h2 class=\"text-red text-center\">your text</h2>." ], "tests": [ - "expect($('h1')).to.have.class('text-center');", "expect($('h2')).to.have.class('text-center');" ], "challengeSeed": [ "", - "

hello world

", - "

cat photo app

", - "

lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

", - "" + "

cat photo app

", + "", + "
" ], "challengeType": 0 }, @@ -995,25 +1161,260 @@ "name": "Create a Button", "difficulty" : "0.37", "description": [ - "Create a bootstrap button with the class .", - "Now that we're using Bootstrap, we can center our heading elements (h1 and h2) to make them look better. All we need to do is add the class text-center to the h1 and h2 elements.", - "Note that you can add several classes to the same element by seperating each of them with a space, like this: <h2 class=\"text-red text-center\">your text</h2>." + "Create a button with the text \"Delete\" using the HTML button element.", + "HTML has special elements that function like links, but look like buttons. Let's creating a default HTML button." ], "tests": [ - "expect($('h1')).to.have.class('text-center');", - "expect($('h2')).to.have.class('text-center');" + "expect((/delete/gi).test($('button').text())).to.be.true;" ], "challengeSeed": [ "", - "

hello world

", - "

cat photo app

", - "

lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

", - "" + "

cat photo app

", + "", + "
", + "", + "
" + ], + "challengeType": 0 + }, + + { + "_id" : "bad87fee1348cd8acdf08812", + "name": "Create a Bootstrap Button", + "difficulty" : "0.37", + "description": [ + "Apply the Bootstrap's btn class to both of your buttons.", + "Bootstrap has its own button styles, which look much better than the plain HTML ones." + ], + "tests": [ + "expect($('.btn').length).to.eql(2);" + ], + "challengeSeed": [ + "", + "

cat photo app

", + "", + "
", + "", + "
", + "" + ], + "challengeType": 0 + }, + + { + "_id" : "bad87fee1348cd8acef08812", + "name": "Create a Block Element Bootstrap Button", + "difficulty" : "0.37", + "description": [ + "Add Bootstrap's btn-block class to both of your buttons.", + "Normally, your buttons are only as wide as the text they contain. By making them block elements, your button will stretch to fill your page's entire horizontal space.", + "Note that these buttons still need the btn class." + ], + "tests": [ + "expect($('.btn-block').length).to.eql(2);" + ], + "challengeSeed": [ + "", + "

cat photo app

", + "", + "
", + "", + "
", + "" + ], + "challengeType": 0 + }, + + { + "_id" : "bad87fee1348cd8acef08812", + "name": "Color a Bootstrap Button with Button Primary", + "difficulty" : "0.37", + "description": [ + "Add Bootstrap's btn-block class to both of your buttons.", + "Normally, your buttons are only as wide as the text they contain. By making them block elements, your button will stretch to fill your page's entire horizontal space.", + "Note that these buttons still need the btn class." + ], + "tests": [ + "expect($('.btn-block').length).to.eql(2);" + ], + "challengeSeed": [ + "", + "

cat photo app

", + "", + "
", + "", + "
", + "" + ], + "challengeType": 0 + }, + + { + "_id" : "bad87fee1348cd8acef08812", + "name": "Color a Bootstrap Button with Button Primary", + "difficulty" : "0.37", + "description": [ + "Add Bootstrap's btn-primary class to both of your buttons.", + "Bootstrap comes with several pre-defined colors for buttons. The btn-primary class is the main button color you'll use throughout your app.", + "Note that these buttons still need the btn and btn-block classes." + ], + "tests": [ + "expect($('.btn-primary').length).to.eql(2);" + ], + "challengeSeed": [ + "", + "

cat photo app

", + "", + "
", + "", + "
", + "" + ], + "challengeType": 0 + }, + + { + "_id" : "bad87fee1348ce8acef08812", + "name": "Warn your Users of a Dangerous Action with the Bootstrap Button Danger Class", + "difficulty" : "0.37", + "description": [ + "Change the \"Delete\" button from btn-primary to btn-danger.", + "Bootstrap comes with several pre-defined colors for buttons. The btn-danger class is the button color you'll use to notify users that the button performs a destructive action, such as deleting a cat photo.", + "Note that this button still needs the btn and btn-block classes." + ], + "tests": [ + "expect($('.btn-danger').length).to.eql(1);" + ], + "challengeSeed": [ + "", + "

cat photo app

", + "", + "
", + "", + "
", + "" + ], + "challengeType": 0 + }, + + { + "_id" : "bad88fee1348ce8acef08812", + "name": "Use the Bootstrap Grid to Put Two Elements Side By Side", + "difficulty" : "0.37", + "description": [ + "Put the \"Like\" and \"Delete\" buttons side-by-side by wrapping them in both in a <div class=\"row\"> element and each of them in a <div class=\"row\"> element.", + "Bootstrap uses a responsive grid system, which makes it easy to put elements into rows and specify each element's relative width. Most of Bootstrap's classes can be applied to a div element.", + "The row class is applied to a div, and the buttons themselves can be nested within it." + ], + "tests": [ + "expect($('.row').length).to.eql(2);", + "expect($('.col-xs-12').length).to.eql(4);" + ], + "challengeSeed": [ + "", + "

cat photo app

", + "", + "
", + "
", + "
", + " ", + "
", + "
", + " ", + "
", + "
", + "", + "
", + "" + ], + "challengeType": 0 + }, + + { + "_id" : "bad89fee1348ce8acef08812", + "name": "Wrap Side By Side Elements in a Bootstrap Row", + "difficulty" : "0.37", + "description": [ + "Put the \"Like\" and \"Delete\" buttons side-by-side by wrapping them in both in a <div class=\"row\"> element and each of them in a <div class=\"row\"> element.", + "Bootstrap uses a responsive grid system, which makes it easy to put elements into rows and specify each element's relative width. Most of Bootstrap's classes can be applied to a div element.", + "The row class is applied to a div, and the buttons themselves can be nested within it." + ], + "tests": [ + "expect($('.row').length).to.eql(2);", + "expect($('.col-xs-12').length).to.eql(4);" + ], + "challengeSeed": [ + "", + "

cat photo app

", + "", + "
", + "
", + "
", + " ", + "
", + "
", + " ", + "
", + "
", + "", + "
", + "" ], "challengeType": 0 },