Mercurial > kallithea
changeset 4292:60ea826baf09
compare: disable compare button until revisions have been selected
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Fri, 18 Jul 2014 18:44:54 +0200 |
parents | c2e3923eebe4 |
children | 6c1bd918a789 |
files | kallithea/templates/compare/compare_diff.html |
diffstat | 1 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/templates/compare/compare_diff.html Fri Jun 28 11:50:13 2013 +0200 +++ b/kallithea/templates/compare/compare_diff.html Fri Jul 18 18:44:54 2014 +0200 @@ -173,17 +173,33 @@ }, }); + var values_changed = function() { + var values = $('#compare_org').select2('data') && $('#compare_other').select2('data'); + if (values) { + $('#compare_revs').removeClass("disabled"); + // TODO: the swap button ... if any + } else { + $('#compare_revs').addClass("disabled"); + // TODO: the swap button ... if any + } + } + values_changed(); + $('#compare_org').change(values_changed); + $('#compare_other').change(values_changed); $('#compare_revs').on('click', function(e){ var org = $('#compare_org').select2('data'); var other = $('#compare_other').select2('data'); + if (!org || !other) { + return; + } var compare_url = "${h.url('compare_url',repo_name=c.repo_name,org_ref_type='__other_ref_type__',org_ref_name='__org__',other_ref_type='__org_ref_type__',other_ref_name='__other__', other_repo=c.other_repo.repo_name)}"; var u = compare_url.replace('__other_ref_type__',org.type) .replace('__org__',org.text) .replace('__org_ref_type__',other.type) .replace('__other__',other.text); - window.location=u; - }) + window.location = u; + }); }); </script> </%def>