Merge pull request #558 from DakuTree/cleanup

Few small fixes/changes
This commit is contained in:
Shish 2016-06-19 13:59:31 +01:00 committed by GitHub
commit 6d47eb1d91
10 changed files with 94 additions and 55 deletions

View File

@ -12,6 +12,8 @@ env:
- DB=mysql - DB=mysql
- DB=pgsql - DB=pgsql
- DB=sqlite - DB=sqlite
allow_failures:
- DB=sqlite
cache: cache:
directories: directories:
@ -41,13 +43,15 @@ script:
after_failure: after_failure:
- head -n 100 data/config/* - head -n 100 data/config/*
- ls /var/run/mysql* - ls /var/run/mysql*
- ls /var/log/*mysql* # All of the below commands require sudo, which we can't use without losing some speed & caching.
- cat /var/log/mysql.err # SEE: https://docs.travis-ci.com/user/workers/container-based-infrastructure/
- cat /var/log/mysql.log # - ls /var/log/*mysql*
- cat /var/log/mysql/error.log # - cat /var/log/mysql.err
- cat /var/log/mysql/slow.log # - cat /var/log/mysql.log
- ls /var/log/postgresql # - cat /var/log/mysql/error.log
- cat /var/log/postgresql/postgresql* # - cat /var/log/mysql/slow.log
# - ls /var/log/postgresql
# - cat /var/log/postgresql/postgresql*
after_script: after_script:
- wget https://scrutinizer-ci.com/ocular.phar - wget https://scrutinizer-ci.com/ocular.phar

View File

@ -11,6 +11,8 @@
# Shimmie # Shimmie
[![Build Status](https://travis-ci.org/shish/shimmie2.svg?branch=master)](https://travis-ci.org/shish/shimmie2) [![Build Status](https://travis-ci.org/shish/shimmie2.svg?branch=master)](https://travis-ci.org/shish/shimmie2)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/shish/shimmie2/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/shish/shimmie2/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/shish/shimmie2/badges/coverage.png?b=develop)](https://scrutinizer-ci.com/g/shish/shimmie2/?branch=master)
This is the main branch of Shimmie, if you know anything at all about running This is the main branch of Shimmie, if you know anything at all about running
websites, this is the version to use. websites, this is the version to use.
@ -26,21 +28,22 @@ check out one of the versioned branches.
# Installation # Installation
0. Download the latest release under [Releases](https://github.com/shish/shimmie2/releases). 1. Download the latest release under [Releases](https://github.com/shish/shimmie2/releases).
1. Create a blank database 2. Create a blank database
2. Unzip shimmie into a folder on the web host 3. Unzip shimmie into a folder on the web host
3. Visit the folder with a web browser 4. Visit the folder with a web browser
4. Enter the location of the database 5. Enter the location of the database
5. Click "install". Hopefully you'll end up at the welcome screen; if 6. Click "install". Hopefully you'll end up at the welcome screen; if
not, you should be given instructions on how to fix any errors~ not, you should be given instructions on how to fix any errors~
# Installation (Development) # Installation (Development)
0. Download the shimmie via the "Download Zip" button. 1. Download shimmie via the "Download Zip" button on the [develop](https://github.com/shish/shimmie2/tree/develop) branch.
1. Install [Composer](https://getcomposer.org/). (If you don't already have it) 2. Unzip shimmie into a folder on the web host
2. Run `composer global require "fxp/composer-asset-plugin:~1.1" --no-plugins`. (This is installed globally due to a known composer bug) 3. Install [Composer](https://getcomposer.org/). (If you don't already have it)
3. Run `composer install` 4. Run `composer global require "fxp/composer-asset-plugin:~1.1" --no-plugins`. (This is installed globally due to a known composer bug)
4. Follow instructions noted in "Installation" (Excluding 0). 5. Run `composer install` in the shimmie folder.
6. Follow instructions noted in "Installation" (Excluding 1 & 3).
## Upgrade from 2.3.X ## Upgrade from 2.3.X

View File

@ -837,7 +837,7 @@ class Artists extends Extension {
INSERT INTO artists (user_id, name, notes, created, updated) INSERT INTO artists (user_id, name, notes, created, updated)
VALUES (?, ?, ?, now(), now()) VALUES (?, ?, ?, now(), now())
", array($user->id, $name, $notes)); ", array($user->id, $name, $notes));
return $database->get_last_insert_id(); return $database->get_last_insert_id('artists_id_seq');
} }
/** /**

View File

@ -1,16 +1,36 @@
$(function(){ $(function(){
var metatags = ['order:id', 'order:width', 'order:height', 'order:filesize', 'order:filename'];
$('[name=search]').tagit({ $('[name=search]').tagit({
singleFieldDelimiter: ' ', singleFieldDelimiter: ' ',
beforeTagAdded: function(event, ui) { beforeTagAdded: function(event, ui) {
// give special class to negative tags if(metatags.indexOf(ui.tagLabel) !== -1) {
if(ui.tagLabel[0] === '-') { ui.tag.addClass('tag-metatag');
ui.tag.addClass('tag-negative'); } else {
}else{ console.log(ui.tagLabel);
ui.tag.addClass('tag-positive'); // give special class to negative tags
if(ui.tagLabel[0] === '-') {
ui.tag.addClass('tag-negative');
}else{
ui.tag.addClass('tag-positive');
}
} }
}, },
autocomplete : ({ autocomplete : ({
source: function (request, response) { source: function (request, response) {
var ac_metatags = $.map(
$.grep(metatags, function(s) {
// Only show metatags for strings longer than one character
return (request.term.length > 1 && s.indexOf(request.term) === 0);
}),
function(item) {
return {
label : item + ' [metatag]',
value : item
};
}
);
var isNegative = (request.term[0] === '-'); var isNegative = (request.term[0] === '-');
$.ajax({ $.ajax({
url: base_href + '/api/internal/autocomplete', url: base_href + '/api/internal/autocomplete',
@ -18,13 +38,17 @@ $(function(){
dataType : 'json', dataType : 'json',
type : 'GET', type : 'GET',
success : function (data) { success : function (data) {
response($.map(data, function (count, item) { response(
item = (isNegative ? '-'+item : item); $.merge(ac_metatags,
return { $.map(data, function (count, item) {
label : item + ' ('+count+')', item = (isNegative ? '-'+item : item);
value : item return {
}; label : item + ' ('+count+')',
})); value : item
};
})
)
);
}, },
error : function (request, status, error) { error : function (request, status, error) {
alert(error); alert(error);
@ -47,10 +71,9 @@ $(function(){
} else if (keyCode == 9) { } else if (keyCode == 9) {
e.preventDefault(); e.preventDefault();
var tag = $('.tagit-autocomplete[style*=\"display: block\"] > li:first').text(); var tag = $('.tagit-autocomplete[style*=\"display: block\"] > li:focus, .tagit-autocomplete[style*=\"display: block\"] > li:first').first();
if(tag){ if(tag.length){
$('[name=search]').tagit('createTag', tag); $(tag).click();
$('.ui-autocomplete-input').autocomplete('close');
$('.ui-autocomplete-input').val(''); //If tag already exists, make sure to remove duplicate. $('.ui-autocomplete-input').val(''); //If tag already exists, make sure to remove duplicate.
} }
} }

View File

@ -5,4 +5,5 @@
input[name=search] ~ input[type=submit] { display: inline-block !important; } input[name=search] ~ input[type=submit] { display: inline-block !important; }
.tag-negative { background: #ff8080 !important; } .tag-negative { background: #ff8080 !important; }
.tag-positive { background: #40bf40 !important; } .tag-positive { background: #40bf40 !important; }
.tag-metatag { background: #eaa338 !important; }

View File

@ -7,26 +7,31 @@ class ExtManagerTheme extends Themelet {
".make_form(make_link("ext_manager/set"))." ".make_form(make_link("ext_manager/set"))."
<table id='extensions' class='zebra sortable'> <table id='extensions' class='zebra sortable'>
<thead> <thead>
<tr>$h_en<th>Name</th><th>Description</th></tr> <tr>
$h_en
<th>Name</th>
<th>Docs</th>
<th>Description</th>
</tr>
</thead> </thead>
<tbody> <tbody>
"; ";
foreach($extensions as $extension) { foreach($extensions as $extension) {
if(!$editable && $extension->visibility == "admin") continue; if(!$editable && $extension->visibility == "admin") continue;
$h_name = html_escape(empty($extension->name) ? $extension->ext_name : $extension->name); $h_name = html_escape(empty($extension->name) ? $extension->ext_name : $extension->name);
$h_description = html_escape($extension->description); $h_description = html_escape($extension->description);
if($extension->enabled === TRUE) $h_enabled = " checked='checked'"; $h_link = make_link("ext_doc/".url_escape($extension->ext_name));
else if($extension->enabled === FALSE) $h_enabled = ""; $h_enabled = ($extension->enabled === TRUE ? " checked='checked'" : ($extension->enabled === FALSE ? "" : " disabled checked='checked'"));
else $h_enabled = " disabled checked='checked'"; $h_enabled_box = $editable ? "<td><input type='checkbox' name='ext_".html_escape($extension->ext_name)."'$h_enabled></td>" : "";
$h_link = make_link("ext_doc/".url_escape($extension->ext_name)); $h_docs = ($extension->documentation ? "<a href='$h_link'>■</a>" : ""); //TODO: A proper "docs" symbol would be preferred here.
$h_en = $editable ? "<td><input type='checkbox' name='ext_".html_escape($extension->ext_name)."'$h_enabled></td>" : "";
$html .= " $html .= "
<tr> <tr data-ext='{$extension->ext_name}'>
$h_en {$h_enabled_box}
<td><a href='$h_link'>$h_name</a></td> <td>{$h_name}</td>
<td style='text-align: left;'>$h_description</td> <td>{$h_docs}</td>
<td style='text-align: left;'>{$h_description}</td>
</tr>"; </tr>";
} }
$h_set = $editable ? "<tfoot><tr><td colspan='5'><input type='submit' value='Set Extensions'></td></tr></tfoot>" : ""; $h_set = $editable ? "<tfoot><tr><td colspan='5'><input type='submit' value='Set Extensions'></td></tr></tfoot>" : "";

View File

@ -85,8 +85,7 @@ class LinkImageTheme extends Themelet {
return " return "
<tr> <tr>
<td><label for='".$id."' title='Click to select the textbox'>$label</label></td> <td><label for='".$id."' title='Click to select the textbox'>$label</label></td>
<td><input type='text' readonly='readonly' id='".$id."' name='".$id."' <td><input type='text' readonly='readonly' id='".$id."' name='".$id."' value='".html_escape($content)."' onfocus='this.select();' /></td>
value='".html_escape($content)."' onfocus='this.select();'></input></td>
</tr> </tr>
"; ";
} }

View File

@ -21,6 +21,7 @@ class PoolsTheme extends Themelet {
$navlinks .= '<a href="'.make_link('post/view/'.$pool['nav']['next']).'" class="pools_next_img">Next</a>'; $navlinks .= '<a href="'.make_link('post/view/'.$pool['nav']['next']).'" class="pools_next_img">Next</a>';
} }
if(!empty($navlinks)){ if(!empty($navlinks)){
$navlinks .= "<div style='height: 5px'></div>";
$linksPools[] = $navlinks; $linksPools[] = $navlinks;
} }
} }

View File

@ -69,7 +69,7 @@ var Tagger = {
tag : { tag : {
submit : function () { submit : function () {
var l = this.list.childNodes.length; var l = this.list.childNodes.length;
var tags = Array(); var tags = [];
for(var i=0; i<l; i++) { for(var i=0; i<l; i++) {
var s_tag = this.list.childNodes[i].firstChild.data; var s_tag = this.list.childNodes[i].firstChild.data;
tags.push(s_tag); tags.push(s_tag);

View File

@ -89,11 +89,14 @@ $(document).ready(function() {
}); });
if(document.location.hash.length > 3) { if(document.location.hash.length > 3) {
query = document.location.hash.substring(1); var query = document.location.hash.substring(1);
a = document.getElementById("prevlink");
a.href = a.href + '?' + query; $('#prevlink').attr('href', function(i, attr) {
a = document.getElementById("nextlink"); return attr + '?' + query;
a.href = a.href + '?' + query; });
$('#nextlink').attr('href', function(i, attr) {
return attr + '?' + query;
});
} }
/* /*