Esempio n. 1
0
        /// <summary>
        /// HTML Helper for Text RichField.
        /// </summary>
        ///
        /// <typeparam name="TModel">Type of the model</typeparam>
        /// <typeparam name="TValue">Type of the value</typeparam>
        /// <param name="helper">HTML Helper</param>
        /// <param name="expression">Value expression supplied</param>
        /// <param name="htmlAttributes">
        ///     optional object specifying HTML attributes to append
        /// </param>
        /// <returns>The html to inject in the razor page.</returns>
        public static MvcHtmlString rfEditTextFor <TModel, TValue>(
            this HtmlHelper <TModel> helper,
            Expression <Func <TModel, TValue> > expression,
            object htmlAttributes = null)
        {
            var config = new FieldConfig <TModel, TValue>(helper, expression,
                                                          htmlAttributes);

            config.InputType           = "text";
            config.InputClass          = "rf-text rounded-right";
            config.InitialDisplayValue = config.InitialScrubbedValue;

            var inputTag = config.InputTag();

            config.OriginalTag();
            config.ScrubbedTag();

            return(config.GetHtmlString());
        }
Esempio n. 2
0
        /// <summary>
        /// HTML Helper for Percent RichField.
        /// </summary>
        ///
        /// <typeparam name="TModel">Type of the model</typeparam>
        /// <typeparam name="TValue">Type of the value</typeparam>
        /// <param name="helper">HTML Helper</param>
        /// <param name="expression">Value expression supplied</param>
        /// <param name="htmlAttributes">
        ///     optional object specifying HTML attributes to append
        /// </param>
        /// <returns>The html to inject in the razor page.</returns>
        public static MvcHtmlString rfEditPercentFor <TModel, TValue>(
            this HtmlHelper <TModel> helper,
            Expression <Func <TModel, TValue> > expression,
            object htmlAttributes = null)
        {
            var config = new FieldConfig <TModel, TValue>(helper, expression,
                                                          htmlAttributes);

            config.InputType           = "text";
            config.InputClass          = "rf-percent";
            config.ScrubType           = "number";
            config.InitialDisplayValue = config.Value.ToString();

            var inputTag = config.InputTag();

            config.AppendTextTag("%");
            config.OriginalTag();
            config.ScrubbedTag();

            return(config.GetHtmlString());
        }
Esempio n. 3
0
        /// <summary>
        /// HTML Helper for the MonthYear RichField.
        /// User enters data via a select for the month
        /// and an input for the year.  They are combined in to the
        /// scrubbed input for submission to the server.
        /// </summary>
        ///
        /// <typeparam name="TModel">Type of the model</typeparam>
        /// <typeparam name="TValue">Type of the value</typeparam>
        /// <param name="helper">HTML Helper</param>
        /// <param name="expression">Value expression supplied</param>
        /// <param name="htmlAttributes">
        ///     optional object specifying HTML attributes to append
        /// </param>
        /// <returns>The html to inject in the razor page.</returns>
        public static MvcHtmlString rfEditMonthYearFor <TModel, TValue>(
            this HtmlHelper <TModel> helper,
            Expression <Func <TModel, TValue> > expression,
            object htmlAttributes = null)
        {
            var config = new FieldConfig <TModel, TValue>(helper, expression,
                                                          htmlAttributes);

            config.InitialScrubbedValue = config.Value.ToString();
            TagBuilder tag = config.Tag;

            TagBuilder monthTag = config.MonthSelectTag(config.Value as DateTime?);

            tag.InnerHtml += monthTag.ToString();
            tag.InnerHtml += config.YearSelectTag(config.Value as DateTime?);


            var scrubbedTag = config.ScrubbedTag();

            tag.InnerHtml += scrubbedTag.ToString();

            return(new MvcHtmlString(tag.ToString()));
        }