Mandricore Cms engine
This project rocks!
License
Copyright (c) 2015 Mandricore.com. All rights reserved.
Tecla CMS
License: Other
This project rocks!
Copyright (c) 2015 Mandricore.com. All rights reserved.
GET API
From: https://docs.google.com/document/d/1qavAOoMVuNbLpLSp3AQgN2Yw4lor22XBM1TuNo_j8-0
Should allow for export of a List of different types of items, such as Blocks and Images (ie. Composite).
commercials (Composite): {
blocks: {
topBanner: -> NamedBlock
sideBanner: -> NamedBlock
matchOfTheDay: -> Block
}
images: {
bonus: -> Image
topCommercial: -> Image
}
}
When iterating over the returned structure, we can use for each block in commercials.blocks
or commercials.blocks.topBanner
We should AVOID the following!
commercials (List): [
{name: topBanner, block -> Block(internal name: banner) } : NamedBlock ,
{name: sideBanner, block -> Block(name:banner) } : NamedBlock ,
Each item should have a type, so that we can iterate and filter on the type.
We also want the serialized output to be rich and easy to use, not nested more than necessary.
Better to collapse a NamedBlock into a Block with a name than to mirror the actual underlying structure.
{
name: topBanner,
type: 'NamedBlock',
text: 'sdgdsgsddgs'
author: 'kmandrup'
}
Add templating for API: blocks, pages and menu.
Use the following code as a base "template" to work from
def block opts = {}
Block.find(opts);
end
# http://apidock.com/rails/ActionController/Base/render
Cms::RenderTemplate.new.render {
template: 'blog',
layout: 'blog_post',
:locals => block(blog: 'latest').to_json
}
# See spec
# https://github.com/yappbox/render_anywhere/blob/master/spec/lib/render_anywhere_spec.rb
class Cms::RenderTemplate
require 'render_anywhere'
include RenderAnywhere
prepend_view_path Cms::Template::Resolver.instance
attr_reader :template, :layout
# Include an additional helper
# If being used in a rake task, you may need to require the file(s)
# Ex: require Rails.root.join('app', 'helpers', 'blog_pages_helper')
def include_helper(helper_name)
set_render_anywhere_helpers(helper_name)
end
# Apply an instance variable to the controller
# If you need to use instance variables instead of locals, just call this method as many times as you need.
def set_instance_variable(var, value)
set_instance_variable(var, value)
end
class RenderingController < RenderAnywhere::RenderingController
# include custom modules here, define accessors, etc. For example:
# attr_accessor :current_user
# helper_method :current_user
end
# If you define custom RenderingController, don't forget to override this method
def rendering_controller
@rendering_controller ||= self.class.const_get("RenderingController").new
end
end
class TemplateFinder
require 'singleton'
include Singleton
def find_template(name)
find(name, 'template')
end
def find_layout(name)
find(name, 'layout')
end
# or via type: 'partial'
def find_partial(name)
find_template("_#{name}")
end
def find(name, type)
Template.find(name: name, type: type)
end
end
class Cms::Template
...
field format: String
def identifier
"#{record.type} - #{record.id} - #{record.path}"
end
end
# Singleton Pattern
# http://eftimov.net/singleton-pattern/
class Cms::Template::Resolver < ActionView::Resolver
require 'singleton'
include Singleton
def initialize
@finder = TemplateFinder.instance
end
def type prefix
prefix.empty? ? 'template' : 'layout'
end
def find_templates name, prefix, partial, details
create_template record(name, type(prefix))
end
def record name, type
finder.find name, type
end
def create_template record
Cms::Template::Creator.new(record).create
end
end
class Cms::Template::Creator
attr_reader :record
extend Forwardable
def_delegators :record, :path, :partial, :format, :name, :identifier, :body, :handler, :updated_at
def initialize record
@record = record
end
# Initialize an ActionView::Template object based on the record found.
def create
ActionView::Template.new body, identifier, template_handler, options
end
def template_handler
ActionView::Template.registered_template_handler handler
end
def options
{
:format => Mime[format],
:updated_at => updated_at,
:virtual_path => virtual_path(path, partial)
}
end
# Make paths as "users/user" become "users/_user" for partials.
def virtual_path
return path unless partial
index
end
def index
path.rindex('/') ? path.insert(index + 1, '_') : "_#{path}"
end
end
Allow setting of locale in session to configure translator locale for all API calls
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.