Skip to content

Commit

Permalink
Admin: Image move & resize: Refactor for future RAW support; Lint; Up…
Browse files Browse the repository at this point in the history
…grade jQuery UI
  • Loading branch information
danactive committed Dec 21, 2014
1 parent dd3ae1a commit 7f519d2
Show file tree
Hide file tree
Showing 48 changed files with 16,907 additions and 1,142 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ gallery-dan
todo
node_modules
npm-debug.log
resizeImages
!node_modules/expect.js/index.js
resizeImages
1 change: 0 additions & 1 deletion admin/get_gallery_directories.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var fs = require('fs');

exports.init = function (param) {
var response = param.response,
request = param.request,
files = fs.readdirSync('.'),
i,
len = files.length,
Expand Down
22 changes: 10 additions & 12 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
/*global __dirname, console, require*/
var doT = require('doT'),
var adminImageManipulation = require('./js/admin-image-manipulation.js'),
express = require('express'),
app = express(),
expressPort = 80,
constant = {
"debug": false,
"resizeFolder": "resizeImages",
"tempThumbFolder": '_historyThumb'
},
path = require('path'),
serveStaticPages = function (param) {
var request = param.request,
Expand Down Expand Up @@ -90,18 +85,18 @@ app.get(/(admin\/walk-path)/, function(request, response) {
'/js/global.js',
'/js/walk-path-tested.js',
'/js/directory-contents.js',
'/lib/jquery-ui-1.10.3.datepicker.sortable/jquery-ui-1.10.3.custom.min.js',
'/lib/jquery-ui-1.11.2.custom/jquery-ui.min.js',
'/public/views.js'
],
"css": [
'/lib/jquery-ui-1.10.3.datepicker.sortable/humanity/jquery-ui-1.10.3.custom.min.css',
'/lib/jquery-ui-1.11.2.custom/jquery-ui.min.css',
'/css/directory-contents.css'
]
}
);
});
app.get(/(api\/walk-path)/, function(request, response) {
require('./js/admin-directory-contents-api.js').list({"constant": constant, "request": request, "response": response});
require('./js/admin-directory-contents-api.js').list({"request": request, "response": response});
});
app.get(/(admin\/diff-album-path)/, function(request, response) {
response.render(
Expand All @@ -120,13 +115,16 @@ app.get(/(admin\/diff-album-path)/, function(request, response) {
);
});
app.post(/(admin\/preview-generator)/, function(request, response) {
require('./js/admin-image-manipulation.js').preview({"constant": constant, "request": request, "response": response});
adminImageManipulation.preview({"request": request, "response": response});
});
app.post(/(admin\/rename-photos)/, function(request, response) {
require('./js/admin-image-manipulation.js').rename({"constant": constant, "request": request, "response": response});
adminImageManipulation.rename({"request": request, "response": response});
});
app.post(/(admin\/resize-photo)/, function(request, response) {
require('./js/admin-image-manipulation.js').resize({"constant": constant, "request": request, "response": response});
adminImageManipulation.resize({"request": request, "response": response});
});
app.post(/(admin\/delete-path)/, function(request, response) {
adminImageManipulation.deletePath({"request": request, "response": response});
});

app.get('*', function(request, response) {
Expand Down
21 changes: 13 additions & 8 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,19 @@ module.exports = function (grunt) {
},
jshint: {
options: {
curly: true,
eqnull: true,
immed: true,
latedef: true,
loopfunc: true,
noarg: true,
sub: true,
undef: true
"curly": true,
"debug": false,
"eqeqeq": true,
"globals": {
"browser": true
},
"immed": true,
"latedef": true,
"loopfunc": true,
"noarg": true,
"sub": true,
"undef": true,
"unused": true
},
adminJs: ['gruntfile.js', 'package.json', 'app.js', 'admin/*.js', 'test/*.js', 'lib/json_to_xml.js'],
viewJs: ['js/*.js', '!js/edit_admin_xml.js', '!<%= jshint.viewJsDebug.files.src %>'],
Expand Down
4 changes: 2 additions & 2 deletions js/admin-directory-contents-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ Format directory contents: files or folders as JSON
function generateJson(arg) {
var currentFolder,
filenames,
isFolder,
isRasterFile,
jsonPackage = { "items": [] },
len,
path = require('path');
Expand Down Expand Up @@ -98,6 +96,8 @@ function generateJson(arg) {
function getType (extension) {
if (extension.toLowerCase().match(/\.(gif|jpg|jpeg|png)$/)) {
return "image";
} else if (extension.toLowerCase().match(/\.(arw|raw|psd)$/)) {
return "source";
} else if (extension.toLowerCase().match(/\.(avi|mov|mp4|mts|qt|webm)$/)) {
return "video";
} else if (extension === "") {
Expand Down
1 change: 1 addition & 0 deletions js/admin-edit-xml-tested.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*global $, album, util*/
/*exported SaveToJson*/
var schema = {
"filename": "filename",
"city": "photo_city",
Expand Down
Loading

0 comments on commit 7f519d2

Please sign in to comment.