Top Banner
Quick Start Guide to JavaScript Frameworks for SharePoint Apps #SPSBE20 Sonja Madsen April 18 th , 2015
30

Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Jul 16, 2015

Download

Internet

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Quick Start Guide to JavaScript Frameworks for SharePoint Apps

#SPSBE20

Sonja Madsen

April 18th, 2015

Page 2: Quick start guide to java script frameworks for sharepoint apps spsbe-2015
Page 3: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

JavaScript Frameworks and Libraries

Page 4: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

SharePoint Apps

SharePoint 2003-2010

SharePoint 2010-2013

Page 5: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

JavaScript Frameworks

Standardized code structure and rules

HTML, CSS and JS

Front-end frameworks CSS to position elements

Typography styles

Browser compatibility

Standard CSS classes

Library Set of tools

Imposes no structure

Page 6: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

SharePoint hosted / Provider app

jQuery

NuGet packages

• jQuery

• Bootstrap

• jQuery validation

• jQuery validation unobtrusive

• Modernizr

• Respond

Page 7: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

jQuery

JavaScript library

Most popular

Open-source

Released in 2006

Easier to select DOM elements

Used in Bootstrap and other libraries

Page 8: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

jQuery

Start with $(document).ready(function(){

AJAX calls $.ajax({

Element selector $(".item")

Chaining $(".item").addClass("blue").slideDown("slow");

Jquery.ui, jquery.validation

Page 9: Quick start guide to java script frameworks for sharepoint apps spsbe-2015
Page 10: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Bootstrap

The most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web

Open-source

Twitter Bootstrap in 2011

Bootstrap 3.0 - mobile first

Page 11: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Bootstrap made sites

http://expo.getbootstrap.com/

Page 12: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Bootstrap

CSS Grid, typography, code, tables, forms, buttons, images

Components Glyphicons, dropdowns, input, navs, nav bars, breadcrumbs, pagination, labels,

badges, jumbotron, page header, thumbnails, alerts, progress bars, media object, list group, panels, responsive embed, wells

JavaScript Transitions, modal, dropdown, scrollspy, tab, tooltip, popover, alert, button,

collapse, carousel, affix

Customize

Page 13: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

SP Table / Bootstrap Div

<table><tr><td>

<div class=“container”>

<div class=“row”><div class=“col-md-6 col-xs-12”>

Phones (xs – auto width), Tablets (sm – 750px), desktops(md – 970px), large (lg – 1170px)

Page 14: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Bootstrap / SharePoint list item form

Bootstrap - label and text field<div class="form-group">

<label for="inputSite3" class="col-sm-2 control-label"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>

Site Title

</label>

<input type="text" class="form-control" id="inputEmail3" placeholder="Site Title" required />

</div>

SharePoint – label and text field<tr>

<td nowrap="true" valign="top" width="113px" class="ms-formlabel"><h3 class="ms-standardheader">

<label for="inputSite3" class="ms-standardheader">

Site Title

</label>

</h3></td>

<td valign="top" width="350px" class="ms-formbody">

<!-- FieldName="Title"

FieldInternalName="Title"

FieldType="SPFieldText"

-->

<input type="text" class="ms-long ms-spellcheck-true"" id="inputEmail3" placeholder="Site Title" required />

</td>

</tr>

Page 15: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

CSS Classes

Bootstrap

<div class=“col-md-6 col-md-offset-2 hidden-xs col-lg-12”>

Office 365

<div autoid="__Microsoft_O365_ShellG2_Core_templates_cs_k" class="o365cs-nav-header16 o365cs-base o365cst o365spo o365cs-nav-header o365cs-topnavBGColor-2 o365cs-topnavBGImage" id="O365_NavHeader">

Custom LESS stylesheet with Bootstrap

<div class=“col-md-6 col-md-offset-2 hidden-xs –col-lg-12”>

HTML

<div class=“demoblock”>

LESS

.demoblock

{

. col-md-6;

.col-md-offset-2;

.hidden-xs;

.col-lg-12;

}

Page 16: Quick start guide to java script frameworks for sharepoint apps spsbe-2015
Page 17: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

DEMO Bootstrap SharePoint hosted app

Page 18: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Bootstrap Themes

Bootswatch – free themes at bootswatch.com

Wrapbootstrap – payed themes at wrapbootstrap.com

Page 19: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Validation with jQuery

Jquery.validation

Jquery.validation.unobtrusive

Page 20: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Validation / UnobtrusiveHTML

<input type=“text” id=“SiteTitle”

JavaScript

rules: {

"SiteTitle": { required: true,

minlength: 5 }

},

messages: {

"SiteTitle": {

required: "Please enter the site

title.",

minlength: "Minimum length is 5

letters."

}

}

HTML

<input type="text“ id=“SiteTitle”

data-rule-required="true"

data-msg-required="The Site Title

field is required.“

data-rule-minlength="5"

data-msg-minlength="The

minimum length is 5 letters.“

JavaScript

$form.validate();

Page 21: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

DEMO Validation

Page 22: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Modernizr

Detects HTML5 and CSS3 features that your browser supports on page load

Result of “feature detection” is “yes” or “no”

Adds classes to HTML

https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills

Support IE6+, Firefox 3.5+, Opera 9.6+, Safari 2+, Chrome

Page 23: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Modernizr

Yepnopejs is deprecated

Modernizr.load({

test: Modernizr.borderradius,

yep : alert("This browser supports border radius."),

nope: 'PIE_IE678.js'

});

Page 24: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Respondjs

It loops through the CSS referenced on the page

IE8: re-requests the CSS files using Ajax

Polyfill for CSS min-width and max-width in browsers that don't support CSS3 Media Queries

Page 25: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Polyfills, shims

Shim: a generic code, a library that brings a new API to an older environment

Polyfill: downloadable code with fallback for functionality that is not available in your browser

https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills

Page 26: Quick start guide to java script frameworks for sharepoint apps spsbe-2015
Page 27: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Links jQuery http://api.jquery.com/

Bootstrap tutorial http://www.tutorialspoint.com/bootstrap/bootstrap_tutorial.pdf

Modernizr http://modernizr.com/docs/

Respond https://github.com/scottjehl/Respond

Building Responsive UI with Bootstrap on MVA

http://www.microsoftvirtualacademy.com/training-courses/building-responsive-ui-with-bootstrap

Page 28: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Pla

tin

um

Go

ldSilver

Thanks to our sponsors!

Page 29: Quick start guide to java script frameworks for sharepoint apps spsbe-2015

Thank you!

Page 30: Quick start guide to java script frameworks for sharepoint apps spsbe-2015