@@ -19,10 +19,8 @@ var Card_1 = require('material-ui/Card');
1919var RaisedButton_1 = require ( 'material-ui/RaisedButton' ) ;
2020var actions_1 = require ( '../../actions' ) ;
2121var TopPanel_1 = require ( '../TopPanel' ) ;
22- var error_1 = require ( 'material-ui/svg-icons/alert/error' ) ;
23- var warning_1 = require ( 'material-ui/svg-icons/alert/warning' ) ;
24- var colors_1 = require ( 'material-ui/styles/colors' ) ;
2522var Stepper_1 = require ( 'material-ui/Stepper' ) ;
23+ var publishStep_1 = require ( './publishStep' ) ;
2624var styles = {
2725 card : {
2826 margin : '10px' ,
@@ -53,42 +51,23 @@ var TutorialPublish = (function (_super) {
5351 this . props . pjLoad ( ) ;
5452 this . props . validatePj ( ) ;
5553 } ;
54+ TutorialPublish . prototype . selectStep = function ( index ) {
55+ this . setState ( {
56+ stepIndex : index
57+ } ) ;
58+ } ;
5659 TutorialPublish . prototype . render = function ( ) {
5760 var _this = this ;
5861 var validation = this . props . validation ;
59- return ( React . createElement ( Card_1 . Card , { style : styles . card } ,
60- React . createElement ( Card_1 . CardHeader , { title : 'Tutorial Info' } ) ,
61- React . createElement ( Stepper_1 . Stepper , { activeStep : this . state . stepIndex , linear : false , orientation : 'vertical' } ,
62- validation . errors . map ( function ( field , index ) { return ( React . createElement ( Stepper_1 . Step , { key : index , completed : false } ,
63- React . createElement ( Stepper_1 . StepButton , { icon : React . createElement ( error_1 . default , { color : colors_1 . pink500 } ) , onClick : function ( ) { return _this . setState ( {
64- stepIndex : index
65- } ) ; } } , field . name ) ,
66- React . createElement ( Stepper_1 . StepContent , null ,
67- React . createElement ( "p" , null , "Example:" ) ,
68- React . createElement ( "pre" , null ,
69- React . createElement ( "code" , null ,
70- "\"" ,
71- field . name ,
72- "\": \"" ,
73- field . example ,
74- "\"" )
75- ) ) ) ) ; } ) ,
76- validation . warnings . map ( function ( field , index ) { return ( React . createElement ( Stepper_1 . Step , { key : index , completed : false } ,
77- React . createElement ( Stepper_1 . StepButton , { icon : React . createElement ( warning_1 . default , { color : colors_1 . amber500 } ) , onClick : function ( ) { return _this . setState ( {
78- stepIndex : index + validation . errors . length
79- } ) ; } } , field . name ) ,
80- React . createElement ( Stepper_1 . StepContent , null ,
81- React . createElement ( "p" , null , "Example:" ) ,
82- React . createElement ( "pre" , null ,
83- React . createElement ( "code" , null ,
84- "\"" ,
85- field . name ,
86- "\": \"" ,
87- field . example ,
88- "\"" )
89- ) ) ) ) ; } ) ) ,
90- React . createElement ( RaisedButton_1 . default , { style : styles . button , label : 'Validate' , primary : true , onTouchTap : this . validate . bind ( this ) } ) ,
91- React . createElement ( RaisedButton_1 . default , { style : styles . button , label : 'Publish' , secondary : true , disabled : validation . errors . length > 0 , onTouchTap : function ( ) { return alert ( 'Publish not yet implemented' ) ; } } ) ) ) ;
62+ return ( React . createElement ( "section" , { className : 'cr-page' } ,
63+ React . createElement ( Card_1 . Card , { style : styles . card } ,
64+ React . createElement ( Card_1 . CardHeader , { title : 'Tutorial Errors & Warnings' } ) ,
65+ React . createElement ( Stepper_1 . Stepper , { activeStep : this . state . stepIndex , linear : false , orientation : 'vertical' } ,
66+ validation . errors . map ( function ( field , index ) { return publishStep_1 . default ( index , 'error' , field , _this . selectStep . bind ( _this , index ) ) ; } ) ,
67+ validation . warnings . map ( function ( field , index ) { return publishStep_1 . default ( index + validation . errors . length , 'warning' , field , _this . selectStep . bind ( _this , index + validation . errors . length ) ) ; } ) ) ,
68+ React . createElement ( RaisedButton_1 . default , { style : styles . button , label : 'Validate' , primary : true , onTouchTap : this . validate . bind ( this ) } ) ,
69+ React . createElement ( RaisedButton_1 . default , { style : styles . button , label : 'Publish' , secondary : true , disabled : validation . errors . length > 0 , onTouchTap : function ( ) { return alert ( 'Publish not yet implemented' ) ; } } ) )
70+ ) ) ;
9271 } ;
9372 TutorialPublish = __decorate ( [
9473 react_redux_1 . connect ( function ( state ) { return ( {
0 commit comments