Code Monkey home page Code Monkey logo

Comments (6)

daniiiol avatar daniiiol commented on August 18, 2024

Hi @ssatpa

Thank you for the question.

A main idea of NitroNet is to have very clean view-presentations without to much logic. As a sample: we had a lot discussions internally to support edit frames or not. But finally, we came to the conclusion to support this special feature of Sitecore in NitroNet.Sitecore.

To edit Fields directly in the EE with NitroNet, I would beg you to create this logic in your Rendering Controller with the Sitecore FieldRenderer (Sitecore.Web.UI.WebControls.FieldRenderer.Render(...)).

Below an example of my dummy-component "Richtext":

public class RichtextController : Controller
    {
        // GET: Richtext
        public ActionResult Index()
        {
            var contentField = FieldRenderer.Render(Sitecore.Context.Item, "Content");
            var model = new Richtext {Content = contentField};
            return View("frontend/patterns/molecules/richtext/richtext", model);
        }
    }

and in your HBS File if you don't want Handlebars to escape a value, use the "triple-stash", {{{:

<div class="m-richtext data-t-name="Richtext">
	{{{content}}}
</div>

I hope having assisted you with this information.

from nitronetsitecore.

ssatpa avatar ssatpa commented on August 18, 2024

Hi @daniiiol ,
Thanks for your help. Just one question, does it work for miltilist/treelist or datetime or droplink or anchor field type, as in my case it is not working

datefield, droplink, anchor is not editable

image

from nitronetsitecore.

ssatpa avatar ssatpa commented on August 18, 2024

More over, does NitronetSitecore supports glassmapper or any other ORM ??

from nitronetsitecore.

daniiiol avatar daniiiol commented on August 18, 2024

Hi @ssatpa

GlassMapper
Yes, NitronetSitecore supports glassmapper and any other ORM as well. You are completely free in your controller. The ViewModel needs only the same properties as defined in your frontend code.

FieldTypes
Yes. Sitecore itself doesn't support these FieldTypes in the Experience Editor. See Stackexchange Link for more informations.
If you would like to give your authors a good toolset in the EE, add some Edit Frames (EF) or Customer Experience Buttons (CEB) around your components (CEB) or component parts (EF).

from nitronetsitecore.

ssatpa avatar ssatpa commented on August 18, 2024

Hi @daniiiol ,

Correct me if I'm wrong, If I use Glassmapper then my fields will not be editable in exp editor.

public ActionResult GetEmployeeDetails() { var context = new SitecoreContext(); var employee = context.GetCurrentItem<IEmployee>(); employee.Profile = employee.Profile; employee.Title = FieldRenderer.Render(Sitecore.Context.Item, "Title"); return View("employee", employee); }

Here both the fields Profile and Title are RichText editor fields, but only title is editable and profile is not as for "Title" I'm using "FieldRenderer", but for "Profile" I'm getting the value from glassmapper.

from nitronetsitecore.

daniiiol avatar daniiiol commented on August 18, 2024

In your sample, you have 2 properties.

  • The Profile property is your Sitecore field data
  • The Title property is your Sitecore field data WITH a FieldRenderer modification.

That's the point why you could edit the title only.

I recommend you to add some new properties with a "Render" suffix like "ProfileRender" to your GlassClass and add additionally this line of code:
employee.ProfileRender = FieldRenderer.Render(Sitecore.Context.Item, "Profile");
and you could edit the Profile-Field as well.

Hint:
Please read also the GlassMapper documentation. In GlassMapper you could use GlassHtml instead of FieldRenderer:

var glassHtml = new GlassHtml(new SitecoreContext());
employee.ProfileRender = glassHtml.Editable(employee, x => x.Profile)

You can find here a good explanation about the usage of GlassMapper in controller renderings without heavy presentation stuff in your views.

from nitronetsitecore.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.