SlideShare a Scribd company logo
UNTANGLING THE WEB Class 7: Making pages
look pretty
AGENDA
--Project 1 presentations
--Some javascript issues coming up in the homeworks
 jsfiddle tips and tricks
 more js stuff
--CSS
--flexbox
--Bootstrap and ui-kit
--Project 2 intro
RECORDING TONIGHT
PRESENTATIONS
You have a handout for each group
Each group gets 10 minutes max for presentation and questions
Don’t worry if you don’t take all 10 minutes, if you can get across
why your business idea is so compelling in two minutes then you’re
way ahead of the game!
Make sure to leave a little bit of question time
Fill in feedback form for each group
ISSUES IN THE HOMEWORK
This is the first homework where answers aren’t just out there all in
one place
Need to learn how to find answers. Most of software development is
about finding answers, either from primary or secondary sources.
Only a small amount is thinking up algorithms on your own.
 Using JSFiddle.net
 HTML and JS on the page together
 Variables into the HTML
 Objects vs arrays
 Adding strings
 Revisiting loops and variables
 Finding answers from stackoverflow
USING JSFIDDLE
From here on out I’d like homework submissions on either github or
jsfiddle (or another service such as nitrous.io)
 Github if it’s just code you’re submitting
 Jsfiddle or an alternative if it’s code I’m supposed to see run
Using JS, you have three options on where to run the code – on load,
in the head, or in the body. Make sure you understand the difference!
Console.log is still very useful, but it doesn’t print on the page! Have
to use the dev console. We’ll use it for some other things today too.
Access DevTools On Windows On Mac
Open Developer
Tools
F12, Ctrl + Shift +
I
Cmd + Opt + I
HTML AND JS TOGETHER
Separate code and data
 Kind of an old paradigm, hard to do that, but html/js comes about from when that
was the goal
 For simple stuff we’ll still treat them as separate. Except when they have to interact
 https://jsfiddle.net/xde554am/ (example we’ll walk through)
Of course, in some frameworks this is exactly backwards. JSX is a
form of javascript for the facebook react toolkit that is fully
intermingled data and presentation. EJS templates are another way of
doing that.
BUTTONS
<input type="submit" id="byBtn" value="Change"
onclick="change()"/>
 Causes page refresh, server loop
 Some styling differences
Versus
<button id="byBtn" onclick="change()">click me</button>
 No page refresh
 Client side action only
 Issues prior to IE6, but don’t care about that anymore
See http://particletree.com/features/rediscovering-the-button-
element/
VARIABLES IN THE HTML
Extension of the last example:
 https://jsfiddle.net/egrs4j7a/1/
In the HTML
 <p id="foo"></p>
In the JS
 var myText = "Hello";
 document.getElementById('foo').innerHTML = myText;
OBJECTS VERSUS ARRAYS
Arrays are actually special cases of objects. All built-in variable types are,
really.
But you use them in different contexts
Arrays - var myArray = [];
 Multidimensional (potentially)
 Ordered
 Native methods like push, pop
Objects - var myObject = {};
 Unordered
 Best for key:value pairs
More info: https://msdn.microsoft.com/en-
us/library/89t1khd2%28v=vs.94%29.aspx?f=255&MSPPError=-2147217396
var a = [1, 2, 3];
var o = {a: 1, b: 2, c: 3};
a[0] = 1; a[1]=2; etc.
o[“a”] = 1
o.a = 1;
ADDING STRINGS
Unary + operator
Most types will be converted to numbers using the unary + sign.
 +true // 1
 +null // 0
 +"" // 0
 +"2.0" // 2
 +"2.5" // 2.5
same as parseInt(x, 10)? Not at all.
 +"3asdf" // NaN
 parseInt("3asdf", 10) // 3
https://www.tutorialspoint.com/javascript/javascript_
operators.htm
LOOPS AND VARIABLES
var toppingsOrder = ["cheese","pepperoni"];
var prices = {
cheese: "1.20",
avocado: "1.99",
pepperoni: "1.50"
}
var total = 0;
var i;
for (i=0; i<toppingsOrder.length; i++) {
total = (+total) + (+prices[toppingsOrder[i]]);
}
alert(total);
PARSING A COMMA SEPARATED
LIST
var myString = "test,test1,test2";
var arr = myString.split(',');
console.log(arr);
["test", "test1", "test2"]
More details: http://stackoverflow.com/questions/2858121/convert-
comma-separated-string-to-array
CSS INTRO – CASCADING STYLE
SHEETS
CSS is just styling on top of HTML
Everything should generally run the same without it, it will just look
ugly
In my example site a few weeks ago, I was using LESS. LESS and SASS
(among others) are CSS variants that compile down to CSS files but
use variables and some program control to make expressions easier
WAYS OF SELECTING TEXT
#id
 #id { color: black;}
.class
 .class { font-size:30px;}
tag
 p { text-align: center;}
CASCADING
HTML tags get superseded by classes and specific id’s
Classes get superseded by specific id’s
Specific id’s win
Unless something is marked important!
CSS EXERCISES
https://jsfiddle.net/sw465f3a/
Make “I’m a paragraph” green and 40px high
Make “another paragraph” blue
Make “more text” and the button red
EXERCISE ANSWERS
https://jsfiddle.net/sw465f3a/1/
Can you make all the paragraph tags blue without changing the class
or id specifiers?
https://jsfiddle.net/sw465f3a/2/
FLEXBOX
This is a system to allow elements to be flexibly positioned
Property Chrome IE Firefox Safari Opera
Basic support
(single-line flexbox)
29.0
21.0 -
webkit-
11.0 22.0
18.0 -moz-
6.1 -
webkit-
12.1 -
webkit-
Multi-line flexbox 29.0
21.0 -
webkit-
11.0 28.0 6.1 -
webkit-
17.0
15.0 -
webkit-
12.1
FLEXBOX FROGGY
Let’s take 10 or 15 minutes to do some examples
http://flexboxfroggy.com/
BOOTSTRAP
Developed by twitter, it has become a common library of CSS
definitions
Reference: http://www.w3schools.com/bootstrap/
Example: https://jsfiddle.net/oazgbqay/
Note external resources!
BOOTSTRAP EXERCISES
https://jsfiddle.net/j7g07w5e/
Create a table with three types of pizza and prices
Make one of the table rows red to indicate it is sold out, using
bootstrap styling
Reference:
http://www.w3schools.com/bootstrap/bootstrap_tables.asp
UI-KIT
And alternative UI language to bootstrap – this is what was used on
my 3data.ca example
Reference: https://getuikit.com/docs/documentation_get-
started.html
Example: https://jsfiddle.net/k0xp1jzy/
JQUERY
Side note on jquery in the last example!
Powerful library. Needs a more full explanation. Many sites these days
attempt to be “pure” in terms of not using jquery, in an attempt to
reduce file size and load times
Feel free to understand and use it if it helps, though!
HOMEWORK 6
Put a ui-kit front end on an expanded pizza ordering site. This front
end should use icons and resources to style the site. (bootstrap and
flexbox are alternative options if you prefer, particularly if that is
what you decide to base your project 2 on)
In addition to last week, the site should contain:
--A list of ingredients, as before, but with a picture and description
of each ingredient that only appears when it is hovered over (perhaps
in a box to the side or something)
--a confirmation dialog that presents the ingredients and the prices
in a nicely formatted receipt
This should be submitted running as a jsfiddle link
PROJECT 2
This is the front-end project
Goal is to make your site reflect the goals of the business – this might
be a sales site, a good landing page.
Ideally you should make it something that has a backend component
 Maybe it takes orders
 Or queries a database
 Or uses speech recognition or advanced interactions
 Think a bit ahead to the project 3 in any case
This project is actually due on the last day of class, coincident with
project 3, but I would like a mockup by Nov 9th. (this can be on paper
or in an image file)
PROJECT 2 TECHNOLOGIES
Ultimately it is up to you, but I would suggest using a framework such
as bootstrap or ui-kit rather than styling directly
You will also need to make hosting decisions. We will talk about this
next class.
Not all of your front-end UI needs to work! If this is a UI prototype
that shows look and feel then that is sufficient, but enough has to
work to get a feel for it
The back-end project decisions will greatly influence which pieces

More Related Content

What's hot

Untangling spring week9
Untangling spring week9Untangling spring week9
Untangling spring week9
Derek Jacoby
 
Untangling spring week10
Untangling spring week10Untangling spring week10
Untangling spring week10
Derek Jacoby
 
Untangling spring week5
Untangling spring week5Untangling spring week5
Untangling spring week5
Derek Jacoby
 
Untangling spring week2
Untangling spring week2Untangling spring week2
Untangling spring week2
Derek Jacoby
 
Untangling spring week6
Untangling spring week6Untangling spring week6
Untangling spring week6
Derek Jacoby
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11
Derek Jacoby
 
Untangling8
Untangling8Untangling8
Untangling8
Derek Jacoby
 
Untangling spring week7
Untangling spring week7Untangling spring week7
Untangling spring week7
Derek Jacoby
 
Untangling the web week 2 - SEO
Untangling the web week 2 - SEOUntangling the web week 2 - SEO
Untangling the web week 2 - SEO
Derek Jacoby
 
Untangling fall2017 week1
Untangling fall2017 week1Untangling fall2017 week1
Untangling fall2017 week1
Derek Jacoby
 
Untangling - fall2017 - week6
Untangling - fall2017 - week6Untangling - fall2017 - week6
Untangling - fall2017 - week6
Derek Jacoby
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
Derek Jacoby
 
Untangling11
Untangling11Untangling11
Untangling11
Derek Jacoby
 
Untangling - fall2017 - week5
Untangling - fall2017 - week5Untangling - fall2017 - week5
Untangling - fall2017 - week5
Derek Jacoby
 
Untangling - fall2017 - week 10
Untangling - fall2017 - week 10Untangling - fall2017 - week 10
Untangling - fall2017 - week 10
Derek Jacoby
 
5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)
5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)
5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)
David Wesst
 
Everyones invited! Meet accesibility requirements with ColdFusion
Everyones invited! Meet accesibility requirements with ColdFusionEveryones invited! Meet accesibility requirements with ColdFusion
Everyones invited! Meet accesibility requirements with ColdFusion
ColdFusionConference
 
Don't make me wait! or Building High-Performance Web Applications
Don't make me wait! or Building High-Performance Web ApplicationsDon't make me wait! or Building High-Performance Web Applications
Don't make me wait! or Building High-Performance Web Applications
Stoyan Stefanov
 
Building mobile applications with DrupalGap
Building mobile applications with DrupalGapBuilding mobile applications with DrupalGap
Building mobile applications with DrupalGap
Alex S
 
Javascript and jQuery PennApps Tech Talk, Fall 2014
Javascript and jQuery PennApps Tech Talk, Fall 2014Javascript and jQuery PennApps Tech Talk, Fall 2014
Javascript and jQuery PennApps Tech Talk, Fall 2014
Kathy Zhou
 

What's hot (20)

Untangling spring week9
Untangling spring week9Untangling spring week9
Untangling spring week9
 
Untangling spring week10
Untangling spring week10Untangling spring week10
Untangling spring week10
 
Untangling spring week5
Untangling spring week5Untangling spring week5
Untangling spring week5
 
Untangling spring week2
Untangling spring week2Untangling spring week2
Untangling spring week2
 
Untangling spring week6
Untangling spring week6Untangling spring week6
Untangling spring week6
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11
 
Untangling8
Untangling8Untangling8
Untangling8
 
Untangling spring week7
Untangling spring week7Untangling spring week7
Untangling spring week7
 
Untangling the web week 2 - SEO
Untangling the web week 2 - SEOUntangling the web week 2 - SEO
Untangling the web week 2 - SEO
 
Untangling fall2017 week1
Untangling fall2017 week1Untangling fall2017 week1
Untangling fall2017 week1
 
Untangling - fall2017 - week6
Untangling - fall2017 - week6Untangling - fall2017 - week6
Untangling - fall2017 - week6
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
 
Untangling11
Untangling11Untangling11
Untangling11
 
Untangling - fall2017 - week5
Untangling - fall2017 - week5Untangling - fall2017 - week5
Untangling - fall2017 - week5
 
Untangling - fall2017 - week 10
Untangling - fall2017 - week 10Untangling - fall2017 - week 10
Untangling - fall2017 - week 10
 
5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)
5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)
5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)
 
Everyones invited! Meet accesibility requirements with ColdFusion
Everyones invited! Meet accesibility requirements with ColdFusionEveryones invited! Meet accesibility requirements with ColdFusion
Everyones invited! Meet accesibility requirements with ColdFusion
 
Don't make me wait! or Building High-Performance Web Applications
Don't make me wait! or Building High-Performance Web ApplicationsDon't make me wait! or Building High-Performance Web Applications
Don't make me wait! or Building High-Performance Web Applications
 
Building mobile applications with DrupalGap
Building mobile applications with DrupalGapBuilding mobile applications with DrupalGap
Building mobile applications with DrupalGap
 
Javascript and jQuery PennApps Tech Talk, Fall 2014
Javascript and jQuery PennApps Tech Talk, Fall 2014Javascript and jQuery PennApps Tech Talk, Fall 2014
Javascript and jQuery PennApps Tech Talk, Fall 2014
 

Viewers also liked

Untangling spring week4
Untangling spring week4Untangling spring week4
Untangling spring week4
Derek Jacoby
 
Untangling spring week3
Untangling spring week3Untangling spring week3
Untangling spring week3
Derek Jacoby
 
Untangling the web - week 3
Untangling the web - week 3Untangling the web - week 3
Untangling the web - week 3
Derek Jacoby
 
Biohacking
BiohackingBiohacking
Biohacking
Derek Jacoby
 
Beyond the Gig Economy
Beyond the Gig EconomyBeyond the Gig Economy
Beyond the Gig Economy
Jon Lieber
 
Recovery: Job Growth and Education Requirements Through 2020
Recovery: Job Growth and Education Requirements Through 2020Recovery: Job Growth and Education Requirements Through 2020
Recovery: Job Growth and Education Requirements Through 2020
CEW Georgetown
 
3 hard facts shaping higher education thinking and behavior
3 hard facts shaping higher education thinking and behavior3 hard facts shaping higher education thinking and behavior
3 hard facts shaping higher education thinking and behavior
Grant Thornton LLP
 
African Americans: College Majors and Earnings
African Americans: College Majors and Earnings African Americans: College Majors and Earnings
African Americans: College Majors and Earnings
CEW Georgetown
 
The Online College Labor Market
The Online College Labor MarketThe Online College Labor Market
The Online College Labor Market
CEW Georgetown
 
Game Based Learning for Language Learners
Game Based Learning for Language LearnersGame Based Learning for Language Learners
Game Based Learning for Language Learners
Shelly Sanchez Terrell
 
What's Trending in Talent and Learning for 2016?
What's Trending in Talent and Learning for 2016?What's Trending in Talent and Learning for 2016?
What's Trending in Talent and Learning for 2016?
Skillsoft
 
SXSW 2016 takeaways
SXSW 2016 takeawaysSXSW 2016 takeaways
SXSW 2016 takeaways
Havas
 

Viewers also liked (12)

Untangling spring week4
Untangling spring week4Untangling spring week4
Untangling spring week4
 
Untangling spring week3
Untangling spring week3Untangling spring week3
Untangling spring week3
 
Untangling the web - week 3
Untangling the web - week 3Untangling the web - week 3
Untangling the web - week 3
 
Biohacking
BiohackingBiohacking
Biohacking
 
Beyond the Gig Economy
Beyond the Gig EconomyBeyond the Gig Economy
Beyond the Gig Economy
 
Recovery: Job Growth and Education Requirements Through 2020
Recovery: Job Growth and Education Requirements Through 2020Recovery: Job Growth and Education Requirements Through 2020
Recovery: Job Growth and Education Requirements Through 2020
 
3 hard facts shaping higher education thinking and behavior
3 hard facts shaping higher education thinking and behavior3 hard facts shaping higher education thinking and behavior
3 hard facts shaping higher education thinking and behavior
 
African Americans: College Majors and Earnings
African Americans: College Majors and Earnings African Americans: College Majors and Earnings
African Americans: College Majors and Earnings
 
The Online College Labor Market
The Online College Labor MarketThe Online College Labor Market
The Online College Labor Market
 
Game Based Learning for Language Learners
Game Based Learning for Language LearnersGame Based Learning for Language Learners
Game Based Learning for Language Learners
 
What's Trending in Talent and Learning for 2016?
What's Trending in Talent and Learning for 2016?What's Trending in Talent and Learning for 2016?
What's Trending in Talent and Learning for 2016?
 
SXSW 2016 takeaways
SXSW 2016 takeawaysSXSW 2016 takeaways
SXSW 2016 takeaways
 

Similar to Untangling7

Future proofing design work with Web components
Future proofing design work with Web componentsFuture proofing design work with Web components
Future proofing design work with Web components
btopro
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
zonathen
 
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroJoomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Steven Pignataro
 
Fewd week4 slides
Fewd week4 slidesFewd week4 slides
Fewd week4 slides
William Myers
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
Andy Peterson
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
David Padbury
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwist
Mark Fayngersh
 
All of Javascript
All of JavascriptAll of Javascript
All of Javascript
Togakangaroo
 
Professional JavaScript: AntiPatterns
Professional JavaScript: AntiPatternsProfessional JavaScript: AntiPatterns
Professional JavaScript: AntiPatterns
Mike Wilcox
 
Catalyst - refactor large apps with it and have fun!
Catalyst - refactor large apps with it and have fun!Catalyst - refactor large apps with it and have fun!
Catalyst - refactor large apps with it and have fun!
mold
 
Creating Openbravo Workspace Widgets
Creating Openbravo Workspace WidgetsCreating Openbravo Workspace Widgets
Creating Openbravo Workspace Widgets
Rob Goris
 
Writing native Linux desktop apps with JavaScript
Writing native Linux desktop apps with JavaScriptWriting native Linux desktop apps with JavaScript
Writing native Linux desktop apps with JavaScript
Igalia
 
Save time by applying clean code principles
Save time by applying clean code principlesSave time by applying clean code principles
Save time by applying clean code principles
Edorian
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Matthew Davis
 
10 Ways To Improve Your Code
10 Ways To Improve Your Code10 Ways To Improve Your Code
10 Ways To Improve Your Code
ConSanFrancisco123
 
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docxLabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
DIPESH30
 
Tdd is not about testing
Tdd is not about testingTdd is not about testing
Tdd is not about testing
Gianluca Padovani
 
DevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation SlidesDevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation Slides
Fab L
 
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
DevSecCon
 
Don't Over-React - just use Vue!
Don't Over-React - just use Vue!Don't Over-React - just use Vue!
Don't Over-React - just use Vue!
Raymond Camden
 

Similar to Untangling7 (20)

Future proofing design work with Web components
Future proofing design work with Web componentsFuture proofing design work with Web components
Future proofing design work with Web components
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
 
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroJoomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
 
Fewd week4 slides
Fewd week4 slidesFewd week4 slides
Fewd week4 slides
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwist
 
All of Javascript
All of JavascriptAll of Javascript
All of Javascript
 
Professional JavaScript: AntiPatterns
Professional JavaScript: AntiPatternsProfessional JavaScript: AntiPatterns
Professional JavaScript: AntiPatterns
 
Catalyst - refactor large apps with it and have fun!
Catalyst - refactor large apps with it and have fun!Catalyst - refactor large apps with it and have fun!
Catalyst - refactor large apps with it and have fun!
 
Creating Openbravo Workspace Widgets
Creating Openbravo Workspace WidgetsCreating Openbravo Workspace Widgets
Creating Openbravo Workspace Widgets
 
Writing native Linux desktop apps with JavaScript
Writing native Linux desktop apps with JavaScriptWriting native Linux desktop apps with JavaScript
Writing native Linux desktop apps with JavaScript
 
Save time by applying clean code principles
Save time by applying clean code principlesSave time by applying clean code principles
Save time by applying clean code principles
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
 
10 Ways To Improve Your Code
10 Ways To Improve Your Code10 Ways To Improve Your Code
10 Ways To Improve Your Code
 
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docxLabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
 
Tdd is not about testing
Tdd is not about testingTdd is not about testing
Tdd is not about testing
 
DevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation SlidesDevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation Slides
 
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
 
Don't Over-React - just use Vue!
Don't Over-React - just use Vue!Don't Over-React - just use Vue!
Don't Over-React - just use Vue!
 

More from Derek Jacoby

Untangling - fall2017 - week 8
Untangling - fall2017 - week 8Untangling - fall2017 - week 8
Untangling - fall2017 - week 8
Derek Jacoby
 
Untangling - fall2017 - week 7
Untangling - fall2017 - week 7Untangling - fall2017 - week 7
Untangling - fall2017 - week 7
Derek Jacoby
 
Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4
Derek Jacoby
 
Untangling the web fall2017 class 3
Untangling the web fall2017 class 3Untangling the web fall2017 class 3
Untangling the web fall2017 class 3
Derek Jacoby
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
Derek Jacoby
 
Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2
Derek Jacoby
 
Untangling spring week12
Untangling spring week12Untangling spring week12
Untangling spring week12
Derek Jacoby
 

More from Derek Jacoby (7)

Untangling - fall2017 - week 8
Untangling - fall2017 - week 8Untangling - fall2017 - week 8
Untangling - fall2017 - week 8
 
Untangling - fall2017 - week 7
Untangling - fall2017 - week 7Untangling - fall2017 - week 7
Untangling - fall2017 - week 7
 
Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4
 
Untangling the web fall2017 class 3
Untangling the web fall2017 class 3Untangling the web fall2017 class 3
Untangling the web fall2017 class 3
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
 
Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2
 
Untangling spring week12
Untangling spring week12Untangling spring week12
Untangling spring week12
 

Recently uploaded

BANG E BHARAT QSN SET by Amra Quiz Pagoler Dol
BANG E BHARAT QSN SET by Amra Quiz Pagoler DolBANG E BHARAT QSN SET by Amra Quiz Pagoler Dol
BANG E BHARAT QSN SET by Amra Quiz Pagoler Dol
Amra Quiz Pagoler Dol (AQPD)
 
Celebrating 25th Year SATURDAY, 27th JULY, 2024
Celebrating 25th Year SATURDAY, 27th JULY, 2024Celebrating 25th Year SATURDAY, 27th JULY, 2024
Celebrating 25th Year SATURDAY, 27th JULY, 2024
APEC Melmaruvathur
 
FIRST AID PRESENTATION ON INDUSTRIAL SAFETY by dr lal.ppt
FIRST AID PRESENTATION ON INDUSTRIAL SAFETY by dr lal.pptFIRST AID PRESENTATION ON INDUSTRIAL SAFETY by dr lal.ppt
FIRST AID PRESENTATION ON INDUSTRIAL SAFETY by dr lal.ppt
ashutoshklal29
 
How to Load Custom Field to POS in Odoo 17 - Odoo 17 Slides
How to Load Custom Field to POS in Odoo 17 - Odoo 17 SlidesHow to Load Custom Field to POS in Odoo 17 - Odoo 17 Slides
How to Load Custom Field to POS in Odoo 17 - Odoo 17 Slides
Celine George
 
Dreams Realised by mahadev desai 9 1.pptx
Dreams Realised by mahadev desai 9 1.pptxDreams Realised by mahadev desai 9 1.pptx
Dreams Realised by mahadev desai 9 1.pptx
AncyTEnglish
 
React Interview Question PDF By ScholarHat
React Interview Question PDF By ScholarHatReact Interview Question PDF By ScholarHat
React Interview Question PDF By ScholarHat
Scholarhat
 
FINAL MATATAG PE and Health CG 2023 Grades 4-10.pdf
FINAL MATATAG PE and Health CG 2023 Grades 4-10.pdfFINAL MATATAG PE and Health CG 2023 Grades 4-10.pdf
FINAL MATATAG PE and Health CG 2023 Grades 4-10.pdf
HayddieMaeCapunong
 
QCE – Unpacking the syllabus Implications for Senior School practices and ass...
QCE – Unpacking the syllabus Implications for Senior School practices and ass...QCE – Unpacking the syllabus Implications for Senior School practices and ass...
QCE – Unpacking the syllabus Implications for Senior School practices and ass...
mansk2
 
NLC 2024 - Certificate of Recognition
NLC  2024  -  Certificate of RecognitionNLC  2024  -  Certificate of Recognition
NLC 2024 - Certificate of Recognition
Deped
 
Reports in Odoo 17 Point of Sale - Odoo Slides
Reports in Odoo 17 Point of Sale - Odoo SlidesReports in Odoo 17 Point of Sale - Odoo Slides
Reports in Odoo 17 Point of Sale - Odoo Slides
Celine George
 
How to define Related field in Odoo 17 - Odoo 17 Slides
How to define Related field in Odoo 17 - Odoo 17 SlidesHow to define Related field in Odoo 17 - Odoo 17 Slides
How to define Related field in Odoo 17 - Odoo 17 Slides
Celine George
 
How to Create an XLS Report in Odoo 17 - Odoo 17 Slides
How to Create an XLS Report in Odoo 17 - Odoo 17 SlidesHow to Create an XLS Report in Odoo 17 - Odoo 17 Slides
How to Create an XLS Report in Odoo 17 - Odoo 17 Slides
Celine George
 
A history of Innisfree in Milanville, Pennsylvania
A history of Innisfree in Milanville, PennsylvaniaA history of Innisfree in Milanville, Pennsylvania
A history of Innisfree in Milanville, Pennsylvania
ThomasRue2
 
Parkinson Disease & Anti-Parkinsonian Drugs.pptx
Parkinson Disease & Anti-Parkinsonian Drugs.pptxParkinson Disease & Anti-Parkinsonian Drugs.pptx
Parkinson Disease & Anti-Parkinsonian Drugs.pptx
AnujVishwakarma34
 
Lecture Notes Unit5 chapter 15 PL/SQL Programming
Lecture Notes Unit5 chapter 15 PL/SQL ProgrammingLecture Notes Unit5 chapter 15 PL/SQL Programming
Lecture Notes Unit5 chapter 15 PL/SQL Programming
Murugan146644
 
How to Make a Field Storable in Odoo 17 - Odoo Slides
How to Make a Field Storable in Odoo 17 - Odoo SlidesHow to Make a Field Storable in Odoo 17 - Odoo Slides
How to Make a Field Storable in Odoo 17 - Odoo Slides
Celine George
 
V2-NLC-Certificate-of-Completion_Learner.docx
V2-NLC-Certificate-of-Completion_Learner.docxV2-NLC-Certificate-of-Completion_Learner.docx
V2-NLC-Certificate-of-Completion_Learner.docx
302491
 
SQL Server Interview Questions PDF By ScholarHat
SQL Server Interview Questions PDF By ScholarHatSQL Server Interview Questions PDF By ScholarHat
SQL Server Interview Questions PDF By ScholarHat
Scholarhat
 
matatag classroom orientation school year 2024-2025
matatag classroom orientation school year 2024-2025matatag classroom orientation school year 2024-2025
matatag classroom orientation school year 2024-2025
florrizabombio
 
Java MCQ Questions and Answers PDF By ScholarHat
Java MCQ Questions and Answers PDF By ScholarHatJava MCQ Questions and Answers PDF By ScholarHat
Java MCQ Questions and Answers PDF By ScholarHat
Scholarhat
 

Recently uploaded (20)

BANG E BHARAT QSN SET by Amra Quiz Pagoler Dol
BANG E BHARAT QSN SET by Amra Quiz Pagoler DolBANG E BHARAT QSN SET by Amra Quiz Pagoler Dol
BANG E BHARAT QSN SET by Amra Quiz Pagoler Dol
 
Celebrating 25th Year SATURDAY, 27th JULY, 2024
Celebrating 25th Year SATURDAY, 27th JULY, 2024Celebrating 25th Year SATURDAY, 27th JULY, 2024
Celebrating 25th Year SATURDAY, 27th JULY, 2024
 
FIRST AID PRESENTATION ON INDUSTRIAL SAFETY by dr lal.ppt
FIRST AID PRESENTATION ON INDUSTRIAL SAFETY by dr lal.pptFIRST AID PRESENTATION ON INDUSTRIAL SAFETY by dr lal.ppt
FIRST AID PRESENTATION ON INDUSTRIAL SAFETY by dr lal.ppt
 
How to Load Custom Field to POS in Odoo 17 - Odoo 17 Slides
How to Load Custom Field to POS in Odoo 17 - Odoo 17 SlidesHow to Load Custom Field to POS in Odoo 17 - Odoo 17 Slides
How to Load Custom Field to POS in Odoo 17 - Odoo 17 Slides
 
Dreams Realised by mahadev desai 9 1.pptx
Dreams Realised by mahadev desai 9 1.pptxDreams Realised by mahadev desai 9 1.pptx
Dreams Realised by mahadev desai 9 1.pptx
 
React Interview Question PDF By ScholarHat
React Interview Question PDF By ScholarHatReact Interview Question PDF By ScholarHat
React Interview Question PDF By ScholarHat
 
FINAL MATATAG PE and Health CG 2023 Grades 4-10.pdf
FINAL MATATAG PE and Health CG 2023 Grades 4-10.pdfFINAL MATATAG PE and Health CG 2023 Grades 4-10.pdf
FINAL MATATAG PE and Health CG 2023 Grades 4-10.pdf
 
QCE – Unpacking the syllabus Implications for Senior School practices and ass...
QCE – Unpacking the syllabus Implications for Senior School practices and ass...QCE – Unpacking the syllabus Implications for Senior School practices and ass...
QCE – Unpacking the syllabus Implications for Senior School practices and ass...
 
NLC 2024 - Certificate of Recognition
NLC  2024  -  Certificate of RecognitionNLC  2024  -  Certificate of Recognition
NLC 2024 - Certificate of Recognition
 
Reports in Odoo 17 Point of Sale - Odoo Slides
Reports in Odoo 17 Point of Sale - Odoo SlidesReports in Odoo 17 Point of Sale - Odoo Slides
Reports in Odoo 17 Point of Sale - Odoo Slides
 
How to define Related field in Odoo 17 - Odoo 17 Slides
How to define Related field in Odoo 17 - Odoo 17 SlidesHow to define Related field in Odoo 17 - Odoo 17 Slides
How to define Related field in Odoo 17 - Odoo 17 Slides
 
How to Create an XLS Report in Odoo 17 - Odoo 17 Slides
How to Create an XLS Report in Odoo 17 - Odoo 17 SlidesHow to Create an XLS Report in Odoo 17 - Odoo 17 Slides
How to Create an XLS Report in Odoo 17 - Odoo 17 Slides
 
A history of Innisfree in Milanville, Pennsylvania
A history of Innisfree in Milanville, PennsylvaniaA history of Innisfree in Milanville, Pennsylvania
A history of Innisfree in Milanville, Pennsylvania
 
Parkinson Disease & Anti-Parkinsonian Drugs.pptx
Parkinson Disease & Anti-Parkinsonian Drugs.pptxParkinson Disease & Anti-Parkinsonian Drugs.pptx
Parkinson Disease & Anti-Parkinsonian Drugs.pptx
 
Lecture Notes Unit5 chapter 15 PL/SQL Programming
Lecture Notes Unit5 chapter 15 PL/SQL ProgrammingLecture Notes Unit5 chapter 15 PL/SQL Programming
Lecture Notes Unit5 chapter 15 PL/SQL Programming
 
How to Make a Field Storable in Odoo 17 - Odoo Slides
How to Make a Field Storable in Odoo 17 - Odoo SlidesHow to Make a Field Storable in Odoo 17 - Odoo Slides
How to Make a Field Storable in Odoo 17 - Odoo Slides
 
V2-NLC-Certificate-of-Completion_Learner.docx
V2-NLC-Certificate-of-Completion_Learner.docxV2-NLC-Certificate-of-Completion_Learner.docx
V2-NLC-Certificate-of-Completion_Learner.docx
 
SQL Server Interview Questions PDF By ScholarHat
SQL Server Interview Questions PDF By ScholarHatSQL Server Interview Questions PDF By ScholarHat
SQL Server Interview Questions PDF By ScholarHat
 
matatag classroom orientation school year 2024-2025
matatag classroom orientation school year 2024-2025matatag classroom orientation school year 2024-2025
matatag classroom orientation school year 2024-2025
 
Java MCQ Questions and Answers PDF By ScholarHat
Java MCQ Questions and Answers PDF By ScholarHatJava MCQ Questions and Answers PDF By ScholarHat
Java MCQ Questions and Answers PDF By ScholarHat
 

Untangling7

  • 1. UNTANGLING THE WEB Class 7: Making pages look pretty
  • 2. AGENDA --Project 1 presentations --Some javascript issues coming up in the homeworks  jsfiddle tips and tricks  more js stuff --CSS --flexbox --Bootstrap and ui-kit --Project 2 intro
  • 4. PRESENTATIONS You have a handout for each group Each group gets 10 minutes max for presentation and questions Don’t worry if you don’t take all 10 minutes, if you can get across why your business idea is so compelling in two minutes then you’re way ahead of the game! Make sure to leave a little bit of question time Fill in feedback form for each group
  • 5. ISSUES IN THE HOMEWORK This is the first homework where answers aren’t just out there all in one place Need to learn how to find answers. Most of software development is about finding answers, either from primary or secondary sources. Only a small amount is thinking up algorithms on your own.  Using JSFiddle.net  HTML and JS on the page together  Variables into the HTML  Objects vs arrays  Adding strings  Revisiting loops and variables  Finding answers from stackoverflow
  • 6. USING JSFIDDLE From here on out I’d like homework submissions on either github or jsfiddle (or another service such as nitrous.io)  Github if it’s just code you’re submitting  Jsfiddle or an alternative if it’s code I’m supposed to see run Using JS, you have three options on where to run the code – on load, in the head, or in the body. Make sure you understand the difference! Console.log is still very useful, but it doesn’t print on the page! Have to use the dev console. We’ll use it for some other things today too. Access DevTools On Windows On Mac Open Developer Tools F12, Ctrl + Shift + I Cmd + Opt + I
  • 7. HTML AND JS TOGETHER Separate code and data  Kind of an old paradigm, hard to do that, but html/js comes about from when that was the goal  For simple stuff we’ll still treat them as separate. Except when they have to interact  https://jsfiddle.net/xde554am/ (example we’ll walk through) Of course, in some frameworks this is exactly backwards. JSX is a form of javascript for the facebook react toolkit that is fully intermingled data and presentation. EJS templates are another way of doing that.
  • 8. BUTTONS <input type="submit" id="byBtn" value="Change" onclick="change()"/>  Causes page refresh, server loop  Some styling differences Versus <button id="byBtn" onclick="change()">click me</button>  No page refresh  Client side action only  Issues prior to IE6, but don’t care about that anymore See http://particletree.com/features/rediscovering-the-button- element/
  • 9. VARIABLES IN THE HTML Extension of the last example:  https://jsfiddle.net/egrs4j7a/1/ In the HTML  <p id="foo"></p> In the JS  var myText = "Hello";  document.getElementById('foo').innerHTML = myText;
  • 10. OBJECTS VERSUS ARRAYS Arrays are actually special cases of objects. All built-in variable types are, really. But you use them in different contexts Arrays - var myArray = [];  Multidimensional (potentially)  Ordered  Native methods like push, pop Objects - var myObject = {};  Unordered  Best for key:value pairs More info: https://msdn.microsoft.com/en- us/library/89t1khd2%28v=vs.94%29.aspx?f=255&MSPPError=-2147217396 var a = [1, 2, 3]; var o = {a: 1, b: 2, c: 3}; a[0] = 1; a[1]=2; etc. o[“a”] = 1 o.a = 1;
  • 11. ADDING STRINGS Unary + operator Most types will be converted to numbers using the unary + sign.  +true // 1  +null // 0  +"" // 0  +"2.0" // 2  +"2.5" // 2.5 same as parseInt(x, 10)? Not at all.  +"3asdf" // NaN  parseInt("3asdf", 10) // 3 https://www.tutorialspoint.com/javascript/javascript_ operators.htm
  • 12. LOOPS AND VARIABLES var toppingsOrder = ["cheese","pepperoni"]; var prices = { cheese: "1.20", avocado: "1.99", pepperoni: "1.50" } var total = 0; var i; for (i=0; i<toppingsOrder.length; i++) { total = (+total) + (+prices[toppingsOrder[i]]); } alert(total);
  • 13. PARSING A COMMA SEPARATED LIST var myString = "test,test1,test2"; var arr = myString.split(','); console.log(arr); ["test", "test1", "test2"] More details: http://stackoverflow.com/questions/2858121/convert- comma-separated-string-to-array
  • 14. CSS INTRO – CASCADING STYLE SHEETS CSS is just styling on top of HTML Everything should generally run the same without it, it will just look ugly In my example site a few weeks ago, I was using LESS. LESS and SASS (among others) are CSS variants that compile down to CSS files but use variables and some program control to make expressions easier
  • 15. WAYS OF SELECTING TEXT #id  #id { color: black;} .class  .class { font-size:30px;} tag  p { text-align: center;}
  • 16. CASCADING HTML tags get superseded by classes and specific id’s Classes get superseded by specific id’s Specific id’s win Unless something is marked important!
  • 17. CSS EXERCISES https://jsfiddle.net/sw465f3a/ Make “I’m a paragraph” green and 40px high Make “another paragraph” blue Make “more text” and the button red
  • 18. EXERCISE ANSWERS https://jsfiddle.net/sw465f3a/1/ Can you make all the paragraph tags blue without changing the class or id specifiers? https://jsfiddle.net/sw465f3a/2/
  • 19. FLEXBOX This is a system to allow elements to be flexibly positioned Property Chrome IE Firefox Safari Opera Basic support (single-line flexbox) 29.0 21.0 - webkit- 11.0 22.0 18.0 -moz- 6.1 - webkit- 12.1 - webkit- Multi-line flexbox 29.0 21.0 - webkit- 11.0 28.0 6.1 - webkit- 17.0 15.0 - webkit- 12.1
  • 20. FLEXBOX FROGGY Let’s take 10 or 15 minutes to do some examples http://flexboxfroggy.com/
  • 21. BOOTSTRAP Developed by twitter, it has become a common library of CSS definitions Reference: http://www.w3schools.com/bootstrap/ Example: https://jsfiddle.net/oazgbqay/ Note external resources!
  • 22. BOOTSTRAP EXERCISES https://jsfiddle.net/j7g07w5e/ Create a table with three types of pizza and prices Make one of the table rows red to indicate it is sold out, using bootstrap styling Reference: http://www.w3schools.com/bootstrap/bootstrap_tables.asp
  • 23. UI-KIT And alternative UI language to bootstrap – this is what was used on my 3data.ca example Reference: https://getuikit.com/docs/documentation_get- started.html Example: https://jsfiddle.net/k0xp1jzy/
  • 24. JQUERY Side note on jquery in the last example! Powerful library. Needs a more full explanation. Many sites these days attempt to be “pure” in terms of not using jquery, in an attempt to reduce file size and load times Feel free to understand and use it if it helps, though!
  • 25. HOMEWORK 6 Put a ui-kit front end on an expanded pizza ordering site. This front end should use icons and resources to style the site. (bootstrap and flexbox are alternative options if you prefer, particularly if that is what you decide to base your project 2 on) In addition to last week, the site should contain: --A list of ingredients, as before, but with a picture and description of each ingredient that only appears when it is hovered over (perhaps in a box to the side or something) --a confirmation dialog that presents the ingredients and the prices in a nicely formatted receipt This should be submitted running as a jsfiddle link
  • 26. PROJECT 2 This is the front-end project Goal is to make your site reflect the goals of the business – this might be a sales site, a good landing page. Ideally you should make it something that has a backend component  Maybe it takes orders  Or queries a database  Or uses speech recognition or advanced interactions  Think a bit ahead to the project 3 in any case This project is actually due on the last day of class, coincident with project 3, but I would like a mockup by Nov 9th. (this can be on paper or in an image file)
  • 27. PROJECT 2 TECHNOLOGIES Ultimately it is up to you, but I would suggest using a framework such as bootstrap or ui-kit rather than styling directly You will also need to make hosting decisions. We will talk about this next class. Not all of your front-end UI needs to work! If this is a UI prototype that shows look and feel then that is sufficient, but enough has to work to get a feel for it The back-end project decisions will greatly influence which pieces