diff --git a/css/DMSMainCMS.css b/css/DMSMainCMS.css index 033f3b5..da99a54 100644 --- a/css/DMSMainCMS.css +++ b/css/DMSMainCMS.css @@ -19,7 +19,7 @@ #Main_FromtheCMS .document-add-existing .treedropdownfield-toggle-panel-link { padding: 5px 9px 9px; } #Main_FromtheCMS .document-add-existing .treedropdownfield-title { width: auto; } #Main_FromtheCMS .document-add-existing .treedropdownfield-toggle-panel-link a { display: inline-block; top: 4px; position: relative; } -#Main_FromtheCMS .document-add-existing .document-list { position: absolute; z-index: 9999; width: 386px; border: 1px solid #DDD; background: #ffffff; box-shadow: 0 2px 4px 1px #DDD; max-height: 300px; overflow: scroll; } +#Main_FromtheCMS .document-add-existing .document-list { position: absolute; z-index: 9999; width: 386px; border: 1px solid #DDD; background: #ffffff; display: none; box-shadow: 0 2px 4px 1px #DDD; max-height: 300px; overflow: scroll; } #Main_FromtheCMS .document-add-existing .document-list ul li { display: block; line-height: 18px; padding: 4px 8px; border: 1px solid #FFF; } #Main_FromtheCMS .document-add-existing .document-list ul li:hover { border: 1px solid #CCC; border-radius: 4px; background: rgba(203, 203, 203, 0.4); } diff --git a/javascript/DMSDocumentAddExistingField.js b/javascript/DMSDocumentAddExistingField.js index 4da899b..1c237b0 100644 --- a/javascript/DMSDocumentAddExistingField.js +++ b/javascript/DMSDocumentAddExistingField.js @@ -52,72 +52,25 @@ } }); - // TODO - If the treedropdown field is open then disable the search field - // else, make this search field enabled - $('.document-add-existing .TreeDropdownField').entwine({ - onmatch: function(event) { - // Not really sure what var self = this does, but thought it looked cool :) - var self = this; - console.log('Ive found you'); - // If dropdownfield-panel is visible - if ($(this).find('.treedropdownfield-panel').is(':visible')) { - // Add border for testing - $(this).css('border', '2px solid blue'); - // Then disable search field - self.closest('.document-add-existing').find('.document-autocomplete').prop('disabled', true); - console.log('Disabling'); - } - else{ - // Add border colour for testing purposes only - self.css('border', '2px solid red'); - // Enable search field - $(this).closest('.document-add-existing').find('.document-autocomplete').prop('disabled', false); - console.log('Ok you can work'); - } - } - }); - - //These are some test but I don't think they work or accomplish the function that I want - - // When clicking on the tree dropdown button - // Disable the search input -/* $('.treedropdownfield-toggle-panel-link').entwine({ - onclick: function() { - //$(this).closest('.document-add-existing').find('.document-autocomplete').addClass('disable'); - $(this).closest('.document-add-existing').find('.document-autocomplete').prop('disabled', true); - } - });*/ - -/* $('.treedropdownfield-toggle-panel-link').entwine({ - onclick: function() { - var self = this; - - if ($(this).hasClass('treedropdownfield-open-tree')) { - $(this).css('border', '2px solid blue'); - self.closest('.document-add-existing').find('.document-autocomplete').prop('disabled', true); - console.log('Disabling'); - } - else{ - self.css('border', '2px solid red'); - $(this).closest('.document-add-existing').find('.document-autocomplete').prop('disabled', false); - console.log('Ok you can work'); - } - } - });*/ - // TODO - This will become redundant if the above function works // When clicking on the search input this removes the disabled state - $('.document-add-existing .document-autocomplete').entwine({ + $('.document-add-existing .treedropdownfield-toggle-panel-link').entwine({ onclick: function() { - this.removeClass('disable'); + $(this).closest('.document-add-existing').find('input.document-autocomplete').prop('disabled', true); } }); //TODO - When documents load in the document list. Toggle the visibilty of this. By default it should be hidden $('.document-add-existing input[name=PageSelector]').entwine({ onchange: function(event) { - $(this).closest('.document-add-existing').find('.document-list').load('admin/pages/adddocument/documentlist?pageID=' + $(this).val()); - $(this).closest('.document-add-existing').find('.document-list').toggle(); + $(this).closest('.document-add-existing').find('.document-list').load( + 'admin/pages/adddocument/documentlist?pageID=' + $(this).val(), + null, + function () { + $(this).show(); + } + ); + } }); @@ -126,6 +79,8 @@ var document_id = $(this).data('document-id'); $(this).closest('.document-add-existing').adddocument(document_id); + $(this).closest('.document-list').hide(); + $(this).closest('.document-add-existing').find('input.document-autocomplete').prop('disabled', false); return false; } diff --git a/scss/DMSMainCMS.scss b/scss/DMSMainCMS.scss index 83dae8a..818b0dc 100644 --- a/scss/DMSMainCMS.scss +++ b/scss/DMSMainCMS.scss @@ -91,7 +91,7 @@ $gf_colour_zebra: #F0F4F7; width: 386px; border: 1px solid #DDD; background: #ffffff; - //display: none; + display: none; box-shadow:0 2px 4px 1px #DDD; max-height:300px; overflow:scroll;