Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions common/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
*/
// client configuration
if (Meteor.isClient) {
// override/set layout
DEFAULT_LAYOUT = "coreLayout";
// override/set workflow
DEFAULT_WORKFLOW = "coreWorkflow";

// Use this to override just the home Package
// ie: {template: "products"}
INDEX_OPTIONS = {};

// default load qty for product grid
ITEMS_INCREMENT = 24;
// sets default number of product displayed on a grid
Session.setDefault("productScrollLimit", ITEMS_INCREMENT);
Expand Down
2 changes: 1 addition & 1 deletion packages/reaction-core/client/helpers/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Template.registerHelper("reactionTemplate", function (options) {
const reactionTemplates = [];
// fetch collection from shop.layout configuration
let layout = _.findWhere(Shop.layout, {
workflow: options.hash.workflow || "coreWorkflow"
workflow: options.hash.workflow || DEFAULT_WORKFLOW || "coreWorkflow"
});

let layoutConfigCollection;
Expand Down
2 changes: 1 addition & 1 deletion packages/reaction-core/server/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ReactionCore.registerPackage({
}
}, {
layout: "coreLayout",
workflow: "coreWorkflow",
workflow: "coreUnauthorized",
theme: "default",
enabled: true,
structure: {
Expand Down
4 changes: 3 additions & 1 deletion packages/reaction-router/common/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,13 @@ ReactionRouter.initPackageRoutes = () => {

//
// index / home route
// to overide layout, ie: home page templates
// set DEFAULT_LAYOUT, in config.js
//
shop.route("/", {
name: "index",
action: function () {
ReactionLayout();
ReactionLayout(INDEX_OPTIONS);
}
});

Expand Down
10 changes: 7 additions & 3 deletions packages/reaction-router/common/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ selectLayout = (layout, setLayout, setWorkflow) => {
* @returns {Object} layout - return object of template definitions for Blaze Layout
*/
ReactionLayout = (options = {}) => {
const layout = options.layout || "coreLayout";
const workflow = options.workflow || "coreWorkflow";
const layout = options.layout || DEFAULT_LAYOUT || "coreLayout";
const workflow = options.workflow || DEFAULT_WORKFLOW || "coreWorkflow";

// this only occurs if you aren't overriding
// with custom options, merges the default (that is already assigned to layout/workflow)
// so that the "newLayout" is actually the old layout
if (!options.layout) {
options.layout = "coreLayout";
}
Expand All @@ -44,7 +48,7 @@ ReactionLayout = (options = {}) => {
if (ReactionCore.Subscriptions.Shops.ready()) {
const shop = ReactionCore.Collections.Shops.findOne(ReactionCore.getShopId());
if (shop) {
const newLayout = shop.layout.find((x) => selectLayout(x, layout, workflow));
const newLayout = shop.layout.reverse().find((x) => selectLayout(x, layout, workflow));
// oops this layout wasn't found. render notFound
if (!newLayout) {
BlazeLayout.render("notFound");
Expand Down
1 change: 1 addition & 0 deletions packages/reaction-ui/.npm/package/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.