Skip to content

Commit

Permalink
Visual improvements
Browse files Browse the repository at this point in the history
- mark text for translation
- remove 'update bug tracker' dropdown
- use 'template' instead of html in js
- `btn-danger`, not `btn-default`
  • Loading branch information
asankov committed Aug 15, 2020
1 parent 4f0fcf4 commit dc85236
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
13 changes: 10 additions & 3 deletions tcms/testruns/static/testruns/js/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function addLinkToExecution(testExecution) {
const url = $('.add-hyperlink-form #id_url').val()
const name = $('.add-hyperlink-form #id_name').val()
const isDefect = $('.add-hyperlink-form #defectCheckbox').is(':checked')
const updateTracker = $('.add-hyperlink-form #autoUpdateCheckbox').is(':checked')
const updateTracker = true

jsonRPC('TestExecution.add_link', [{
execution_id: testExecution.id,
Expand Down Expand Up @@ -256,6 +256,13 @@ function addLinkToExecution(testExecution) {
}

function renderLink(link) {
const icon = link.is_defect ? `<span class="fa fa-bug"></span>` : ''
return `<li>${icon} <a href="${link.url}">${link.name || link.url}</a></li>`
const linkEntryTemplate = $('#link-entry')[0].content
const template = $(linkEntryTemplate.cloneNode(true))
if (link.is_defect) {
template.find('.link-icon').addClass('fa fa-bug')
}

template.find('.link-url').html(link.name || link.url)

return template
}
21 changes: 12 additions & 9 deletions tcms/testruns/templates/testruns/get.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ <h5><span class="test-executions-count"></span> Results</h5>
[<a href="#" class="add-link-button" data-toggle="modal" data-target="#add-link-modal"> Add </a>]
<div>
<ul class="test-execution-hyperlinks"></ul>
<template id="link-entry">
<li><span class="link-icon"></span><a class="link-url" href="${link.url}">${link.name || link.url}</a></li>
</template>
</div>
</div>
</div>
Expand Down Expand Up @@ -271,34 +274,34 @@ <h5><span class="test-executions-count"></span> Results</h5>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" aria-label="Close">
<span class="pficon pficon-close"></span>
</button>
<h4 class="modal-title" id="add-hyperlink-modal-title">Add hyperlink</h4>
<h4 class="modal-title" id="add-hyperlink-modal-title">{% trans "Add hyperlink" %}</h4>
</div>
<form class="form-horizontal add-hyperlink-form">
<div class="modal-body">
<div class="form-group">
<label class="col-sm-3 control-label" for="{{ link_form.url.id_for_label }}">URL</label>
<label class="col-sm-3 control-label" for="{{ link_form.url.id_for_label }}">{% trans "URL" %}</label>
<div class="col-sm-9">
<input type="url" name="{{ link_form.url.name }}" maxlength="{{ link_form.url.field.max_length }}" {% if link_form.url.field.required %}required{% endif %} id="{{ link_form.url.id_for_label }}" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="{{ link_form.name.id_for_label }}">Name</label>
<label class="col-sm-3 control-label" for="{{ link_form.name.id_for_label }}">{% trans "Name" %}</label>
<div class="col-sm-9">
<input type="text" name="{{ link_form.name.name }}" maxlength="{{ link_form.name.field.max_length }}" {% if link_form.name.field.required %}required{% endif %} id="{{ link_form.name.id_for_label }}" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="defectCheckbox">Is a defect</label>
<input class="col-sm-9 bootstrap-switch" type="checkbox" id="defectCheckbox"/>
<label class="col-md-3 col-lg-3 col-sm-3 control-label" for="defectCheckbox">{% trans "Is a defect" %}</label>
<input class="col-md-9 col-lg-9 col-sm-9 bootstrap-switch" type="checkbox" id="defectCheckbox"/>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="autoUpdateCheckbox">Auto-update issue tracker</label>
<input class="col-sm-9 bootstrap-switch" type="checkbox" id="autoUpdateCheckbox"/>
<label class="col-md-3 col-lg-3 col-sm-3 control-label" for="autoUpdateCheckbox">{% trans "Auto-update issue tracker" %}</label>
<input class="col-md-9 col-lg-9 col-sm-9 bootstrap-switch" type="checkbox" id="autoUpdateCheckbox"/>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary add-hyperlink-button">Save</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">{% trans "Cancel" %}</button>
<button type="submit" class="btn btn-primary add-hyperlink-button">{% trans "Save" %}</button>
</div>
</form>
</div>
Expand Down

0 comments on commit dc85236

Please sign in to comment.