You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by am...@apache.org on 2020/06/17 22:53:39 UTC

[couchdb-fauxton] branch master updated: feat: prototype news page (#1284)

This is an automated email from the ASF dual-hosted git repository.

amaranhao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git


The following commit(s) were added to refs/heads/master by this push:
     new 93e48f4  feat: prototype news page (#1284)
93e48f4 is described below

commit 93e48f43640f623e641be2ef33ee4458d4509b4d
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Thu Jun 18 00:53:29 2020 +0200

    feat: prototype news page (#1284)
---
 .gitignore                            |  1 +
 app/addons/news/assets/less/news.less | 16 +++++++++++++++
 app/addons/news/base.js               | 28 ++++++++++++++++++++++++++
 app/addons/news/components.js         | 25 +++++++++++++++++++++++
 app/addons/news/routes.js             | 37 +++++++++++++++++++++++++++++++++++
 devserver.js                          |  2 +-
 settings.json.default.json            |  3 ++-
 7 files changed, 110 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 047db07..2d7315c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@ app/addons/*
 !app/addons/cors
 !app/addons/setup
 !app/addons/search
+!app/addons/news
 settings.json*
 i18n.json
 !settings.json.default
diff --git a/app/addons/news/assets/less/news.less b/app/addons/news/assets/less/news.less
new file mode 100644
index 0000000..f5674a4
--- /dev/null
+++ b/app/addons/news/assets/less/news.less
@@ -0,0 +1,16 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+#news-page {
+  width: 100%;
+  height: 100%;
+}
diff --git a/app/addons/news/base.js b/app/addons/news/base.js
new file mode 100644
index 0000000..cebd785
--- /dev/null
+++ b/app/addons/news/base.js
@@ -0,0 +1,28 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+import FauxtonAPI from "../../core/api";
+import News from "./routes";
+import "./assets/less/news.less";
+
+News.initialize = function () {
+  FauxtonAPI.addHeaderLink({
+    id: 'News',
+    title: 'News',
+    icon: 'fonticon-clipboard',
+    href: '#/news',
+    bottomNav: true,
+    top: true
+  });
+};
+
+export default News;
diff --git a/app/addons/news/components.js b/app/addons/news/components.js
new file mode 100644
index 0000000..c780ef5
--- /dev/null
+++ b/app/addons/news/components.js
@@ -0,0 +1,25 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+import React from "react";
+
+const NewsPage = () => {
+  return (
+    <div id="news-page" className="">
+      <iframe src="https://blog.couchdb.org" width="100%" height="100%"></iframe>
+    </div>
+  );
+};
+
+export default {
+  NewsPage: NewsPage
+};
diff --git a/app/addons/news/routes.js b/app/addons/news/routes.js
new file mode 100644
index 0000000..fd152eb
--- /dev/null
+++ b/app/addons/news/routes.js
@@ -0,0 +1,37 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+import React from 'react';
+import FauxtonAPI from "../../core/api";
+import NewsComponents from "./components";
+import {OnePaneSimpleLayout} from '../components/layouts';
+
+var NewsRouteObject = FauxtonAPI.RouteObject.extend({
+  selectedHeader: 'News',
+  hideApiBar: true,
+  hideNotificationCenter: true,
+  routes: {
+    'news': 'news'
+  },
+  roles: ['fx_loggedIn'],
+  news: function () {
+    return <OnePaneSimpleLayout
+      component={<NewsComponents.NewsPage/>}
+      crumbs={[
+        {'name': 'News'}
+      ]}
+    />;
+  }
+});
+NewsRouteObject.RouteObjects = [NewsRouteObject];
+
+export default NewsRouteObject;
diff --git a/devserver.js b/devserver.js
index 8d76bd6..3d858c0 100644
--- a/devserver.js
+++ b/devserver.js
@@ -51,7 +51,7 @@ const devSetup = function (cb) {
   });
 };
 
-const defaultHeaderValue = "default-src 'self'; child-src 'self' blob:; img-src 'self' data:; font-src 'self'; " +
+const defaultHeaderValue = "default-src 'self'; child-src 'self' blob: https://blog.couchdb.org; img-src 'self' data:; font-src 'self'; " +
                   "script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline';";
 function getCspHeaders () {
   if (!settings.contentSecurityPolicy) {
diff --git a/settings.json.default.json b/settings.json.default.json
index d11150f..02979f9 100644
--- a/settings.json.default.json
+++ b/settings.json.default.json
@@ -14,7 +14,8 @@
   { "name": "permissions" },
   { "name": "auth" },
   { "name": "verifyinstall" },
-  { "name": "documentation" }
+  { "name": "documentation" },
+  { "name": "news" }
   ],
     "template": {
       "development": {