Mercurial > altnet-hispano
comparison Agendas/trunk/src/Agendas.Web/Views/Shared/EditorTemplates/Ponentes.cshtml @ 291:5f1e3d35e113
Patrocinadores: Correcciones en Vistas.
author | juanjose.montesdeocaarbos |
---|---|
date | Thu, 09 Feb 2012 00:12:00 -0300 |
parents | 92c912b46307 |
children |
comparison
equal
deleted
inserted
replaced
290:15b428ae5931 | 291:5f1e3d35e113 |
---|---|
1 @model IEnumerable<Guid> | 1 @model IEnumerable<Guid> |
2 <script type="text/javascript"> | 2 <script type="text/javascript"> |
3 $(document).ready(function () { | 3 $(document).ready(function () { |
4 $("#agregarPonente").subpanel({ success: add_new_otro_ponente, url: '@Url.Action("Nueva", "PersonaApi")' }); | 4 $("form:first").submit(function () { |
5 $("#add").click(select_otro_ponente); | 5 select_all_ponentes(); |
6 $("#remove").click(remove_otro_ponente); | 6 }); |
7 | 7 |
8 var width = $("#posiblesPonentes").width(); | 8 $("#agregarPonente").subpanel({ success: add_new_otro_ponente, url: '@Url.Action("Nueva", "PersonaApi")' }); |
9 $("#@Html.ViewData.ModelMetadata.PropertyName").width(width); | 9 $("#add").click(select_otro_ponente); |
10 }); | 10 $("#remove").click(remove_otro_ponente); |
11 | |
12 var width = $("#posiblesPonentes").width(); | |
13 $("#@Html.ViewData.ModelMetadata.PropertyName").width(width); | |
14 }); | |
15 | |
16 function select_all_ponentes() { | |
17 $("#@Html.ViewData.ModelMetadata.PropertyName option").each(function () { | |
18 $(this).attr("selected", "selected"); | |
19 }); | |
20 } | |
11 | 21 |
12 function add_new_otro_ponente(data) { | 22 function add_new_otro_ponente(data) { |
13 if (data.Succeful) { | 23 if (data.Succeful) { |
14 var opcion = $("<option></option>").attr("value", data.Id).attr("selected", "selected").html(data.Nombre); | 24 var opcion = $("<option></option>").attr("value", data.Id).attr("selected", "selected").html(data.Nombre); |
15 add_otro_ponente(opcion); | 25 add_otro_ponente(opcion); |
31 var Ponentes = $("#@Html.ViewData.ModelMetadata.PropertyName"); | 41 var Ponentes = $("#@Html.ViewData.ModelMetadata.PropertyName"); |
32 option.appendTo(Ponentes); | 42 option.appendTo(Ponentes); |
33 } | 43 } |
34 | 44 |
35 function remove_otro_ponente(event) { | 45 function remove_otro_ponente(event) { |
36 event.preventDefault(); | 46 event.preventDefault(); |
37 | 47 |
38 $("option:selected", $("#@Html.ViewData.ModelMetadata.PropertyName")).each(function () { | 48 $("option:selected", $("#@Html.ViewData.ModelMetadata.PropertyName")).each(function () { |
39 var current = $(this); | 49 var current = $(this); |
40 var posiblesPonentes = $("#posiblesPonentes"); | 50 var posiblesPonentes = $("#posiblesPonentes"); |
41 current.appendTo(posiblesPonentes); | 51 current.appendTo(posiblesPonentes); |
42 | 52 |
43 // ordenamos los ponentes | 53 // ordenamos los ponentes |
44 var options = $("option", posiblesPonentes); | 54 var options = $("option", posiblesPonentes); |
45 | 55 |
46 options.sort(function (a, b) { | 56 options.sort(function (a, b) { |
47 if (a.text > b.text) return 1; | 57 if (a.text > b.text) return 1; |
48 else if (a.text < b.text) return -1; | 58 else if (a.text < b.text) return -1; |
49 else return 0 | 59 else return 0 |
50 }); | 60 }); |
51 | 61 |
52 posiblesPonentes.empty().append(options); | 62 posiblesPonentes.empty().append(options); |
53 | 63 |
54 posiblesPonentes.attr("value", current.val()); | 64 posiblesPonentes.attr("value", current.val()); |
55 }); | 65 }); |
66 select_all_ponentes(); | |
56 } | 67 } |
57 </script> | 68 </script> |
58 @Html.ListBox(string.Empty, Html.GetPonentes(Model), new { style = "vertical-align: top;" }) | 69 @Html.ListBox(string.Empty, Html.GetPonentes(Model), new { style = "vertical-align: top; min-width: 160px;" }) |
59 <div style="display: inline-block"> | 70 <div style="display: inline-block"> |
60 <div> | 71 <div> |
61 <a class="ajax-button ui-state-default ui-corner-all" id="add"><span class="ui-icon ui-icon-triangle-1-w"></span></a> | 72 <a class="ajax-button ui-state-default ui-corner-all" id="add"><span class="ui-icon ui-icon-triangle-1-w"></span></a> |
62 @Html.DropDownList("posiblesPonentes", Html.GetPonentesExcepto(Model), new { style = "vertical-align: top;", id = "posiblesPonentes" }) | 73 @Html.DropDownList("posiblesPonentes", Html.GetPonentesExcepto(Model), new { style = "vertical-align: top; min-width: 160px;", id = "posiblesPonentes" }) |
63 </div> | 74 </div> |
64 <div> | 75 <div> |
65 <a class="ajax-button ui-state-default ui-corner-all" id="remove"><span class="ui-icon ui-icon-triangle-1-e"></span></a> | 76 <a class="ajax-button ui-state-default ui-corner-all" id="remove"><span class="ui-icon ui-icon-triangle-1-e"></span></a> |
66 </div> | 77 </div> |
67 <div> | 78 <div> |