shuup.xtheme.layout package
Submodules
shuup.xtheme.layout.utils module
Module contents
- class shuup.xtheme.layout.AnonymousContactLayout(theme, placeholder_name, rows=None)[source]
Bases:
Layout
- Parameters:
- get_help_text(context)[source]
Help text for this placeholder box shown at the top of the editable layout.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Returns:
Help text for this layout.
- Return type:
- get_layout_data_suffix(context)[source]
Layout data suffix which is used to save layout data to view config.
With layout data suffix you can define data keys that is only available for certain contexts. Make sure that you validate the context for variables that is used to form this suffix.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Return type:
- identifier = 'xtheme-anonymous-contact-layout'
- class shuup.xtheme.layout.CategoryLayout(theme, placeholder_name, rows=None)[source]
Bases:
Layout
- Parameters:
- get_help_text(context)[source]
Help text for this placeholder box shown at the top of the editable layout.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Returns:
Help text for this layout.
- Return type:
- get_layout_data_suffix(context)[source]
Layout data suffix which is used to save layout data to view config.
With layout data suffix you can define data keys that is only available for certain contexts. Make sure that you validate the context for variables that is used to form this suffix.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Return type:
- identifier = 'xtheme-category-layout'
- class shuup.xtheme.layout.CompanyContactLayout(theme, placeholder_name, rows=None)[source]
Bases:
Layout
- Parameters:
- get_help_text(context)[source]
Help text for this placeholder box shown at the top of the editable layout.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Returns:
Help text for this layout.
- Return type:
- get_layout_data_suffix(context)[source]
Layout data suffix which is used to save layout data to view config.
With layout data suffix you can define data keys that is only available for certain contexts. Make sure that you validate the context for variables that is used to form this suffix.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Return type:
- identifier = 'xtheme-company-contact-layout'
- class shuup.xtheme.layout.ContactLayout(theme, placeholder_name, rows=None)[source]
Bases:
Layout
- Parameters:
- get_help_text(context)[source]
Help text for this placeholder box shown at the top of the editable layout.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Returns:
Help text for this layout.
- Return type:
- get_layout_data_suffix(context)[source]
Layout data suffix which is used to save layout data to view config.
With layout data suffix you can define data keys that is only available for certain contexts. Make sure that you validate the context for variables that is used to form this suffix.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Return type:
- identifier = 'xtheme-contact-layout'
- class shuup.xtheme.layout.Layout(theme, placeholder_name, rows=None)[source]
Bases:
object
The layout (row, cell and plugin configuration) for a single placeholder.
- Parameters:
- add_plugin(plugin_identifier, config)[source]
Configure a plugin in the last row and cell of the layout.
If no rows or cells exist, one row and one cell is implicitly created.
This is internally used by
LayoutPartExtension
, but could just as well be used to programmatically create layouts for whichever purpose.- Parameters:
- Returns:
The configured cell.
- Return type:
- begin_column(sizes=None)[source]
Begin a new column (cell) in the layout, in the last row.
If no rows exist, one is implicitly created, for your convenience. The newly created cell has no plugin or configuration.
This is internally used by
LayoutPartExtension
, but could just as well be used to programmatically create layouts for whichever purpose.- Parameters:
sizes – The size dictionary to pass to
LayoutCell
.- Returns:
The newly created cell
- Return type:
- begin_row()[source]
Begin a new row in the layout.
This is internally used by
LayoutPartExtension
, but could just as well be used to programmatically create layouts for whichever purpose.- Returns:
The newly created row.
- Return type:
- cell_class_template = 'col-%(breakpoint)s-%(width)s'
- delete_cell(x, y)[source]
Delete a layout cell indicated by the given (zero-based) coordinates.
If the coordinates are out of range, nothing is done.
- get_cell(x, y)[source]
Get a layout cell indicated by the given (zero-based) coordinates.
If the coordinates are out of range, returns None.
- Parameters:
- Returns:
Layout cell.
- Return type:
LayoutCell|None
- get_help_text(context)[source]
Help text for this placeholder box shown at the top of the editable layout.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Returns:
Help text for this layout.
- Return type:
- get_layout_data_suffix(context)[source]
Layout data suffix which is used to save layout data to view config.
With layout data suffix you can define data keys that is only available for certain contexts. Make sure that you validate the context for variables that is used to form this suffix.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Return type:
- hide_cell_class_template = 'hidden-%(breakpoint)s'
- identifier = 'xtheme-default-layout'
- insert_row(y=None)[source]
Insert a new row at the given zero-based row and return it.
If
y
is None, the row in inserted at the end.
- is_valid_context(context)[source]
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Returns:
Whether the current context is valid for this layout.
- Return type:
- move_cell_to_position(from_x, from_y, to_x, to_y)[source]
Move the layout cell to the specified zero-based coordinates.
If the coordinates are out of range, nothing is done.
- Parameters:
- Returns:
Was something done?
- Return type:
- move_row_to_index(from_y, to_y)[source]
Move the y’th row to the specified zero-based index.
If
y
or index are out of bounds, nothing is done.
- row_class = 'row'
- class shuup.xtheme.layout.LayoutCell(theme, plugin_identifier, config=None, sizes=None, align='', extra_classes='')[source]
Bases:
object
A single cell in a layout. Maps to Bootstrap’s
col-XX-XX
classes.Initialize a layout cell with a given plugin, config and sizing configuration.
- Parameters:
- __init__(theme, plugin_identifier, config=None, sizes=None, align='', extra_classes='')[source]
Initialize a layout cell with a given plugin, config and sizing configuration.
- instantiate_plugin()[source]
Instantiate the plugin with the current config.
- Returns:
Instantiated plugin (if a class is available).
- Return type:
Plugin|None
- property plugin_class
Get the actual plugin class for this cell, or None if the plugin class isn’t available.
- Returns:
Plugin or None.
- Return type:
Plugin|None
- property plugin_name
Get the name of the plugin in this cell for display purposes.
- Returns:
Plugin name string.
- Return type:
- render(context, cache_key_prefix=None)[source]
Return the plugin’s rendered content.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Returns:
string of content.
- Return type:
- class shuup.xtheme.layout.LayoutRow(theme, cells=None)[source]
Bases:
object
A single row in a layout. Maps to Bootstrap’s
row
class.- Parameters:
cells – Optional iterable of LayoutCells to populate this LayoutRow with.
- __init__(theme, cells=None)[source]
- Parameters:
cells – Optional iterable of LayoutCells to populate this LayoutRow with.
- add_cell(sizes=None)[source]
Add an empty cell to this row. Used by the editor API.
- Parameters:
sizes (dict|None) – An optional size dict, see
LayoutCell
.- Returns:
The new layout cell.
- Return type:
- class shuup.xtheme.layout.PersonContactLayout(theme, placeholder_name, rows=None)[source]
Bases:
Layout
- Parameters:
- get_help_text(context)[source]
Help text for this placeholder box shown at the top of the editable layout.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Returns:
Help text for this layout.
- Return type:
- get_layout_data_suffix(context)[source]
Layout data suffix which is used to save layout data to view config.
With layout data suffix you can define data keys that is only available for certain contexts. Make sure that you validate the context for variables that is used to form this suffix.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Return type:
- identifier = 'xtheme-person-contact-layout'
- class shuup.xtheme.layout.ProductLayout(theme, placeholder_name, rows=None)[source]
Bases:
Layout
- Parameters:
- get_help_text(context)[source]
Help text for this placeholder box shown at the top of the editable layout.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Returns:
Help text for this layout.
- Return type:
- get_layout_data_suffix(context)[source]
Layout data suffix which is used to save layout data to view config.
With layout data suffix you can define data keys that is only available for certain contexts. Make sure that you validate the context for variables that is used to form this suffix.
- Parameters:
context (jinja2.runtime.Context) – Jinja2 rendering context.
- Return type:
- identifier = 'xtheme-product-layout'