allura
Revision | 69ab1b1b8c43651af310e07fe5d8be2d59c70fe7 (tree) |
---|---|
Zeit | 2012-07-06 22:07:29 |
Autor | Igor Bondarenko <jetmind2@gmai...> |
Commiter | Igor Bondarenko |
[#4481] ticket:102 Added option to enable/disable voting on tickets.
@@ -108,7 +108,9 @@ | ||
108 | 108 | {% endblock %} |
109 | 109 | |
110 | 110 | {% block content %} |
111 | -{{ c.vote_form.display(artifact=ticket) }} | |
111 | +{% if voting_enabled %} | |
112 | + {{ c.vote_form.display(artifact=ticket) }} | |
113 | +{% endif %} | |
112 | 114 | <div id="ticket_content"> |
113 | 115 | {{g.markdown.convert(ticket.description)|safe}} |
114 | 116 | {% if ticket.attachments %} |
@@ -106,6 +106,7 @@ class ForgeTrackerApp(Application): | ||
106 | 106 | permissions = ['configure', 'read', 'write', 'save_searches', |
107 | 107 | 'unmoderated_post', 'post', 'moderate', 'admin'] |
108 | 108 | config_options = Application.config_options + [ |
109 | + ConfigOption('EnableVoting', bool, False), | |
109 | 110 | ConfigOption('TicketMonitoringEmail', str, ''), |
110 | 111 | ConfigOption('TicketMonitoringType', |
111 | 112 | schema.OneOf('NewTicketsOnly', 'AllTicketChanges'), None) |
@@ -1021,10 +1022,11 @@ class TicketController(BaseController): | ||
1021 | 1022 | subscribed = M.Mailbox.subscribed(artifact=self.ticket) |
1022 | 1023 | post_count = self.ticket.discussion_thread.post_count |
1023 | 1024 | limit, page = h.paging_sanitizer(limit, page, post_count) |
1025 | + voting_enabled = self.ticket.app.config.options.get('EnableVoting') | |
1024 | 1026 | return dict(ticket=self.ticket, globals=c.app.globals, |
1025 | 1027 | allow_edit=has_access(self.ticket, 'write')(), |
1026 | 1028 | tool_subscribed=tool_subscribed, |
1027 | - subscribed=subscribed, | |
1029 | + subscribed=subscribed, voting_enabled=voting_enabled, | |
1028 | 1030 | page=page, limit=limit, count=post_count) |
1029 | 1031 | else: |
1030 | 1032 | raise exc.HTTPNotFound, 'Ticket #%s does not exist.' % self.ticket_num |
@@ -1240,6 +1242,7 @@ class TrackerAdminController(DefaultAdminController): | ||
1240 | 1242 | def options(self, **kw): |
1241 | 1243 | c.options_admin = W.options_admin |
1242 | 1244 | return dict(app=self.app, form_value=dict( |
1245 | + EnableVoting=self.app.config.options.get('EnableVoting'), | |
1243 | 1246 | TicketMonitoringType=self.app.config.options.get('TicketMonitoringType'), |
1244 | 1247 | TicketMonitoringEmail=self.app.config.options.get('TicketMonitoringEmail'), |
1245 | 1248 | TicketHelpNew=self.app.config.options.get('TicketHelpNew'), |
@@ -13,6 +13,9 @@ class OptionsAdmin(ff.AdminForm): | ||
13 | 13 | @property |
14 | 14 | def fields(self): |
15 | 15 | fields = [ |
16 | + ew.Checkbox( | |
17 | + name='EnableVoting', | |
18 | + label='Enable voting on tickets'), | |
16 | 19 | ew.TextField( |
17 | 20 | name='TicketMonitoringEmail', |
18 | 21 | label='Email ticket notifications to', |