Browse Source

Use bootstrap tab instead of jquery-ui.

Julio Montoya 10 years ago
parent
commit
ac6f010ebe

+ 1 - 1
main/document/upload.php

@@ -78,8 +78,8 @@ $(function () {
             return $('<tr><td>' + file.name + '<\/td> <td> ' + file.size + ' <\/td>  <td>&nbsp;' + file.result + ' <\/td> <\/tr>');
         }
     });
-    $('#tabs').tabs();
 });
+
 </script>";
 
 // Variables

+ 21 - 6
main/inc/lib/display.lib.php

@@ -1018,21 +1018,36 @@ class Display
         $lis = '';
         $i = 1;
         foreach ($header_list as $item) {
-            $item =self::tag('a', $item, array('href'=>'#'.$id.'-'.$i));
-            $lis .=self::tag('li', $item, $ul_attributes);
+            $active = '';
+            if ($i == 1) {
+                $active = ' active';
+            }
+            $item = self::tag('a', $item, array('href'=>'#'.$id.'-'.$i, 'role'=> 'tab'));
+            $ul_attributes['data-toggle'] = 'tab';
+            $ul_attributes['role'] = 'presentation';
+            $ul_attributes['class'] = $active;
+            $lis .= self::tag('li', $item, $ul_attributes);
             $i++;
         }
-        $ul = self::tag('ul',$lis);
+        $ul = self::tag('ul', $lis, ['class' => 'nav nav-tabs', 'role'=> 'tablist']);
 
         $i = 1;
         $divs = '';
         foreach ($content_list as $content) {
-            $content = self::tag('p',$content);
-            $divs .=self::tag('div', $content, array('id'=>$id.'-'.$i));
+            $active = '';
+            if ($i == 1) {
+                $active = ' active';
+            }
+            $divs .= self::tag('div', $content, array('id'=> $id.'-'.$i, 'class' => 'tab-pane '.$active, 'role' => 'tabpanel'));
             $i++;
         }
+
         $attributes['id'] = $id;
-        $main_div = self::tag('div',$ul.$divs, $attributes);
+        $attributes['role'] = 'tabpanel';
+        $attributes['class'] = 'tab-wrapper';
+
+        $main_div = self::tag('div', $ul.self::tag('div', $divs, ['class' => 'tab-content']), $attributes);
+
         return $main_div ;
     }
 

+ 4 - 8
main/newscorm/lp_add_item.php

@@ -48,9 +48,6 @@ $(function() {
             load_cbo($(\'#idParent\').val());
         }
     }
-    //Loads LP item tabs
-
-    $("#resource_tab").tabs();
     $(\'.lp_resource_element\').click(function() {
         window.location.href = $(\'a\', this).attr(\'href\');
     });
@@ -99,14 +96,14 @@ $interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=$learnpa
 
 switch ($type) {
     case 'chapter':
-        $interbreadcrumb[]= array ('url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$learnPath->get_id(), 'name' => get_lang('NewStep'));
-        $interbreadcrumb[]= array ('url' => '#', 'name' => get_lang('NewChapter'));
+        $interbreadcrumb[]= array('url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$learnPath->get_id(), 'name' => get_lang('NewStep'));
+        $interbreadcrumb[]= array('url' => '#', 'name' => get_lang('NewChapter'));
         break;
     case 'document':
-        $interbreadcrumb[]= array ('url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$learnPath->get_id(), 'name' => get_lang('NewStep'));
+        $interbreadcrumb[]= array('url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$learnPath->get_id(), 'name' => get_lang('NewStep'));
         break;
     default:
-        $interbreadcrumb[]= array ('url' => '#', 'name' => get_lang('NewStep'));
+        $interbreadcrumb[]= array('url' => '#', 'name' => get_lang('NewStep'));
         break;
 }
 
@@ -194,7 +191,6 @@ if (in_array($message, array('ItemUpdated'))) {
 }
 
 if (isset($new_item_id) && is_numeric($new_item_id)) {
-
     switch ($type) {
         case 'chapter':
             echo $learnPath->display_manipulate($new_item_id, $_POST['type']);

+ 7 - 0
main/template/default/layout/footer.tpl

@@ -90,6 +90,13 @@
         $.datepicker.setDefaults($.datepicker.regional["{{ locale }}"]);
         $.datepicker.regional["local"] = $.datepicker.regional["{{ locale }}"];
 
+        $('.tab-wrapper a').click(function (e) {
+            e.preventDefault()
+            $(this).tab('show');
+
+            //$('#tabs a:first').tab('show') // Select first tab
+        })
+
         /**
          * Advanced options
          * Usage