Added iron router

This commit is contained in:
perroned 2014-06-13 09:22:30 -07:00
parent 8cabd766dc
commit d0747c9418
7 changed files with 95 additions and 18 deletions

27
labs/meteor-client/client/main.html Normal file → Executable file
View File

@ -1,15 +1,20 @@
<head> <template name="main">
<title>Demo</title> <head>
</head> <title>Demo</title>
<body> </head>
<div class="container"> <body>
<header class="navbar">
<div class="navbar-inner">
<a class="brand" href="/">Demo</a>
</div>
</header>
<div id="main" class="row-fluid"> <div id="main" class="row-fluid">
{{> usersList}} {{> usersList}}
</div> </div>
</body>
</template>
<template name="header">
<div class="navbar navbar-default navbar-static-top" role="navigation">
<!-- <div class="container"> -->
<div class="navbar-header">
<a class="navbar-brand" href="/">BigBlueButton</a>
</div>
<!-- </div> -->
</div> </div>
</body> </template>

View File

@ -0,0 +1,8 @@
Meteor.navigateTo = (path) ->
Router.go path
Router.configure layoutTemplate: 'layout'
Router.map ->
@route 'main',
path: '/'

View File

@ -0,0 +1,45 @@
#users {
/*display: none;*/
z-index: 0;
border: 3px solid #33343b;
position: absolute;
left: 0;
top: 6vh;
min-height:35vh;
background: #ffffff;
overflow-y: auto;
overflow-x: hidden;
resize:both;
min-width: 25vw;
h3 {
background:#f7f7f7;
font-size: 1em;
line-height: 2em;
font-weight: bold;
color: #666;
border-bottom: 1px solid #d7d7d7;
padding: 5px 10px;
margin:0;
}
}
#user-list {
border-radius:25px;
border: 2px solid grey;
li {
padding:10px;
border-bottom:1px solid #f2f2f2;
/*
* Added by Danny
*/
padding-left:50px;
list-style-type: none;
}
.user-wrapper:nth-child(even) {
background: #f6f6f6;
}
}

View File

@ -0,0 +1,6 @@
<template name="layout">
<div>
{{>header}}
</div>
{{> yield}}
</template>

View File

@ -1,7 +1,8 @@
# retrieve account for selected user, or the first mod account if nothing is selected
# global function
@getCurrentUserFromSession = -> @getCurrentUserFromSession = ->
id = Session.get("userId") or "a1a1a1a1a1a1" id = Session.get("userId") or "a1a1a1a1a1a1"
u = Meteor.users.findOne("user.userId": id) Meteor.users.findOne("user.userId": id)
u
Template.userItem.helpers Template.userItem.helpers
domain: -> domain: ->
@ -9,13 +10,13 @@ Template.userItem.helpers
a.href = @url a.href = @url
a.hostname a.hostname
# retrieve account for selected user, or the first mod account if nothing is selected # retrieve account for selected user
getCurrentUser: => getCurrentUser: =>
@window.getCurrentUserFromSession() @window.getCurrentUserFromSession()
isUserModerator: => isUserModerator: =>
u = @window.getCurrentUserFromSession() id = Session.get("userId") or "a1a1a1a1a1a1"
u.user.role is "MODERATOR" (Meteor.users.findOne {"user.userId": id, "user.role": "MODERATOR"})?
# using handlebars' {{equals}} wasn't working for these some reason, so heres a simple JS function to do it # using handlebars' {{equals}} wasn't working for these some reason, so heres a simple JS function to do it
compareUserIds: (u1, u2) -> compareUserIds: (u1, u2) ->

View File

@ -1,5 +1,6 @@
{ {
"packages": { "packages": {
"bootstrap-3": {} "bootstrap-3": {},
"iron-router": {}
} }
} }

View File

@ -2,13 +2,24 @@
"meteor": {}, "meteor": {},
"dependencies": { "dependencies": {
"basePackages": { "basePackages": {
"bootstrap-3": {} "bootstrap-3": {},
"iron-router": {}
}, },
"packages": { "packages": {
"bootstrap-3": { "bootstrap-3": {
"git": "https://github.com/mangasocial/meteor-bootstrap-3.git", "git": "https://github.com/mangasocial/meteor-bootstrap-3.git",
"tag": "v3.1.1-1", "tag": "v3.1.1-1",
"commit": "63dd38968828bb8963636df93e9a1c45e2dfe67e" "commit": "63dd38968828bb8963636df93e9a1c45e2dfe67e"
},
"iron-router": {
"git": "https://github.com/EventedMind/iron-router.git",
"tag": "v0.7.1",
"commit": "d1ffb3f06ea4c112132b030f2eb1a70b81675ecb"
},
"blaze-layout": {
"git": "https://github.com/EventedMind/blaze-layout.git",
"tag": "v0.2.4",
"commit": "b40e9b0612329288d75cf52ad14a7da64bb8618f"
} }
} }
} }