Skip to content

Commit

Permalink
Merge pull request #1920 from reactioncommerce/development
Browse files Browse the repository at this point in the history
Release 0.19.1
  • Loading branch information
kieckhafer authored Feb 28, 2017
2 parents bd93bb1 + ada60a4 commit b846aa9
Show file tree
Hide file tree
Showing 78 changed files with 1,239 additions and 262 deletions.
8 changes: 8 additions & 0 deletions client/modules/core/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,14 @@ export default {
return false;
},

updateUserPreferences(packageName, preference, values) {
const currentPreference = this.getUserPreferences(packageName, preference, {});
return this.setUserPreferences(packageName, preference, {
...currentPreference,
...values
});
},

getShopId() {
return this.shopId;
},
Expand Down
1 change: 0 additions & 1 deletion client/modules/i18n/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ Meteor.startup(() => {
.use(i18nextBrowserLanguageDetector)
.use(i18nextLocalStorageCache)
.use(i18nextSprintfPostProcessor)
.use(i18nextJquery)
.init({
detection: options,
debug: false,
Expand Down
5 changes: 3 additions & 2 deletions client/modules/router/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,13 @@ Router.initPackageRoutes = () => {
// registryItems
if (registryItem.route) {
const {
meta,
route,
template,
layout,
workflow
} = registryItem;

// console.log(registryItem);

// get registry route name
const name = getRegistryRouteName(pkg.name, registryItem);

Expand All @@ -208,6 +207,7 @@ Router.initPackageRoutes = () => {
const newRouteConfig = {
route,
options: {
meta,
name,
template,
layout,
Expand All @@ -218,6 +218,7 @@ Router.initPackageRoutes = () => {
}
}
};

// push new routes
newRoutes.push(newRouteConfig);
} // end registryItems
Expand Down
9 changes: 5 additions & 4 deletions imports/plugins/core/ui/client/components/cards/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ class Card extends Component {
handleExpanderClick = (event) => {
this.setState({
expanded: !this.state.expanded
}, () => {
if (typeof this.props.onExpand === "function") {
this.props.onExpand(event, this, this.props.name, this.state.expanded);
}
});

if (typeof this.props.onExpand === "function") {
this.props.onExpand(event, this);
}
}

render() {
Expand Down Expand Up @@ -67,6 +67,7 @@ Card.propTypes = {
children: PropTypes.node,
expandable: PropTypes.bool,
expanded: PropTypes.bool,
name: PropTypes.string,
onExpand: PropTypes.func,
style: PropTypes.object
};
Expand Down
38 changes: 34 additions & 4 deletions imports/plugins/core/ui/client/components/cards/cardHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component, PropTypes } from "react";
import classnames from "classnames";
import CardTitle from "./cardTitle";
import IconButton from "../button/iconButton";
import Icon from "../icon/icon";
import Switch from "../switch/switch";

class CardHeader extends Component {
Expand All @@ -16,10 +17,13 @@ class CardHeader extends Component {
expandOnSwitchOn: PropTypes.bool,
expanded: PropTypes.bool,
i18nKeyTitle: PropTypes.string,
icon: PropTypes.string,
imageView: PropTypes.node,
onClick: PropTypes.func,
onSwitchChange: PropTypes.func,
showSwitch: PropTypes.bool,
switchChecked: PropTypes.bool,
switchName: PropTypes.string,
switchOn: PropTypes.bool,
title: PropTypes.string
};

Expand Down Expand Up @@ -53,6 +57,26 @@ class CardHeader extends Component {
return null;
}

renderImage() {
if (this.props.icon) {
return (
<div className="image">
<Icon icon={this.props.icon} />
</div>
);
}

if (this.props.imageView) {
return (
<div className="image">
{this.props.imageView}
</div>
);
}

return null;
}

renderDisclsoureArrow() {
const expanderClassName = classnames({
rui: true,
Expand All @@ -76,7 +100,8 @@ class CardHeader extends Component {
if (this.props.showSwitch) {
return (
<Switch
checked={this.props.switchChecked}
checked={this.props.switchOn}
name={this.props.switchName}
onChange={this.handleSwitchChange}
/>
);
Expand All @@ -97,6 +122,7 @@ class CardHeader extends Component {
return (
<div className={baseClassName}>
<div className="content-view" onClick={this.handleClick}>
{this.renderImage()}
{this.renderTitle()}
</div>
<div className="action-view">
Expand All @@ -109,8 +135,12 @@ class CardHeader extends Component {

return (
<div className={baseClassName}>
{this.renderTitle()}
{this.props.children}
<div className="content-view">
{this.renderTitle()}
</div>
<div className="action-view">
{this.props.children}
</div>
</div>
);
}
Expand Down
1 change: 1 addition & 0 deletions imports/plugins/core/ui/client/components/cards/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export { default as CardHeader } from "./cardHeader";
export { default as CardTitle } from "./cardTitle";
export { default as CardBody } from "./cardBody";
export { default as CardGroup } from "./cardGroup";
export { default as SettingsCard } from "./settingsCard";
67 changes: 67 additions & 0 deletions imports/plugins/core/ui/client/components/cards/settingsCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* Settings Card is a composite component to standardize the
* creation settings cards (panels) in the dashboard.
*/

import React, { Component, PropTypes } from "react";
import Blaze from "meteor/gadicc:blaze-react-component";
import { Card, CardHeader, CardBody } from "/imports/plugins/core/ui/client/components";

class SettingsCard extends Component {
static propTypes = {
children: PropTypes.node,
enabled: PropTypes.bool,
expanded: PropTypes.bool,
i18nKeyTitle: PropTypes.string,
icon: PropTypes.string,
name: PropTypes.string,
onExpand: PropTypes.func,
onSwitchChange: PropTypes.func,
template: PropTypes.any,
title: PropTypes.string
}

handleSwitchChange = (event, isChecked) => {
if (typeof this.props.onSwitchChange === "function") {
this.props.onSwitchChange(event, isChecked, this.props.name, this);
}
}

renderCardBody() {
if (this.props.template) {
return (
<Blaze template={this.props.template} />
);
}

return this.props.children;
}

render() {
return (
<Card
expandable={true}
onExpand={this.props.onExpand}
expanded={this.props.expanded}
name={this.props.name}
>
<CardHeader
i18nKeyTitle={this.props.i18nKeyTitle}
icon={this.props.icon}
title={this.props.title}
showSwitch={true}
actAsExpander={true}
switchOn={this.props.enabled}
switchName={this.props.name}
expandOnSwitchOn={true}
onSwitchChange={this.handleSwitchChange}
/>
<CardBody expandable={true}>
{this.renderCardBody()}
</CardBody>
</Card>
);
}
}

export default SettingsCard;
Loading

0 comments on commit b846aa9

Please sign in to comment.