Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase height of texteditor #25

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
<div id="view-source">
<a id="view-source-link" href="https://github.com/PrasadG193/yaml2go"><i class="fa fa-github"></i> &nbsp;View Source</a>
</div>
<div id="view-source">
<a id="view-source-link" href="https://github.com/PrasadG193/yaml2go"><i class="fa fa-github"></i> &nbsp;View
Source</a>
</div>
</div>
<div id="error">
<span id="err-span"></span>
</div>
<div id="error">
<span id="err-span">
Expand Down
52 changes: 31 additions & 21 deletions frontend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@ let go = document.getElementById("goGenerator")

let editor = ""

window.generatorCall=function (){
let yamlData = document.getElementById("yamlGenerator").value
window.generatorCall = function () {
let yamlData = document.getElementById("yamlGenerator").value
document.getElementById('yamlGenerator').style.border = "1px solid #ced4da"
yamlData = editor.getValue()
$.ajax({
'url' : `${URL}`,
'type' : 'POST',
'data' : yamlData,
'success' : function(data) {
'url': `${URL}`,
'type': 'POST',
'data': yamlData,
'success': function (data) {
document.getElementById("error").style.display="none"
document.getElementById("err-span").innerHTML="";
go.setValue(data)
},
'error' : function(jqXHR, request,error)
{
'error': function (jqXHR, request, error) {
document.getElementById('yamlGenerator').style.border = "1px solid red"
if (jqXHR.status == 400) {
displayError('Invalid yaml format')
Expand All @@ -32,30 +31,41 @@ window.generatorCall=function (){
}

//Convert
document.getElementById("convert").addEventListener('click', ()=>{
generatorCall()
document.getElementById("convert").addEventListener('click', () => {
console.log('Temp Data')
generatorCall()
})

//Clear YAML
document.getElementById('clearYaml').addEventListener('click',()=>{
document.getElementById('clearYaml').addEventListener('click', () => {
editor.setValue('')
})

//Clear Go
document.getElementById('clearGo').addEventListener('click',()=>{
document.getElementById('clearGo').addEventListener('click', () => {
go.setValue('')
})


$(document).ready(function(){
//code here...
var input = $(".codemirror-textarea")[0];
var output = $(".codemirror-textarea")[1];
editor = CodeMirror.fromTextArea(input, {
mode: "text/x-yaml",
lineNumbers : true
});

$(document).ready(function () {
//code here...
var input = $(".codemirror-textarea")[0];
var output = $(".codemirror-textarea")[1];
editor = CodeMirror.fromTextArea(input, {
mode: "text/x-yaml",
lineNumbers: true
});
editor.setSize(600, 400)
go = CodeMirror.fromTextArea(output, {
lineNumbers: true,
mode: "text/x-go"
});
go.setSize(600, 400)
$('.CodeMirror').resizable({
resize: function () {
editor.setSize($(this).width(), $(this).height());
}
});
go = CodeMirror.fromTextArea(output, {
lineNumbers : true,
mode: "text/x-go"
Expand Down
286 changes: 143 additions & 143 deletions frontend/style.css
Original file line number Diff line number Diff line change
@@ -1,143 +1,143 @@
html, body, main {
height:100%;
}
.apply_space{
width: 45%;
}
.button_yaml{
width: 50px;
height: 50px;
top: 50%;
margin: auto;
left: 0;
right: 0;
}
/* Safari 4.0 - 8.0 */
@-webkit-keyframes example {
0% {border-color: #FF851B;}
25% {border-color: #0074D9;}
50% {border-color: #F012BE;}
75% {border-color: #B10DC9;}
100% {border-color: #001f3f;}
}
/* Standard syntax */
@keyframes example {
0% {border-color: #FF851B;}
25% {border-color: #0074D9;}
50% {border-color: #F012BE;}
75% {border-color: #B10DC9;}
100% {border-color: #001f3f;}
}
.btn {
background-color: steelBlue; /* Blue background */
border: none; /* Remove borders */
color: white; /* White text */
cursor: pointer; /* Mouse pointer on hover */
}
.container{
max-width: 80%;
height: 100%;
}
.coversion{
width: 21px;
margin-left: 12px;
margin-top: 16px;
}
.clear_code{
float: right;
margin-top: 8px;
}
.modify{
display: flex;
justify-content: center;
}
.go-float{
float: right;
}
.jumbotron {
padding: 10px 0 !important;
background-color: azure !important;
}
.infoData{
margin: 16px 42px;
width: 50%
}
.k2Go{
font-size: 22px;
color: steelblue;
font-family: monospace;
margin-bottom: 4px;
}
.secondaryData{
font-size: 15px;
color: steelblue;
font-family: monospace;
}
button:focus{
outline: none;
box-shadow: none;
}
.pointer{
cursor: pointer;
}
.CodeMirror {
border: 1px solid lavender !important;
height: 100%;
}
#error{
width: 50%;
margin: auto;
border: 1px solid azure;
display: none;
padding: 10px;
text-align: center;
color: red;
}
#view-source{
margin-top: 40px;
width: 60%;
text-align: right;
margin-right: 100px;
}
#view-source-link{
border: 1px solid steelblue;
padding: 10px;
color: steelblue;
}
#view-source a{
text-decoration: none !important;
}
#view-source-link:hover{
background-color: white;
}
.credits {
color: gray;
text-align: center;
}
html, body, main {
height:100%;
}

.apply_space{
width: 45%;
}

.button_yaml{
width: 50px;
height: 50px;
top: 50%;
margin: auto;
left: 0;
right: 0;
}

/* Safari 4.0 - 8.0 */
@-webkit-keyframes example {
0% {border-color: #FF851B;}
25% {border-color: #0074D9;}
50% {border-color: #F012BE;}
75% {border-color: #B10DC9;}
100% {border-color: #001f3f;}

}

/* Standard syntax */
@keyframes example {
0% {border-color: #FF851B;}
25% {border-color: #0074D9;}
50% {border-color: #F012BE;}
75% {border-color: #B10DC9;}
100% {border-color: #001f3f;}
}


.btn {
background-color: steelBlue; /* Blue background */
border: none; /* Remove borders */
color: white; /* White text */
cursor: pointer; /* Mouse pointer on hover */
}

.container{
max-width: 80%;
height: 100%;
}

.coversion{
width: 21px;
margin-left: 12px;
margin-top: 16px;
}
.clear_code{
float: right;
margin-top: 8px;
}

.modify{
display: flex;
justify-content: center;
}

.go-float{
float: right;
}

.jumbotron {
padding: 10px 0 !important;
background-color: azure !important;
}


.infoData{
margin: 16px 42px;
width: 50%
}

.k2Go{
font-size: 22px;
color: steelblue;
font-family: monospace;
margin-bottom: 4px;
}

.secondaryData{
font-size: 15px;
color: steelblue;
font-family: monospace;
}

button:focus{
outline: none;
box-shadow: none;
}

.pointer{
cursor: pointer;
}


.CodeMirror {
border: 1px solid lavender !important;
height: 100%;
}

#error{
width: 50%;
margin: auto;
border: 1px solid azure;
display: none;
padding: 10px;
text-align: center;
color: red;
}

#view-source{
margin-top: 40px;
width: 60%;
text-align: right;
margin-right: 100px;
}

#view-source-link{
border: 1px solid steelblue;
padding: 10px;
color: steelblue;

}

#view-source a{
text-decoration: none !important;
}

#view-source-link:hover{
background-color: white;
}

.credits {
color: gray;
text-align: center;
}