Added Cosmetic changes
This commit is contained in:
@@ -117,6 +117,7 @@
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<!-- Alerts -->
|
||||
<div class="alert alert-success alert-dismissible fade show hide good" id="successAlert" role="alert">
|
||||
<strong>Success! </strong><span id="op-msg"> Repository Added!</span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
@@ -129,7 +130,12 @@
|
||||
</button>
|
||||
<strong>Oh snap!</strong> Change a few things up and try submitting again.
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<div class="alert alert-info alert-dismissible hide good" id="intentBox" role="alert">
|
||||
<button type="button" id="hideInfoAlert" class="close" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<strong>I understand you intend to: </strong><span id="intentName"></span> If not, please choose the correct option:
|
||||
</div>
|
||||
<!-- Widgets -->
|
||||
<div class="card-group" id="widgets">
|
||||
<div class="card hide widget good" id="createissue">
|
||||
@@ -139,8 +145,8 @@
|
||||
<form>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12 col-sm-12 col-lg-12 col-xs-12 mb-3">
|
||||
<label for="issueName">Issue Title</label>
|
||||
<input type="text" class="form-control" id="issueName" placeholder="Issue name" required>
|
||||
<label for="issueTitle">Issue Title</label>
|
||||
<input type="text" class="form-control" id="issueTitle" placeholder="Issue title" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
@@ -195,12 +201,12 @@
|
||||
Please type some relevant words in the command box.
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary">OK</button>
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button style="display: none" type="submit" data-toggle="modal" data-target="#emptyCommandMessageModal"></button>
|
||||
<button style="display: none" id="emptyCommandMsgDisplayer" type="submit" data-toggle="modal" data-target="#emptyCommandMessageModal"></button>
|
||||
<div class="card-group">
|
||||
<div class="card">
|
||||
<!-- <img class="card-img-top" src="..." alt="Card image cap"> -->
|
||||
|
||||
@@ -28,6 +28,7 @@ module.exports = class Recast {
|
||||
bodyRelevant = body.results;
|
||||
intent = bodyRelevant.intents[0]["slug"];
|
||||
if(intent !== undefined) {
|
||||
domManipulator.displayIntentBox(intent);
|
||||
domManipulator.showWidget(intent);
|
||||
domManipulator.populateRecastData(intent, bodyRelevant);
|
||||
// self.processIntent(intent);
|
||||
|
||||
@@ -2,6 +2,10 @@ module.exports = class DomManipulator {
|
||||
|
||||
constructor() {
|
||||
this.createRepoWidgetCreated = false;
|
||||
this.intentSlugToIntention = {
|
||||
'createrepo' : "Create a Repository in Github",
|
||||
'createissue' : "Raise an issue in Github",
|
||||
};
|
||||
}
|
||||
showWidget(widgetName) {
|
||||
self = this;
|
||||
@@ -54,6 +58,7 @@ module.exports = class DomManipulator {
|
||||
var createRepoWidget = self.createRepoWidget();
|
||||
if(!this.isVisible(createRepoWidget)) {
|
||||
createRepoWidget.classList.remove('hide');
|
||||
$('#underWidgetLine').show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,9 +66,18 @@ module.exports = class DomManipulator {
|
||||
var createIssueWidget = document.getElementById('createissue');
|
||||
if(!this.isVisible(createIssueWidget)) {
|
||||
createIssueWidget.classList.remove('hide');
|
||||
$('#underWidgetLine').show();
|
||||
}
|
||||
}
|
||||
|
||||
displayIntentBox(intent) {
|
||||
var intentBox = document.getElementById('intentBox');
|
||||
if(!this.isVisible(intentBox)) {
|
||||
intentBox.classList.remove('hide');
|
||||
}
|
||||
$('#intentName').text(this.intentSlugToIntention[intent] + ' [slug: ' + intent + '].');
|
||||
}
|
||||
|
||||
createRepoWidget() {
|
||||
var existingWidget = document.getElementById('createrepo')
|
||||
if(existingWidget) {
|
||||
@@ -257,7 +271,7 @@ module.exports = class DomManipulator {
|
||||
app.deleteRepository();
|
||||
break;
|
||||
case "createissue":
|
||||
app.createIssue();
|
||||
self.populateCreateIssueData(recastResponse);
|
||||
break;
|
||||
case "updateissue":
|
||||
app.updateIssue();
|
||||
@@ -297,6 +311,15 @@ module.exports = class DomManipulator {
|
||||
}
|
||||
}
|
||||
|
||||
populateCreateIssueData(recastResponse) {
|
||||
var issueTitleTextField = document.getElementById('issueTitle');
|
||||
if(issueTitleTextField && recastResponse && recastResponse.entities['git-repository'] && recastResponse.entities['git-repository'].length > 0
|
||||
&& recastResponse.entities['git-repository']['0']['value']) {
|
||||
var issueTitle = recastResponse.entities['git-repository']['0']['value'];
|
||||
issueTitleTextField.value = issueTitle;
|
||||
}
|
||||
}
|
||||
|
||||
isVisible(element) {
|
||||
return element ? !element.classList.contains('hide') : false;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ module.exports = $(document).ready(function () {
|
||||
$('#command').keyup(function(e){
|
||||
var code = (e.keyCode ? e.keyCode : e.which);
|
||||
if(code == 13) {
|
||||
$('widgets').children().hide();
|
||||
$('#widgets').children().addClass('hide');
|
||||
var command = document.getElementById('command').value;
|
||||
if(command) {
|
||||
var text = { "text": command};
|
||||
@@ -37,8 +37,8 @@ module.exports = $(document).ready(function () {
|
||||
var requestJSON = dom.getDataFromFormAsJSON();
|
||||
app.createRepository(requestJSON);
|
||||
})
|
||||
$("#hideInfoAlert").on('click', function(){
|
||||
$('#intentBox').addClass('hide');
|
||||
})
|
||||
|
||||
$('#submitForm').click(function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user