diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-04-30 13:35:51 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-06-17 13:21:27 +0200 | 
| commit | 9a80d61b0cf5fa159beb6864b99446a44aff5476 (patch) | |
| tree | 78ef660a5c7c814e1f2d207276c908f3e9f6e25b /ishtar_common | |
| parent | f7eb29db4d43080dcb87994a18a2be7a2a07c622 (diff) | |
| download | Ishtar-9a80d61b0cf5fa159beb6864b99446a44aff5476.tar.bz2 Ishtar-9a80d61b0cf5fa159beb6864b99446a44aff5476.zip  | |
Label generation: label generation available at the bottom of tables
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/templates/blocks/DataTables-content.html | 44 | ||||
| -rw-r--r-- | ishtar_common/templates/blocks/DataTables.html | 10 | ||||
| -rw-r--r-- | ishtar_common/widgets.py | 1 | 
3 files changed, 41 insertions, 14 deletions
diff --git a/ishtar_common/templates/blocks/DataTables-content.html b/ishtar_common/templates/blocks/DataTables-content.html index 1b069f674..4a9257f65 100644 --- a/ishtar_common/templates/blocks/DataTables-content.html +++ b/ishtar_common/templates/blocks/DataTables-content.html @@ -21,19 +21,39 @@              </div>          </div>          <div> -            <div class="btn-group btn-group-sm" role="group" -                 aria-label="{% trans 'Export'%}"> -                {% if source_full or extra_sources %} -                <a class="btn btn-secondary {{sname}}-csv" href='{{source}}csv' target='_blank' -                   title="{% trans 'Export as CSV - ' %}{% trans 'simple'%}">{% trans "Simple CSV" %}</a> -                {% if source_full %}<a class='btn btn-secondary {{sname}}-csv-full' href='{{source_full}}csv' target='_blank' title="{% trans 'Export as CSV - full' %}">{% trans "CSV full" %}</a>{% endif %} -                {% for slug, name, extra_source in extra_sources %} -                <a class="btn btn-secondary {{slug}}-csv-full" href='{{extra_source}}csv' target='_blank' title="{% trans 'Export as CSV - ' %}{{name}}">{{name}}</a> -                {% endfor %} -                {% else %} -                <a class="btn btn-secondary {{sname}}-csv" href="{{source}}csv" target="_blank" title="{% trans 'Export as CSV' %}">{% trans "CSV" %}</a> -                {% endif %} +            <div class="btn-group btn-group-sm" role="group"> +                  <button id="export-{{name}}" type="button" +                          class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" +                          aria-haspopup="true" aria-expanded="false"> +                    {% trans 'Export'%} +                  </button> +                  <div class="dropdown-menu" aria-labelledby="export-{{name}}"> +                    {% if source_full or extra_sources %} +                    <a class="dropdown-item {{sname}}-csv" href='{{source}}csv' target='_blank' +                    title="{% trans 'Export as CSV - ' %}{% trans 'simple'%}">{% trans "Simple CSV" %}</a> +                    {% if source_full %}<a class='dropdown-item {{sname}}-csv-full' href='{{source_full}}csv' target='_blank' title="{% trans 'Export as CSV - full' %}">{% trans "CSV full" %}</a>{% endif %} +                    {% for slug, name, extra_source in extra_sources %} +                    <a class="dropdown-item {{slug}}-csv-full" href='{{extra_source}}csv' target='_blank' title="{% trans 'Export as CSV - ' %}{{name}}">{{name}}</a> +                    {% endfor %} +                    {% else %} +                    <a class="dropdown-item {{sname}}-csv" href="{{source}}csv" target="_blank" title="{% trans 'Export as CSV' %}">{% trans "CSV" %}</a> +                    {% endif %} +                  </div>              </div> +            {% if current_model.has_label_templates %}<div class="btn-group btn-group-sm" role="group"> +                  <button id="export-labels-{{name}}" type="button" +                          class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" +                          aria-haspopup="true" aria-expanded="false"> +                    {% trans 'Labels'%} +                  </button> +                  <div class="dropdown-menu" aria-labelledby="export-labels-{{name}}"> +                  {% for template in current_model.label_templates %} +                    <a class="dropdown-item {{template.slug}}-labels" href="{{template.get_baselink_for_labels}}" target="_blank" title="{{template.name}}"> +                        {{template.name}} +                    </a> +                  {% endfor %} +                  </div> +            </div>{% endif %}          </div>      </div> diff --git a/ishtar_common/templates/blocks/DataTables.html b/ishtar_common/templates/blocks/DataTables.html index 90eced2f9..a20a151a9 100644 --- a/ishtar_common/templates/blocks/DataTables.html +++ b/ishtar_common/templates/blocks/DataTables.html @@ -163,8 +163,14 @@ update_submit_args = function(){      var csv_full_url = "{{source_full}}csv?submited=1&" + data;      $(".{{sname}}-csv-full").attr("href", csv_full_url);      {% for slug, name, extra_source in extra_sources %} -    $(".{{slug}}-csv-full").attr("href", '{{extra_source}}csv?submited=1&' + data); -    {% endfor %} +    $(".{{slug}}-csv-full").attr("href", '{{extra_source}}csv?submited=1&' + data);{% endfor %} +    {% for template in current_model.label_templates %} +    $(".{{template.slug}}-labels").attr("href", '{{template.get_baselink_for_labels}}?submited=1&' + data);{% endfor %} + +    if ($('.modal-progress').length > 0){ +        $('.modal-progress').modal('hide'); +    } +    return false;  }; diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index 3d69ff117..5b5f44477 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -1089,6 +1089,7 @@ class DataTable(Select2Media, forms.RadioSelect):          dct['extra_sources'] = []          dct['quick_actions'] = []          if self.associated_model: +            dct['current_model'] = self.associated_model              model_name = "{}.{}".format(                  self.associated_model.__module__,                  self.associated_model.__name__)  | 
