Ghetto search and favicon.
parent
78b534e27a
commit
37f2a2edb9
|
@ -936,6 +936,7 @@ jQuery(function($) {
|
|||
initialize: function(opts) {
|
||||
|
||||
this.$el = $(this.el);
|
||||
this.$search_form = $('form.search', this.$el);
|
||||
this.$search_query = $('input#search-query', this.$el);
|
||||
this.$snipts = $('section#snipts article.snipt', this.$el);
|
||||
this.$copyModals = $('div.copy-modal', this.$snipts);
|
||||
|
@ -954,17 +955,21 @@ jQuery(function($) {
|
|||
});
|
||||
}
|
||||
|
||||
this.$search_query.focus(function() {
|
||||
$search_query = this.$search_query;
|
||||
$search_query.focus(function() {
|
||||
if (window.$selected) {
|
||||
$selected.trigger('deselect');
|
||||
}
|
||||
});
|
||||
this.$search_form.submit(function() {
|
||||
window.location = 'https://www.google.com/search?q=' + $search_query.val() + ' site:snipt.net%20';
|
||||
return false;
|
||||
});
|
||||
|
||||
$('div.modal a.close').click(function() {
|
||||
$(this).parent().parent().modal('hide');
|
||||
return false;
|
||||
});
|
||||
|
||||
},
|
||||
events: {
|
||||
'showKeyboardShortcuts': 'showKeyboardShortcuts'
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 1.1 KiB |
|
@ -9,6 +9,7 @@
|
|||
initialize: function(opts) {
|
||||
|
||||
this.$el = $(this.el);
|
||||
this.$search_form = $('form.search', this.$el);
|
||||
this.$search_query = $('input#search-query', this.$el);
|
||||
this.$snipts = $('section#snipts article.snipt', this.$el);
|
||||
this.$copyModals = $('div.copy-modal', this.$snipts);
|
||||
|
@ -27,17 +28,21 @@
|
|||
});
|
||||
}
|
||||
|
||||
this.$search_query.focus(function() {
|
||||
$search_query = this.$search_query;
|
||||
$search_query.focus(function() {
|
||||
if (window.$selected) {
|
||||
$selected.trigger('deselect');
|
||||
}
|
||||
});
|
||||
this.$search_form.submit(function() {
|
||||
window.location = 'https://www.google.com/search?q=' + $search_query.val() + ' site:snipt.net%20';
|
||||
return false;
|
||||
});
|
||||
|
||||
$('div.modal a.close').click(function() {
|
||||
$(this).parent().parent().modal('hide');
|
||||
return false;
|
||||
});
|
||||
|
||||
},
|
||||
events: {
|
||||
'showKeyboardShortcuts': 'showKeyboardShortcuts'
|
||||
|
|
|
@ -18,6 +18,7 @@ def i():
|
|||
users()
|
||||
create_api_keys()
|
||||
snipts()
|
||||
favs()
|
||||
|
||||
def users():
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class SniptAdmin(admin.ModelAdmin):
|
|||
admin.site.register(Snipt, SniptAdmin)
|
||||
|
||||
class FavoriteAdmin(admin.ModelAdmin):
|
||||
#readonly_fields = ('snipt', 'user',)
|
||||
readonly_fields = ('snipt', 'user',)
|
||||
list_display = ('snipt', 'user',)
|
||||
search_fields = ('snipt', 'user',)
|
||||
ordering = ('-created',)
|
||||
|
|
|
@ -44,7 +44,7 @@ class Snipt(models.Model):
|
|||
self.key = md5.new(self.slug).hexdigest()
|
||||
|
||||
if not self.slug:
|
||||
self.slug = slugify_uniquely(self.title)
|
||||
self.slug = slugify_uniquely(self.title, Snipt)
|
||||
|
||||
self.stylized = highlight(self.code,
|
||||
get_lexer_by_name(self.lexer, encoding='UTF-8'),
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<link rel="stylesheet" href="{{ STATIC_URL }}css/bootstrap.css" />
|
||||
<link rel="stylesheet" href="{{ STATIC_URL }}css/style.css" />
|
||||
<link rel="stylesheet" href="{{ STATIC_URL }}css/themes.css" />
|
||||
<link rel="icon" href="/media/images/favicon.ico">
|
||||
|
||||
<script type="text/javascript" src="{{ STATIC_URL }}js/libs/a_underscore.js"></script>
|
||||
<script type="text/javascript" src="{{ STATIC_URL }}js/libs/b_jquery.js"></script>
|
||||
|
@ -44,7 +45,7 @@
|
|||
<div class="inner">
|
||||
<div class="shadey"></div>
|
||||
<h1><a href="/">Snipt</a></h1>
|
||||
<form class="search" action="/public/search/" method="get">
|
||||
<form class="search" action="" method="get">
|
||||
<fieldset>
|
||||
<div class="fields infield">
|
||||
<label for="search-query">Search public snipts</label>
|
||||
|
|
Loading…
Reference in New Issue