public override Stream Open() { var repo = new ThemeVarsRepository(); if (_themeName.IsEmpty()) { return(GenerateStreamFromString(string.Empty)); } var lessCss = repo.GetVariablesAsLess(_themeName, _storeId); return(GenerateStreamFromString(lessCss)); }
public override Stream Open() { var repo = new ThemeVarsRepository(); if (_themeName.IsEmpty()) { return(GenerateStreamFromString(string.Empty)); } var css = repo.GetPreprocessorCss(_extension, _themeName, _storeId); return(GenerateStreamFromString(css)); }
public static MvcHtmlString ThemeVarEditor(this HtmlHelper html, ThemeVariableInfo info, object value) { Guard.NotNull(info, "info"); string expression = html.NameForThemeVar(info); var strValue = string.Empty; var arrValue = value as string[]; if (arrValue != null) { strValue = arrValue.Length > 0 ? arrValue[0] : value.ToString(); } else { strValue = value.ToString(); } var isDefault = strValue.IsCaseInsensitiveEqual(info.DefaultValue); var isValidColor = info.Type == ThemeVariableType.Color && ((strValue.HasValue() && ThemeVarsRepository.IsValidColor(strValue)) || (strValue.IsEmpty() && ThemeVarsRepository.IsValidColor(info.DefaultValue))); MvcHtmlString control; if (isValidColor) { control = html.ColorBox(expression, strValue, info.DefaultValue); } else if (info.Type == ThemeVariableType.Boolean) { var locService = EngineContext.Current.Resolve <ILocalizationService>(); control = html.CheckBox(expression, strValue.ToBool()); var custom = "<label class='switch'>{0}<span class='switch-toggle' data-on='{1}' data-off='{2}'></span></label>".FormatInvariant( control.ToString(), locService.GetResource("Common.On").Truncate(3), locService.GetResource("Common.Off").Truncate(3)); control = MvcHtmlString.Create(custom); } else if (info.Type == ThemeVariableType.Select) { control = ThemeVarSelectEditor(html, info, expression, strValue); } else { control = html.TextBox(expression, isDefault ? "" : strValue, new { placeholder = info.DefaultValue, @class = "form-control" }); } return(control); }