Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add colResizable #47

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
230 changes: 230 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@

# Created by https://www.gitignore.io/api/macos,python,pycharm

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### PyCharm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

### PyCharm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

### Python Patch ###
.venv/

### Python.VirtualEnv Stack ###
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
pip-selfcheck.json


# End of https://www.gitignore.io/api/macos,python,pycharm

user*
user/*
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name='sqlite-web',
version='0.3.3',
version='0.3.3.1-dev3',
description='Web-based SQLite database browser.',
long_description=long_description,
author='Charles Leifer',
Expand Down
3 changes: 3 additions & 0 deletions sqlite_web/static/css/table-resizable.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.table-container {
overflow-x: scroll;
}
3 changes: 3 additions & 0 deletions sqlite_web/static/js/colResizable-1.6.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions sqlite_web/static/js/table-resizable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$(function() {
$('#content').hover(function(){
$('#sidebar').hide();
$('#content').removeClass('col-9').addClass('col');
}, function(){
$('#sidebar').show();
$('#content').addClass('col-9').removeClass('col');
});

$("th").each(function(){
$(this).css('width', ($(this).width() + 10) + 'px');
});

$("table").colResizable({
liveDrag: true,
resizeMode: 'overflow'
});
});
56 changes: 32 additions & 24 deletions sqlite_web/templates/table_content.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{% extends "base_table.html" %}

{% block extra_head %}
<link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/table-resizable.css') }}" />
{% endblock %}

{% block extra_scripts %}
<script type="text/javascript" src="{{ url_for('static', filename='js/colResizable-1.6.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/table-resizable.js') }}"></script>
<script type="text/javascript">
$(function() {
var valueToggles = $('a.toggle-value');
Expand All @@ -25,33 +31,35 @@

{% block inner_content %}
{# add filters #}
<table class="table table-striped">
<thead>
<tr>
{% for column in columns %}
<th>
<a href="./?ordering={% if ordering == column %}-{% endif %}{{ column }}">{{ column }}</a>
</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in query %}
<div class="table-container">
<table class="table table-striped">
<thead>
<tr>
{% for field in field_names %}
{% set value = row[field] %}
<td>
{% if value is none %}
NULL
{% else %}
{{ value|value_filter|safe }}
{% endif %}
</td>
{% for column in columns %}
<th>
<a href="./?ordering={% if ordering == column %}-{% endif %}{{ column }}">{{ column }}</a>
</th>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</thead>
<tbody>
{% for row in query %}
<tr>
{% for field in field_names %}
{% set value = row[field] %}
<td>
{% if value is none %}
NULL
{% else %}
{{ value|value_filter|safe }}
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
<nav>
<ul class="pagination">
<li class="{% if not previous_page %}disabled {% endif %}page-item">
Expand Down