Skip to content

Commit

Permalink
[Base][Edit] Fixes for release 0.37.0 (#612)
Browse files Browse the repository at this point in the history
* [Base][Edit] Fixes for release 0.37.0

- Refactor ginger edit template to not overrule so much
- Remove template in base that needed zotonic 0.50

* [Edit] Refactor edit js include so no duplicate editor.tpl are included

* [Edit] Add fileupload for multi upload support
  • Loading branch information
DorienD authored and loetie committed Jul 19, 2019
1 parent 2ea0607 commit 3ddab8a
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 112 deletions.
32 changes: 0 additions & 32 deletions modules/mod_ginger_base/templates/_action_dialog_new_rsc_tab.tpl

This file was deleted.

75 changes: 2 additions & 73 deletions modules/mod_ginger_edit/templates/_action_dialog_edit_basics.tpl
Original file line number Diff line number Diff line change
@@ -1,74 +1,3 @@
{% with m.config.i18n.language_list.list as languages %}
{% with m.rsc[id].language as r_lang %}
{% wire id=#form type="submit"
postback={
rsc_edit_basics
id=id
edge_id=edge_id
update_element=update_element
template=template
actions=actions
callback=callback
is_update=is_update
}
delegate=delegate
%}
<form id="{{ #form }}" method="POST" action="postback" class="form">
<div class="tabbable">
{% block tabbar %}
<ul class="nav nav-pills">
<li class="active"><a data-toggle="tab" href="#{{ #main }}">{_ Main _}</a></li>
<li><a data-toggle="tab" href="#{{ #acl }}">{_ Access control _}</a></li>
</ul>
{% endblock %}
<div class="tab-content">
{% block tab_content %}
<div class="tab-pane form-horizontal active" id="{{ #main }}">
{% overrules %}

{% catinclude "_admin_edit_basics.tpl" id in_dialog is_editable=id.is_editable languages=languages %}

{% if id.is_a.category or id.is_a.predicate %}
<div class="form-group row">
<label class="control-label col-md-3" for="{{ #unique }}">{_ Unique name _}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="{{ #unique }}" name="name" value="{{ id.name }}" />
{% validate id=#unique name="name" type={presence} %}
</div>
</div>
{% endif %}

<div class="form-group row">
<label class="control-label col-md-3" for="{{ #published }}">{_ Published _}</label>
<div class="col-md-9">
<div class="checkbox">
<label>
<input type="checkbox" id="{{ #published }}" name="is_published" value="1" {% if id.is_published %}checked="checked"{% endif %} />
</label>
</div>
</div>
</div>
</div>
{% endblock %}

{% block tab_visible_for %}
<div class="tab-pane form-horizontal" id="{{ #acl }}">
{% include "_admin_edit_visible_for.tpl" id=id %}
</div>
{% endblock %}

{% block tab_extra %}
{% endblock %}
</div>
</div>

<div class="modal-footer">
{% button class="btn btn-default" action={dialog_close} text=_"Cancel" tag="a" %}
{% if m.acl.use.mod_admin %}
<a href="{% url admin_edit_rsc id=id %}" class="btn btn-default">{_ Visit full edit page _}</a>
{% endif %}
{% button class="btn btn-primary" type="submit" text=_"Save" %}
</div>
</form>

{% endwith %}
{% endwith %}
{% block tabbar %}{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
{% with (objects|is_defined)|if:objects:[[]] as objects %}
{% with (add_author|is_defined)|if:[[m.acl.user, 'author']]:[[]] as author %}
{% with objects++author as objects %}

<ul class="nav nav-pills">
{% block tabs %}
{% if cat_name!='keyword' %}
Expand Down
4 changes: 2 additions & 2 deletions modules/mod_ginger_edit/templates/_ginger-editor.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ overrides_tpl: (optional) template location that contains JavaScript overrides f
subject_id=id
predicate=`depiction`
is_zmedia
tab=media_tab|default:"depiction"
tabs_enabled=media_tabs_enabled
tab="upload"|default:"depiction"
tabs_enabled=["upload"]
callback="window.zAdminMediaDone"
center=0
autoclose
Expand Down
59 changes: 59 additions & 0 deletions modules/mod_ginger_edit/templates/_ginger_edit_js_include.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{# Original template: admin_js_include.tpl #}
{#
Overwrite needed because in original template there is an all include
that includes _editor.tpl again. Where we only want to include
_ginger-editor.tpl.
#}

{% lib
"bootstrap/js/bootstrap.min.js"
%}

{% lib
"js/apps/zotonic-1.0.js"
"js/apps/z.widgetmanager.js"
"js/modules/ubf.js"
"js/qlobber.js"
"js/pubzub.js"
"js/modules/jquery.hotkeys.js"
"js/apps/admin-common.js"
"js/jquery.ui.nestedSortable.js"
"js/modules/z.adminwidget.js"
"js/modules/z.live.js"
"js/modules/z.notice.js"
"js/modules/z.tooltip.js"
"js/modules/z.dialog.js"
"js/modules/z.feedback.js"
"js/modules/z.formreplace.js"
"js/modules/z.datepicker.js"
"js/modules/z.menuedit.js"
"js/modules/z.cropcenter.js"
"js/modules/z.popupwindow.js"
"js/modules/livevalidation-1.3.js"
"js/modules/jquery.loadmask.js"
"js/modules/jquery.timepicker.min.js"
"js/modules/jstz.min.js"
"js/ginger_edit.js"
%}

{% if m.modules.active.mod_geo %}
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key={{ m.config.mod_geo.api_key.value|escape }}"></script>
{% lib "js/admin-geo.js" %}
{% endif %}

{% if m.modules.active.mod_admin_multiupload and m.acl.is_allowed.use.mod_admin_multiupload %}
{% lib "js/jquery.fileupload.js" %}
{% endif %}
<script type="text/javascript">
$(function()
{
$.widgetManager();
});
</script>
5 changes: 1 addition & 4 deletions modules/mod_ginger_edit/templates/ginger_edit_base.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@
</div>
{% endblock %}

{% include "_ginger_edit_js_include.tpl" %}

{% include "_admin_js_include.tpl" %}
{% lib
"js/ginger_edit.js"
%}
{% optional include "_ginger_edit_js_extra.tpl" %}


Expand Down

0 comments on commit 3ddab8a

Please sign in to comment.