You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2014/02/13 16:05:35 UTC
[01/17] git commit: [#7069] ticket:527 Add test for merge request page
Updated Branches:
refs/heads/cj/7097 fdbc326a0 -> 9d6c69bbe (forced update)
[#7069] ticket:527 Add test for merge request page
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/1ad33e15
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1ad33e15
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1ad33e15
Branch: refs/heads/cj/7097
Commit: 1ad33e1589d1a3df112f328b9ffb31da23a18a0f
Parents: 2b45973
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Thu Feb 6 13:56:43 2014 +0400
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Feb 11 05:13:08 2014 +0000
----------------------------------------------------------------------
.../forgegit/tests/functional/test_controllers.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1ad33e15/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index c9d296c..e4ccc51 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -537,6 +537,20 @@ class TestFork(_TestCase):
assert 'git fetch git://git.localhost/p/test2/code master' in merge_instructions
assert 'git merge {}'.format(c_id) in merge_instructions
+ def test_merge_request_with_deleted_repo(self):
+ self._request_merge()
+ h.set_context('test2', 'code', neighborhood='Projects')
+ c.app.repo.delete()
+ ThreadLocalORMSession.flush_all()
+
+ r = self.app.get('/p/test/src-git/merge-requests/')
+ assert '<i>(deleted)</i>' in r
+
+ r = self.app.get('/p/test/src-git/merge-requests/1/')
+ assert '''Original repository by
+ <a href="/u/test-admin/">Test Admin</a>
+ is deleted''' in r, r
+
def test_merge_request_list_view(self):
r, mr_num = self._request_merge()
r = self.app.get('/p/test/src-git/merge-requests/')
[16/17] git commit: [#7097] Refactored User Profile to use Profile
Sections
Posted by jo...@apache.org.
[#7097] Refactored User Profile to use Profile Sections
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/77cafa4b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/77cafa4b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/77cafa4b
Branch: refs/heads/cj/7097
Commit: 77cafa4bfdd593b0610201549c0d9d8b0fe6f5cf
Parents: 36ba2d6
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Feb 12 02:00:38 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Feb 13 15:04:29 2014 +0000
----------------------------------------------------------------------
Allura/allura/config/app_cfg.py | 3 +
.../templates/profile_section_base.html | 28 ++
.../templates/sections/personal-data.html | 63 +++++
.../templates/sections/projects.html | 49 ++++
.../user_profile/templates/sections/skills.html | 39 +++
.../user_profile/templates/sections/tools.html | 39 +++
.../ext/user_profile/templates/user_index.html | 255 +------------------
Allura/allura/ext/user_profile/user_main.py | 34 ++-
Allura/allura/lib/helpers.py | 26 ++
Allura/allura/lib/plugin.py | 6 +-
.../allura/templates/jinja_master/nav_menu.html | 14 +-
Allura/setup.py | 6 +
ForgeActivity/forgeactivity/main.py | 1 -
.../templates/widgets/profile_section.html | 24 +-
14 files changed, 321 insertions(+), 266 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/77cafa4b/Allura/allura/config/app_cfg.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/app_cfg.py b/Allura/allura/config/app_cfg.py
index 1661356..bcca0c2 100644
--- a/Allura/allura/config/app_cfg.py
+++ b/Allura/allura/config/app_cfg.py
@@ -31,6 +31,7 @@ convert them into boolean, for example, you should use the
"""
import logging
+from functools import partial
import tg
import jinja2
@@ -102,6 +103,8 @@ class ForgeConfig(AppConfig):
jinja2_env.install_gettext_translations(pylons.i18n)
jinja2_env.filters['filesizeformat'] = helpers.do_filesizeformat
jinja2_env.filters['datetimeformat'] = helpers.datetimeformat
+ jinja2_env.filters['filter'] = lambda s,t=None: filter(t and jinja2_env.tests[t], s)
+ jinja2_env.filters['map'] = helpers.map_jinja_filter
jinja2_env.globals.update({'hasattr': hasattr})
config['pylons.app_globals'].jinja2_env = jinja2_env
# Jinja's unable to request c's attributes without strict_c
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/77cafa4b/Allura/allura/ext/user_profile/templates/profile_section_base.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/profile_section_base.html b/Allura/allura/ext/user_profile/templates/profile_section_base.html
new file mode 100644
index 0000000..7e15dad
--- /dev/null
+++ b/Allura/allura/ext/user_profile/templates/profile_section_base.html
@@ -0,0 +1,28 @@
+{#-
+ 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.
+-#}
+<div class="profile-section {% block section_class %}{% endblock %}">
+ <h3>
+ {% block title %}{% endblock %}
+ <span class="actions">{% block actions %}{% endblock %}</span>
+ </h3>
+
+ <div class="section-body">
+ {% block content %}{% endblock %}
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/77cafa4b/Allura/allura/ext/user_profile/templates/sections/personal-data.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/sections/personal-data.html b/Allura/allura/ext/user_profile/templates/sections/personal-data.html
new file mode 100644
index 0000000..94b0421
--- /dev/null
+++ b/Allura/allura/ext/user_profile/templates/sections/personal-data.html
@@ -0,0 +1,63 @@
+{#-
+ 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.
+-#}
+{% extends "allura.ext.user_profile:templates/profile_section_base.html" %}
+
+{% block title %}
+ Personal Data
+{% endblock %}
+
+{% block actions %}
+ {% if user == c.user %}
+ <a href="{{auth.account_urls['account_user_info']}}">Edit Personal Data</a>
+ {% endif %}
+{% endblock %}
+
+{% block section_class %}personal-data{% endblock %}
+
+{% block content %}
+ <dl class="personal-data">
+ <dt>Joined:</dt><dd>{{auth.user_registration_date(user)}}</dd>
+ <dt>Location:</dt><dd>
+ {% set loc = user.get_pref('localization') %}
+ {{ [loc.city, loc.country, timezone]|filter|join(' / ') }}
+ </dd>
+ <dt>Username:</dt><dd>
+ {{user.username}}
+ </dd>
+ <dt>Gender:</dt><dd>
+ {{user.get_pref('sex')}}
+ </dd>
+ <dt>Phone Number:</dt><dd>
+ {{user.get_pref('telnumbers')|join(', ')}}
+ </dd>
+ <dt>Skype:</dt><dd>
+ {{user.get_pref('skypeaccount')}}
+ </dd>
+ <dt>Web Site{% if user.get_pref('webpages')|length > 1 %}s{% endif %}:</dt><dd>
+ {{user.get_pref('webpages')|filter|map('urlize', 20, true)|join(', ')}}
+ </dd>
+ <dt>Availability:</dt><dd>
+ <ol>
+ {% for slot in user.get_localized_availability('utc') %}
+ <li>{{ slot.week_day }}: {{ slot.start_time.strftime('%H:%M') }} to {{ slot.end_time.strftime('%H:%M') }}</li>
+ {% endfor %}
+ </ol>
+ </dd>
+ </dl>
+{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/77cafa4b/Allura/allura/ext/user_profile/templates/sections/projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/sections/projects.html b/Allura/allura/ext/user_profile/templates/sections/projects.html
new file mode 100644
index 0000000..4fc5eda
--- /dev/null
+++ b/Allura/allura/ext/user_profile/templates/sections/projects.html
@@ -0,0 +1,49 @@
+{#-
+ 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.
+-#}
+{% extends "allura.ext.user_profile:templates/profile_section_base.html" %}
+
+{% block title %}
+ Projects
+{% endblock %}
+
+{% block actions %}
+ {% if user == c.user %}
+ <a href="/{{config.get('default_neighborhood', 'p')}}/add_project">Add Project</a>
+ {% endif %}
+{% endblock %}
+
+{% block section_class %}projects{% endblock %}
+
+{% block content %}
+ <ul>
+ {% for project in user.my_projects() %}
+ <li>
+ {% if project.icon -%}
+ <img src="{{project.url()}}/icon?{{project.icon._id.generation_time}}" alt="Project Logo"/>
+ {%- else -%}
+ <img src="{{g.forge_static('images/project_default.png')}}" alt="Project Logo"/>
+ {%- endif -%}
+ <span class="project-info">
+ <a href="{{project.url()}}">{{project.name}}</a>
+ {{project.summary}}
+ </span>
+ </li>
+ {% endfor %}
+ </ul>
+{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/77cafa4b/Allura/allura/ext/user_profile/templates/sections/skills.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/sections/skills.html b/Allura/allura/ext/user_profile/templates/sections/skills.html
new file mode 100644
index 0000000..104cc7a
--- /dev/null
+++ b/Allura/allura/ext/user_profile/templates/sections/skills.html
@@ -0,0 +1,39 @@
+{#-
+ 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.
+-#}
+{% extends "allura.ext.user_profile:templates/profile_section_base.html" %}
+
+{% block title %}
+ Skills
+{% endblock %}
+
+{% block actions %}
+ {% if user == c.user %}
+ <a href="{{auth.account_urls['account_user_info']}}/skills">Edit Skills</a>
+ {% endif %}
+{% endblock %}
+
+{% block section_class %}skills{% endblock %}
+
+{% block content %}
+ <ul>
+ {% for skill in user.get_skills() %}
+ <li>{{ skill.skill.fullname }}</li>
+ {% endfor %}
+ </ul>
+{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/77cafa4b/Allura/allura/ext/user_profile/templates/sections/tools.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/sections/tools.html b/Allura/allura/ext/user_profile/templates/sections/tools.html
new file mode 100644
index 0000000..4427c8b
--- /dev/null
+++ b/Allura/allura/ext/user_profile/templates/sections/tools.html
@@ -0,0 +1,39 @@
+{#-
+ 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.
+-#}
+{% extends "allura.ext.user_profile:templates/profile_section_base.html" %}
+
+{% block title %}
+ Tools
+{% endblock %}
+
+{% block actions %}
+ {% if user == c.user %}
+ <a href="{{c.project.url()}}/admin/tools">Add Tools</a>
+ {% endif %}
+{% endblock %}
+
+{% block section_class %}tools{% endblock %}
+
+{% block content %}
+ <ul>
+ {% for tool in c.project.ordered_mounts() %}
+ <li><a href="{{tool['ac'].url()}}">{{ tool['ac'].options.mount_label }}</a></li>
+ {% endfor %}
+ </ul>
+{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/77cafa4b/Allura/allura/ext/user_profile/templates/user_index.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/user_index.html b/Allura/allura/ext/user_profile/templates/user_index.html
index 77d8028..30e4ea3 100644
--- a/Allura/allura/ext/user_profile/templates/user_index.html
+++ b/Allura/allura/ext/user_profile/templates/user_index.html
@@ -32,260 +32,11 @@
<a href="{{c.app.url}}feed.rss" title="Follow"><b data-icon="{{g.icons['feed'].char}}" class="ico {{g.icons['feed'].css}}"></b></a>
{% endblock %}
-{% block content %}
- {% if user.preferences.email_address %}
- <p>{{lib.gravatar(user)}}</p>
- {% endif %}
- <div class="project-list grid-18">
- <b>Projects</b>
- <ul>
- {% for p in user.my_projects() %}
- {% if (c.user == user) or h.has_access(p, 'read') %}
- <li>
- <a class="project-name" href="{{p.url()}}">{{p.name}}</a>
- </li>
- {% endif %}
- {% endfor %}
- </ul>
- </div>
-
- <div class="grid-24">
- <div class="grid-24" style="margin:0;"><b>Personal data</b></div>
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Registration Date:</div>
- <div class="grid-8">{{reg_date}}</div>
- </div>
- {% if user.get_pref('sex') == 'Male' or user.get_pref('sex') == 'Female' %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Gender:</div>
- <div class="grid-8">{{user.get_pref('sex')}}</div>
- </div>
- {% endif %}
- {% if user.get_pref('birthdate') %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Birthdate:</div>
- <div class="grid-8">
- {{ user.get_pref('birthdate').strftime('%d %B %Y')}}
- </div>
- </div>
- {% endif %}
-
- {% if user.get_pref('localization').country or user.get_pref('localization').city %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Localization:</div>
- <div class="grid-8">
- {% if user.get_pref('localization').city %}
- {{user.get_pref('localization').city}}{{ ',' if user.get_pref('localization').country else '' }}
- {% endif %}
- {% if user.get_pref('localization').country %}
- {{user.get_pref('localization').country}}
- {% endif %}
- </div>
- </div>
- {% endif %}
-
- {% if user.get_pref('timezone') %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Timezone:</div>
- <div class="grid-8">
- {{user.get_pref('timezone')}}
- </div>
- </div>
- {% endif %}
-
- {% if user.get_pref('socialnetworks')|length > 0 %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Social networks:</div>
- <div class="grid-18">
- {{user.get_pref('display_name')}}'s account(s):
- <ul>
- {% for i in user.get_pref('socialnetworks') %}
- <li>{{i.socialnetwork}}: <a href="{{i.accounturl}}">{{i.accounturl}}</a></li>
- {% endfor %}
- </ul>
- </div>
- </div>
- {% endif %}
-
- {% if user.get_pref('webpages')|length > 0 %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Websites:</div>
- <div class="grid-18">
- {{user.get_pref('display_name')}}'s website(s):
- <ul>
- {% for i in user.get_pref('webpages') %}
- <li><a href="{{i}}">{{i}}</a></li>
- {% endfor %}
- </ul>
- </div>
- </div>
- {% endif %}
-
- {% if user.get_pref('telnumbers')|length > 0 %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Telephone number(s):</div>
- <div class="grid-18">
- {{user.get_pref('display_name')}}'s telephone number(s):
- <ul>
- {% for i in user.get_pref('telnumbers') %}
- <li>{{i}}</li>
- {% endfor %}
- </ul>
- </div>
- </div>
- {% endif %}
-
- {% if user.get_pref('skypeaccount') %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Skype account:</div>
- <div class="grid-8">{{user.get_pref('skypeaccount')}}</div>
- </div>
- {% endif %}
+{% block nav_menu %}{{super()}}{% endblock %}
- {% if user.get_pref('timezone') and user.get_availability_timeslots() |length > 0 %}
- <div class="grid-24" style="margin:0;">
- <div class="grid-4">Availability:</div>
-
- {% if c.user.get_pref('timezone') %}
- <div class="grid-18" id="timeslotsconverted" style="visibility: visible; display:none;">
- {{user.get_pref('display_name')}}'s availability time-slots.
- <div style="float:right;">
- See timeslots in:
- <a href="JavaScript:void(0);" onclick="changeTimezone('utc')">UTC</a> |
- <a href="JavaScript:void(0);" onclick="changeTimezone('local')">
- {{user.get_pref('display_name')}}'s local time
- </a> |
- <b>Your local time</b>
- </div>
- <ul>
- {% for i in user.get_localized_availability(c.user.get_pref('timezone')) %}
- <li>{{i.week_day}}: from {{i.start_time.strftime("%H:%M")}} to {{i.end_time.strftime("%H:%M")}} </li>
- {% endfor %}
- </ul>
- </div>
- {% endif %}
-
- <div class="grid-18" id="timeslotsutc" style="visibility: visible; display:block;">
- {{user.get_pref('display_name')}}'s availability time-slots.
- <div style="float:right;">
- See timeslots in:
- <b>UTC</b> |
- <a href="JavaScript:void(0);" onclick="changeTimezone('local')">
- {{user.get_pref('display_name')}}'s local time
- </a>
- {% if c.user.get_pref('timezone') %} |
- <a href="JavaScript:void(0);" onclick="changeTimezone('converted')">
- Your local time
- </a>
- {% endif %}
- </div>
- <ul>
- {% for i in user.get_localized_availability('utc') %}
- <li>{{i.week_day}}: from {{i.start_time.strftime("%H:%M")}} to {{i.end_time.strftime("%H:%M")}} </li>
- {% endfor %}
- </ul>
- </div>
-
- <div class="grid-18" id="timeslotslocal" style="visibility: visible; display:none;">
- {{user.get_pref('display_name')}}'s availability time-slots.
- <div style="float:right;">
- See timeslots in:
- <a href="JavaScript:void(0);" onclick="changeTimezone('utc')">UTC</a> |
- <b>
- {{user.get_pref('display_name')}}'s local time
- </b>
- {% if c.user.get_pref('timezone') %} |
- <a href="JavaScript:void(0);" onclick="changeTimezone('converted')">
- Your local time
- </a>
- {% endif %}
- </div>
- <ul>
- {% for i in user.get_availability_timeslots() %}
- <li>{{i.week_day}}: from {{i.start_time.strftime("%H:%M")}} to {{i.end_time.strftime("%H:%M")}} </li>
- {% endfor %}
- </ul>
- </div>
-
- </div>
- </div>
- {% endif %}
-
- {% if user.get_inactive_periods(include_past_periods=False)|length > 0 %}
- <div class="grid-24">
- <div class="grid-4">Inactive periods:</div>
- <div class="grid-18">
- This user won't be able to work on the forge in the following period(s):
- <ul>
- {% for p in user.get_inactive_periods(include_past_periods=False) %}
- <li>From {{p.start_date.strftime('%d %B %Y')}} to {{p.end_date.strftime('%d %B %Y')}}.</li>
- {% endfor %}
- </div>
- </div>
- {% endif %}
-
- {% if user.get_pref('email_address') and c.user.get_pref('email_address') and not user.get_pref('disable_user_messages') %}
- <div class="grid-24">
- <b><a href="send_message">Send me a message</a></b>
- </div>
- {% endif %}
- </div><!-- end of Personal data section -->
- <div class="grid-24">
- <b>Current {{user.get_pref('display_name')}}'s skills list</b>
- <div class="grid-24">
- {% if user.get_skills()|length > 0 %}
- <table>
- <thead>
- <tr>
- <th>Skill</th>
- <th>Level</th>
- <th>Comments</th>
- </tr>
- </thead>
- <tbody>
- {% for s in user.get_skills() %}
- <tr>
- <td>{{s.skill.fullpath}}</td>
- <td>{{s.level}}</td>
- <td>{{s.comment}}</td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% else %}
- <div class="grid-24">At the moment, {{user.get_pref('display_name')}}'s skills list is empty!</div>
- {% endif %}
- </div>
- </div>
-
- {% if c.user.username == user.username %}
- <div class="address-list grid-18">
- <b>Email Addresses</b>
- <ul>
- {% for email in user.email_addresses %}
- <li>
- {{lib.email_gravatar(email, size=24)}}
- {% if email == user.preferences.email_address %}
- <span class="prime email-address">{{email}}</span>
- {% else %}
- <span class="email-address">{{email}}</span>
- {% endif %}
- </li>
- {% endfor %}
- </ul>
- </div>
- <div class="openid-list grid-18">
- <b>OpenIDs</b>
- <ul>
- {% for openid in user.open_ids %}
- <li>
- <span class="openid">{{openid}}</span>
- </li>
- {% endfor %}
- </ul>
- </div>
- {% endif %}
+{% block top_nav %}{# disabled #}{% endblock %}
+{% block content %}
{% for section in sections %}
{{ section.display() }}
{% endfor %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/77cafa4b/Allura/allura/ext/user_profile/user_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/user_main.py b/Allura/allura/ext/user_profile/user_main.py
index 1112aa8..01bb6b8 100644
--- a/Allura/allura/ext/user_profile/user_main.py
+++ b/Allura/allura/ext/user_profile/user_main.py
@@ -27,6 +27,8 @@ from tg import expose, redirect, validate, flash
import tg
from webob import exc
from jinja2 import Markup
+from pytz import timezone
+from datetime import datetime
from allura import version
from allura.app import Application, SitemapEntry
@@ -257,5 +259,35 @@ class ProfileSectionBase(object):
if not self.check_display():
return ''
tmpl = g.jinja2_env.get_template(self.template)
- context = self.prepare_context({'h': h, 'c': c, 'g': g})
+ context = self.prepare_context({
+ 'h': h,
+ 'c': c,
+ 'g': g,
+ 'user': self.user,
+ 'config': tg.config,
+ 'auth': AuthenticationProvider.get(request),
+ })
return Markup(tmpl.render(context))
+
+
+class PersonalDataSection(ProfileSectionBase):
+ template = 'allura.ext.user_profile:templates/sections/personal-data.html'
+
+ def prepare_context(self, context):
+ context['timezone'] = self.user.get_pref('timezone')
+ if context['timezone']:
+ tz = timezone(context['timezone'])
+ context['timezone'] = tz.tzname(datetime.utcnow())
+ return context
+
+
+class ProjectsSection(ProfileSectionBase):
+ template = 'allura.ext.user_profile:templates/sections/projects.html'
+
+
+class SkillsSection(ProfileSectionBase):
+ template = 'allura.ext.user_profile:templates/sections/skills.html'
+
+
+class ToolsSection(ProfileSectionBase):
+ template = 'allura.ext.user_profile:templates/sections/tools.html'
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/77cafa4b/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index ac54d13..83992aa 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -32,6 +32,7 @@ from datetime import datetime, timedelta
from collections import defaultdict
import shlex
import socket
+from functools import partial
import tg
import genshi.template
@@ -49,6 +50,7 @@ from tg.decorators import before_validate
from formencode.variabledecode import variable_decode
import formencode
from jinja2 import Markup
+from jinja2.filters import contextfilter
from paste.deploy.converters import asbool, aslist
from webhelpers import date, feedgenerator, html, number, misc, text
@@ -1154,3 +1156,27 @@ def login_overlay(exceptions=None):
if request.path.rstrip('/').endswith('/%s' % exception):
raise
c.show_login_overlay = True
+
+
+def get_filter(ctx, filter_name):
+ """
+ Gets a named Jinja2 filter, passing through
+ any context requested by the filter.
+ """
+ filter_ = ctx.environment.filters[filter_name]
+ if getattr(filter_, 'contextfilter', False):
+ return partial(filter_, ctx)
+ elif getattr(filter_, 'evalcontextfilter', False):
+ return partial(filter_, ctx.eval_ctx)
+ elif getattr(filter_, 'environmentfilter', False):
+ return partial(filter_, ctx.environment)
+
+
+@contextfilter
+def map_jinja_filter(ctx, seq, filter_name, *a, **kw):
+ """
+ A Jinja2 filter that applies the named filter with the
+ given args to the sequence this filter is applied to.
+ """
+ filter_ = get_filter(ctx, filter_name)
+ return [filter_(value, *a, **kw) for value in seq]
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/77cafa4b/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index cd0ed23..084501f 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -173,7 +173,7 @@ class AuthenticationProvider(object):
'alt': 'Manage Personal Information',
},
{
- 'tabid': 'account_sfnet_beta_index',
+ 'tabid': 'account_subscriptions',
'title': 'Subscriptions',
'target': "/auth/subscriptions",
'alt': 'Manage Subscription Preferences',
@@ -186,6 +186,10 @@ class AuthenticationProvider(object):
},
]
+ @LazyProperty
+ def account_urls(self):
+ return {m['tabid']: m['target'] for m in self.account_navigation()}
+
def user_project_shortname(self, user):
'''
:param user: a :class:`User <allura.model.auth.User>`
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/77cafa4b/Allura/allura/templates/jinja_master/nav_menu.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/nav_menu.html b/Allura/allura/templates/jinja_master/nav_menu.html
index 4280881..b29d566 100644
--- a/Allura/allura/templates/jinja_master/nav_menu.html
+++ b/Allura/allura/templates/jinja_master/nav_menu.html
@@ -24,13 +24,21 @@
{% else %}
{{ theme_macros.breadcrumbs(c.project, c.app) }}
{{ theme_macros.project_header_right(c.project, c.app) }}
- {% if c.project.user_project_of %}
+ {% if c.project.is_user_project %}
{{lib.gravatar(c.project.user_project_of, size=48, className='project_icon')}}
{% elif c.project.icon %}
<img src="{{c.project.url()}}/icon?{{c.project.icon._id.generation_time}}" class="project_icon" alt="Project Logo">
{% endif %}
<h1 class="project_title">
- <a href="{{c.project.url()}}" class="project_link">{{ c.project.neighborhood.name if c.project.is_nbhd_project else c.project.name }}</a>
+ <a href="{{c.project.url()}}" class="project_link">
+ {%- if c.project.is_user_project -%}
+ {{ c.project.user_project_of.display_name }}
+ {%- elif c.project.is_nbhd_project -%}
+ {{ c.project.neighborhood.name }}
+ {%- else -%}
+ {{ c.project.name }}
+ {%- endif -%}
+ </a>
</h1>
{% set status = c.project.troves_by_type('developmentstatus')|sort(attribute='fullname') %}
{% set status = status[-1] %}
@@ -40,6 +48,7 @@
<h2 class="project_summary{% if c.project.icon %} with-icon{% endif %}">
{{c.project.summary}}
</h2>
+ {% if not c.project.is_user_project %}
<div class="brought-by{% if c.project.icon %} with-icon{% endif %}">
Brought to you by:
{% set admins = c.project.admins()|sort(attribute='username') %}
@@ -51,4 +60,5 @@
{% endif %}
{%- endfor -%}
</div>
+ {% endif %}
{% endif %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/77cafa4b/Allura/setup.py
----------------------------------------------------------------------
diff --git a/Allura/setup.py b/Allura/setup.py
index cfb4649..33ca9f5 100644
--- a/Allura/setup.py
+++ b/Allura/setup.py
@@ -127,6 +127,12 @@ setup(
[allura.site_admin]
stats = allura.controllers.site_admin:StatsSiteAdminExtension
+ [allura.user_profile.sections]
+ personal-data = allura.ext.user_profile.user_main:PersonalDataSection
+ projects = allura.ext.user_profile.user_main:ProjectsSection
+ skills = allura.ext.user_profile.user_main:SkillsSection
+ tools = allura.ext.user_profile.user_main:ToolsSection
+
[paste.paster_command]
taskd = allura.command.taskd:TaskdCommand
taskd_cleanup = allura.command.taskd_cleanup:TaskdCleanupCommand
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/77cafa4b/ForgeActivity/forgeactivity/main.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index 269dbfc..e82cca7 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -255,7 +255,6 @@ class ForgeActivityProfileSection(ProfileSectionBase):
filtered_timeline = list(islice(ifilter(perm_check(c.user), full_timeline),
0, 5))
context.update({
- 'user': self.user,
'follow_toggle': W.follow_toggle,
'following': g.director.is_connected(c.user, self.user),
'timeline': filtered_timeline,
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/77cafa4b/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 4e1bec2..5f2230e 100644
--- a/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
+++ b/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
@@ -16,18 +16,24 @@
specific language governing permissions and limitations
under the License.
-#}
+{% extends "allura.ext.user_profile:templates/profile_section_base.html" %}
{% import 'allura:templates/jinja_master/lib.html' as lib with context %}
{% import 'forgeactivity:templates/macros.html' as am with context %}
-<div class="user-activity grid-8">
- <h3>
- User Activity
+{% block title %}
+ User Activity
+{% endblock %}
- {% if c.user and not c.user.is_anonymous() and c.user != user %}
- {{follow_toggle.display(following=following, action=activity_app.url+'follow')}}
- {% endif %}
- <a href="feed.rss" title="RSS"><b data-icon="{{g.icons['feed'].char}}" class="ico {{g.icons['feed'].css}}" title="Feed"></b></a>
- </h3>
+{% block actions %}
+ {% if c.user and not c.user.is_anonymous() and c.user != user %}
+ {{follow_toggle.display(following=following, action=activity_app.url+'follow')}}
+ {% endif %}
+ <a href="feed.rss" title="RSS"><b data-icon="{{g.icons['feed'].char}}" class="ico {{g.icons['feed'].css}}" title="Feed"></b></a>
+{% endblock %}
+
+{% block section_class %}user-activity{% endblock %}
+
+{% block content %}
{% if not timeline %}
<p class="empty">No activity to display.</p>
{% else %}
@@ -49,4 +55,4 @@
</ul>
<a class="view-all" href="{{activity_app.url}}">View All</a>
{% endif %}
-</div>
+{% endblock %}
[14/17] git commit: [#5769] ticket:528 Made code browser handle
double/triple clicks properly
Posted by jo...@apache.org.
[#5769] ticket:528 Made code browser handle double/triple clicks properly
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/390043a1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/390043a1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/390043a1
Branch: refs/heads/cj/7097
Commit: 390043a1539cabfa9d4f4fe5e1cee74ae12b9fe8
Parents: 7406ab9
Author: Ferens Dmitriy <fe...@gmail.com>
Authored: Tue Feb 4 15:22:56 2014 +0200
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Feb 12 20:16:21 2014 +0000
----------------------------------------------------------------------
Allura/allura/templates/repo/file.html | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/390043a1/Allura/allura/templates/repo/file.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/file.html b/Allura/allura/templates/repo/file.html
index b84c47c..8fe2819 100644
--- a/Allura/allura/templates/repo/file.html
+++ b/Allura/allura/templates/repo/file.html
@@ -53,12 +53,15 @@
$('.code_block').each(function(index, element) {
$(element).bind('click', function() {
- var hash = window.location.hash.substring(1);
- if (hash !== '' && hash.substring(0, 1) === 'l' && !isNaN(hash.substring(1))) {
- $('#' + hash).css('background-color', 'transparent');
- }
- $(element).css('background-color', '#ffff99');
- window.location.href = '#' + $(element).attr('id');
+ // Let double/triple clicks select code first
+ setTimeout(function() {
+ var hash = window.location.hash.substring(1);
+ if (hash !== '' && hash.substring(0, 1) === 'l' && !isNaN(hash.substring(1))) {
+ $('#' + hash).css('background-color', 'transparent');
+ }
+ $(element).css('background-color', '#ffff99');
+ window.location.href = '#' + $(element).attr('id');
+ }, 500);
});
});
}());
[08/17] git commit: [#6677] ticket:512 refactored my_projects
Posted by jo...@apache.org.
[#6677] ticket:512 refactored my_projects
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/798e47bf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/798e47bf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/798e47bf
Branch: refs/heads/cj/7097
Commit: 798e47bfbd12c05893b782b90ea0c566d87ef335
Parents: 84c2b7c
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Mon Jan 27 13:32:09 2014 +0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Feb 12 15:59:47 2014 +0000
----------------------------------------------------------------------
.../ext/user_profile/templates/user_index.html | 8 +++-----
Allura/allura/model/auth.py | 17 ++++++++++++++++-
Allura/allura/tests/model/test_auth.py | 5 +++--
ForgeTracker/forgetracker/tracker_main.py | 2 +-
4 files changed, 23 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/798e47bf/Allura/allura/ext/user_profile/templates/user_index.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/user_index.html b/Allura/allura/ext/user_profile/templates/user_index.html
index e639b58..75425c9 100644
--- a/Allura/allura/ext/user_profile/templates/user_index.html
+++ b/Allura/allura/ext/user_profile/templates/user_index.html
@@ -40,11 +40,9 @@
<b>Projects</b>
<ul>
{% for p in user.my_projects() %}
- {% if h.has_access(p, 'read')() %}
- <li>
- <a class="project-name" href="{{p.url()}}">{{p.name}}</a>
- </li>
- {% endif %}
+ <li>
+ <a class="project-name" href="{{p.url()}}">{{p.name}}</a>
+ </li>
{% endfor %}
</ul>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/798e47bf/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 542b1f6..f9f73b6 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -743,7 +743,22 @@ class User(MappedClass, ActivityNode, ActivityObject):
def script_name(self):
return '/u/' + self.username + '/'
- def my_projects(self, role_name=None):
+ def my_projects(self):
+ if self.is_anonymous():
+ return
+ if not c.user:
+ c.user = self.anonymous()
+ user_roles = g.credentials.user_roles(user_id=c.user._id)
+ user_projects = [r['project_id'] for r in user_roles]
+
+ roles = g.credentials.user_roles(user_id=self._id)
+ projects = [r['project_id'] for r in roles]
+ from .project import Project
+ for p in Project.query.find({'_id': {'$in': projects}, 'deleted': False}):
+ if (p._id in user_projects) or h.has_access(p, 'read')():
+ yield p
+
+ def my_projects_by_role_name(self, role_name=None):
"""Return projects to which this user belongs.
If ``role_name`` is provided, return only projects for which user has
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/798e47bf/Allura/allura/tests/model/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_auth.py b/Allura/allura/tests/model/test_auth.py
index cb548da..5119f68 100644
--- a/Allura/allura/tests/model/test_auth.py
+++ b/Allura/allura/tests/model/test_auth.py
@@ -96,6 +96,7 @@ def test_user():
# delete one of the projects and make sure it won't appear in my_projects()
p = M.Project.query.get(shortname='test2')
p.deleted = True
+ ThreadLocalORMSession.flush_all()
assert_equal(set(p.shortname for p in c.user.my_projects()),
set(['test', 'u/test-admin', 'adobe-1', '--init--']))
u = M.User.register(dict(
@@ -237,7 +238,7 @@ def test_email_address_claimed_by_user():
def test_user_projects_by_role():
assert_equal(set(p.shortname for p in c.user.my_projects()),
set(['test', 'test2', 'u/test-admin', 'adobe-1', '--init--']))
- assert_equal(set(p.shortname for p in c.user.my_projects('Admin')),
+ assert_equal(set(p.shortname for p in c.user.my_projects_by_role_name('Admin')),
set(['test', 'test2', 'u/test-admin', 'adobe-1', '--init--']))
# Remove admin access from c.user to test2 project
project = M.Project.query.get(shortname='test2')
@@ -250,7 +251,7 @@ def test_user_projects_by_role():
g.credentials.clear()
assert_equal(set(p.shortname for p in c.user.my_projects()),
set(['test', 'test2', 'u/test-admin', 'adobe-1', '--init--']))
- assert_equal(set(p.shortname for p in c.user.my_projects('Admin')),
+ assert_equal(set(p.shortname for p in c.user.my_projects_by_role_name('Admin')),
set(['test', 'u/test-admin', 'adobe-1', '--init--']))
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/798e47bf/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index f60df6d..193570d 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -148,7 +148,7 @@ def _my_trackers(user, current_tracker_app_config):
Returns list of 3-tuples (<tracker_id>, '<project>/<mount_point>', <is current tracker?>)
'''
trackers = []
- projects = user.my_projects('Admin')
+ projects = user.my_projects_by_role_name('Admin')
for p in projects:
for ac in p.app_configs:
if ac.tool_name.lower() == 'tickets':
[07/17] git commit: [#6677] ticket:532 Require role_name
Posted by jo...@apache.org.
[#6677] ticket:532 Require role_name
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/4201b080
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/4201b080
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/4201b080
Branch: refs/heads/cj/7097
Commit: 4201b080c81dc5a0dee5a41a8f61c35f9eb6a9fe
Parents: 70f0bf3
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Feb 11 16:13:24 2014 +0200
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Feb 12 15:59:47 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/auth.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4201b080/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index fefc2c5..dfbfc32 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -751,7 +751,7 @@ class User(MappedClass, ActivityNode, ActivityObject):
from .project import Project
return Project.query.find({'_id': {'$in': projects}, 'deleted': False})
- def my_projects_by_role_name(self, role_name=None):
+ def my_projects_by_role_name(self, role_name):
"""
Return only projects for which user has
that role.
[03/17] git commit: [#7069] ticket:525 Properly handle deleted
repository on merge request page
Posted by jo...@apache.org.
[#7069] ticket:525 Properly handle deleted repository on merge request page
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/4e2ec156
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/4e2ec156
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/4e2ec156
Branch: refs/heads/cj/7097
Commit: 4e2ec15648333d2aa73b5ea7b93a399edc74a83a
Parents: 6e0435c
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Thu Jan 30 23:40:55 2014 +0200
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Feb 11 05:13:08 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/repository.py | 5 ++
Allura/allura/templates/repo/merge_request.html | 51 +++++++++++++-------
2 files changed, 38 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4e2ec156/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 03803cb..4a00f52 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -707,6 +707,11 @@ class MergeRequest(VersionedArtifact, ActivityObject):
return c.app.url
@LazyProperty
+ def downstream_repo(self):
+ with self.push_downstream_context():
+ return c.app.repo
+
+ @LazyProperty
def downstream_repo_url(self):
with self.push_downstream_context():
return c.app.repo.clone_url(
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4e2ec156/Allura/allura/templates/repo/merge_request.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/merge_request.html b/Allura/allura/templates/repo/merge_request.html
index 820c4e9..9c1da9f 100644
--- a/Allura/allura/templates/repo/merge_request.html
+++ b/Allura/allura/templates/repo/merge_request.html
@@ -31,27 +31,42 @@ Merge Request #{{req.request_number}}: {{req.summary}} ({{req.status}})
{% endblock %}
{% block content %}
- <p>
- <a href="{{req.creator_url}}">{{req.creator_name}}</a>
- would like you to merge {{ req.commits | count }} commits
- from <a href="{{req.downstream_url}}">{{req.downstream_url}}</a>
- to {{ req.target_branch }}
- </p>
+ {% if req.downstream_repo %}
+ <p>
+ <a href="{{req.creator_url}}">{{req.creator_name}}</a>
+ would like you to merge {{ req.commits | count }} commits
+ from <a href="{{req.downstream_url}}">{{req.downstream_url}}</a>
+ to {{ req.target_branch }}
+ </p>
- <div>{{g.markdown.convert(req.description)}}</div>
+ <div>{{g.markdown.convert(req.description)}}</div>
- {{ c.log_widget.display(value=req.commits, app=downstream_app) }}
- <div class="grid-19"><a href="#discussion_holder">Discuss</a></div>
+ {{ c.log_widget.display(value=req.commits, app=downstream_app) }}
+ <div class="grid-19"><a href="#discussion_holder">Discuss</a></div>
- {% if h.has_access(c.app, 'write')() %}
- <div class="grid-19">To merge the commits, please execute the following commands in your working
- copy: </div>
- <div class="grid-19"><textarea
- style="width:80%; height:60px;"
- readonly
- >{{ c.app.repo.merge_command(req) | safe }}</textarea></div>
- {{ c.mr_dispose_form.display(action="save", value=dict(status=req.status)) }}
- <br style="clear:both">
+ {% if h.has_access(c.app, 'write')() %}
+ <div class="grid-19">To merge the commits, please execute the following commands in your working
+ copy: </div>
+ <div class="grid-19"><textarea
+ style="width:80%; height:60px;"
+ readonly
+ >{{ c.app.repo.merge_command(req) | safe }}</textarea></div>
+ {{ c.mr_dispose_form.display(action="save", value=dict(status=req.status)) }}
+ <br style="clear:both">
+ {% endif %}
+ {% else %}
+ <p>
+ Original repository by
+ <a href="{{req.creator_url}}">{{req.creator_name}}</a>
+ is deleted
+ </p>
+
+ <div>{{g.markdown.convert(req.description)}}</div>
+
+ {% if h.has_access(c.app, 'write')() %}
+ {{ c.mr_dispose_form.display(action="save", value=dict(status=req.status)) }}
+ <br style="clear:both">
+ {% endif %}
{% endif %}
{% endblock %}
[05/17] git commit: [#7163] Configure activity tool for anon read
access
Posted by jo...@apache.org.
[#7163] Configure activity tool for anon read access
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/76071dc3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/76071dc3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/76071dc3
Branch: refs/heads/cj/7097
Commit: 76071dc3741f43ae569af34c92ed9a7d8158ff2e
Parents: 1ad33e1
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Feb 11 22:28:00 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Feb 11 22:28:00 2014 +0000
----------------------------------------------------------------------
ForgeActivity/forgeactivity/main.py | 14 ++++++++++++--
.../forgeactivity/tests/functional/test_root.py | 9 +++++++++
2 files changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/76071dc3/ForgeActivity/forgeactivity/main.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index 4df5dbe..0c7aa08 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -28,8 +28,9 @@ from webhelpers import feedgenerator as FG
from allura.app import Application
from allura import version
+from allura import model as M
from allura.controllers import BaseController
-from allura.lib.security import require_authenticated
+from allura.lib.security import require_authenticated, require_access
from allura.model.timeline import perm_check
from allura.lib import helpers as h
from allura.lib.decorators import require_post
@@ -58,7 +59,10 @@ class ForgeActivityApp(Application):
return []
def install(self, project):
- pass # pragma no cover
+ role_anon = M.ProjectRole.by_name('*anonymous')._id
+ self.config.acl = [
+ M.ACE.allow(role_anon, 'read'),
+ ]
def uninstall(self, project):
pass # pragma no cover
@@ -77,6 +81,9 @@ class ForgeActivityController(BaseController):
setattr(self, 'feed.atom', self.feed)
setattr(self, 'feed.rss', self.feed)
+ def _check_security(self):
+ require_access(c.app, 'read')
+
def _before(self, *args, **kw):
"""Runs before each request to this controller.
@@ -193,6 +200,9 @@ class ForgeActivityRestController(BaseController):
super(ForgeActivityRestController, self).__init__(*args, **kw)
self.app = app
+ def _check_security(self):
+ require_access(c.app, 'read')
+
@expose('json:')
def index(self, **kw):
data = self.app.root._get_activities_data(**kw)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/76071dc3/ForgeActivity/forgeactivity/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/tests/functional/test_root.py b/ForgeActivity/forgeactivity/tests/functional/test_root.py
index 2074866..5b6a8d0 100644
--- a/ForgeActivity/forgeactivity/tests/functional/test_root.py
+++ b/ForgeActivity/forgeactivity/tests/functional/test_root.py
@@ -47,6 +47,15 @@ class TestActivityController(TestController):
config['activitystream.enabled'] = 'false'
self.app.get('/activity/', status=404)
+ @td.with_tool('u/test-user-1', 'activity')
+ @td.with_user_project('test-user-1')
+ def test_anon_read(self):
+ r = self.app.get('/u/test-user-1',
+ extra_environ={'username': '*anonymous'}).follow().follow()
+ assert r.html.find('div', dict(id='top_nav')).find('a',
+ dict(href='/u/test-user-1/activity/')), \
+ 'No Activity tool in top nav'
+
@td.with_tool('test', 'activity')
@patch('forgeactivity.main.g.director')
def test_index_html(self, director):
[04/17] git commit: [#7069] ticket:525 added empty check for
downstream_url
Posted by jo...@apache.org.
[#7069] ticket:525 added empty check for downstream_url
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/6e0435cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6e0435cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6e0435cb
Branch: refs/heads/cj/7097
Commit: 6e0435cbd928c14a21cad8cd9a6976511eca4939
Parents: 52ad1f4
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Thu Jan 30 20:28:07 2014 +0200
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Feb 11 05:13:08 2014 +0000
----------------------------------------------------------------------
Allura/allura/templates/repo/merge_requests.html | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6e0435cb/Allura/allura/templates/repo/merge_requests.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/merge_requests.html b/Allura/allura/templates/repo/merge_requests.html
index 772957c..166be00 100644
--- a/Allura/allura/templates/repo/merge_requests.html
+++ b/Allura/allura/templates/repo/merge_requests.html
@@ -48,7 +48,11 @@
<td><a href="{{req.request_number}}/">{{req.request_number}}</a></td>
<td><a href="{{req.request_number}}/">{{req.status}}</a></td>
<td><a href="{{req.request_number}}/">{{req.summary}}</a></td>
- <td><a href="{{req.downstream_url}}">{{req.downstream_url}}</a></td>
+ <td>{% if req.downstream_url %}
+ <a href="{{req.downstream_url}}">{{req.downstream_url}}</a>
+ {% else %}
+ <i>(deleted)</i>
+ {% endif %}</td>
<td><a href="{{req.creator_url}}">{{req.creator_name}}</a></td>
</tr>
{% endfor %}
[11/17] git commit: [#7075] ticket:530 Added "dragable" mode to
screenshots macro
Posted by jo...@apache.org.
[#7075] ticket:530 Added "dragable" mode to screenshots macro
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/984c22e0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/984c22e0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/984c22e0
Branch: refs/heads/cj/7097
Commit: 984c22e0c70630ad2dd1922c82e66485ce1f0047
Parents: 9702f5c
Author: Ferens Dmitriy <fe...@gmail.com>
Authored: Wed Feb 5 18:17:29 2014 +0200
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Feb 12 18:29:13 2014 +0000
----------------------------------------------------------------------
Allura/allura/ext/admin/admin_main.py | 2 +-
Allura/allura/lib/widgets/project_list.py | 3 ++-
Allura/allura/templates/widgets/project_screenshots.html | 8 +++++---
3 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/984c22e0/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index 34641b9..4b75a13 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -65,7 +65,7 @@ class W:
group_settings = aw.GroupSettings()
new_group_settings = aw.NewGroupSettings()
screenshot_admin = aw.ScreenshotAdmin()
- screenshot_list = ProjectScreenshots()
+ screenshot_list = ProjectScreenshots(dragable=True)
metadata_admin = aw.MetadataAdmin()
audit = aw.AuditLog()
page_list = ffw.PageList()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/984c22e0/Allura/allura/lib/widgets/project_list.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/project_list.py b/Allura/allura/lib/widgets/project_list.py
index af209cb..ba560e6 100644
--- a/Allura/allura/lib/widgets/project_list.py
+++ b/Allura/allura/lib/widgets/project_list.py
@@ -165,7 +165,8 @@ class ProjectScreenshots(ew_core.Widget):
defaults = dict(
ew_core.Widget.defaults,
project=None,
- edit=False)
+ edit=False,
+ dragable=False)
def resources(self):
yield ew.JSLink('js/screenshots.js')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/984c22e0/Allura/allura/templates/widgets/project_screenshots.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/project_screenshots.html b/Allura/allura/templates/widgets/project_screenshots.html
index f1c5bca..53731a2 100644
--- a/Allura/allura/templates/widgets/project_screenshots.html
+++ b/Allura/allura/templates/widgets/project_screenshots.html
@@ -18,10 +18,12 @@
-#}
{% import 'allura:templates/jinja_master/lib.html' as lib with context %}
{% set screenshots = project.get_screenshots() %}
-{% if screenshots.__len__() > 1 %}
-<p>Drag screenshots to sort.</p>
+{% if dragable %}
+ {% if screenshots.__len__() > 1 %}
+ <p>Drag screenshots to sort.</p>
+ {% endif %}
{% endif %}
-<div class="sortable">
+<div class="{% if dragable %}sortable{% endif %}">
{% for ss in screenshots %}
<div data-ss-id="{{ ss._id }}" class="screenshot">
<div class="image">
[09/17] git commit: [#6677] ticket:532 return has_access and pull
projects in one query
Posted by jo...@apache.org.
[#6677] ticket:532 return has_access and pull projects in one query
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/70f0bf35
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/70f0bf35
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/70f0bf35
Branch: refs/heads/cj/7097
Commit: 70f0bf35a327a8be18b733252a389efd2ed9992e
Parents: 798e47b
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Thu Feb 6 00:00:59 2014 +0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Feb 12 15:59:47 2014 +0000
----------------------------------------------------------------------
.../ext/user_profile/templates/user_index.html | 8 +++--
Allura/allura/model/auth.py | 32 +++++---------------
2 files changed, 12 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/70f0bf35/Allura/allura/ext/user_profile/templates/user_index.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/user_index.html b/Allura/allura/ext/user_profile/templates/user_index.html
index 75425c9..77d8028 100644
--- a/Allura/allura/ext/user_profile/templates/user_index.html
+++ b/Allura/allura/ext/user_profile/templates/user_index.html
@@ -40,9 +40,11 @@
<b>Projects</b>
<ul>
{% for p in user.my_projects() %}
- <li>
- <a class="project-name" href="{{p.url()}}">{{p.name}}</a>
- </li>
+ {% if (c.user == user) or h.has_access(p, 'read') %}
+ <li>
+ <a class="project-name" href="{{p.url()}}">{{p.name}}</a>
+ </li>
+ {% endif %}
{% endfor %}
</ul>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/70f0bf35/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index f9f73b6..fefc2c5 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -746,43 +746,25 @@ class User(MappedClass, ActivityNode, ActivityObject):
def my_projects(self):
if self.is_anonymous():
return
- if not c.user:
- c.user = self.anonymous()
- user_roles = g.credentials.user_roles(user_id=c.user._id)
- user_projects = [r['project_id'] for r in user_roles]
-
roles = g.credentials.user_roles(user_id=self._id)
projects = [r['project_id'] for r in roles]
from .project import Project
- for p in Project.query.find({'_id': {'$in': projects}, 'deleted': False}):
- if (p._id in user_projects) or h.has_access(p, 'read')():
- yield p
+ return Project.query.find({'_id': {'$in': projects}, 'deleted': False})
def my_projects_by_role_name(self, role_name=None):
- """Return projects to which this user belongs.
-
- If ``role_name`` is provided, return only projects for which user has
+ """
+ Return only projects for which user has
that role.
-
"""
if self.is_anonymous():
return
reaching_role_ids = list(
g.credentials.user_roles(user_id=self._id).reaching_ids_set)
reaching_roles = ProjectRole.query.find(
- {'_id': {'$in': reaching_role_ids}}).all()
- if not role_name:
- named_roles = [r for r in reaching_roles
- if r.name and r.project and not r.project.deleted]
- else:
- named_roles = [r for r in reaching_roles
- if r.name == role_name and r.project and not r.project.deleted]
- seen_project_ids = set()
- for r in named_roles:
- if r.project_id in seen_project_ids:
- continue
- seen_project_ids.add(r.project_id)
- yield r.project
+ {'_id': {'$in': reaching_role_ids}, 'name': role_name})
+ projects = [r['project_id'] for r in reaching_roles]
+ from .project import Project
+ return Project.query.find({'_id': {'$in': projects}, 'deleted': False})
def set_password(self, new_password):
return plugin.AuthenticationProvider.get(request).set_password(
[12/17] git commit: [#7075] ticket:530 s/dragable/draggable and merge
nested if
Posted by jo...@apache.org.
[#7075] ticket:530 s/dragable/draggable and merge nested if
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/367ae8dd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/367ae8dd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/367ae8dd
Branch: refs/heads/cj/7097
Commit: 367ae8dda8258848197c1d904d7a5c2b04cac1e0
Parents: 984c22e
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Feb 7 15:39:57 2014 +0200
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Feb 12 18:29:13 2014 +0000
----------------------------------------------------------------------
Allura/allura/ext/admin/admin_main.py | 2 +-
Allura/allura/lib/widgets/project_list.py | 2 +-
Allura/allura/templates/widgets/project_screenshots.html | 6 ++----
3 files changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/367ae8dd/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index 4b75a13..8c10e3d 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -65,7 +65,7 @@ class W:
group_settings = aw.GroupSettings()
new_group_settings = aw.NewGroupSettings()
screenshot_admin = aw.ScreenshotAdmin()
- screenshot_list = ProjectScreenshots(dragable=True)
+ screenshot_list = ProjectScreenshots(draggable=True)
metadata_admin = aw.MetadataAdmin()
audit = aw.AuditLog()
page_list = ffw.PageList()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/367ae8dd/Allura/allura/lib/widgets/project_list.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/project_list.py b/Allura/allura/lib/widgets/project_list.py
index ba560e6..f14fba9 100644
--- a/Allura/allura/lib/widgets/project_list.py
+++ b/Allura/allura/lib/widgets/project_list.py
@@ -166,7 +166,7 @@ class ProjectScreenshots(ew_core.Widget):
ew_core.Widget.defaults,
project=None,
edit=False,
- dragable=False)
+ draggable=False)
def resources(self):
yield ew.JSLink('js/screenshots.js')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/367ae8dd/Allura/allura/templates/widgets/project_screenshots.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/project_screenshots.html b/Allura/allura/templates/widgets/project_screenshots.html
index 53731a2..94107c5 100644
--- a/Allura/allura/templates/widgets/project_screenshots.html
+++ b/Allura/allura/templates/widgets/project_screenshots.html
@@ -18,12 +18,10 @@
-#}
{% import 'allura:templates/jinja_master/lib.html' as lib with context %}
{% set screenshots = project.get_screenshots() %}
-{% if dragable %}
- {% if screenshots.__len__() > 1 %}
+{% if draggable and screenshots.__len__() > 1 %}
<p>Drag screenshots to sort.</p>
- {% endif %}
{% endif %}
-<div class="{% if dragable %}sortable{% endif %}">
+<div class="{% if draggable %}sortable{% endif %}">
{% for ss in screenshots %}
<div data-ss-id="{{ ss._id }}" class="screenshot">
<div class="image">
[17/17] git commit: [#7097] Changes for new User Profile
Posted by jo...@apache.org.
[#7097] Changes for new User Profile
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/9d6c69bb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/9d6c69bb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/9d6c69bb
Branch: refs/heads/cj/7097
Commit: 9d6c69bbe394520da7ff945a9a1f53b052af0a2e
Parents: 77cafa4
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Feb 12 04:01:38 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Feb 13 15:04:29 2014 +0000
----------------------------------------------------------------------
.../templates/sections/personal-data.html | 2 +-
.../templates/sections/projects.html | 2 ++
.../ext/user_profile/templates/user_index.html | 23 +++++++++-----------
Allura/allura/model/auth.py | 2 +-
Allura/allura/model/project.py | 5 ++++-
.../allura/templates/jinja_master/master.html | 2 ++
.../templates/widgets/profile_section.html | 2 +-
7 files changed, 21 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9d6c69bb/Allura/allura/ext/user_profile/templates/sections/personal-data.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/sections/personal-data.html b/Allura/allura/ext/user_profile/templates/sections/personal-data.html
index 94b0421..81ad62c 100644
--- a/Allura/allura/ext/user_profile/templates/sections/personal-data.html
+++ b/Allura/allura/ext/user_profile/templates/sections/personal-data.html
@@ -52,7 +52,7 @@
<dt>Web Site{% if user.get_pref('webpages')|length > 1 %}s{% endif %}:</dt><dd>
{{user.get_pref('webpages')|filter|map('urlize', 20, true)|join(', ')}}
</dd>
- <dt>Availability:</dt><dd>
+ <dt>Availability (UTC):</dt><dd>
<ol>
{% for slot in user.get_localized_availability('utc') %}
<li>{{ slot.week_day }}: {{ slot.start_time.strftime('%H:%M') }} to {{ slot.end_time.strftime('%H:%M') }}</li>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9d6c69bb/Allura/allura/ext/user_profile/templates/sections/projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/sections/projects.html b/Allura/allura/ext/user_profile/templates/sections/projects.html
index 4fc5eda..3f517de 100644
--- a/Allura/allura/ext/user_profile/templates/sections/projects.html
+++ b/Allura/allura/ext/user_profile/templates/sections/projects.html
@@ -33,6 +33,7 @@
{% block content %}
<ul>
{% for project in user.my_projects() %}
+ {% if project != c.project and not project.is_nbhd_project %}
<li>
{% if project.icon -%}
<img src="{{project.url()}}/icon?{{project.icon._id.generation_time}}" alt="Project Logo"/>
@@ -44,6 +45,7 @@
{{project.summary}}
</span>
</li>
+ {% endif %}
{% endfor %}
</ul>
{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9d6c69bb/Allura/allura/ext/user_profile/templates/user_index.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/user_index.html b/Allura/allura/ext/user_profile/templates/user_index.html
index 30e4ea3..dea696a 100644
--- a/Allura/allura/ext/user_profile/templates/user_index.html
+++ b/Allura/allura/ext/user_profile/templates/user_index.html
@@ -32,23 +32,20 @@
<a href="{{c.app.url}}feed.rss" title="Follow"><b data-icon="{{g.icons['feed'].char}}" class="ico {{g.icons['feed'].css}}"></b></a>
{% endblock %}
-{% block nav_menu %}{{super()}}{% endblock %}
+{% block nav_menu %}
+ {% if user != c.user %}
+ <a id="user-message" href="send_message" class="btn">
+ <b data-icon="{{g.icons['mail'].char}}" class="ico {{g.icons['mail'].css}}"></b>
+ Send Message
+ </a>
+ {% endif %}
+ {{super()}}
+{% endblock %}
{% block top_nav %}{# disabled #}{% endblock %}
-{% block content %}
+{% block content_base %}
{% for section in sections %}
{{ section.display() }}
{% endfor %}
{% endblock %}
-
-{% block extra_js %}
- <script type="text/javascript">
- function changeTimezone(opt){
- $("#timeslotslocal").hide();
- $("#timeslotsutc").hide();
- $("#timeslotsconverted").hide();
- $("#timeslots" + opt).show();
- }
- </script>
-{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9d6c69bb/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index dfbfc32..85681dd 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -513,7 +513,7 @@ class User(MappedClass, ActivityNode, ActivityObject):
week_day = ['Monday', 'Tuesday', 'Wednesday', 'Thursday',
'Friday', 'Saturday', 'Sunday']
avail = self.get_availability_timeslots()
- usertimezone = timezone(self.get_pref('timezone'))
+ usertimezone = timezone(self.get_pref('timezone') or 'UTC')
chosentimezone = timezone(tz_name)
retlist = []
for t in avail:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9d6c69bb/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index eaec993..96bbf67 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -745,7 +745,10 @@ class Project(MappedClass, ActivityNode, ActivityObject):
MappedClass.delete(self)
def breadcrumbs(self):
- entry = (self.name, self.url())
+ if self.is_user_project:
+ entry = (self.user_project_of.display_name, self.url())
+ else:
+ entry = (self.name, self.url())
if self.parent_project:
return self.parent_project.breadcrumbs() + [entry]
else:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9d6c69bb/Allura/allura/templates/jinja_master/master.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/master.html b/Allura/allura/templates/jinja_master/master.html
index dd9c313..0c4d188 100644
--- a/Allura/allura/templates/jinja_master/master.html
+++ b/Allura/allura/templates/jinja_master/master.html
@@ -99,6 +99,7 @@
{% endblock %}
</div>
<div id="content_base">
+ {% block content_base %}
{% if not hide_left_bar %}
{% block sidebar_menu %}
{% include g.theme.sidebar_menu %}
@@ -132,6 +133,7 @@
{% endif %}
{% block after_content %}{% endblock %}
</div>
+ {% endblock %}
</div>
</section>
{{theme_macros.footer(g.year(), g.theme_href(''))}}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9d6c69bb/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 5f2230e..28ba645 100644
--- a/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
+++ b/ForgeActivity/forgeactivity/templates/widgets/profile_section.html
@@ -31,7 +31,7 @@
<a href="feed.rss" title="RSS"><b data-icon="{{g.icons['feed'].char}}" class="ico {{g.icons['feed'].css}}" title="Feed"></b></a>
{% endblock %}
-{% block section_class %}user-activity{% endblock %}
+{% block section_class %}activity{% endblock %}
{% block content %}
{% if not timeline %}
[10/17] git commit: [#7154] Introduce SiteAdminExtension
Posted by jo...@apache.org.
[#7154] Introduce SiteAdminExtension
Move neighborhood stats to an extension.
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/9702f5c7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/9702f5c7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/9702f5c7
Branch: refs/heads/cj/7097
Commit: 9702f5c7d3c3b5f8728c1aea485fc856f0a44203
Parents: 4201b08
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Feb 11 20:47:17 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Feb 12 17:26:36 2014 +0000
----------------------------------------------------------------------
Allura/allura/controllers/root.py | 2 +-
Allura/allura/controllers/site_admin.py | 61 +++++++++++++++++---
Allura/allura/lib/app_globals.py | 1 +
Allura/allura/lib/plugin.py | 30 ++++++++++
Allura/allura/templates/site_admin.html | 15 ++---
Allura/allura/templates/site_admin_index.html | 12 +---
Allura/allura/templates/site_admin_stats.html | 30 ++--------
.../allura/tests/functional/test_site_admin.py | 5 ++
Allura/docs/extending.rst | 1 +
Allura/setup.py | 3 +
10 files changed, 106 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9702f5c7/Allura/allura/controllers/root.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/root.py b/Allura/allura/controllers/root.py
index 198493c..d43afa4 100644
--- a/Allura/allura/controllers/root.py
+++ b/Allura/allura/controllers/root.py
@@ -68,7 +68,6 @@ class RootController(WsgiDispatchController):
auth = AuthController()
error = ErrorController()
nf = NewForgeController()
- nf.admin = SiteAdminController()
search = SearchController()
rest = RestController()
if config.get('trovecategories.enableediting', 'false') == 'true':
@@ -80,6 +79,7 @@ class RootController(WsgiDispatchController):
if n and not n.url_prefix.startswith('//'):
n.bind_controller(self)
self.browse = ProjectBrowseController()
+ self.nf.admin = SiteAdminController()
super(RootController, self).__init__()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9702f5c7/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index e2680dd..352d35f 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -25,14 +25,17 @@ from ming.orm import session
import pymongo
import bson
import tg
+from pylons import app_globals as g
from pylons import tmpl_context as c
from pylons import request
from formencode import validators, Invalid
from webob.exc import HTTPNotFound
+from allura.app import SitemapEntry
from allura.lib import helpers as h
from allura.lib import validators as v
from allura.lib.decorators import require_post
+from allura.lib.plugin import SiteAdminExtension
from allura.lib.security import require_access
from allura.lib.widgets import form_fields as ffw
from allura import model as M
@@ -54,24 +57,40 @@ class SiteAdminController(object):
def __init__(self):
self.task_manager = TaskManagerController()
+ c.site_admin_sidebar_menu = self.sidebar_menu()
def _check_security(self):
with h.push_context(config.get('site_admin_project', 'allura'),
neighborhood=config.get('site_admin_project_nbhd', 'Projects')):
require_access(c.project, 'admin')
+ @expose()
+ def _lookup(self, name, *remainder):
+ for ep_name in sorted(g.entry_points['site_admin'].keys()):
+ admin_extension = g.entry_points['site_admin'][ep_name]
+ controller = admin_extension().controllers.get(name)
+ if controller:
+ return controller(), remainder
+ raise HTTPNotFound, name
+
+ def sidebar_menu(self):
+ base_url = '/nf/admin/'
+ links = [
+ SitemapEntry('Home', base_url, ui_icon=g.icons['admin']),
+ SitemapEntry('API Tickets', base_url + 'api_tickets', ui_icon=g.icons['admin']),
+ SitemapEntry('Add Subscribers', base_url + 'add_subscribers', ui_icon=g.icons['admin']),
+ SitemapEntry('New Projects', base_url + 'new_projects', ui_icon=g.icons['admin']),
+ SitemapEntry('Reclone Repo', base_url + 'reclone_repo', ui_icon=g.icons['admin']),
+ SitemapEntry('Task Manager', base_url + 'task_manager?state=busy', ui_icon=g.icons['stats']),
+ ]
+ for ep_name in sorted(g.entry_points['site_admin']):
+ g.entry_points['site_admin'][ep_name]().update_sidebar_menu(links)
+ return links
+
@expose('jinja:allura:templates/site_admin_index.html')
@with_trailing_slash
def index(self):
- neighborhoods = []
- for n in M.Neighborhood.query.find():
- project_count = M.Project.query.find(
- dict(neighborhood_id=n._id)).count()
- configured_count = M.Project.query.find(
- dict(neighborhood_id=n._id, database_configured=True)).count()
- neighborhoods.append((n.name, project_count, configured_count))
- neighborhoods.sort(key=lambda n: n[0])
- return dict(neighborhoods=neighborhoods)
+ return {}
@expose('jinja:allura:templates/site_admin_api_tickets.html')
@without_trailing_slash
@@ -380,3 +399,27 @@ class TaskManagerController(object):
except Invalid as e:
error = str(e)
return dict(doc=doc, error=error)
+
+
+class StatsController(object):
+ """Show neighborhood stats."""
+ @expose('jinja:allura:templates/site_admin_stats.html')
+ @with_trailing_slash
+ def index(self):
+ neighborhoods = []
+ for n in M.Neighborhood.query.find():
+ project_count = M.Project.query.find(
+ dict(neighborhood_id=n._id)).count()
+ configured_count = M.Project.query.find(
+ dict(neighborhood_id=n._id, database_configured=True)).count()
+ neighborhoods.append((n.name, project_count, configured_count))
+ neighborhoods.sort(key=lambda n: n[0])
+ return dict(neighborhoods=neighborhoods)
+
+
+class StatsSiteAdminExtension(SiteAdminExtension):
+ controllers = {'stats': StatsController}
+
+ def update_sidebar_menu(self, links):
+ links.append(SitemapEntry('Stats', '/nf/admin/stats',
+ ui_icon=g.icons['stats']))
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9702f5c7/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index d4f1b06..3ac8499 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -254,6 +254,7 @@ class Globals(object):
stats=_cache_eps('allura.stats'),
site_stats=_cache_eps('allura.site_stats'),
admin=_cache_eps('allura.admin'),
+ site_admin=_cache_eps('allura.site_admin'),
# macro eps are used solely for ensuring that external macros are
# imported (after load, the ep itself is not used)
macros=_cache_eps('allura.macros'),
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9702f5c7/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 4617303..cd0ed23 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -1038,6 +1038,36 @@ class AdminExtension(object):
pass
+class SiteAdminExtension(object):
+ """
+ A base class for extending the site admin area in Allura.
+
+ After extending this, expose the extension by adding an entry point in your
+ setup.py::
+
+ [allura.site_admin]
+ myext = foo.bar.baz:MySiteAdminExtension
+
+ :ivar dict controllers: Mapping of str (url component) to
+ Controllers. Can be implemented as a ``@property`` function. The str
+ url components will be mounted at /nf/admin/STR/ and will
+ invoke the Controller.
+ """
+
+ controllers = {}
+
+ def update_sidebar_menu(self, sidebar_links):
+ """
+ Change the site admin sidebar by modifying ``sidebar_links``.
+
+ :param sidebar_links: site admin side bar links
+ :type sidebar_links: list of :class:`allura.app.SitemapEntry`
+
+ :rtype: ``None``
+ """
+ pass
+
+
class ImportIdConverter(object):
'''
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9702f5c7/Allura/allura/templates/site_admin.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin.html b/Allura/allura/templates/site_admin.html
index 8e82374..d83f06e 100644
--- a/Allura/allura/templates/site_admin.html
+++ b/Allura/allura/templates/site_admin.html
@@ -16,6 +16,9 @@
specific language governing permissions and limitations
under the License.
-#}
+
+{% from 'allura:templates/jinja_master/sidebar_menu.html' import sidebar_item with context %}
+
{% set hide_left_bar=False %}
{% if page == 'new_projects' %}
{% set hide_left_bar=True %}
@@ -32,15 +35,9 @@
{% block sidebar_menu %}
<div id="sidebar">
<div> </div>
- <ul>
- <li class="{{page=='index' and 'active' or ''}}"><a href="{{sidebar_rel}}."><b data-icon="{{g.icons['admin'].char}}" class="ico {{g.icons['admin'].css}}"></b>Home</a></li>
- <li class="{{page=='api_tickets' and 'active' or ''}}"><a href="{{sidebar_rel}}api_tickets"><b data-icon="{{g.icons['admin'].char}}" class="ico {{g.icons['admin'].css}}"></b>API Tickets</a></li>
- <li class="{{page=='add_subscribers' and 'active' or ''}}"><a href="{{sidebar_rel}}add_subscribers"><b data-icon="{{g.icons['admin'].char}}" class="ico {{g.icons['admin'].css}}"></b>Add Subscribers</a></li>
- <li class="{{page=='new_projects' and 'active' or ''}}"><a href="{{sidebar_rel}}new_projects"><b data-icon="{{g.icons['admin'].char}}" class="ico {{g.icons['admin'].css}}"></b>New Projects</a></li>
- <li class="{{page=='reclone_repo' and 'active' or ''}}"><a href="{{sidebar_rel}}reclone_repo"><b data-icon="{{g.icons['admin'].char}}" class="ico {{g.icons['admin'].css}}"></b>Reclone Repo</a></li>
- <li class="{{page=='task_manager' and 'active' or ''}}"><a href="{{sidebar_rel}}task_manager?state=busy"><b data-icon="{{g.icons['stats'].char}}" class="ico {{g.icons['stats'].css}}"></b>Task Manager</a></li>
-
- </ul>
+ {% for s in c.site_admin_sidebar_menu %}
+ {{sidebar_item(s)}}
+ {% endfor %}
</div>
{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9702f5c7/Allura/allura/templates/site_admin_index.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_index.html b/Allura/allura/templates/site_admin_index.html
index a03bed1..4fea844 100644
--- a/Allura/allura/templates/site_admin_index.html
+++ b/Allura/allura/templates/site_admin_index.html
@@ -18,14 +18,8 @@
-#}
{% set page="index" %}
{% extends 'allura:templates/site_admin.html' %}
+
{% block content %}
-<h2>Neighborhood Stats</h2>
-<table>
- <thead>
- <tr><th>Name</th><th>Projects</th><th>Configured</th></tr>
- </thead>
- {% for name, count, count_configured in neighborhoods %}
- <tr><td>{{name}}</td><td>{{count}}</td><td>{{count_configured}}</td></tr>
- {% endfor %}
-</table>
+<h2>Site Admin Home</h2>
+<p>Choose an action from the menu on the left.</p>
{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9702f5c7/Allura/allura/templates/site_admin_stats.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_stats.html b/Allura/allura/templates/site_admin_stats.html
index 86262d5..6bdcf3b 100644
--- a/Allura/allura/templates/site_admin_stats.html
+++ b/Allura/allura/templates/site_admin_stats.html
@@ -20,35 +20,13 @@
{% extends 'allura:templates/site_admin.html' %}
{% block content %}
+<h2>Neighborhood Stats</h2>
<table>
<thead>
- <tr>
- <th>Url</th>
- <th>Ming</th>
- <th>Mongo</th>
- <th>Render</th>
- <th>Template</th>
- <th>Total Time</th>
- </tr>
- <tr>
- <th>Mean</th>
- <td>{{agg_timings.ming}}</td>
- <td>{{agg_timings.mongo}}</td>
- <td>{{agg_timings.render}}</td>
- <td>{{agg_timings.template}}</td>
- <td>{{agg_timings.total}}</td>
- </tr>
+ <tr><th>Name</th><th>Projects</th><th>Configured</th></tr>
</thead>
- {% for url,timers in stats %}
- <tr>
- <td>{{url}}</td>
- <td>{{timers.get('ming')}}</td>
- <td>{{timers.get('mongo')}}</td>
- <td>{{timers.get('render')}}</td>
- <td>{{timers.get('template')}}</td>
- <td>{{timers.get('total')}}</td>
- </tr>
+ {% for name, count, count_configured in neighborhoods %}
+ <tr><td>{{name}}</td><td>{{count}}</td><td>{{count_configured}}</td></tr>
{% endfor %}
</table>
-
{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9702f5c7/Allura/allura/tests/functional/test_site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_site_admin.py b/Allura/allura/tests/functional/test_site_admin.py
index 0bbff58..79ca43b 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -39,6 +39,11 @@ class TestSiteAdmin(TestController):
def test_home(self):
r = self.app.get('/nf/admin/', extra_environ=dict(
username='root'))
+ assert 'Site Admin Home' in r
+
+ def test_stats(self):
+ r = self.app.get('/nf/admin/stats/', extra_environ=dict(
+ username='root'))
assert 'Forge Site Admin' in r.html.find(
'h2', {'class': 'dark title'}).contents[0]
stats_table = r.html.find('table')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9702f5c7/Allura/docs/extending.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/extending.rst b/Allura/docs/extending.rst
index 9758f55..1e7cef7 100644
--- a/Allura/docs/extending.rst
+++ b/Allura/docs/extending.rst
@@ -31,6 +31,7 @@ The available extension points for Allura are:
* :class:`allura.lib.plugin.AuthenticationProvider`
* :class:`allura.lib.plugin.UserPreferencesProvider`
* :class:`allura.lib.plugin.AdminExtension`
+* :class:`allura.lib.plugin.SiteAdminExtension`
* :class:`allura.lib.spam.SpamFilter`
* ``site_stats`` in the root API data. Docs in :class:`allura.controllers.rest.RestController`
* :mod:`allura.lib.package_path_loader` (for overriding templates)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9702f5c7/Allura/setup.py
----------------------------------------------------------------------
diff --git a/Allura/setup.py b/Allura/setup.py
index f4ea03a..cfb4649 100644
--- a/Allura/setup.py
+++ b/Allura/setup.py
@@ -124,6 +124,9 @@ setup(
akismet = allura.lib.spam.akismetfilter:AkismetSpamFilter
mollom = allura.lib.spam.mollomfilter:MollomSpamFilter
+ [allura.site_admin]
+ stats = allura.controllers.site_admin:StatsSiteAdminExtension
+
[paste.paster_command]
taskd = allura.command.taskd:TaskdCommand
taskd_cleanup = allura.command.taskd_cleanup:TaskdCleanupCommand
[06/17] git commit: [#7127] ticket:531 fixed download snapshot
background
Posted by jo...@apache.org.
[#7127] ticket:531 fixed download snapshot background
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/84c2b7c5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/84c2b7c5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/84c2b7c5
Branch: refs/heads/cj/7097
Commit: 84c2b7c5c8824970cae0132ac323f6d9c19de885
Parents: 76071dc
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Wed Feb 5 16:42:01 2014 +0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Feb 12 14:59:35 2014 +0000
----------------------------------------------------------------------
Allura/allura/templates/repo/tree.html | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/84c2b7c5/Allura/allura/templates/repo/tree.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/tree.html b/Allura/allura/templates/repo/tree.html
index e310056..13f69aa 100644
--- a/Allura/allura/templates/repo/tree.html
+++ b/Allura/allura/templates/repo/tree.html
@@ -45,6 +45,7 @@ form.tarball button {
font-family: "Ubuntu", sans-serif;
font-weight: normal;;
padding: 0;
+ margin-bottom: 0;
font-size: 12px;
line-height: 36px;
}
[02/17] git commit: [#7069] ticket:525 Use downstream_repo for clarity
Posted by jo...@apache.org.
[#7069] ticket:525 Use downstream_repo for clarity
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/2b459735
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/2b459735
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/2b459735
Branch: refs/heads/cj/7097
Commit: 2b4597359bc6566a65df92a9e725c74d94e9c8ba
Parents: 4e2ec15
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Thu Jan 30 23:41:43 2014 +0200
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Feb 11 05:13:08 2014 +0000
----------------------------------------------------------------------
Allura/allura/templates/repo/merge_requests.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2b459735/Allura/allura/templates/repo/merge_requests.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/merge_requests.html b/Allura/allura/templates/repo/merge_requests.html
index 166be00..1b70881 100644
--- a/Allura/allura/templates/repo/merge_requests.html
+++ b/Allura/allura/templates/repo/merge_requests.html
@@ -48,7 +48,7 @@
<td><a href="{{req.request_number}}/">{{req.request_number}}</a></td>
<td><a href="{{req.request_number}}/">{{req.status}}</a></td>
<td><a href="{{req.request_number}}/">{{req.summary}}</a></td>
- <td>{% if req.downstream_url %}
+ <td>{% if req.downstream_repo %}
<a href="{{req.downstream_url}}">{{req.downstream_url}}</a>
{% else %}
<i>(deleted)</i>
[13/17] git commit: [#7164] proactively grab more activities if we
have a low limit
Posted by jo...@apache.org.
[#7164] proactively grab more activities if we have a low limit
Permission filtering may cause no activities to be found unless we do this.
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/7406ab96
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/7406ab96
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/7406ab96
Branch: refs/heads/cj/7097
Commit: 7406ab96608d9806650fa3bff5901ffa74dd6ef9
Parents: 367ae8d
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Feb 12 17:23:18 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Feb 12 18:41:53 2014 +0000
----------------------------------------------------------------------
ForgeActivity/forgeactivity/main.py | 36 ++++++++++++++------
.../forgeactivity/tests/functional/test_root.py | 7 +---
2 files changed, 26 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7406ab96/ForgeActivity/forgeactivity/main.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index 0c7aa08..269dbfc 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -17,6 +17,7 @@
import logging
import calendar
+from itertools import islice, ifilter
from pylons import tmpl_context as c, app_globals as g
from pylons import request, response
@@ -106,19 +107,29 @@ class ForgeActivityController(BaseController):
actor_only = False
following = g.director.is_connected(c.user, followee)
- timeline = g.director.get_timeline(followee, page=kw.get('page', 0),
- limit=kw.get('limit', 100),
- actor_only=actor_only,
- filter_func=perm_check(c.user))
page = asint(kw.get('page', 0))
- limit = asint(kw.get('limit', 100))
+ limit = extra_limit = asint(kw.get('limit', 100))
+ # get more in case perm check filters some out
+ if page == 0 and limit <= 10:
+ extra_limit = limit * 20
+ timeline = g.director.get_timeline(followee, page,
+ limit=extra_limit,
+ actor_only=actor_only)
+ filtered_timeline = list(islice(ifilter(perm_check(c.user), timeline),
+ 0, limit))
+ if extra_limit == limit:
+ # if we didn't ask for extra, then we expect there's more if we got all we asked for
+ has_more = len(timeline) == limit
+ else:
+ # if we did ask for extra, check filtered result
+ has_more = len(filtered_timeline) == limit
return dict(
followee=followee,
following=following,
- timeline=timeline,
+ timeline=filtered_timeline,
page=page,
limit=limit,
- has_more=len(timeline) == limit)
+ has_more=has_more)
@expose('jinja:forgeactivity:templates/index.html')
@with_trailing_slash
@@ -237,14 +248,17 @@ class ForgeActivityProfileSection(ProfileSectionBase):
return app_installed and activity_enabled
def prepare_context(self, context):
+ full_timeline = g.director.get_timeline(
+ self.user, page=0, limit=100,
+ actor_only=True,
+ )
+ filtered_timeline = list(islice(ifilter(perm_check(c.user), full_timeline),
+ 0, 5))
context.update({
'user': self.user,
'follow_toggle': W.follow_toggle,
'following': g.director.is_connected(c.user, self.user),
- 'timeline': g.director.get_timeline(
- self.user, page=0, limit=5,
- actor_only=True,
- filter_func=perm_check(c.user)),
+ 'timeline': filtered_timeline,
'activity_app': self.activity_app,
})
g.register_js('activity_js/follow.js')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7406ab96/ForgeActivity/forgeactivity/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/tests/functional/test_root.py b/ForgeActivity/forgeactivity/tests/functional/test_root.py
index 5b6a8d0..b57c149 100644
--- a/ForgeActivity/forgeactivity/tests/functional/test_root.py
+++ b/ForgeActivity/forgeactivity/tests/functional/test_root.py
@@ -41,7 +41,7 @@ class TestActivityController(TestController):
def test_index(self):
resp = self.app.get('/activity/')
- assert 'No activity to display.' in resp
+ assert 'No activity to display.' in resp, resp
def test_index_disabled(self):
config['activitystream.enabled'] = 'false'
@@ -65,7 +65,6 @@ class TestActivityController(TestController):
"_id": ObjectId("529fa331033c5e6406d8b338"),
"obj": {
"activity_extras": {
- "allura_id": "some_id",
"summary": "Just wanted to leave a comment on this..."
},
"activity_url": "/p/test/tickets/34/?limit=25#ed7c",
@@ -186,7 +185,6 @@ class TestActivityController(TestController):
"_id": ObjectId("529fa331033c5e6406d8b338"),
"obj": {
"activity_extras": {
- "allura_id": "some_id",
"summary": "Just wanted to leave a comment on this..."
},
"activity_url": "/p/test/tickets/34/?limit=25#ed7c",
@@ -238,7 +236,6 @@ class TestActivityController(TestController):
"_id": ObjectId("529fa331033c5e6406d8b338"),
"obj": {
"activity_extras": {
- "allura_id": "some_id",
"summary": "Just wanted to leave a comment on this..."
},
"activity_url": "/p/test/tickets/34/?limit=25#ed7c",
@@ -289,7 +286,6 @@ class TestActivityController(TestController):
"_id": ObjectId("529fa331033c5e6406d8b338"),
"obj": {
"activity_extras": {
- "allura_id": "some_id",
"summary": "Just wanted to leave a comment on this..."
},
"activity_url": "/p/test/tickets/34/?limit=25#ed7c",
@@ -346,7 +342,6 @@ class TestActivityController(TestController):
"_id": ObjectId("529fa331033c5e6406d8b338"),
"obj": {
"activity_extras": {
- "allura_id": "some_id",
"summary": "Just wanted to leave a comment on this..."
},
"activity_url": "/p/test/tickets/34/?limit=25#ed7c",
[15/17] git commit: [#5769] ticket:528 Made code browser ignore
double and triple clicks
Posted by jo...@apache.org.
[#5769] ticket:528 Made code browser ignore double and triple clicks
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/36ba2d62
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/36ba2d62
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/36ba2d62
Branch: refs/heads/cj/7097
Commit: 36ba2d62d9bcf79e5581f3b1af39114e0546863c
Parents: 390043a
Author: Ferens Dmitriy <fe...@gmail.com>
Authored: Fri Feb 7 16:57:25 2014 +0200
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Feb 12 20:16:21 2014 +0000
----------------------------------------------------------------------
Allura/allura/templates/repo/file.html | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/36ba2d62/Allura/allura/templates/repo/file.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/file.html b/Allura/allura/templates/repo/file.html
index 8fe2819..7221557 100644
--- a/Allura/allura/templates/repo/file.html
+++ b/Allura/allura/templates/repo/file.html
@@ -51,17 +51,24 @@
}
}).trigger('hashchange');
+ var clicks = 0;
$('.code_block').each(function(index, element) {
$(element).bind('click', function() {
- // Let double/triple clicks select code first
- setTimeout(function() {
- var hash = window.location.hash.substring(1);
- if (hash !== '' && hash.substring(0, 1) === 'l' && !isNaN(hash.substring(1))) {
- $('#' + hash).css('background-color', 'transparent');
- }
- $(element).css('background-color', '#ffff99');
- window.location.href = '#' + $(element).attr('id');
- }, 500);
+ // Trick to ignore double and triple clicks
+ clicks++;
+ if (clicks == 1) {
+ setTimeout(function() {
+ if (clicks == 1) {
+ var hash = window.location.hash.substring(1);
+ if (hash !== '' && hash.substring(0, 1) === 'l' && !isNaN(hash.substring(1))) {
+ $('#' + hash).css('background-color', 'transparent');
+ }
+ $(element).css('background-color', '#ffff99');
+ window.location.href = '#' + $(element).attr('id');
+ };
+ clicks = 0;
+ }, 500);
+ };
});
});
}());