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

View File

@ -11,6 +11,8 @@
# Shimmie
[![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
websites, this is the version to use.
@ -26,21 +28,22 @@ check out one of the versioned branches.
# Installation
0. Download the latest release under [Releases](https://github.com/shish/shimmie2/releases).
1. Create a blank database
2. Unzip shimmie into a folder on the web host
3. Visit the folder with a web browser
4. Enter the location of the database
5. Click "install". Hopefully you'll end up at the welcome screen; if
1. Download the latest release under [Releases](https://github.com/shish/shimmie2/releases).
2. Create a blank database
3. Unzip shimmie into a folder on the web host
4. Visit the folder with a web browser
5. Enter the location of the database
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~
# Installation (Development)
0. Download the shimmie via the "Download Zip" button.
1. Install [Composer](https://getcomposer.org/). (If you don't already have it)
2. Run `composer global require "fxp/composer-asset-plugin:~1.1" --no-plugins`. (This is installed globally due to a known composer bug)
3. Run `composer install`
4. Follow instructions noted in "Installation" (Excluding 0).
1. Download shimmie via the "Download Zip" button on the [develop](https://github.com/shish/shimmie2/tree/develop) branch.
2. Unzip shimmie into a folder on the web host
3. Install [Composer](https://getcomposer.org/). (If you don't already have it)
4. Run `composer global require "fxp/composer-asset-plugin:~1.1" --no-plugins`. (This is installed globally due to a known composer bug)
5. Run `composer install` in the shimmie folder.
6. Follow instructions noted in "Installation" (Excluding 1 & 3).
## Upgrade from 2.3.X

View File

@ -837,7 +837,7 @@ class Artists extends Extension {
INSERT INTO artists (user_id, name, notes, created, updated)
VALUES (?, ?, ?, now(), now())
", 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(){
var metatags = ['order:id', 'order:width', 'order:height', 'order:filesize', 'order:filename'];
$('[name=search]').tagit({
singleFieldDelimiter: ' ',
beforeTagAdded: function(event, ui) {
if(metatags.indexOf(ui.tagLabel) !== -1) {
ui.tag.addClass('tag-metatag');
} else {
console.log(ui.tagLabel);
// give special class to negative tags
if(ui.tagLabel[0] === '-') {
ui.tag.addClass('tag-negative');
}else{
ui.tag.addClass('tag-positive');
}
}
},
autocomplete : ({
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] === '-');
$.ajax({
url: base_href + '/api/internal/autocomplete',
@ -18,13 +38,17 @@ $(function(){
dataType : 'json',
type : 'GET',
success : function (data) {
response($.map(data, function (count, item) {
response(
$.merge(ac_metatags,
$.map(data, function (count, item) {
item = (isNegative ? '-'+item : item);
return {
label : item + ' ('+count+')',
value : item
};
}));
})
)
);
},
error : function (request, status, error) {
alert(error);
@ -47,10 +71,9 @@ $(function(){
} else if (keyCode == 9) {
e.preventDefault();
var tag = $('.tagit-autocomplete[style*=\"display: block\"] > li:first').text();
if(tag){
$('[name=search]').tagit('createTag', tag);
$('.ui-autocomplete-input').autocomplete('close');
var tag = $('.tagit-autocomplete[style*=\"display: block\"] > li:focus, .tagit-autocomplete[style*=\"display: block\"] > li:first').first();
if(tag.length){
$(tag).click();
$('.ui-autocomplete-input').val(''); //If tag already exists, make sure to remove duplicate.
}
}

View File

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

View File

@ -7,7 +7,12 @@ class ExtManagerTheme extends Themelet {
".make_form(make_link("ext_manager/set"))."
<table id='extensions' class='zebra sortable'>
<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>
<tbody>
";
@ -16,17 +21,17 @@ class ExtManagerTheme extends Themelet {
$h_name = html_escape(empty($extension->name) ? $extension->ext_name : $extension->name);
$h_description = html_escape($extension->description);
if($extension->enabled === TRUE) $h_enabled = " checked='checked'";
else if($extension->enabled === FALSE) $h_enabled = "";
else $h_enabled = " disabled checked='checked'";
$h_link = make_link("ext_doc/".url_escape($extension->ext_name));
$h_enabled = ($extension->enabled === TRUE ? " checked='checked'" : ($extension->enabled === FALSE ? "" : " disabled checked='checked'"));
$h_enabled_box = $editable ? "<td><input type='checkbox' name='ext_".html_escape($extension->ext_name)."'$h_enabled></td>" : "";
$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 .= "
<tr>
$h_en
<td><a href='$h_link'>$h_name</a></td>
<td style='text-align: left;'>$h_description</td>
<tr data-ext='{$extension->ext_name}'>
{$h_enabled_box}
<td>{$h_name}</td>
<td>{$h_docs}</td>
<td style='text-align: left;'>{$h_description}</td>
</tr>";
}
$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 "
<tr>
<td><label for='".$id."' title='Click to select the textbox'>$label</label></td>
<td><input type='text' readonly='readonly' id='".$id."' name='".$id."'
value='".html_escape($content)."' onfocus='this.select();'></input></td>
<td><input type='text' readonly='readonly' id='".$id."' name='".$id."' value='".html_escape($content)."' onfocus='this.select();' /></td>
</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>';
}
if(!empty($navlinks)){
$navlinks .= "<div style='height: 5px'></div>";
$linksPools[] = $navlinks;
}
}

View File

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

View File

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