Add some standard CRUD buttons for buefy themes
finally! also disable the permalink "feature" since it seems not useful
This commit is contained in:
parent
30f95e2f08
commit
31dff0d353
|
@ -51,14 +51,9 @@ header .navbar-item.nested {
|
||||||
padding-left: 2.5rem;
|
padding-left: 2.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
header .level #current-context,
|
header span.header-text {
|
||||||
header .level-left #current-context {
|
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
|
||||||
|
|
||||||
header .level #current-context span,
|
|
||||||
header .level-left #current-context span {
|
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
% if master.editable and request.has_perm('{}.edit'.format(permission_prefix)):
|
% if master.editable and request.has_perm('{}.edit'.format(permission_prefix)):
|
||||||
<li>${h.link_to("Edit this {}".format(model_title), action_url('edit', instance))}</li>
|
<li>${h.link_to("Edit this {}".format(model_title), action_url('edit', instance))}</li>
|
||||||
% endif
|
% endif
|
||||||
% if master.creatable and master.show_create_link and request.has_perm('{}.create'.format(permission_prefix)):
|
% if not use_buefy and master.creatable and master.show_create_link and master.has_perm('create'):
|
||||||
% if master.creates_multiple:
|
% if master.creates_multiple:
|
||||||
<li>${h.link_to("Create new {}".format(model_title_plural), url('{}.create'.format(route_prefix)))}</li>
|
<li>${h.link_to("Create new {}".format(model_title_plural), url('{}.create'.format(route_prefix)))}</li>
|
||||||
% else:
|
% else:
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<li>${h.link_to("View this {}".format(model_title), action_url('view', instance))}</li>
|
<li>${h.link_to("View this {}".format(model_title), action_url('view', instance))}</li>
|
||||||
% endif
|
% endif
|
||||||
${self.context_menu_item_delete()}
|
${self.context_menu_item_delete()}
|
||||||
% if master.creatable and master.show_create_link and request.has_perm('{}.create'.format(permission_prefix)):
|
% if not use_buefy and master.creatable and master.show_create_link and master.has_perm('create'):
|
||||||
% if master.creates_multiple:
|
% if master.creates_multiple:
|
||||||
<li>${h.link_to("Create new {}".format(model_title_plural), url('{}.create'.format(route_prefix)))}</li>
|
<li>${h.link_to("Create new {}".format(model_title_plural), url('{}.create'.format(route_prefix)))}</li>
|
||||||
% else:
|
% else:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<%inherit file="/form.mako" />
|
<%inherit file="/form.mako" />
|
||||||
|
|
||||||
<%def name="context_menu_item_delete()">
|
<%def name="context_menu_item_delete()">
|
||||||
% if master.deletable and instance_deletable and request.has_perm('{}.delete'.format(permission_prefix)):
|
% if not use_buefy and master.deletable and instance_deletable and master.has_perm('delete'):
|
||||||
% if master.delete_confirm == 'simple':
|
% if master.delete_confirm == 'simple':
|
||||||
<li>
|
<li>
|
||||||
## note, the `ref` here is for buefy only
|
## note, the `ref` here is for buefy only
|
||||||
|
|
|
@ -155,7 +155,7 @@
|
||||||
% if master.results_downloadable_xlsx and request.has_perm('{}.results_xlsx'.format(permission_prefix)):
|
% if master.results_downloadable_xlsx and request.has_perm('{}.results_xlsx'.format(permission_prefix)):
|
||||||
<li>${h.link_to("Download results as XLSX", url('{}.results_xlsx'.format(route_prefix)))}</li>
|
<li>${h.link_to("Download results as XLSX", url('{}.results_xlsx'.format(route_prefix)))}</li>
|
||||||
% endif
|
% endif
|
||||||
% if master.creatable and master.show_create_link and request.has_perm('{}.create'.format(permission_prefix)):
|
% if not use_buefy and master.creatable and master.show_create_link and master.has_perm('create'):
|
||||||
% if master.creates_multiple:
|
% if master.creates_multiple:
|
||||||
<li>${h.link_to("Create new {}".format(model_title_plural), url('{}.create'.format(route_prefix)))}</li>
|
<li>${h.link_to("Create new {}".format(model_title_plural), url('{}.create'.format(route_prefix)))}</li>
|
||||||
% else:
|
% else:
|
||||||
|
|
|
@ -48,22 +48,24 @@
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="context_menu_items()">
|
<%def name="context_menu_items()">
|
||||||
<li>${h.link_to("Permalink for this {}".format(model_title), action_url('view', instance))}</li>
|
## TODO: either make this configurable, or just lose it.
|
||||||
|
## nobody seems to ever find it useful in practice.
|
||||||
|
## <li>${h.link_to("Permalink for this {}".format(model_title), action_url('view', instance))}</li>
|
||||||
% if master.has_versions and request.rattail_config.versioning_enabled() and request.has_perm('{}.versions'.format(permission_prefix)):
|
% if master.has_versions and request.rattail_config.versioning_enabled() and request.has_perm('{}.versions'.format(permission_prefix)):
|
||||||
<li>${h.link_to("Version History", action_url('versions', instance))}</li>
|
<li>${h.link_to("Version History", action_url('versions', instance))}</li>
|
||||||
% endif
|
% endif
|
||||||
% if master.editable and instance_editable and request.has_perm('{}.edit'.format(permission_prefix)):
|
% if not use_buefy and master.editable and instance_editable and master.has_perm('edit'):
|
||||||
<li>${h.link_to("Edit this {}".format(model_title), action_url('edit', instance))}</li>
|
<li>${h.link_to("Edit this {}".format(model_title), action_url('edit', instance))}</li>
|
||||||
% endif
|
% endif
|
||||||
${self.context_menu_item_delete()}
|
${self.context_menu_item_delete()}
|
||||||
% if master.creatable and master.show_create_link and request.has_perm('{}.create'.format(permission_prefix)):
|
% if not use_buefy and master.creatable and master.show_create_link and master.has_perm('create'):
|
||||||
% if master.creates_multiple:
|
% if master.creates_multiple:
|
||||||
<li>${h.link_to("Create new {}".format(model_title_plural), url('{}.create'.format(route_prefix)))}</li>
|
<li>${h.link_to("Create new {}".format(model_title_plural), url('{}.create'.format(route_prefix)))}</li>
|
||||||
% else:
|
% else:
|
||||||
<li>${h.link_to("Create a new {}".format(model_title), url('{}.create'.format(route_prefix)))}</li>
|
<li>${h.link_to("Create a new {}".format(model_title), url('{}.create'.format(route_prefix)))}</li>
|
||||||
% endif
|
% endif
|
||||||
% endif
|
% endif
|
||||||
% if master.cloneable and request.has_perm('{}.clone'.format(permission_prefix)):
|
% if not use_buefy and master.cloneable and master.has_perm('clone'):
|
||||||
<li>${h.link_to("Clone this as new {}".format(model_title), url('{}.clone'.format(route_prefix), uuid=instance.uuid))}</li>
|
<li>${h.link_to("Clone this as new {}".format(model_title), url('{}.clone'.format(route_prefix), uuid=instance.uuid))}</li>
|
||||||
% endif
|
% endif
|
||||||
% if master.touchable and request.has_perm('{}.touch'.format(permission_prefix)):
|
% if master.touchable and request.has_perm('{}.touch'.format(permission_prefix)):
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
% if master.rows_editable and instance_editable and request.has_perm('{}.edit'.format(permission_prefix)):
|
% if master.rows_editable and instance_editable and request.has_perm('{}.edit'.format(permission_prefix)):
|
||||||
<li>${h.link_to("Edit this {}".format(model_title), action_url('edit', instance))}</li>
|
<li>${h.link_to("Edit this {}".format(model_title), action_url('edit', instance))}</li>
|
||||||
% endif
|
% endif
|
||||||
% if instance_deletable and master.has_perm('delete_row'):
|
% if not use_buefy and instance_deletable and master.has_perm('delete_row'):
|
||||||
<li>${h.link_to("Delete this {}".format(model_title), action_url('delete', instance))}</li>
|
<li>${h.link_to("Delete this {}".format(model_title), action_url('delete', instance))}</li>
|
||||||
% endif
|
% endif
|
||||||
% if rows_creatable and request.has_perm('{}.create'.format(permission_prefix)):
|
% if rows_creatable and request.has_perm('{}.create'.format(permission_prefix)):
|
||||||
|
|
|
@ -274,24 +274,48 @@
|
||||||
<div id="current-context" class="level-item">
|
<div id="current-context" class="level-item">
|
||||||
% if master:
|
% if master:
|
||||||
% if master.listing:
|
% if master.listing:
|
||||||
<span>${index_title}</span>
|
<span class="header-text">
|
||||||
|
${index_title}
|
||||||
|
</span>
|
||||||
|
% if use_buefy and master.creatable and master.show_create_link and master.has_perm('create'):
|
||||||
|
<once-button type="is-primary"
|
||||||
|
tag="a" href="${url('{}.create'.format(route_prefix))}"
|
||||||
|
icon-left="plus"
|
||||||
|
style="margin-left: 1rem;"
|
||||||
|
text="Create New">
|
||||||
|
</once-button>
|
||||||
|
% endif
|
||||||
% elif index_url:
|
% elif index_url:
|
||||||
${h.link_to(index_title, index_url)}
|
<span class="header-text">
|
||||||
|
${h.link_to(index_title, index_url)}
|
||||||
|
</span>
|
||||||
% if parent_url is not Undefined:
|
% if parent_url is not Undefined:
|
||||||
<span> »</span>
|
<span class="header-text">
|
||||||
${h.link_to(parent_title, parent_url)}
|
»
|
||||||
|
</span>
|
||||||
|
<span class="header-text">
|
||||||
|
${h.link_to(parent_title, parent_url)}
|
||||||
|
</span>
|
||||||
% elif instance_url is not Undefined:
|
% elif instance_url is not Undefined:
|
||||||
<span> »</span>
|
<span class="header-text">
|
||||||
${h.link_to(instance_title, instance_url)}
|
»
|
||||||
|
</span>
|
||||||
|
<span class="header-text">
|
||||||
|
${h.link_to(instance_title, instance_url)}
|
||||||
|
</span>
|
||||||
% endif
|
% endif
|
||||||
% if master.viewing and grid_index:
|
% if master.viewing and grid_index:
|
||||||
${grid_index_nav()}
|
${grid_index_nav()}
|
||||||
% endif
|
% endif
|
||||||
% else:
|
% else:
|
||||||
<span>${index_title}</span>
|
<span class="header-text">
|
||||||
|
${index_title}
|
||||||
|
</span>
|
||||||
% endif
|
% endif
|
||||||
% elif index_title:
|
% elif index_title:
|
||||||
<span>${index_title}</span>
|
<span class="header-text">
|
||||||
|
${index_title}
|
||||||
|
</span>
|
||||||
% endif
|
% endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -384,8 +408,49 @@
|
||||||
<h1 class="title" v-html="contentTitleHTML"></h1>
|
<h1 class="title" v-html="contentTitleHTML"></h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
% if show_prev_next is not Undefined and show_prev_next:
|
<div class="level-right">
|
||||||
<div class="level-right">
|
% if use_buefy and master and master.viewing:
|
||||||
|
## TODO: is there a better way to check if viewing parent?
|
||||||
|
% if parent_instance is Undefined:
|
||||||
|
% if master.editable and instance_editable and master.has_perm('edit'):
|
||||||
|
<div class="level-item">
|
||||||
|
<once-button tag="a" href="${action_url('edit', instance)}"
|
||||||
|
icon-left="edit"
|
||||||
|
text="Edit This">
|
||||||
|
</once-button>
|
||||||
|
</div>
|
||||||
|
% endif
|
||||||
|
% if master.cloneable and master.has_perm('clone'):
|
||||||
|
<div class="level-item">
|
||||||
|
<once-button tag="a" href="${action_url('clone', instance)}"
|
||||||
|
icon-left="object-ungroup"
|
||||||
|
text="Clone This">
|
||||||
|
</once-button>
|
||||||
|
</div>
|
||||||
|
% endif
|
||||||
|
% if master.deletable and instance_deletable and master.has_perm('delete'):
|
||||||
|
<div class="level-item">
|
||||||
|
<once-button tag="a" href="${action_url('delete', instance)}"
|
||||||
|
type="is-danger"
|
||||||
|
icon-left="trash"
|
||||||
|
text="Delete This">
|
||||||
|
</once-button>
|
||||||
|
</div>
|
||||||
|
% endif
|
||||||
|
% else:
|
||||||
|
## viewing row
|
||||||
|
% if instance_deletable and master.has_perm('delete_row'):
|
||||||
|
<div class="level-item">
|
||||||
|
<once-button tag="a" href="${action_url('delete', instance)}"
|
||||||
|
type="is-danger"
|
||||||
|
icon-left="trash"
|
||||||
|
text="Delete This">
|
||||||
|
</once-button>
|
||||||
|
</div>
|
||||||
|
% endif
|
||||||
|
% endif
|
||||||
|
% endif
|
||||||
|
% if show_prev_next is not Undefined and show_prev_next:
|
||||||
% if prev_url:
|
% if prev_url:
|
||||||
<div class="level-item">
|
<div class="level-item">
|
||||||
${h.link_to(u"« Older", prev_url, class_='button autodisable')}
|
${h.link_to(u"« Older", prev_url, class_='button autodisable')}
|
||||||
|
@ -404,8 +469,8 @@
|
||||||
${h.link_to(u"Newer »", '#', class_='button', disabled='disabled')}
|
${h.link_to(u"Newer »", '#', class_='button', disabled='disabled')}
|
||||||
</div>
|
</div>
|
||||||
% endif
|
% endif
|
||||||
</div>
|
% endif
|
||||||
% endif
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
% endif
|
% endif
|
||||||
|
|
Loading…
Reference in a new issue