From 267ae5c37c9b42d21df2c4fcc1d1d5589f7931d2 Mon Sep 17 00:00:00 2001
From: Ryan Lerch
Date: Jan 16 2018 12:19:49 +0000
Subject: add user and team bio into the hubconfig and hub header
---
diff --git a/hubs/models/hubconfig.py b/hubs/models/hubconfig.py
index 08d2923..ae19eb0 100644
--- a/hubs/models/hubconfig.py
+++ b/hubs/models/hubconfig.py
@@ -90,6 +90,7 @@ class HubConfigProxy(MutableMapping):
KEYS = (
"archived", "summary", "left_width", "avatar", "visibility",
"chat_domain", "chat_channel", "mailing_list", "calendar",
+ "bio",
) + tuple(p["name"] for p in DEV_PLATFORMS)
CONVERTERS = {
"archived": BooleanConverter(),
@@ -103,6 +104,7 @@ class HubConfigProxy(MutableMapping):
"visibility": "public",
"left_width": 8,
"avatar": "",
+ "bio": "",
}
LISTS = ("pagure", "github")
VALIDATORS = {
diff --git a/hubs/static/client/app/components/HubConfig/HubConfigPanelGeneral.js b/hubs/static/client/app/components/HubConfig/HubConfigPanelGeneral.js
index 9bcd6df..a58ad0a 100644
--- a/hubs/static/client/app/components/HubConfig/HubConfigPanelGeneral.js
+++ b/hubs/static/client/app/components/HubConfig/HubConfigPanelGeneral.js
@@ -23,6 +23,14 @@ const messages = defineMessages({
id: "hubs.core.config.general.summary_help",
defaultMessage: "This text will be displayed at the top of the hub.",
},
+ bio: {
+ id: "hubs.core.config.general.bio",
+ defaultMessage: "Summary",
+ },
+ bio_help: {
+ id: "hubs.core.config.general.bio_help",
+ defaultMessage: "A short paragraph describing the hub",
+ },
left_width: {
id: "hubs.core.config.general.left_width",
defaultMessage: "Left width",
@@ -76,7 +84,7 @@ export default class GeneralPanel extends React.Component {
let invalid = {};
if (this.props.error && this.props.error.fields) {
- ["summary", "left_width", "visibility", "avatar"].forEach((key) => {
+ ["summary", "left_width", "visibility", "avatar", "bio"].forEach((key) => {
invalid[key] = this.props.error.fields[key];
});
}
@@ -108,6 +116,28 @@ export default class GeneralPanel extends React.Component {
+
+
+
+
+ { invalid.bio &&
+
+ {invalid.bio}
+
+ }
+
+
+
+
+
diff --git a/hubs/static/client/app/components/HubHeader/HubHeader.css b/hubs/static/client/app/components/HubHeader/HubHeader.css
index 73ba27c..552f244 100644
--- a/hubs/static/client/app/components/HubHeader/HubHeader.css
+++ b/hubs/static/client/app/components/HubHeader/HubHeader.css
@@ -22,3 +22,8 @@
position: absolute;
left: 1rem;
}
+
+.HubHeader .userBioBubble{
+ background: white;
+ border-radius: 15px;
+}
diff --git a/hubs/static/client/app/components/HubHeader/HubHeaderLeft.js b/hubs/static/client/app/components/HubHeader/HubHeaderLeft.js
index 9e76ad6..0c50285 100644
--- a/hubs/static/client/app/components/HubHeader/HubHeaderLeft.js
+++ b/hubs/static/client/app/components/HubHeader/HubHeaderLeft.js
@@ -9,6 +9,7 @@ export default class HubHeaderLeft extends React.Component {
render() {
return (
+
+
+
);
}
}
HubHeaderLeft.propTypes = {
hub: PropTypes.object.isRequired,
}
+
+class BioBubble extends React.Component {
+ render() {
+ if (this.props.bio != ""){
+ if (this.props.hub_type == 'user'){
+ return (
+
+ {this.props.bio}
+
+ )
+ } else if (this.props.hub_type == 'team'){
+ return (
+
+ {this.props.bio}
+
+ )
+ } else {
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
+ }
+ BioBubble.propTypes = {
+ bio: PropTypes.string.isRequired,
+ hub_type: PropTypes.string.isRequired,
+ }
\ No newline at end of file
diff --git a/hubs/static/client/app/components/HubHeader/index.js b/hubs/static/client/app/components/HubHeader/index.js
index 29ae354..2d42c71 100644
--- a/hubs/static/client/app/components/HubHeader/index.js
+++ b/hubs/static/client/app/components/HubHeader/index.js
@@ -41,7 +41,7 @@ class HubHeader extends React.Component {
hub={this.props.hub}
/>
-
+
diff --git a/populate.py b/populate.py
index 3c75c79..ede9322 100755
--- a/populate.py
+++ b/populate.py
@@ -45,6 +45,10 @@ hub.config.update(dict(
summary='The Internationalization Team',
avatar=placekitten,
archived=True,
+ bio='The Fedora I18N project works on internationalization (i18n)'
+ 'to support the localization (l10n) of Fedora in many languages.'
+ 'Translation of Fedora software and documentation are handled by'
+ 'the Fedora L10N project.',
))
widget = hubs.models.Widget(
@@ -68,20 +72,6 @@ widget = hubs.models.Widget(
}))
hub.widgets.append(widget)
-widget = hubs.models.Widget(
- plugin='sticky', index=1, left=True, _config=json.dumps({
- 'text': """
-
The Fedora I18N project works on internationalization (i18n) to support the
-localization (l10n) of Fedora in many languages. Translation of Fedora software
-and documentation are handled by the Fedora L10N project.
The goals of
-the Project are to:
Develop, package, and maintain applications
-like input methods for different languages Improve applications and
-utilities to support and process different languages Quality-assure
-that existing applications meet i18n standards Support the
-infrastructure of the Fedora Localization Project
-""",
- }))
-hub.widgets.append(widget)
widget = hubs.models.Widget(plugin='feed', index=2, left=True)
hub.widgets.append(widget)
@@ -102,6 +92,9 @@ hub.config["chat_domain"] = 'irc.freenode.net'
hub.config["chat_channel"] = '#fedora-hubs'
hub.config["pagure"] = 'fedora-hubs'
hub.config["calendar"] = 'commops'
+hub.config["bio"] = "Bringing more heat and light to Fedora, so you don't \
+have to choose between 'building things' and 'building communities \
+that build things."
widget = hubs.models.Widget(
plugin='rules', index=1, _config=json.dumps({
@@ -126,13 +119,6 @@ widget = hubs.models.Widget(plugin='about', index=3,
}))
hub.widgets.append(widget)
-widget = hubs.models.Widget(
- plugin='sticky', index=1, left=True, _config=json.dumps({
- 'text': "Bringing more heat and light to Fedora, so you don't have "
- "to choose between 'building things' and 'building "
- "communities that build things.'",
- }))
-hub.widgets.append(widget)
widget = hubs.models.Widget(plugin='feed', index=2, left=True)
hub.widgets.append(widget)