Commit 4c21dfbc by Bridger Maxwell

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

parents a2b19322 ca27804e
section.wiki {
padding-top: 25px;
header {
> header {
height: 33px;
margin-bottom: 36px;
padding-bottom: 26px;
......@@ -406,6 +406,7 @@ section.wiki {
letter-spacing: 0 !important;
&:hover {
color: $base-font-color;
text-decoration: none;
}
......@@ -436,6 +437,44 @@ section.wiki {
margin-left: -480px;
top: 150px;
&.upload-modal,
&.search-file-modal {
width: 400px;
min-height: 0;
margin-left: -200px;
h4 {
margin-bottom: 20px;
font-weight: bold;
}
.help-block {
font-size: 0.8em;
}
}
&.search-file-modal {
width: 500px;
margin-left: -250px;
p {
font-size: 0.8em;
line-height: 1.4em;
}
.form-search {
margin: 30px 0 15px;
input {
width: 350px;
}
button {
height: 35px;
}
}
}
.modal-header {
h1, p {
color: #fff;
......@@ -472,10 +511,17 @@ section.wiki {
}
}
.modal-inner-wrapper {
background: #fff;
padding: 20px;
}
#previewWindow body {
background: #f00 !important;
}
......@@ -544,6 +590,41 @@ section.wiki {
/*-----------------
Settings
-----------------*/
#settings_form {
.well {
margin-bottom: 15px;
@include clearfix;
}
.control-group {
float: left;
margin-bottom: 0;
clear: both;
}
label {
margin-left: 15px;
}
.controls {
padding-top: 4px;
}
label,
.controls {
float: right;
}
}
/*-----------------
New
-----------------*/
......@@ -568,6 +649,71 @@ section.wiki {
/*-----------------
Attachments
-----------------*/
.attachment-options {
height: 40px;
margin: 40px 0 30px;
}
.attachment-list {
ul {
list-style: none;
padding: 0;
}
li {
margin-bottom: 15px;
border: 1px solid #DDD;
background: #F9F9F9;
@include border-radius(5px);
}
header,
.attachment-details {
padding: 12px 15px;
}
.attachment-details {
background: #eee;
@include border-radius(0 0 5px 5px);
}
h3 {
a {
font-weight: bold;
font-size: 0.9em;
}
.badge {
float: right;
font-size: 0.6em;
line-height: 20px;
color: #aaa;
}
}
.attachment-description {
font-size: 0.8em;
}
table {
width: 100%;
font-size: 0.8em;
}
.attachment-actions .btn {
float: right;
}
}
/*-----------------
......
......@@ -13,6 +13,7 @@
{% 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 %}">
......
......@@ -7,14 +7,41 @@
{% block wiki_contents_tab %}
<div class="row-fluid">
{% if article|can_write:user %}
<div class="attachment-options">
<a class="btn" href="#" id="upload-file-btn">
<span class="icon-upload"></span>{% trans "Upload new file" %}
</a>
<a class="btn" href="#" id="search-for-file-btn">
<span class="icon-plus-sign"></span>{% trans "Search and add file" %}
</a>
</div>
<a class="btn" href="#" id="upload-file-btn">
<span class="icon-upload"></span>{% trans "Upload new file" %}
</a>
<div class="modal upload-modal hide fade" id="upload-modal">
<div class="modal-inner-wrapper">
<h4>Upload File</h4>
<form method="POST" class="form-vertical" id="attachment_form" enctype="multipart/form-data">
{% wiki_form form %}
<button type="submit" name="save" value="1" class="btn btn-primary">
{% trans "Upload file" %}
</button>
</form>
</div>
</div>
<div class="modal search-file-modal hide fade" id="search-file-modal">
<div class="modal-inner-wrapper">
<h4>Search files and articles</h4>
<p>{% trans "You can reuse files from other articles. These files are subject to updates on other articles which may or may not be a good thing." %}</p>
<form method="GET" action="{% url 'wiki:attachments_search' path=urlpath.path article_id=article.id %}" class="form-search">
{{ search_form.query }}
<button class="btn btn-primary">
{% trans "Search" %}
</button>
</form>
</div>
</div>
<script type="text/javascript">
$('#upload-file-btn').bind('click', function(e) {
......@@ -24,139 +51,79 @@
$('#upload-modal').modal('show');
{% endif %}
});
</script>
<div class="modal hide fade" id="upload-modal">
{% if anonymous_disallowed %}
{% include "wiki/includes/anonymous_blocked.html" %}
{% else %}
<form method="POST" class="form-vertical" id="attachment_form" enctype="multipart/form-data">
{% wiki_form form %}
<button type="submit" name="save" value="1" class="btn btn-large">
{% trans "Upload file" %}
</button>
</form>
{% endif %}
</div>
<div class="span5" style="min-width: 330px;">
<div class="accordion" id="accordion_upload">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle btn" href="#collapse_upload" data-toggle="collapse">
<span class="icon-upload"></span>{% trans "Upload new file" %}
</a>
</div>
<div id="collapse_upload" class="accordion-body collapse{% if form.errors %} in{% endif %}">
<div class="accordion-inner">
{% if anonymous_disallowed %}
{% include "wiki/includes/anonymous_blocked.html" %}
{% else %}
<form method="POST" class="form-vertical" id="attachment_form" enctype="multipart/form-data">
{% wiki_form form %}
<button type="submit" name="save" value="1" class="btn btn-large">
{% trans "Upload file" %}
</button>
</form>
{% endif %}
</div>
</div>
</div>
</div>
<div class="accordion" id="accordion_add">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle btn" href="#collapse_add" data-toggle="collapse">
<span class="icon-plus-sign"></span>{% trans "Search and add file" %}
</a>
</div>
<div id="collapse_add" class="accordion-body collapse">
<div class="accordion-inner">
<p>{% trans "You can reuse files from other articles. These files are subject to updates on other articles which may or may not be a good thing." %}</p>
<form method="GET" action="{% url 'wiki:attachments_search' path=urlpath.path article_id=article.id %}" class="form-search">
{{ search_form.query }}
<button class="btn btn-large">
{% trans "Search files and articles" %}
</button>
</form>
</div>
</div>
</div>
</div>
</div>
$('#search-for-file-btn').bind('click', function(e) {
$('#search-file-modal').modal('show');
});
</script>
{% endif %}
<div class="span7">
<p class="lead">{% trans "The following files are available for this article. Copy the markdown tag to directly refer to a file from the article text." %}</p>
{% for attachment in attachments %}
<table class="table table-bordered table-striped" style="width: 100%;">
<tr>
<td colspan="4">
<h3>
<a href="{% url 'wiki:attachments_download' path=urlpath.path article_id=article.id attachment_id=attachment.id %}">{{ attachment.current_revision.get_filename }}</a>
<span class="badge">{{ attachment.current_revision.created|naturaltime }}</span>
{% if attachment.current_revision.deleted %}
<span class="badge badge-important">{% trans "deleted" %}</span>
{% endif %}
</h3>
{{ attachment.current_revision.description }}
</td>
</tr>
<tr>
<th>{% trans "Markdown tag" %}</th>
<th>{% trans "Uploaded by" %}</th>
<th>{% trans "Size" %}</th>
<td style="text-align: right;" rowspan="2">
{% if attachment|can_write:user %}
<p>
{% if not attachment.current_revision.deleted %}
<a href="{% url 'wiki:attachments_replace' path=urlpath.path article_id=article.id attachment_id=attachment.id %}" class="btn">{% trans "Replace" %}</a>
{% if attachment.article = article %}
<a href="{% url 'wiki:attachments_delete' path=urlpath.path article_id=article.id attachment_id=attachment.id %}" class="btn">{% trans "Delete" %}</a>
{% else %}
<a href="{% url 'wiki:attachments_delete' path=urlpath.path article_id=article.id attachment_id=attachment.id %}" class="btn">{% trans "Detach" %}</a>
{% endif %}
{% else %}
{% if attachment.current_revision.previous_revision.id %}
<form method="POST" action="{% url 'wiki:attachments_revision_change' path=urlpath.path article_id=article.id attachment_id=attachment.id revision_id=attachment.current_revision.previous_revision.id %}">
{% csrf_token %}
<button class="btn">
{% trans "Restore" %}
</button>
</form>
<div class="attachment-list">
<!--<p class="lead">{% trans "The following files are available for this article. Copy the markdown tag to directly refer to a file from the article text." %}</p>-->
<ul>
{% for attachment in attachments %}
<li>
<header>
<h3>
<a href="{% url 'wiki:attachments_download' path=urlpath.path article_id=article.id attachment_id=attachment.id %}">{{ attachment.current_revision.get_filename }}</a>
<span class="badge">{{ attachment.current_revision.created|naturaltime }}</span>
{% if attachment.current_revision.deleted %}
<span class="badge badge-important">{% trans "deleted" %}</span>
{% endif %}
{% endif %}
</h3>
<p class="attachment-description">
{{ attachment.current_revision.description }}
</p>
{% endif %}
<p>
<a href="{% url 'wiki:attachments_history' path=urlpath.path article_id=article.id attachment_id=attachment.id %}">
<span class="icon-time"></span>
{% trans "File history" %} ({{ attachment.attachmentrevision_set.all.count }} {% trans "revisions" %})
</a>
</p>
</td>
</tr>
<tr>
<td><code>[attachment:{{ attachment.id }}]</code></td>
<td>
{% if attachment.current_revision.user %}{{ attachment.current_revision.user }}{% else %}{% if user|is_moderator %}{{ attachment.current_revision.ip_address|default:"anonymous (IP not logged)" }}{% else %}{% trans "anonymous (IP logged)" %}{% endif %}{% endif %}
</td>
<td>{{ attachment.current_revision.get_size|filesizeformat }}</td>
</tr>
</table>
{% empty %}
<p style="margin-bottom: 20px;"><em>{% trans "There are no attachments for this article." %}</em></p>
{% endfor %}
</header>
<div class="attachment-details">
<table>
<tr>
<th>{% trans "Markdown tag" %}</th>
<th>{% trans "Uploaded by" %}</th>
<th>{% trans "Size" %}</th>
<th>{% trans "File History" %}</th>
<td class="attachment-actions">
{% if attachment|can_write:user %}
{% if not attachment.current_revision.deleted %}
{% if attachment.article = article %}
<a href="{% url 'wiki:attachments_delete' path=urlpath.path article_id=article.id attachment_id=attachment.id %}" class="btn btn-danger">{% trans "Delete" %}</a>
{% else %}
<a href="{% url 'wiki:attachments_delete' path=urlpath.path article_id=article.id attachment_id=attachment.id %}" class="btn">{% trans "Detach" %}</a>
{% endif %}
<a href="{% url 'wiki:attachments_replace' path=urlpath.path article_id=article.id attachment_id=attachment.id %}" class="btn">{% trans "Replace" %}</a>
{% else %}
{% if attachment.current_revision.previous_revision.id %}
<form method="POST" action="{% url 'wiki:attachments_revision_change' path=urlpath.path article_id=article.id attachment_id=attachment.id revision_id=attachment.current_revision.previous_revision.id %}">
{% csrf_token %}
<button class="btn">
{% trans "Restore" %}
</button>
</form>
{% endif %}
{% endif %}
{% endif %}
</td>
</tr>
<tr>
<td><code>[attachment:{{ attachment.id }}]</code></td>
<td>
{% if attachment.current_revision.user %}{{ attachment.current_revision.user }}{% else %}{% if user|is_moderator %}{{ attachment.current_revision.ip_address|default:"anonymous (IP not logged)" }}{% else %}{% trans "anonymous (IP logged)" %}{% endif %}{% endif %}
</td>
<td>{{ attachment.current_revision.get_size|filesizeformat }}</td>
<td>{{ attachment.attachmentrevision_set.all.count }} {% trans "revisions" %}</td>
</tr>
</table>
</div>
</li>
{% empty %}
<p style="margin-bottom: 20px;"><em>{% trans "There are no attachments for this article." %}</em></p>
{% endfor %}
</ul>
</div>
......
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