Exemple #1
0
        public static bool StartContainer(this IHtmlHelper helper, string tag, string identifier, object attrs = null, string tabVariable = null)
        {
            var access = proc.Process(helper, identifier.ToLower(), "Container");

            if (access.Read)
            {
                dynamic other       = new ExpandoObject();
                string  stringified = attrs == null ? "" : RazorUtils.ToAttributeString(attrs);
                if (attrs == null || !attrs.HasProperty("id"))
                {
                    other.id = identifier;
                }
                if (tabVariable != null)
                {
                    other.calc__show_if = $"{tabVariable}=='{identifier}'";
                    other.@class        = "tab-page";
                }

                if (other != null)
                {
                    stringified += RazorUtils.ToAttributeStringDynamic(other);
                }
                stringified += " #" + identifier;
                helper.ViewContext.Writer.Write(string.Format("<{0} {1}>\n", tag, stringified));
            }

            return(access.Read);
        }
 public static void WriteContainerStart(ViewContext con, string tag, object attr, dynamic otherAttr = null)
 {
     if (tag != null)
     {
         string attrs = RazorUtils.ToAttributeString(attr);
         if (otherAttr != null)
         {
             attrs += RazorUtils.ToAttributeStringDynamic(otherAttr);
         }
         con.Writer.Write(string.Format("<{0} {1}>\n", tag, attrs));
     }
 }