Mercurial > altnet-hispano
changeset 291:5f1e3d35e113
Patrocinadores: Correcciones en Vistas.
author | juanjose.montesdeocaarbos |
---|---|
date | Thu, 09 Feb 2012 00:12:00 -0300 |
parents | 15b428ae5931 |
children | 1408ac17cb64 |
files | Agendas/trunk/src/Agendas.Web/DataProviders.cs Agendas/trunk/src/Agendas.Web/Views/Shared/DefaultEditor.cshtml Agendas/trunk/src/Agendas.Web/Views/Shared/EditorTemplates/Patrocinadores.cshtml Agendas/trunk/src/Agendas.Web/Views/Shared/EditorTemplates/Ponentes.cshtml |
diffstat | 4 files changed, 52 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Web/DataProviders.cs Tue Feb 07 23:29:06 2012 -0300 +++ b/Agendas/trunk/src/Agendas.Web/DataProviders.cs Thu Feb 09 00:12:00 2012 -0300 @@ -54,8 +54,9 @@ var patrocinadores = repository.GetAll(); if (ids == null || !ids.Any()) return new SelectListItem[] { }; - return from p in patrocinadores - select new SelectListItem {Text = p.Nombre, Value = p.Id.ToString()}; + return from p in from id in ids + select repository.GetById(id.ToString()) + select new SelectListItem { Text = p.Nombre, Value = p.Id.ToString() }; } public static IEnumerable<SelectListItem> GetPatrocinadoresExcepto(this HtmlHelper helper, IEnumerable<Guid> ids)
--- a/Agendas/trunk/src/Agendas.Web/Views/Shared/DefaultEditor.cshtml Tue Feb 07 23:29:06 2012 -0300 +++ b/Agendas/trunk/src/Agendas.Web/Views/Shared/DefaultEditor.cshtml Thu Feb 09 00:12:00 2012 -0300 @@ -9,16 +9,6 @@ <script src="@Url.Content("~/Scripts/subpanels-0.9.js")" type="text/javascript"></script> <link rel="stylesheet" href="@Url.Content("~/Content/subpanels-0.9.css")" type="text/css" /> -<script type="text/javascript"> - $(document).ready(function () { - $("form:first").submit(function () { - $("#Ponentes option").each(function () { - $(this).attr("selected", "selected"); - }); - }); - }); -</script> - @using (Html.BeginForm( null, null,
--- a/Agendas/trunk/src/Agendas.Web/Views/Shared/EditorTemplates/Patrocinadores.cshtml Tue Feb 07 23:29:06 2012 -0300 +++ b/Agendas/trunk/src/Agendas.Web/Views/Shared/EditorTemplates/Patrocinadores.cshtml Thu Feb 09 00:12:00 2012 -0300 @@ -1,6 +1,10 @@ @model IEnumerable<Guid> <script type="text/javascript"> $(document).ready(function () { + $("form:first").submit(function () { + select_all_patrocinadores(); + }); + $("#agregarPatrocinador").subpanel({ success: add_new_otro_patrocinador, url: '@Url.Action("Nuevo", "PatrocinadorApi")' }); $("#add").click(select_otro_patrocinador); $("#remove").click(remove_otro_patrocinador); @@ -9,6 +13,12 @@ $("#@Html.ViewData.ModelMetadata.PropertyName").width(width); }); + function select_all_patrocinadores() { + $("#@Html.ViewData.ModelMetadata.PropertyName option").each(function () { + $(this).attr("selected", "selected"); + }); + } + function add_new_otro_patrocinador(data) { if (data.Succeful) { var opcion = $("<option></option>").attr("value", data.Id).attr("selected", "selected").html(data.Nombre); @@ -52,14 +62,15 @@ posiblesPatrocinadores.empty().append(options); posiblesPatrocinadores.attr("value", current.val()); - }); + }); + select_all_patrocinadores(); } </script> -@Html.ListBox(string.Empty, Html.GetPatrocinadores(Model), new { style = "vertical-align: top;" }) +@Html.ListBox(string.Empty, Html.GetPatrocinadores(Model), new { style = "vertical-align: top; min-width: 160px;" }) <div style="display: inline-block"> <div> <a class="ajax-button ui-state-default ui-corner-all" id="add"><span class="ui-icon ui-icon-triangle-1-w"></span></a> - @Html.DropDownList("posiblesPatrocinadores", Html.GetPatrocinadoresExcepto(Model), new { style = "vertical-align: top;", id = "posiblesPatrocinadores" }) + @Html.DropDownList("posiblesPatrocinadores", Html.GetPatrocinadoresExcepto(Model), new { style = "vertical-align: top; min-width: 160px;", id = "posiblesPatrocinadores" }) </div> <div> <a class="ajax-button ui-state-default ui-corner-all" id="remove"><span class="ui-icon ui-icon-triangle-1-e"></span></a>
--- a/Agendas/trunk/src/Agendas.Web/Views/Shared/EditorTemplates/Ponentes.cshtml Tue Feb 07 23:29:06 2012 -0300 +++ b/Agendas/trunk/src/Agendas.Web/Views/Shared/EditorTemplates/Ponentes.cshtml Thu Feb 09 00:12:00 2012 -0300 @@ -1,13 +1,23 @@ @model IEnumerable<Guid> <script type="text/javascript"> - $(document).ready(function () { - $("#agregarPonente").subpanel({ success: add_new_otro_ponente, url: '@Url.Action("Nueva", "PersonaApi")' }); - $("#add").click(select_otro_ponente); - $("#remove").click(remove_otro_ponente); + $(document).ready(function () { + $("form:first").submit(function () { + select_all_ponentes(); + }); + + $("#agregarPonente").subpanel({ success: add_new_otro_ponente, url: '@Url.Action("Nueva", "PersonaApi")' }); + $("#add").click(select_otro_ponente); + $("#remove").click(remove_otro_ponente); - var width = $("#posiblesPonentes").width(); - $("#@Html.ViewData.ModelMetadata.PropertyName").width(width); - }); + var width = $("#posiblesPonentes").width(); + $("#@Html.ViewData.ModelMetadata.PropertyName").width(width); + }); + + function select_all_ponentes() { + $("#@Html.ViewData.ModelMetadata.PropertyName option").each(function () { + $(this).attr("selected", "selected"); + }); + } function add_new_otro_ponente(data) { if (data.Succeful) { @@ -33,33 +43,34 @@ } function remove_otro_ponente(event) { - event.preventDefault(); + event.preventDefault(); - $("option:selected", $("#@Html.ViewData.ModelMetadata.PropertyName")).each(function () { - var current = $(this); - var posiblesPonentes = $("#posiblesPonentes"); - current.appendTo(posiblesPonentes); + $("option:selected", $("#@Html.ViewData.ModelMetadata.PropertyName")).each(function () { + var current = $(this); + var posiblesPonentes = $("#posiblesPonentes"); + current.appendTo(posiblesPonentes); - // ordenamos los ponentes - var options = $("option", posiblesPonentes); + // ordenamos los ponentes + var options = $("option", posiblesPonentes); - options.sort(function (a, b) { - if (a.text > b.text) return 1; - else if (a.text < b.text) return -1; - else return 0 - }); + options.sort(function (a, b) { + if (a.text > b.text) return 1; + else if (a.text < b.text) return -1; + else return 0 + }); - posiblesPonentes.empty().append(options); + posiblesPonentes.empty().append(options); - posiblesPonentes.attr("value", current.val()); - }); + posiblesPonentes.attr("value", current.val()); + }); + select_all_ponentes(); } </script> -@Html.ListBox(string.Empty, Html.GetPonentes(Model), new { style = "vertical-align: top;" }) +@Html.ListBox(string.Empty, Html.GetPonentes(Model), new { style = "vertical-align: top; min-width: 160px;" }) <div style="display: inline-block"> <div> <a class="ajax-button ui-state-default ui-corner-all" id="add"><span class="ui-icon ui-icon-triangle-1-w"></span></a> - @Html.DropDownList("posiblesPonentes", Html.GetPonentesExcepto(Model), new { style = "vertical-align: top;", id = "posiblesPonentes" }) + @Html.DropDownList("posiblesPonentes", Html.GetPonentesExcepto(Model), new { style = "vertical-align: top; min-width: 160px;", id = "posiblesPonentes" }) </div> <div> <a class="ajax-button ui-state-default ui-corner-all" id="remove"><span class="ui-icon ui-icon-triangle-1-e"></span></a>