Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jfontan/glsl-sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
emackey committed Dec 10, 2011
2 parents 5071dde + c0e8d86 commit f3f1688
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion server/assets/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,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");
}

Expand All @@ -122,6 +123,9 @@ function load_code(hash) {
original_version=result['parent'];
parentButton.href = original_version;
set_parent_button('visible');
} else {
original_version='';
set_parent_button('hidden');
}

effect_owner=result['user'];
Expand Down
4 changes: 2 additions & 2 deletions server/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f3f1688

Please sign in to comment.