Skip to content

Instantly share code, notes, and snippets.

@hansv
Created July 7, 2011 14:07
Show Gist options
  • Save hansv/1069585 to your computer and use it in GitHub Desktop.
Save hansv/1069585 to your computer and use it in GitHub Desktop.
function loadCatalog () {
<%- @products.each do |product| -%>
storeProduct([0, <%= product.id %>, "", "<%= product.bon_name %>", "<%= product.article_number %>", <%= product.unit_price %>, <%= product.price %>, <%= product.slide? %>,0]);
<%- end -%>
<% @catalog.each do |catalog| -%>
<%- catalog.productgroups.slide.each do |productgroup| -%>
<%- unless productgroup.nil? %>
<%- productgroup.products.active.each do |product| -%>
<%- if product.slide? -%>
storeProduct([<%= productgroup.id %>, <%= product.id %>, "<%= product.name %>", "<%= product.bon_name %>", "<%= product.article_number %>", <%= product.unit_price %>, <%= product.price %>, <%= product.slide? %>, <%= 0 %>]);
<%- end -%>
<%- end -%>
storeProductgroup([<%= catalog.id %>, <%= productgroup.id %>, "<%= productgroup.name %>", "<%= productgroup.getSlideImg %>", <%= 0 %>, "productgroup.description_nl"]);
<%- end -%>
<%- end -%>
storeCatalog([<%= catalog.id %>, "<%= catalog.name %>", "<%= catalog.slide_extra_nl %>", "<%= catalog.ancestry %>", <%= catalog.position %>]);
<%- end -%>
systemDB.transaction(
function (tx) {
tx.executeSql('select count(*) from clients;', [], function(transaction, results) {
if (confirm('syncing done, go to offline version?')) {
document.location = '/offline/#/';
}
}
);
}
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment