Repository: allura
Updated Branches:
refs/heads/master 650e181ce -> 0d602084c
[#8216] Personal Dashboard - Activity Section cleaning up the code
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/0d602084
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/0d602084
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/0d602084
Branch: refs/heads/master
Commit: 0d602084c2c80ad099de4c046b3e2ca9b39c5b5e
Parents: ce15220
Author: deshanigtk <deshani.14@cse.mrt.ac.lk>
Authored: Mon Jul 9 22:50:06 2018 +0530
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Mon Jul 9 18:42:20 2018 -0400
----------------------------------------------------------------------
.../ext/personal_dashboard/config/__init__.py | 16 ----------
.../ext/personal_dashboard/config/resources.py | 23 ---------------
.../ext/personal_dashboard/dashboard_main.py | 4 ---
.../templates/sections/activity.html | 31 ++------------------
.../forgeactivity/templates/macros.html | 27 +++++++++++++++++
.../templates/widgets/profile_section.html | 23 +--------------
6 files changed, 30 insertions(+), 94 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/0d602084/Allura/allura/ext/personal_dashboard/config/__init__.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/config/__init__.py b/Allura/allura/ext/personal_dashboard/config/__init__.py
deleted file mode 100644
index 144e298..0000000
--- a/Allura/allura/ext/personal_dashboard/config/__init__.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
http://git-wip-us.apache.org/repos/asf/allura/blob/0d602084/Allura/allura/ext/personal_dashboard/config/resources.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/config/resources.py b/Allura/allura/ext/personal_dashboard/config/resources.py
deleted file mode 100644
index 5d98bd3..0000000
--- a/Allura/allura/ext/personal_dashboard/config/resources.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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 pkg_resources
-
-
-def register_ew_resources(manager):
- manager.register_directory(
- 'activity_js', pkg_resources.resource_filename('forgeactivity', 'widgets/resources/js'))
http://git-wip-us.apache.org/repos/asf/allura/blob/0d602084/Allura/allura/ext/personal_dashboard/dashboard_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/dashboard_main.py b/Allura/allura/ext/personal_dashboard/dashboard_main.py
index 16c0fad..4f2a9f9 100644
--- a/Allura/allura/ext/personal_dashboard/dashboard_main.py
+++ b/Allura/allura/ext/personal_dashboard/dashboard_main.py
@@ -28,7 +28,6 @@ from allura.controllers.feed import FeedController
from allura.lib.widgets.user_profile import SectionBase, SectionsUtil, ProjectsSectionBase
from allura.lib.widgets import form_fields as ffw
from paste.deploy.converters import asbool
-from forgeactivity.widgets.follow import FollowToggle
log = logging.getLogger(__name__)
@@ -167,10 +166,7 @@ class ActivitySection(DashboardSectionBase):
activity_obj = get_activity_object(activity.obj)
activity.obj.project = getattr(activity_obj, 'project', None)
- context['follow_toggle'] = FollowToggle(),
- context['following'] = g.director.is_connected(c.user, self.user),
context['timeline'] = filtered_timeline
context['activity_app'] = self.activity_app
- g.register_js('activity_js/follow.js')
return context
http://git-wip-us.apache.org/repos/asf/allura/blob/0d602084/Allura/allura/ext/personal_dashboard/templates/sections/activity.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/personal_dashboard/templates/sections/activity.html b/Allura/allura/ext/personal_dashboard/templates/sections/activity.html
index 285aaa5..98f909f 100644
--- a/Allura/allura/ext/personal_dashboard/templates/sections/activity.html
+++ b/Allura/allura/ext/personal_dashboard/templates/sections/activity.html
@@ -24,37 +24,10 @@
Activity from people you follow
{% endblock %}
-{% block actions %}
- {% if c.user and not c.user.is_anonymous() and c.user != user %}
- {{ follow_toggle.display(following=following) }}
- {% endif %}
-{% endblock %}
+{% block actions %}{% endblock %}
{% block section_class %}activity{% endblock %}
{% block content %}
- {% if not timeline %}
- <p class="empty">No activity to display.</p>
- {% else %}
- <ul class="timeline">
- {% for a in timeline %}
- <li>
- <b>
- {{ a.verb.capitalize() }} {{ am.activity_obj(a.obj) }}
- {% if a.target.activity_name %}on {{ am.activity_obj(a.target) }}{%
endif %}
- {% if a.obj.project %}on
- <a href="{{ a.obj.project.url() }}">{{ a.obj.project.name
}}</a>{% endif %}
- </b>
- {% if a.obj.activity_extras.get('summary') %}
- <p>
- {{ a.obj.activity_extras.get('summary') }}
- </p>
- {% endif %}
- <time datetime="{{ a.published|datetimeformat }}"
- title="{{ a.published|datetimeformat }}">{{ h.ago(a.published,
show_date_after=None) }}</time>
- </li>
- {% endfor %}
- </ul>
- <a class="view-all" href="{{activity_app.url}}">View All</a>
- {% endif %}
+ {{ am.timeline_section(timeline, activity_app) }}
{% endblock %}
http://git-wip-us.apache.org/repos/asf/allura/blob/0d602084/ForgeActivity/forgeactivity/templates/macros.html
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/templates/macros.html b/ForgeActivity/forgeactivity/templates/macros.html
index 25fed79..4f87732 100644
--- a/ForgeActivity/forgeactivity/templates/macros.html
+++ b/ForgeActivity/forgeactivity/templates/macros.html
@@ -38,3 +38,30 @@
extra_css='emboss {} x{}'.format(className or '', size or '')) }}
{% endif %}
{%- endmacro %}
+
+{% macro timeline_section(timeline, activity_app) -%}
+ {% if not timeline %}
+ <p class="empty">No activity to display.</p>
+ {% else %}
+ <ul class="timeline">
+ {% for a in timeline %}
+ <li>
+ <b>
+ {{ a.verb.capitalize() }} {{ activity_obj(a.obj) }}
+ {% if a.target.activity_name %}on {{ activity_obj(a.target) }}{%
endif %}
+ {% if a.obj.project %}on
+ <a href="{{ a.obj.project.url() }}">{{ a.obj.project.name
}}</a>{% endif %}
+ </b>
+ {% if a.obj.activity_extras.get('summary') %}
+ <p>
+ {{ a.obj.activity_extras.get('summary') }}
+ </p>
+ {% endif %}
+ <time datetime="{{ a.published|datetimeformat }}"
+ title="{{ a.published|datetimeformat }}">{{ h.ago(a.published,
show_date_after=None) }}</time>
+ </li>
+ {% endfor %}
+ </ul>
+ <a class="view-all" href="{{activity_app.url}}">View All</a>
+ {% endif %}
+{%- endmacro %}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/allura/blob/0d602084/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/templates/widgets/profile_section.html b/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
index 5f6fbee..37a19a9 100644
--- a/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
+++ b/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
@@ -34,26 +34,5 @@
{% block section_class %}activity{% endblock %}
{% block content %}
- {% if not timeline %}
- <p class="empty">No activity to display.</p>
- {% else %}
- <ul class="timeline">
- {% for a in timeline %}
- <li>
- <b>
- {{a.verb.capitalize()}} {{am.activity_obj(a.obj)}}
- {% if a.target.activity_name %}on {{am.activity_obj(a.target)}}{% endif %}
- {% if a.obj.project %}on <a href="{{a.obj.project.url()}}">{{a.obj.project.name}}</a>{%
endif %}
- </b>
- {% if a.obj.activity_extras.get('summary') %}
- <p>
- {{ a.obj.activity_extras.get('summary') }}
- </p>
- {% endif %}
- <time datetime="{{a.published|datetimeformat}}" title="{{a.published|datetimeformat}}">{{h.ago(a.published,
show_date_after=None)}}</time>
- </li>
- {% endfor %}
- </ul>
- <a class="view-all" href="{{activity_app.url}}">View All</a>
- {% endif %}
+ {{ am.timeline_section(timeline, activity_app) }}
{% endblock %}
|