</section>
{% end %}
+ {# Log #}
<section class="section">
<h5 class="title is-5">{{ _("Log") }}</h5>
{% module EventsList(build=build, show_build=False) %}
</section>
+
+ {# Comment - This probably should go into a modal #}
+ <section class="section">
+ <form method="POST" action="/builds/{{ build.uuid }}/comment">
+ {% raw xsrf_form_html() %}
+
+ <div class="field">
+ <label class="label">{{ _("Comment") }}</label>
+ <div class="control">
+ <textarea class="textarea" name="text" rows="8"
+ placeholder="{{ _("Comment...") }}"></textarea>
+ </div>
+ </div>
+
+ <div class="field">
+ <div class="control">
+ <button class="button is-link">Submit</button>
+ </div>
+ </div>
+ </form>
+ </section>
{% end block %}
{% for event in events %}
{% if event.build_comment %}
- {% module EventBuildComment(event, show_build=show_build) %}
+ {% module EventBuildComment(event, show_build=show_build, show_builder=show_builder) %}
{% elif event.user or event.by_user %}
{% module EventUserMessage(event, show_build=show_build, show_builder=show_builder) %}
{% else %}
<div class="media-content">
<p>
- {% if event.type == "build-created" %}
+ {% if event.type == "build-comment" %}
+ {{ _("%s Commented") % event.by_user }}
+ {% elif event.type == "build-created" %}
{{ _("Build Created") }}
{% elif event.type == "build-deleted" %}
{{ _("Build Deleted") }}
# Builds
(r"/builds", builds.IndexHandler),
(r"/builds/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})", builds.ShowHandler),
+ (r"/builds/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/comment", builds.CommentHandler),
(r"/builds/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/delete", builds.DeleteHandler),
(r"/builds/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/watch", builds.WatchHandler),
(r"/builds/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/unwatch", builds.UnwatchHandler),
- (r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/comment", builds.BuildDetailCommentHandler),
(r"/api/v1/builds", builds.APIv1IndexHandler),
self.redirect("/builds/%s" % build.uuid)
-class BuildDetailCommentHandler(base.BaseHandler):
+class CommentHandler(base.BaseHandler):
@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")
-
- vote = self.get_argument("vote", "none")
-
- if vote == "up":
- vote = 1
- elif vote == "down":
- vote = -1
- else:
- vote = 0
+ raise tornado.web.HTTPError(404, "Could not find build %s" % uuid)
- text = self.get_argument("text", "")
+ text = self.get_argument("text")
- # Add a new comment to the build.
- if text or vote:
- build.comment(self.current_user, text, vote)
+ # Add a new comment to the build
+ with self.db.transaction():
+ build.comment(self.current_user, text)
- # Redirect to the build detail page.
- self.redirect("/build/%s" % build.uuid)
+ # Redirect to the build
+ self.redirect("/builds/%s" % build.uuid)
class ListModule(ui_modules.UIModule):
class BuildCommentModule(ui_modules.UIModule):
- def render(self, event, show_build=False):
+ def render(self, event, show_build=False, show_builder=True):
return self.render_string("events/modules/build-comment.html",
- event=event, comment=event.build_comment, show_build=show_build)
+ event=event, comment=event.build_comment,
+ show_build=show_build, show_builder=show_builder)
class UserMessageModule(ui_modules.UIModule):