Skip to content

Commit bfd26d0

Browse files
committed
route to paht
1 parent 4ce2b31 commit bfd26d0

File tree

8 files changed

+235
-1
lines changed

8 files changed

+235
-1
lines changed

app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ passport.use(new LocalStrategy(
5757
app.get('/', routes.index);
5858
app.get('/users', user.list);
5959
app.get('/login', routes.login);
60+
app.get('/path', routes.login);
6061

6162
app.get('/auth',
6263
passport.authenticate('local', {failureRedirect: '/login'}),
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
/* =============================================================
2+
* bootstrap-collapse.js v2.1.1
3+
* http://twitter.github.com/bootstrap/javascript.html#collapse
4+
* =============================================================
5+
* Copyright 2012 Twitter, Inc.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* ============================================================ */
19+
20+
21+
!function ($) {
22+
23+
"use strict"; // jshint ;_;
24+
25+
26+
/* COLLAPSE PUBLIC CLASS DEFINITION
27+
* ================================ */
28+
29+
var Collapse = function (element, options) {
30+
this.$element = $(element)
31+
this.options = $.extend({}, $.fn.collapse.defaults, options)
32+
33+
if (this.options.parent) {
34+
this.$parent = $(this.options.parent)
35+
}
36+
37+
this.options.toggle && this.toggle()
38+
}
39+
40+
Collapse.prototype = {
41+
42+
constructor: Collapse
43+
44+
, dimension: function () {
45+
var hasWidth = this.$element.hasClass('width')
46+
return hasWidth ? 'width' : 'height'
47+
}
48+
49+
, show: function () {
50+
var dimension
51+
, scroll
52+
, actives
53+
, hasData
54+
55+
if (this.transitioning) return
56+
57+
dimension = this.dimension()
58+
scroll = $.camelCase(['scroll', dimension].join('-'))
59+
actives = this.$parent && this.$parent.find('> .accordion-group > .in')
60+
61+
if (actives && actives.length) {
62+
hasData = actives.data('collapse')
63+
if (hasData && hasData.transitioning) return
64+
actives.collapse('hide')
65+
hasData || actives.data('collapse', null)
66+
}
67+
68+
this.$element[dimension](0)
69+
this.transition('addClass', $.Event('show'), 'shown')
70+
$.support.transition && this.$element[dimension](this.$element[0][scroll])
71+
}
72+
73+
, hide: function () {
74+
var dimension
75+
if (this.transitioning) return
76+
dimension = this.dimension()
77+
this.reset(this.$element[dimension]())
78+
this.transition('removeClass', $.Event('hide'), 'hidden')
79+
this.$element[dimension](0)
80+
}
81+
82+
, reset: function (size) {
83+
var dimension = this.dimension()
84+
85+
this.$element
86+
.removeClass('collapse')
87+
[dimension](size || 'auto')
88+
[0].offsetWidth
89+
90+
this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
91+
92+
return this
93+
}
94+
95+
, transition: function (method, startEvent, completeEvent) {
96+
var that = this
97+
, complete = function () {
98+
if (startEvent.type == 'show') that.reset()
99+
that.transitioning = 0
100+
that.$element.trigger(completeEvent)
101+
}
102+
103+
this.$element.trigger(startEvent)
104+
105+
if (startEvent.isDefaultPrevented()) return
106+
107+
this.transitioning = 1
108+
109+
this.$element[method]('in')
110+
111+
$.support.transition && this.$element.hasClass('collapse') ?
112+
this.$element.one($.support.transition.end, complete) :
113+
complete()
114+
}
115+
116+
, toggle: function () {
117+
this[this.$element.hasClass('in') ? 'hide' : 'show']()
118+
}
119+
120+
}
121+
122+
123+
/* COLLAPSIBLE PLUGIN DEFINITION
124+
* ============================== */
125+
126+
$.fn.collapse = function (option) {
127+
return this.each(function () {
128+
var $this = $(this)
129+
, data = $this.data('collapse')
130+
, options = typeof option == 'object' && option
131+
if (!data) $this.data('collapse', (data = new Collapse(this, options)))
132+
if (typeof option == 'string') data[option]()
133+
})
134+
}
135+
136+
$.fn.collapse.defaults = {
137+
toggle: true
138+
}
139+
140+
$.fn.collapse.Constructor = Collapse
141+
142+
143+
/* COLLAPSIBLE DATA-API
144+
* ==================== */
145+
146+
$(function () {
147+
$('body').on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
148+
var $this = $(this), href
149+
, target = $this.attr('data-target')
150+
|| e.preventDefault()
151+
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
152+
, option = $(target).data('collapse') ? 'toggle' : $this.data()
153+
$this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
154+
$(target).collapse(option)
155+
})
156+
})
157+
158+
}(window.jQuery);

public/javascripts/jquery.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/stylesheets/style.css

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,32 @@ filter:alpha(opacity=100); /* For IE8 and earlier */
4141
overflow: hidden;
4242
text-overflow: ellipsis;
4343
}
44+
45+
46+
.circle-badge {
47+
background: radial-gradient( 5px -9px, circle, white 8%, red 26px );
48+
background-color: #15CF8D;
49+
border: 0px;
50+
border-radius: 30px; /* one half of ( (border * 2) + height + padding ) */
51+
box-shadow: 1px 1px 1px black;
52+
color: white;
53+
font: bold 24px/20px Helvetica, Verdana, Tahoma;
54+
height: 30px;
55+
line-height: 30px;
56+
width: 30px;
57+
padding: 1px 1px 1px 1px;
58+
text-align: center;
59+
vertical-align: middle;
60+
}
61+
.path-node-title {
62+
display: block;
63+
font: bold 24px/20px Helvetica, Verdana, Tahoma;
64+
height: 30px;
65+
line-height: 30px;
66+
padding: 10px 10px 10px 10px;
67+
margin: 10px 10px 10px 10px;
68+
text-align: left;
69+
vertical-align: middle;
70+
71+
}
72+

routes/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,12 @@ exports.login = function(req, res){
1818
console.log('login');
1919
res.render('login',{ title: 'Login' });
2020
};
21+
22+
/*
23+
* GET path page.
24+
*/
25+
exports.login = function(req, res){
26+
console.log('path');
27+
res.render('path',{ title: 'Path title' });
28+
};
29+

views/bit/scripts.jade

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
script(type='text/javascript', src='javascripts/jquery.min.js')
2+
script(type='text/javascript', src='javascripts/bootstrap.js')

views/layout.jade

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ html
44
title= title
55
link(rel='stylesheet', href='/stylesheets/bootstrap.min.css')
66
link(rel='stylesheet', href='/stylesheets/style.css')
7+
include bit/scripts
78
body
89
include bit/topbar
910
div.container
10-
block content
11+
block content

views/path.jade

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
extends layout
2+
3+
block content
4+
div.row-fluid
5+
div.span9
6+
div
7+
h2 Path name
8+
div.path-node-title
9+
button.circle-badge(data-toggle="collapse", data-target="#path-node-1") 1
10+
span Topic 1
11+
div#path-node-1.collapse.in abc
12+
div.path-node-title
13+
button.circle-badge(data-toggle="collapse", data-target="#path-node-2") 2
14+
span Topic 2
15+
div#path-node-2.collapse.in abc
16+
div.path-node-title
17+
button.circle-badge(data-toggle="collapse", data-target="#path-node-3") 3
18+
span Topic 3
19+
div#path-node-3.collapse.in abc
20+
div.span3
21+
div.well
22+
li
23+
i.icon-eye-open
24+
span 1000
25+
li
26+
i.icon-thumbs-up
27+
span 1000
28+
li
29+
i.icon-share
30+
span 1000
31+
32+

0 commit comments

Comments
 (0)