Created
June 18, 2014 13:32
-
-
Save podhmo/c9c45080aa32571e3b85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%namespace file="./widget.html" name="w"/> | |
<!doctype html> | |
<html> | |
<head> | |
<meta charset="UTF-8"/> | |
<style type="text/css"> | |
body > .container {padding:40px;} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="row"> | |
<div class="span9"> | |
<!-- drop down widget --> | |
<%w:dropdown name="DropDown" id="dropdownMenu1"> | |
<%w:menu id="first" href="#">Action</%w:menu> | |
<%w:menu href="#">Another Action</%w:menu> | |
<%w:menu href="#">Something else here</%w:menu> | |
<li role="presentation" class="divider"></li> | |
<%w:menu href="#">Separated link</%w:menu> | |
</%w:dropdown> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from wsgiref.simple_server import make_server | |
from pyramid.config import Configurator | |
import os.path | |
def top_view(request): | |
from js.bootstrap import bootstrap_css; bootstrap_css.need() | |
from js.bootstrap import bootstrap_js; bootstrap_js.need() | |
return {} | |
if __name__ == '__main__': | |
here = os.path.dirname(os.path.abspath(__file__)) | |
settings = {"mako.directories": here, | |
"pyramid.reload_all": True} | |
config = Configurator(settings=settings) | |
config.include("pyramid_mako") | |
config.include("pyramid_fanstatic") | |
config.add_mako_renderer(".html") | |
config.add_route('top', '/') | |
config.add_view(top_view, route_name='top', renderer="bootstrap.html") | |
app = config.make_wsgi_app() | |
server = make_server('0.0.0.0', 7654, app) | |
server.serve_forever() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%def name="dropdown(name='dropdown',id='')"> | |
<div class="dropdown"> | |
<button class="btn dropdown-toggle" type="button" ${"id={}".format(id) if id else ""} data-toggle="dropdown"> | |
${name} | |
<span class="caret"></span> | |
</button> | |
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1"> | |
${caller.body()} | |
</ul> | |
</div> | |
</%def> | |
<%def name="menu(href='#', id='')"> | |
<li role="presentation"><a ${"id={}".format(id) if id else ""} role="menuitem" tabindex="-1" href="#">${caller.body()}</a></li> | |
</%def> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
こういう表示になる