application no longer thanks people for ordering nothing
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
GIT
|
GIT
|
||||||
remote: git://github.com/activescaffold/active_scaffold.git
|
remote: git://github.com/activescaffold/active_scaffold.git
|
||||||
revision: 4693e8a3278702143b1668fb5f6317b1c4f90388
|
revision: 6f637d62c7b4eb7ae49a28f6b8c9b86997a326a3
|
||||||
branch: master
|
branch: master
|
||||||
specs:
|
specs:
|
||||||
active_scaffold (3.4.14)
|
active_scaffold (3.4.17)
|
||||||
rails (>= 3.2.18, < 5)
|
rails (>= 3.2.18, < 5)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
|
|||||||
@@ -22,5 +22,8 @@ module Ribicabackoffice
|
|||||||
|
|
||||||
# Do not swallow errors in after_commit/after_rollback callbacks.
|
# Do not swallow errors in after_commit/after_rollback callbacks.
|
||||||
config.active_record.raise_in_transactional_callbacks = true
|
config.active_record.raise_in_transactional_callbacks = true
|
||||||
|
config.assets.precompile += %w(*.svg *.eot *.woff *.ttf *.gif *.png *.ico)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,3 +20,4 @@ gem "sinatra-activerecord"
|
|||||||
gem "json"
|
gem "json"
|
||||||
gem 'puma'
|
gem 'puma'
|
||||||
gem "sinatra-contrib"
|
gem "sinatra-contrib"
|
||||||
|
gem 'rerun'
|
||||||
|
|||||||
@@ -24,11 +24,21 @@ GEM
|
|||||||
bcrypt (3.1.10)
|
bcrypt (3.1.10)
|
||||||
bcrypt (3.1.10-java)
|
bcrypt (3.1.10-java)
|
||||||
builder (3.2.2)
|
builder (3.2.2)
|
||||||
|
celluloid (0.16.0)
|
||||||
|
timers (~> 4.0.0)
|
||||||
|
ffi (1.9.6)
|
||||||
|
ffi (1.9.6-java)
|
||||||
|
hitimes (1.2.2)
|
||||||
|
hitimes (1.2.2-java)
|
||||||
i18n (0.7.0)
|
i18n (0.7.0)
|
||||||
jdbc-postgres (9.3.1102)
|
jdbc-postgres (9.3.1102)
|
||||||
jruby-openssl (0.9.6-java)
|
jruby-openssl (0.9.6-java)
|
||||||
json (1.8.1)
|
json (1.8.1)
|
||||||
json (1.8.1-java)
|
json (1.8.1-java)
|
||||||
|
listen (2.8.5)
|
||||||
|
celluloid (>= 0.15.2)
|
||||||
|
rb-fsevent (>= 0.9.3)
|
||||||
|
rb-inotify (>= 0.9)
|
||||||
minitest (5.5.0)
|
minitest (5.5.0)
|
||||||
multi_json (1.10.1)
|
multi_json (1.10.1)
|
||||||
pg (0.17.1)
|
pg (0.17.1)
|
||||||
@@ -41,6 +51,11 @@ GEM
|
|||||||
rack
|
rack
|
||||||
rack-test (0.6.3)
|
rack-test (0.6.3)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
|
rb-fsevent (0.9.4)
|
||||||
|
rb-inotify (0.9.5)
|
||||||
|
ffi (>= 0.5.0)
|
||||||
|
rerun (0.10.0)
|
||||||
|
listen (~> 2.7, >= 2.7.3)
|
||||||
sinatra (1.4.5)
|
sinatra (1.4.5)
|
||||||
rack (~> 1.4)
|
rack (~> 1.4)
|
||||||
rack-protection (~> 1.4)
|
rack-protection (~> 1.4)
|
||||||
@@ -58,6 +73,8 @@ GEM
|
|||||||
thread_safe (0.3.4)
|
thread_safe (0.3.4)
|
||||||
thread_safe (0.3.4-java)
|
thread_safe (0.3.4-java)
|
||||||
tilt (1.4.1)
|
tilt (1.4.1)
|
||||||
|
timers (4.0.1)
|
||||||
|
hitimes
|
||||||
tzinfo (1.2.2)
|
tzinfo (1.2.2)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
|
|
||||||
@@ -73,6 +90,7 @@ DEPENDENCIES
|
|||||||
json
|
json
|
||||||
pg
|
pg
|
||||||
puma
|
puma
|
||||||
|
rerun
|
||||||
sinatra
|
sinatra
|
||||||
sinatra-activerecord
|
sinatra-activerecord
|
||||||
sinatra-contrib
|
sinatra-contrib
|
||||||
|
|||||||
@@ -105,10 +105,8 @@ ActiveRecord::Schema.define(version: 20150222055517) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
create_table "sub_categories", force: :cascade do |t|
|
create_table "sub_categories", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.integer "category_id"
|
t.integer "category_id"
|
||||||
t.datetime "created_at", null: false
|
|
||||||
t.datetime "updated_at", null: false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "units", force: :cascade do |t|
|
create_table "units", force: :cascade do |t|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ var CartPage = React.createClass({
|
|||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("bla :" , this.state.items.length);
|
||||||
var cartTotal = (
|
var cartTotal = (
|
||||||
<div className="row cart-total">
|
<div className="row cart-total">
|
||||||
<CartTotal items={this.state.items} itemCounts={this.state.itemCounts} />
|
<CartTotal items={this.state.items} itemCounts={this.state.itemCounts} />
|
||||||
@@ -44,11 +45,22 @@ var CartPage = React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var buySomethingMessage = (<div></div>);
|
||||||
|
|
||||||
|
if (this.state.items.length <= 0) {
|
||||||
|
cartTotal = (<div></div>)
|
||||||
|
buySomethingMessage = (<div>Nemate ni jedan artikal u vašoj korpi. Kada vidite nešto što vam se sviđa - pritisnite dugme KUPI pored artikla kako biste ga dodali u korpu. </div>)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log("length :" , this.state.items.length);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<div className="cart-page center">
|
<div className="cart-page center">
|
||||||
{cartTotal}
|
{cartTotal}
|
||||||
{displayedItems}
|
{displayedItems}
|
||||||
|
{buySomethingMessage}
|
||||||
{cartTotal}
|
{cartTotal}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
var RibicaValidationMixin = {
|
||||||
|
_updateState: function(prop, value, callback) {
|
||||||
|
var newState = {};
|
||||||
|
newState[prop] = value;
|
||||||
|
this.setState(newState, function(){
|
||||||
|
if(callback) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
_validate: function(prop, value) {
|
||||||
|
if(this.validations && this.validations[prop]) {
|
||||||
|
var cb = function(err, revalidateFields) {
|
||||||
|
var errors = this.state.errors || {};
|
||||||
|
if (err !== undefined) {
|
||||||
|
if(err.length > 0) {
|
||||||
|
errors[prop] = err;
|
||||||
|
} else {
|
||||||
|
delete errors[prop];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
delete errors[prop];
|
||||||
|
}
|
||||||
|
this.setState({errors: errors});
|
||||||
|
if (revalidateFields) {
|
||||||
|
for(var i = 0; i < revalidateFields.length; i++) {
|
||||||
|
this.validateField(revalidateFields[i], this.state[revalidateFields[i]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.bind(this);
|
||||||
|
|
||||||
|
var immediateErrors = this.validations[prop](value, cb);
|
||||||
|
cb(immediateErrors);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleChange: function(prop) {
|
||||||
|
return function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
var target = event.target;
|
||||||
|
this._updateState(prop, target.value, function(){
|
||||||
|
this._validate(prop, target.value);
|
||||||
|
}.bind(this));
|
||||||
|
}.bind(this);
|
||||||
|
|
||||||
|
},
|
||||||
|
getValidationMessages:function(prop) {
|
||||||
|
var errors = this.state.errors || {};
|
||||||
|
return (errors[prop] || []);
|
||||||
|
},
|
||||||
|
validateField: function(field) {
|
||||||
|
this._validate(field, this.state[field]);
|
||||||
|
},
|
||||||
|
validate: function() {
|
||||||
|
for (var key in this.state) {
|
||||||
|
if (this.state.hasOwnProperty(key)) {
|
||||||
|
this._validate(key, this.state[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.isValid();
|
||||||
|
},
|
||||||
|
isValid: function() {
|
||||||
|
var errors = this.state.errors || {};
|
||||||
|
return Object.keys(errors).length === 0;
|
||||||
|
},
|
||||||
|
componentDidMount : function(){
|
||||||
|
this.setState({errors: {}});
|
||||||
|
if (this.validations) {
|
||||||
|
var self = this;
|
||||||
|
this.validations.getState = function() {
|
||||||
|
return self.state;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = RibicaValidationMixin;
|
||||||
@@ -63,7 +63,6 @@ var RibicaValidationMixin = {
|
|||||||
return Object.keys(errors).length === 0;
|
return Object.keys(errors).length === 0;
|
||||||
},
|
},
|
||||||
componentDidMount : function(){
|
componentDidMount : function(){
|
||||||
this.setState({errors: {}});
|
|
||||||
if (this.validations) {
|
if (this.validations) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.validations.getState = function() {
|
this.validations.getState = function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user