Skip to content

Commit

Permalink
Add basic item and some views to example
Browse files Browse the repository at this point in the history
  • Loading branch information
rnixx committed May 26, 2024
1 parent c3f56fa commit 57ec7be
Show file tree
Hide file tree
Showing 13 changed files with 224 additions and 88 deletions.
1 change: 1 addition & 0 deletions TODO.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
TODO
====

- Selectable table row colors dark/light mode.
- Live search.
- SCSS splitting.
- Reduce CSS class noise and add some custom rules to SCSS files.
Expand Down
4 changes: 2 additions & 2 deletions examples/cone.example/example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ pyramid.default_locale_name = en
cone.available_languages = de, en

# cone.app admin user and password
#cone.admin_user = admin
#cone.admin_password = admin
#cone.admin_user =
#cone.admin_password =

# cone.app auth tkt settings
cone.auth_secret = 12345
Expand Down
21 changes: 8 additions & 13 deletions examples/cone.example/src/cone/example/__init__.py
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 examples/cone.example/src/cone/example/browser/__init__.py
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
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.

This file was deleted.

27 changes: 27 additions & 0 deletions examples/cone.example/src/cone/example/browser/templates/view.pt
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>
25 changes: 18 additions & 7 deletions examples/cone.example/src/cone/example/locale/cone.example.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 ""
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Loading

0 comments on commit 57ec7be

Please sign in to comment.