Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
PyCon2012ChinaBj-UliWeb
Search
Zoom.Quiet
October 20, 2012
Programming
140
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PyCon2012ChinaBj-UliWeb
http://cn.pycon.org/2012/schedulebj
Zoom.Quiet
October 20, 2012
More Decks by Zoom.Quiet
See All by Zoom.Quiet
PyCon2014China-Zhuhai-high performance
zoomquiet
0
210
PyCon2014China-Zhuhai-meta programming
zoomquiet
1
180
PyCon2014China-Zhuhai-bpm.py
zoomquiet
0
160
PyCon2014China-Zhuhai-luna kv db
zoomquiet
0
160
PyCon2014China-Zhuhai-seed studio
zoomquiet
0
160
PyCon2014China-Zhuhai-Docker Registry Build By Python
zoomquiet
0
170
PyCon2014China-Zhuhai-jeff
zoomquiet
0
160
PyCon2014China-Zhuhai-pythonic front-end
zoomquiet
0
210
DevFest2014-Zhuhai-Polymer
zoomquiet
0
500
Other Decks in Programming
See All in Programming
ActionController meets Protocol Buffers
sorah
0
550
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
640
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
160
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
180
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
180
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
180
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
35
17k
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
510
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
160
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
320
Featured
See All Featured
The Cult of Friendly URLs
andyhume
79
7k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
410
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
360
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
570
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
Designing for Timeless Needs
cassininazir
1
530
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
540
The Limits of Empathy - UXLibs8
cassininazir
2
720
Faster Mobile Websites
deanohume
310
32k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
630
YesSQL, Process and Tooling at Scale
rocio
174
15k
エンジニアに許された特別な時間の終わり
watany
109
250k
Transcript
又一年,Uliweb发展纪事 李迎辉(
[email protected]
) 2012/10/20
Uliweb 转到github,同时在 code.google.com Uliweb-doc为专门的Uliweb文档项目 Plugs集成越来越多的组件,包括JQuery, Bootstrap, AngularJS等 Ver 0.1.6 Ver
0.1.4 在多个场合介绍Uliweb,如:《我们的开源项目》 UliwebZone项目,由何家胜部署在 http://uliweb.clkg.org 2012 cn.pycon.org 官网开发
UliwebZone的实战
Uliweb Plugs SQLAlchemy par - MarkDown解释器,加入bootstrap的语法支持 JQuery + 插件 AngularJS
论坛
论坛
教程
教程
教程
课程
课程
消息
管理
AngularJS
Javascript MVC框架 基于DOM的模板引擎 双向数据绑定 Dirty data check 模块化 控制器 Directive
HTML标签扩展 。。。
{{use "angularjs"}} {{use "jquery"}} <div ng-app="AdminApp" id="ng-app" ng-controller="adminCtrl"> <form class="form-inline">
<input ng-model="topictype_name" placeholder="新课程分类名称"></input> <a class=“btn btn-primary” ng-click=“add_category()“>添加</a> </form> <table class="table table-bordered table-header"> <tbody> <tr ng-repeat="c in objects"> <td>{% c.name %}</td> <td> <a ng-click="edit_category(c.id)"> <i class="icon-edit" title="编辑"></i> </a> <a ng-click="remove_category(c.id)"> <i class="icon-remove" title="删除"></i> </a> </td> </tr> </tbody> </table> </div> 装入相关的资源 Template
{{use "angularjs"}} {{use "jquery"}} <div ng-app="AdminApp" id="ng-app" ng-controller="adminCtrl"> <form class="form-inline">
<input ng-model="topictype_name" placeholder="新课程分类名称"></input> <a class="btn btn-primary" ng-click="add_category()“>添加</a> </form> <table class="table table-bordered table-header"> <tbody> <tr ng-repeat="c in objects"> <td>{% c.name %}</td> <td> <a ng-click="edit_category(c.id)"> <i class="icon-edit" title="编辑"></i> </a> <a ng-click="remove_category(c.id)"> <i class="icon-remove" title="删除"></i> </a> </td> </tr> </tbody> </table> </div> 设置App和Controller Template
{{use "angularjs"}} {{use "jquery"}} <div ng-app="AdminApp" id="ng-app" ng-controller="adminCtrl"> <form class="form-inline">
<input ng-model="topictype_name" placeholder="新课程分类名称"></input> <a class="btn btn-primary" ng-click="add_category()">添加</a> </form> <table class="table table-bordered table-header"> <tbody> <tr ng-repeat="c in objects|orderBy:Ordering"> <td>{% c.name %}</td> <td> <a ng-click="edit_category(c.id)"> <i class="icon-edit" title="编辑"></i> </a> <a ng-click="remove_category(c.id)"> <i class="icon-remove" title="删除"></i> </a> </td> </tr> </tbody> </table> </div> 绑定变量 Template
{{use "angularjs"}} {{use "jquery"}} <div ng-app="AdminApp" id="ng-app" ng-controller="adminCtrl"> <form class="form-inline">
<input ng-model="topictype_name" placeholder="新课程分类名称"></input> <a class="btn btn-primary" ng-click="add_category()“>添加</a> </form> <table class="table table-bordered table-header"> <tbody> <tr ng-repeat="c in objects|orderBy:Ordering"> <td>{% c.name %}</td> <td> <a ng-click="edit_category(c.id)"> <i class="icon-edit" title="编辑"></i> </a> <a ng-click="remove_category(c.id)"> <i class="icon-remove" title="删除"></i> </a> </td> </tr> </tbody> </table> </div> 绑定click事件 Template
{{use "angularjs"}} {{use "jquery"}} <div ng-app="AdminApp" id="ng-app" ng-controller="adminCtrl"> <form class="form-inline">
<input ng-model="topictype_name" placeholder="新课程分类名称"></input> <a class="btn btn-primary" ng-click="add_category()“>添加</a> </form> <table class="table table-bordered table-header"> <tbody> <tr ng-repeat="c in objects|orderBy:Ordering"> <td>{% c.name %}</td> <td> <a ng-click="edit_category(c.id)"> <i class="icon-edit" title="编辑"></i> </a> <a ng-click="remove_category(c.id)"> <i class="icon-remove" title="删除"></i> </a> </td> </tr> </tbody> </table> </div> 对objects进行循环 在DOM显示变量值(表达式) 绑定click事件进行编辑 绑定click事件进行删除 Template
var app = angular.module('AdminApp', []).config(function ($interpolateProvider) { $interpolateProvider.startSymbol('{%'); $interpolateProvider.endSymbol('%}'); });
function adminCtrl($scope) { $.get('/class/admin/category/query') .success(function(data, status, headers, config){ $scope.objects = data.rows; $scope.$apply(); }); $scope.ordering = „name‟; $scope.add_category = function(){ var v = $('#field_category').val(); if (!v){ show_message('课程分类名称不能为空', 'error'); }else{ $.post('/class/admin/category/add', {'name':v}) .success(function(data){ if (data.success) $scope.objects.push(data.data); else show_message(data.message, 'error'); $scope.$apply(); }); } } } 初始化angularjs标签 Template
var app = angular.module('AdminApp', []).config(function ($interpolateProvider) { $interpolateProvider.startSymbol('{%'); $interpolateProvider.endSymbol('%}'); });
function adminCtrl($scope) { $.get('/class/admin/category/query') .success(function(data, status, headers, config){ $scope.objects = data.rows; $scope.$apply(); }); $scope.ordering = „name‟; $scope.add_category = function(){ var v = $('#field_category').val(); if (!v){ show_message('课程分类名称不能为空', 'error'); }else{ $.post('/class/admin/category/add', {'name':v}) .success(function(data){ if (data.success) $scope.objects.push(data.data); else show_message(data.message, 'error'); $scope.$apply(); }); } } } 从后台装入数据(只会执行一次) Template
var app = angular.module('AdminApp', []).config(function ($interpolateProvider) { $interpolateProvider.startSymbol('{%'); $interpolateProvider.endSymbol('%}'); });
function adminCtrl($scope) { $.get('/class/admin/category/query') .success(function(data, status, headers, config){ $scope.objects = data.rows; $scope.$apply(); }); $scope.ordering = „name‟; $scope.add_category = function(){ var v = $('#field_category').val(); if (!v){ show_message('课程分类名称不能为空', 'error'); }else{ $.post('/class/admin/category/add', {'name':v}) .success(function(data){ if (data.success) $scope.objects.push(data.data); else show_message(data.message, 'error'); $scope.$apply(); }); } } } 设置排序字段 Template
var app = angular.module('AdminApp', []).config(function ($interpolateProvider) { $interpolateProvider.startSymbol('{%'); $interpolateProvider.endSymbol('%}'); });
function adminCtrl($scope) { $.get('/class/admin/category/query') .success(function(data, status, headers, config){ $scope.objects = data.rows; $scope.$apply(); }); $scope.ordering = „name‟; $scope.add_category = function(){ var v = $('#field_category').val(); if (!v){ show_message('课程分类名称不能为空', 'error'); }else{ $.post('/class/admin/category/add', {'name':v}) .success(function(data){ if (data.success) $scope.objects.push(data.data); else show_message(data.message, 'error'); $scope.$apply(); }); } } } 添加数据处理,界面自动刷新 Template
#coding=utf8 from uliweb import expose, functions from uliweb.orm import get_model
@expose('/class/admin/category') class ClassCategoryAdminView(object): def __init__(self): self.model = get_model('class_category') def __begin__(self): functions.require_login() if not functions.has_role(request.user, 'superuser'): error("你没有权限访问此页面") def query(self): view = functions.ListView(self.model, pagination=False) return json(view.json()) def add(self): view = functions.AddView(self.model, success_data=True) return view.run(json_result=True) View 导入常用函数
#coding=utf8 from uliweb import expose, functions from uliweb.orm import get_model
@expose('/class/admin/category') class ClassCategoryAdminView(object): def __init__(self): self.model = get_model('class_category') def __begin__(self): functions.require_login() if not functions.has_role(request.user, 'superuser'): error("你没有权限访问此页面") def query(self): view = functions.ListView(self.model, pagination=False) return json(view.json()) def add(self): view = functions.AddView(self.model, success_data=True) return view.run(json_result=True) View 设置Class的URL
#coding=utf8 from uliweb import expose, functions from uliweb.orm import get_model
@expose('/class/admin/category') class ClassCategoryAdminView(object): def __init__(self): self.model = get_model('class_category') def __begin__(self): functions.require_login() if not functions.has_role(request.user, 'superuser'): error("你没有权限访问此页面") def query(self): view = functions.ListView(self.model, pagination=False) return json(view.json()) def add(self): view = functions.AddView(self.model, success_data=True) return view.run(json_result=True) View 初始化
#coding=utf8 from uliweb import expose, functions from uliweb.orm import get_model
@expose('/class/admin/category') class ClassCategoryAdminView(object): def __init__(self): self.model = get_model('class_category') def __begin__(self): functions.require_login() if not functions.has_role(request.user, 'superuser'): error("你没有权限访问此页面") def query(self): view = functions.ListView(self.model, pagination=False) return json(view.json()) def add(self): view = functions.AddView(self.model, success_data=True) return view.run(json_result=True) View 执行Class方法 前的处理
#coding=utf8 from uliweb import expose, functions from uliweb.orm import get_model
@expose('/class/admin/category') class ClassCategoryAdminView(object): def __init__(self): self.model = get_model('class_category') def __begin__(self): functions.require_login() if not functions.has_role(request.user, 'superuser'): error("你没有权限访问此页面") def query(self): view = functions.ListView(self.model, pagination=False) return json(view.json()) def add(self): view = functions.AddView(self.model, success_data=True) return view.run(json_result=True) View 返回数据处理
#coding=utf8 from uliweb import expose, functions from uliweb.orm import get_model
@expose('/class/admin/category') class ClassCategoryAdminView(object): def __init__(self): self.model = get_model('class_category') def __begin__(self): functions.require_login() if not functions.has_role(request.user, 'superuser'): error("你没有权限访问此页面") def query(self): view = functions.ListView(self.model, pagination=False) return json(view.json()) def add(self): view = functions.AddView(self.model, success_data=True) return view.run(json_result=True) View 新增的处理
代码框架自动生成 处理常见的:List, Add, Edit, Delete, View 目前支持angularjs,html等以后还要支持其它模式
谢谢!明年再见!