/src/Mvc/Dinamico/Dinamico/Themes/Default/Views/ContentParts/ImageAndText.cshtml
https://github.com/lundbeck/n2cms · Razor · 70 lines · 36 code · 7 blank · 27 comment · 5 complexity · fba56dc831ed3abe3730d5b904ac41fd MD5 · raw file
- @*************************************************************************************************
-
- Image and Text Content Part: Razor Template-First Sample
- Licensed to users of N2CMS under the terms of the Boost Software License
-
- Copyright (c) 2013 Benjamin Herila <mailto:ben@herila.net>
-
- Boost Software License - Version 1.0 - August 17th, 2003
-
- Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the
- software and accompanying documentation covered by this license (the "Software") to use, reproduce,
- display, distribute, execute, and transmit the Software, and to prepare derivative works of the
- Software, and to permit third-parties to whom the Software is furnished to do so, all subject to
- the following:
-
- The copyright notices in the Software and this entire statement, including the above license grant,
- this restriction and the following disclaimer, must be included in all copies of the Software, in
- whole or in part, and all derivative works of the Software, unless such copies or derivative works
- are solely in the form of machine-executable object code generated by a source language processor.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
- NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-
- INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
- FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
- IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- *************************************************************************************************@
-
- @model Dinamico.Models.ContentPart
-
- @{
-
- Content.Define(ie => {
- ie.Title = "Image and Text";
- ie.IconUrl = "{IconsUrl}/text_padding_left.png";
- ie.Text("Title", "Heading text").SortOrder(100);
- ie.ImageUpload("Image").SortOrder(200);
- ie.FreeText("Description").SortOrder(300);
- ie.CheckBox("ImageFirst", "Image first").DefaultValue(true).SortOrder(400);
- ie.CheckBox("HiddenPhone", "Hide image in mobile view (requires responsive CSS)").DefaultValue(false).SortOrder(500);
- });
-
- var imgCssClass = "img-polaroid";
- if (Content.Has.HiddenPhone && Content.Data.HiddenPhone == true) { imgCssClass += " hidden-phone"; }
-
- }
-
- @if (Content.Has.Title && !String.IsNullOrWhiteSpace(Content.Data.Title))
- {
- <h3>@Content.Data.Title</h3>
- }
-
- @if (Content.Has.ImageFirst && Content.Data.ImageFirst)
- {
- <div class="imageAndText container-fluid">
- <div class="row-fluid">
- <div class="span3"><img class="@imgCssClass" alt="@Content.Data.Title" src="@Content.Data.Image" /></div>
- <div class="span9">@Content.Display.Description</div>
- </div>
- </div>
- }
- else
- {
- <div class="imageAndText container-fluid">
- <div class="row-fluid">
- <div class="span9">@Content.Display.Description</div>
- <div class="span3"><img class="@imgCssClass" alt="@Content.Data.Title" src="@Content.Data.Image" /></div>
- </div>
- </div>
- }