incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [05/22] git commit: [#5656] ticket:301 Skeleton for bulk move UI
Date Tue, 28 May 2013 19:27:39 GMT
[#5656] ticket:301 Skeleton for bulk move UI


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/c0797acc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/c0797acc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/c0797acc

Branch: refs/heads/cj/6218
Commit: c0797acc6d69a2a6cf55530f7e150721f94f4525
Parents: e375efb
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Tue Apr 30 13:28:14 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri May 24 18:35:50 2013 +0000

----------------------------------------------------------------------
 .../forgetracker/templates/tracker/index.html      |    3 +
 .../forgetracker/templates/tracker/mass_move.html  |   38 +++++++++++++++
 .../forgetracker/templates/tracker/milestone.html  |    3 +
 .../forgetracker/templates/tracker/search.html     |    5 ++-
 ForgeTracker/forgetracker/tracker_main.py          |   23 ++++++++-
 ForgeTracker/forgetracker/widgets/ticket_search.py |    9 ++++
 6 files changed, 79 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c0797acc/ForgeTracker/forgetracker/templates/tracker/index.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/index.html b/ForgeTracker/forgetracker/templates/tracker/index.html
index 1d1145c..7b3ad36 100644
--- a/ForgeTracker/forgetracker/templates/tracker/index.html
+++ b/ForgeTracker/forgetracker/templates/tracker/index.html
@@ -36,6 +36,9 @@
   {% if allow_edit %}
     <a href="{{tg.url(c.app.url+'edit/', dict(q=url_q, limit=limit, sort=url_sort, page=page))}}"
title="Bulk Edit"><b data-icon="{{g.icons['pencil'].char}}" class="ico {{g.icons['pencil'].css}}"></b></a>
   {% endif %}
+  {% if allow_move %}
+    <a href="{{tg.url(c.app.url + 'move/', dict(q=url_q, limit=limit, sort=url_sort, page=page))}}"
title="Bulk Move"><b data-icon="" class=""></b>Bulk Move</a>
+  {% endif %}
 {% endblock %}
 
 {% block content %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c0797acc/ForgeTracker/forgetracker/templates/tracker/mass_move.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/mass_move.html b/ForgeTracker/forgetracker/templates/tracker/mass_move.html
new file mode 100644
index 0000000..1953801
--- /dev/null
+++ b/ForgeTracker/forgetracker/templates/tracker/mass_move.html
@@ -0,0 +1,38 @@
+{#-
+       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 'forgetracker:templates/tracker/mass_edit.html' %}
+
+{% block actions %}
+<a href="{{tg.url(c.app.url+'move/', dict(q=q, limit=limit, sort=sort, page=page))}}"
title="Bulk Move" class="active"><b data-icon="" class=""></b>Bulk Move</a>
+{% endblock %}
+
+{% block edit_box %}
+<div class="editbox">
+  {{c.mass_move_form.display()}}
+</div>
+{% endblock %}
+
+{% block content %}
+  {{c.mass_move.display(count=count,
+    limit=limit,
+    query=q,
+    tickets=tickets,
+    sort=sort,
+    page=page)}}
+{% endblock %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c0797acc/ForgeTracker/forgetracker/templates/tracker/milestone.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/milestone.html b/ForgeTracker/forgetracker/templates/tracker/milestone.html
index 4c1e61c..7c1cd00 100644
--- a/ForgeTracker/forgetracker/templates/tracker/milestone.html
+++ b/ForgeTracker/forgetracker/templates/tracker/milestone.html
@@ -28,6 +28,9 @@
 {% if allow_edit %}
   <a href="{{tg.url(c.app.url+'edit/', dict(q=q, limit=limit, sort=url_sort, page=page))}}"
title="Bulk Edit"><b data-icon="{{g.icons['pencil'].char}}" class="ico {{g.icons['pencil'].css}}"></b></a>
 {% endif %}
+{% if allow_move %}
+  <a href="{{tg.url(c.app.url + 'move/', dict(q=q, limit=limit, sort=url_sort, page=page))}}"
title="Bulk Move"><b data-icon="" class=""></b>Bulk Move</a>
+{% endif %}
 {% endblock %}
 
 {% block edit_box %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c0797acc/ForgeTracker/forgetracker/templates/tracker/search.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/search.html b/ForgeTracker/forgetracker/templates/tracker/search.html
index 48516f8..dda451d 100644
--- a/ForgeTracker/forgetracker/templates/tracker/search.html
+++ b/ForgeTracker/forgetracker/templates/tracker/search.html
@@ -33,6 +33,9 @@
 {% if allow_edit and count != 0 %}
   <a href="{{tg.url(c.app.url+'edit/', dict(q=q, limit=limit, sort=sort, page=page))}}"
title="Bulk Edit"><b data-icon="{{g.icons['pencil'].char}}" class="ico {{g.icons['pencil'].css}}"></b></a>
 {% endif %}
+{% if allow_move and count != 0 %}
+  <a href="{{tg.url(c.app.url + 'move/', dict(q=q, limit=limit, sort=sort, page=page))}}"
title="Bulk Move"><b data-icon="" class=""></b>Bulk Move</a>
+{% endif %}
 {% endblock %}
 
 {% if q and h.has_access(c.app, 'save_searches')() %}
@@ -67,7 +70,7 @@
   <input type="text" name="q" value="{{q}}" style="width: 280px; float: left; margin-right:
.5em" id="bin_terms">
   {% if bin and h.has_access(c.app, 'save_searches')() %}
     <input type="button" value="Update Search" id="save_search"/>
-  {% endif %}  
+  {% endif %}
   <input type="submit" value="Search"/>
 </form>
 <a href="#" class="btn search_help_modal"><b data-icon="{{g.icons['help'].char}}"
class="ico {{g.icons['help'].css}}"></b> Help</a>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c0797acc/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index 17f3b6b..b1bd941 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -71,7 +71,7 @@ from forgetracker import version
 from forgetracker.widgets.admin import OptionsAdmin
 from forgetracker.widgets.ticket_form import TicketForm, TicketCustomField
 from forgetracker.widgets.bin_form import BinForm
-from forgetracker.widgets.ticket_search import TicketSearchResults, MassEdit, MassEditForm,
SearchHelp
+from forgetracker.widgets.ticket_search import TicketSearchResults, MassEdit, MassEditForm,
MassMoveForm, SearchHelp
 from forgetracker.widgets.admin_custom_fields import TrackerFieldAdmin, TrackerFieldDisplay
 from forgetracker.import_support import ImportSupport
 from forgetracker.plugins import ImportIdConverter
@@ -163,6 +163,7 @@ class W:
     search_help_modal = SearchHelp()
     vote_form = w.VoteForm()
     move_ticket_form = w.forms.MoveTicketForm
+    mass_move_form = MassMoveForm
 
 class ForgeTrackerApp(Application):
     __version__ = version.__version__
@@ -547,6 +548,7 @@ class RootController(BaseController, FeedController):
         result['sortable_custom_fields'] = c.app.globals.sortable_custom_fields_shown_in_search()
         result['subscribed'] = M.Mailbox.subscribed()
         result['allow_edit'] = has_access(c.app, 'update')()
+        result['allow_move'] = has_access(c.app, 'admin')()
         result['help_msg'] = c.app.config.options.get('TicketHelpSearch','').strip()
         result['url_q'] = c.app.globals.not_closed_query
         result['url_sort'] = ''
@@ -650,6 +652,7 @@ class RootController(BaseController, FeedController):
         result['columns'] = columns or solr_columns()
         result['sortable_custom_fields'] = c.app.globals.sortable_custom_fields_shown_in_search()
         result['allow_edit'] = has_access(c.app, 'update')()
+        result['allow_move'] = has_access(c.app, 'admin')()
         result['bin'] = bin
         result['help_msg'] = c.app.config.options.get('TicketHelpSearch', '').strip()
         result['deleted'] = deleted
@@ -758,6 +761,23 @@ class RootController(BaseController, FeedController):
         c.mass_edit_form = W.mass_edit_form
         return result
 
+    @with_trailing_slash
+    @expose('jinja:forgetracker:templates/tracker/mass_move.html')
+    @validate(dict(q=validators.UnicodeString(if_empty=None),
+                   limit=validators.Int(if_empty=10),
+                   page=validators.Int(if_empty=0),
+                   sort=validators.UnicodeString(if_empty='ticket_num_i asc')))
+    def move(self, q=None, limit=None, page=None, sort=None, **kw):
+        require_access(c.app, 'admin')
+        result = TM.Ticket.paged_search(c.app.config, c.user, q, sort=sort, limit=limit,
page=page, show_deleted=False, **kw)
+        result['columns'] = solr_columns()
+        result['sortable_custom_fields'] = c.app.globals.sortable_custom_fields_shown_in_search()
+        result['globals'] = c.app.globals
+        result['cancel_href'] = url(c.app.url + 'search/', dict(q=q, limit=limit, sort=sort))
+        c.mass_move = W.mass_edit
+        c.mass_move_form = W.mass_move_form(tracker=[])
+        return result
+
     @expose()
     @require_post()
     def update_tickets(self, **post_data):
@@ -1768,6 +1788,7 @@ class MilestoneController(BaseController):
         result['columns'] = columns or mongo_columns()
         result['sortable_custom_fields'] = c.app.globals.sortable_custom_fields_shown_in_search()
         result['allow_edit'] = has_access(c.app, 'update')()
+        result['allow_move'] = has_access(c.app, 'admin')()
         result['help_msg'] = c.app.config.options.get('TicketHelpSearch','').strip()
         result['deleted'] = deleted
         progress = c.app.globals.milestone_count(self.progress_key)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c0797acc/ForgeTracker/forgetracker/widgets/ticket_search.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_search.py b/ForgeTracker/forgetracker/widgets/ticket_search.py
index 38a91a7..fdc257a 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_search.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_search.py
@@ -23,6 +23,7 @@ import ew as ew_core
 import ew.jinja2_ew as ew
 
 from allura.lib.widgets import form_fields as ffw
+from allura.lib.widgets import forms
 
 class TicketSearchResults(ew_core.SimpleForm):
     template='jinja:forgetracker:templates/tracker_widgets/ticket_search_results.html'
@@ -84,6 +85,14 @@ class MassEditForm(ew_core.Widget):
     def resources(self):
         yield ew.JSLink('tracker_js/mass-edit.js')
 
+class MassMoveForm(forms.MoveTicketForm):
+    defaults=dict(
+        forms.MoveTicketForm.defaults,
+        action='.')
+
+    def resources(self):
+        yield ew.JSLink('tracker_js/mass-edit.js')
+
 class SearchHelp(ffw.Lightbox):
     defaults=dict(
         ffw.Lightbox.defaults,


Mime
View raw message