From c7d0d2efb0df207f87bd775a884e84751012bc7d Mon Sep 17 00:00:00 2001 From: Yaroslav Rogoza Date: Wed, 3 Apr 2019 12:37:01 +0200 Subject: [PATCH 1/6] GraphQl Example of adding product to cart with customizable options --- guides/v2.3/graphql/reference/quote.md | 76 ++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/guides/v2.3/graphql/reference/quote.md b/guides/v2.3/graphql/reference/quote.md index 69a2e46a840..004561e1c65 100644 --- a/guides/v2.3/graphql/reference/quote.md +++ b/guides/v2.3/graphql/reference/quote.md @@ -220,6 +220,82 @@ mutation { } ``` +### Adding simple product with customizable options to a cart + +If a product has a customizable option, the option's value can be specified in the add to cart request. + +**Request** + +``` text +mutation { + addSimpleProductsToCart (input: { + cart_id: "nu31JXR9DaqbdVqFDGnqjrMJmUnT3mzB" + cartItems: { + data: { + sku:"simple" + qty:1 + }, + customizable_options: [ + { + id: 121 + value: "field value" + } + ] + } + }) { + cart { + items { + product { + name + } + qty + + ... on SimpleCartItem { + customizable_options { + label + values { + value + } + } + } + } + } + } +} +``` + +**Response** + +```text +{ + "data": { + "addSimpleProductsToCart": { + "cart": { + "items": [ + { + "product": { + "name": "simple" + }, + "qty": 2, + "customizable_options": [ + { + "label": "Field Option", + "values": [ + { + "value": "field value" + } + ] + } + ] + } + ] + } + } + } +} +``` + + ### Updating billing and shipping information {:.no_toc} From b2880cda97375c113afd3f951663fb6179c3259c Mon Sep 17 00:00:00 2001 From: Dima Shevtsov Date: Mon, 15 Apr 2019 16:15:52 -0500 Subject: [PATCH 2/6] Implement Docfile Add Docfile that contatins configuration for devdocs content management Implement rake automation to use the Docfile locally and on CICD --- Docfile | 5 +++++ Rakefile | 1 + rakelib/lib/doc-config.rb | 21 +++++++++++++++++++++ rakelib/multirepo.rake | 21 +++++++++++++-------- 4 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 Docfile create mode 100644 rakelib/lib/doc-config.rb diff --git a/Docfile b/Docfile new file mode 100644 index 00000000000..7dbc6543d24 --- /dev/null +++ b/Docfile @@ -0,0 +1,5 @@ +The "guides/v2.0" directory contains all content from the "2.0" branch of the "magento/devdocs" repository. +The "guides/m1x" directory contains all content from the "master" branch of the "magento/devdocs-m1" repository. +The "mbi" directory contains only "docs" content from the "master" branch of the "magento/devdocs-mbi" repository. +The "page-builder" directory contains only "docs" content from the "develop" branch of the "magento-devdocs/magento2-page-builder" repository. +The "mftf" directory contains only "docs" content from the "develop" branch of the "magento/magento2-functional-testing-framework" repository. \ No newline at end of file diff --git a/Rakefile b/Rakefile index c100a40e52c..2ba8f224524 100644 --- a/Rakefile +++ b/Rakefile @@ -15,6 +15,7 @@ require 'colorator' require_relative 'rakelib/lib/link-checker.rb' require_relative 'rakelib/lib/converter.rb' require_relative 'rakelib/lib/double-slash-check.rb' +require_relative 'rakelib/lib/doc-config.rb' desc "Same as 'rake', 'rake preview'" task default: %w[preview] diff --git a/rakelib/lib/doc-config.rb b/rakelib/lib/doc-config.rb new file mode 100644 index 00000000000..caad28bdd13 --- /dev/null +++ b/rakelib/lib/doc-config.rb @@ -0,0 +1,21 @@ +# Read Docfile file and get configuration data for adding subrepositories +class DocConfig + attr_reader :config + def initialize(config_file = 'Docfile') + @config_data = File.readlines(config_file) + @config = [] + parse_file + end + + def parse_file + @config = + @config_data.map do |string| + { + 'directory' => string[/(?<=")[^"]+(?="\sdirectory)/], + 'repository' => string[/(?<=")[^"]+(?="\srepository)/], + 'branch' => string[/(?<=")[^"]+(?="\sbranch)/], + 'filter' => string.match?(/(?<=")[^"]+(?="\scontent)/) + } + end + end +end diff --git a/rakelib/multirepo.rake b/rakelib/multirepo.rake index 25f7587403a..54bc6d1c2c8 100644 --- a/rakelib/multirepo.rake +++ b/rakelib/multirepo.rake @@ -1,14 +1,19 @@ namespace :multirepo do - desc 'Add content from external repositories' + desc 'Create a file tree for devdocs website and get all required content' task :init do - sh './scripts/docs-from-code.sh mbi git@github.com:magento/devdocs-mbi.git master' - sh './scripts/docs-from-code.sh page-builder git@github.com:magento-devdocs/magento2-page-builder.git develop' - sh './scripts/docs-from-code.sh mftf git@github.com:magento/magento2-functional-testing-framework.git develop' + ssh = 'git@github.com:' + https = 'https://${token}@github.com/' + protocol = + if ENV['token'] + https + else + ssh + end - # The last argument 'false' disables content filtering by sparse checkout. - # It covers cases when we need entire repository, not only the '/docs/' directory. - sh './scripts/docs-from-code.sh guides/m1x git@github.com:magento/devdocs-m1.git master false' - sh './scripts/docs-from-code.sh guides/v2.0 git@github.com:magento/devdocs.git 2.0 false' + config = DocConfig.new.config + config.each do |subrepo| + sh "./scripts/docs-from-code.sh #{subrepo['directory']} #{protocol}#{subrepo['repository']}.git #{subrepo['branch']} #{subrepo['filter']}" + end end desc 'Add multirepo docs providing shell arguments "dir=", "repo=", "branch=", "filter=" ("true" by default) to 1) filter content if "true" or 2) add content from the entire repository if "false".' From 03a433ea0c610e333aca3ae351853fde03ac782b Mon Sep 17 00:00:00 2001 From: Dmitry Shevtsov <12731225+dshevtsov@users.noreply.github.com> Date: Mon, 15 Apr 2019 17:04:25 -0500 Subject: [PATCH 3/6] Update Docfile Add a blank line at the end of file --- Docfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docfile b/Docfile index 7dbc6543d24..116e9132fc6 100644 --- a/Docfile +++ b/Docfile @@ -2,4 +2,4 @@ The "guides/v2.0" directory contains all content from the "2.0" branch of the "m The "guides/m1x" directory contains all content from the "master" branch of the "magento/devdocs-m1" repository. The "mbi" directory contains only "docs" content from the "master" branch of the "magento/devdocs-mbi" repository. The "page-builder" directory contains only "docs" content from the "develop" branch of the "magento-devdocs/magento2-page-builder" repository. -The "mftf" directory contains only "docs" content from the "develop" branch of the "magento/magento2-functional-testing-framework" repository. \ No newline at end of file +The "mftf" directory contains only "docs" content from the "develop" branch of the "magento/magento2-functional-testing-framework" repository. From 6114e1b192241692c50c0e8aa07d09ec29faff63 Mon Sep 17 00:00:00 2001 From: Dima Shevtsov Date: Wed, 17 Apr 2019 16:39:35 -0500 Subject: [PATCH 4/6] Change Docfile to YAML --- Docfile | 5 ----- Docfile.yml | 26 ++++++++++++++++++++++++++ rakelib/lib/doc-config.rb | 18 ++++-------------- rakelib/multirepo.rake | 4 ++-- 4 files changed, 32 insertions(+), 21 deletions(-) delete mode 100644 Docfile create mode 100644 Docfile.yml diff --git a/Docfile b/Docfile deleted file mode 100644 index 7dbc6543d24..00000000000 --- a/Docfile +++ /dev/null @@ -1,5 +0,0 @@ -The "guides/v2.0" directory contains all content from the "2.0" branch of the "magento/devdocs" repository. -The "guides/m1x" directory contains all content from the "master" branch of the "magento/devdocs-m1" repository. -The "mbi" directory contains only "docs" content from the "master" branch of the "magento/devdocs-mbi" repository. -The "page-builder" directory contains only "docs" content from the "develop" branch of the "magento-devdocs/magento2-page-builder" repository. -The "mftf" directory contains only "docs" content from the "develop" branch of the "magento/magento2-functional-testing-framework" repository. \ No newline at end of file diff --git a/Docfile.yml b/Docfile.yml new file mode 100644 index 00000000000..40f8fc69ce6 --- /dev/null +++ b/Docfile.yml @@ -0,0 +1,26 @@ +content_map: +- + directory: guides/v2.0 + repository: magento/devdocs + branch: 2.0 + filter: false +- + directory: guides/m1x + repository: magento/devdocs-m1 + branch: master + filter: false +- + directory: mbi + repository: magento/devdocs-mbi + branch: master + filter: true +- + directory: mftf + repository: magento/magento2-functional-testing-framework + branch: develop + filter: true +- + directory: page-builder + repository: magento-devdocs/magento2-page-builder + branch: develop + filter: true diff --git a/rakelib/lib/doc-config.rb b/rakelib/lib/doc-config.rb index caad28bdd13..361efe90a92 100644 --- a/rakelib/lib/doc-config.rb +++ b/rakelib/lib/doc-config.rb @@ -1,21 +1,11 @@ # Read Docfile file and get configuration data for adding subrepositories class DocConfig attr_reader :config - def initialize(config_file = 'Docfile') - @config_data = File.readlines(config_file) - @config = [] - parse_file + def initialize(config_file = 'Docfile.yml') + @config = YAML.load_file(config_file) end - def parse_file - @config = - @config_data.map do |string| - { - 'directory' => string[/(?<=")[^"]+(?="\sdirectory)/], - 'repository' => string[/(?<=")[^"]+(?="\srepository)/], - 'branch' => string[/(?<=")[^"]+(?="\sbranch)/], - 'filter' => string.match?(/(?<=")[^"]+(?="\scontent)/) - } - end + def content_map + @config['content_map'] end end diff --git a/rakelib/multirepo.rake b/rakelib/multirepo.rake index 54bc6d1c2c8..bbdad0f39a3 100644 --- a/rakelib/multirepo.rake +++ b/rakelib/multirepo.rake @@ -10,8 +10,8 @@ namespace :multirepo do ssh end - config = DocConfig.new.config - config.each do |subrepo| + content_map = DocConfig.new.content_map + content_map.each do |subrepo| sh "./scripts/docs-from-code.sh #{subrepo['directory']} #{protocol}#{subrepo['repository']}.git #{subrepo['branch']} #{subrepo['filter']}" end end From 1b62c7f30ca4e7af0ad095efd2bfcfd16ec7c7f5 Mon Sep 17 00:00:00 2001 From: Dima Shevtsov Date: Wed, 17 Apr 2019 16:43:53 -0500 Subject: [PATCH 5/6] Update gitignore file --- .gitignore | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 95e9639356c..b25a33fc130 100644 --- a/.gitignore +++ b/.gitignore @@ -8,15 +8,8 @@ /_site/ -/.* -!/.github -!/.github/** - -/*.yml -!/_config.yml -!/_config.prod.yml -!/_config.checks.yml -!/_config.stage.yml +_config.local.yml +.jekyll-metadata *.bat /tmp/ From 1159ecc4badfb12164fb2dd2c91abbd2c11815fe Mon Sep 17 00:00:00 2001 From: Sanjay Vadadoriya <39721144+magesanjay@users.noreply.github.com> Date: Mon, 22 Apr 2019 23:18:44 +0530 Subject: [PATCH 6/6] Update link as current Devdoc Magento version (#4297) * Update link as current Devdoc Magento version * update constant for url in V2.1 * Apply suggestions from code review Slash Added in URL Co-Authored-By: magesanjay <39721144+magesanjay@users.noreply.github.com> * Apply suggestions from code review Co-Authored-By: magesanjay <39721144+magesanjay@users.noreply.github.com> * Update path urls * Update link url for widget --- guides/v2.1/javascript-dev-guide/javascript/js_init.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/v2.1/javascript-dev-guide/javascript/js_init.md b/guides/v2.1/javascript-dev-guide/javascript/js_init.md index ef84a0f7801..316389b2e72 100644 --- a/guides/v2.1/javascript-dev-guide/javascript/js_init.md +++ b/guides/v2.1/javascript-dev-guide/javascript/js_init.md @@ -10,7 +10,7 @@ redirect_from: This topic describes different ways to call and initialize JavaScript in Magento 2: -- Insert a [JavaScript component]({{ site.gdeurl }}javascript-dev-guide/bk-javascript-dev-guide.html#js_terms) in `.phtml` page templates. +- Insert a [JavaScript component]({{ page.baseurl }}/javascript-dev-guide/bk-javascript-dev-guide.html#js_terms) in `.phtml` page templates. - Call Javascript components that require initialization in Javascript (`.js`) files. We strongly recommend that you use the described approaches and do not add inline {% glossarytooltip 312b4baf-15f7-4968-944e-c814d53de218 %}JavaScript{% endglossarytooltip %}. @@ -128,7 +128,7 @@ require([ ## Calling JS components requiring initialization in JS files {#js_widget_init} -To call a widget in JS code, use a notation similar to the following ([accordion]({{ site.gdeurl }}frontend-dev-guide/javascript/widget_accordion.html) widget is intiialized on the `[data-role=example]` element as illustration): +To call a widget in JS code, use a notation similar to the following ([accordion]({{ page.baseurl }}/javascript-dev-guide/widgets/widget_accordion.html) widget is intiialized on the `[data-role=example]` element as illustration): ```javascript $('[data-role=example]').accordion();