如何为coffeescript视图指定变体?

时间:2017-07-24 10:10:55

标签: ruby-on-rails-4

使用Rails变种时,我会使用此约定来指定要使用的JS模板:

http://localhost:4444/grid/console

如何为Coffeescript视图做同样的事情?

static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
    bool isName;
    string path = GetAssemblyLoadInfo(args, out isName);
    return isName ? Assembly.Load(path) : Assembly.LoadFrom(path);
}

static string GetAssemblyLoadInfo(ResolveEventArgs args, out bool isAssemblyName)
{
    isAssemblyName = false;
    var assemblyName = new AssemblyName(args.Name);
    string path = String.Concat(new FileInfo(DllPath).Directory, "\\", assemblyName.Name, ".dll");
    if (File.Exists(path))
    {
        return path;
    }
    if (path.EndsWith(".resources.dll"))
    {
        path = path.Replace(".resources.dll", ".dll");
        if (File.Exists(path)) return path;
    }

    var assemblyLocation = AssemblyLocations.FirstOrDefault(al => al.Name.FullName == assemblyName.FullName);
    if (null == assemblyLocation)
    {
        isAssemblyName = true;
        return args.Name;
    }
    else
    {
        return assemblyLocation.Location;
    }
}

1 个答案:

答案 0 :(得分:0)

原来是action.js+variant.coffee