Ignore:
Timestamp:
07/09/19 22:14:12 (7 months ago)
Author:
Lance Edgar <ledgar@…>
Branches:
master
Children:
fa825da
Parents:
0d7492f
Message:

Add basic "DB picker" support, for views which allow multiple engines

i.e. whichever engine is "current" will determine where data comes from

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tailbone/templates/themes/falafel/base.mako

    r0d7492f r839f6af  
    133133          </div>
    134134
     135          % if expose_db_picker is not Undefined and expose_db_picker:
     136              <div class="level-item">
     137                <p>DB:</p>
     138              </div>
     139              <div class="level-item">
     140                ${h.form(url('change_db_engine'))}
     141                ${h.csrf_token(request)}
     142                ${h.hidden('engine_type', value=master.engine_type_key)}
     143                <div class="select">
     144                  ${h.select('dbkey', db_picker_selected, db_picker_options, id='db-picker')}
     145                </div>
     146                ${h.end_form()}
     147              </div>
     148          % endif
     149
    135150        </div><!-- level-left -->
    136151        <div class="level-right">
     
    304319    var logout_url = '${request.route_url('logout')}';
    305320    var noop_url = '${request.route_url('noop')}';
     321    % if expose_db_picker is not Undefined and expose_db_picker:
     322        $(function() {
     323            $('#db-picker').change(function() {
     324                $(this).parents('form:first').submit();
     325            });
     326        });
     327    % endif
    306328    % if expose_theme_picker and request.has_perm('common.change_app_theme'):
    307329        $(function() {
Note: See TracChangeset for help on using the changeset viewer.