Comments (6)
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.
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
from nitronetsitecore.
More over, does NitronetSitecore supports glassmapper or any other ORM ??
from nitronetsitecore.
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.
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.
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)
- Feature: Provide a demo solution HOT 2
- Feature: Add admin page to see the usage of NitroNet renderings
- NitroNetSitecore doesn't execute HBS Files HOT 2
- Auto-Generate model classes based on their schema.json definition HOT 1
- Feature: Manage Sitecore.Database object by IoC container
- New attribute on placeholder helper to enforce standard sitecore placeholder HOT 1
- NitroNetsitecore not working as expected, need a dummy solution HOT 6
- Automatically register the view engine
- NitroNetsitecore for view rendering. HOT 3
- Sitecore 9.0 Compatibility HOT 2
- Feature: Better Exception Message if two existing Renderings have the same Name HOT 2
- NitroNet.Sitecore.RenderingExclusions Setting - not in source code HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nitronetsitecore.