src/templates/build-manage.html \
src/templates/build-schedule-test.html \
src/templates/build-state.html \
- src/templates/builds-watchers-add.html \
- src/templates/builds-watchers-list.html \
src/templates/distro-edit.html \
src/templates/distro-source-commit-detail.html \
src/templates/distro-source-commit-reset.html \
+++ /dev/null
-{% extends "base.html" %}
-
-{% block title %}{{ _("Watch build %s") % build.name }}{% end block %}
-
-{% block body %}
- <ul class="breadcrumb">
- <li>
- <a href="/">{{ _("Home") }}</a>
- <span class="divider">/</span>
- </li>
- <li>
- <a href="/packages">{{ _("Packages") }}</a>
- <span class="divider">/</span>
- </li>
- <li>
- <a href="/package/{{ build.pkg.name }}">{{ build.pkg.name }}</a>
- <span class="divider">/</span>
- </li>
- <li>
- <a href="/build/{{ build.uuid }}">{{ build.pkg.friendly_version }}</a>
- <span class="divider">/</span>
- </li>
- <li class="active">
- <a href="/build/{{ build.uuid }}/watch">{{ _("Watch") }}</a>
- </li>
- </ul>
-
- <div class="page-header">
- <h1>{{ _("Watch build %s") % build.name }}</h1>
- </div>
-
- <div class="row">
- <div class="span12">
- <p>
- {{ _("You may here add yourself to the list of watchers of this build.") }}
- {{ _("If you do so, you will receive messages about new comments and status updates.") }}
- </p>
- </div>
- </div>
-
- {% if not current_user.is_admin() and current_user in watchers %}
- <div class="alert alert-block">
- <h4 class="alert-heading">{{ _("Oops!") }}</h4>
- {{ _("You are already watching this build.") }}
- </div>
- {% end %}
-
- <div class="row">
- <div class="span6 offset3">
- <form class="form-horizontal" method="POST" action="">
- {% raw xsrf_form_html() %}
-
- <fieldset>
- {% if current_user.is_admin() %}
- <div class="control-group">
- <label class="control-label">{{ _("Choose user") }}</label>
- <div class="controls">
- <select name="user_id">
- {% if not current_user in watchers %}
- <option value="{{ current_user.id }}">{{ _("Myself") }}</option>
- <option value="" disabled>--------</option>
- {% end %}
-
- {% for user in [u for u in users if not u in watchers] %}
- <option value="{{ user.id }}">{{ user.realname }}</option>
- {% end %}
- </select>
-
- <p class="help-block">
- {{ _("Choose a user who should watch this build.") }}
- </p>
- </div>
- </div>
- {% else %}
- <div class="control-group">
- <label class="control-label">{{ _("User") }}</label>
- <div class="controls">
- <span class="input-xlarge uneditable-input">{{ current_user.realname }}</span>
- </div>
- </div>
- {% end %}
-
- <div class="form-actions">
- <button type="submit" class="btn btn-primary">{{ _("Add watcher") }}</button>
- </div>
- </fieldset>
- </form>
- </div>
- </div>
-{% end block %}
+++ /dev/null
-{% extends "base.html" %}
-
-<!-- XXX I THINK THIS IS UNUSED -->
-
-{% block title %}{{ _("Build") }}: {{ _("Watchers of %s") % build.name }}{% end block %}
-
-{% block body %}
- <h1>{{ _("Build") }}: {{ _("Watchers of %s") % build.name }}</h1>
-
- <p>
- {{ _("This is a list of all users who watch this build.") }}
- {{ _("If you write a comment or the status of the build is changed, they all will get a message.") }}
- </p>
-
- {% if current_user in watchers %}
- <p>
- {{ _("You are already watching this build.") }}
- </p>
- {% elif build.owner and current_user == build.owner %}
- <p>
- {{ _("You are the owner of this build. So you don't need to watch it.") }}
- </p>
- {% else %}
- <p>
- <a href="/build/{{ build.uuid }}/watch">{{ _("Watch this build.") }}</a>
- </p>
- {% end %}
-
- <table class="form form2">
- <tr>
- <td class="col1">{{ _("Build") }}</td>
- <td class="col2">
- <a href="/build/{{ build.uuid }}">{{ build.name }}</a>
- </td>
- </tr>
- </table>
- <div style="clear: both;"> </div>
-
- <h2>{{ _("List of all watchers") }}</h2>
- <ul class="watchers">
- {% for watcher in watchers %}
- <li class="user">
- <a class="{{ watcher.state }}" href="/user/{{ watcher.name }}">{{ watcher.realname }}</a>
- </li>
- {% end %}
- </ul>
-{% end block %}
-
-{% block sidebar %}
- <h1>{{ _("Actions") }}</h1>
- <ul>
- <li>
- <a href="/build/{{ build.uuid }}">{{ _("Back to build") }}</a>
- </li>
- </ul>
-{% end %}
(r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/manage", builds.BuildManageHandler),
(r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/comment", builds.BuildDetailCommentHandler),
(r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/state", builds.BuildStateHandler),
- (r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/watch", builds.BuildWatchersAddHandler),
- (r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/watchers", builds.BuildWatchersHandler),
(r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/delete", builds.BuildDeleteHandler),
(r"/queue", jobs.QueueHandler),
self.redirect("/build/%s" % build.uuid)
-class BuildWatchersHandler(base.BaseHandler):
- def get(self, uuid):
- build = self.backend.builds.get_by_uuid(uuid)
-
- if not build:
- raise tornado.web.HTTPError(404, "Build not found")
-
- # Get a list of all watchers and sort them by their realname.
- watchers = build.get_watchers()
- watchers.sort(key=lambda watcher: watcher.realname)
-
- self.render("builds-watchers-list.html", build=build, watchers=watchers)
-
-
-class BuildWatchersAddHandler(base.BaseHandler):
- @tornado.web.authenticated
- def get(self, uuid, error_msg=None):
- build = self.backend.builds.get_by_uuid(uuid)
-
- if not build:
- raise tornado.web.HTTPError(404, "Build not found")
-
- # Get a list of all users that are currently watching this build.
- watchers = build.get_watchers()
-
- self.render("builds-watchers-add.html", error_msg=error_msg,
- build=build, users=self.backend.users, watchers=watchers)
-
- @tornado.web.authenticated
- def post(self, uuid):
- build = self.backend.builds.get_by_uuid(uuid)
-
- if not build:
- raise tornado.web.HTTPError(404, "Build not found")
-
- # Get the user id of the new watcher.
- user_id = self.current_user.id
-
- if self.current_user.is_admin():
- user_id = self.get_argument("user_id", self.current_user.id)
- assert user_id
-
- user = self.backend.users.get_by_id(user_id)
- if not user:
- _ = self.locale.translate
- error_msg = _("User not found.")
-
- return self.get(uuid, error_msg=error_msg)
-
- # Actually add the user to the list of watchers.
- build.add_watcher(user)
-
- # Send user back to the build detail page.
- self.redirect("/build/%s" % build.uuid)
-
-
class ListModule(ui_modules.UIModule):
def render(self, builds):
return self.render_string("builds/modules/list.html", builds=builds)