Skip to content

Commit

Permalink
simplify styles, fix add dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
rnixx committed May 25, 2024
1 parent 2c3ab6c commit 9d7da5b
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 56 deletions.
35 changes: 26 additions & 9 deletions examples/cone.example/src/cone/example/model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from cone.app.model import AppNode
from cone.app.model import CopySupport
from cone.app.model import FactoryNode
from cone.app.model import Metadata
from cone.app.model import node_info
Expand Down Expand Up @@ -81,14 +82,16 @@ class PublicationWorkflowNode:
default_acl = [
(Allow, 'system.Authenticated', ['view']),
(Allow, 'role:viewer', ['view', 'list']),
(Allow, 'role:editor', ['view', 'list', 'add', 'edit']),
(Allow, 'role:editor', [
'view', 'list', 'add', 'edit', 'cut', 'copy', 'paste'
]),
(Allow, 'role:admin', [
'view', 'list', 'add', 'edit', 'delete', 'change_state',
'manage_permissions'
'view', 'list', 'add', 'edit', 'delete', 'cut', 'copy', 'paste',
'change_state', 'manage_permissions'
]),
(Allow, 'role:manager', [
'view', 'list', 'add', 'edit', 'delete', 'change_state',
'manage_permissions', 'manage'
'view', 'list', 'add', 'edit', 'delete', 'cut', 'copy', 'paste',
'change_state', 'manage_permissions', 'manage'
]),
(Allow, Everyone, ['login']),
(Deny, Everyone, ALL_PERMISSIONS),
Expand All @@ -98,7 +101,7 @@ def __call__(self):
...


@plumbing(PrincipalACL)
@plumbing(PrincipalACL, CopySupport)
class BaseContainer(PublicationWorkflowNode):
role_inheritance = True

Expand All @@ -114,17 +117,22 @@ def properties(self):
props.action_up = True
props.action_add = True
props.action_list = True
props.action_edit = True
props.action_sharing = True
return props

@property
def metadata(self):
md = Metadata()
md.title = self.attrs['title'].value
md.icon = self.nodeinfo.icon
return md


@node_info(
name='entry_folder',
title=_('folder', default='Folder'),
icon='bi bi-folder',
addables=['folder'])
class EntryFolder(BaseContainer):

def __init__(self, name=None, parent=None):
Expand All @@ -135,6 +143,15 @@ def __init__(self, name=None, parent=None):


@node_info(
name='folder')
name='folder',
title=_('folder', default='Folder'),
icon='bi bi-folder',
addables=['folder'])
class Folder(BaseContainer):
...

@property
def properties(self):
props = super().properties
props.action_edit = True
props.action_delete = True
return props
23 changes: 0 additions & 23 deletions scss/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -251,29 +251,6 @@ body {
#main-area {
width: 0!important; /* prevent 'jumping' between 1400 and 1440px */
}
#contextmenu {
li.nav-item.dropdown .nav-link.dropdown-toggle.show {
background-color: $dropdown-border-color;
}
a {
padding: 0 8px;
text-decoration: none;
color: $form-text-color;
}
.dropdown-item {
&:active {
background-color: var(--bs-dropdown-link-hover-bg);
}

a {
padding: 0;

&.selected {
color: $primary;
}
}
}
}

/* scrollbar */
.scrollable-x, .scrollable-y {
Expand Down
1 change: 1 addition & 0 deletions src/cone/app/browser/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ def __init__(self, **kw):
def target(self):
return make_url(self.request, node=self.model)


class ActionUp(LinkAction):
"""One level up action."""
id = 'toolbaraction-up'
Expand Down
4 changes: 2 additions & 2 deletions src/cone/app/browser/contextmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


class ContextMenuToolbar(Toolbar):
css = u'nav-item py-2'
css = u'nav-item py-0'

def __call__(self, model, request):
if not self.display:
Expand All @@ -40,7 +40,7 @@ def __call__(self, model, request):
continue
# wrap link action in list item
rendered_actions.append(
f'<li class="nav-item py-2">{rendered}</li>'
f'<li class="nav-item py-0">{rendered}</li>'
)
if not rendered_actions:
return ''
Expand Down
18 changes: 0 additions & 18 deletions src/cone/app/browser/static/cone/cone.app.css
Original file line number Diff line number Diff line change
Expand Up @@ -268,24 +268,6 @@ body {
width: 0 !important; /* prevent 'jumping' between 1400 and 1440px */
}

#contextmenu li.nav-item.dropdown .nav-link.dropdown-toggle.show {
background-color: var(--bs-border-color-translucent);
}
#contextmenu a {
padding: 0 8px;
text-decoration: none;
color: var(--bs-secondary-color);
}
#contextmenu .dropdown-item:active {
background-color: var(--bs-dropdown-link-hover-bg);
}
#contextmenu .dropdown-item a {
padding: 0;
}
#contextmenu .dropdown-item a.selected {
color: #4e7bba;
}

/* scrollbar */
.scrollable-x, .scrollable-y {
position: relative;
Expand Down
2 changes: 1 addition & 1 deletion src/cone/app/browser/static/cone/cone.app.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/cone/app/browser/templates/add_dropdown.pt
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
i18n:domain="cone.app"
omit-tag="True">

<li class="dropdown">
<li class="nav-item dropdown py-0">

<a href="#"
class="dropdown-toggle"
class="nav-link dropdown-toggle py-2 px-3"
data-bs-toggle="dropdown">
<span i18n:translate="add">Add</span>
<span class="caret"></span>
</a>

<ul class="dropdown-menu" role="addmenu">
<ul class="dropdown-menu rounded-0 rounded-bottom mt-0" role="addmenu">
<li tal:repeat="item context.items">
<a href="${item.url}"
class="dropdown-item"
Expand Down

0 comments on commit 9d7da5b

Please sign in to comment.