-
Notifications
You must be signed in to change notification settings - Fork 1
Editor
If you want to develop a content driven web application, you will need some content. At least during the early stages of a project, this can be a problem since you won't have the respective parts of the project in place to enter data into your storage layer.
This is how the Tangram Generic Editor came into existence. It can deal with any
type of content fulfilling the Tangram org.tangram.content.Content
interface and
provides a simple and lean interface to edit items following their JavaBeans interface.
To be able to use the editor, you have to add the tangram:tangram-editor
dependency to
you project.
dependencies {
...
runtime "tangram:tangram-nucleus:$tangram_version"
...
}
With Tangram 1.0 and with some containers it is necessary to add both, the JAR and the WAR dependency, to you project to let the files for the Tangram Editor be integrated into your application instead of just using them from the JAR (which is a Servlet API 3.0 feature). The Tangram Gradle Plugin is responsible for the overlaying in this case, but of course you could use any other overlaying plugin or use maven instead.
dependencies {
...
webapp "tangram:tangram-core:$tangram_version:war@war"
compile "tangram:tangram-nucleus:$tangram_version"
...
}
Any person from the list of people with a valid login for your Tangram based application
that should be able to use the editor, must be in the so called "admin" role. It is
the only role distinguished by the authorization part
of Tangram. So you have to configure the adminUsers
list.
This can be achieved statically in the web application setup (where you at least should
have one account available) through the set adminUsers
of the PasswordFilter
or
PasswordInterceptor
respectively.
Static configuration of the set of admin users (with just one element) using the Springframework:
<util:set id="adminUsers" value-type="java.lang.String">
<value>form:admin</value>
</util:set>
Static configuration of the set of admin users (with just one element) using Google Guice with the Guicy implementation of Tangram:
adminUsers=java.util.Set(form:admin)
Static configuration of the set of admin users (with just one element) using dinistiq:
adminUsers=java.util.Set(form:admin)
In addition to this static list, the list of admin users being able to edit content can be extended at runtime similar to the list of users with a valid login. Since this is done using the editor, at least one account needs to be in place in the static list, to be able to boot strap this process. See the [authentication and authorization] (AuthenticationAuthorization) chapter for details.
The Tangram Editor can be reached through the URL
https://your.server/yourapplication/tangramservlet/list
Since all the parts here - except the list suffix - are applicaiton specific, this is not really self explanatory. E.g. the application context can even be the ROOT context and thus must be omitted in the URL. So lets give an example.
The example application called example has the tangram servlet configured to /s like the default. So running on your development machine localhost on port 8080 this results in
http://localhost:8080/example/s/list
It is the responsibility of the application setup, that these URLs should be accessed through https preferably.
Since content elements don't necessarily provide things like folders to structure the storage of content, the tangram editor provides a generic filtering facility based on the contents of properties. Thus keywords, title, or even folder like paths can be used to filter content.
The editor stors the filter settings for each content type available.
Since some scenarios of Tangram are weak about referential integrity, the "delete" button of the editor is switched off by default.
To make this button available, you have to set the property deleteMethodEnabled
of the EditingHandler instance to true using the means of your respective DI
container in use for configuration of Tangram.
The Editor jar and war come in two flavours: The standard implementation uses the editing components CKEditor and CodeMirror by reference, the "local" flavour integrates a copy so that your installation later only depends on resources delivered through you server instances.