#537 remove about widget
Merged 6 years ago by abompard. Opened 6 years ago by ryanlerch.
ryanlerch/fedora-hubs remove-about  into  develop

file modified
-1
@@ -56,7 +56,6 @@ 

  EMAIL_PORT = 25

  

  WIDGETS = [

-     'hubs.widgets.about:About',

      'hubs.widgets.badges:Badges',

      'hubs.widgets.bugzilla:Bugzilla',

      'hubs.widgets.library:Library',

file modified
+1 -1
@@ -77,7 +77,7 @@ 

  

          hub = hubs.models.Hub.by_name('ralph', "user")

          widget = hubs.models.Widget(

-             plugin='about',

+             plugin='sticky',

              index=500,

              _config=json.dumps({"text": "Testing."}),

          )

file modified
+10 -10
@@ -152,32 +152,32 @@ 

          self.assertEqual(rules[0].rule, "/widgets/testing/<int:idx>/test-2")

  

      def test_get_props(self):

-         widget = widget_instance('ralph', "about")

+         widget = widget_instance('ralph', "sticky")

          with app.test_request_context('/'):

              props = widget.get_props()

          self.assertDictEqual(props, {

              'config': {'text': 'Testing.'},

-             'contentUrl': '/widgets/about/{}/'.format(widget.idx),

+             'contentUrl': '/widgets/sticky/{}/'.format(widget.idx),

              'cssClass': None,

              'hiddenIfEmpty': False,

              'hub_types': HUB_TYPES,

              'idx': widget.idx,

              'index': 500,

              'isReact': False,

-             'isLarge': False,

-             'label': 'About',

-             'name': 'about',

+             'isLarge': True,

+             'label': 'Sticky Note',

+             'name': 'sticky',

              'params': [

-                 {'default': 'I am a Fedora user, and this is my about',

-                  'help': 'Text about a user.',

+                 {'default': 'Lorem ipsum dolor...',

+                  'help': 'Some dummy text to display.',

                   'label': 'Text',

                   'name': 'text',

-                  'renderTag': 'input',

-                  'renderAttributes': {'type': 'text'},

+                  'renderTag': 'textarea',

+                  'renderAttributes': {'rows': '30'},

                   },

              ],

              'position': 'right',

              'selfUrl': '/api/hubs/{}/widgets/{}/'.format(

                  widget.hub.id, widget.idx),

-             'title': 'About',

+             'title': None,

          })

@@ -28,7 +28,7 @@ 

                          replace_existing_backend=True)

          self.w_instance = Widget.query.filter(

              Hub.name == "ralph",

-             Widget.plugin == "about",

+             Widget.plugin == "sticky",

              ).one()

          self.fn = DummyFunction(self.w_instance)

          cache.delete(self.fn.get_cache_key())

@@ -56,7 +56,7 @@ 

      def test_move_widget(self):

          hub = Hub(name="testing", hub_type="team")

          self.session.add(hub)

-         widget_names = ["about", "badges", "bugzilla", "my_hubs", "sticky"]

+         widget_names = ["meetings", "badges", "bugzilla", "my_hubs", "sticky"]

  

          def get_names():

              return [
@@ -83,23 +83,23 @@ 

          # From middle to middle forwards

          check_move(

              "badges", 3,

-             ["about", "bugzilla", "my_hubs", "badges", "sticky"])

+             ["meetings", "bugzilla", "my_hubs", "badges", "sticky"])

          # From middle to middle backwards

          check_move(

              "badges", 1,

-             ["about", "badges", "bugzilla", "my_hubs", "sticky"])

+             ["meetings", "badges", "bugzilla", "my_hubs", "sticky"])

          # From middle to start

          check_move(

              "my_hubs", 0,

-             ["my_hubs", "about", "badges", "bugzilla", "sticky"])

+             ["my_hubs", "meetings", "badges", "bugzilla", "sticky"])

          # From middle to end

          check_move(

              "badges", 5,

-             ["my_hubs", "about", "bugzilla", "sticky", "badges"])

+             ["my_hubs", "meetings", "bugzilla", "sticky", "badges"])

          # From start to end

          check_move(

              "my_hubs", 5,

-             ["about", "bugzilla", "sticky", "badges", "my_hubs"])

+             ["meetings", "bugzilla", "sticky", "badges", "my_hubs"])

  

      def test_move_widget_disabled(self):

          # Make sure moving works even if there are disabled widgets

@@ -14,7 +14,7 @@ 

      def test_get_widgets(self):

          hub = Hub.by_name('ralph', "user")

          expected_widgets = [

-             'feed', 'my_hubs', 'badges', 'about',

+             'feed', 'my_hubs', 'badges', 'sticky',

          ]

          response = self.check_url("/api/hubs/%s/widgets/" % hub.id)

          response_data = json.loads(response.get_data(as_text=True))
@@ -178,9 +178,9 @@ 

      def test_post_valid_widget_name_with_config(self):

          hub = Hub.by_name("ralph", "user")

          self.assertEqual(

-             Widget.query.filter_by(hub=hub, plugin="about").count(), 1)

+             Widget.query.filter_by(hub=hub, plugin="sticky").count(), 1)

          data = {

-             "name": "about",

+             "name": "sticky",

              "config": {'text': 'text of widget'},

              'position': 'right',

              }
@@ -195,7 +195,7 @@ 

              json.loads(result.get_data(as_text=True)),

              {"status": "OK"})

          self.assertEqual(

-             Widget.query.filter_by(hub=hub, plugin="about").count(), 2)

+             Widget.query.filter_by(hub=hub, plugin="sticky").count(), 2)

  

      def test_post_invalid_config(self):

          hub = Hub.by_name("ralph", "user")

@@ -1,10 +0,0 @@ 

- from __future__ import unicode_literals

- 

- from . import WidgetTest

- 

- 

- class TestAbout(WidgetTest):

-     plugin = 'about'  # The name in hubs.widgets.registry

- 

-     def test_view_authz(self):

-         self._test_view_authz()

@@ -1,26 +0,0 @@ 

- from __future__ import unicode_literals

- 

- from hubs.utils import validators

- from hubs.widgets.base import Widget

- from hubs.widgets.view import RootWidgetView

- 

- 

- class About(Widget):

- 

-     name = "about"

-     position = "both"

-     parameters = [dict(

-         name="text",

-         label="Text",

-         default="I am a Fedora user, and this is my about",

-         validator=validators.Text,

-         help="Text about a user.",

-         )]

- 

- 

- class BaseView(RootWidgetView):

- 

-     def get_context(self, instance, *args, **kwargs):

-         return dict(

-             text=instance.config["text"],

-             )

@@ -1,1 +0,0 @@ 

- <p class="mb-0">{{text}}</p>