Fix some bugs.
parent
a0ae95da64
commit
6071307c6a
|
@ -76,7 +76,7 @@
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('div.modal a.close').click(function() {
|
$('section.main').on('click', 'a.close', function() {
|
||||||
$(this).parent().parent().modal('hide');
|
$(this).parent().parent().modal('hide');
|
||||||
window.ui_halted = false;
|
window.ui_halted = false;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
window.$selected = false;
|
window.$selected = false;
|
||||||
},
|
},
|
||||||
detail: function() {
|
detail: function() {
|
||||||
window.location = this.model.get('get_absolute_url');
|
window.location = this.model.get('absolute_url');
|
||||||
},
|
},
|
||||||
edit: function() {
|
edit: function() {
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@
|
||||||
created: $created.attr('title'),
|
created: $created.attr('title'),
|
||||||
created_formatted: $created.text(),
|
created_formatted: $created.text(),
|
||||||
embed_url: $('div.embed-url', $el).text(),
|
embed_url: $('div.embed-url', $el).text(),
|
||||||
get_absolute_url: $h1.attr('href'),
|
absolute_url: $h1.attr('href'),
|
||||||
id: parseInt($el.attr('id').replace('snipt-', ''), 0),
|
id: parseInt($el.attr('id').replace('snipt-', ''), 0),
|
||||||
key: $('div.key', $el).text(),
|
key: $('div.key', $el).text(),
|
||||||
lexer: $('div.lexer', $el).text(),
|
lexer: $('div.lexer', $el).text(),
|
||||||
|
@ -350,7 +350,7 @@
|
||||||
tags_list: $('div.tags-list', $el).text(),
|
tags_list: $('div.tags-list', $el).text(),
|
||||||
title: $h1.text(),
|
title: $h1.text(),
|
||||||
user: {
|
user: {
|
||||||
get_absolute_url: $user.attr('href'),
|
absolute_url: $user.attr('href'),
|
||||||
username: $user.text()
|
username: $user.text()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -376,6 +376,7 @@
|
||||||
title: '',
|
title: '',
|
||||||
lexer: 'text',
|
lexer: 'text',
|
||||||
lexer_name: 'Text only',
|
lexer_name: 'Text only',
|
||||||
|
new_from_js: true,
|
||||||
user: {
|
user: {
|
||||||
username: ''
|
username: ''
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ class PublicSniptResource(ModelResource):
|
||||||
class Meta:
|
class Meta:
|
||||||
queryset = Snipt.objects.filter(public=True).order_by('-created')
|
queryset = Snipt.objects.filter(public=True).order_by('-created')
|
||||||
resource_name = 'snipt'
|
resource_name = 'snipt'
|
||||||
fields = ['title', 'slug', 'lexer', 'code', 'line_count',
|
fields = ['id', 'title', 'slug', 'lexer', 'code', 'line_count',
|
||||||
'stylized', 'created', 'modified',]
|
'stylized', 'created', 'modified',]
|
||||||
include_absolute_url = True
|
include_absolute_url = True
|
||||||
allowed_methods = ['get']
|
allowed_methods = ['get']
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<header>
|
<header>
|
||||||
<h2><%= snipt.lexer_name %></h2>
|
<h2><%= snipt.lexer_name %></h2>
|
||||||
<h1><a href="<%= snipt.get_absolute_url %>"><%= snipt.title %></a></h1>
|
<h1><a href="<%= snipt.absolute_url %>"><%= snipt.title %></a></h1>
|
||||||
</header>
|
</header>
|
||||||
<section class="code autumn">
|
<section class="code autumn">
|
||||||
<%= snipt.stylized %>
|
<%= snipt.stylized %>
|
||||||
|
@ -51,9 +51,11 @@
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<ul class="attrs">
|
<ul class="attrs">
|
||||||
<li class="author"><a href="<%= snipt.user.get_absolute_url %>"><%= snipt.user.username %></a></li>
|
<li class="author"><a href="<%= snipt.user.absolute_url %>"><%= snipt.user.username %></a></li>
|
||||||
<li class="created" title="<%= snipt.created %>"><%= snipt.created_formatted %></li>
|
<% if (!snipt.new_from_js) { %>
|
||||||
<li class="comments"><a href="<%= snipt.get_absolute_url %>#disqus_thread" data-disqus-identifier="<%= snipt.id %>"></a></li>
|
<li class="created" title="<%= snipt.created %>"><%= snipt.created_formatted %></li>
|
||||||
|
<% } %>
|
||||||
|
<li class="comments"><a href="<%= snipt.absolute_url %>#disqus_thread" data-disqus-identifier="<%= snipt.id %>"></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</footer>
|
</footer>
|
||||||
<div class="modal hide copy-modal">
|
<div class="modal hide copy-modal">
|
||||||
|
|
Loading…
Reference in New Issue