ソースを参照

WebUi improvements with bootstrap

prieto 8年前
コミット
73c39d0ca4

+ 2
- 0
plugins/webui/interface/controllers/__init__.py ファイルの表示

@@ -2,4 +2,6 @@ from .base import *
2 2
 from .admin import *
3 3
 from .document import *
4 4
 from .listing import *
5
+from .users import *
6
+
5 7
 

+ 0
- 2
plugins/webui/interface/controllers/admin.py ファイルの表示

@@ -6,7 +6,6 @@ from lodel import logger
6 6
 
7 7
 import leapi_dyncode as dyncode
8 8
 import warnings
9
-from lodel import logger
10 9
 
11 10
 def index_admin(request):
12 11
     return get_response('admin/admin.html')
@@ -14,7 +13,6 @@ def index_admin(request):
14 13
 def admin_update(request):
15 14
     msg=''
16 15
     if request.method == 'POST':
17
-
18 16
         error = None
19 17
         datas = list()
20 18
         classname = request.form['classname']

+ 13
- 0
plugins/webui/interface/controllers/users.py ファイルの表示

@@ -0,0 +1,13 @@
1
+# -*- coding: utf-8 -*-
2
+from .base import get_response
3
+from ...exceptions import *
4
+from lodel import logger
5
+import leapi_dyncode as dyncode
6
+
7
+def signin(request):
8
+    msg=''
9
+    if request.method == 'POST':
10
+        print('Welcome')
11
+    else:
12
+        return get_response('users/signin.html')
13
+

+ 2
- 1
plugins/webui/interface/urls.py ファイルの表示

@@ -14,5 +14,6 @@ urls = (
14 14
     (r'^/list_classes', list_classes),
15 15
     (r'^/list_classes?$', list_classes),
16 16
     (r'^/show_object?$', show_object),
17
-    (r'^/show_class?$', show_class)
17
+    (r'^/show_class?$', show_class),
18
+    (r'^/signin', signin)
18 19
 )

+ 12
- 5
plugins/webui/templates/admin/admin_create.html ファイルの表示

@@ -3,20 +3,27 @@
3 3
 
4 4
 {% block title %}- Creating a new {{target.__name__}}{% endblock %}
5 5
 {% block body %}
6
+<ol class="breadcrumb">
7
+  <li><a href="/lodel_i/admin">Home</a></li>
8
+  <li><a href="/lodel_i/admin/object_create">Creation</a></li>
9
+  <li class="active">Edit</li>
10
+</ol>
6 11
 {% if msg is not none %}
7 12
 {% block msg %} <p style="color:red; font-size:20pt; font-weight:bold">{{ msg }}</p> {% endblock %}
8 13
 {% endif %}
9
-<h1>Creating a new {{target.__name__}}</h1>
10
- <form action="" method ="post">
14
+<h1 style="padding-bottom:30px;">Creating a new {{target.__name__}}</h1>
15
+ <form class="form-horizontal" action="" method ="post">
11 16
      <input type="hidden" name="classname" id="classname" value="{{target.__name__}}" />
12 17
 	{% for fieldname, field in target.fields().items() %}
13
-     <div style="padding-bottom:15px;"> {{edit.input(fieldname, field) }}</div>
18
+     <div class="form-group">
19
+     <div class="form-group" style="padding-bottom:15px;"> {{edit.input(fieldname, field) }}</div>
20
+     </div>
14 21
 	{% endfor %}
15 22
      <p>&nbsp;</p>
16
- <input type="submit" value="Save">
23
+     <button type="submit" class="btn btn-default">Save</button>
24
+     <a class="btn btn-primary" href="object_create">Return</a>
17 25
  </form>
18 26
 <div>
19
-    <a href="object_create">Return</a>
20 27
 </div>
21 28
 {% endblock %}
22 29
 

+ 15
- 6
plugins/webui/templates/admin/admin_edit.html ファイルの表示

@@ -3,21 +3,30 @@
3 3
 {% set objects = target.get(('lodel_id = %s') % (lodel_id)) %}
4 4
 {% set objects = target.get(('%s = %s') % (uidfield, lodel_id)) %}
5 5
 {% set obj = objects.pop() %}
6
-{% block title %}- Edit Object{% endblock %}
6
+{% block title %}Edit Object{% endblock %}
7 7
 {% block body %}
8
+<ol class="breadcrumb">
9
+  <li><a href="/lodel_i/admin">Home</a></li>
10
+  <li><a href="/lodel_i/admin/classes_admin">Edition</a></li>
11
+  <li><a href="/lodel_i/admin/class_admin?classname={{ target.__name__ }}">{{ target.__name__ }}</a></li>
12
+  <li class="active">Edit</li>
13
+</ol>
8 14
 {% if msg is not none %}
9 15
 {% block msg %} <p style="color:red; font-size:20pt; font-weight:bold">{{ msg }}</p> {% endblock %}
10 16
 {% endif %}
11
-<h1>Lodel 2 - Edit {{ target.__name__ }} with uid {{ lodel_id }} </h1>
12
-    <form action="" method ="post">
17
+<h1 style="padding-bottom:30px;">Lodel 2 - Edit {{ target.__name__ }} with uid {{ lodel_id }} </h1>
18
+    <form class="form-horizontal" action="" method ="post">
13 19
     <input type="hidden" name="uid" value="{{ lodel_id}}" />
14 20
     <input type="hidden" name="classname" value={{ target.__name__ }} />
15 21
     {% for fieldname, fieldvalue in obj.fields().items() %}
16
-       <div style="padding-bottom:15px;"> {{edit.input(fieldname, fieldvalue, obj.data(fieldname)) }} </div>
22
+        <div class="form-group">
23
+        <div style="padding-bottom:15px;"> {{edit.input(fieldname, fieldvalue, obj.data(fieldname)) }} </div>
24
+        </div>
17 25
     {% endfor %}
18
-     <input type="submit" value="Save">
26
+     <button type="submit" class="btn btn-primary">Save</button>
27
+     <a class="btn btn-default" href="classes_admin">Return</a>
19 28
     </form>
20 29
 <div>
21
-    <a href="classes_admin">Return</a>
30
+    
22 31
 </div>
23 32
 {% endblock %}

+ 8
- 5
plugins/webui/templates/admin/editable_component.html ファイルの表示

@@ -1,9 +1,11 @@
1 1
 {% macro input(fieldname, field, value='') -%}
2
-	<label for="field_input_{{fieldname}}">{{fieldname}}</label>
2
+	<label for="field_input_{{fieldname}}" class="col-sm-2 control-label">{{fieldname}}</label>
3
+    <div class="col-xs-6">
3 4
 	{% if field.base_type == 'bool' %}
4
-		<input id="field_input_{{fieldname}}" name="field_input_{{fieldname}}" type="checkbox" checked="{% if value %}checked{% endif %}" >
5
+    
6
+		<input id="field_input_{{fieldname}}" class="form-control" name="field_input_{{fieldname}}" type="checkbox" checked="{% if value %}checked{% endif %}" >
5 7
 	{% elif field.base_type == 'char' or field.base_type == 'int' %}
6
-		<input id="{{fieldname}}" name="field_input_{{fieldname}}" type="text" value="{{value}}" >
8
+		<input id="{{fieldname}}" class="form-control" name="field_input_{{fieldname}}" type="text" value="{{value}}" >
7 9
     {% elif field.base_type == 'ref' %}
8 10
         {% if value is iterable %}
9 11
             {% set sval=value|join(',') %}
@@ -11,14 +13,15 @@
11 13
             {% set sval = value %}
12 14
         {% endif %}
13 15
         {% if field.directly_editable %}
14
-            <input id="{{fieldname}}" name="field_input_{{fieldname}}" type="text" value="{{sval}}" >
16
+            <input id="{{fieldname}}" class="form-control" name="field_input_{{fieldname}}" type="text" value="{{sval}}" >
15 17
             {% set l_classe = field.linked_classes %}
16 18
             <p> Please enter uids to instances of {{ l_classe.__name__ }} separated by commas </p>
17 19
         {% else %}
18
-            <input id="{{fieldname}}" name="field_input_{{fieldname}}" type="text" value="{{sval}}" readonly >
20
+            <input id="{{fieldname}}" class="form-control" name="field_input_{{fieldname}}" type="text" value="{{sval}}" readonly >
19 21
             <p> If you want to update this field, please do it in child objects</p>
20 22
         {% endif %}
21 23
 	{% else %}
22 24
 		Unsupported base type "{{field.base_type}}" <br>
23 25
 	{% endif %}
26
+</div>
24 27
 {%- endmacro %}

+ 8
- 3
plugins/webui/templates/admin/list_classes_admin.html ファイルの表示

@@ -1,7 +1,12 @@
1
-{% extends "base.html" %}
1
+{% extends "base_backend.html" %}
2 2
 {% block title %}Lodel 2 - Admin - List of Classes{% endblock %}
3
-{% block content %} 
4
-<h1>Lodel 2 - Admin - List of Classes</h1>
3
+{% block body %} 
4
+<ol class="breadcrumb">
5
+  <li><a href="/lodel_i/admin">Home</a></li>
6
+  <li class="active">Edit</li>
7
+</ol>
8
+<h1>Edition</h1>
9
+<h2>Select a class</h2>
5 10
 <ul>
6 11
 {% for classe in my_classes %}
7 12
     {% set abst = '' %}

+ 8
- 3
plugins/webui/templates/admin/list_classes_create.html ファイルの表示

@@ -1,7 +1,12 @@
1
-{% extends "base.html" %}
1
+{% extends "base_backend.html" %}
2 2
 {% block title %}Lodel 2 - Admin - List of Classes{% endblock %}
3
-{% block content %} 
4
-<h1>Lodel 2 - Admin - Choose a class for create an instance</h1>
3
+{% block body %}
4
+<ol class="breadcrumb">
5
+  <li><a href="/lodel_i/admin">Home</a></li>
6
+  <li class="active">Edit</li>
7
+</ol>
8
+<h1>Creation</h1>
9
+<h2>Choose a type to create an instance</h1>
5 10
 <ul>
6 11
 {% for classe in my_classes %}
7 12
     {% set abst = '' %}

+ 8
- 3
plugins/webui/templates/admin/show_class_admin.html ファイルの表示

@@ -1,7 +1,12 @@
1
-{% extends "base.html" %}
1
+{% extends "base_backend.html" %}
2 2
 {% block title %}Lodel 2 - Admin - Class {{ target.__name__ }} {% endblock %}
3
-{% block content %} 
4
-<h1>Lodel 2 - Admin - Class {{target.__name__  }} </h1>
3
+{% block body %} 
4
+<ol class="breadcrumb">
5
+  <li><a href="/lodel_i/admin">Home</a></li>
6
+  <li><a href="/lodel_i/admin/classes_admin">Edition</a></li>
7
+  <li class="active">{{target.__name__  }}</li>
8
+</ol>
9
+<h1>Edition - {{target.__name__  }} </h1>
5 10
 
6 11
  {% if not target.is_abstract() %}
7 12
     {% set objects = target.get(None) %}

+ 4
- 2
plugins/webui/templates/base.html ファイルの表示

@@ -28,12 +28,14 @@
28 28
         </div>
29 29
         <div id="navbar" class="navbar-collapse collapse">
30 30
           <ul class="nav navbar-nav">
31
-            <li class="active"><a href="lodel_i/">Home</a></li>
31
+            <li class="active"><a href="/lodel_i/">Home</a></li>
32 32
             <li><a href="list_classes">All types</a></li>
33 33
           </ul>
34 34
           <ul class="nav navbar-nav navbar-right">
35
-            <li><a href="admin">Back-end</a></li>
35
+            <li id="backend-nav"><a href="admin" class="btn btn-link disabled">Back-end</a></li>
36
+            <li id="backend-nav"><a href="admin" class="btn btn-link">Back-end</a></li>
36 37
               <li id="signin-nav"><a href="signin">Sign In</a></li>
38
+              <li id="signout-nav" style="display: none;"><a href="signout">Logout</a>
37 39
           </ul>
38 40
         </div><!--/.nav-collapse -->
39 41
       </div>

+ 3
- 3
plugins/webui/templates/base_backend.html ファイルの表示

@@ -25,9 +25,9 @@
25 25
         </div>
26 26
         <div id="navbar" class="navbar-collapse collapse">
27 27
           <ul class="nav navbar-nav">
28
-            <li class="active"><a href="admin">Home</a></li>
29
-            <li><a href="admin/object_create">Create</a></li>
30
-            <li><a href="admin/classes_admin">Edit</a></li>
28
+            <li class="active"><a href="/lodel_i/admin">Home</a></li>
29
+            <li><a href="/lodel_i/admin/object_create">Create</a></li>
30
+            <li><a href="/lodel_i/admin/classes_admin">Edit</a></li>
31 31
           </ul>
32 32
           <ul class="nav navbar-nav navbar-right">
33 33
             <li><a href="/lodel_i/">Front-End</a></li>

+ 40
- 0
plugins/webui/templates/css/bootstrap-3.3.7/docs/examples/signin/signin.css ファイルの表示

@@ -0,0 +1,40 @@
1
+body {
2
+  padding-top: 40px;
3
+  padding-bottom: 40px;
4
+  background-color: #eee;
5
+}
6
+
7
+.form-signin {
8
+  max-width: 330px;
9
+  padding: 15px;
10
+  margin: 0 auto;
11
+}
12
+.form-signin .form-signin-heading,
13
+.form-signin .checkbox {
14
+  margin-bottom: 10px;
15
+}
16
+.form-signin .checkbox {
17
+  font-weight: normal;
18
+}
19
+.form-signin .form-control {
20
+  position: relative;
21
+  height: auto;
22
+  -webkit-box-sizing: border-box;
23
+     -moz-box-sizing: border-box;
24
+          box-sizing: border-box;
25
+  padding: 10px;
26
+  font-size: 16px;
27
+}
28
+.form-signin .form-control:focus {
29
+  z-index: 2;
30
+}
31
+.form-signin input[type="email"] {
32
+  margin-bottom: -1px;
33
+  border-bottom-right-radius: 0;
34
+  border-bottom-left-radius: 0;
35
+}
36
+.form-signin input[type="password"] {
37
+  margin-bottom: 10px;
38
+  border-top-left-radius: 0;
39
+  border-top-right-radius: 0;
40
+}

+ 6
- 0
plugins/webui/templates/css/template.css ファイルの表示

@@ -0,0 +1,6 @@
1
+body {
2
+  min-height: 2000px;
3
+  padding-top: 70px;
4
+  padding-left: 70px;
5
+} 
6
+

+ 2
- 2
plugins/webui/templates/listing/list_classes.html ファイルの表示

@@ -1,11 +1,11 @@
1 1
 {% extends "base.html" %}
2 2
 {% block title %}Lodel 2 - List of Classes{% endblock %}
3 3
 {% block content %} 
4
-<h1>Lodel 2 - List of Classes</h1>
4
+<h1>All types</h1>
5 5
 <ul>
6 6
 {% for classe in my_classes %}
7 7
     {% if classe.is_abstract() and allclasses == 1 %}
8
-        {% set abst = ' - Abstract class ' %}
8
+        {% set abst = ' - Abstract type ' %}
9 9
         <li> <a href="show_class?classname={{ classe.__name__ }}" target="_blank">{{ classe.__name__ }} </a>{{ abst }}</li>
10 10
     {% elif not classe.is_abstract() %}
11 11
         {% set abst = ' - ' ~ classe.get(None)|length %}

+ 8
- 2
plugins/webui/templates/listing/show_class.html ファイルの表示

@@ -1,10 +1,15 @@
1 1
 {% extends "base.html" %}
2 2
 {% block title %}Lodel 2 - Class {{ classname }} {% endblock %}
3 3
 {% block content %} 
4
-<h1>Lodel 2 - Class {{ classname }} </h1>
4
+<ol class="breadcrumb">
5
+  <li><a href="/lodel_i/">Home</a></li>
6
+  <li><a href="/lodel_i/list_classes">Types</a></li>
7
+  <li class="active">{{ classname }}</li>
8
+</ol>
9
+<h1>Type {{ classname }} </h1>
5 10
  {% set my_class  = leapi.name2class(classname) %}
6 11
  {% if my_class.child_classes()|length >0 %}
7
-     <h2> Childs classes</h2>
12
+     <h2> Childs types</h2>
8 13
      <ul>
9 14
      {% for child in my_class.child_classes() %}
10 15
          {% if child.is_abstract() %}
@@ -17,6 +22,7 @@
17 22
      </ul>
18 23
   {% endif %}
19 24
  {% if not my_class.is_abstract() %}
25
+<h2>Instances</h2>
20 26
     {% set uid_f = my_class.uid_fieldname() %}
21 27
     {% set objects = my_class.get(None) %}
22 28
     <ul>

+ 7
- 1
plugins/webui/templates/listing/show_object.html ファイルの表示

@@ -7,9 +7,15 @@
7 7
 {% set classname = obj.data('classname') %}
8 8
 {% set my_class = my_class.name2class(classname) %}
9 9
 {% endif %}
10
-{% block title %}Lodel 2 - Object {{ lodel_id }} {% endblock %}
10
+{% block title %}Object {{ lodel_id }} {% endblock %}
11 11
 {% import "components/components.html" as components %}
12 12
 {% block content %}
13
+<ol class="breadcrumb">
14
+  <li><a href="/lodel_i/">Home</a></li>
15
+  <li><a href="/lodel_i/list_classes">Types</a></li>
16
+  <li><a href="/lodel_i/show_class?classname={{ classname }}">{{ classname }}</a></li>
17
+  <li class="active">{{ lodel_id }}</li>
18
+</ol>
13 19
 <h1>Lodel 2 - {{ classname }} with uid {{ lodel_id }}</h1>
14 20
     
15 21
 <ul>

+ 40
- 0
plugins/webui/templates/users/signin.html ファイルの表示

@@ -0,0 +1,40 @@
1
+{% extends "base.html" %}
2
+{% block title %}Lodel 2 - Sign In{% endblock %}
3
+<!-- Custom styles for this template -->
4
+{% block style %}
5
+    <link href="http://127.0.0.1/css/signin.css" rel="stylesheet">
6
+{% endblock %}
7
+{% block content %} 
8
+<div class="container">
9
+    <h1>Lodel2 - Sign In</h1>
10
+<form class="form-horizontal">
11
+  <div class="form-group">
12
+    <label for="inputEmail3" class="col-sm-2 control-label">Email</label>
13
+    <div class="col-xs-4">
14
+      <input type="email" class="form-control" id="inputEmail3" placeholder="Email">
15
+    </div>
16
+  </div>
17
+  <div class="form-group">
18
+    <label for="inputPassword3" class="col-sm-2 control-label">Password</label>
19
+    <div class="col-xs-4">
20
+      <input type="password" class="form-control" id="inputPassword3" placeholder="Password">
21
+    </div>
22
+  </div>
23
+  <div class="form-group">
24
+    <div class="col-sm-offset-2 col-sm-10">
25
+      <div class="checkbox">
26
+        <label>
27
+          <input type="checkbox"> Remember me
28
+        </label>
29
+      </div>
30
+    </div>
31
+  </div>
32
+  <div class="form-group">
33
+    <div class="col-sm-offset-2 col-sm-10">
34
+      <button type="submit" class="btn btn-default">Sign in</button>
35
+    </div>
36
+  </div>
37
+</form>
38
+
39
+    </div> <!-- /container -->
40
+{% endblock %}

読み込み中…
キャンセル
保存