Skip to content

added code so button is flush with rightside of containing box #9

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

Open
wants to merge 1 commit 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
3 changes: 1 addition & 2 deletions main/static/main/algoview.css
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ pre{
padding: 10px;
word-wrap: break-word;
border-radius:0;
margin-bottom: 0;
margin-right: -15px;
margin-bottom: 0;
}
.userbox a {
color: #fff;
Expand Down
226 changes: 102 additions & 124 deletions main/templates/main/algo/view.html
Original file line number Diff line number Diff line change
@@ -1,162 +1,140 @@
{% extends "main/layout.html" %}

{% block titletag %}
{{ algo.name }} - algoBook
{% endblock %}

{% block description %}
<meta name="description" content="{{ algo.description }} - algobook.net">
{% endblock %}

{% block authors %}
<meta name="authors" content="{% for code in codes %}{{ code.user.username }},{% endfor %}">
{% endblock %}


{% block content %} {% include "main/navbar.html" %}
{% extends "main/layout.html" %} {% block titletag %} {{ algo.name }} - algoBook {% endblock %} {% block description %}
<meta name="description" content="{{ algo.description }} - algobook.net"> {% endblock %} {% block authors %}
<meta name="authors" content="{% for code in codes %}{{ code.user.username }},{% endfor %}"> {% endblock %} {% block content %} {% include "main/navbar.html" %}
<div class="container ">
<h1 class="algotitle"> {{ algo.name }} </h1>
<p class="description text-muted textarea" id="description" placeholder="Add Description">
{{ algo.description }}
</p>
<p class="lead algolang">
in <span class="label label-danger"> {{ lang }}</span>
</p>
{% load votes_filter %}
{% load codes_filter %}
{% for code in codes %}
<div class="row codebox" id="code-{{code.id}}">
<div class="col-sm-2 col-lg-1 col-xs-hidden meta">
<a href="/algos/codes/{{ code.id }}/votes?add=1" class="vote"
v-bind:class="{ 'disabled' : {% isUp code %} }">
<h1 class="algotitle"> {{ algo.name }} </h1>
<p class="description text-muted textarea" id="description" placeholder="Add Description">
{{ algo.description }}
</p>
<p class="lead algolang">
in <span class="label label-danger"> {{ lang }}</span>
</p>
{% load votes_filter %} {% load codes_filter %} {% for code in codes %}
<div class="row codebox" id="code-{{code.id}}">
<div class="col-sm-2 col-lg-1 col-xs-hidden meta">
<a href="/algos/codes/{{ code.id }}/votes?add=1" class="vote" v-bind:class="{ 'disabled' : {% isUp code %} }">
<i class="glyphicon glyphicon-chevron-up"></i>
</a>

<p class="text-center score"> {{ code|count }}</p>

<a href="/algos/codes/{{ code.id }}/votes?add=-1" class="vote"
v-bind:class="{ 'disabled' : {% isDown code %} }">

<p class="text-center score"> {{ code|count }}</p>

<a href="/algos/codes/{{ code.id }}/votes?add=-1" class="vote" v-bind:class="{ 'disabled' : {% isDown code %} }">
<i class="glyphicon glyphicon-chevron-down"></i>
</a> <!-- #TODO: Add favourites in second stage -->
<!-- <i class="glyphicon glyphicon-heart fav"></i> -->
</div>
<div class="col-sm-10 col-lg-11">
<pre class="{{ code.lang.name|noDefault }}">
</a>
<!-- #TODO: Add favourites in second stage -->
<!-- <i class="glyphicon glyphicon-heart fav"></i> -->
</div>
<div class="col-sm-10 col-lg-11">
<pre class="{{ code.lang.name|noDefault }}">
<code>{{ code.code }}</code>
</pre>
</div>
<div class="col-sm-12">
<div class="row">
<div class="col-sm-6 col-lg-4 col-sm-offset-3 col-lg-offset-6">
{% showDelete code as c%} {% if c %}
<div class="pull-right">
<a href="codes/{{code.id}}/delete" class="controls"><i class="glyphicon glyphicon-trash"></i></a>
</div>
{% endif %}
</div>
<div class="col-sm-12">
<div class="col-sm-6 col-lg-4 col-sm-offset-3 col-lg-offset-6">
{% showDelete code as c%}
{% if c %}
<div class="pull-right">
<a href="codes/{{code.id}}/delete" class="controls"><i class="glyphicon glyphicon-trash"></i></a>
</div>
{% endif %}
</div>
<div class="col-sm-3 col-lg-2">
<div class="userbox">
<a href="/user/{{ code.user.username }}"> {{ code.user.username }}</a>
</div>
</div>
<div class="col-sm-3 col-lg-2">
<div class="userbox">
<a href="/user/{{ code.user.username }}"> {{ code.user.username }}</a>
</div>
</div>
</div>
</div>
{% endfor %}
<div class="row ">
<div class="container codebox addans">
<form action="{% url 'add_code' %}" method="post">
{% csrf_token %}
<textarea class="form-control codeform" name="code" v-model="data" placeholder="Submit your code for this algorithm"></textarea>
<input type="text" name="lang" hidden value="{{ lang }}" id="lang">
<input type="text" id="algo_id" name="algo_id" hidden value="{{ algo.id }}" id="algoId">
<button class="btn btn-danger pull-right" style="margin-top:20px;">Post Your Algorithm</button>
</form>
<div class="container">
<pre>
</div>
{% endfor %}
<div class="row ">
<div class="container codebox addans">
<form action="{% url 'add_code' %}" method="post">
{% csrf_token %}
<textarea class="form-control codeform" name="code" v-model="data" placeholder="Submit your code for this algorithm"></textarea>
<input type="text" name="lang" hidden value="{{ lang }}" id="lang">
<input type="text" id="algo_id" name="algo_id" hidden value="{{ algo.id }}" id="algoId">
<button class="btn btn-danger pull-right" style="margin-top:20px;">Post Your Algorithm</button>
</form>
<div class="container">
<pre>
<code class="css">(( data ))</code>
</pre>
</div>
</div>
</div>
</div>
<!-- Disqus -->
<div class="row codebox">
<div class="container">
<div id="disqus_thread"></div>
</div>
</div>
<!-- Disqus -->
<div class="row codebox">
<div class="container">
<div id="disqus_thread"></div>
</div>
<!-- ./Disqus -->
</div>
<!-- ./Disqus -->
</div>
<script>
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
/*
var disqus_config = function () {
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
*/
(function() { // DON'T EDIT BELOW THIS LINE
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
/*
var disqus_config = function () {
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
*/
(function () { // DON'T EDIT BELOW THIS LINE
var d = document,
s = d.createElement('script');
s = d.createElement('script');
s.src = '//qanda-2.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
{% endblock %} {% block headextended %} {% load static %}
<link rel="stylesheet" href="{% static 'main/algoview.css' %}"> {% endblock %}





{% block footerextended %}
<link rel="stylesheet" href="{% static 'main/algoview.css' %}"> {% endblock %} {% block footerextended %}
<!-- TODO: second stage, change languages -->
<script type="text/javascript">
$('#selectlang').popover();
$('#selectlang').popover();

function clearit(ev){
function clearit(ev) {
console.log(ev)
}
}

$('#description').focusin( function(){
$('#description').focusin(function () {
$('#deleteit').remove();
})
})

$('#description').focusout(function() {
$('#description').focusout(function () {
algo_id = $('#algo_id').val()
if( $(this).html() == '')
return 0
if ($(this).html() == '')
return 0
description = $('#description').html()
$.get("{% url 'add_desc' %}?algo_id=" + algo_id + "&desc=" + description)
})

})
</script>

<script src="{% static 'main/textarea.js' %}"></script>
<script>
$(".textarea").toTextarea({
allowHTML: false,//allow HTML formatting with CTRL+b, CTRL+i, etc.
allowImg: false,//allow drag and drop images
singleLine: false,//make a single line so it will only expand horizontally
pastePlainText: true,//paste text without styling as source
placeholder: "Add Description"//a placeholder when no text is entered. This can also be set by a placeholder="..." or data-placeholder="..." attribute
$(".textarea").toTextarea({
allowHTML: false, //allow HTML formatting with CTRL+b, CTRL+i, etc.
allowImg: false, //allow drag and drop images
singleLine: false, //make a single line so it will only expand horizontally
pastePlainText: true, //paste text without styling as source
placeholder: "Add Description" //a placeholder when no text is entered. This can also be set by a placeholder="..." or data-placeholder="..." attribute
});
$(document)
.one('focus.textarea', '.autoExpand', function () {
var savedValue = this.value;
this.value = '';
this.baseScrollHeight = this.scrollHeight;
this.value = savedValue;
})
.on('input.textarea', '.autoExpand', function () {
var minRows = this.getAttribute('data-min-rows') | 0,
rows;
this.rows = minRows;
rows = Math.ceil((this.scrollHeight - this.baseScrollHeight) / 16);
this.rows = minRows + rows;
});
$(document)
.one('focus.textarea', '.autoExpand', function(){
var savedValue = this.value;
this.value = '';
this.baseScrollHeight = this.scrollHeight;
this.value = savedValue;
})
.on('input.textarea', '.autoExpand', function(){
var minRows = this.getAttribute('data-min-rows')|0,
rows;
this.rows = minRows;
rows = Math.ceil((this.scrollHeight - this.baseScrollHeight) / 16);
this.rows = minRows + rows;
});
</script>
{% endblock %}
{% endblock %}