18 Commits

Author SHA1 Message Date
Senad Uka
d97516e24e thrown out ringeraja banner 2016-06-09 12:42:22 +02:00
Senad Uka
9820f6a363 another trello card formatting fix 2016-05-07 09:26:02 +02:00
Senad Uka
6b4bc6aa20 fixed trello formating again 2016-05-07 09:21:34 +02:00
Senad Uka
98e64830e1 fixed trello formating 2016-05-07 09:17:30 +02:00
Senad Uka
5c899ca6ed added paypal notice 2016-05-07 09:14:06 +02:00
Senad Uka
138c5de68e added coupon code to label on remark 2016-05-07 08:49:11 +02:00
Senad Uka
edb1325c07 fixed search on enter 2016-05-07 06:41:12 +02:00
Senad Uka
6b97c2342c fixed trello 2016-05-07 06:10:04 +02:00
Senad Uka
70ee58e989 slugify fixed 2016-03-16 12:13:47 +01:00
Senad Uka
7e62881d16 SOlved conflict 2016-03-16 12:12:26 +01:00
Senad Uka
d111406f03 fixed bugs with trello 2016-02-16 12:34:21 +01:00
Senad Uka
1368a71f26 Merge branch 'develop'
paypal, pikpay and gift support
2016-02-07 19:54:08 +01:00
Senad Uka
e0fda3e9ee add robots.txt - because of the SEO 2016-01-26 06:09:08 +01:00
Senad Uka
30e48cd1b6 put menu items into links - because of the SEO 2016-01-26 05:43:05 +01:00
Senad Uka
0e2e5b8fb9 put items into links - because of the SEO 2016-01-26 05:01:18 +01:00
Senad Uka
418eb028ae changed text of newsleetter sweepstake 2016-01-18 11:06:49 +01:00
Senad Uka
1c0c4fa78a changed date of newsleetter sweepstake 2016-01-18 10:28:28 +01:00
Senad Uka
53ef339f5f added ringeraja ba advertisement 2015-12-16 08:49:42 +01:00
12 changed files with 158 additions and 93 deletions

View File

@@ -0,0 +1,34 @@
<%= form_tag('./import') do %>
<p><label for="supplier_id">Supplier: </label>
<%= select_tag "supplier_id", options_from_collection_for_select(@suppliers, "id", "name", @selected_supplier.try(:id)) %></p>
<p><label for="codes">
Codes to check:
</label><br />
<%= text_area_tag "codes", @codes_to_check, rows: 20, columns: 50 %></p>
<p><%= submit_tag "Check" %></p>
<% end %>
<div>
<h2> In database: <%= @items.length %>, in file: <%= @codes_to_check_array.length %> </h2>
</div>
<div>
<h2>Not in database (<%= @missing_from_database.length %>): </h2>
<br />
<% @missing_from_database.each do |code| %>
<%= code %><br />
<% end %>
</div>
<div>
<h2>Not in file (<%= @missing_from_codes.length %>): </h2>
<br />
<% @missing_from_codes.each do |code| %>
<%= code %><br />
<% end %>
</div>

View File

@@ -1,9 +1,9 @@
create_the_cart = -> () {
create_the_cart = lambda do
# -1 is a placeholder for user id when we implement users
# auid will still be used in case user is not logged in
Cart.find_or_create(anonymous_id, logged_in_user_id).to_json
}
end
post '/cart', &create_the_cart
put '/cart', &create_the_cart
@@ -16,22 +16,19 @@ get '/cart/item' do
Cart.just_find(anonymous_id, logged_in_user_id).item_in_carts.to_json
end
update_cart_item = ->() {
update_cart_item = lambda do
cart_id = Cart.just_find(anonymous_id, logged_in_user_id).id
item_id = @json_params["item_id"].to_i
count = @json_params["count"].to_i
item_id = @json_params['item_id'].to_i
count = @json_params['count'].to_i
ItemInCart.update_state(cart_id, item_id, count).to_json
}
end
put '/cart/item', &update_cart_item
post '/cart/item', &update_cart_item
# gets list of items in cart without count
get '/cart/item/display' do
cart = Cart.just_find(anonymous_id, logged_in_user_id)
item_ids = cart.item_in_carts.map do |x|
x.item_id
end
item_ids = cart.item_in_carts.map(&:item_id)
items = []
items = Item.find(item_ids) if cart.item_in_carts.length > 0
prepare_items_for_mass_display(items)
@@ -39,9 +36,23 @@ end
get '/cart/delivery_destination' do
cart = Cart.just_find(anonymous_id, logged_in_user_id)
cart.delivery_destination.to_json(:except => [:created_at, :email_verification_code, :phone_verification_code])
cart.delivery_destination.to_json(except: [:created_at, :email_verification_code, :phone_verification_code])
end
update_delivery_destination = lambda do
cart = Cart.just_find(anonymous_id, logged_in_user_id)
allowed_keys = %w(name address place postal_code phone email note payment_method gift
recipient_name recipient_address recipient_place recipient_postal_code recipient_phone recipient_email)
params = @json_params.reject { |key, _| !allowed_keys.include?(key) }
cart.delivery_destination.update_attributes(params)
cart.delivery_destination.save!
cart.delivery_destination.to_json(except: [:created_at, :email_verification_code, :phone_verification_code])
end
put '/cart/delivery_destination', &update_delivery_destination
post '/cart/delivery_destination', &update_delivery_destination
def report_to_trello(cart)
Thread.new do
@cart = cart
@@ -50,8 +61,8 @@ def report_to_trello(cart)
card = Trello::Card.new
card.list_id = list.id
card.name = cart.title
card.pos = "bottom"
card.desc = erb(:cart_trello, :layout => false)
card.pos = 'bottom'
card.desc = erb(:cart_trello, layout: false)
card.save
end
end
@@ -75,22 +86,21 @@ post '/cart/delivery_destination', &update_delivery_destination
def send_order_email(cart)
Thread.new do
client = SendGrid::Client.new(
api_user: RibicaConfig.SENDGRID_API_USER,
api_key: RibicaConfig.SENDGRID_API_KEY
api_user: RibicaConfig::SENDGRID_API_USER,
api_key: RibicaConfig::SENDGRID_API_KEY
)
email = SendGrid::Mail.new do |m|
m.to = RibicaConfig.BACKOFFICE_ORDER_EMAIL_TO
m.from = RibicaConfig.BACKOFFICE_ORDER_EMAIL_FROM
m.from_name = "Prodavnica Ribica"
m.to = RibicaConfig::BACKOFFICE_ORDER_EMAIL_TO
m.from = RibicaConfig::BACKOFFICE_ORDER_EMAIL_FROM
m.from_name = 'Prodavnica Ribica'
m.subject = "Nova Narudžba: #{cart.id}"
m.html = "Mušterija naručila nešto. <br /> Pogledati #{RibicaConfig.ROOT_ADDRESS}/backoffice/carts/#{cart.id}"
m.html = "Mušterija naručila nešto. <br /> Pogledati #{RibicaConfig::ROOT_ADDRESS}/backoffice/carts/#{cart.id}"
end
client.send(email)
end
end
post '/cart/confirmation' do
anonymous = anonymous_id
cart = Cart.just_find(anonymous, logged_in_user_id)
@@ -98,51 +108,51 @@ post '/cart/confirmation' do
cart.ordered = true
cart.save!
end
report_to_trello(cart)
send_order_email(cart)
# since there is no more ordered cart this needs to be done
# in order for next call of Cart#just_find to be ready
Cart.find_or_create(anonymous, logged_in_user_id)
#report_to_trello(cart)
send_order_email(cart)
"OK".to_json
'OK'.to_json
end
post '/payment/confirmation' do
data = JSON.parse params[:custom]
data = JSON.parse params[:custom]
puts "Data #{data.inspect}"
puts "Data #{data.inspect}"
anonymous = data["anonymous_id_string"]
user = data["user_id"]
user ||= -1
user = user.to_i
anonymous = data['anonymous_id_string']
user = data['user_id']
user ||= -1
user = user.to_i
cart = Cart.just_find(anonymous, user)
if cart.item_in_carts.length > 0
cart.ordered = true
cart.save!
end
cart = Cart.just_find(anonymous, user)
if cart.item_in_carts.length > 0
cart.ordered = true
cart.save!
end
Cart.find_or_create(anonymous, user)
#report_to_trello(cart)
send_order_email(cart)
"OK".to_json
Cart.find_or_create(anonymous, user)
report_to_trello(cart)
send_order_email(cart)
'OK'.to_json
end
get '/pikpay/confirmation' do
anonymous = params["anonymous_id_string"]
user = params["user_id"]
user ||= -1
user = user.to_i
anonymous = params['anonymous_id_string']
user = params['user_id']
user ||= -1
user = user.to_i
cart = Cart.just_find(anonymous, user)
if cart.item_in_carts.length > 0
cart.ordered = true
cart.save!
end
cart = Cart.just_find(anonymous, user)
if cart.item_in_carts.length > 0
cart.ordered = true
cart.save!
end
Cart.find_or_create(anonymous, user)
#report_to_trello(cart)
send_order_email(cart)
Cart.find_or_create(anonymous, user)
report_to_trello(cart)
send_order_email(cart)
redirect "#{RibicaConfig::ROOT_ADDRESS}/hvala"
redirect "#{RibicaConfig::ROOT_ADDRESS}/hvala"
end

View File

@@ -1,4 +1,3 @@
<%
dd = @cart.delivery_destination
c = @cart
@@ -9,51 +8,43 @@
**Adresa:**
<%= dd.address %>
<%= dd.place.to_s.strip %> <%= Place.name_from_code(dd.place.to_s) %>
Bosna i Hercegovina
**Email: **<%= dd.email %>
**Email:** <%= dd.email %>
**Telefon: ** +387 <%= dd.phone %>
**Telefon:** +387 <%= dd.phone %>
**Plaćanje: ** <%= dd.get_payment_string %>
**Plaćanje:** <%= dd.get_payment_string %>
**Napomena:**
**Napomena: **
<%= dd.note %>
<% if dd.gift %>
**Poklon **
**Name: **<%= dd.recipient_name %>
**Postal code: **<%= dd.recipient_postal_code %>
**Place: **<%= dd.recipient_place %>
**Address: **<%= dd.recipient_address %>
**Phone: **<%= dd.recipient_phone %>
**Email: **<%= dd.recipient_email %>
**Poklon** **Name:** <%= dd.recipient_name %>
**Postal code:** <%= dd.recipient_postal_code %>
**Place:** <%= dd.recipient_place %>
**Address:** <%= dd.recipient_address %>
**Phone:** <%= dd.recipient_phone %>
**Email:** <%= dd.recipient_email %>
<% end %>
<% if dd.instant_delivery %>
**Naručeno:** <%= @cart.updated_at.in_time_zone("Europe/Sarajevo").strftime("%A %d.%m.%Y. %H:%M") %>
**Naručeno:**
<%= @cart.updated_at.in_time_zone("Europe/Sarajevo").strftime("%A %d.%m.%Y. %H:%M") %>
<% end %>
<% if dd.instant_delivery %>
** OVO JE NARUDŽBA ZA INSTANT DOSTAVU **
<% end %>
<% @cart.item_in_carts.each do |iic| %>
**<%= iic.item.code %> <%= iic.item.name %>**
**<%= iic.count %>** x <%= Helper.money(iic.price) %> = <%= Helper.money(iic.count * iic.price) %>
<% end %>
Dostava
1 x <%= Helper.money(c.delivery_cost) %> = <%= Helper.money(c.delivery_cost) %>
**UKUPNO:** <%= Helper.money(c.total) %>
[Pogledati OVAJ LINK](https://www.ribica.ba/backoffice/carts/<%= @cart.id %>)

View File

@@ -19,9 +19,9 @@ var NewsletterSweepstake = React.createClass({
<h1 className="normal-message">Novosti i sniženja</h1>
<p className="normal-message">Prijavite se na naše novosti i saznajte sve o najnovijim sniženjima i ponudama na Ribici!</p>
<p className="normal-message"><strong>I ovaj put - najsretnije očekuju vrijedne Disney Frozen nagrade!</strong> <br /></p>
<p className="normal-message"><strong>I ovaj put - najsretnije očekuju vrijedne Lego i Disney Frozen nagrade nagrade!</strong> <br /></p>
<p className="normal-message">Pobjednike objavljujemo u našim email novostima u Ponedjeljak, 7.12.2015. </p>
<p className="normal-message">Pobjednike objavljujemo u našim email novostima u Nedjelju, 7.2.2016. </p>
<p style={{"textAlign": "center"}}>

View File

@@ -102,7 +102,7 @@ var CheckoutPage = React.createClass({
</div>
</div>
<div className="form-group ">
<label className="col-md-4 control-label" htmlFor="note">Napomena</label>
<label className="col-md-4 control-label" htmlFor="note">Napomena (poruka, ili broj nagradnog kupona)</label>
<div className="col-md-4">
<textarea className="form-control" id="note" name="note" value={this.state.deliveryDestination.get('note')} onChange={this._onFieldChange} ></textarea>
</div>
@@ -118,7 +118,7 @@ var CheckoutPage = React.createClass({
</div>
<br />
<div className="checkbox">
<label><input type="checkbox" name="gift" checked={this.state.deliveryDestination.get('gift')} onChange={this._onFieldChange} />Poklon</label>
<label><input type="checkbox" name="gift" checked={this.state.deliveryDestination.get('gift')} onChange={this._onFieldChange} />Poklon (plaćanje samo preko Paypal-a)</label>
</div>
</div>
</div>

View File

@@ -11,6 +11,8 @@ var SingleItem = React.createClass({
var hidePrice = this.props.hidePrice || false;
var self = this;
var itemClick = this.itemClick;
var stopPropagation = this.stopPropagation;
var itemUrl = NavigationStore.getUrlForItem(this.props.item);
var firstImage = this.props.item.get('multi_media_descriptions')[0];
firstImage = firstImage || { resized_url: "https://res.cloudinary.com/lfvt7ps2n/image/upload/c_fit,h_172,w_226/v1421732950/http_www.asms.ru_bitrix_templates_main_images_nophoto_irnofq.png" } ;
if (hidePrice) {
@@ -29,7 +31,7 @@ var SingleItem = React.createClass({
}
else {
return (
<a href={itemUrl} onClick={stopPropagation}>
<div className="col-lg-3 col-md-3 col-sm-4 col-xs-6" onClick={itemClick}>
<div className="productbox">
<img className="img-responsive" src={firstImage.resized_url} alt="product image" />
@@ -40,14 +42,22 @@ var SingleItem = React.createClass({
</div>
</div>
</div>
</a>
);
}
},
},
stopPropagation: function(e){
e.stopPropagation();
e.nativeEvent.stopImmediatePropagation();
return false;
},
itemClick: function(e) {
NavigationActions.goToItemDetails(this.props.item);
}
});

View File

@@ -20,6 +20,16 @@ var MenuItemListComponent = React.createClass({
}
},
menuItemUrl: function(menuItem) {
var url = "#"
if (menuItem.get) {
url = menuItem.get('url');
} else {
url = menuItem.url;
}
return url;
},
getInitialState: function() {
var state = MenuItemStore.getState();
var cartState = CartStore.getWholeCartState();
@@ -44,6 +54,7 @@ var MenuItemListComponent = React.createClass({
MenuItemActions.unsetMenuItemHover();
NavigationActions.goToMenuItem(menuItem);
e.preventDefault();
return false;
},
_onCartClick: function(e) {
NavigationActions.goToCart();
@@ -74,7 +85,7 @@ var MenuItemListComponent = React.createClass({
<span className="icon-bar" />
<span className="icon-bar" />
</button>
</div>
<div className="navbar-collapse collapse">
<ul className="nav navbar-nav hidden-sm hidden-xs ">
@@ -121,16 +132,16 @@ var MenuItemListComponent = React.createClass({
{this.state.menuItems.map(function(menuItem) {
return <li className="mydropdown menu-large" onMouseLeave={self.onMouseOut} onMouseOver={self.onMouseOver.bind(self, menuItem)}>
<a href="#" className="dropdown-toggle " id={menuItem.get('title').toLowerCase().replace(/\s+/g, '')} onClick={self.onMenuItemClick.bind(self, menuItem)} >{menuItem.get('title')}</a>
<a href={self.menuItemUrl(menuItem)} className="dropdown-toggle " id={menuItem.get('title').toLowerCase().replace(/\s+/g, '')} onClick={self.onMenuItemClick.bind(self, menuItem)} >{menuItem.get('title')}</a>
<ul className={menuItem.get('id') !== self.state.hoveredMenuItem ? "dropdown-menu megamenu row hide": "dropdown-menu megamenu row"}>
{menuItem.get('menu_sub_items').map(function(menuSubItem) {
return (
<li className="col-sm-3" key={menuSubItem.id}>
<ul>
<li className="dropdown-header"><a href="#" onClick={self.onMenuItemClick.bind(self, menuSubItem)}><p>{menuSubItem.title}</p></a></li>
<li className="dropdown-header"><a href={self.menuItemUrl(menuSubItem)} onClick={self.onMenuItemClick.bind(self, menuSubItem)}><p>{menuSubItem.title}</p></a></li>
{menuSubItem.menu_sub_sub_items.map(function(menuSubSubItem) {
return (<li><a href="#" onClick={self.onMenuItemClick.bind(self, menuSubSubItem)}>{menuSubSubItem.title}</a></li>)
return (<li><a href={self.menuItemUrl(menuSubSubItem)} onClick={self.onMenuItemClick.bind(self, menuSubSubItem)}>{menuSubSubItem.title}</a></li>)
})}
</ul>
</li>
@@ -189,7 +200,7 @@ var MenuItemListComponent = React.createClass({
*/}
{this.state.menuItems.map(function(menuItem) {
return <li className="dropdown menu-large">
<a href="#" className="dropdown-toggle " data-toggle="dropdown" role="button" aria-expanded="false">
<a href={self.menuItemUrl(menuItem)} className="dropdown-toggle " data-toggle="dropdown" role="button" aria-expanded="false">
{menuItem.get('title')} <b className="caret" /> </a>
<ul className="dropdown-menu megamenu row">
@@ -198,9 +209,9 @@ var MenuItemListComponent = React.createClass({
<li className="col-sm-3" key={menuSubItem.id}>
<ul>
<li className="dropdown-header"><a href="#" onClick={self.onMenuItemClick.bind(self, menuSubItem)}><p>{menuSubItem.title}</p></a></li>
<li className="dropdown-header"><a href={self.menuItemUrl(menuSubItem)} onClick={self.onMenuItemClick.bind(self, menuSubItem)}><p>{menuSubItem.title}</p></a></li>
{menuSubItem.menu_sub_sub_items.map(function(menuSubSubItem) {
return (<li><a href="#" onClick={self.onMenuItemClick.bind(self, menuSubSubItem)}>{menuSubSubItem.title}</a></li>)
return (<li><a href={self.menuItemUrl(menuSubSubItem)} onClick={self.onMenuItemClick.bind(self, menuSubSubItem)}>{menuSubSubItem.title}</a></li>)
})}
</ul>
</li>

View File

@@ -41,7 +41,7 @@ var SearchBox = React.createClass({
}
},
render: function() {
var large = (<form style={ {marginLeft: '60px', width: '100%'} } className="form-inline">
var large = (<form onSubmit={this.onSearchClick} style={ {marginLeft: '60px', width: '100%'} } className="form-inline">
<div className="left-inner-addon">
<i className="glyphicon glyphicon-search"></i>
<input style={{width: '75%'}} type="search" onKeyPress={this.onKeyPress}
@@ -57,7 +57,7 @@ var SearchBox = React.createClass({
</div>
</form>);
var small = (<form className="form-inline">
var small = (<form onSubmit={this.onSearchClick} className="form-inline">
<span className="left-inner-addon">
<i style={{positon: "absolute", zIndex: "600" }} className="glyphicon glyphicon-search"></i>
<input style={{ width: "100%"}} type="search" onKeyPress={this.onKeyPress}
@@ -67,10 +67,10 @@ var SearchBox = React.createClass({
</input>
</span>
</form>);
</form>);
if (this.props.small === 'true') {
return small;
return small;
}
else {
return large;

View File

@@ -19,7 +19,6 @@ var StartPage = React.createClass({
<AllItemsInGroup />
<h2>Preporučeno</h2>
<RandomItems />
</div>
<GAInitiailizer />
</div>

View File

@@ -29,6 +29,9 @@ module.exports = {
PikpayKey: "Ribica",
Slugify: function(text) {
if(!text) {
text = "";
}
return text.toString().toLowerCase()
.replace(/š/g,'s')
.replace(/[čć]/g,'c')

View File

@@ -53,8 +53,13 @@ var NavigationStore = _.extend({}, EventEmitter.prototype, {
} else {
return false;
}
},
getUrlForItem: function(item) {
return '/artikal/' + item.get('id') +'/' + Globals.Slugify(item.get('name'))
}
});
@@ -84,4 +89,4 @@ NavigationStore.dispatchToken = AppDispatcher.register(function(payload) {
});
module.exports = NavigationStore;
module.exports = NavigationStore;

View File

@@ -0,0 +1,2 @@
User-agent: *
Disallow: