Skip to content

Commit

Permalink
style referencebrowser as input-group
Browse files Browse the repository at this point in the history
  • Loading branch information
lenadax committed Dec 3, 2024
1 parent 78e1515 commit 5f39b1c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions scss/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ body {
#footer {
z-index: 1;
}
.referencebrowser_trigger {
cursor: pointer;
}

@import 'content.scss';
@import 'form.scss';
Expand Down
7 changes: 4 additions & 3 deletions src/cone/app/browser/referencebrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def reference_extractor(widget, data):
return data.request['{}.uid'.format(widget.dottedpath)]


def wrap_ajax_target(rendered, widget, data):
def wrap_ajax_target(rendered, widget, data, cssclass):
target = widget.attrs['target']
if not target:
request = data.request.request
Expand Down Expand Up @@ -327,13 +327,14 @@ def wrap_ajax_target(rendered, widget, data):
target = '{}{}'.format(target, query)
attrs = {
'ajax:target': target,
'class_': cssclass
}
return tag('span', rendered, **attrs)


def reference_trigger_renderer(widget, data):
attrs = {
'class': 'referencebrowser_trigger',
'class': 'referencebrowser_trigger input-group-text',
'data-reference-name': widget.dottedpath
}
return data.tag(
Expand Down Expand Up @@ -411,7 +412,7 @@ def reference_edit_renderer(widget, data):
}
rendered = tag('input', **text_attrs) + tag('input', **hidden_attrs)
trigger = reference_trigger_renderer(widget, data)
return wrap_ajax_target(rendered + trigger, widget, data)
return wrap_ajax_target(rendered + trigger, widget, data, 'input-group')


def reference_display_renderer(widget, data):
Expand Down
4 changes: 4 additions & 0 deletions src/cone/app/browser/static/cone/cone.app.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ body {
z-index: 1;
}

.referencebrowser_trigger {
cursor: pointer;
}

/* content */
#content {
height: calc(100% - 40px);
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.

0 comments on commit 5f39b1c

Please sign in to comment.