diff options
author | emkael <emkael@tlen.pl> | 2019-08-01 14:16:52 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-08-01 14:19:26 +0200 |
commit | 2cf067473e78844aa616de98bcf0cfcadada2431 (patch) | |
tree | d28970628cd8b4ad0b07607606bf498d97377294 /http | |
parent | 05d8c2a8b6801533144e1c0aa7e550ec44e0d946 (diff) |
DD hand analysis optional in API version
Fixes #3
Diffstat (limited to 'http')
-rw-r--r-- | http/api/api.py | 1 | ||||
-rw-r--r-- | http/dealconvert.js | 10 | ||||
-rw-r--r-- | http/index.html | 4 |
3 files changed, 14 insertions, 1 deletions
diff --git a/http/api/api.py b/http/api/api.py index 6a9a785..0e5da8d 100644 --- a/http/api/api.py +++ b/http/api/api.py @@ -102,6 +102,7 @@ def handle_upload(response, request): output_id, output_path = _get_file_id() token = _get_rand_string(16) output_buffer = StringIO() + output.analyze = params.get('analyze_deals', False) output.output_content(output_buffer, dealset) with file(output_path, 'w') as output_file: json.dump({ diff --git a/http/dealconvert.js b/http/dealconvert.js index 2478fe9..ab8e90b 100644 --- a/http/dealconvert.js +++ b/http/dealconvert.js @@ -3,8 +3,14 @@ $(document).ready(function() { $('input[name="output"]').change(function() { if ($('input[name="output"]:checked').length > 0) { $('#submit-btn').removeAttr('disabled'); + if ($('input[name="output"][value="pbn"]').is(':checked')) { + $('#analyze-boards').removeAttr('disabled'); + } else { + $('#analyze-boards').attr('disabled', 'disabled').prop('checked', false); + } } else { $('#submit-btn').attr('disabled', 'disabled'); + $('#analyze-boards').attr('disabled', 'disabled').prop('checked', false); } }); $('#input-files').change(function() { @@ -17,6 +23,7 @@ $(document).ready(function() { output.push(this.value); }); var display = that.find('input[name="display"]').is(':checked'); + var analyze = that.find('input[name="analyze"]').is(':checked'); var files = {}; var formFiles = this['input-files'].files; if (formFiles.length) { @@ -42,7 +49,8 @@ $(document).ready(function() { 'name': file, 'content': files[file], 'output': output, - 'display_deals': display + 'display_deals': display, + 'analyze_deals': analyze }; $.ajax( 'api/upload/', diff --git a/http/index.html b/http/index.html index c43a2ac..51c6b34 100644 --- a/http/index.html +++ b/http/index.html @@ -149,6 +149,10 @@ <input class="form-check-input" type="checkbox" name="display" value="yes" id="display-boards" /> <label class="form-check-label" for="display-boards">Wyświetl podgląd rozkładów</label> </div> + <div class="form-check-inline"> + <input class="form-check-input" type="checkbox" name="analyze" value="yes" id="analyze-boards" disabled="disabled" /> + <label class="form-check-label" for="analyze-boards">Przeanalizuj rozkłady w widne</label> + </div> </div> </form> </div> |