suggested articles / email is now sent
This commit is contained in:
@@ -22,4 +22,4 @@ gem 'puma'
|
||||
gem "sinatra-contrib"
|
||||
gem 'rerun'
|
||||
gem 'xxhash', '~> 0.3.0'
|
||||
gem 'pony'
|
||||
gem 'sendgrid-ruby'
|
||||
|
||||
@@ -26,6 +26,8 @@ GEM
|
||||
builder (3.2.2)
|
||||
celluloid (0.16.0)
|
||||
timers (~> 4.0.0)
|
||||
domain_name (0.5.24)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
elasticsearch (1.0.8)
|
||||
elasticsearch-api (= 1.0.7)
|
||||
elasticsearch-transport (= 1.0.7)
|
||||
@@ -40,6 +42,8 @@ GEM
|
||||
ffi (1.9.6-java)
|
||||
hitimes (1.2.2)
|
||||
hitimes (1.2.2-java)
|
||||
http-cookie (1.0.2)
|
||||
domain_name (~> 0.5)
|
||||
i18n (0.7.0)
|
||||
jdbc-postgres (9.3.1102)
|
||||
jruby-openssl (0.9.6-java)
|
||||
@@ -49,15 +53,12 @@ GEM
|
||||
celluloid (>= 0.15.2)
|
||||
rb-fsevent (>= 0.9.3)
|
||||
rb-inotify (>= 0.9)
|
||||
mail (2.6.3)
|
||||
mime-types (>= 1.16, < 3)
|
||||
mime-types (2.6.1)
|
||||
mime-types (2.6.2)
|
||||
minitest (5.5.0)
|
||||
multi_json (1.10.1)
|
||||
multipart-post (2.0.0)
|
||||
netrc (0.10.3)
|
||||
pg (0.17.1)
|
||||
pony (1.11)
|
||||
mail (>= 2.0)
|
||||
puma (2.10.2)
|
||||
rack (>= 1.1, < 2.0)
|
||||
puma (2.10.2-java)
|
||||
@@ -72,6 +73,13 @@ GEM
|
||||
ffi (>= 0.5.0)
|
||||
rerun (0.10.0)
|
||||
listen (~> 2.7, >= 2.7.3)
|
||||
rest-client (1.8.0)
|
||||
http-cookie (>= 1.0.2, < 2.0)
|
||||
mime-types (>= 1.16, < 3.0)
|
||||
netrc (~> 0.7)
|
||||
sendgrid-ruby (0.0.3)
|
||||
rest-client
|
||||
smtpapi
|
||||
sinatra (1.4.5)
|
||||
rack (~> 1.4)
|
||||
rack-protection (~> 1.4)
|
||||
@@ -86,6 +94,7 @@ GEM
|
||||
rack-test
|
||||
sinatra (~> 1.4.0)
|
||||
tilt (~> 1.3)
|
||||
smtpapi (0.1.0)
|
||||
thread_safe (0.3.4)
|
||||
thread_safe (0.3.4-java)
|
||||
tilt (1.4.1)
|
||||
@@ -93,6 +102,10 @@ GEM
|
||||
hitimes
|
||||
tzinfo (1.2.2)
|
||||
thread_safe (~> 0.1)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf (0.1.4-java)
|
||||
unf_ext (0.0.7.1)
|
||||
xxhash (0.3.0)
|
||||
|
||||
PLATFORMS
|
||||
@@ -107,9 +120,9 @@ DEPENDENCIES
|
||||
jruby-openssl
|
||||
json
|
||||
pg
|
||||
pony
|
||||
puma
|
||||
rerun
|
||||
sendgrid-ruby
|
||||
sinatra
|
||||
sinatra-activerecord
|
||||
sinatra-contrib
|
||||
|
||||
@@ -5,7 +5,7 @@ require 'json'
|
||||
require 'sinatra/cookies'
|
||||
require 'elasticsearch'
|
||||
require 'xxhash'
|
||||
require 'pony'
|
||||
require 'sendgrid-ruby'
|
||||
|
||||
|
||||
Dir[File.dirname(__FILE__) + '/models/*.rb'].each {|file| require file }
|
||||
|
||||
@@ -55,22 +55,21 @@ post '/cart/delivery_destination', &update_delivery_destination
|
||||
|
||||
|
||||
def send_order_email(cart)
|
||||
Pony.options = {
|
||||
:subject => "Nova Narudžba: #{cart.id}",
|
||||
:html_body => "Mušterija naručila nešto. <br /> Pogledati https://www.ribica.ba/backoffice/carts/#{cart.id}",
|
||||
:body => "Mušterija naručila nešto. Pogledati https://www.ribica.ba/backoffice/carts/#{cart.id}",
|
||||
:via => :smtp,
|
||||
:via_options => {
|
||||
:address => 'smtp.gmail.com',
|
||||
:port => '587',
|
||||
:enable_starttls_auto => true,
|
||||
:user_name => 'ribica.ba@gmail.com',
|
||||
:password => 'pumparica*pumpa*sumpa*lumpa',
|
||||
:authentication => :plain, # :plain, :login, :cram_md5, no auth by default
|
||||
:domain => "localhost.localdomain"
|
||||
}
|
||||
}
|
||||
Pony.mail(:to => "narudzbe@ribica.ba")
|
||||
|
||||
client = SendGrid::Client.new(api_user: "ribica",
|
||||
api_key: "plava*kutija*svjetlo*torba07"
|
||||
)
|
||||
|
||||
email = SendGrid::Mail.new do |m|
|
||||
m.to = "narudzbe@ribica.ba"
|
||||
m.from = "draga@ribica.ba"
|
||||
m.from_name = "Prodavnica Ribica"
|
||||
m.subject = "Nova Narudžba: #{cart.id}"
|
||||
m.html = "Mušterija naručila nešto. <br /> Pogledati https://www.ribica.ba/backoffice/carts/#{cart.id}"
|
||||
end
|
||||
|
||||
client.send(email)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ class MultiMediaDescription < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def resized_url
|
||||
url.gsub('/upload/v','/upload/c_lpad,h_170,w_226/v')
|
||||
url.gsub('/upload/v','/upload/c_lpad,h_281,w_375/v')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
50
front-ui/app/components/items/randomItems.js
Normal file
50
front-ui/app/components/items/randomItems.js
Normal file
@@ -0,0 +1,50 @@
|
||||
var React = require('react');
|
||||
var ItemList = require('./itemList');
|
||||
var ItemStore = require('../../stores/itemStore.js');
|
||||
var ItemActions = require('../../actions/itemActions.js');
|
||||
var ItemCollection = require('../../models/itemCollection');
|
||||
|
||||
var RandomItems = React.createClass({
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<ItemList items={this.state.items} />
|
||||
);
|
||||
},
|
||||
|
||||
// Add change listeners to stores
|
||||
componentDidMount: function() {
|
||||
ItemActions.loadFrontPageItems();
|
||||
ItemStore.addChangeListener(this._onChange);
|
||||
},
|
||||
|
||||
componentWillUnmount: function () {
|
||||
ItemStore.removeChangeListener(this._onChange);
|
||||
},
|
||||
|
||||
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
items: this.getRandomItems()
|
||||
}
|
||||
},
|
||||
|
||||
getRandomItems: function() {
|
||||
var NUMBER_OF_SUGGESTED_ITEMS = 8;
|
||||
var allItems = ItemStore.getItems();
|
||||
var randomIndexStart = Math.floor(Math.random() * ((allItems.models.length - NUMBER_OF_SUGGESTED_ITEMS + 1)));
|
||||
allItems.models = allItems.models.slice(randomIndexStart, randomIndexStart + NUMBER_OF_SUGGESTED_ITEMS);
|
||||
return allItems;
|
||||
},
|
||||
|
||||
|
||||
_onChange: function () {
|
||||
|
||||
this.setState({
|
||||
items: this.getRandomItems()
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = RandomItems;
|
||||
@@ -2,6 +2,7 @@ var React = require('react'),
|
||||
Router = require('react-router'),
|
||||
RouteHandler = Router.RouteHandler,
|
||||
AllItems = require('../items/allItems'),
|
||||
RandomItems = require('../items/randomItems'),
|
||||
LinkBanner = require('../linkBanner/linkBanner'),
|
||||
AllItemsInGroup = require('../items/allItemsInGroup');
|
||||
|
||||
@@ -16,7 +17,9 @@ var StartPage = React.createClass({
|
||||
<div className='col-md-12'>
|
||||
<LinkBanner locationName="startPage" />
|
||||
<AllItemsInGroup />
|
||||
<RouteHandler />
|
||||
<h2>Preporučeno</h2>
|
||||
<RandomItems />
|
||||
|
||||
</div>
|
||||
<GAInitiailizer />
|
||||
</div>
|
||||
|
||||
@@ -529,3 +529,7 @@ text-decoration: none;
|
||||
font-size: 29px;
|
||||
color: #06c3c3;
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: center;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -21,6 +21,9 @@
|
||||
<img height={50} src="https://res.cloudinary.com/du5pdibul/image/upload/v1434870249/progress_bar_idgtad.gif" />
|
||||
</div>
|
||||
<script src='/ribica.js' type='text/javascript'></script>
|
||||
<div class="footer">
|
||||
© Ribica.ba 2015.
|
||||
</div>
|
||||
<script type='text/javascript'>
|
||||
RIBICA.App.bootstrap();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user