Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit996a73e

Browse files
committed
Merge branch 'packageRefactor'
2 parents4d3bdbc +f4b5f92 commit996a73e

File tree

167 files changed

+1342
-1236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+1342
-1236
lines changed

‎lib/actions/_types.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ exports.ALERT_TOGGLE = 'ALERT_TOGGLE';
44
exports.COMPLETE_CHAPTER='COMPLETE_CHAPTER';
55
exports.COMPLETE_PAGE='COMPLETE_PAGE';
66
exports.COMPLETE_TUTORIAL='COMPLETE_TUTORIAL';
7-
exports.GLOBALS_SET='GLOBALS_SET';
87
exports.HINT_POSITION_SET='HINT_POSITION_SET';
98
exports.HINT_SHOW='HINT_SHOW';
109
exports.PACKAGE_SET='PACKAGE_SET';
11-
exports.PAGE_NEXT='PAGE_NEXT';
1210
exports.PAGE_SET='PAGE_SET';
1311
exports.POSITION_SET='POSITION_SET';
12+
exports.PROGRESS_LOAD='PROGRESS_LOAD';
1413
exports.ROUTE_SET='ROUTE_SET';
1514
exports.SETUP_VERIFY='SETUP_VERIFY';
1615
exports.TEST_COMPLETE='TEST_COMPLETE';
1716
exports.TEST_RESULT='TEST_RESULT';
1817
exports.TEST_RUN='TEST_RUN';
18+
exports.TESTS_LOAD='TESTS_LOAD';
1919
exports.TUTORIAL_SET='TUTORIAL_SET';
2020
exports.TUTORIAL_UPDATE='TUTORIAL_UPDATE';
2121
exports.TUTORIALS_FIND='TUTORIALS_FIND';

‎lib/actions/alert.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@ var _types_1 = require('./_types');
44
functionalertToggle(alert){
55
varisOpen=store_1.store.getState().alert.open;
66
if(!alert){
7-
alert={message:'',action:'',open:false};
7+
alert={
8+
action:'',
9+
message:'',
10+
open:false,
11+
};
812
}
913
else{
1014
alert=Object.assign({},{open:!isOpen},alert);
1115
}
12-
return{type:_types_1.ALERT_TOGGLE,payload:{alert:alert}};
16+
return{
17+
payload:{alert:alert},
18+
type:_types_1.ALERT_TOGGLE,
19+
};
1320
}
1421
exports.alertToggle=alertToggle;
1522
functionalertReplay(){

‎lib/actions/globals.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎lib/actions/hint.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
"use strict";
22
var_types_1=require('./_types');
33
functionhintPositionSet(hintPosition){
4-
return{type:_types_1.HINT_POSITION_SET,payload:{hintPosition:hintPosition}};
4+
return{
5+
payload:{hintPosition:hintPosition},
6+
type:_types_1.HINT_POSITION_SET,
7+
};
58
}
69
exports.hintPositionSet=hintPositionSet;
710
functionhintShow(){

‎lib/actions/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
varalert_1=require('./alert');
33
exports.alertToggle=alert_1.alertToggle;
44
exports.alertReplay=alert_1.alertReplay;
5-
varcomplete_1=require('./complete');
6-
exports.completePage=complete_1.completePage;
7-
exports.completeChapter=complete_1.completeChapter;
8-
exports.completeTutorial=complete_1.completeTutorial;
9-
varglobals_1=require('./globals');
10-
exports.globalsSet=globals_1.globalsSet;
5+
varprogress_1=require('./progress');
6+
exports.progressLoad=progress_1.progressLoad;
7+
exports.completePage=progress_1.completePage;
8+
exports.completeChapter=progress_1.completeChapter;
9+
exports.completeTutorial=progress_1.completeTutorial;
1110
varhint_1=require('./hint');
1211
exports.hintShow=hint_1.hintShow;
1312
exports.hintPositionSet=hint_1.hintPositionSet;
@@ -24,7 +23,7 @@ var test_1 = require('./test');
2423
exports.testRun=test_1.testRun;
2524
exports.testComplete=test_1.testComplete;
2625
exports.testResult=test_1.testResult;
26+
exports.testsLoad=test_1.testsLoad;
2727
vartutorial_1=require('./tutorial');
2828
exports.tutorialsFind=tutorial_1.tutorialsFind;
29-
exports.tutorialUpdate=tutorial_1.tutorialUpdate;
3029
exports.tutorialSet=tutorial_1.tutorialSet;

‎lib/actions/page.js

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,49 @@
11
"use strict";
22
var_types_1=require('./_types');
3+
varindex_1=require('./index');
34
varstore_1=require('../store');
4-
vartutorial_package_1=require('../services/tutorial-package');
5+
var_position={
6+
chapter:0,
7+
page:0,
8+
};
59
functionpageNext(){
6-
varposition=store_1.store.getState().position;
7-
varnextPosition=tutorial_package_1.default.getNextPosition(position);
8-
returnpageSet(nextPosition);
10+
varposition=null;
11+
var_a=store_1.store.getState().position,page=_a.page,chapter=_a.chapter;
12+
varchapters=store_1.store.getState().tutorial.chapters;
13+
if(page<chapters[chapter].pages.length-1){
14+
position={
15+
chapter:chapter,
16+
page:page+1,
17+
};
18+
}
19+
elseif(chapter<chapters.length-1){
20+
store_1.store.dispatch(index_1.completePage());
21+
position={
22+
chapter:chapter+1,
23+
page:0,
24+
};
25+
}
26+
else{
27+
store_1.store.dispatch(index_1.completeTutorial());
28+
position={
29+
chapter:chapter,
30+
page:page
31+
};
32+
}
33+
return{type:_types_1.PAGE_SET,payload:{position:position}};
934
}
1035
exports.pageNext=pageNext;
11-
functionpageSet(selectedPosition){
12-
if(selectedPosition===void0){selectedPosition={chapter:0,page:0};}
13-
if(selectedPosition.completed){
14-
return{type:_types_1.ROUTE_SET,payload:{route:'final'}};
36+
functionpageSet(position){
37+
if(position===void0){position=_position;}
38+
if(position.completed){
39+
return{
40+
payload:{route:'final'},
41+
type:_types_1.ROUTE_SET,
42+
};
1543
}
16-
varpage=tutorial_package_1.default.getPage(selectedPosition);
17-
vartasks=tutorial_package_1.default.getTasks(selectedPosition);
18-
vartaskTests=[].concat.apply([],tasks.map(function(task){returntask.tests||[];}));
19-
varactions=tasks.map(function(task){returntask.actions||[];});
20-
return{type:_types_1.PAGE_SET,payload:{page:page,tasks:tasks,position:selectedPosition,taskTests:taskTests,actions:actions}};
44+
return{
45+
payload:{position:position},
46+
type:_types_1.PAGE_SET,
47+
};
2148
}
2249
exports.pageSet=pageSet;

‎lib/actions/position.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
"use strict";
22
var_types_1=require('./_types');
33
functionpositionSet(position){
4-
return{type:_types_1.POSITION_SET,payload:{position:position}};
4+
return{
5+
payload:{position:position},
6+
type:_types_1.POSITION_SET,
7+
};
58
}
69
exports.positionSet=positionSet;

‎lib/actions/complete.jsrenamed to‎lib/actions/progress.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
"use strict";
22
var_types_1=require('./_types');
33
varstore_1=require('../store');
4+
functionprogressLoad(){
5+
return{type:_types_1.PROGRESS_LOAD};
6+
}
7+
exports.progressLoad=progressLoad;
48
functioncompletePage(){
59
varposition=store_1.store.getState().position;
610
varpageLength=store_1.store.getState().progress.chapters[position.chapter].pages.length;
711
if(position.page>=pageLength-1){
812
returncompleteChapter();
913
}
10-
return{type:_types_1.COMPLETE_PAGE,payload:{position:position}};
14+
return{
15+
payload:{position:position},
16+
type:_types_1.COMPLETE_PAGE,
17+
};
1118
}
1219
exports.completePage=completePage;
1320
functioncompleteChapter(){
@@ -16,7 +23,10 @@ function completeChapter() {
1623
if(chapter>=chapterLength-1){
1724
returncompleteTutorial();
1825
}
19-
return{type:_types_1.COMPLETE_CHAPTER,payload:{chapter:chapter}};
26+
return{
27+
payload:{chapter:chapter},
28+
type:_types_1.COMPLETE_CHAPTER,
29+
};
2030
}
2131
exports.completeChapter=completeChapter;
2232
functioncompleteTutorial(){

‎lib/actions/route.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ function setRoute(route) {
1010
store_1.store.dispatch(tutorial_1.tutorialsFind());
1111
}
1212
previous=route;
13-
return{type:_types_1.ROUTE_SET,payload:{route:route}};
13+
return{
14+
payload:{route:route},
15+
type:_types_1.ROUTE_SET,
16+
};
1417
}
1518
}
1619
exports.setRoute=setRoute;

‎lib/actions/test.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ function testRun() {
77
exports.testRun=testRun;
88
functiontestResult(result){
99
varactions=store_1.store.getState().editorActions;
10-
return{type:_types_1.TEST_RESULT,payload:{result:result,actions:actions}};
10+
return{
11+
payload:{result:result,actions:actions},
12+
type:_types_1.TEST_RESULT,
13+
};
1114
}
1215
exports.testResult=testResult;
1316
functiontestComplete(){
1417
return{type:_types_1.TEST_COMPLETE};
1518
}
1619
exports.testComplete=testComplete;
20+
functiontestsLoad(){
21+
return{type:_types_1.TESTS_LOAD};
22+
}
23+
exports.testsLoad=testsLoad;

‎lib/actions/tutorial.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
"use strict";
22
var_types_1=require('./_types');
3-
functiontutorialSet(){
4-
return{type:_types_1.TUTORIAL_SET};
3+
functiontutorialSet(name){
4+
return{
5+
payload:{name:name},
6+
type:_types_1.TUTORIAL_SET,
7+
};
58
}
69
exports.tutorialSet=tutorialSet;
7-
functiontutorialUpdate(name){
8-
return{type:_types_1.TUTORIAL_UPDATE,payload:{name:name}};
9-
}
10-
exports.tutorialUpdate=tutorialUpdate;
1110
functiontutorialsFind(){
1211
return{type:_types_1.TUTORIALS_FIND};
1312
}

‎lib/atom/editor.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,23 @@ exports.set = set;
5353
functioninsert(text,options){
5454
if(options===void0){options={};}
5555
options=Object.assign(options,{
56-
autoIndent:true
56+
autoIndent:true,
5757
});
58-
returngetEditor().then(function(editor){
58+
return(getEditor().then(functioninsertWithEditor(editor){
5959
editor.moveToBottom();
6060
editor.insertText(text,options);
6161
editor.insertNewline();
6262
editor.moveToBottom();
6363
editor.save();
6464
setCursorPosition(editor);
65-
});
65+
}));
6666
}
6767
exports.insert=insert;
68+
varcursor=/::\s?>/g;
6869
functionsetCursorPosition(editor){
69-
editor.scan(/::>/g,function(match){
70-
varstart=match.range.start;
71-
match.replace('');
72-
editor.setCursorScreenPosition(start,{autoscroll:true});
70+
editor.scan(cursor,function(scanned){
71+
editor.setCursorScreenPosition(scanned.range.start);
72+
scanned.replace('');
73+
scanned.stop();
7374
});
7475
}

‎lib/atom/main.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,20 @@
1-
'use strict';
1+
"use strict";
22
varrender_1=require('../components/render');
33
varmount_1=require('../components/mount');
44
varpolyfills_1=require('../services/polyfills');
55
varsubscriptions_1=require('./subscriptions');
66
varstore_1=require('../store');
77
varactions_1=require('../actions');
8-
functionsetDir(){
9-
if(atom.project.rootDirectories.length>0){
10-
returnatom.project.rootDirectories[0].path;
11-
}
12-
else{
13-
returnnull;
14-
}
15-
}
16-
functionsetWin(){
17-
returnnavigator.appVersion.indexOf('Win')>-1;
18-
}
198
varMain=(function(){
209
functionMain(){
2110
polyfills_1.default();
22-
window.coderoad={
23-
dir:setDir(),
24-
win:setWin()
25-
};
2611
store_1.store.dispatch(actions_1.setupVerify());
2712
this.root=mount_1.initRoot();
2813
}
2914
Main.prototype.activate=function(){
3015
atom.workspace.addRightPanel({
3116
item:this.root,
32-
priority:0
17+
priority:0,
3318
});
3419
subscriptions_1.onActivate();
3520
render_1.render(this.root);

‎lib/atom/subscriptions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var subscriptions = null;
77
functiononActivate(){
88
subscriptions=newCompositeDisposable;
99
subscriptions.add(atom.commands.add('atom-workspace',{
10-
'cr-viewer:toggle':mount_1.togglePanel
10+
'cr-viewer:toggle':mount_1.togglePanel,
1111
}));
1212
atom.workspace.observeTextEditors(function(editor){
1313
subscriptions.add(editor.onDidSave(function(){
@@ -19,7 +19,7 @@ function onActivate() {
1919
if(store_1.store.getState().route==='page'){
2020
store_1.store.dispatch(actions_1.testRun());
2121
}
22-
})
22+
}),
2323
}));
2424
returnsubscriptions;
2525
}

‎lib/components/alert/index.jsrenamed to‎lib/components/Alert/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ var Action = require('../../actions');
1919
varSnackbar_1=require('material-ui/Snackbar');
2020
varclassNames=require('classnames');
2121
vardefaultAlert={
22-
open:false,
2322
message:'',
23+
open:false,
2424
};
2525
varAlert=(function(_super){
2626
__extends(Alert,_super);
@@ -30,12 +30,12 @@ var Alert = (function (_super) {
3030
Alert.prototype.render=function(){
3131
var_a=this.props,alert=_a.alert,alertToggle=_a.alertToggle;
3232
varaction=alert.action,open=alert.open,message=alert.message,duration=alert.duration;
33-
return(React.createElement(Snackbar_1.default,{className:classNames('cr-alert',action),open:open||false,message:message||'',action:action,autoHideDuration:duration||1500,onActionTouchTap:alertToggle,onRequestClose:alertToggle}));
33+
return(React.createElement(Snackbar_1.default,{className:classNames('cr-alert',action),open:open||false,message:message||'',action:action,autoHideDuration:duration||2000,onActionTouchTap:alertToggle,onRequestClose:alertToggle}));
3434
};
3535
Alert=__decorate([
3636
react_redux_1.connect(null,function(dispatch){
3737
return{
38-
alertToggle:function(){returndispatch(Action.alertToggle());}
38+
alertToggle:function(){returndispatch(Action.alertToggle());},
3939
};
4040
}),
4141
__metadata('design:paramtypes',[])

‎lib/components/app.jsrenamed to‎lib/components/App.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var App = (function (_super) {
3535
_super.apply(this,arguments);
3636
}
3737
App.prototype.render=function(){
38+
console.log(this.props.store);
3839
return(React.createElement("section",{className:'cr',key:'main',style:{height:height}},React.createElement(index_1.AppMenu,__assign({},this.props.store)),React.createElement(Routes_1.Routes,__assign({},this.props.store)),React.createElement(index_1.Alert,__assign({},this.props.store))));
3940
};
4041
App=__decorate([

‎lib/components/AppMenu/MenuLink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var MenuLink = (function (_super) {
2929
MenuLink=__decorate([
3030
react_redux_1.connect(null,function(dispatch){
3131
return{
32-
routeTo:function(route){returndispatch(actions_1.setRoute(route));}
32+
routeTo:function(route){returndispatch(actions_1.setRoute(route));},
3333
};
3434
}),
3535
__metadata('design:paramtypes',[])

‎lib/components/AppMenu/issuesLink.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
"use strict";
22
varReact=require('react');
33
varMenuItem_1=require('material-ui/MenuItem');
4+
varstore_1=require('../../store');
45
functionissuesLink(){
5-
if(!window.coderoad.issuesPath){
6+
vartutorial=store_1.store.getState().tutorial;
7+
if(!tutorial||!tutorial.config||!tutorial.config.issuesPath){
68
returnnull;
79
}
8-
return(React.createElement(MenuItem_1.default,{key:'issue',className:'link'},React.createElement("a",{href:window.coderoad.issuesPath},"post issue")));
10+
return(React.createElement(MenuItem_1.default,{key:'issue',className:'link'},React.createElement("a",{href:tutorial.config.issuesPath},"post issue")));
911
}
1012
exports.issuesLink=issuesLink;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp