Giter Site home page Giter Site logo

yvestrublin / silverstripe-gridstructuredcontent Goto Github PK

View Code? Open in Web Editor NEW

This project forked from burnbright/silverstripe-gridstructuredcontent

0.0 1.0 0.0 210 KB

Allows structuring Content editor content into CSS grid system layouts

PHP 62.79% JavaScript 15.90% CSS 7.90% Scheme 13.41%

silverstripe-gridstructuredcontent's Introduction

SilverStripe Grid Structured Content Module

The layout-with-tables killer.

Author

Why

Problem: structuring content beyond single columns.

Existing solutions:

  • pre-define template(s) and additional db fields for holding content.
  • use tables within TinyMCE Content editor.
  • define content in seperate DataObjects, eg Page Elements Module
  • SilverStripe Blocks

New solution: use the CSS grids we've come to know and love

This can be done by splitting up 'Content' field with a short delimiter string, and also storing a (sub)grid structure. The grid strucutre could be predefined by a designer, or edited by the user. This means defining the appropriate nesting of rows, columns, and width each column spans.

The same TinyMCE editor interface can be used, with the only difference being that you choose what part of the grid you are working on. On save, the seperate grid sections are concatenated into the 'Content' db field, and are delimited by a front-end invisible string.

When rendering on the front-end, the defined grid structure is traversed (depth first), dropping the delimited Content into the appropriate areas.

This idea relies on the fact that most grid systems are the same. Most have:

  • Predefined number of columns
  • HTML structure & CSS classes for defining grid layout

For example, here is the bootstrap structure

<div class="row">
    <div class="span4">...</div>
    <div class="span8">...</div>
</div>

Converted to a generic SilverStripe template:

<div class="row">
	<% loop Columns %>
		<div class="span{$Width}">
			$Content
		</div>
	<% end_loop %>
</div>

The minor differences between grid systems should be handled by using a slightly different row template.

Benefits:

  • Grid system agnostic: it should would work with different CSS grid systems.
  • Un-obtrusive: it doesn't require any new data objects, or fields.
  • Clever: all content is stored in 'Content' db field, therefore taking full advantage of history, rollback etc.
  • Graceful: the 'Content' field could still be displayed in a single column format with $Content, because delimiters will be hidden. This also means content summaries can still be used.

Research

List of CSS Grid Systems/Frameworks

Javascript Grid Layout Editors

Similar ideas

Screenshots

Editor

Configuration

silverstripe-gridstructuredcontent's People

Contributors

chillu avatar jedateach avatar yvestrublin avatar

Watchers

 avatar

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.