/// <summary> /// The intention here is to allow the rich edit control to be changed from request to request. /// Before this flexibility is active a "settings" page will be required to make changes to /// DasBlogSettings /// </summary> /// <param name="serviceProvider"></param> /// <returns>object used by the taghandlers supporting the rich edit control</returns> /// <exception cref="Exception">EntryEditControl in site.config is misconfugured</exception> private IRichEditBuilder SelectRichEditor(IServiceProvider serviceProvider) { string entryEditControl = serviceProvider.GetService <IDasBlogSettings>() .SiteConfiguration.EntryEditControl.ToLower(); IRichEditBuilder richEditBuilder; switch (entryEditControl) { case Constants.TinyMceEditor: richEditBuilder = new TinyMceBuilder(); break; case Constants.NicEditEditor: richEditBuilder = new NicEditBuilder(); break; case Constants.TextAreaEditor: richEditBuilder = new TextAreaBuilder(); break; default: throw new Exception($"Attempt to use unknown rich edit control, {entryEditControl}"); } return(richEditBuilder); }
public TextAreaBuilder TextAreaFor <TProperty>(Expression <Func <TModel, TProperty> > expression) { TextAreaBuilder textAreaBuilder = TextArea(); textAreaBuilder.PrepareEditorFor(base.Html, expression); return(textAreaBuilder); }
public void TextAreaSecureAccessTest() { var htmlHelper = MvcHelper.GetHtmlHelper("test.user", new[] { "Finance" }); var component = new TextArea(htmlHelper); var builder = new TextAreaBuilder(component); builder .Name("CreditLimit") .Value("1000") .Secure("Finance", "Administrator") .Placeholder("Credit Limit"); var html = builder.ToHtmlString(); html.Should().Be("<textarea id=\"CreditLimit\" name=\"CreditLimit\" placeholder=\"Credit Limit\">1000</textarea>"); }
public void TextAreaSecureNoAccessTest() { var htmlHelper = MvcHelper.GetHtmlHelper(); var component = new TextArea(htmlHelper); var builder = new TextAreaBuilder(component); builder .Name("CreditLimit") .Value("1000") .Secure("Finance", "Administrator") .Placeholder("Credit Limit"); var html = builder.ToHtmlString(); html.Should().Be("<textarea class=\"access-denied\" id=\"CreditLimit\" name=\"CreditLimit\" placeholder=\"Credit Limit\" readonly=\"readonly\">1000</textarea>"); }
public void TextAreaHtml() { var htmlHelper = MvcHelper.GetHtmlHelper(); var component = new TextArea(htmlHelper); var builder = new TextAreaBuilder(component); builder .Name<Contact, string>(c => c.Name) .Columns(30) .Rows(5) .Value("<p>Testing</p>") .Placeholder("Name"); var html = builder.ToHtmlString(); html.Should().Be("<textarea cols=\"30\" id=\"Name\" name=\"Name\" placeholder=\"Name\" rows=\"5\"><p>Testing</p></textarea>"); }