Commit 1f60dffe authored by Leo Iannacone's avatar Leo Iannacone

removed local data from update and populate

parent eae8dc7a
...@@ -216,49 +216,38 @@ function Page_Distrubion() ...@@ -216,49 +216,38 @@ function Page_Distrubion()
} }
var update = { var update = {
page: function(data, old_data) { page: function(old_data) {
if (! old_data ) { if ( ! old_data
if (! data ) || ! Utils.check_data_distribution(old_data)
populate() || ! Utils.check_data_distribution(data)
else || data.distribution.name != old_data.distribution.name
populate(data)
return;
}
else {
if (! Utils.check_data_distribution(old_data) ||
! Utils.check_data_distribution(data) ||
data.distribution.name != old_data.distribution.name)
{
clean()
populate(data)
return
}
else if (
! Utils.check_data_package(old_data) ||
! Utils.check_data_package(data) ||
data.package.orig_name != old_data.package.orig_name )
{
file.clean()
files.get()
if (Utils.check_data_package(data)) {
// I will always get dataestamp from package
window.location.hash += '/datestamp'
}
}
else if (
! Utils.check_data_file(old_data) ||
! Utils.check_data_file(data) ||
data.file.name != old_data.file.name
) )
{ { // new distribution view
file.get() populate()
return
}
else if ( ! Utils.check_data_package(old_data)
|| ! Utils.check_data_package(data)
|| data.package.orig_name != old_data.package.orig_name
)
{ // new pacakge view
file.clean()
files.get()
if (Utils.check_data_package(data)) {
// I will always get dataestamp from package
window.location.hash += '/datestamp'
} }
update.view(data)
} }
else if ( ! Utils.check_data_file(old_data)
|| ! Utils.check_data_file(data)
|| data.file.name != old_data.file.name
)
{ // new file view
file.get()
}
update.view(data)
}, },
view : function(data) { view : function() {
if (! data )
data = Utils.from_hash_to_data()
title.set() title.set()
breadcrumb.update() breadcrumb.update()
select() select()
...@@ -266,14 +255,12 @@ function Page_Distrubion() ...@@ -266,14 +255,12 @@ function Page_Distrubion()
} }
} }
var populate = function (data) { var populate = function () {
clean() clean()
if (! data )
data = Utils.from_hash_to_data()
packages.get() packages.get()
files.get() files.get()
file.get() file.get()
update.view(data) update.view()
} }
this.init = function (mysocket) { this.init = function (mysocket) {
...@@ -300,12 +287,12 @@ function Page_Distrubion() ...@@ -300,12 +287,12 @@ function Page_Distrubion()
__check_hash_makes_sense() __check_hash_makes_sense()
var old_data = data var old_data = data
data = Utils.from_hash_to_data() data = Utils.from_hash_to_data()
update.page(data, old_data) update.page(old_data)
}); });
$(window).on('load', function (){ $(window).on('load', function (){
__check_hash_makes_sense() __check_hash_makes_sense()
populate(data) populate()
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment