Skip to content

Commit

Permalink
History mode for package detail page
Browse files Browse the repository at this point in the history
  • Loading branch information
Lessica committed Apr 6, 2018
1 parent 5849e56 commit e3d1f93
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 30 deletions.
9 changes: 6 additions & 3 deletions WEIPDCRM/styles/DefaultStyle/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ body {
}

.container .content .list .chart-item .download {
float: right
float: right;
user-select: none;
}

.container .content .list .chart-item .download a {
Expand Down Expand Up @@ -449,7 +450,8 @@ body {

.container .content .article .download {
float: right;
text-align: center
text-align: center;
user-select: none;
}

.container .content .article .download a {
Expand Down Expand Up @@ -1089,14 +1091,15 @@ body {
margin: 30px auto -30px;
width: 960px;
min-height: 10px;
text-align: center
text-align: center;
}

.container .content .contact .card .card-wrapper {
margin-top: 15px;
width: 100%;
overflow: auto;
overflow-y: hidden;
user-select: none;
-webkit-overflow-scrolling: touch;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</div>
<div class="clear"></div>
<p>{{ version.update_logs | linebreaksbr }}</p>
<a target="_blank" href="{% url "package_id" version.id %}">
<a target="_blank" href="{% url "package_id" version.id %}?history=1">
{% trans "View this version" %} <i class="fa fa-angle-right" aria-hidden="true"></i>
</a>
</div>
Expand Down
87 changes: 61 additions & 26 deletions WEIPDCRM/styles/DefaultStyle/templates/package/package.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
<i class="fa fa-angle-right"></i>
<a href="{% url "section_id" package_info.c_section.id %}">{{ package_info.c_section }}</a>
{% endif %}
<i class="fa fa-angle-right"></i> <a href="{{ package_info.get_absolute_url }}">{{ package_info.c_name | default:_("Untitled Package") }}</a>
<i class="fa fa-angle-right"></i>
<a href="{{ package_info.get_absolute_url }}">{{ package_info.c_name | default:_("Untitled Package") }}</a>
{% endblock %}
{% block content %}
<div class="article">
Expand All @@ -37,7 +38,9 @@
{% endif %}
<li>{% trans "Size" %}: {{ package_info.c_size|filesizeformat }}</li>
{% if package_info.author_name %}
<li>{% trans "Author" %}: <a href="{% url "package_action" package_info.id "contact" %}">{{ package_info.author_name }}</a></li>
<li>{% trans "Author" %}: <a
href="{% url "package_action" package_info.id "contact" %}">{{ package_info.author_name }}</a>
</li>
{% endif %}
</ul>
<div class="clear"></div>
Expand All @@ -62,10 +65,10 @@
<div class="clear"></div>
<div class="description">
<label>
<h2>{% trans "Description" %}</h2>
{% if package_info.c_homepage %}
<a target="_blank" href="{{ package_info.c_homepage }}">{% trans "More Info" %}</a>
{% endif %}
<h2>{% trans "Description" %}</h2>
{% if package_info.c_homepage %}
<a target="_blank" href="{{ package_info.c_homepage }}">{% trans "More Info" %}</a>
{% endif %}
</label>
<div class="clear"></div>
<p>
Expand All @@ -83,12 +86,13 @@ <h2>{% trans "Description" %}</h2>
<div class="clear"></div>
<div class="whatsnew">
<label>
<h2>{% trans "What's New" %}</h2>
{% if settings.version_history %}
<a href="{% url "package_action" package_info.id "history" %}">{% trans "History" %}</a>
{% endif %}
<h2>{% trans "What's New" %}</h2>
{% if settings.version_history %}
<a href="{% url "package_action" package_info.id "history" %}">{% trans "History" %}</a>
{% endif %}
</label>
<div class="version"><p>{% trans "Version" %}: {{ package_info.c_version }}</p><span>{{ package_info.created_at | date:"Y-m-d H:i" }}</span></div>
<div class="version"><p>{% trans "Version" %}: {{ package_info.c_version }}</p>
<span>{{ package_info.created_at | date:"Y-m-d H:i" }}</span></div>
<p>
{{ package_info.update_logs | linebreaksbr }}
</p>
Expand All @@ -106,7 +110,9 @@ <h2>{% trans "Screenshot" %}</h2>
<ul>
{% for photo in gallery.public %}
<li>
<a data-fancybox="images" data-caption="{{ package_info.c_name | default:_("Untitled Package") }}" href="{{ photo.get_display_url }}">
<a data-fancybox="images"
data-caption="{{ package_info.c_name | default:_("Untitled Package") }}"
href="{{ photo.get_display_url }}">
<img src="{{ photo.get_display_url }}" alt="{{ photo.title }}">
</a>
</li>
Expand Down Expand Up @@ -142,7 +148,7 @@ <h2>{% trans "Comments" %}</h2>
<script type="application/javascript" src="{% static 'js/jquery.fancybox.min.js' %}"></script>
<script type="text/javascript">
function nice() {
if ($(window).width() <= 985 && 482 <=$(window).width()) {
if ($(window).width() <= 985 && 482 <= $(window).width()) {
$('.image').css('width', '100%');
}
else if ($(window).width() <= 482) {
Expand All @@ -164,22 +170,51 @@ <h2>{% trans "Comments" %}</h2>
nice();

// In Cydia
if (navigator.userAgent.search(/Cydia/) !== -1)
{
if (navigator.userAgent.search(/Cydia/) !== -1) {
function parse_query_string(query) {
var vars = query.split("&");
var query_string = {};
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
// If first entry with this name
if (typeof query_string[pair[0]] === "undefined") {
query_string[pair[0]] = decodeURIComponent(pair[1]);
// If second entry with this name
} else if (typeof query_string[pair[0]] === "string") {
query_string[pair[0]] = [query_string[pair[0]], decodeURIComponent(pair[1])];
// If third or later entry with this name
} else {
query_string[pair[0]].push(decodeURIComponent(pair[1]));
}
}
return query_string;
}

var query = window.location.search.substring(1);
var qs = parse_query_string(query);
var history_mode = false;
if (typeof(qs.history) === "string" && qs.history === "1") {
history_mode = true;
}

$('a').attr("target", "_blank");
$('.main').addClass("bg-cydia");
$('.footer').remove();
$('.breadcrumbs').remove();
var $widget = $('.widget-area');
if ($widget.children().length) {
$widget.css("margin", "auto");
$widget.css("padding", "0");
} else {
$widget.remove();

if (!history_mode) {
$('.footer').remove();
$('.breadcrumbs').remove();
var $widget = $('.widget-area');
if ($widget.children().length) {
$widget.css("margin", "auto");
$widget.css("padding", "0");
} else {
$widget.remove();
}
$('.icon').remove();
$('.title').remove();
$('.intro').remove();
}
$('.icon').remove();
$('.title').remove();
$('.intro').remove();

}

// Comments
Expand Down

0 comments on commit e3d1f93

Please sign in to comment.