-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
644 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. | ||
from .models import Documentation | ||
|
||
|
||
class DocumentationAdmin(admin.ModelAdmin): | ||
list_display = ["name", "pub_date"] | ||
list_display_links = ["name"] | ||
list_filter = ["pub_date"] | ||
search_fields = ["name"] | ||
class Meta: | ||
model = Documentation | ||
|
||
|
||
admin.site.register(Documentation, DocumentationAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
from django import forms | ||
|
||
from .models import Documentation | ||
|
||
class DocUploadForm(forms.Form): | ||
'''Form for documentation file upload''' | ||
|
||
name = forms.CharField(max_length=100) | ||
doc_file = forms.FileField() | ||
class DocUploadForm(forms.ModelForm): | ||
'''Form for documentation file upload''' | ||
class Meta(object): | ||
model = Documentation | ||
fields = [ | ||
"name", | ||
"doc_file", | ||
] | ||
widgets = { | ||
'name': forms.TextInput(attrs={'placeholder': 'Enter Title','class': 'form-control'}), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
''' | ||
|
||
import os | ||
|
||
import pypandoc | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.4 on 2016-05-05 03:04 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('docupload', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='documentation', | ||
name='doc_file', | ||
field=models.FileField(upload_to='/home/darknight/Desktop/oksp/media/'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{% load staticfiles %} | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>{% block head_title %}OKSP{% endblock head_title %}</title> | ||
<!-- Latest compiled and minified CSS --> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> | ||
|
||
<!-- Optional theme --> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous"> | ||
<link rel="stylesheet" type="text/css" href='{% static "css/base.css" %}' /> | ||
{% block csslink %} | ||
|
||
{% endblock csslink %} | ||
{% block jslink %} | ||
|
||
{% endblock jslink %} | ||
<style> | ||
.container-fluid .navbar .navbar-brand { | ||
color: white; | ||
} | ||
{% block style %} | ||
{% endblock style %} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="container-fluid" style="margin: 0; padding: 0"> | ||
{% block bar %} | ||
|
||
{% endblock bar %} | ||
</div> | ||
<div class="container-fluid" style="margin: 0; padding: 0"> | ||
{% block content %} | ||
|
||
{% endblock content %} | ||
</div> | ||
<!-- Latest compiled and minified JavaScript --> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{% extends "docupload/base.html" %} | ||
|
||
{% block style %} | ||
body { | ||
background:black; | ||
} | ||
{% endblock style %} | ||
|
||
{% block bar %} | ||
<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="margin: 0; padding: 0"> | ||
<a class="navbar-brand" rel="home" href='#' title="OKSP">OKSP</a> | ||
</div> | ||
{% endblock bar %} | ||
|
||
{% block content %} | ||
<div class="jumbotron text-center" style="background: black;"> | ||
<div class="container"> | ||
<h1 style="color:white;">OKSP Editor</h1> | ||
<p style="color:white">Welcome to the documentation upload portal.<br/>Please choose the editor of your choice. We support Markdown as well as WYSIWYG (eg MS Word, Google Docs)</p> | ||
<span style="margin-right: 2em;"><a class="btn btn-info btn-lg" href="{% url 'docupload:markdown_editor' %}" role="button">Markdown »</a></span> | ||
<span style="margin-left: 2em;"><a class="btn btn-info btn-lg" href="{% url 'docupload:wsyiwyg_editor' %}" role="button">WYSIWYG »</a></span> | ||
</div> | ||
</div> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,56 @@ | ||
<form name="docupload" action="{% url 'docupload:upload' %}" method="post" enctype="multipart/form-data"> | ||
{% csrf_token %} | ||
{{ form }} | ||
<input type="submit" value="Submit"> | ||
</form> | ||
<hr><br> | ||
{% if doc_list %} | ||
<ul> | ||
{% for doc in doc_list %} | ||
<li><a href="/doc/{{ doc.id }}/">{{ doc.name }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
{% else %} | ||
<p>No docs are available.</p> | ||
{% endif %} | ||
{% extends "docupload/base.html" %} | ||
|
||
{% block style %} | ||
body { | ||
background: black; | ||
} | ||
.form-group, h3 { | ||
color: white; | ||
} | ||
{% endblock style %} | ||
|
||
{% block bar %} | ||
<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="margin: 0; padding: 0"> | ||
<a class="navbar-brand" rel="home" href='#' title="OKSP">OKSP</a> | ||
</div> | ||
{% endblock bar %} | ||
|
||
{% block content %} | ||
<div class="container-fluid" style="margin: 0; padding: 0;"> | ||
<div class="jumbotron" style="background: black;"> | ||
<h3 style="text-align: center;">Fill out the Details</h3> | ||
<form method='POST' action="{% url 'docupload:upload' %}" enctype="multipart/form-data" role="form">{% csrf_token %} | ||
<div class="form-group"> | ||
<label>Title:</label> | ||
{{ form.name }} | ||
</div> | ||
<div class="form-group"> | ||
<label>File:</label> | ||
{{ form.doc_file }} | ||
</div> | ||
<input type = 'submit' class = 'btn btn-primary' value='Submit' /> | ||
</form> | ||
<hr/> | ||
<div class="container"> | ||
<div class="row"> | ||
{% if doc_list %} | ||
{% for doc in doc_list %} | ||
<div class="col-sm-6" style="margin: 0; padding: 0;"> | ||
<div class="thumbnail"> | ||
<!--<img src="..." alt="...">--> | ||
<div class="caption"> | ||
<h3><a href='/doc/{{ doc.id }}/'>{{ doc.name }}<small> {{ doc.pub_date|timesince }} ago</small> </a></h3> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{% cycle "" "<div class = 'col-sm-12'><hr/></div></div><div class='row'>" %} | ||
{% endfor %} | ||
{% else %} | ||
<h3>No docs are available.</h3> | ||
{% endif %} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{% extends "docupload/base.html" %} | ||
|
||
{% block jslink %} | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.3.0/showdown.min.js" type="text/javascript"></script> | ||
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script> | ||
{% endblock jslink %} | ||
|
||
{% block style %} | ||
.well { | ||
background: white; | ||
} | ||
body { | ||
background: black; | ||
} | ||
{% endblock style %} | ||
|
||
{% block bar %} | ||
<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="margin: 0; padding: 0"> | ||
<a class="navbar-brand" rel="home" href='#' title="OKSP">OKSP</a> | ||
</div> | ||
{% endblock bar %} | ||
|
||
{% block content %} | ||
<div class="jumbotron" style="background: black;"> | ||
<div class="container"> | ||
<h1 style="text-align: center; color: white;">Markdown Editor</h1> | ||
</div> | ||
<textarea id="sourceTA" rows="25" style="width: 49%; display: inline-block;" class="well" placeholder="Start writing here"></textarea> | ||
<div id='targetDiv' style="float: right; width: 49%; overflow: scroll; height: 38.5em;" class="well"></div> | ||
<hr/> | ||
<script> | ||
function run() { | ||
var text = document.getElementById('sourceTA').value, | ||
target = document.getElementById('targetDiv'), | ||
converter = new showdown.Converter(), | ||
html = converter.makeHtml(text); | ||
|
||
target.innerHTML = html; | ||
} | ||
|
||
$('#sourceTA').on('change keyup paste', function() { | ||
run(); | ||
console.log(this.value); | ||
}); | ||
</script> | ||
</div> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{% extends "docupload/base.html" %} | ||
|
||
{% block style %} | ||
body { | ||
background: black; | ||
} | ||
{% endblock style %} | ||
|
||
{% block jslink %} | ||
<script src="//cdn.ckeditor.com/4.5.8/full/ckeditor.js"></script> | ||
{% endblock jslink %} | ||
|
||
|
||
{% block bar %} | ||
<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="margin: 0; padding: 0"> | ||
<a class="navbar-brand" rel="home" href='#' title="OKSP">OKSP</a> | ||
</div> | ||
{% endblock bar %} | ||
|
||
{% block content %} | ||
<div class="jumbotron" style="background: black;"> | ||
<h1 style="text-align: center; color: white;">WSYIWYG Editor</h1> | ||
<hr/> | ||
<textarea name="editor1"></textarea> | ||
<script> | ||
CKEDITOR.replace( 'editor1' ); | ||
CKEDITOR.config.width = '100%'; | ||
CKEDITOR.config.height = 500; | ||
</script> | ||
<hr/> | ||
</div> | ||
|
||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. | ||
from .models import New, comment | ||
|
||
|
||
class NewsAdmin(admin.ModelAdmin): | ||
list_display = ['title'] | ||
list_display_links = ['title'] | ||
search_fields = ['title'] | ||
class Meta: | ||
model = New | ||
|
||
class CommentsAdmin(admin.ModelAdmin): | ||
list_display = ['text'] | ||
list_display_links = ['text'] | ||
search_fields = ['text'] | ||
class Meta: | ||
model = comment | ||
|
||
|
||
admin.site.register(New, NewsAdmin) | ||
admin.site.register(comment, CommentsAdmin) |
Oops, something went wrong.