Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ikunato 8 posts 109 karma points
    Apr 15, 2019 @ 13:33
    Ikunato
    0

    Rendering redundant infos

    Hello guys,

    I'm new to Umbraco, so I kind of not understand everything with it so I'm asking for a little bit of help out here.

    I have currently a static website with basic MVC but I need to put it in a Umbraco... So I want to start at the most difficult things. First thing first, I want to make the website as smooth as possible for a non-developer person to use the backoffice to make as much change possible without asking for help to developers every now and then... So I have to render multiple times same layout of info (In short, on the website, we show the people in the society : photo, first and last name, job title and LinkedIn url). So what I want is the easiest way possible to do that in Umbraco (remember that the person who will use the website will have approximately 0 knowledge of development).

    What do you guys think of it ? Oh and if there is no easy way, I will teach her but the less code there will be, better it is going to be

    Thanks in advance

  • Ikunato 8 posts 109 karma points
    Apr 15, 2019 @ 13:52
    Ikunato
    0

    I've think of : Maybe a grid... Maybe a Partial View Macros... But the grid implies to know how many TeamMember i'll have... and the layout is going to change in mobile (a grid with 4 columns will become a slider in a mobile display)... The Partial View Macros implies a little bit of code, I think...

  • Damiaan 442 posts 1301 karma points MVP 6x c-trib
    Apr 15, 2019 @ 19:46
    Damiaan
    100

    I would allow the user to add "person" documents and then create a template which loops all the persons.

    So...

    • step 1: create a persons doc type
    • step 2: create a person doctype
    • step 3: allow a person underneath the persons
    • step 4: create a template for the persons page

    The template would contain code like below

    @foreach(var person in Model.Children()) 
    {
      <div>
        <div>@person.Name</div>
        <div>@person.phone</div>
       </div>
    }
    

    this will render very fast and the content editor will be very happy

  • Damiaan 442 posts 1301 karma points MVP 6x c-trib
    Apr 15, 2019 @ 19:52
    Damiaan
    1

    I am not sure on what your level on expertise is.

    If this would be too much information, I would consider using the tutorial on creating a basic website. This has an similar example with news.

  • Ikunato 8 posts 109 karma points
    Apr 16, 2019 @ 06:38
    Ikunato
    0

    Thank you, I've already check, but doing it a second time can't be bad at all... And thanks for you solution, I'll try that

  • Ikunato 8 posts 109 karma points
    Apr 16, 2019 @ 09:33
    Ikunato
    0

    Ok so It worked partially... I've made it to work in the preview of the template "persons" but I want it to be shown on the homepage

    This is what I do in the template :

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<ContentModels.Employees>
    @using ContentModels = Umbraco.Web.PublishedModels;
    @{
        Layout = "master.cshtml";
    }
        @foreach (var item in Model.Children())
        {
            var mainPostImage = item.Value<IPublishedContent>("photo");
            {     
                <div class="person-card d-flex flex-column text-center align-items-center justify-content-start col-md-3 col-6 mb-3">
                <img [email protected] alt="image description" class="mb-2">
                <h3 class="h3"><span>@item.Value("firstName")</span> @item.Value("lastName")</h3>
                <span class="position">@item.Value("jobTitle")</span>
                <a [email protected]("linkedIn") class="profile-link"><img width="44" src="/images/link-logo.png" alt="image description"></a>
                @*@if (!String.IsNullOrEmpty(@item.Value("linkedIn")))
                {
                    <a [email protected]("linkedIn") class="profile-link"><img width="44" src="/images/link-logo.png" alt="image description"></a>
                }*@
                </div>
            }
        }
    

    Should the logic will be the same ?

    I tried something like

    var selection = Model.Content.Site().FirstChild("employees").Children("employee").Where(x => x.IsVisible()).OrderByDescending(x => x.Id);
    

    But I got this : enter image description here

    I feel like I am doing something wrong because I want to do it too quickly lol

  • Ikunato 8 posts 109 karma points
    Apr 16, 2019 @ 09:51
    Ikunato
    0

    Nevermind. Found it. Thanks !

Please Sign in or register to post replies

Write your reply to:

Draft