#13 and #18 finished and PreReleased launch

This commit is contained in:
José Luis Garrido Labrador
2018-10-21 20:48:35 +02:00
parent cb7a16984b
commit d1353bd1cf
15 changed files with 450 additions and 100 deletions

View File

@@ -0,0 +1,26 @@
.myAlert-top{
position: fixed;
top: 5px;
left:2%;
width: 96%;
}
.myAlert-bottom{
position: fixed;
bottom: 5px;
left:2%;
width: 96%;
}
div.fullscreen {
position: absolute;
width:100%;
height:960px;
top: 0;
left: 0;
background-color: lightblue;
}
.alert{
display: none;
}

View File

@@ -5,8 +5,10 @@
<link type="text/css" rel="stylesheet" href="{{ app.frontcss }}/bootstrap-paper.css"/>
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="{{ app.frontcss }}/main.css"/>
<link type="text/css" rel="stylesheet" href="{{ app.frontcss }}/alert.css"/>
<link type="text/css" rel="stylesheet" href="{{ app.frontcss }}/codeStyles/vs.css"/>
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.css" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous">
{#<link rel="shortcut icon" href="{{ path.img }}favicon.ico" type="image/x-icon"/>#}
{% block css %}{% endblock %}
@@ -19,6 +21,7 @@
<script src="{{ app.frontjs }}/bootstrap.min.js"></script>
<script src='https://www.google.com/recaptcha/api.js'></script>
<script src="{{ app.frontjs }}/functions.js"></script>
<script src="{{ app.frontjs }}/like.js"></script>
</head>
<body>
{% include app.fronthtml~'/nav.twig' %}
@@ -26,6 +29,10 @@
{% block content %}{% endblock %}
<div class="myAlert-bottom alert alert-dismissible alert-danger">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a><strong>Oh snap!</strong> Something wrong
</div>
{% include app.fronthtml~"/footer.twig" %}
{% block js %}

View File

@@ -1,35 +1,45 @@
<table style="width: 100%; text-align:center">
<tr>
<th>
<a href="{{ path('code',{'idc': code.idc,'lang': code.lang,'version': code.version}) }}">{{ code.name }}</a>
</th>
</tr>
<tr>
<td><strong>Author:</strong>&nbsp{{ code.nick }} <strong> Version: </strong>{{ code.version }} <strong>
Lang: </strong>{{ code.lLang }}</td>
</tr>
{% if code.extlib is defined and code.extlib != "" %}
<tr>
<td>
<strong>External library:</strong>&nbsp{{ code.extlib }}
{% if code.extlibver is not null %}
<strong> Version used: </strong>{{ code.extlibver }}
<div class="container-fluid" style="width: 100%; text-align:center">
<div class="row">
<div class="col-lg-offset-2 col-md-offset-2 col-sm-offset-2 col-xs-offset-2 col-lg-8 col-md-8 col-sm-8 col-xs-8">
<h5><a href="{{ path('code',{'idc': code.idc,'lang': code.lang,'version': code.version}) }}">{{ code.name }}</a></h5>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2" style="text-align: right">
<h4>
<a href="javascript:;" onclick="likeAndSave('l',{{ code.idc }},'{{ code.lang }}'{% if user.nick is defined %},'{{ user.nick }}'{% endif %})"
data-toggle="tooltip" data-placement="top" title="" data-original-title="Like">
<i class="{% if code.like == 1 %}fas{% else %}far{% endif %} fa-heart" id="l-{{ code.idc }}-{{ code.lang|raw }}" style="padding-right: 0.05em;"></i>
</a>
<a href="javascript:;" onclick="likeAndSave('s',{{ code.idc }},'{{ code.lang }}'{% if user.nick is defined %},'{{ user.nick }}'{% endif %})"
data-toggle="tooltip" data-placement="top" title="" data-original-title="Save">
<i class="{% if code.save == 1 %}fas{% else %}far{% endif %} fa-bookmark" id="s-{{ code.idc }}-{{ code.lang }}"></i>
</a>
</h4>
</div>
</div>
{% if page.page!="home"%}
{% if code.extlib is defined and code.extlib != "" %}
<div class="row">
<strong>External library:</strong>&nbsp{{ code.extlib }}
{% if code.extlibver is not null %}
<strong> Version used: </strong>{{ code.extlibver }}
{% endif %}
<div/>
</div>
{% endif %}
</td>
</tr>
{% endif %}
<tr>
<th colspan="6">Description</th>
</tr>
<tr>
<td colspan="6">{{ code.description }}</td>
</tr>
<tr>
<th colspan="6">Code</th>
</tr>
<tr>
<td colspan="6">
<div class="row">
<div class="col-lg-offset-3 col-md-offset-3 col-sm-offset-3 col-xs-offset-3 col-lg-6 col-md-6 col-sm-6 col-xs-6">
{% if page.page!="home"%}<strong>Description:</strong> {{ code.description }}{% endif %}
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6" style="text-align: left"><strong>{{ code.lLang }}</strong></div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6" style="text-align: right"><strong>{{ code.nick }}</strong></div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<pre class="highlight"><code class='{{ code.lang }} codeto toHightlight'>{{ code.code }}</code></pre>
</td>
</tr>
</table>
</div>
</div>
</div>

View File

@@ -0,0 +1,48 @@
{#<table style="width: 100%; text-align:center">
<tr>
<th>
<h4><a href="{{ path('code',{'idc': code.idc,'lang': code.lang,'version': code.version}) }}">{{ code.name }}</a></h4>
</th>
</tr>
<tr>
<td><strong>Author:</strong>&nbsp{{ code.nick }} <strong> Version: </strong>{{ code.version }} <strong>
Lang: </strong>{{ code.lLang }}</td>
</tr>
<tr>
<td colspan="6">
<pre class="highlight"><code class='{{ code.lang }} codeto toHightlight'>{{ code.code }}</code></pre>
</td>
</tr>
</table>#}
<div class="container-fluid" style="width: 100%; text-align:center">
<div class="row">
<div class="col-lg-12"><h5><a href="{{ path('code',{'idc': code.idc,'lang': code.lang,'version': code.version}) }}">{{ code.name }}</a></h5></div>
</div>
<div class="row">
<div class="col-lg-12"></div>
</div>
{% if page.page!=home%}
{% if code.extlib is defined and code.extlib != "" %}
<div class="row">
<strong>External library:</strong>&nbsp{{ code.extlib }}
{% if code.extlibver is not null %}
<strong> Version used: </strong>{{ code.extlibver }}
{% endif %}
<div/>
</div>
{% endif %}
<div class="row">
<strong>Description:</strong> {{ code.description }}
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6" style="text-align: left"><strong>{{ code.lLang }}</strong></div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6" style="text-align: right"><strong>{{ code.nick }}</strong></div>
</div>
{% endif %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<pre class="highlight"><code class='{{ code.lang }} codeto toHightlight'>{{ code.code }}</code></pre>
</div>
</div>
</div>

View File

@@ -12,6 +12,7 @@
<p class="text-danger loginMessage" id="POST_ERROR">Error during sign-up, check your data</p>
<p class="text-danger loginMessage" id="MAIL_IN_USE">The e-mail is currently in use</p>
<p class="text-danger loginMessage" id="NICK_IN_USE">The nickname is currently in use</p>
<p class="text-danger loginMessage" id="CONFIRM_MAIL">Please, confirm your email before</p>
</div>
</div>
</div>

View File

@@ -25,7 +25,7 @@
<script>
$(document).ready(function() {
var options = {success: function(data){
console.log(data);
window.location.href = '{{path('home')}}';
},
url: '{{ path("restore")}}',
} ;

View File

@@ -0,0 +1,16 @@
<div class="container">
<div class="row">
<h5 class="col-sm-offset-1">Saved codes</h5>
</div>
<div class="row">
<div class="col-sm-offset-1">
<ul class="list-group">
{% for s in saved %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<a href="{{ path('code',{'idc': s.idc,'lang': s.lang,'version': s.version}) }}">{{ s.name }} on {{ s.lLang }}</a>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>

View File

@@ -3,50 +3,77 @@
<h4 style="text-align: center" xmlns="http://www.w3.org/1999/html">{{ user.nick }}</h4>
<div class="container">
<div class="row">
<p class="col-md-1"><strong>Nickname</strong></p>
<p class="col-md-11">{{ user.nick }}</p>
</div>
<div class="row">
<p class="col-md-1"><strong>Email</strong></p>
<p class="col-md-11">{{ user.email }}</p>
</div>
<hr/>
</div>
<div class="container">
{% if page.status == 1 %}
<p class="text-success">Password updated successfully</p>
{% elseif page.status == 2 %}
<p class="text-danger">Old password incorrect</p>
{% endif %}
<div class="row">
<h5 class="col-sm-offset-1">Change password</h5>
</div>
<div class="row">
<form class="form-horizontal" method="post">
<div class="form-group">
<label class="control-label col-sm-2" for="passact">Current password:</label>
<div class="col-sm-10">
<input type="password" class="form-control" required="required" name="passact" id="passact" placeholder="Current password">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="navbar-link active" href="#data" role="tab" data-toggle="tab">My information</a>
</li>
<li class="nav-item">
<a class="navbar-link" href="#saved" role="tab" data-toggle="tab">Saved codes</a>
</li>
<li class="nav-item">
<a class="navbar-link" href="#password" role="tab" data-toggle="tab">Change password</a>
</li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane fade in active" id="data">
<div class="container">
<div class="row">
<h5 class="col-sm-offset-1">My information</h5>
</div>
<div class="row">
<p class="col-md-1 col-sm-offset-1"><strong>Nickname</strong></p>
<p class="col-md-10">{{ user.nick }}</p>
</div>
<div class="row">
<p class="col-md-1 col-sm-offset-1"><strong>Email</strong></p>
<p class="col-md-10">{{ user.email }}</p>
</div>
<hr/>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="newpass">New password:</label>
<div class="col-sm-10">
<input type="password" class="form-control" required="required" name="newpass" id="newpass" onchange="onPasswordChange()" placeholder="New password">
<div role="tabpanel" class="tab-pane fade" id="saved">
{% include app.fronthtml~'/saved.twig' %}
</div>
<div role="tabpanel" class="tab-pane fade" id="password">
<div class="container">
{% if page.status == 1 %}
<p class="text-success">Password updated successfully</p>
{% elseif page.status == 2 %}
<p class="text-danger">Old password incorrect</p>
{% endif %}
<div class="row">
<h5 class="col-sm-offset-1">Change password</h5>
</div>
<div class="row">
<form class="form-horizontal" method="post">
<div class="form-group">
<label class="control-label col-sm-2" for="passact">Current password:</label>
<div class="col-sm-10">
<input type="password" class="form-control" required="required" name="passact" id="passact" placeholder="Current password">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="newpass">New password:</label>
<div class="col-sm-10">
<input type="password" class="form-control" required="required" name="newpass" id="newpass" onchange="onPasswordChange()" placeholder="New password">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="newpass-re">Repeat new password:</label>
<div class="col-sm-10">
<input type="password" class="form-control" required="required" name="newpass-re" id="newpass-re" onchange="onPasswordChange()" placeholder="Repear new password">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="newpass-re">Repeat new password:</label>
<div class="col-sm-10">
<input type="password" class="form-control" required="required" name="newpass-re" id="newpass-re" onchange="onPasswordChange()" placeholder="Repear new password">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
{% endblock %}

69
Source/assets/js/like.js Normal file
View File

@@ -0,0 +1,69 @@
function likeAndSave(m,c,l,i=null){
var b=$('#'+m+"-"+c+"-"+l);
var data = {};
switch (m) {
case 'l':
if(b.hasClass('fas')){
data.mode = "unvote";
data.before = 'fas';
data.after = 'far';
}else{
data.mode = "vote";
data.before = 'far';
data.after = 'fas';
}
break;
case 's':
if(b.hasClass('fas')){
data.mode = "unsave";
data.before = 'fas';
data.after = 'far';
}else{
data.mode = "save";
data.before = 'far';
data.after = 'fas';
}
break;
}
if (i==null){
window.location.replace('/login')
}
data.idc=c;
data.lang=l;
$.ajax({
url: '/vote-save',
type: 'POST',
contentType: "application/json",
data: JSON.stringify(data),
traditional: true,
success: function(result) {
console.log(result);
if (result == 0){
b.addClass(data.after);
b.removeClass(data.before);
}
else
myAlertBottom();
},
error: function (result) {
myAlertBottom();
}
});
}
function myAlertTop(){
$(".myAlert-top").fadeToggle();
setTimeout(function(){
$(".myAlert-top").fadeToggle();
}, 2000);
}
function myAlertBottom(){
$(".myAlert-bottom").fadeToggle();
setTimeout(function(){
$(".myAlert-bottom").fadeToggle();
}, 2000);
}