Mercurial > altnet-hispano
changeset 86:723aed93a0e6
Template de Object y Tooltip
author | nelopauselli |
---|---|
date | Wed, 25 May 2011 01:53:31 -0300 |
parents | 8a4135f019dd |
children | 26d0513a8410 |
files | Agendas/trunk/src/Agendas.Web/Agendas.Web.csproj Agendas/trunk/src/Agendas.Web/Content/question.jpg Agendas/trunk/src/Agendas.Web/Views/Shared/DisplayTemplates/Tooltip.cshtml Agendas/trunk/src/Agendas.Web/Views/Shared/EditorTemplates/Object.cshtml |
diffstat | 4 files changed, 43 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Web/Agendas.Web.csproj Wed May 25 01:20:24 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Web/Agendas.Web.csproj Wed May 25 01:53:31 2011 -0300 @@ -79,6 +79,7 @@ </ItemGroup> <ItemGroup> <Content Include="Content\altnetlogo.png" /> + <Content Include="Content\question.jpg" /> <Content Include="Global.asax" /> <Content Include="hibernate.cfg.xml"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> @@ -170,6 +171,12 @@ <ItemGroup> <Content Include="packages.config" /> </ItemGroup> + <ItemGroup> + <Content Include="Views\Shared\EditorTemplates\Object.cshtml" /> + </ItemGroup> + <ItemGroup> + <Content Include="Views\Shared\DisplayTemplates\Tooltip.cshtml" /> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Web/Views/Shared/DisplayTemplates/Tooltip.cshtml Wed May 25 01:53:31 2011 -0300 @@ -0,0 +1,9 @@ +@{ + string tooltip=null; + tooltip = ViewData.ModelMetadata.Description; +} + +@if (tooltip != null) +{ + <img title='@tooltip' src='@Url.Content("~/Content/question.jpg")' width='20' height='20' border='0' align="middle" style="vertical-align: top;"/> +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Agendas/trunk/src/Agendas.Web/Views/Shared/EditorTemplates/Object.cshtml Wed May 25 01:53:31 2011 -0300 @@ -0,0 +1,27 @@ +@if (ViewData.TemplateInfo.TemplateDepth > 1) { + if (Model == null) { + @ViewData.ModelMetadata.NullDisplayText + } else { + @ViewData.ModelMetadata.SimpleDisplayText + } +} else { + foreach (var prop in ViewData.ModelMetadata.Properties.Where(metadata => metadata.ShowForEdit && !metadata.IsComplexType && !ViewData.TemplateInfo.Visited(metadata))) + { + if (prop.HideSurroundingHtml) { + @Html.Editor(prop.PropertyName) + } else { + if (!String.IsNullOrEmpty(Html.Label(prop.PropertyName).ToHtmlString())) { + if (prop.IsRequired) { + <div class="editor-label"><b>@Html.Label(prop.PropertyName)</b></div> + } else { + <div class="editor-label">@Html.Label(prop.PropertyName)</div> + } + } + <div class="editor-field"> + @Html.Editor(prop.PropertyName) + @Html.ValidationMessage(prop.PropertyName) + @Html.Display(prop.PropertyName, "Tooltip") + </div> + } + } +} \ No newline at end of file