-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic item and some views to example
- Loading branch information
Showing
13 changed files
with
224 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,23 @@ | ||
from cone.app import main_hook | ||
from cone.app import get_root | ||
from cone.app import register_entry | ||
from cone.example.model import Translation | ||
from cone.example.model import ExampleNode | ||
from cone.example.model import EntryFolder | ||
import uuid | ||
|
||
|
||
def create_app_data(): | ||
"""Create example application data""" | ||
# register plugin entry nodes | ||
for i in range(1, 11): | ||
register_entry(f'folder_{i}', EntryFolder) | ||
from cone.example.browser import configure_resources | ||
|
||
|
||
@main_hook | ||
def example_main_hook(config, global_config, local_config): | ||
def example_main_hook(config, global_config, settings): | ||
"""Function which gets called at application startup to initialize | ||
this plugin. | ||
""" | ||
# add translation | ||
config.add_translation_dirs('cone.example:locale/') | ||
|
||
create_app_data() | ||
# register plugin entry nodes | ||
for i in range(1, 11): | ||
register_entry(f'folder_{i}', EntryFolder) | ||
|
||
# static resources | ||
configure_resources(config, settings) | ||
|
||
# scan browser package | ||
config.scan('cone.example.browser') |
37 changes: 33 additions & 4 deletions
37
examples/cone.example/src/cone/example/browser/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,40 @@ | ||
from cone.app.browser.layout import ProtectedContentTile | ||
from cone.example.model import ExampleNode | ||
from cone.example.model import EntryFolder | ||
from cone.example.model import Folder | ||
from cone.example.model import Item | ||
from cone.tile import tile | ||
import webresource as wr | ||
import os | ||
|
||
|
||
resources_dir = os.path.join(os.path.dirname(__file__), 'static') | ||
cone_example_resources = wr.ResourceGroup( | ||
name='cone.example', | ||
directory=resources_dir, | ||
path='example' | ||
) | ||
cone_example_resources.add(wr.StyleResource( | ||
name='cone-example-css', | ||
resource='cone.example.css' | ||
)) | ||
|
||
|
||
def configure_resources(config, settings): | ||
config.register_resource(cone_example_resources) | ||
config.set_resource_include('cone-example-css', 'authenticated') | ||
|
||
|
||
@tile(name='content', | ||
path='templates/view.pt', | ||
interface=EntryFolder, | ||
permission='login') | ||
@tile(name='content', | ||
path='templates/view.pt', | ||
interface=Folder, | ||
permission='login') | ||
@tile(name='content', | ||
path='templates/example.pt', | ||
interface=ExampleNode, | ||
path='templates/view.pt', | ||
interface=Item, | ||
permission='login') | ||
class ExamplePluginContent(ProtectedContentTile): | ||
class DefaultContent(ProtectedContentTile): | ||
pass |
8 changes: 8 additions & 0 deletions
8
examples/cone.example/src/cone/example/browser/static/cone.example.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#contextmenu a.state-private, | ||
tr.state-private td.title a { | ||
color: red; | ||
} | ||
#contextmenu a.state-public, | ||
tr.state-public td.title a { | ||
color: green; | ||
} |
Empty file.
3 changes: 0 additions & 3 deletions
3
examples/cone.example/src/cone/example/browser/templates/example.pt
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
examples/cone.example/src/cone/example/browser/templates/view.pt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<tal:view xmlns:tal="http://xml.zope.org/namespaces/tal" | ||
omit-tag="True"> | ||
|
||
<tal:contextmenu replace="structure tile('contextmenu')" /> | ||
|
||
<div class="card mt-3"> | ||
|
||
<div class="card-body"> | ||
|
||
<h4 class="card-title"> | ||
<span class="label label-primary" | ||
tal:content="model.metadata.title"> | ||
Title | ||
</span> | ||
</h4> | ||
|
||
<tal:byline replace="structure tile('byline')" /> | ||
|
||
<p class="card-text" tal:content="model.metadata.description"> | ||
Description | ||
</p> | ||
|
||
</div> | ||
|
||
</div> | ||
|
||
</tal:view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: PACKAGE 1.0\n" | ||
"POT-Creation-Date: 2024-05-25 18:52+0200\n" | ||
"POT-Creation-Date: 2024-05-26 07:48+0200\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
|
@@ -16,26 +16,37 @@ msgstr "" | |
"Content-Transfer-Encoding: 8bit\n" | ||
"Generated-By: Lingua 4.15.0\n" | ||
|
||
#: ./examples/cone.example/src/cone/example/publication.zcml:14 | ||
#. Default: Folder | ||
#: ./examples/cone.example/src/cone/example/model.py:146 | ||
#: ./examples/cone.example/src/cone/example/model.py:183 | ||
msgid "folder" | ||
msgstr "" | ||
|
||
#. Default: Item | ||
#: ./examples/cone.example/src/cone/example/model.py:198 | ||
msgid "item" | ||
msgstr "" | ||
|
||
#: ./examples/cone.example/src/cone/example/publication.zcml:16 | ||
msgid "private" | ||
msgstr "" | ||
|
||
#: ./examples/cone.example/src/cone/example/publication.zcml:19 | ||
#: ./examples/cone.example/src/cone/example/publication.zcml:21 | ||
msgid "Object is private" | ||
msgstr "" | ||
|
||
#: ./examples/cone.example/src/cone/example/publication.zcml:23 | ||
#: ./examples/cone.example/src/cone/example/publication.zcml:25 | ||
msgid "public" | ||
msgstr "" | ||
|
||
#: ./examples/cone.example/src/cone/example/publication.zcml:28 | ||
#: ./examples/cone.example/src/cone/example/publication.zcml:30 | ||
msgid "Object is public" | ||
msgstr "" | ||
|
||
#: ./examples/cone.example/src/cone/example/publication.zcml:33 | ||
#: ./examples/cone.example/src/cone/example/publication.zcml:35 | ||
msgid "private_to_public" | ||
msgstr "" | ||
|
||
#: ./examples/cone.example/src/cone/example/publication.zcml:43 | ||
#: ./examples/cone.example/src/cone/example/publication.zcml:45 | ||
msgid "public_to_private" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: PACKAGE 1.0\n" | ||
"POT-Creation-Date: 2024-05-25 18:52+0200\n" | ||
"POT-Creation-Date: 2024-05-26 07:48+0200\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
|
@@ -15,26 +15,37 @@ msgstr "" | |
"Content-Transfer-Encoding: 8bit\n" | ||
"Generated-By: Lingua 4.15.0\n" | ||
|
||
#: examples/cone.example/src/cone/example/publication.zcml:14 | ||
#. Default: Folder | ||
#: examples/cone.example/src/cone/example/model.py:146 | ||
#: examples/cone.example/src/cone/example/model.py:183 | ||
msgid "folder" | ||
msgstr "Ordner" | ||
|
||
#. Default: Item | ||
#: examples/cone.example/src/cone/example/model.py:198 | ||
msgid "item" | ||
msgstr "Object" | ||
|
||
#: examples/cone.example/src/cone/example/publication.zcml:16 | ||
msgid "private" | ||
msgstr "Privat" | ||
|
||
#: examples/cone.example/src/cone/example/publication.zcml:19 | ||
#: examples/cone.example/src/cone/example/publication.zcml:21 | ||
msgid "Object is private" | ||
msgstr "Object ist privat" | ||
|
||
#: examples/cone.example/src/cone/example/publication.zcml:23 | ||
#: examples/cone.example/src/cone/example/publication.zcml:25 | ||
msgid "public" | ||
msgstr "Öffentlich" | ||
|
||
#: examples/cone.example/src/cone/example/publication.zcml:28 | ||
#: examples/cone.example/src/cone/example/publication.zcml:30 | ||
msgid "Object is public" | ||
msgstr "Objekt ist öffentlich" | ||
|
||
#: examples/cone.example/src/cone/example/publication.zcml:33 | ||
#: examples/cone.example/src/cone/example/publication.zcml:35 | ||
msgid "private_to_public" | ||
msgstr "veröffentlichen" | ||
|
||
#: examples/cone.example/src/cone/example/publication.zcml:43 | ||
#: examples/cone.example/src/cone/example/publication.zcml:45 | ||
msgid "public_to_private" | ||
msgstr "zurückziehen" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: PACKAGE 1.0\n" | ||
"POT-Creation-Date: 2024-05-25 18:52+0200\n" | ||
"POT-Creation-Date: 2024-05-26 07:48+0200\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
|
@@ -15,26 +15,37 @@ msgstr "" | |
"Content-Transfer-Encoding: 8bit\n" | ||
"Generated-By: Lingua 4.15.0\n" | ||
|
||
#: examples/cone.example/src/cone/example/publication.zcml:14 | ||
#. Default: Folder | ||
#: examples/cone.example/src/cone/example/model.py:146 | ||
#: examples/cone.example/src/cone/example/model.py:183 | ||
msgid "folder" | ||
msgstr "Folder" | ||
|
||
#. Default: Item | ||
#: examples/cone.example/src/cone/example/model.py:198 | ||
msgid "item" | ||
msgstr "Item" | ||
|
||
#: examples/cone.example/src/cone/example/publication.zcml:16 | ||
msgid "private" | ||
msgstr "Private" | ||
|
||
#: examples/cone.example/src/cone/example/publication.zcml:19 | ||
#: examples/cone.example/src/cone/example/publication.zcml:21 | ||
msgid "Object is private" | ||
msgstr "Object is private" | ||
|
||
#: examples/cone.example/src/cone/example/publication.zcml:23 | ||
#: examples/cone.example/src/cone/example/publication.zcml:25 | ||
msgid "public" | ||
msgstr "Public" | ||
|
||
#: examples/cone.example/src/cone/example/publication.zcml:28 | ||
#: examples/cone.example/src/cone/example/publication.zcml:30 | ||
msgid "Object is public" | ||
msgstr "Object is public" | ||
|
||
#: examples/cone.example/src/cone/example/publication.zcml:33 | ||
#: examples/cone.example/src/cone/example/publication.zcml:35 | ||
msgid "private_to_public" | ||
msgstr "publish" | ||
|
||
#: examples/cone.example/src/cone/example/publication.zcml:43 | ||
#: examples/cone.example/src/cone/example/publication.zcml:45 | ||
msgid "public_to_private" | ||
msgstr "retract" |
Oops, something went wrong.