@@ -398,14 +398,15 @@ <h1 id="configurations">Configurations</h1>
398
398
< h1 id ="templates "> Customizations</ h1 >
399
399
400
400
< p >
401
- The oauth directive comes to life with customisazion in mind. You can easily define
401
+ The oauth directive comes to life with customization in mind. You can easily define
402
402
personalized CSS styles or create brand new templates.
403
403
</ p >
404
404
405
- < h2 > Custom CSS</ h2 >
405
+ < h1 > Custom CSS</ h1 >
406
406
407
407
< p >
408
- By default the directive is a simple link. To improve its visual style add some CSS.
408
+ By default the directive is shown as a simple link. To improve its visual style
409
+ add some CSS rules.
409
410
</ p >
410
411
411
412
< table class ="table button ">
@@ -519,13 +520,93 @@ <h2>Custom CSS</h2>
519
520
</ p >
520
521
521
522
522
- < h2 > Custom Template</ h2 >
523
+ < h1 > Custom Template</ h1 >
523
524
524
525
< p >
525
- If the custom template does not fit for you, you can create a personalized one. Below you
526
- can see the default one .
526
+ If the custom template does not fit for you, you can create a personalized one.
527
+ Below you can see the default template used from the directive .
527
528
</ p >
528
529
530
+ < pre > < code > < xmp > < span class ="oauth ">
531
+ < a href ="# " class ="logged-out " ng-show ="show=='logged-out' " ng-click ="login() "> Sign In</ a >
532
+ < a href ="# " class ="logged-in " ng-show ="show=='logged-in' " ng-click ="logout() "> Logout {{profile.full_name}}</ a >
533
+ < a href ="# " class ="denied " ng-show ="show=='denied' " ng-click ="login() "> Access denied. Try again.</ a >
534
+ </ span > </ xmp > </ code > </ pre >
535
+
536
+ < p >
537
+ To create a new one create your personalized HTML and make it interact with the oauth
538
+ internal API.
539
+ </ p >
540
+
541
+ < table class ="table smaller-titles ">
542
+ < tbody >
543
+ < tr >
544
+ < td class ="parameter ">
545
+ < span > show</ span >
546
+ < span class ="info "> variable</ span >
547
+ </ td >
548
+ < td >
549
+ Defines the oauth status. < br >
550
+ Valid values are < code > logged-out</ code > , < code > logged-in</ code > and < code > denied</ code > .
551
+ </ td >
552
+ </ tr >
553
+ < tr >
554
+ < td class ="parameter ">
555
+ < span > login()</ span >
556
+ < span class ="info "> method</ span >
557
+ </ td >
558
+ < td >
559
+ Logs in redirecting the app to the OAuth 2.0 authorization server.
560
+ </ td >
561
+ </ tr >
562
+ < tr >
563
+ < td class ="parameter ">
564
+ < span > logout()</ span >
565
+ < span class ="info "> method</ span >
566
+ </ td >
567
+ < td >
568
+ Logs out deleting the access token.
569
+ </ td >
570
+ </ tr >
571
+ </ tbody >
572
+ </ table >
573
+
574
+ < p >
575
+ Suppose you defined a new template in < code > views/templates/custom.html</ code > .
576
+ Now you need to let the directive know about the new template. You can do it in two ways.
577
+ </ p >
578
+
579
+ < ul >
580
+ < li > Setting the template attribute</ li >
581
+ < li > Firing the template event</ li >
582
+ </ ul >
583
+
584
+ < h2 > Template attribute</ h2 >
585
+
586
+ < p >
587
+ Set the template path (or uri) as value for the template attribute.
588
+ </ p >
589
+
590
+ < pre > < code > < xmp > < oauth2
591
+ template ="views/templates/custom.html "
592
+ client-id ="<client-id> "
593
+ redirect-uri ="<redirect-uri> "
594
+ scope ="<your-scope> "
595
+ profile ="<profile-uri> ">
596
+ </ oauth2 > </ xmp > </ code > </ pre >
597
+
598
+ < h2 > Template event</ h2 >
599
+
600
+ < p >
601
+ Fires the update template event passing the template path (or uri) as param.
602
+ </ p >
603
+
604
+ < pre > < code > < xmp > $rootScope.$broadcast('oauth:template:update', 'views/templates/custom.html');</ xmp > </ code > </ pre >
605
+
606
+ < p >
607
+ The main advantage of using the update template event is that it can change the
608
+ HTML view of your directive at any moment of its life.
609
+ </ p >
529
610
530
611
</ div >
531
612
</ section >
0 commit comments