From 27201305f55384650ac6467de5abd2fc918bd50c Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Jan 18 2018 07:34:10 +0000 Subject: [PATCH 1/4] Add the description to the hub page Fixes #462 --- diff --git a/hubs/static/client/app/components/HubHeader/HubHeader.css b/hubs/static/client/app/components/HubHeader/HubHeader.css index 73ba27c..344b3c9 100644 --- a/hubs/static/client/app/components/HubHeader/HubHeader.css +++ b/hubs/static/client/app/components/HubHeader/HubHeader.css @@ -22,3 +22,10 @@ position: absolute; left: 1rem; } + +.HubHeader.hub-user .description { + background-color: white; +} +.HubHeader.hub-team .description { + background-color: #dfedf3; +} diff --git a/hubs/static/client/app/components/HubHeader/HubHeaderLeft.js b/hubs/static/client/app/components/HubHeader/HubHeaderLeft.js index 9e76ad6..dd8dcea 100644 --- a/hubs/static/client/app/components/HubHeader/HubHeaderLeft.js +++ b/hubs/static/client/app/components/HubHeader/HubHeaderLeft.js @@ -27,6 +27,11 @@ export default class HubHeaderLeft extends React.Component {
+ { this.props.hub.config.description && +
+ {this.props.hub.config.description} +
+ } ); } diff --git a/hubs/static/client/app/components/HubHeader/HubHeaderRight.js b/hubs/static/client/app/components/HubHeader/HubHeaderRight.js index dccf7c3..6b250a9 100644 --- a/hubs/static/client/app/components/HubHeader/HubHeaderRight.js +++ b/hubs/static/client/app/components/HubHeader/HubHeaderRight.js @@ -9,7 +9,7 @@ export default class HubHeaderRight extends React.Component { render() { return ( -
+
{ this.props.hub.perms.config &&
diff --git a/hubs/static/client/app/components/HubHeader/HubStats.js b/hubs/static/client/app/components/HubHeader/HubStats.js index 83dd6ce..016cd8b 100644 --- a/hubs/static/client/app/components/HubHeader/HubStats.js +++ b/hubs/static/client/app/components/HubHeader/HubStats.js @@ -18,7 +18,7 @@ export default class HubStats extends React.Component { return null; } return ( -
+
{ (this.props.hub.type === "team") && +
{ this.props.isLoading && } @@ -41,7 +43,7 @@ class HubHeader extends React.Component { hub={this.props.hub} />
-
+
diff --git a/populate.py b/populate.py index 64ac65c..8bf99d4 100755 --- a/populate.py +++ b/populate.py @@ -47,7 +47,12 @@ def create_teams(): summary='The Internationalization Team', avatar=placekitten, archived=True, - )) + description=( + '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( plugin='rules', index=1, _config=json.dumps({ @@ -70,21 +75,7 @@ def create_teams(): })) 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) + widget = hubs.models.Widget(plugin='feed', index=1, left=True) hub.widgets.append(widget) @@ -104,6 +95,11 @@ def create_teams(): hub.config["chat_channel"] = '#fedora-hubs' hub.config["pagure"] = 'fedora-hubs' hub.config["calendar"] = 'commops' + hub.config["description"] = ( + "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({ @@ -128,14 +124,7 @@ def create_teams(): })) 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) + widget = hubs.models.Widget(plugin='feed', index=1, left=True) hub.widgets.append(widget) @@ -153,6 +142,15 @@ def create_teams(): hub = hubs.models.Hub(name='marketing', hub_type="team") db.add(hub) hub.config["summary"] = 'The Fedora Marketing Team' + hub.config["description"] = """ + The Fedora Marketing Team develops and executes marketing strategies to promote + the usage and support of Fedora worldwide. Through the development of processes + and content, this project aims to support the efforts of other Fedora projects + to spread Fedora and to provide a central repository of ideas and information + that can be used to deliver Fedora to new audiences. We work closely with the + Fedora Ambassadors who spread the word about Fedora at events and allow the + Fedora Project to interact directly with its existing and prospective users. + """ widget = hubs.models.Widget( plugin='rules', index=1, _config=json.dumps({ @@ -177,20 +175,7 @@ def create_teams(): })) hub.widgets.append(widget) - widget = hubs.models.Widget( - plugin='sticky', index=1, left=True, _config=json.dumps({ - 'text': """ - The Fedora Marketing Team develops and executes marketing strategies to promote - the usage and support of Fedora worldwide. Through the development of processes - and content, this project aims to support the efforts of other Fedora projects - to spread Fedora and to provide a central repository of ideas and information - that can be used to deliver Fedora to new audiences. We work closely with the - Fedora Ambassadors who spread the word about Fedora at events and allow the - Fedora Project to interact directly with its existing and prospective users. - """, - })) - hub.widgets.append(widget) - widget = hubs.models.Widget(plugin='feed', index=2, left=True) + widget = hubs.models.Widget(plugin='feed', index=1, left=True) hub.widgets.append(widget) @@ -206,9 +191,14 @@ def create_teams(): db.commit() # ############# Design team - hub = hubs.models.Hub(name='designteam', hub_type="team") + hub = hubs.models.Hub(name='design', hub_type="team") db.add(hub) hub.config["summary"] = 'The Fedora Design Team' + hub.config["description"] = """ + The Design Team is the design group of the Fedora project. Our interests are + not only in creating graphics for use by the Fedora community, but also in + advocating the use of the creative tools that are a part of Fedora. + """ widget = hubs.models.Widget( plugin='rules', index=1, _config=json.dumps({ @@ -233,16 +223,7 @@ def create_teams(): })) hub.widgets.append(widget) - widget = hubs.models.Widget( - plugin='sticky', index=1, left=True, _config=json.dumps({ - 'text': """ - The Design Team is the design group of the Fedora project. Our interests are - not only in creating graphics for use by the Fedora community, but also in - advocating the use of the creative tools that are a part of Fedora. - """, - })) - hub.widgets.append(widget) - widget = hubs.models.Widget(plugin='feed', index=2, left=True) + widget = hubs.models.Widget(plugin='feed', index=1, left=True) hub.widgets.append(widget) @@ -262,6 +243,12 @@ def create_teams(): hub = hubs.models.Hub(name='infrastructure', hub_type="team") db.add(hub) hub.config["summary"] = 'The Fedora Infra Team' + hub.config["description"] = """ + The Infrastructure Team consists of dedicated volunteers and professionals + managing the servers, building the tools and utilities, and creating new + applications to make Fedora development a smoother process. We're located all + over the globe and communicate primarily by IRC and e-mail. + """ widget = hubs.models.Widget( plugin='rules', index=1, _config=json.dumps({ @@ -287,17 +274,7 @@ def create_teams(): })) hub.widgets.append(widget) - widget = hubs.models.Widget( - plugin='sticky', index=2, left=True, _config=json.dumps({ - 'text': """ - The Infrastructure Team consists of dedicated volunteers and professionals - managing the servers, building the tools and utilities, and creating new - applications to make Fedora development a smoother process. We're located all - over the globe and communicate primarily by IRC and e-mail. - """, - })) - hub.widgets.append(widget) - widget = hubs.models.Widget(plugin='feed', index=3, left=True) + widget = hubs.models.Widget(plugin='feed', index=1, left=True) hub.widgets.append(widget) hub.subscribe(hubs.models.User.by_username('ralph'), 'owner') From e58fb8e21166b428caff8b5ae9721e6b0129956c Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Jan 18 2018 07:34:10 +0000 Subject: [PATCH 2/4] Implement the rules widget in React --- diff --git a/hubs/models/user.py b/hubs/models/user.py index ccc7fe9..c72c3b2 100644 --- a/hubs/models/user.py +++ b/hubs/models/user.py @@ -59,7 +59,8 @@ class User(BASE): 'fullname': self.fullname, 'created_on': self.created_on, 'last_active': self.last_active, - + 'hub_url': flask.url_for( + 'hub', hub_name=self.username, hub_type='u'), # We'll need hubs subscribed to, owned, etc.. # 'hubs': [hub.idx for hub in self.hubx], } diff --git a/hubs/static/client/app/components/HubHeader/HubCommunity.css b/hubs/static/client/app/components/HubHeader/HubCommunity.css new file mode 100644 index 0000000..a5f70c6 --- /dev/null +++ b/hubs/static/client/app/components/HubHeader/HubCommunity.css @@ -0,0 +1,18 @@ +.HubCommunity { + background-color: #e7e7e7; + text-align: left; +} + +.HubCommunity h6 { + font-family: 'Open Sans', sans-serif; + text-transform: capitalize; + font-size: normal; + font-weight: 700; + color: #808080; + margin-bottom: 5px; +} +.HubCommunity .img-circle-lg { + height: 4em; + width: 4em; + padding: 10px; +} diff --git a/hubs/static/client/app/components/HubHeader/HubCommunity.js b/hubs/static/client/app/components/HubHeader/HubCommunity.js new file mode 100644 index 0000000..c7b058d --- /dev/null +++ b/hubs/static/client/app/components/HubHeader/HubCommunity.js @@ -0,0 +1,213 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import Modal from '../Modal'; +import "./HubCommunity.css"; + + +export default class HubCommunity extends React.Component { + + render() { + return ( +
+ + + + +
+ ); + } +} +HubCommunity.propTypes = { + hub: PropTypes.object.isRequired, +} + + +class HubCommunityRules extends React.Component { + + render() { + if (!this.props.hub.config.rules_url) { + return null; + } + return ( +
+
community rules
+

+ + Community Rules and Guidelines + +

+
+ ); + } +} + + +class HubCommunityOwners extends React.Component { + + constructor(props) { + super(props); + this.state = {moreOpen: false}; + this.handleClickMore = this.handleClickMore.bind(this); + this.handleCloseMore = this.handleCloseMore.bind(this); + } + + handleClickMore(e) { + e.preventDefault(); + this.setState((prevState, props) => ({ + moreOpen: !prevState.moreOpen + })) + } + + handleCloseMore(e) { + e.preventDefault(); + this.setState({moreOpen: false}); + } + + render() { + const ellipsis_limit = 5; + let owners = [...this.props.hub.users.owner]; + //for (const owner in this.props.hub.users.owner) { + // owners.push(this.props.hub.users.owner[owner]); + //} + const compare = (a, b) => { + if (a < b) { return -1; } + if (a > b) { return 1; } + return 0; + } + if (owners.length <= ellipsis_limit) { + owners.sort((o1, o2) => (compare(o1.username, o2.username))); + } else { + owners.sort((o1, o2) => { + const d1 = Date.parse(o1.created_on); + const d2 = Date.parse(o2.created_on); + return compare(d1, d2); + }) + } + return ( +
+
Group Owners ({owners.length})
+
+ { owners.slice(0, ellipsis_limit).map((owner) => ( + + )) + } + { owners.length > ellipsis_limit && + + } +
+ { this.state.moreOpen && + + Close + + } + > + { owners.map((owner) => ( + + )) + } + + } +
+ ); + } +} + + +class HubCommunityMeetings extends React.Component { + + render() { + const config = this.props.hub.config; + if (!config.schedule_text && + !config.schedule_url && + !config.minutes_url) { + return null; + } + return ( +
+
Meetings
+ { config.schedule_text && +

{config.schedule_text}

+ } +

+ { config.schedule_url && + + Meeting Schedule + + } + { config.schedule_url && config.minutes_url && + "|" + } + { config.minutes_url && + + Past Meeting Minutes + + } +

+
+ ); + } +} + + +class HubCommunityCommunication extends React.Component { + + render() { + const config = this.props.hub.config; + if (!config.mailing_list && + !config.irc_channel) { + return null; + } + const mailing_list_url = `https://lists.fedoraproject.org/archives/list/${config.mailing_list}/`; + return ( +
+
Communication
+
    + { config.mailing_list && +
  • + + + + {config.mailing_list} + + +
  • + } + { config.irc_channel && +
  • + + + { config.irc_channel } on { config.irc_network } + +
  • + } +
+
+ ); + } +} diff --git a/hubs/static/client/app/components/HubHeader/HubHeaderRight.js b/hubs/static/client/app/components/HubHeader/HubHeaderRight.js index 6b250a9..f58dc19 100644 --- a/hubs/static/client/app/components/HubHeader/HubHeaderRight.js +++ b/hubs/static/client/app/components/HubHeader/HubHeaderRight.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import HubConfig from '../HubConfig'; import EditModeButton from './EditModeButton'; import HubMembership from './HubMembership'; +import HubCommunity from './HubCommunity'; export default class HubHeaderRight extends React.Component { @@ -17,6 +18,7 @@ export default class HubHeaderRight extends React.Component {
} +
); } diff --git a/hubs/tests/views/test_api_hub_config.py b/hubs/tests/views/test_api_hub_config.py index 773c9ce..63f093b 100644 --- a/hubs/tests/views/test_api_hub_config.py +++ b/hubs/tests/views/test_api_hub_config.py @@ -19,6 +19,7 @@ class TestAPIHubConfig(APPTest): hub.last_refreshed = datetime.datetime(2017, 1, 1, 0, 0, 0) user = User.query.get("ralph") user.created_on = datetime.datetime(2017, 1, 1, 0, 0, 0) + user.last_active = datetime.datetime(2017, 1, 1, 0, 0, 0) self.session.commit() auth_user = FakeAuthorization('ralph') response = self.check_url( @@ -38,13 +39,15 @@ class TestAPIHubConfig(APPTest): "archived": False, "avatar": avatar_url, 'chat_channel': None, - 'chat_domain': None, + 'chat_domain': 'irc.freenode.net', "calendar": None, "description": None, "mailing_list": None, + "meetings_text": None, "github": [], "pagure": [], "left_width": 8, + "rules_url": None, "summary": "Ralph", "visibility": "public", }, @@ -54,7 +57,9 @@ class TestAPIHubConfig(APPTest): "username": "ralph", "fullname": "Ralph", "avatar": avatar_url, + 'hub_url': '/u/ralph/', "created_on": "Sun, 01 Jan 2017 00:00:00 GMT", + "last_active": "Sun, 01 Jan 2017 00:00:00 GMT", }, ], "member": [], diff --git a/populate.py b/populate.py index 8bf99d4..8582997 100755 --- a/populate.py +++ b/populate.py @@ -21,10 +21,8 @@ placekitten = "https://placekitten.com/g/320/320" # Register widgets we will use hubs.widgets.registry.register_list([ - "hubs.widgets.rules:Rules", "hubs.widgets.meetings:Meetings", "hubs.widgets.about:About", - "hubs.widgets.sticky:Sticky", "hubs.widgets.feed:Feed", ]) @@ -52,19 +50,10 @@ def create_teams(): 'to support the localization (l10n) of Fedora in many languages.' 'Translation of Fedora software and documentation are handled by' 'the Fedora L10N project.'), + rules_url='https://fedoraproject.org/wiki/I18N', )) - widget = hubs.models.Widget( - plugin='rules', index=1, _config=json.dumps({ - 'link': 'https://fedoraproject.org/wiki/I18N', - 'schedule_text': None, - 'schedule_link': None, - 'minutes_link': 'https://meetbot.fedoraproject.org/sresults/' - '?group_id=i18n&type=team', - })) - hub.widgets.append(widget) - - widget = hubs.models.Widget(plugin='meetings', index=2, + widget = hubs.models.Widget(plugin='meetings', index=1, _config=json.dumps({'calendar': 'i18n'})) hub.widgets.append(widget) @@ -100,19 +89,10 @@ def create_teams(): "have to choose between 'building things' and 'building communities " "that build things'." ) + hub.config["rules_url"] = 'https://fedoraproject.org/wiki/CommOps' widget = hubs.models.Widget( - plugin='rules', index=1, _config=json.dumps({ - 'link': 'https://fedoraproject.org/wiki/CommOps', - 'schedule_text': None, - 'schedule_link': None, - 'minutes_link': 'http://meetbot.fedoraproject.org/sresults/' - '?group_id=commops&type=team', - })) - hub.widgets.append(widget) - - widget = hubs.models.Widget( - plugin='meetings', index=2, _config=json.dumps({ + plugin='meetings', index=1, _config=json.dumps({ 'calendar': 'commops', 'n_meetings': 4 })) hub.widgets.append(widget) @@ -151,19 +131,10 @@ def create_teams(): Fedora Ambassadors who spread the word about Fedora at events and allow the Fedora Project to interact directly with its existing and prospective users. """ + hub.config["rules_url"] = 'https://fedoraproject.org/wiki/Marketing' widget = hubs.models.Widget( - plugin='rules', index=1, _config=json.dumps({ - 'link': 'https://fedoraproject.org/wiki/Marketing', - 'schedule_text': None, - 'schedule_link': None, - 'minutes_link': 'http://meetbot.fedoraproject.org/sresults/' - '?group_id=fedora-mktg&type=channel', - })) - hub.widgets.append(widget) - - widget = hubs.models.Widget( - plugin='meetings', index=2, _config=json.dumps({ + plugin='meetings', index=1, _config=json.dumps({ 'calendar': 'marketing', 'n_meetings': 4 })) hub.widgets.append(widget) @@ -199,26 +170,18 @@ def create_teams(): not only in creating graphics for use by the Fedora community, but also in advocating the use of the creative tools that are a part of Fedora. """ + hub.config["rules_url"] = 'https://fedoraproject.org/wiki/Design' + hub.config["meetings_text"] = 'Meetings are every other Tuesday at 16:00 UTC' widget = hubs.models.Widget( - plugin='rules', index=1, _config=json.dumps({ - 'link': 'https://fedoraproject.org/wiki/Design', - 'schedule_text': 'Meetings are every other Tuesday at 16:00 UTC', - 'schedule_link': 'https://apps.fedoraproject.org/calendar/design/', - 'minutes_link': 'http://meetbot.fedoraproject.org/sresults/' - '?group_id=fedora-design&type=channel', - })) - hub.widgets.append(widget) - - widget = hubs.models.Widget( - plugin='meetings', index=2, _config=json.dumps({ - 'calendar': 'design', 'n_meetings': 4 + plugin='meetings', index=1, _config=json.dumps({ + 'n_meetings': 4 })) hub.widgets.append(widget) # Added a hubs about widget widget = hubs.models.Widget( - plugin='about', index=3, _config=json.dumps({ + plugin='about', index=2, _config=json.dumps({ "text": "I'm a Fedora user, and this is my about widget text!", })) hub.widgets.append(widget) @@ -249,27 +212,18 @@ def create_teams(): applications to make Fedora development a smoother process. We're located all over the globe and communicate primarily by IRC and e-mail. """ + hub.config["rules_url"] = 'https://fedoraproject.org/wiki/Infrastructure' + hub.config["meetings_text"] = 'We meet weekly in #fedora-meeting at 18:00 UTC' widget = hubs.models.Widget( - plugin='rules', index=1, _config=json.dumps({ - 'link': 'https://fedoraproject.org/wiki/Infrastructure', - 'schedule_text': 'We meet weekly in #fedora-meeting at 18:00 UTC', - 'schedule_link': - 'https://apps.fedoraproject.org/calendar/infrastructure/', - 'minutes_link': 'http://meetbot.fedoraproject.org/sresults/' - '?group_id=infrastructure&type=team', - })) - hub.widgets.append(widget) - - widget = hubs.models.Widget( - plugin='meetings', index=2, _config=json.dumps({ - 'calendar': 'infrastructure', 'n_meetings': 4 + plugin='meetings', index=1, _config=json.dumps({ + 'n_meetings': 4 })) hub.widgets.append(widget) # Added a hubs about widget widget = hubs.models.Widget( - plugin='about', index=3, _config=json.dumps({ + plugin='about', index=2, _config=json.dumps({ "text": "I'm a Fedora user, and this is my about widget text!", })) hub.widgets.append(widget) From 1bbc3f00ca1fabf42e2fab8c034ec682fcc4ec01 Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Jan 18 2018 07:34:10 +0000 Subject: [PATCH 3/4] Hub settings for the rules content --- diff --git a/hubs/models/constants.py b/hubs/models/constants.py index 52a5dc5..dc6fff6 100644 --- a/hubs/models/constants.py +++ b/hubs/models/constants.py @@ -45,3 +45,10 @@ DEV_PLATFORMS = ( "url": "https://github.com", }, ) + +CHAT_NETWORKS = [ + { + "name": "Freenode", + "domain": "irc.freenode.net", + }, +] diff --git a/hubs/models/hubconfig.py b/hubs/models/hubconfig.py index c3531c1..26a4d4d 100644 --- a/hubs/models/hubconfig.py +++ b/hubs/models/hubconfig.py @@ -29,13 +29,14 @@ except ImportError: # Python 2 from collections import MutableMapping +import flask import six import sqlalchemy as sa from sqlalchemy.orm.session import object_session from hubs.database import BASE from hubs.utils import validators -from .constants import DEV_PLATFORMS, VISIBILITIES +from .constants import DEV_PLATFORMS, VISIBILITIES, CHAT_NETWORKS log = logging.getLogger(__name__) @@ -90,7 +91,7 @@ class HubConfigProxy(MutableMapping): KEYS = ( "archived", "summary", "description", "left_width", "avatar", "visibility", "chat_domain", "chat_channel", "mailing_list", - "calendar", + "calendar", "meetings_text", "rules_url", ) + tuple(p["name"] for p in DEV_PLATFORMS) CONVERTERS = { "archived": BooleanConverter(), @@ -104,6 +105,7 @@ class HubConfigProxy(MutableMapping): "visibility": "public", "left_width": 8, "avatar": "", + "chat_domain": CHAT_NETWORKS[0]["domain"], } LISTS = ("pagure", "github") VALIDATORS = { diff --git a/hubs/static/client/app/components/HubConfig/HubConfigDialog.js b/hubs/static/client/app/components/HubConfig/HubConfigDialog.js index a802f13..effec9a 100644 --- a/hubs/static/client/app/components/HubConfig/HubConfigDialog.js +++ b/hubs/static/client/app/components/HubConfig/HubConfigDialog.js @@ -6,9 +6,10 @@ import { import PropTypes from 'prop-types'; import GeneralPanel from './HubConfigPanelGeneral'; import UserPanel from './HubConfigPanelUser'; +import CommunityPanel from './HubConfigPanelCommunity'; import MailingListPanel from './HubConfigPanelMailingList'; import ChatPanel from './HubConfigPanelChat'; -import CalendarPanel from './HubConfigPanelCalendar'; +import MeetingsPanel from './HubConfigPanelMeetings'; import DevPlatformPanel from './HubConfigPanelDevPlatform'; import NotImplementedPanel from './HubConfigPanelNotImpl'; import Modal from '../../components/Modal'; @@ -33,6 +34,10 @@ const messages = defineMessages({ id: "hubs.core.config.members", defaultMessage: "Members", }, + community: { + id: "hubs.core.config.community", + defaultMessage: "Community", + }, mailinglist: { id: "hubs.core.config.mailinglist", defaultMessage: "Mailing-list", @@ -41,9 +46,9 @@ const messages = defineMessages({ id: "hubs.core.config.chat", defaultMessage: "Chat", }, - calendar: { - id: "hubs.core.config.calendar", - defaultMessage: "Calendar", + meetings: { + id: "hubs.core.config.meetings", + defaultMessage: "Meetings", }, devplatform: { id: "hubs.core.config.devplatform", @@ -135,6 +140,15 @@ export default class HubConfigDialog extends React.Component { hub={this.props.hub} /> , + } + handleChange={this.props.onConfigChange} + error={this.props.hub.error} + /> + , , - } + tabTitle={} handleChange={this.props.onConfigChange} error={this.props.hub.error} /> diff --git a/hubs/static/client/app/components/HubConfig/HubConfigPanelCalendar.js b/hubs/static/client/app/components/HubConfig/HubConfigPanelCalendar.js deleted file mode 100644 index be75510..0000000 --- a/hubs/static/client/app/components/HubConfig/HubConfigPanelCalendar.js +++ /dev/null @@ -1,88 +0,0 @@ -import React from 'react'; -import { - defineMessages, - FormattedMessage, - } from 'react-intl'; - - -const messages = defineMessages({ - title: { - id: "hubs.core.config.calendar.title", - defaultMessage: "Calendar Settings", - }, - intro_1: { - id: "hubs.core.config.calendar.intro1", - defaultMessage: ( - "If your team or project has a calendar associated with it, you " - +"can connect this hub to it." - ), - }, - intro_2: { - id: "hubs.core.config.calendar.intro2", - defaultMessage: "Please indicate your team's calendar below:", - }, - address: { - id: "hubs.core.config.calendar.calendar", - defaultMessage: "Calendar name", - }, - example: { - id: "hubs.core.config.calendar.example", - defaultMessage: "Example:", - }, -}); - - -export default class CalendarPanel extends React.Component { - - constructor(props) { - super(props); - this.handleChange = this.handleChange.bind(this); - } - - handleChange(e) { - const name = e.target.name, value = e.target.value; - this.props.handleChange(name, value); - } - - render() { - const stillLoading = ( - typeof this.props.hubConfig.calendar === "undefined" - ); - - let invalid = null; - if (this.props.error && this.props.error.fields) { - invalid = this.props.error.fields.calendar; - } - - return ( -
{e.preventDefault();}}> - - - -
- - - { invalid && -
- {invalid} -
- } -

- - team -

-
- - ); - } -} diff --git a/hubs/static/client/app/components/HubConfig/HubConfigPanelCommunity.js b/hubs/static/client/app/components/HubConfig/HubConfigPanelCommunity.js new file mode 100644 index 0000000..227c9cc --- /dev/null +++ b/hubs/static/client/app/components/HubConfig/HubConfigPanelCommunity.js @@ -0,0 +1,88 @@ +import React from 'react'; +import { + defineMessages, + FormattedMessage, + } from 'react-intl'; + + +const messages = defineMessages({ + title: { + id: "hubs.core.config.community.title", + defaultMessage: "Community Settings", + }, + intro_1: { + id: "hubs.core.config.community.intro1", + defaultMessage: ( + "If your team or project has community rules and guidelines, you " + +"can point to them here." + ), + }, + intro_2: { + id: "hubs.core.config.community.intro2", + defaultMessage: "Please indicate your team's rules below:", + }, + url: { + id: "hubs.core.config.community.url", + defaultMessage: "Rules URL", + }, + example: { + id: "hubs.core.config.community.example", + defaultMessage: "Example:", + }, +}); + + +export default class CommunityPanel extends React.Component { + + constructor(props) { + super(props); + this.handleChange = this.handleChange.bind(this); + } + + handleChange(e) { + const name = e.target.name, value = e.target.value; + this.props.handleChange(name, value); + } + + render() { + const stillLoading = ( + typeof this.props.hubConfig.rules_url === "undefined" + ); + + let invalid = null; + if (this.props.error && this.props.error.fields) { + invalid = this.props.error.fields.rules_url; + } + + return ( +
{e.preventDefault();}}> + + + +
+ + + { invalid && +
+ {invalid} +
+ } +

+ + https://fedoraproject.org/wiki/YourTeam +

+
+ + ); + } +} diff --git a/hubs/static/client/app/components/HubConfig/HubConfigPanelMeetings.js b/hubs/static/client/app/components/HubConfig/HubConfigPanelMeetings.js new file mode 100644 index 0000000..8fcca29 --- /dev/null +++ b/hubs/static/client/app/components/HubConfig/HubConfigPanelMeetings.js @@ -0,0 +1,116 @@ +import React from 'react'; +import { + defineMessages, + FormattedMessage, + } from 'react-intl'; + + +const messages = defineMessages({ + title: { + id: "hubs.core.config.meetings.title", + defaultMessage: "Meetings Settings", + }, + intro_1: { + id: "hubs.core.config.meetings.intro1", + defaultMessage: ( + "If your team or project has regular meetings and a calendar associated with it, you " + +"can indicate them and connect this hub to the calendar." + ), + }, + intro_2: { + id: "hubs.core.config.meetings.intro2", + defaultMessage: "Please indicate your team's Fedocal calendar below:", + }, + cal_name: { + id: "hubs.core.config.meetings.calendar", + defaultMessage: "Calendar name", + }, + meetings_info: { + id: "hubs.core.config.meetings.meetings_info", + defaultMessage: "Meetings info", + }, + example: { + id: "hubs.core.config.meetings.example", + defaultMessage: "Example:", + }, + example_meetings: { + id: "hubs.core.config.meetings.example_meetings", + defaultMessage: "We meet weekly in #fedora-meeting at 18:00 UTC", + }, +}); + + +export default class CalendarPanel extends React.Component { + + constructor(props) { + super(props); + this.handleChange = this.handleChange.bind(this); + } + + handleChange(e) { + const name = e.target.name, value = e.target.value; + this.props.handleChange(name, value); + } + + render() { + const stillLoading = ( + typeof this.props.hubConfig.calendar === "undefined" + ); + + let invalid = null; + if (this.props.error && this.props.error.fields) { + invalid = this.props.error.fields.calendar; + } + + return ( +
{e.preventDefault();}}> + + + +
+ + + { invalid && +
+ {invalid} +
+ } +

+ + team +

+
+
+ + +

+ + + + +

+
+ + ); + } +} diff --git a/hubs/static/client/app/components/HubHeader/HubCommunity.js b/hubs/static/client/app/components/HubHeader/HubCommunity.js index c7b058d..04683b1 100644 --- a/hubs/static/client/app/components/HubHeader/HubCommunity.js +++ b/hubs/static/client/app/components/HubHeader/HubCommunity.js @@ -29,7 +29,7 @@ class HubCommunityRules extends React.Component { return null; } return ( -
+
community rules

@@ -84,7 +84,7 @@ class HubCommunityOwners extends React.Component { }) } return ( -

+
Group Owners ({owners.length})
{ owners.slice(0, ellipsis_limit).map((owner) => ( @@ -135,35 +135,36 @@ class HubCommunityMeetings extends React.Component { render() { const config = this.props.hub.config; - if (!config.schedule_text && - !config.schedule_url && - !config.minutes_url) { + if (!config.meetings_text && + !config.calendar) { return null; } + const calendar_url = `https://apps.fedoraproject.org/calendar/${config.calendar}/`; + const minutes_url = `https://meetbot.fedoraproject.org/sresults?group_id=${this.props.hub.name}&type=team` return ( -
+
Meetings
- { config.schedule_text && -

{config.schedule_text}

+ { config.meetings_text && +

{config.meetings_text}

}

- { config.schedule_url && + { config.calendar && Meeting Schedule } - { config.schedule_url && config.minutes_url && + { config.calendar && minutes_url && "|" } - { config.minutes_url && + { minutes_url && Past Meeting Minutes @@ -180,7 +181,7 @@ class HubCommunityCommunication extends React.Component { render() { const config = this.props.hub.config; if (!config.mailing_list && - !config.irc_channel) { + !config.chat_channel) { return null; } const mailing_list_url = `https://lists.fedoraproject.org/archives/list/${config.mailing_list}/`; @@ -198,11 +199,11 @@ class HubCommunityCommunication extends React.Component { } - { config.irc_channel && + { config.chat_channel &&

  • - { config.irc_channel } on { config.irc_network } + { config.chat_channel } on { config.chat_domain }
  • } From efae475f06ec4a12a65825921d3b898bffd71a7c Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Jan 18 2018 07:34:10 +0000 Subject: [PATCH 4/4] Flake8 fixes --- diff --git a/hubs/models/hubconfig.py b/hubs/models/hubconfig.py index 26a4d4d..0c8e332 100644 --- a/hubs/models/hubconfig.py +++ b/hubs/models/hubconfig.py @@ -29,7 +29,6 @@ except ImportError: # Python 2 from collections import MutableMapping -import flask import six import sqlalchemy as sa from sqlalchemy.orm.session import object_session diff --git a/hubs/widgets/weeklyactivity/__init__.py b/hubs/widgets/weeklyactivity/__init__.py index 662b1f9..c6d609f 100644 --- a/hubs/widgets/weeklyactivity/__init__.py +++ b/hubs/widgets/weeklyactivity/__init__.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -from hubs.utils import validators from hubs.widgets.base import Widget from hubs.widgets.view import RootWidgetView