main-vinayFork / Source / WebService / Web.Admin / Views / Home / _Edit.cshtml

@model DataUp.Web.Admin.ViewModel.RepositoryViewModel
@{
    Layout = null;
    ViewContext.FormContext = new FormContext();
}
<script type="text/javascript">
    $(function () {
        $('#repositoryTypeId').change(function () {
            admin.validateType($(this));
        });
    });

    $(document).ready(function () {
        $.post('/Home/GetTypes', function (returnedList) {
            window.types = returnedList;
        });
        $('#frmRepository').removeData('validator');
        $.validator.unobtrusive.parse($('#frmRepository'));
    });

    var admin = {
        validateType: function (element) {
            var selected = $(element).val();
            for (i = 0; i < window.types.length; i++) {
                if (types[i].TypeId == selected) {
                    if (types[i].Required === false) {
                        $("#userName").removeAttr('disabled');
                        $("#passWord").removeAttr('disabled');
                        $('#credentials').show();
                    } else {

                        $("#userName").attr('disabled', 'disabled');
                        $("#passWord").attr('disabled', 'disabled');
                        $("#userName").val("");
                        $("#passWord").val("");
                        $(".elemContainer span[data-valmsg-for='UserName']").removeClass('field-validation-error').addClass('field-validation-valid');
                        $(".elemContainer span[data-valmsg-for='Password']").removeClass('field-validation-error').addClass('field-validation-valid');
                        $('#credentials').hide();
                    }
                }
            }
            $('#detailsError').hide();
        }
    };


    $(document).keyup(function (e) {
      
        if (e.keyCode == 27) {
            $(".btnCancel").click();
        }

    });
</script>
@using (Html.BeginForm("Add", "Home", FormMethod.Post, new { id = "frmRepository", @class = "elemContainer" }))
{
    <div class="elemContainer">
        <div class="elemItemsContainer">
            <label> @Html.LabelFor(m => m.RepositoryName)
            <span class="mandatory">*</span></label>
            @Html.TextBoxFor(m => m.RepositoryName, new { maxlength = 100, id = "repositoryName", value = "" })
            @Html.ValidationMessageFor(m => m.RepositoryName, "Invalid Repository Name", new { @class = "mandtrField" })
        </div>
        <div class="elemItemsContainer">
           <label> @Html.LabelFor(m => m.SelectedRepositoryTypeId)
            <span class="mandatory">*</span></label>
            @Html.DropDownListFor(m => m.SelectedRepositoryTypeId, Model.RepositoryTypes, new { id = "repositoryTypeId" })
        </div>
        <div class="elemItemsContainer">
           <label> @Html.LabelFor(m => m.IdentifierUrl)
            <span class="mandatory">*</span></label>
            @Html.TextBox("IdentifierUrl", null, new { maxlength = 100, id = "identifierUrl", width = "100%" })
            @Html.ValidationMessageFor(m => m.IdentifierUrl, "Invalid Identifier Url. Must Start with https:// or http://", new { @class = "mandtrField" })
        </div>
        <div class="elemItemsContainer">
            <label>@Html.LabelFor(m => m.PostFileUrl)
            <span class="mandatory">*</span></label>
            @Html.TextBox("PostFileUrl", null, new { maxlength = 100, id = "postFileUrl" })
            @Html.ValidationMessageFor(m => m.PostFileUrl, "Invalid PostFile Url. Must Start with https:// or http://", new { @class = "mandtrField" })
        </div>
        <div id="credentials" style="display: none" class="elemContainer">
            <div class="elemItemsContainer">
              
                <label>@Html.LabelFor(m => m.UserName)<span class="mandatory">*</span></label>
                @Html.TextBoxFor(m => m.UserName, new { maxlength = 100, id = "userName" })
                @Html.ValidationMessageFor(m => m.UserName, "UserName Required", new { @class = "mandtrField" })
            </div>
            <div class="elemItemsContainer">
                
              <label> @Html.LabelFor(m => m.Password) <span class="mandatory">*</span></label> 
                @Html.PasswordFor(m => m.Password, new { maxlength = 100, id = "passWord" })
                @Html.ValidationMessageFor(m => m.Password, "Password Required", new { @class = "mandtrField", value = Model.Password })
                <input type="hidden" value="@Model.RepositoryId" id="repositoryId"/>
            </div>
        </div>
        <div class="elemItemsContainer">
            <label>User&nbsp;Agreement <span class="mandatory">*</span></label>
            @Html.TextAreaFor(m => m.UserAgreement, new { @class = "userAgreementDisplay agreeText", cols = "1", rows = "4", id = "userAgreement" })
            @Html.ValidationMessageFor(m => m.UserAgreement, "User Agreement is required", new { @class = "mandtrField" })
        </div>
    </div>
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.