Commit 8595cb24 by Bridger Maxwell

Merge branch 'feature/bridger/new_wiki' of github.com:MITx/mitx into feature/bridger/new_wiki

Conflicts:
	lms/templates/wiki/base.html
parents 6b716c28 ad45a44a
......@@ -359,9 +359,17 @@ section.wiki {
display: none;
}
button {
font-family: $sans-serif;
}
.btn {
@include button(simple, #eee);
font-size: 0.8em;
margin-right: 5px;
line-height: 1.2em;
text-transform: none !important;
letter-spacing: 0 !important;
&:hover {
text-decoration: none;
......@@ -376,14 +384,40 @@ section.wiki {
@include button(simple, $pink);
font-size: 0.8em;
}
&.btn-info {
@include button(simple, #ccc);
font-size: 0.8em;
}
}
a.btn {
padding: 7px 18px 8px !important;
}
#previewModal {
.modal {
width: 960px;
z-index: 9999;
min-height: 500px;
margin-left: -480px;
top: 200px;
top: 150px;
.modal-header {
h1, p {
color: #fff;
}
h1 {
margin: 3px 12px 8px;
font-size: 1.1em;
}
p {
font-size: 0.9em;
margin: 5px 12px 20px;
line-height: 1em;
}
}
.modal-body {
padding-bottom: 8px;
......@@ -395,6 +429,10 @@ section.wiki {
border: 0;
}
.modal-footer {
margin: 12px;
}
.modal-footer .btn {
margin-right: 10px;
}
......@@ -421,14 +459,71 @@ section.wiki {
border: 1px solid $light-gray;
background: #f9f9f9;
border-radius: 5px;
a:hover {
text-decoration: none;
}
}
}
.collapse {
display: none;
.collapse {
display: none;
&.in {
display: block;
}
&.in {
display: block;
}
}
/*-----------------
New
-----------------*/
.new-article {
margin: auto;
float: none;
.add-on {
line-height: 34px;
margin-right: 6px;
}
}
#hint_id_slug {
display: inline-block;
font-size: 0.9em;
line-height: 1.3em;
margin-top: 9px;
}
/*-----------------
Delete
-----------------*/
#div_id_confirm {
position: relative;
height: 30px;
margin: 40px 0;
#id_confirm {
position: absolute;
top: 6px;
}
label {
position: absolute;
left: 25px;
font-size: 1.4em;
}
}
......
......@@ -6,7 +6,28 @@
{% block headextra %}
{% compressed_css 'course' %}
<script src="{% static "js/bootstrap-modal.js" %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script type="text/javascript">
function ajaxError(){}
$.ajaxSetup({
timeout: 7000,
cache: false,
error: function(e, xhr, settings, exception) {
ajaxError();
}
});
function jsonWrapper(url, callback) {
$.getJSON(url, function(data) {
if (data == null) {
ajaxError();
} else {
callback(data);
}
});
}
</script>
{% endblock %}
......
{% extends "wiki/base.html" %}
{% load wiki_tags i18n sekizai_tags %}
{% load url from future %}
{% block pagetitle %}{% trans "Add new article" %}{% endblock %}
{% block wiki_contents %}
{% addtoblock "js" %}
<script type="text/javascript" src="{{ STATIC_URL }}admin/js/urlify.js "></script>
<script type="text/javascript">
//<![CDATA[
(function($) {
$(document).ready(function (){
$("#id_title").keyup(function () {
var e = $("#id_slug")[0];
if(!e._changed) {
e.value = URLify(this.value, 64);
}
});
});
})(jQuery);
//]]>
</script>
{% endaddtoblock %}
<article class="main-article new-article">
{% include "wiki/includes/editormedia.html" %}
<h1 class="page-header">{% trans "Add new article" %}</h1>
<form method="POST" class="form-horizontal">
{% wiki_form create_form %}
<div class="form-actions">
<a href="{% url 'wiki:get' path=parent_urlpath.path %}" class="btn btn-large">
<span class="icon-circle-arrow-left"></span>
{% trans "Go back" %}
</a>
<button type="submit" name="save_changes" class="btn btn-primary btn-large">
<span class="icon-plus"></span>
{% trans "Create article" %}
</button>
</div>
</form>
</article>
{% endblock %}
{% extends "wiki/base.html" %}
{% load wiki_tags i18n sekizai_tags %}
{% load url from future %}
{% block pagetitle %}{% trans "Delete article" %}{% endblock %}
{% block wiki_contents %}
<h1 class="page-header">{% trans "Delete" %} "{{ article.current_revision.title }}"</h1>
{% if cannot_delete_root %}
<p class="lead">{% trans "You cannot delete a root article." %}</p>
<p><a href="{% url 'wiki:get' path=urlpath.path article_id=article.id %}">{% trans "Go back" %}</a></p>
{% else %}
{% if cannot_delete_children %}
<p class="alert alert-error"><strong>{% trans "You cannot delete this article because you do not have permission to delete articles with children. Try to remove the children manually one-by-one." %}</strong></p>
{% endif %}
{% if delete_children %}
<p class="lead">{% trans "You are deleting an article. This means that its children will be deleted as well. If you choose to purge, children will also be purged!" %}</p>
<h2>{% trans "Articles that will be deleted" %}</h2>
<ul>
{% for child in delete_children %}
<li><a href="{% url 'wiki:get' article_id=child.article.id %}" target="_blank">{{ child.article }}</a></li>
{% if delete_children_more %}
<li><em>{% trans "...and more!" %}</em></li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
{% if not cannot_delete_children %}
<p class="lead">{% trans "You are deleting an article. Please confirm." %}</p>
<form method="POST" class="form-horizontal">
{% wiki_form delete_form %}
<script type="text/javascript">
$('#id_revision').val('{{ article.current_revision.id }}');
</script>
<div class="form-actions">
<a href="{% url 'wiki:get' path=urlpath.path article_id=article.id %}" class="btn btn-large">
<span class="icon-circle-arrow-left"></span>
{% trans "Go back" %}
</a>
<button type="submit" name="save_changes" class="btn btn-danger btn-large">
<span class="icon-plus"></span>
{% trans "Delete article" %}
</button>
</div>
</form>
{% endif %}
{% endif %}
{% endblock %}
{% extends "wiki/article.html" %}
{% load wiki_tags i18n sekizai_tags %}
{% load url from future %}
{% block pagetitle %}{% trans "History" %}: {{ article.current_revision.title }}{% endblock %}
{% block wiki_contents_tab %}
{% addtoblock "js" %}
<script type="text/javascript" src="{{ STATIC_URL }}wiki/js/diffview.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}wiki/js/diff.js"></script>
<script type="text/javascript">
$(document).ready(
function() {
$('.accordion input[disabled!="disabled"][type="radio"]').first().attr('checked', 'true');
// Fix modal heights
// $('.modal-body').css('height', $(window).height()*0.70 + 'px');
// $('.modal').css('max-height', $(window).height() + 'px');
});
</script>
{% endaddtoblock %}
{% addtoblock "css" %}
<style type="text/css">
td.linenumber {
width: 20px;
}
tr.insert td {
background-color: #DFC;
}
tr.delete td {
background-color: #FDC;
}
tr.equal td {
background-color: #F2F2F2;
}
.diff-container td {
white-space: pre; font-family: monospace;
}
.diff-container td,
.diff-container th {
padding: 2px 7px;
border-right: 1px solid #DDD;
}
.diff-container td:last-child,
.diff-container th:last-child {
border-right: none;
}
.diff-container table {
border-top: 1px solid #DDD;
}
</style>
{% endaddtoblock %}
<form method="GET">
<div class="tab-content" style="overflow: visible;">
{% for revision in revisions %}
<div class="accordion" id="accordion{{ revision.revision_number }}">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" style="float: left;" href="#collapse{{ revision.revision_number }}" onclick="get_diff_json('{% url 'wiki:diff' revision.id %}', $('#collapse{{ revision.revision_number }}'))">
{{ revision.created }} (#{{ revision.revision_number }}) by {% if revision.user %}{{ revision.user }}{% else %}{% if user|is_moderator %}{{ revision.ip_address|default:"anonymous (IP not logged)" }}{% else %}{% trans "anonymous (IP logged)" %}{% endif %}{% endif %}
{% if revision == article.current_revision %}
<strong>*</strong>
{% endif %}
{% if revision.deleted %}
<span class="badge badge-important">{% trans "deleted" %}</span>
{% endif %}
{% if revision.previous_revision.deleted and not revision.deleted %}
<span class="badge badge-success">{% trans "restored" %}</span>
{% endif %}
<div style="color: #CCC;">
<small>
{% if revision.user_message %}
{{ revision.user_message }}
{% else %}
({% trans "no log message" %})
{% endif %}
</small>
</div>
</a>
<div class="progress progress-striped active" style="display: none; width: 40px; float: left; margin-top: 7px; margin-bottom: -7px;">
<div class="bar" style="width: 100%;"></div>
</div>
<div class="pull-right" style="vertical-align: middle; margin: 8px 3px;">
{% if revision == article.current_revision %}
<a href="#" class="btn disabled">
<span class="icon-lock"></span>
{% trans "Preview this version" %}
</a>
{% else %}
<button type="submit" class="btn" onclick="$('#previewModal').modal('show'); this.form.target='previewWindow'; this.form.r.value='{{ revision.id }}'; this.form.action='{% url 'wiki:preview_revision' article.id %}'; $('#previewModal .switch-to-revision').attr('href', '{% url 'wiki:change_revision' path=urlpath.path article_id=article.id revision_id=revision.id %}')">
<span class="icon-eye-open"></span>
{% trans "Preview this version" %}
</button>
{% endif %}
<a class="btn btn-info" href="#collapse{{ revision.revision_number }}" onclick="get_diff_json('{% url 'wiki:diff' revision_id=revision.id %}', $('#collapse{{ revision.revision_number }}'))">
<span class="icon-list-alt"></span>
{% trans "Show changes" %}
</a>
{% if article|can_write:user %}
<input type="radio"{% if revision == article.current_revision %} disabled="true"{% endif %} style="margin: 0 10px;" value="{{ revision.id }}" name="revision_id" switch-button-href="{% url 'wiki:change_revision' path=urlpath.path revision_id=revision.id %}" merge-button-href="{% url 'wiki:merge_revision_preview' article_id=article.id revision_id=revision.id %}" merge-button-commit-href="{% url 'wiki:merge_revision' path=urlpath.path article_id=article.id revision_id=revision.id %}" />
{% endif %}
</div>
<div style="clear: both"></div>
</div>
<div id="collapse{{ revision.revision_number }}" class="accordion-body collapse">
<div class="accordion-inner diff-container" style="padding: 0;">
<dl class="dl-horizontal">
<dt>{% trans "Auto log:" %}</dt>
<dd>{{ revision.automatic_log|default:"-"|linebreaksbr }}</dd>
</dl>
<table class="table table-condensed" style="margin: 0; border-collapse: collapse;">
<thead>
<tr>
<th class="linenumber">{% if revision.previous_revision %}#{{revision.previous_revision.revision_number}}{% endif %}</th>
<th class="linenumber">#{{revision.revision_number}}</th>
<th>{% trans "Change" %}</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
{% endfor %}
{% include "wiki/includes/pagination.html" %}
{% if revisions.count > 1 %}
<div class="form-actions">
<div class="pull-right">
{% if article|can_write:user %}
<button type="submit" name="preview" value="1" class="btn btn-large" onclick="$('#mergeModal').modal('show'); this.form.target='mergeWindow'; this.form.action=$('input[type=radio]:checked').attr('merge-button-href'); $('.merge-revision-commit').attr('href', $('input[type=radio]:checked').attr('merge-button-commit-href'))">
<span class="icon-random"></span>
{% trans "Merge selected with current..." %}
</button>
{% else %}
<button type="submit" disabled="true" name="preview" value="1" class="btn btn-large">
<span class="icon-lock"></span>
{% trans "Merge selected with current..." %}
</button>
{% endif %}
<button type="submit" name="save" value="1" class="btn btn-large btn-primary" onclick="$('#previewModal').modal('show'); this.form.target='previewWindow'; this.form.action=$('input[type=radio]:checked').attr('switch-button-href')">
<span class="icon-flag"></span>
{% trans "Switch to selected version" %}
</button>
</div>
</div>
{% endif %}
</div>
<input type="hidden" name="r" value="" />
<div class="modal hide fade" id="previewModal">
<div class="modal-body">
<iframe name="previewWindow" frameborder="0"></iframe>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-large" data-dismiss="modal">
<span class="icon-circle-arrow-left"></span>
{% trans "Back to history view" %}
</a>
{% if article|can_write:user %}
<a href="#" class="btn btn-large btn-primary switch-to-revision">
<span class="icon-flag"></span>
{% trans "Switch to this version" %}
</a>
{% else %}
<a href="#" class="btn btn-large btn-primary disabled">
<span class="icon-lock"></span>
{% trans "Switch to this version" %}
</a>
{% endif %}
</div>
</div>
<div class="modal hide fade" id="mergeModal">
<div class="modal-header">
<h1>{% trans "Merge with current" %}</h1>
<p class="lead"><span class="icon-info-sign"></span> {% trans "When you merge a revision with the current, all data will be retained from both versions and merged at its approximate location from each revision." %} <strong>{% trans "After this, it's important to do a manual review." %}</strong></p>
</div>
<div class="modal-body">
<iframe name="mergeWindow" frameborder="0"></iframe>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-large" data-dismiss="modal">
<span class="icon-circle-arrow-left"></span>
{% trans "Back to history view" %}
</a>
{% if article|can_write:user %}
<a href="#" class="btn btn-large btn-primary merge-revision-commit">
<span class="icon-file"></span>
{% trans "Create new merged version" %}
</a>
{% else %}
<a href="#" class="btn btn-large btn-primary disabled">
<span class="icon-lock"></span>
{% trans "Create new merged version" %}
</a>
{% endif %}
</div>
</div>
</form>
{% endblock %}
......@@ -11,7 +11,7 @@
</div>
<div>
<div >
<div>
{% for plugin in sidebar %}
<div class="accordion" id="accordion_{{ plugin.slug }}">
......
{% csrf_token %}
{% if form.non_field_errors %}
{% if form_error_title %}<h4 class="alert-heading">{{ form_error_title }}</h4>{% endif %}
{% for error_message in form.non_field_errors %}
<div class="alert alert-block alert-error">
{{ error_message }}
</div>
{% endfor %}
{% endif %}
{% for field in form %}
{% if field.is_hidden %}
{{ field }}
{% else %}
<div id="div_{{ field.auto_id }}" class="clearfix control-group{% if field.errors %} error{% endif %}">
{% if field.label %}
<label for="{{ field.id_for_label }}" class="control-label {% if field.field.required %}requiredField{% endif %}">
{{ field.label|safe }}
</label>
{% endif %}
<div class="controls">
{{ field }} {% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
{% if field.errors %}
{% for error in field.errors %}
<div id="error_{{ forloop.counter }}_{{ field.auto_id }}" class="help-block"><strong>{{ error }}</strong></div>
{% endfor %}
{% endif %}
{% if field.help_text %}
<p id="hint_{{ field.auto_id }}" class="help-block">{{ field.help_text|safe }}</p>
{% endif %}
</div>
</div>
{% endif %}
{% endfor %}
{% extends "wiki/base.html" %}
{% load wiki_tags i18n %}
{% load url from future %}
{% block pagetitle %}{% trans "Settings" %}: {{ article.current_revision.title }}{% endblock %}
{% block wiki_breadcrumbs %}
{% include "wiki/includes/breadcrumbs.html" %}
{% endblock %}
{% block wiki_contents %}
<div class="article-wrapper">
<article class="main-article">
{% if selected_tab != "edit" %}
<h1>{{ article.current_revision.title }}</h1>
{% endif %}
{% for form in forms %}
<form method="POST" class="form-horizontal" id="settings_form" action="?f={{form.action}}">
<h2>{{ form.settings_form_headline }}</h2>
<div class="well">
{% wiki_form form %}
</div>
<div class="form-actions">
<button type="submit" name="save" value="1" class="btn btn-large btn-primary">
<span class="icon-ok"></span>
{% trans "Save changes" %}
</button>
</div>
</form>
{% endfor %}
</article>
<div class="article-functions">
<div class="timestamp">
<span class="label">{% trans "Last modified:" %}</span><br />
<span class="date">{{ article.current_revision.modified }}</span>
</div>
<ul class="nav nav-tabs">
{% with "settings" as selected %}
{% include "wiki/includes/article_menu.html" %}
{% endwith %}
</ul>
</div>
</div>
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment