Fix the gutter height of the editor when the parent is resized.

This commit is contained in:
Dave Page 2015-02-13 13:13:36 +00:00
parent f4982efb19
commit b09c1b6c68
6 changed files with 35 additions and 5 deletions

View File

@ -2,11 +2,16 @@
<link rel="stylesheet" href="{{ url_for('static', filename='css/codemirror/codemirror.css') }}" />
<script src="{{ url_for('static', filename='js/vendor/codemirror/codemirror.js') }}"></script>
<script src="{{ url_for('static', filename='js/vendor/codemirror/mode/sql.js') }}"></script>
<link rel="stylesheet" href="{{ url_for('.static', filename='css/aciTree/css/aciTree.css') }}" />
<script src="{{ url_for('.static', filename='js/aciTree/jquery.aciPlugin.min.js') }}"></script>
<script src="{{ url_for('.static', filename='js/aciTree/jquery.aciTree.min.js') }}"></script>
<div id="container" class="browser-pane-container">
<div class="pane ui-layout-west browser-browser-pane">
<p>Browser Pane</p>
<div id="tree" class="aciTree">
</div>
</div>
<div class="pane ui-layout-center browser-inner-pane" id="outer-center">
@ -162,5 +167,12 @@ var editor = CodeMirror.fromTextArea(document.getElementById("sql-textarea"), {
readOnly: true,
});
// Initialise the treeview
$('#tree').aciTree({
ajax: {
url: '/static/tree.json'
}
});
</script>

View File

@ -76,9 +76,9 @@ def index():
# Get the layout settings
layout_settings = {}
layout_settings['sql_size'] = get_setting('Browser/SQLPane/Size', default=250)
layout_settings['sql_closed'] = get_setting('Browser/SQLPane/Closed', default=False)
layout_settings['sql_closed'] = get_setting('Browser/SQLPane/Closed', default="false")
layout_settings['browser_size'] = get_setting('Browser/BrowserPane/Size', default=250)
layout_settings['browser_closed'] = get_setting('Browser/BrowserPane/Closed', default=False)
layout_settings['browser_closed'] = get_setting('Browser/BrowserPane/Closed', default="false")
return render_template(MODULE_NAME + '/index.html',
username=current_user.email,

View File

@ -45,3 +45,11 @@ class Setting(db.Model):
setting = db.Column(db.String(255), primary_key=True)
value = db.Column(db.String(1024))
class ServerGroup(db.Model):
"""Define a server group for the treeview"""
__tablename__ = 'servergroup'
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
name = db.Column(db.String(80))
__table_args__ = (db.UniqueConstraint('user_id', 'name'),)

View File

@ -19,3 +19,8 @@
iframe {
border-width: 0;
}
/* Ensure the codemirror editor displays full height gutters when resized */
.CodeMirror, .CodeMirror-gutters {
height: 100% !important;
}

View File

@ -19,7 +19,6 @@
{% if config.DEBUG %}<link rel="stylesheet" href="{{ url_for('static', filename='css/alertifyjs/alertify.css') }}" />{% else %}<link rel="stylesheet" href="{{ url_for('static', filename='css/alertifyjs/alertify.min.css') }}" />{% endif %}
{% if config.DEBUG %}<link rel="stylesheet" href="{{ url_for('static', filename='css/alertifyjs/themes/bootstrap.css') }}" />{% else %}<link rel="stylesheet" href="{{ url_for('static', filename='css/alertifyjs/themes/bootstrap.min.css') }}" />{% endif %}
{% if config.DEBUG %}<link rel="stylesheet" href="{{ url_for('static', filename='css/jquery-ui/jquery-ui.css') }}" />{% else %}<link rel="stylesheet" href="{{ url_for('static', filename='css/jquery-ui/jquery-ui.min.css') }}" />{% endif %}
<style>
body {
padding-top: 50px;

View File

@ -14,7 +14,7 @@ from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.security import Security, SQLAlchemyUserDatastore
from flask.ext.security.utils import encrypt_password
from pgadmin.settings.settings_model import db, Role, User
from pgadmin.settings.settings_model import db, Role, User, ServerGroup
import getpass, os, random, sys, string
@ -75,6 +75,12 @@ with app.app_context():
user_datastore.create_role(name='Administrators', description='pgAdmin Administrators Role')
user_datastore.create_user(email=email, password=password)
user_datastore.add_role_to_user(email, 'Administrators')
# Get the user's ID and create the default server group
user = User.query.filter_by(email=email).first()
server_group = ServerGroup(user_id=user.id, name="Servers")
db.session.merge(server_group)
db.session.commit()
# Done!