Skip to content

Commit

Permalink
Merge branch '4.0.2-rc1' of git://github.com/photo/frontend into 4.0.…
Browse files Browse the repository at this point in the history
…2-rc1
  • Loading branch information
jmathai committed Apr 14, 2014
2 parents efde939 + b00cf36 commit 10f14e3
Show file tree
Hide file tree
Showing 45 changed files with 4,401 additions and 865 deletions.
2 changes: 1 addition & 1 deletion src/configs/defaults.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[defaults]
theme="fabrizio1.0"
lastCodeVersion=0.0.0
currentCodeVersion=4.0.1
currentCodeVersion=4.0.2
mediaVersion="a"

[site]
Expand Down
2 changes: 1 addition & 1 deletion src/configs/upgrade/db/mysql/mysql-4.0.0.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
mysql_4_0_0($sql);

$sql = <<<SQL
ALTER TABLE `activity` ADD `elementId` VARCHAR( 6 ) NOT NULL AFTER `type`
ALTER TABLE `activity` ADD `{$this->mySqlTablePrefix}elementId` VARCHAR( 6 ) NOT NULL AFTER `type`
SQL;
mysql_4_0_0($sql);

Expand Down
30 changes: 30 additions & 0 deletions src/configs/upgrade/db/mysql/mysql-4.0.2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

$status = true;

$sql = <<<SQL
ALTER TABLE `{$this->mySqlTablePrefix}activity` ADD `elementId` VARCHAR( 6 ) NOT NULL AFTER `type`
SQL;

mysql_4_0_2($sql);

function mysql_4_0_2($sql, $params = array())
{
try
{
getDatabase()->execute($sql, $params);
getLogger()->info($sql);
}
catch(Exception $e)
{
getLogger()->crit($e->getMessage());
return false;
}
return true;
}

// Gh-1279
// We return true here since the only reason to include this alter is in case
// a user upgraded prior to this patch and we'll run it with the table prefix
// and fail silently if it doesn't take
return true;
Binary file not shown.
Binary file not shown.
399 changes: 399 additions & 0 deletions src/html/assets/font/fontawesome-3.2.1/fontawesome-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion src/html/assets/themes/fabrizio1.0/config/settings.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[site]
mediaVersion="co"
mediaVersion="ct"

[behavior]
useDefaultMobile="0"
Expand Down
2 changes: 1 addition & 1 deletion src/html/assets/themes/fabrizio1.0/javascripts/dropzone.js
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
input = _ref2[_i];
inputName = input.getAttribute("name");
inputType = input.getAttribute("type");
if (!inputType || inputType.toLowerCase() !== "checkbox" || input.checked) {
if (!inputType || (inputType.toLowerCase() !== "checkbox" && inputType.toLowerCase() !== "radio") || input.checked) {
formData.append(inputName, input.value);
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
if(lastLetter === 'y' || lastLetter === 'Y')
return string.substr(0, string.length-1) + 'ies';
else
return string.substr(0, string.length-1) + 's';
return string.substr(0, string.length) + 's';
};

this.sprintf = function() {
Expand Down
5 changes: 5 additions & 0 deletions src/html/assets/themes/fabrizio1.0/javascripts/op/Handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@
var $el = $(ev.target), photoId = $el.attr('data-id'), albumId = TBX.util.getPathParam('album');
OP.Util.makeRequest(TBX.format.sprintf('/album/%s/cover/%s/update.json', albumId, photoId), {crumb: TBX.crumb()}, TBX.callbacks.setAlbumCover, 'json', 'post');
};
this.click.shareAlbum = function(ev) {
ev.preventDefault();
var $el = $(ev.target), id = $el.attr('data-id');
OP.Util.makeRequest('/share/album/'+id+'/view.json', {crumb: TBX.crumb()}, TBX.callbacks.share, 'json', 'get');
};
this.click.sharePopup = function(ev) {
ev.preventDefault();
var $el = $(ev.target), url = $el.attr('href'), w=575, h=300, l, t, opts;
Expand Down
21 changes: 21 additions & 0 deletions src/html/assets/themes/fabrizio1.0/javascripts/op/Highlight.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
(function($) {
if(typeof TBX === 'undefined')
TBX = {};

function Hightlight() {
var highlightColor = '#fff7dc', startColor;
reset = function() {
$(this).animate({'backgroundColor':startColor}, 'slow');
}

this.run = function(el) {
var $el = $(el);

startColor = $el.css('backgroundColor');
$el.animate({backgroundColor: highlightColor}, 'slow', 'swing', reset.bind($el));
}
}

TBX.highlight = new Hightlight;
})(jQuery);

59 changes: 45 additions & 14 deletions src/html/assets/themes/fabrizio1.0/javascripts/op/Upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,65 @@
TBX = {};

function Upload() {
var dropzone, total = 0, duplicateCache = {}, completeObj = {success: 0, duplicate: 0, failed: 0}, confirmationMessage = 0;
var dropzone, total = 0, ids = [], duplicateCache = {}, completeObj = {success: 0, duplicate: 0, failed: 0, completed: 0}, progressModel, $form = $('form.upload');

var fileFinishedHandler = function(file, response) {
var message, previewElement = $(file.previewElement);
var message, $previewElement = $(file.previewElement);
switch(response.code) {
case 201:
completeObj.success++;
$(".dz-details>img", previewElement).attr('src', response.result.path100x100xCR).css('display', 'block');
$(".dz-details>img", $previewElement).attr('src', response.result.path100x100xCR).css('display', 'block');
break;
case 409:
$(".dz-details>img", previewElement).attr('src', response.result.path100x100xCR).css('display', 'block');
$(".dz-details>img", $previewElement).attr('src', response.result.path100x100xCR).css('display', 'block');
completeObj.duplicate++;
break;
default:
completeObj.failed++;
break;
}

if(completeObj.duplicate === 0)
message = TBX.format.sprintf('Your upload progress: total -> %s, successful -> %s, failed -> %s', total, completeObj.success, completeObj.failed);
else
message = TBX.format.sprintf('Your upload progress: total -> %s, successful -> %s, duplicate -> %s, failed -> %s', total, completeObj.success, completeObj.duplicate, completeObj.failed);
completeObj.completed++;
ids.push(response.result.id);

if(confirmationMessage === 0)
TBX.notification.show(message);
else

confirmationMessage = 1;
if(completeObj.completed === total) {
progressModel.completed();

if(completeObj.failed === 0) {
if(completeObj.duplicate === 0)
message = 'Your photos have been successfully uploaded. %s';
else
message = TBX.format.sprintf('Your photos have been successfully uploaded (%s %s).', completeObj.duplicate, TBX.format.plural('duplicate', completeObj.duplicate)) + ' %s';

TBX.notification.show(TBX.format.sprintf(message, TBX.format.sprintf('<a href="/photos/ids-%s/list">View or edit your photos</a>.', ids.join(','))));
} else {
TBX.notification.show('There was a problem uploading your photos. Please try again.', 'static', 'error');
}

$('button i', $form).remove();
}

progressModel.set('success', percent(completeObj.success, total));
progressModel.set('warning', percent(completeObj.duplicate, total));
progressModel.set('danger', percent(completeObj.failed, total));
};
var fileSending = function() {
if(typeof(progressModel) === "undefined") {
// insert the progress container
$el = $('.progress-upload');
// create the progress model
progressModel = new op.data.model.ProgressBar();
// insert the view and render it in place
(new op.data.view.ProgressBar({model: progressModel, el: $el})).render();
$('button', $form).prepend('<i class="icon-spinner icon-spin"></i> ');
}
};
var percent = function(numerator, denominator) {
if(denominator === 0)
return 0;
return (numerator / denominator) * 100;
};

this.init = function() {
dropzone = new Dropzone('form.dropzone', {
url: '/photo/upload.json',
Expand Down Expand Up @@ -65,11 +95,12 @@
});
dropzone.on("success", function(file, response) { fileFinishedHandler(file, response); });
dropzone.on("error", function(file) { fileFinishedHandler(file, {"code":500}); });
dropzone.on("sending", fileSending);
};
this.start = function() {
dropzone.processQueue();
}
}

TBX.upload = new Upload;
})(jQuery);
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(function($){
op.ns('data.model').ProgressBar = Backbone.Model.extend({
defaults: {
"total": 0,
"success": 0,
"warning": 0,
"danger": 0,
"striped": "progress-striped"
},
completed: function() {
this.set('striped', '');
},
sync: function(method, model) {
model.trigger('change');
}
});
})(jQuery);
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
},
render: function(){
var that = this, $el = $(this.el), notification = that.model.toJSON(), exists = $('.trovebox-message').length === 1;
if(exists)
$el.slideUp('fast', function() { $(this).html(that.template(notification)).slideDown('medium'); });
else
if(exists) {
$el.html(that.template(notification));
TBX.highlight.run($('.alert', $el));
} else {
$el.css('display', 'none').html(that.template(notification)).slideDown('medium');

}
return this;
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(function($){
op.ns('data.view').ProgressBar = Backbone.View.extend({
initialize: function() {
this.model.on('change', this.modelChanged, this);
},
model: this.model,
className: 'progress-meta',
template :_.template($('#progress-meta').html()),
render: function() {
this.$el.html(this.template(this.model.attributes));
return this;
},
modelChanged: function() {
this.render();
}
});
})(jQuery);

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@import "components/bootstrap-editable";
@import "resources/bootstrap/less/bootstrap";
@import "resources/bootstrap/less/responsive";
@import "resources/fontawesome/font-awesome";
@import "variables";
@import "typography";
@import "icons";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@import "tables.less";

// Components: common
@import "font-awesome.less";
//@import "font-awesome.less";
@import "dropdowns.less";
@import "wells.less";
@import "component-animations.less";
Expand Down
Loading

0 comments on commit 10f14e3

Please sign in to comment.