From 32a89b0c758316d0173b5c855a4874d1037fd158 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Sat, 10 Dec 2011 04:45:42 +0100 Subject: [PATCH 1/2] fix fork button --- server/assets/js/helpers.js | 3 ++- server/model.rb | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/server/assets/js/helpers.js b/server/assets/js/helpers.js index 30493a7..04d13d1 100644 --- a/server/assets/js/helpers.js +++ b/server/assets/js/helpers.js @@ -102,13 +102,14 @@ function save() { if(am_i_owner()) data["code_id"]=window.location.hash.substr(1); else { - data["parent"]=window.location.pathname; + data["parent"]=window.location.hash.substr(1); } $.post(loc, JSON.stringify(data), function(result) { window.location.replace('/e#'+result); + load_url_code(); }, "text"); } diff --git a/server/model.rb b/server/model.rb index e0356e3..64b016a 100644 --- a/server/model.rb +++ b/server/model.rb @@ -105,9 +105,9 @@ def save_new_effect(code) } if code_data['parent'] - m=code_data['parent'].match(%r{^/(\d+)(/(\d+))?}) + m=code_data['parent'].match(%r{^(\d+)(\.(\d+))?}) data[:parent] = m[1].to_i if m - data[:parent_version] = m[3].to_i if m[3] + data[:parent_version] = m[3].to_i if m && m[3] end @code.insert(data) From c0e8d868597108fa115c4bd11f8b51ee6b844c9a Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Sat, 10 Dec 2011 04:50:33 +0100 Subject: [PATCH 2/2] fix parent button --- server/assets/js/helpers.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/assets/js/helpers.js b/server/assets/js/helpers.js index 04d13d1..99e1635 100644 --- a/server/assets/js/helpers.js +++ b/server/assets/js/helpers.js @@ -121,6 +121,9 @@ function load_code(hash) { if(result['parent']) { original_version=result['parent']; set_parent_button('visible'); + } else { + original_version=''; + set_parent_button('hidden'); } effect_owner=result['user'];