Skip to content

Commit

Permalink
administration page react template, proptypes migration
Browse files Browse the repository at this point in the history
  • Loading branch information
rtm7777 committed Jul 31, 2017
1 parent 5ff9803 commit 847af43
Show file tree
Hide file tree
Showing 26 changed files with 288 additions and 69 deletions.
67 changes: 34 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
},
"license": "MIT",
"scripts": {
"build" : "NODE_ENV=production browserify web/js/main_common.js -o public/main.js",
"build_less" : "lessc --source-map-map-inline web/less/main.less > public/css/main.css",
"build_min" : "uglifyjs public/main.js -o public/main.min.js -m -p -c drop_console --screw-ie8 ",
"watch_js" : "watchify web/js/main_common.js -o public/main.js -v -d",
"watch_less" : "watch 'npm run build_less' 'web/less'",
"watch" : "npm run watch_less & npm run watch_js",
"copy:img" : "rsync -av web/img public",
"copy:bs-fonts" : "rsync -av node_modules/bootstrap/dist/fonts public",
"copy:bs-css" : "rsync -av node_modules/bootstrap/dist/css public",
"copy:jquery" : "rsync -av node_modules/jquery/dist/jquery.min.js public",
"copy:bs" : "rsync -av node_modules/bootstrap/dist/js/bootstrap.min.js public",
"copy" : "npm run copy:img && npm run copy:bs-fonts && npm run copy:bs-css && npm run copy:jquery && npm run copy:bs",
"build_all" : "npm run build && npm run build_min && npm run copy && npm run build_less",
"test" : "BABEL_JEST_STAGE=0 jest"
"build": "NODE_ENV=production browserify web/js/main_common.js -o public/main.js",
"build_less": "lessc --source-map-map-inline web/less/main.less > public/css/main.css",
"build_min": "uglifyjs public/main.js -o public/main.min.js -m -p -c drop_console --screw-ie8 ",
"watch_js": "watchify web/js/main_common.js -o public/main.js -v -d",
"watch_less": "watch 'npm run build_less' 'web/less'",
"watch": "npm run watch_less & npm run watch_js",
"copy:img": "rsync -av web/img public",
"copy:bs-fonts": "rsync -av node_modules/bootstrap/dist/fonts public",
"copy:bs-css": "rsync -av node_modules/bootstrap/dist/css public",
"copy:jquery": "rsync -av node_modules/jquery/dist/jquery.min.js public",
"copy:bs": "rsync -av node_modules/bootstrap/dist/js/bootstrap.min.js public",
"copy": "npm run copy:img && npm run copy:bs-fonts && npm run copy:bs-css && npm run copy:jquery && npm run copy:bs",
"build_all": "npm run build && npm run build_min && npm run copy && npm run build_less",
"test": "BABEL_JEST_STAGE=0 jest"
},
"browserify": {
"transform": [
Expand Down Expand Up @@ -56,26 +56,27 @@
"jquery": "^2.1.3"
},
"devDependencies": {
"babel-core" : "^6.9.0",
"babel-eslint" : "^7.2.0",
"babel-jest" : "^20.0.0",
"babel-core": "^6.9.0",
"babel-eslint": "^7.2.0",
"babel-jest": "^20.0.0",
"babel-plugin-transform-class-properties": "^6.0.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.0.0",
"babel-preset-react" : "^6.0.0",
"babelify" : "^7.0.0",
"browserify" : "^14.0.0",
"watch" : "^1.0.0",
"debounce" : "^1.0.0",
"dexie" : "^1.0.0",
"eslint" : "^4.0.0",
"eslint-plugin-react" : "^7.0.0",
"flux" : "^3.0.0",
"jest-cli" : "^20.0.0",
"less" : "^2.7.0",
"react" : "^15.0.0",
"react-dom" : "^15.0.0",
"react-router-dom" : "^4.0.0",
"uglify-js" : "^2.0.0",
"watchify" : "^3.0.0"
"babel-preset-react": "^6.0.0",
"babelify": "^7.0.0",
"browserify": "^14.0.0",
"debounce": "^1.0.0",
"dexie": "^1.0.0",
"eslint": "^4.0.0",
"eslint-plugin-react": "^7.0.0",
"flux": "^3.0.0",
"jest-cli": "^20.0.0",
"less": "^2.7.0",
"prop-types": "^15.5.7",
"react": "^15.0.0",
"react-dom": "^15.0.0",
"react-router-dom": "^4.0.0",
"uglify-js": "^2.0.0",
"watch": "^1.0.0",
"watchify": "^3.0.0"
}
}
47 changes: 47 additions & 0 deletions web/js/actions/adminActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
class AdminActions {
constructor(dispatcher) {
this.dispatcher = dispatcher;
}

load() {
this.dispatcher.dispatch({
actionType: 'load'
});
}

selectCategory(category) {
this.dispatcher.dispatch({
actionType: 'categorySelected',
name: category
});
}

itemSelected(item, state) {
this.dispatcher.dispatch({
actionType: 'itemSelected',
id: item,
selected: state
});
}

itemChanged(data) {
this.dispatcher.dispatch({
actionType: 'itemChanged',
data
});
}

deleteAction() {
this.dispatcher.dispatch({
actionType: 'deleteAction'
});
}

addAction() {
this.dispatcher.dispatch({
actionType: 'addAction'
});
}
}

export default AdminActions;
5 changes: 3 additions & 2 deletions web/js/components/database/dbActionMenu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @jsx */
import React from "react";
import PropTypes from 'prop-types';
import SelectLink from "../selectLink";
import ActionMenuButton from "../actionMenuButton";
import DBStore from "../../stores/dbStore";
Expand All @@ -8,8 +9,8 @@ import clickAwayStore from "../../stores/clickAwayStore";

class ActionMenu extends React.Component {
static contextTypes = {
actions: React.PropTypes.object.isRequired,
store: React.PropTypes.instanceOf(DBStore).isRequired
actions: PropTypes.object.isRequired,
store: PropTypes.instanceOf(DBStore).isRequired
};

constructor(props) {
Expand Down
5 changes: 3 additions & 2 deletions web/js/components/database/dbContent.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @jsx */
import React from "react";
import PropTypes from 'prop-types';
import AudienceItem from "./items/audienceItem";
import DepartmentItem from "./items/departmentItem";
import FacultyItem from "./items/facultyItem";
Expand All @@ -12,8 +13,8 @@ import I18n from "../../services/i18n";

class Content extends React.Component {
static contextTypes = {
actions: React.PropTypes.object.isRequired,
store: React.PropTypes.instanceOf(DBStore).isRequired
actions: PropTypes.object.isRequired,
store: PropTypes.instanceOf(DBStore).isRequired
};

constructor(props) {
Expand Down
3 changes: 2 additions & 1 deletion web/js/components/database/dbLoader.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react";
import PropTypes from 'prop-types';
import Loader from "../loader";
import DBStore from "../../stores/dbStore";

class DBLoader extends Loader {
static contextTypes = {
store: React.PropTypes.instanceOf(DBStore).isRequired
store: PropTypes.instanceOf(DBStore).isRequired
};
}

Expand Down
3 changes: 2 additions & 1 deletion web/js/components/database/dbNavigation.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from "react";
import PropTypes from 'prop-types';
import Navigation from "../navigation";

class DBNavigation extends Navigation {
static contextTypes = {
actions: React.PropTypes.object.isRequired
actions: PropTypes.object.isRequired
};

selectOption = (el) => {
Expand Down
5 changes: 3 additions & 2 deletions web/js/components/item.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
/** @jsx */
import React from "react";
import PropTypes from 'prop-types';
import debounce from "debounce";
import {validateNumber, validateMinMax} from "../libs/validation";

class Item extends React.Component {
static propTypes = {
data: React.PropTypes.object
data: PropTypes.object
};

static contextTypes = {
actions: React.PropTypes.object.isRequired
actions: PropTypes.object.isRequired
};

constructor(props) {
Expand Down
5 changes: 3 additions & 2 deletions web/js/components/schedule/actionMenu/scheduleActions.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/** @jsx */
import React from "react";
import PropTypes from 'prop-types';
import ScheduleStore from "../../../stores/scheduleStore";
import I18n from "../../../services/i18n";

import ActionMenuButton from "../../actionMenuButton";

class ScheduleActions extends React.Component {
static contextTypes = {
actions: React.PropTypes.object.isRequired,
store: React.PropTypes.instanceOf(ScheduleStore).isRequired
actions: PropTypes.object.isRequired,
store: PropTypes.instanceOf(ScheduleStore).isRequired
};

constructor(props) {
Expand Down
5 changes: 3 additions & 2 deletions web/js/components/schedule/actionMenu/scheduleFilters.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @jsx */
import React from "react";
import PropTypes from 'prop-types';
import ScheduleStore from "../../../stores/scheduleStore";
import I18n from "../../../services/i18n";
import clickAwayStore from "../../../stores/clickAwayStore";
Expand All @@ -8,8 +9,8 @@ import SelectLink from "../../selectLink";

class ScheduleFilters extends React.Component {
static contextTypes = {
actions: React.PropTypes.object.isRequired,
store: React.PropTypes.instanceOf(ScheduleStore).isRequired
actions: PropTypes.object.isRequired,
store: PropTypes.instanceOf(ScheduleStore).isRequired
};

constructor(props) {
Expand Down
5 changes: 3 additions & 2 deletions web/js/components/schedule/scheduleCell.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/** @jsx */
import React from "react";
import PropTypes from 'prop-types';
import ScheduleStore from "../../stores/scheduleStore";

class SсheduleCell extends React.Component {
static contextTypes = {
actions: React.PropTypes.object.isRequired,
store: React.PropTypes.instanceOf(ScheduleStore).isRequired
actions: PropTypes.object.isRequired,
store: PropTypes.instanceOf(ScheduleStore).isRequired
};

constructor(props) {
Expand Down
3 changes: 2 additions & 1 deletion web/js/components/schedule/scheduleDaysPairsRows.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @jsx */
import React from "react";
import PropTypes from 'prop-types';
import ScheduleStore from "../../stores/scheduleStore";
import I18n from "../../services/i18n";

Expand All @@ -17,7 +18,7 @@ const PairCol = (props) => {

class DaysPairsRows extends React.Component {
static contextTypes = {
store: React.PropTypes.instanceOf(ScheduleStore).isRequired
store: PropTypes.instanceOf(ScheduleStore).isRequired
};

constructor(props) {
Expand Down
5 changes: 3 additions & 2 deletions web/js/components/schedule/scheduleGroup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @jsx */
import React from "react";
import PropTypes from 'prop-types';
import ScheduleStore from "../../stores/scheduleStore";

import DaysPairsRows from "./scheduleDaysPairsRows";
Expand All @@ -8,8 +9,8 @@ import ToggleButton from "../toggleButton";

class Group extends React.Component {
static contextTypes = {
actions: React.PropTypes.object.isRequired,
store: React.PropTypes.instanceOf(ScheduleStore).isRequired
actions: PropTypes.object.isRequired,
store: PropTypes.instanceOf(ScheduleStore).isRequired
};

constructor(props) {
Expand Down
3 changes: 2 additions & 1 deletion web/js/components/schedule/scheduleLoader.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react";
import PropTypes from 'prop-types';
import Loader from "../loader";
import ScheduleStore from "../../stores/scheduleStore";

class ScheduleLoader extends Loader {
static contextTypes = {
store: React.PropTypes.instanceOf(ScheduleStore).isRequired
store: PropTypes.instanceOf(ScheduleStore).isRequired
};
}

Expand Down
5 changes: 3 additions & 2 deletions web/js/components/schedule/scheduleWorkSpace.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/** @jsx */
import React from "react";
import PropTypes from 'prop-types';
import ScheduleStore from "../../stores/scheduleStore";

import DaysPairsRows from "./scheduleDaysPairsRows";
import Group from "./scheduleGroup";

class WorkSpace extends React.Component {
static contextTypes = {
actions: React.PropTypes.object.isRequired,
store: React.PropTypes.instanceOf(ScheduleStore).isRequired
actions: PropTypes.object.isRequired,
store: PropTypes.instanceOf(ScheduleStore).isRequired
};

constructor(props) {
Expand Down
3 changes: 2 additions & 1 deletion web/js/components/tasks/departmentsNavigation.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from "react";
import PropTypes from 'prop-types';
import Navigation from "../navigation";

class DepartmentsNavigation extends Navigation {
static contextTypes = {
actions: React.PropTypes.object.isRequired
actions: PropTypes.object.isRequired
};

selectOption = (el) => {
Expand Down
5 changes: 3 additions & 2 deletions web/js/components/tasks/taskItem.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @jsx */
import React from "react";
import PropTypes from 'prop-types';
import Item from "../item";
import SelectInput from "../selectInput";
import Popover from "../popover";
Expand All @@ -9,8 +10,8 @@ import I18n from "../../services/i18n";

class TaskItem extends Item {
static contextTypes = {
store: React.PropTypes.instanceOf(TasksStore).isRequired,
actions: React.PropTypes.object.isRequired
store: PropTypes.instanceOf(TasksStore).isRequired,
actions: PropTypes.object.isRequired
};

constructor(props) {
Expand Down
5 changes: 3 additions & 2 deletions web/js/components/tasks/tasksActionMenu.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/** @jsx */
import React from "react";
import PropTypes from 'prop-types';
import ActionMenuButton from "../actionMenuButton";
import TasksStore from "../../stores/tasksStore";
import I18n from "../../services/i18n";

class ActionMenu extends React.Component {
static contextTypes = {
actions: React.PropTypes.object.isRequired,
store: React.PropTypes.instanceOf(TasksStore).isRequired
actions: PropTypes.object.isRequired,
store: PropTypes.instanceOf(TasksStore).isRequired
};

constructor(props) {
Expand Down
5 changes: 3 additions & 2 deletions web/js/components/tasks/tasksContent.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/** @jsx */
import React from "react";
import PropTypes from 'prop-types';
import TasksStore from "../../stores/tasksStore";
import TaskItem from "./taskItem";
import I18n from "../../services/i18n";

class Content extends React.Component {
static contextTypes = {
actions: React.PropTypes.object.isRequired,
store: React.PropTypes.instanceOf(TasksStore).isRequired
actions: PropTypes.object.isRequired,
store: PropTypes.instanceOf(TasksStore).isRequired
};

constructor(props) {
Expand Down
Loading

0 comments on commit 847af43

Please sign in to comment.