Skip to content

Commit

Permalink
Add RTL to docs
Browse files Browse the repository at this point in the history
Resolves #176
  • Loading branch information
aaronjudd committed Mar 16, 2015
1 parent 37139c7 commit 13b9b5c
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 39 deletions.
96 changes: 66 additions & 30 deletions packages/reaction-core/docs/conventions.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Conventions
Our core is being built with a preference for Coffeescript + LESS, but JavaScript is welcome in packages.
##Conventions
This entire doc is really just a bunch of stuff you'll probably need to know, or at least reference to contribute successfully to Reaction development.

Read [Meteor Style Guide](https://github.com/meteor/meteor/wiki/Meteor-Style-Guide) for format and style of contributions.
Our core is being built with a preference for Coffeescript + LESS, but JavaScript is welcome in packages. [There has been some discussion about moving to ES6.](https://github.com/reactioncommerce/reaction/issues/320)

## Issues
##Issues
For development tasks/issues please use the [Reaction project issues](https://github.com/ongoworks/reaction/issues?state=open). We're keeping this as the central issue tracking for all [reactioncommerce:*](https://github.com/reactioncommerce/) packages. You can also view issues on our [waffle board](https://waffle.io/reactioncommerce/reaction).

The default branch for reaction, reaction-core, reaction-core-theme is *development*. Pull requests made into the *development* branch, will be reviewed and accepted into development for a quick release, while we work on specific feature branches separately, to be merged into *development*.
Expand All @@ -16,23 +16,75 @@ The [ready](https://github.com/reactioncommerce/reaction/labels/ready) label gro

Of course, [in progress](https://github.com/reactioncommerce/reaction/labels/in%20progress) labels are actively being worked on.

### Testing
##Releases
We will publish packages, and merge `development` into `master`, whenever a major feature set becomes test-able.

No pull requests to `master` will be accepted.

`master` should always be a stable branch, but with a rapid merge cycle from `development`. The [release](https://github.com/reactioncommerce/reaction/releases) and published packages will be tagged for minor release or higher, and sometimes for special case patches.

###Testing
We're testing a couple of [Velocity packages](http://velocity.meteor.com/).

See: https://github.com/reactioncommerce/reaction/issues/241

* Feature branches can be merged and released when they are feature incomplete, but soon we're planning on enforcing a passing test written for every pull request.*

##Pull Requests

### Releases
We will merge `development` into `master` whenever an issue is marked done, and a PR has been submitted and accepted to development. No pull requests to `master` will be accepted.
**Caution: your own research may be needed here, feedback is appreciated!**

`master` should always be a stable branch, but with a rapid merge cycle from `development`. The [release](https://github.com/reactioncommerce/reaction/releases) and published packages will be tagged for minor release or higher, and sometimes for special case patches.

### Pull Requests
Please make sure your pull requests are to the active `development` branch, no pull requests to `master` will be accepted. When you create a pull request, you can click the 'edit' button to change the "to" branch.

##Directory structure
Please cleanup your PR into as few commits as possible (single is good).

In your branch:

```bash
git rebase -i origin/development
```


In the editor that opens, replace the words "pick" with "squash" next to the commits you want to squash into the commit before it(so all but the first one, for a single commit). Save and close the editor, and another editor instance will open the combined commit messages, tidy them up and save and close the editor.

If you need to edit the commit message later you can use

```bash
git commit --amend
```

You can now `push` your branch to GitHub. If you've already published this branch, you should create a new branch, or use `--force` (rewrites history)

```bash
git push --force
```

Finally, [create a pull request](https://help.github.com/articles/creating-a-pull-request/) into the `development` branch of the appropriate reaction package.

##Style Guide

*A work in progress, but these are good guides.*

Read [Meteor Style Guide](https://github.com/meteor/meteor/wiki/Meteor-Style-Guide) for ideas on format and style of contributions.

Generally, follow the [CoffeeScript Style Guide](https://github.com/polarmobile/coffeescript-style-guide) as well.


**event,template**

When using event, template parameters in methods, use full names

'click': (event, template) ->

**return**

As much as possible, include the `return` keyword in all functions. Include it alone if you want to return `undefined` since coffeescript will otherwise try to return some other value, and it may not be what you expect or want. Using explicit `return` also makes the code more readable for others.

**comments**
Use of `{{!-- comment --}}` rather than `<!-- comment -->` is suggested, this isn't outputed in production.


###Folder structure

public *public file assets*
private *private files*
Expand Down Expand Up @@ -65,7 +117,7 @@ Please make sure your pull requests are to the active `development` branch, no p
package.js *package declarations for meteor*


##Presentation layer
###Presentation layer

See [themes.md](themes.md) for details on the themes and LESS implementation.

Expand All @@ -80,27 +132,11 @@ See [themes.md](themes.md) for details on the themes and LESS implementation.
Template.functionalTriad.helpers
Template.functionalTriad.events

**Style Guide**

In general we try to align with the [Meteor style guide](https://github.com/meteor/meteor/wiki/Meteor-Style-Guide).

**event,template**

When using event, template parameters in methods, use full names

'click': (event, template) ->

**return**

As much as possible, include the `return` keyword in all functions. Include it alone if you want to return `undefined` since coffeescript will otherwise try to return some other value, and it may not be what you expect or want. Using explicit `return` also makes the code more readable for others.

**comments**
Use of `{{!-- comment --}}` rather than `<!-- comment -->` is suggested, this isn't outputed in production.


##Server Methods

**Variable Scope & Namespaces**
###Variable Scope & Namespaces

*common/packageGlobals.js:*

Expand Down Expand Up @@ -140,7 +176,7 @@ The `reaction-core` package exports `ReactionCore`, on both client and server:
api.export(["ReactionCore"]);
```

##Logging
###Logging
We use Bunyan for server logging https://github.com/trentm/node-bunyan. Client logging is standard Meteor client handling of `console.log`.

The ongoworks:bunyan package exports `loggers`, and is instantiated by the `ReactionCore.Events` global that can be used anywhere in Reaction code.
Expand Down
9 changes: 8 additions & 1 deletion packages/reaction-core/docs/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ Typical usage is `price = accounting.formatMoney price, ReactionCore.Locale.curr

*Note: changing base shop currency is not reactive. Refresh/restart to see changes.*

## RTL - Right to Left
Support for Right to Left languages. See [themes.md](https://github.com/reactioncommerce/reaction-core/blob/development/docs/themes.md)

The `rtl` class is added when the shops.languages language direction is 'rtl'.
See [core-theme/default/mixins.less](https://github.com/danielgindi/reaction-core-theme/blob/development/default/mixins.less#L200) file for RTL mixins that you should use instead of standard css properties when editing LESS themes.

## Fixture Data
Initial translation data that gets loaded with a new shop is located in `private/data/i18n/*.json`

Expand All @@ -56,7 +62,8 @@ New languages will need to edit the languages array in the shops collection, or
{
"label": "العربية",
"i18n": "ar",
"enabled": true
"enabled": true,
"languageDirection": "rtl"
}
]
```
Expand Down
52 changes: 44 additions & 8 deletions packages/reaction-core/docs/themes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Themes

Reaction uses [Bootstrap 3](http://getbootstrap.com/css/#less) and the [Less](http://lesscss.org) preprocessor to create its theme.
Reaction uses [Bootstrap 3](http://getbootstrap.com/css/#less) and the [Less](http://lesscss.org) preprocessor to create its theme.

## Customizing Themes
To extend and create your own themes, you can edit the the example files:
Expand All @@ -10,24 +10,24 @@ To extend and create your own themes, you can edit the the example files:

`client/themes/custom.bootstrap.import.less` is the default bootstrap settings. Here you can configure things like background, fonts, etc.

`client/themes/custom.reaction.import.less` contains all the Reaction Commerce styles.
`client/themes/custom.reaction.import.less` contains all the Reaction Commerce styles.

The `custom.reaction.less` file imports the `custom.bootstrap.less`, which in turn is created automatically from `client/themes/custom.bootstrap.import.less`, so there is an order of precedence, and any change you make in `custom.bootstrap.import.less` will cascade down to `custom.reaction.less`, but changes made in `custom.reaction.import.less` will override changes made in any other file.

You can modify either the `custom.bootstrap.json` or `custom.reaction.json` files to completely exclude (or include) particular Bootstrap or Reaction style elements.

You should not modify `custom.bootstrap.mixins.import.less`, `custom.reaction.mixins.import.less`, `custom.bootstrap.less`, `custom.reaction.less`, as these files are generated whenever you edit one of the user configurable files.

## Importing Themes
## Importing Themes
For a quick example, edit `client/themes/custom.reaction.import.less`, and the end of the file, add:

```less
```less
//--> Import example Bootstrap 3 theme using generic theme from bootswatch
@import "http://bootswatch.com/slate/bootswatch.less";
@import "http://bootswatch.com/slate/variables.less";
```

This will load a typical Bootstrap theme from Bootswatch.com, but you of course are free to load any theme or build your own. Any prebuilt theme should get you quite far, but there will be customization needed.
This will load a typical Bootstrap theme from Bootswatch.com, but you of course are free to load any theme or build your own. Any prebuilt theme should get you quite far, but there will be customization needed.

For reference when customizing, review the `import` files in the `client/themes` directory for an idea of mixins and variables that are available.

Expand All @@ -51,21 +51,57 @@ The default configuration file for Reaction build is:

If you are installing into your own application, you should save this in your project as `custom.reaction.json`. We automatically insert an import to `client/themes/custom.bootstrap.less`, so if you are not using the nemo64:bootstrap package, or choose a different location for your themes, you will need to edit the import statement in `client/themes/custom.reaction.import.less`.

## RTL - Right to Left
Support for Right to Left languages

The `rtl` class is added when the shops.languages language direction is 'rtl'.
See [core-theme/default/mixins.less](https://github.com/danielgindi/reaction-core-theme/blob/development/default/mixins.less#L200) file for RTL mixins that you should use instead of standard css properties when editing LESS themes.

For example, instead of

```
.mystyle {
padding-right: 50px;
}
```

You should use the RTL mixin:

```
.mystyle {
.padding-right: 50px;
}
```

The following RTL mixins are available:

* .rtl
* .ltr
* .left
* .right
* .margin-left
* .margin-right
* .padding-left
* .padding-right
* .float
* .clear
* .text-align

## Alternate HTML/CSS Frameworks
We've developed with Bootstrap, as it's the most common UI framework, however there are other great frameworks such as Zurb's Foundation, and other pre-processors like `Sass` or `Stylus`. It should be possible to abstract out the reaction-core classes, and use these other tools in combination with a custom theme package. Let us know if you want to get your hands dirty on this, and we'll be excited to help.


#Questions

Asked:
Asked:
What's the correlation between reaction-core-theme/theme/accounts/inline/inline.less and reaction-core/client/templates/inline/inline.import.less ?

Where do changes go?

Replied:
Replied:
See https://github.com/reactioncommerce/reaction-core/blob/12c8a495a20b0ebc699bd31d7023500e3fbc85e0/server/buildtools/module-definitions.js for the mapping logic.

You can make an update in reaction-core-theme if you think it’s something worth contributing back, just create a Pull Request to the `development` branch, and we'll review the update and merge. Alternatively, you could clone the repo and use as your own theme. *Let us know if it's great and we'll add it to the app gallery.*
You can make an update in reaction-core-theme if you think it’s something worth contributing back, just create a Pull Request to the `development` branch, and we'll review the update and merge. Alternatively, you could clone the repo and use as your own theme. *Let us know if it's great and we'll add it to the app gallery.*

Lastly, but most common, to just generally customize your instance, edit the `custom.` files in `client/themes`.

Expand Down

0 comments on commit 13b9b5c

Please sign in to comment.