Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. @using Sitecore.XA.Foundation.MarkupDecorator.Extensions
  2. @using Sitecore.XA.Foundation.SitecoreExtensions.Extensions
  3. @model myworkspace.Models.SectionTitle
  4.  
  5. <div @Html.Sxa().Component("section-title", Model.Attributes)>
  6. <div class="component-content text-green section-title">
  7. @Html.Sxa().Field("Title", Model.Item, Model.GetRenderingWebEditingParams())
  8. <span class="underline-shape-line"></span>
  9. <span class="underline-shape-disc"></span>
  10. </div>
  11.  
  12. public class SectionTitle : RenderingModelBase
  13. {
  14. public SectionTitle() { }
  15. public string Title { get; set; }
  16. }
  17.  
  18. public class SectionTitleController : StandardController
  19. {
  20. private readonly ISectionTitleRepository _repository;
  21.  
  22. public SectionTitleController(ISectionTitleRepository repository)
  23. {
  24. _repository = repository;
  25. }
  26.  
  27. protected override object GetModel()
  28. {
  29. return _repository.GetModel();
  30. }
  31. }
  32.  
  33. public interface ISectionTitleRepository: IModelRepository
  34. {
  35. }
  36.  
  37. public class SectionTitleRepository : ModelRepository, ISectionTitleRepository
  38. {
  39. public override IRenderingModelBase GetModel()
  40. {
  41. SectionTitle model = new SectionTitle();
  42. FillBaseProperties(model);
  43. model.Title = GetTitle();
  44. return base.GetModel();
  45. }
  46.  
  47. private string GetTitle()
  48. {
  49. return PageContext.Current[Templates.SectionTitle.Fields.Title];
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement