In-Context Editing
Lean CMS lets content editors modify pages directly on the live site — no separate admin dashboard required for day-to-day edits.
How it works
When a user with CMS permissions is logged in, two editing mechanisms are activated:
-
Section overlays — Any section wrapped with
cms_editable_sectiongets a hover-activated dashed border and a sticky “Edit” button. Clicking Edit opens the field editor for that section in a new tab. -
Inline editing — Fields rendered with
editable_contentare directly clickable on the page. Clicking a field opens an inline input; saving updates the content without a page reload.
Both mechanisms are invisible to regular visitors. The wrappers render as plain HTML elements with no extra attributes unless a CMS user is logged in.
The editing gate
In-context editing only activates when all three conditions are true:
- The request is authenticated (
authenticated?returns true) - The current user has CMS permissions (
current_user.has_any_cms_permission?) - The
in_context_editingsetting is enabled (default:true)
The setting can be toggled in the CMS settings panel without a redeploy — useful if you want to temporarily disable editing on a site.
Enabling in your views
Wrap any page section to get the hover overlay:
<%= cms_editable_section(page: 'home', section: 'hero', display_title: 'Hero') do %>
<section class="hero">
...
</section>
<% end %>
For settings-backed content (phone number, address, hours), use the settings variant:
<%= cms_settings_section(display_title: 'Contact Information', anchor: 'site-info') do %>
<address>...</address>
<% end %>
The overlay button for settings sections links to the Settings admin page rather than a page content editor.