From f29791701ebede19974f5d02a4584fb4e5d8e3a2 Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Mon, 14 Jul 2014 13:06:46 -0400
Subject: [PATCH] Commited some work in progress files. Apologies. Watch your
 commit flags kids.

---
 .../src/VuFindTheme/Initializer.php           |  2 +-
 .../src/VuFindTheme/ResourceContainer.php     | 98 +++----------------
 .../View/Helper/HeadThemeResources.php        |  6 +-
 themes/bootprint3/less/icons.less             |  2 +-
 themes/bootstrap3/less/bootstrap.less         |  5 -
 themes/bootstrap3/theme.config.php            |  6 +-
 6 files changed, 23 insertions(+), 96 deletions(-)

diff --git a/module/VuFindTheme/src/VuFindTheme/Initializer.php b/module/VuFindTheme/src/VuFindTheme/Initializer.php
index a0185b7b495..36035ee2481 100644
--- a/module/VuFindTheme/src/VuFindTheme/Initializer.php
+++ b/module/VuFindTheme/src/VuFindTheme/Initializer.php
@@ -341,7 +341,7 @@ class Initializer
                 $resources->addLessCss($currentThemeInfo['less']);
             }
             if (isset($currentThemeInfo['scss'])) {
-                $resources->addScssCss($currentThemeInfo['scss']);
+                $resources->addSassCss($currentThemeInfo['scss']);
             }
             if (isset($currentThemeInfo['css'])) {
                 $resources->addCss($currentThemeInfo['css']);
diff --git a/module/VuFindTheme/src/VuFindTheme/ResourceContainer.php b/module/VuFindTheme/src/VuFindTheme/ResourceContainer.php
index 9a06ac11646..213e491e2a0 100644
--- a/module/VuFindTheme/src/VuFindTheme/ResourceContainer.php
+++ b/module/VuFindTheme/src/VuFindTheme/ResourceContainer.php
@@ -44,25 +44,13 @@ class ResourceContainer
      * @var array
      */
     protected $less = array();
+    
     /**
-     * Less CSS active boolean
+     * Sass CSS files
      *
      * @var array
      */
-    protected $lessActive = false;
-
-    /**
-     * scss CSS files
-     *
-     * @var array
-     */
-    protected $scss = array();
-    /**
-     * SCSS CSS active boolean
-     *
-     * @var array
-     */
-    protected $scssActive = false;
+    protected $sass = array();
 
     /**
      * CSS files
@@ -111,35 +99,25 @@ class ResourceContainer
         if (!is_array($less) && !is_a($less, 'Traversable')) {
             $less = array($less);
         }
-        $this->lessActive = !isset($less['active']) || $less['active'] === true;
-        if ($this->lessActive) {
-            unset($less['active']);
-            foreach ($less as $index=>$current) {
-                $this->less[$index] = $current;
-                $this->removeCSS($current);
-            }
+        foreach ($less as $current) {
+            $this->less[] = $current;
         }
     }
 
     /**
-     * Add a scss CSS file.
+     * Add a Sass CSS file.
      *
-     * @param array|string $scss scss CSS file (or array of scss CSS files) to add
+     * @param array|string $sass Sass CSS file (or array of Sass CSS files) to add
      *
      * @return void
      */
-    public function addScssCss($scss)
+    public function addSassCss($sass)
     {
-        if (!is_array($scss) && !is_a($scss, 'Traversable')) {
-            $scss = array($scss);
+        if (!is_array($sass) && !is_a($sass, 'Traversable')) {
+            $sass = array($sass);
         }
-        $this->scssActive = !isset($scss['active']) || $scss['active'] === true;
-        if ($this->scssActive) {
-            unset($scss['active']);
-            foreach ($scss as $index=>$current) {
-                $this->scss[$index] = $current;
-                $this->removeCSS($current);
-            }
+        foreach ($sass as $current) {
+            $this->sass[] = $current;
         }
     }
 
@@ -157,9 +135,7 @@ class ResourceContainer
             $css = array($css);
         }
         foreach ($css as $current) {
-            if (!$this->activeInLess($current) && !$this->activeInScss($current)) {
-                $this->css[] = $current;
-            }
+            $this->css[] = $current;
         }
     }
 
@@ -191,13 +167,13 @@ class ResourceContainer
         return array_unique($this->less);
     }
     /**
-     * Get SCSS CSS files.
+     * Get Sass CSS files.
      *
      * @return array
      */
-    public function getScssCss()
+    public function getSassCss()
     {
-        return array_unique($this->scss);
+        return array_unique($this->sass);
     }
 
     /**
@@ -285,46 +261,4 @@ class ResourceContainer
     {
         return $this->generator;
     }
-
-    /**
-     * Check if a CSS file is being dynamically compiled in LESS
-     *
-     * @return boolean
-     */
-    private function activeInLess($file)
-    {
-        if (empty($this->less) || $this->lessActive === false) {
-            return false;
-        }
-        list($lessFile,) = explode('.', $file);
-        $lessFile .= '.less';
-        return in_array($lessFile, $this->less, true) ? true : false;
-    }
-
-    /**
-     * Check if a CSS file is being dynamically compiled in SCSS
-     *
-     * @return boolean
-     */
-    private function activeInScss($file)
-    {
-        if (empty($this->scss) || $this->scssActive === false) {
-            return false;
-        }
-        list($scssFile,) = explode('.', $file);
-        $scssFile .= '.scss';
-        return in_array($scssFile, $this->scss, true) ? true : false;
-    }
-
-    /**
-     * Check if a CSS file is being dynamically compiled in SCSS
-     *
-     * @return boolean
-     */
-    private function removeCSS($file)
-    {
-        list($name, ) = explode('.', $file);
-        $name .= '.css';
-        unset($this->css[array_search($name, $this->css)]);
-    }
 }
diff --git a/module/VuFindTheme/src/VuFindTheme/View/Helper/HeadThemeResources.php b/module/VuFindTheme/src/VuFindTheme/View/Helper/HeadThemeResources.php
index 3500a2fa4c6..8e274faf518 100644
--- a/module/VuFindTheme/src/VuFindTheme/View/Helper/HeadThemeResources.php
+++ b/module/VuFindTheme/src/VuFindTheme/View/Helper/HeadThemeResources.php
@@ -87,7 +87,7 @@ class HeadThemeResources extends \Zend\View\Helper\AbstractHelper
                 isset($parts[2]) ? trim($parts[2]) : false
             );
         }
-
+        
         // Compile and load LESS (make sure we prepend them in the appropriate order
         // theme resources should load before extras added by individual templates):
         foreach (array_reverse($this->container->getLessCss()) as $current) {
@@ -96,8 +96,8 @@ class HeadThemeResources extends \Zend\View\Helper\AbstractHelper
 
         // Compile and load SASS (make sure we prepend them in the appropriate order
         // theme resources should load before extras added by individual templates):
-        foreach (array_reverse($this->container->getScssCss()) as $current) {
-            $headLink()->addScssStylesheet($current);
+        foreach (array_reverse($this->container->getSassCss()) as $current) {
+            $headLink()->addSassStylesheet($current);
         }
 
         // Load Javascript (same ordering considerations as CSS, above):
diff --git a/themes/bootprint3/less/icons.less b/themes/bootprint3/less/icons.less
index b424c63a927..7b47d305f12 100644
--- a/themes/bootprint3/less/icons.less
+++ b/themes/bootprint3/less/icons.less
@@ -14,7 +14,7 @@
 .fa-x {background-image:url('../../images/icons/page_white.png'); &:extend(.bp-icon);}
 i.fa-archive {background-image:url('../../images/icons/package.png'); &:extend(.bp-icon);}
 i.fa-asterisk {background-image:url('../../images/icons/list.png'); &:extend(.bp-icon);}
-i.fa-atlas {background-image:url('../../images/icons/map.png'); &:extend(.bp-icon);}
+i.fa-atlas          {background-image:url('../../images/icons/map.png'); &:extend(.bp-icon);}
 i.fa-bell {background-image:url('../../images/icons/bell.png'); &:extend(.bp-icon);}
 i.fa-book {background-image:url('../../images/icons/book.png'); &:extend(.bp-icon);}
 i.fa-bookbag-add {background-image:url('../../images/icons/bookbag_add.png'); &:extend(.bp-icon);}
diff --git a/themes/bootstrap3/less/bootstrap.less b/themes/bootstrap3/less/bootstrap.less
index 6aee9ca1eaa..0be356a5bd6 100644
--- a/themes/bootstrap3/less/bootstrap.less
+++ b/themes/bootstrap3/less/bootstrap.less
@@ -138,11 +138,6 @@ label.list-group-item {border-radius:0;font-weight:normal;margin-top:0;padding-l
     }
   }
 }
-.list-group-item.active, .badge {
-  i.fa {
-    cursor:inherit;
-  }
-}
 
 /* --- Slider accessibility --- */
 .slider {
diff --git a/themes/bootstrap3/theme.config.php b/themes/bootstrap3/theme.config.php
index c6421cc660f..d7469ac25a4 100644
--- a/themes/bootstrap3/theme.config.php
+++ b/themes/bootstrap3/theme.config.php
@@ -20,12 +20,10 @@ return array(
         'lightbox.js',
     ),
     'less' => array(
-        'active' => true,
-        'compiled.less'
+        //'compiled.less'
     ),
     'scss' => array(
-        'active' => false,
-        'compiled.scss'
+        //'compiled.scss'
     ),
     'favicon' => 'vufind-favicon.ico',
     'helpers' => array(
-- 
GitLab