Explorar o código

Merge commit 'c131be01abd87d43f7b0979dae349853e91a351c' into feat/use-MongoDB-GridFS-for-file-storage

yusueketk %!s(int64=7) %!d(string=hai) anos
pai
achega
a9edf3fd18

+ 1 - 1
config/webpack.common.js

@@ -58,7 +58,7 @@ module.exports = (options) => {
     },
     resolve: {
       extensions: ['.js', '.jsx', '.json'],
-      modules: [helpers.root('node_modules')],
+      modules: ((options.resolve && options.resolve.modules) || []).concat([helpers.root('node_modules')]),
       alias: {
         '@root': helpers.root('/'),
         '@commons': helpers.root('src/lib'),

+ 1 - 2
config/webpack.dev.js

@@ -24,8 +24,7 @@ module.exports = require('./webpack.common')({
     'js/dev': './src/client/js/dev',
   },
   resolve: {
-    // TODO merge in webpack.common.js
-    modules: [path.join(process.env.HOME, '.node_modules')],
+    modules: ['../node_modules'],
   },
   module: {
     rules: [

+ 2 - 1
resource/locales/en-US/translation.json

@@ -255,7 +255,6 @@
     "Package name": "Package name",
     "Specified version": "Specified version",
     "Installed version": "Installed version"
-
   },
 
   "app_setting": {
@@ -265,7 +264,9 @@
     "Site URL": "Site URL",
     "siteurl_help": "Site full URL beginning from <code>http://</code> or <code>https://</code>.",
     "Confidential name": "Confidential name",
+    "Default Language for new users": "Default Language for new users",
     "ex): internal use only":"ex): internal use only",
+    "File Uploading": "File Uploading",
     "enable_files_except_image": "Enable file upload other than image files.",
     "attach_enable": "You can attach files other than image files if you enable this option.",
     "Update": "Update",

+ 2 - 3
resource/locales/ja/translation.json

@@ -271,9 +271,6 @@
     "Package name": "パッケージ名",
     "Specified version": "指定バージョン",
     "Installed version": "インストールされているバージョン"
-
-
-
   },
 
   "app_setting": {
@@ -283,7 +280,9 @@
     "Site URL": "サイトURL",
     "siteurl_help": "<code>http://</code> または <code>https://</code> から始まるサイトのURL。",
     "Confidential name": "コンフィデンシャル表示",
+    "Default Language for new users": "新規ユーザーのデフォルト設定言語",
     "ex): internal use only": "例: 社外秘",
+    "File Uploading": "ファイルアップロード",
     "enable_files_except_image": "画像以外のファイルアップロードを許可",
     "attach_enable": "許可をしている場合、画像以外のファイルをページに添付可能になります。",
     "Update": "更新",

+ 1 - 1
src/client/js/components/PageEditor/HandsontableModal.jsx

@@ -130,7 +130,7 @@ export default class HandsontableModal extends React.PureComponent {
 
   save() {
     if (this.props.onSave != null) {
-      this.props.onSave(this.state.markdownTable);
+      this.props.onSave(this.state.markdownTable.clone().normalizeCells());
     }
 
     this.hide();

+ 1 - 1
src/client/js/components/PageEditor/MarkdownTableDataImportForm.jsx

@@ -45,7 +45,7 @@ export default class MarkdownTableDataImportForm extends React.Component {
         result = MarkdownTable.fromHTMLTableTag(this.state.data);
         break;
     }
-    return result;
+    return result.normalizeCells();
   }
 
   render() {

+ 13 - 0
src/client/js/models/MarkdownTable.js

@@ -40,6 +40,19 @@ export default class MarkdownTable {
     return new MarkdownTable(newTable, this.options);
   }
 
+  /**
+   * normalize all cell data(trim & convert the newline character to space)
+   */
+  normalizeCells() {
+    for (let i = 0; i < this.table.length; i++) {
+      for (let j = 0; j < this.table[i].length; j++) {
+        this.table[i][j] = this.table[i][j].trim().replace(/\r?\n/g, ' ');
+      }
+    }
+
+    return this;
+  }
+
   /**
    * return a MarkdownTable instance made from a string of HTML table tag
    *

+ 5 - 2
src/client/styles/agile-admin/inverse/colors/_apply-colors.scss

@@ -34,11 +34,14 @@ body{
 }
 
 .navbar-header{
-     background:$topbar;
+  background:$topbar;
 }
-.navbar-top-links > li > a{
+.navbar-top-links > li > a {
     color:$white;
 }
+.navbar-top-links .confidential {
+  background-color: darken($topbar, 10%);
+}
 /*
 .notify .heartbit{
     border-color:$white;

+ 2 - 8
src/client/styles/scss/_layout.scss

@@ -6,14 +6,8 @@
   .navbar-top-links { // {{{
     .confidential {
       a {
-        // border: solid 2px #f00;
-        // background: #fff;
-        // color: #f00;
-        // font-weight: bold;
-        // height: 42px;
-        // margin-top: 5px;
-        // padding: 10px;
-        // margin-right: 5px;
+        cursor: default;
+        font-weight: bold;
       }
     }
 

+ 1 - 0
src/server/form/admin/app.js

@@ -7,6 +7,7 @@ module.exports = form(
   field('settingForm[app:title]').trim(),
   field('settingForm[app:siteUrl]').trim().required().isUrl(),
   field('settingForm[app:confidential]'),
+  field('settingForm[app:globalLang]'),
   field('settingForm[app:fileUpload]').trim().toBooleanStrict()
 );
 

+ 1 - 0
src/server/routes/me.js

@@ -117,6 +117,7 @@ module.exports = function(crowi, app) {
             Object.keys(err.errors).forEach((e) => {
               req.form.errors.push(err.errors[e].message);
             });
+
             return res.render('me/index', {});
           }
           req.i18n.changeLanguage(lang);

+ 16 - 1
src/server/views/admin/app.html

@@ -60,7 +60,22 @@
         </div>
 
         <div class="form-group">
-          <div class="col-xs-offset-3 col-xs-6">
+          <label class="col-xs-3 control-label tbd">(TBD) {{ t('app_setting.Default Language for new users') }}</label>
+          <div class="col-xs-6">
+            <div class="radio radio-primary radio-inline">
+                <input type="radio" id="radioLangEn" name="userForm[globalLang]" value="{{ consts.language.LANG_EN_US }}" {% if user.lang == consts.language.LANG_EN_US %}checked="checked"{% endif %}>
+                <label for="radioLangEn">{{ t('English') }}</label>
+            </div>
+            <div class="radio radio-primary radio-inline">
+                <input type="radio" id="radioLangJa" name="userForm[globalLang]" value="{{ consts.language.LANG_JA }}" {% if user.lang == consts.language.LANG_JA %}checked="checked"{% endif %}>
+                <label for="radioLangJa">{{ t('Japanese') }}</label>
+            </div>
+          </div>
+        </div>
+
+        <div class="form-group">
+          <label class="col-xs-3 control-label">{{ t('app_setting.File Uploading') }}</label>
+          <div class="col-xs-6">
             <div class="checkbox checkbox-info">
               <input type="checkbox" id="cbFileUpload" name="settingForm[app:fileUpload]" value="1"
                 {% if settingForm['app:fileUpload'] %}

+ 5 - 6
src/server/views/admin/customize.html

@@ -65,12 +65,6 @@
       <form action="/_api/admin/customize/layout" method="post" class="form-horizontal" id="customlayoutSettingForm" role="form">
       <fieldset>
         <legend>{{ t('customize_page.Layout') }}</legend>
-        {% if env === 'development' %}
-          <br>
-          <div class="alert alert-warning">
-            <strong>DEBUG MESSAGE:</strong> development build では、リアルタイムプレビューが無効になります
-          </div>
-        {% endif %}
         <div class="form-group">
           <div class="col-sm-4">
             <h4>
@@ -134,6 +128,11 @@
           </div>
         </div>
         <h2>{{ t('customize_page.Theme') }}</h2>
+        {% if env === 'development' %}
+          <div class="alert alert-warning">
+            <strong>DEBUG MESSAGE:</strong> development build では、リアルタイムプレビューが無効になります
+          </div>
+        {% endif %}
         <div id="themeOptions" {% if 'kibela' == settingForm['customize:layout'] %}class="disabled"{% endif %}>
           {# Light Themes #}
           <div class="d-flex">