You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by db...@apache.org on 2016/03/16 20:00:53 UTC

docs commit: CB-10836 Adding translation links and making 'Edit' links point to correct edit locations.

Repository: cordova-docs
Updated Branches:
  refs/heads/master a9058c4e4 -> c69f5a812


CB-10836 Adding translation links and making 'Edit' links point to correct edit locations.


Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/c69f5a81
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/c69f5a81
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/c69f5a81

Branch: refs/heads/master
Commit: c69f5a812058e23579a6c45cbcb50f208e9d2a4a
Parents: a9058c4
Author: Dmitry Blotsky <dm...@gmail.com>
Authored: Thu Mar 10 04:11:27 2016 -0800
Committer: Dmitry Blotsky <dm...@gmail.com>
Committed: Wed Mar 16 11:59:46 2016 -0700

----------------------------------------------------------------------
 conf/_config.yml              |  3 ++
 tools/bin/gen_defaults.js     |  8 ++++-
 www/_layouts/docs-de.html     |  3 ++
 www/_layouts/docs-en.html     |  3 ++
 www/_layouts/docs-es.html     |  3 ++
 www/_layouts/docs-fr.html     |  3 ++
 www/_layouts/docs-it.html     |  3 ++
 www/_layouts/docs-ja.html     |  3 ++
 www/_layouts/docs-ko.html     |  3 ++
 www/_layouts/docs-pl.html     |  3 ++
 www/_layouts/docs-ru.html     |  3 ++
 www/_layouts/docs-sl.html     |  3 ++
 www/_layouts/docs-zh.html     |  3 ++
 www/_layouts/docs.html        | 56 ++++++++++++++++++++++++-----
 www/static/css-src/_docs.scss | 72 ++++++++++++++++++++------------------
 15 files changed, 128 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c69f5a81/conf/_config.yml
----------------------------------------------------------------------
diff --git a/conf/_config.yml b/conf/_config.yml
index 0e2c49f..0087e9f 100644
--- a/conf/_config.yml
+++ b/conf/_config.yml
@@ -27,6 +27,9 @@ latest_docs_version: dev
 # the docs version that is shown by default when clicking on docs links on the site
 default_linked_docs_version: latest
 
+# the language that serves as the source for the translations
+src_language: en
+
 # NOTE:
 #      this value _might_ get overwritten on some pages;
 #      see _defaults.yml, which is a generated file

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c69f5a81/tools/bin/gen_defaults.js
----------------------------------------------------------------------
diff --git a/tools/bin/gen_defaults.js b/tools/bin/gen_defaults.js
index 741adef..61dcbc5 100644
--- a/tools/bin/gen_defaults.js
+++ b/tools/bin/gen_defaults.js
@@ -88,11 +88,16 @@ function main () {
             if (versionName === latestVersionName) {
                 changeFrequency = LATEST_CHANGE_FREQUENCY;
                 pagePriority    = LATEST_PAGE_PRIORITY;
-            } else if (versionName == DEV_VERSION_NAME) {
+            } else if (versionName === DEV_VERSION_NAME) {
                 changeFrequency = DEV_CHANGE_FREQUENCY;
                 pagePriority    = DEV_PAGE_PRIORITY;
             }
 
+            var current = false;
+            if (versionName === latestVersionName || versionName === DEV_VERSION_NAME) {
+                current = true;
+            }
+
             var versionDefaults = {
                 scope: {
                     path: "docs/" + langName + "/" + versionName
@@ -103,6 +108,7 @@ function main () {
                     generated_toc:    generatedToc.replace(".yml", ""),
                     change_frequency: changeFrequency,
                     priority:         pagePriority,
+                    current:          current
                 }
             };
 

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c69f5a81/www/_layouts/docs-de.html
----------------------------------------------------------------------
diff --git a/www/_layouts/docs-de.html b/www/_layouts/docs-de.html
index 776d8e0..1f1a16e 100644
--- a/www/_layouts/docs-de.html
+++ b/www/_layouts/docs-de.html
@@ -7,6 +7,9 @@ toc_text: "Inhaltsverzeichnis"
 latest_text: "Letzte"
 visit_github_text: "Other versions are on GitHub."
 plugin_version_text: "This documentation describes this plugin at version"
+edit_text: "Edit"
+edit_source_text: "Edit Source on GitHub"
+edit_translation_text: "Edit Translation on Crowdin"
 ---
 
 {{ content }}

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c69f5a81/www/_layouts/docs-en.html
----------------------------------------------------------------------
diff --git a/www/_layouts/docs-en.html b/www/_layouts/docs-en.html
index 9031a49..84a9ae5 100644
--- a/www/_layouts/docs-en.html
+++ b/www/_layouts/docs-en.html
@@ -7,6 +7,9 @@ toc_text: "Table of Contents"
 latest_text: "Latest"
 visit_github_text: "Other versions are on GitHub."
 plugin_version_text: "This documentation describes this plugin at version"
+edit_text: "Edit"
+edit_source_text: "Edit Source on GitHub"
+edit_translation_text: "Edit Translation on Crowdin"
 ---
 
 {{ content }}

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c69f5a81/www/_layouts/docs-es.html
----------------------------------------------------------------------
diff --git a/www/_layouts/docs-es.html b/www/_layouts/docs-es.html
index 189a82c..7f6f145 100644
--- a/www/_layouts/docs-es.html
+++ b/www/_layouts/docs-es.html
@@ -7,6 +7,9 @@ toc_text: "Tabla de Contenidos"
 latest_text: "Ultima"
 visit_github_text: "Other versions are on GitHub."
 plugin_version_text: "This documentation describes this plugin at version"
+edit_text: "Edit"
+edit_source_text: "Edit Source on GitHub"
+edit_translation_text: "Edit Translation on Crowdin"
 ---
 
 {{ content }}

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c69f5a81/www/_layouts/docs-fr.html
----------------------------------------------------------------------
diff --git a/www/_layouts/docs-fr.html b/www/_layouts/docs-fr.html
index 99ae786..249de1a 100644
--- a/www/_layouts/docs-fr.html
+++ b/www/_layouts/docs-fr.html
@@ -7,6 +7,9 @@ toc_text: "Table des Matières"
 latest_text: "Dernière"
 visit_github_text: "L'autres versions sont sur Github."
 plugin_version_text: "Ce document décrit ce plugin à la version"
+edit_text: "Modifier"
+edit_source_text: "Modifier la Source sur GitHub"
+edit_translation_text: "Modifier la Traduction sur Crowdin"
 ---
 
 {{ content }}

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c69f5a81/www/_layouts/docs-it.html
----------------------------------------------------------------------
diff --git a/www/_layouts/docs-it.html b/www/_layouts/docs-it.html
index b213e4b..9f9883d 100644
--- a/www/_layouts/docs-it.html
+++ b/www/_layouts/docs-it.html
@@ -7,6 +7,9 @@ toc_text: "Sommario"
 latest_text: "Latest"
 visit_github_text: "Other versions are on GitHub."
 plugin_version_text: "This documentation describes this plugin at version"
+edit_text: "Edit"
+edit_source_text: "Edit Source on GitHub"
+edit_translation_text: "Edit Translation on Crowdin"
 ---
 
 {{ content }}

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c69f5a81/www/_layouts/docs-ja.html
----------------------------------------------------------------------
diff --git a/www/_layouts/docs-ja.html b/www/_layouts/docs-ja.html
index 428a55a..3bcf571 100644
--- a/www/_layouts/docs-ja.html
+++ b/www/_layouts/docs-ja.html
@@ -7,6 +7,9 @@ toc_text: "目次"
 latest_text: "Latest"
 visit_github_text: "Other versions are on GitHub."
 plugin_version_text: "This documentation describes this plugin at version"
+edit_text: "Edit"
+edit_source_text: "Edit Source on GitHub"
+edit_translation_text: "Edit Translation on Crowdin"
 ---
 
 {{ content }}

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c69f5a81/www/_layouts/docs-ko.html
----------------------------------------------------------------------
diff --git a/www/_layouts/docs-ko.html b/www/_layouts/docs-ko.html
index 979d164..b6cf28f 100644
--- a/www/_layouts/docs-ko.html
+++ b/www/_layouts/docs-ko.html
@@ -7,6 +7,9 @@ toc_text: "차례"
 latest_text: "Latest"
 visit_github_text: "Other versions are on GitHub."
 plugin_version_text: "This documentation describes this plugin at version"
+edit_text: "Edit"
+edit_source_text: "Edit Source on GitHub"
+edit_translation_text: "Edit Translation on Crowdin"
 ---
 
 {{ content }}

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c69f5a81/www/_layouts/docs-pl.html
----------------------------------------------------------------------
diff --git a/www/_layouts/docs-pl.html b/www/_layouts/docs-pl.html
index ef3df0c..85a3277 100644
--- a/www/_layouts/docs-pl.html
+++ b/www/_layouts/docs-pl.html
@@ -7,6 +7,9 @@ toc_text: "Spis treści"
 latest_text: "Latest"
 visit_github_text: "Other versions are on GitHub."
 plugin_version_text: "This documentation describes this plugin at version"
+edit_text: "Edit"
+edit_source_text: "Edit Source on GitHub"
+edit_translation_text: "Edit Translation on Crowdin"
 ---
 
 {{ content }}

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c69f5a81/www/_layouts/docs-ru.html
----------------------------------------------------------------------
diff --git a/www/_layouts/docs-ru.html b/www/_layouts/docs-ru.html
index 1371f8d..d56a4ed 100644
--- a/www/_layouts/docs-ru.html
+++ b/www/_layouts/docs-ru.html
@@ -7,6 +7,9 @@ toc_text: "Содержание"
 latest_text: "Последняя"
 visit_github_text: "Другие версии на GitHub."
 plugin_version_text: "Эта документация описывает этот плагин версии"
+edit_text: "Править"
+edit_source_text: "Править Исток на GitHub"
+edit_translation_text: "Править Перевод на Crowdin"
 ---
 
 <style type="text/css">

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c69f5a81/www/_layouts/docs-sl.html
----------------------------------------------------------------------
diff --git a/www/_layouts/docs-sl.html b/www/_layouts/docs-sl.html
index 535e217..0ecfa9d 100644
--- a/www/_layouts/docs-sl.html
+++ b/www/_layouts/docs-sl.html
@@ -7,6 +7,9 @@ toc_text: "Kazalo"
 latest_text: "Latest"
 visit_github_text: "Other versions are on GitHub."
 plugin_version_text: "This documentation describes this plugin at version"
+edit_text: "Edit"
+edit_source_text: "Edit Source on GitHub"
+edit_translation_text: "Edit Translation on Crowdin"
 ---
 
 {{ content }}

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c69f5a81/www/_layouts/docs-zh.html
----------------------------------------------------------------------
diff --git a/www/_layouts/docs-zh.html b/www/_layouts/docs-zh.html
index 06669c2..af6f4f7 100644
--- a/www/_layouts/docs-zh.html
+++ b/www/_layouts/docs-zh.html
@@ -7,6 +7,9 @@ toc_text: "目录"
 latest_text: "Latest"
 visit_github_text: "Other versions are on GitHub."
 plugin_version_text: "This documentation describes this plugin at version"
+edit_text: "Edit"
+edit_source_text: "Edit Source on GitHub"
+edit_translation_text: "Edit Translation on Crowdin"
 ---
 
 {{ content }}

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c69f5a81/www/_layouts/docs.html
----------------------------------------------------------------------
diff --git a/www/_layouts/docs.html b/www/_layouts/docs.html
index cd8fba2..b3a05fe 100644
--- a/www/_layouts/docs.html
+++ b/www/_layouts/docs.html
@@ -34,10 +34,10 @@ analytics_id: UA-64283057-1
 
     <!-- Page content -->
     <div class="col-md-8 col-md-offset-1">
+        <div class=" content-header">
 
-        <!-- ToC Dropdown (for XS and SM sizes only) -->
-        <div class="toc-dropdown content-header visible-xs-block visible-sm-block">
-            <div class="dropdown">
+            <!-- ToC Dropdown (for XS and SM sizes only) -->
+            <div class="toc-dropdown dropdown visible-xs-block visible-sm-block">
                 <button class="btn btn-default dropdown-toggle" type="button" id="tocDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                     {{ page.toc_text }}
                     <span class="caret"></span>
@@ -46,13 +46,53 @@ analytics_id: UA-64283057-1
                     {% include toc_recursive_dropdown.html entries=tocfile my_entry=my_entry path_to_root=path_to_root %}
                 </ul>
             </div>
-        </div>
 
-        <div class="content-header">
+            {% comment %}
+            Show a simple edit link if the page has a specific edit link.
+            {% endcomment %}
+            {% if page.edit_link %}
+                <a class="edit" href="{{ page.edit_link }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> {{ page.edit_text }}</a>
+
+            {% comment %}
+            Otherwise, have a dropdown of editing options.
+            {% endcomment %}
+            {% else %}
+
+                {% capture edit_link %}{{ site.repo.uri }}/tree/{{ site.repo.branch }}/www/{{ page.path }}{% endcapture %}
+                {% capture version_string %}/{{ page.version }}/{% endcapture %}
+                {% capture language_string %}/{{ page.language }}/{% endcapture %}
+                {% capture src_language_string %}/{{ site.src_language }}/{% endcapture %}
+
+                {% comment %}
+                Compute related edit links (i.e. source language edit link and /dev/ edit link).
+                {% endcomment %}
+                {% assign dev_edit_link     = edit_link | replace:version_string,"/dev/" %}
+                {% assign src_dev_edit_link = dev_edit_link | replace:language_string,src_language_string %}
+
+                {% comment %}
+                NOTE:
+                     Pages that are under /dev/ or /latest/ (i.e. site.latest_docs_version) have page.current set to "true".
+                {% endcomment %}
+
+                <!-- Links for editing -->
+                {% if page.language != site.src_language and page.current %}
+
+                    {% capture page_path_prefix %}docs/{{ page.language }}/{{ page.version }}{% endcapture %}
+                    {% assign page_path_end = page.path | split:"/" | last %}
+                    {% assign page_path     = page.path | replace:page_path_prefix,"docs/en/dev" | replace:page_path_end,"" %}
+                    {% capture crowdin_link %}https://crowdin.com/project/cordova/{{ page.language }}#/cordova-docs/{{ page_path }}{% endcapture %}
+
+                    <a class="edit" href="{{ src_dev_edit_link }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> {{ page.edit_source_text }}</a>
+                    <a class="edit" href="{{ crowdin_link }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> {{ page.edit_translation_text }}</a>
+
+                {% else %}
+                    {% if page.version == site.latest_docs_version %}
+                        {% assign edit_link = dev_edit_link %}
+                    {% endif %}
 
-            <a class="edit" href="{% if page.edit_link %}{{ page.edit_link }}{% else %}{{ site.repo.uri }}/tree/{{ site.repo.branch }}/www/{{ page.path }}{% endif %}">
-                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit
-            </a>
+                    <a class="edit" href="{{ edit_link }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> {{ page.edit_source_text }}</a>
+                {% endif %}
+            {% endif %}
 
             <!-- Language dropdown -->
             <div class="dropdown">

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/c69f5a81/www/static/css-src/_docs.scss
----------------------------------------------------------------------
diff --git a/www/static/css-src/_docs.scss b/www/static/css-src/_docs.scss
index c5df1ab..da627fa 100644
--- a/www/static/css-src/_docs.scss
+++ b/www/static/css-src/_docs.scss
@@ -111,50 +111,52 @@
     .content-header {
         text-align: right;
         margin-top: 22px;
+
+        /* this trick sets spacing _between_ items in .content-header, but _not inside_ them */
+        word-spacing: 0.3em;
+        * {
+            word-spacing: 0em;
+        }
+
         .alert {
-            text-align:left;
+            text-align: left;
         }
-    }
-    .toc-dropdown {
-        text-align: center;
-        width: 100%;
-        .dropdown {
-            width: inherit;
+        .dropdown, .edit {
+            margin-top: 0.3em;
+            margin-bottom: 0.3em;
+            display: inline-block;
+        }
+        .edit {
+            line-height: 32px;
+        }
+        .dropdown.toc-dropdown {
+            text-align: center;
+            width: 100%;
             button {
-                width: inherit;
+                width: 100%;
+            }
+        }
+        .dropdown {
+            .dropdown-menu {
+                left: inherit;
+                right: 0;
+            }
+            .selected {
+                font-weight: bold;
+                font-style: italic;
+            }
+            button.dropdown-toggle {
+                border-radius: 4px;
+                background-color: rgb(214, 214, 214);
+                &:hover {
+                    background-color: rgb(191, 191, 191);
+                }
             }
         }
     }
     .alert.alert-warning.alert-dismissible {
         margin-top: 15px;
     }
-    .dropdown {
-        display: inline-block;
-        &:not(:last-child) {
-            margin-right: 0.3em;
-        }
-    }
-    .dropdown .selected {
-        font-weight: bold;
-        font-style: italic;
-    }
-    .dropdown button.dropdown-toggle {
-        border-radius: 4px;
-        background-color: rgb(214, 214, 214);
-        &:hover {
-            background-color: rgb(191, 191, 191);
-        }
-    }
-
-    .dropdown-menu {
-        left: inherit;
-        right: 0;
-    }
-
-    .content-header .edit {
-        margin-right: 0.5em;
-        margin-left: 0.5em;
-    }
 
     /* missing version highlight */
     .missing-version {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org