Browse Source

Removed notice about tripal_ds with ajax loading

Stephen Ficklin 6 years ago
parent
commit
10d96c7879

+ 0 - 14
tripal/includes/TripalBundleUIController.inc

@@ -256,20 +256,6 @@ function tripal_tripal_bundle_form($form, &$form_state, $entityDataType) {
     '#weight' => 10,
   );
 
-  // Add ajax support only if tripal_ds is enabled
-  if(!module_exists('tripal_ds')){
-
-    $form['tripalds disclaimer'] = array(
-      '#type' => 'markup',
-      '#markup' => '<div class="messages warning">
-        Hiding fields and loading fields using AJAX requires the Tripal DS module.
-        Please enabled it if you would like this functionality</div>',
-      '#weight' => 8,
-    );
-    $form['hide_empty_field']['#disabled'] = TRUE;
-    $form['ajax_field']['#disabled'] = TRUE;
-  }
-
   $form['additional_settings'] = array(
     '#type' => 'vertical_tabs',
     '#weight' => 99,

+ 0 - 1
tripal/includes/tripal.entity.inc

@@ -551,7 +551,6 @@ function tripal_entity_view($entity, $type, $view_mode, $langcode) {
       if ($hide_empty and !$load_via_ajax) {
         $field = field_info_field($instance['field_name']);
         $items = field_get_items('TripalEntity', $entity, $child_name);
-        
         if (tripal_field_is_empty($field, $items)) {
           unset($entity->content[$child_name]);
         }

+ 14 - 3
tripal/theme/js/tripal.js

@@ -65,10 +65,11 @@
   }
   
   /**
-   * Removes the pan from the HTML of the page.
+   * Removes the pane from the HTML of the page.
    */
   TripalPane.prototype.remove = function() {
-	var pane = $('#' + this.id);
+	// Remove the Pane's fieldset
+	var pane = $('.tripal_pane-fieldset-' + this.id);
     pane.remove();
     
     // Remove the pane's title from the TOC.
@@ -175,8 +176,18 @@
    * @return {String|null}
    */
   TripalAjaxField.prototype.getPane = function () {
+	  
+	// Get the pane for this field.
 	var field = $('#' + this.id);
-	var classes = field.parents('.tripal_pane').first().attr('class').split(' ');
+	var pane = field.parents('.tripal_pane')
+	
+	// If the field is not in a pane then just return.
+	if (pane.length == 0) {
+	  return null;
+	}
+	
+	// Get further details about the pane.
+	var classes = pane.first().attr('class').split(' ');
     var sub_length = 'tripal_pane-fieldset-'.length;
     var pane_id = null;
 

+ 1 - 0
tripal_ds/theme/js/tripal_ds.js

@@ -34,6 +34,7 @@
           }
         });
       });
+      
       // Move the tripal pane to the first position when its TOC item is clicked.
       $('.tripal_pane-toc-list-item-link').each(function (i) {
         var id = '.tripal_pane-fieldset-' + $(this).attr('id');