Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/01/15 14:59:47 (9 years ago)
Author:
ascheibe
Message:

#2394 merged r12428, r12429, r12430, r12435, r12442, r12443, r12445, r12514, r12517, r12519, r12520, r12521, r12523, r12532, r12542, r12546, r12552, r12553, r12556, r12557, r12559, r12561, r12146, r12457 into stable

Location:
stable
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Services.WebApp/3.3/Configs/BundleConfig.cs

    r12428 r12563  
    1 using System.Collections.Generic;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System.Collections.Generic;
    223using System.IO;
    3 using System.Linq;
    4 using System.Web;
    524using System.Web.Optimization;
    625
    726namespace HeuristicLab.Services.WebApp.Configs {
    827  public class BundleConfig {
     28
    929    public static void RegisterBundles(BundleCollection bundles) {
    1030      bundles.IgnoreList.Clear();
     
    2141        "~/WebApp/libs/bootstrap/css/bootstrap-theme.min.css",
    2242        "~/WebApp/libs/font-aweseome/font-aweseome.min.css",
    23         "~/WebApp/libs/angularjs/loading-bar/loading-bar.css"
     43        "~/WebApp/libs/angularjs/loading-bar/loading-bar.css",
     44        "~/WebApp/libs/angularjs/angular-tablesort/tablesort.css"
    2445      ));
    2546
     
    5071        "~/WebApp/libs/angularjs/angular-ui-router.min.js",
    5172        "~/WebApp/libs/angularjs/angular-knob/angular-knob.js",
     73        "~/WebApp/libs/angularjs/angular-tablesort/angular-tablesort.js",
    5274        "~/WebApp/libs/angularjs/angular-ui/ui-bootstrap-tpls-0.13.0.min.js",
    5375        "~/WebApp/libs/angularjs/loading-bar/loading-bar.js",
     
    6183        "~/WebApp/app.css"
    6284      ));
    63       AddOrUpdateWebAppBundle();
     85
     86      bundles.Add(new ScriptBundle("~/Bundles/WebApp/Main").Include(
     87        "~/WebApp/main.js"
     88      ));
     89
     90      bundles.Add(new ScriptBundle("~/Bundles/WebApp/Shared")
     91        .IncludeDirectory("~/WebApp/shared/services", "*.js", true)
     92        .IncludeDirectory("~/WebApp/shared/directives", "*.js", true)
     93        .IncludeDirectory("~/WebApp/shared/filter", "*.js", true)
     94        .IncludeDirectory("~/WebApp/shared/menu", "*.js", true)
     95      );
    6496    }
    6597
    66     public static void AddOrUpdateWebAppBundle() {
    67       var jsBundle = BundleTable.Bundles.GetBundleFor("~/Bundles/WebApp/js");
    68       if (jsBundle != null) {
    69         BundleTable.Bundles.Remove(jsBundle);
     98    public static IEnumerable<string> GetWebAppScripts() {
     99      var jsFiles = new List<string> {
     100        "WebApp/helper.js",
     101        "WebApp/app.js"
     102      };
     103      PluginManager pluginManager = PluginManager.Instance;
     104      foreach (var plugin in pluginManager.Plugins) {
     105        if (File.Exists(string.Format(@"{0}\{1}\{1}.js", PluginManager.PluginsDirectory, plugin.Name))) {
     106          jsFiles.Add(string.Format("WebApp/plugins/{0}/{0}.js", plugin.Name));
     107        }
    70108      }
    71       var jsFiles = new List<string> {
    72         "~/WebApp/helper.js",
    73         "~/WebApp/app.js"
    74       };
    75       var directories = Directory.GetDirectories(string.Format(@"{0}WebApp\plugins", HttpRuntime.AppDomainAppPath));
    76       jsFiles.AddRange(directories.Select(Path.GetFileName).Select(directory => string.Format("~/WebApp/plugins/{0}/{0}.js", directory)));
    77       jsFiles.Add("~/WebApp/main.js");
    78       jsBundle = new ScriptBundle("~/Bundles/WebApp/js");
    79       jsBundle.Include(jsFiles.ToArray());
    80       jsBundle.IncludeDirectory("~/WebApp/shared/", "*.js", true);
    81       BundleTable.Bundles.Add(jsBundle);
     109      jsFiles.Add("WebApp/main.js");
     110      return jsFiles;
    82111    }
    83112  }
Note: See TracChangeset for help on using the changeset viewer.