diff --git a/modules/auth.js b/modules/auth.js index ca5dd30..ac314a9 100644 --- a/modules/auth.js +++ b/modules/auth.js @@ -5,8 +5,6 @@ var User = require('./index').User; exports.everyauth = everyauth; -//everyauth.debug = true; -// everyauth.everymodule.findUserById(function(userId, callback){ User.findById(userId, callback); }); diff --git a/public/bootstrap b/public/bootstrap index b23aea9..0810b7b 160000 --- a/public/bootstrap +++ b/public/bootstrap @@ -1 +1 @@ -Subproject commit b23aea9983fa8407fac832f09a99618a5b07c51c +Subproject commit 0810b7bcf4aceac78c28c14e6d783e0dc3f81c28 diff --git a/public/css/boothack.less b/public/css/boothack.less index ef48ea3..317a06c 100644 --- a/public/css/boothack.less +++ b/public/css/boothack.less @@ -1,9 +1,22 @@ +// Focus states +a { + color:#3399CC; + &:hover { + color: #2e89b6; + } +} +a:focus { + outline: thin dotted; +} +// Hover & Active +a:hover, +a:active { + outline: 0; +} + .topbar div > ul, .nav { .active > a { background-color: #1d648e; background-color: rgba(27,94,134,.5); } - .menu-dropdown,.dropdown-menu { - background-color:#123e58; - } } diff --git a/public/css/share.less b/public/css/share.less index ce9ef1f..cd72385 100644 --- a/public/css/share.less +++ b/public/css/share.less @@ -3,48 +3,147 @@ #main{ padding-top:50px; } +html,body { + background:#cdcdcd url(http://img04.taobaocdn.com/tps/i4/T1KWCyXo0pXXXXXXXX-164-164.png) 0 0; +} .navback { float:right; padding:10px; } +// 分享 .ratelist { .clearfix(); margin:0; list-style:none; } -.rateitem { +@shareWidth : 195px; +@shareBorder : 10px; +@shareBorderRadius:3px; +.shareitem{ + width:@shareWidth; + height:@shareWidth; + margin:0 50px 50px 0; + color:#666; float:left; - width:260px; - height:260px; - border:1px solid #888; - margin-left:-1px; - margin-top:-1px; - padding:10px; + position:relative; + .cover { + .transition(all .2s ease-in); + width:@shareWidth; + height:@shareWidth; + position:absolute; + z-index:1; + .border-radius(@shareBorderRadius); + } + .wrap { + border:@shareBorder solid #fff; + height:@shareWidth - @shareBorder*2; + .border-radius(@shareBorderRadius); + } + .cnt { + .transition(all .2s ease-in); + width:@shareWidth; + height:@shareWidth; + position:absolute; + z-index:0; + .border-radius(@shareBorderRadius); + background-color:rgba(255,255,255,0); + } + &:hover { + .cnt { + z-index:2; + background-color:rgba(255,255,255,0.5); + } + .cover { + opacity:.3; + } + + } + h3 { + font-size:14px; + line-height:1.5; + padding:5px; + } .score { display:none; } + .desc { + padding:5px; + } + .author { + font-weight:bold; + } + .act { + padding:5px; + position:absolute; + bottom:@shareBorder; + left:@shareBorder; + width:@shareWidth - @shareBorder*2; + } +} + +.slideshare { + width:580px; + background:#fff; +} +.desc { + color : @gray; + margin-bottom:20px; } + +// 标签 .tags { .clearfix(); list-style:none; margin:0; li { float:left; + margin: 5px 5px 0 0; + } + a { + display:inline-block; padding:5px; - margin-right:10px; background:#eee; + #gradient .vertical(#f2f2f2, #ddd); + } + a:hover { + text-decoration:none; + color:#fff; + #gradient .vertical(#666, #333); } -} -.slideshare { - width:580px; } + +// 分享会 .setitem { - padding:10px 0; + margin:20px 0; + border-bottom:1px solid #b9b9b9; + border-right:1px solid #b9b9b9; + border-left:1px solid #b9b9b9; margin-bottom:20px; - border-bottom:1px solid #ddd; + background:#fff; + .box-shadow(); + .hd { + background:#d5d5d7; + height:24px; + border-bottom:1px solid #b7bac1; + } + .bd { + padding:10px; + } + .a { + color:#39c + } + dl { + .clearfix(); + } + dt, dd { + float:left; + } + dd { + margin-right:20px; + } } //fix calendar @@ -57,7 +156,3 @@ } } -.desc { - color : @gray; - margin-bottom:20px; -} diff --git a/public/img/default-cover.png b/public/img/default-cover.png new file mode 100644 index 0000000..9cf3a3d Binary files /dev/null and b/public/img/default-cover.png differ diff --git a/public/js/rate/tags.js b/public/js/rate/tags.js new file mode 100644 index 0000000..9685af9 --- /dev/null +++ b/public/js/rate/tags.js @@ -0,0 +1,15 @@ +KISSY.add('rate/tags',function(S){ + var $ = S.all; + + var temp = S.one('#temp-tags')[0].innerHTML; + var tagsTmpl = new S.Template(temp); + + S.io({ + url : '/json/tags', + dataType : 'json', + type : 'get', + success : function(data){ + $('#tags .bd').html(tagsTmpl.render(data)); + } + }); +}); diff --git a/routers/shareset.js b/routers/shareset.js index 947e546..9f56cff 100644 --- a/routers/shareset.js +++ b/routers/shareset.js @@ -59,10 +59,12 @@ exports.create = function(req,res){ exports.show = function(req,res, next){ var ss = req.shareset; Share.find({shareset : ss._id, deleted : {$ne : true}}, function(err, docs){ + var isOwner = req.loggedIn && req.user._id.toString() == ss.owner.toString(); if(err) return next(err); res.render('shareset/show',{ title : ss.subject ,shareset : ss + ,isOwner : isOwner ,shares : docs }); }); @@ -87,13 +89,13 @@ exports.update = function(req,res){ shareset.save(function(error,saved){ if(error && error.errors){ res.send({ - success : false - ,errors : error.errors + errors : error.errors }); return; } res.send({ - success : true, + errors : null, + action : 'redirect', redirect : '/shareset/' + saved._id }); }); diff --git a/views/404.jade b/views/404.jade new file mode 100644 index 0000000..49a29b8 --- /dev/null +++ b/views/404.jade @@ -0,0 +1 @@ +h1 page not found! diff --git a/views/500.jade b/views/500.jade new file mode 100644 index 0000000..306dd9c --- /dev/null +++ b/views/500.jade @@ -0,0 +1 @@ +div= error diff --git a/views/index.jade b/views/index.jade new file mode 100644 index 0000000..6017fc2 --- /dev/null +++ b/views/index.jade @@ -0,0 +1,29 @@ +script + KISSY.use('rate/app',function(S,App){ + App.nav('home'); + }); + +script#temp-tags(type='kissy/template') + | + +div.box + .hd + h3 分享会 + .bd!= partial('partial/links') +.box + .hd + h3 常用链接 + .bd + ul.links + li + a(href='https://is.taobao.org/meeting/') 会议室预定 +div#tags.box + .hd + h3 标签 + .bd +script + KISSY.use('rate/home'); diff --git a/views/layout.jade b/views/layout.jade new file mode 100644 index 0000000..a7eedde --- /dev/null +++ b/views/layout.jade @@ -0,0 +1,57 @@ +!!! 5 +html + head + title= title + link(rel='stylesheet/less', href='/css/share.less') + script(src='/lib/less/1.1.3/less.min.js') + meta(name='viewport',content='width=device-width, initial-scale = 1.0, user-scalable = no') + -if(typeof css !== "undefined" ) + -if(css=="rate") + link(rel='stylesheet', href='/stylesheets/rate2.css') + script(src='http://a.tbcdn.cn/s/kissy/1.2.0/kissy-min.js') + script(src=''); + script(src='/js/template-pkg-min.js') + script + KISSY.config({ + packages : [{ + name : 'rate', + path : '/js' + }] + }); + KISSY.Config.debug = true; + script + KISSY.use('rate/app'); + body + div.topbar(data-dropdown='dropdown') + div.topbar-inner + .container + h3 + a.brand(href='/') 分享平台 + ul.nav + li(id='nav-home') + a(href="/") 首页 + li(id='nav-setlist') + a(href="/shareset/") 分享会 + li(id='nav-list') + a(href="/share") 分享 + li#nav-create + a(href='/shareset/new') 组织分享 + ul.nav.secondary-nav + - if(!everyauth.loggedIn) + li.dropdown + a.dropdown-toggle(href='/login') 未登录 + ul.dropdown-menu + li + a(href='/login') 登录 + li + a(href='/register') 注册 + - else + li.dropdown + a.dropdown-toggle(href='#')= user.login + ul.dropdown-menu + li + a(href='/logout') 退出 + div#main.container!= body + div.footer + script(src="/lib/jquery/1.6.4/jquery.min.js") + script(src="/bootstrap/js/bootstrap-dropdown.js") diff --git a/views/partial/links.jade b/views/partial/links.jade new file mode 100644 index 0000000..9e55287 --- /dev/null +++ b/views/partial/links.jade @@ -0,0 +1,5 @@ +ul.links + li + a(href="/list/?tag=firebird") 火鸟分享 + li + a(href="/list/?tag=firebird") STS分享分享会 diff --git a/views/rate2.jade b/views/rate2.jade new file mode 100644 index 0000000..78197a8 --- /dev/null +++ b/views/rate2.jade @@ -0,0 +1,71 @@ +div.mode_rate.mod.rate + h1= doc.title + h2= doc.authors.join(',') + + form#rateform(method="post",action="/ratedo") + h3 准备工作(比如PPT,案例) + #rate1.rateslider.section.rating-item.stars.ks-clear(tabindex='0') + p.text 拖动进行打分 + ul.indicator + li(title='没有准备嘛') 差 + li(title='该有的都有了') 一般 + li(title='资料充分') 好 + li(title='很有诚意啊') 很好 + li(title='准备的太好乐,让人感动') 牛逼 + .bar + .handle + input(name='rate1',type='hidden') + + h3 分享掌控(表达能力,控场能力, 时间把握) + #rate2.rateslider.section.rating-item.stars.ks-clear(tabindex='0') + p.text 拖动进行打分 + ul.indicator + li(title='表达能力欠佳,无法把握时间') 差 + li(title='表达能力尚可, 分享技能一般') 一般 + li(title='表达能力挺好的') 好 + li(title='很有诚意啊') 很好 + li(title='准备的太好了,让人感动') 牛逼 + .bar + .handle + input(name='rate2',type='hidden') + + h3 分享内容(分享内容对我的帮助,启发) + #rate3.rateslider.section.rating-item.stars.ks-clear(tabindex='0') + p.text 拖动进行打分 + ul.indicator + li(title='没有实质内容,太水了,快要睡着了') 差 + li(title='分享内容一般,但是也有点亮点') 一般 + li(title='内容很有意义') 好 + li(title='内容很好,充实,对我很有帮助') 很好 + li(title='内容无敌了,对我启发很大') 牛逼 + .bar + .handle + input(name='rate3',type='hidden') + + h3 整体映像(整场分享的大体感受) + #rate4.rateslider.section.rating-item.stars.ks-clear(tabindex='0') + p.text 拖动进行打分 + ul.indicator + li(title='这分享,发生过吗?') 差 + li(title='分享整体感脚一般') 一般 + li(title='分享不错') 好 + li(title='印象很好') 很好 + li(title='整场分享行云流水啊有木有,牛逼的分享') 牛逼 + .bar + .handle + input(name='rate4',type='hidden') + + .actions + input(type="hidden",value=doc._id,name="rid") + button.button.rate-btn(type="submit")#rate-submit 提交打分 +  或者  + a(href="/show/#{doc._id}") 返回 +script(src='/js/rate/slider.js') +script + KISSY.use('rate/slider',function(S, Slider){ + S.all('.rateslider','#rateform').each(function(item){ + new Slider({ + elem : item + }); + }) + }); diff --git a/views/share/show.jade b/views/share/show.jade index 92f183f..197bf20 100644 --- a/views/share/show.jade +++ b/views/share/show.jade @@ -9,12 +9,6 @@ script a(href='/list/') 所有分享 h1 #{share.authors.join(',')}: #{share.title} #tabs1 - ul.tabs.ks-switchable-nav - li.active - a(href='#detail') 首页 - li - a(href='#record') 评分记录 - .ks-switchable-content div.row .span10 @@ -52,12 +46,6 @@ h1 #{share.authors.join(',')}: #{share.title} document.getElementsByTagName("head")[0].appendChild(dsq); })() .span6 - .action - p - a.disabled(href='#') 我参加过 - | - - a.disabled(href='#') 我想参加 - p 手机扫描此条码直接打分 .meta dl.author dt 分享者 @@ -67,6 +55,13 @@ h1 #{share.authors.join(',')}: #{share.title} dt 分享会 dd a(href='/shareset/#{share.shareset}')= shareset.subject + + .action + p + a.btn(href='#') 我参加过 + | + a.btn(href='#') 我想参加 + //p 手机扫描此条码直接打分 - if(share.tags && share.tags.length); .ftags h3 Tags @@ -90,15 +85,6 @@ h1 #{share.authors.join(',')}: #{share.title} th.ts 评分时间 tbody a(href="/getRate/#{share._id}") 获取文件 - -script(src='/js/switchable-min.js'); script KISSY.use('rate/app,rate/inplace', function(S,APP){ - //APP.getQRCode('#qrcode', S.one('#rate-btn')[0].href); - }); - KISSY.use('switchable', function(S){ - new S.Tabs('#tabs1', { - triggerType : 'click', - activeTriggerCls : 'active' - }); }); diff --git a/views/shareset/index.jade b/views/shareset/index.jade index fa1b247..d32854c 100644 --- a/views/shareset/index.jade +++ b/views/shareset/index.jade @@ -3,26 +3,48 @@ script KISSY.use('rate/app',function(S,App){ App.nav('setlist#{type}'); }); +script#temp-tags(type='kissy/template') + | h1 所有分享会 #page - - if (results.length) - .setlist - - each item in results - .setitem.row - .span8 - h3.title - a(href="/shareset/#{item._id}") #{item.subject} - div.desc=item.desc - .span4 - dl.meta - dt 开始时间 - dd= dateFormat(item.startTime,'yyyy-mm-dd HH:MM:ss') - dt 结束时间 - dd= dateFormat(item.endTime,'yyyy-mm-dd HH:MM:ss') - .span4 - dl.meta - dt 分享地点 - dd= item.position - - else - p results is empty + .row + .span11 + ul.pills + li.active + a(href='#') 所有 + li + a(href='#') 即将到来的 + - if (results.length) + .setlist + - each item in results + .setitem + .hd + .bd + h3.title + a(href="/shareset/#{item._id}") #{item.subject} + div.desc=item.desc + dl.meta + dt 分享地点 + dd= item.position + dt 开始时间 + dd= dateFormat(item.startTime,'yyyy-mm-dd HH:MM:ss') + dt 结束时间 + dd= dateFormat(item.endTime,'yyyy-mm-dd HH:MM:ss') + - else + p results is empty + .span5 + .box#tags + .hd + h3 标签 + .bd + .box#tags + .hd + h3 分享会 + .bd!= partial('partial/links') +script + KISSY.use('rate/tags'); diff --git a/views/shareset/share.jade b/views/shareset/share.jade new file mode 100644 index 0000000..bf6ec44 --- /dev/null +++ b/views/shareset/share.jade @@ -0,0 +1,16 @@ +li.shareitem + .cover(style='background-image:url(#{shares[indexInCollection].cover})') + .cnt + .wrap + h3.title + a(href='/share/#{shares[indexInCollection]._id}') #{shares[indexInCollection].title} + div.desc=shares[indexInCollection].desc.substr(0, 40); + .act + span.author + #{shares[indexInCollection].authors.join(', ')} + - if(isOwner) + .btns + a(href='/share/#{shares[indexInCollection]._id}/edit') 编辑 + | + a.ajax-btn(data-type='delete', data-url='/share/#{shares[indexInCollection]._id}', href='/share/#{shares[indexInCollection]._id}') 删除 + diff --git a/views/shareset/show.jade b/views/shareset/show.jade index b3f9f8c..e1274b0 100644 --- a/views/shareset/show.jade +++ b/views/shareset/show.jade @@ -4,7 +4,7 @@ script }); .navback a(href='/shareset') 返回到分享会列表 -h1 分享会:#{shareset.subject} +h1 #{shareset.subject} .row .span5 dl @@ -15,25 +15,15 @@ h1 分享会:#{shareset.subject} dt 分享地点 dd= shareset.position .desc= shareset.desc - .action - a.btn.small(href='/shareset/#{shareset._id}/edit') 编辑 - | - a.btn.small.ajax-btn(data-type='delete',href='/shareset/#{shareset._id}') 删除 + - if(isOwner ) + .action + a.btn.small(href='/shareset/#{shareset._id}/edit') 编辑 + | + a.btn.small.ajax-btn(data-type='delete',href='/shareset/#{shareset._id}') 删除 + | + a.primary.btn(href='/share/new?shareset=#{shareset._id}')添加分享 .span11 - if (shares && shares.length) - ul.ratelist - - each item in shares - li.rateitem - h3.title - a(href="/share/#{item._id}") #{item.authors.join(', ')}: #{item.title} - p.meta - span.time #{item.ts_save.getFullYear()}-#{item.ts_save.getMonth()}-#{item.ts_save.getDate()} - div.desc=item.desc - .act - a(href='/share/#{item._id}/edit') 编辑 - | - - a.ajax-btn(data-type='delete', data-url='/share/#{item._id}', href='/share/#{item._id}') 删除 - .actions - a.primary.btn(href='/share/new?shareset=#{shareset._id}')添加分享 + ul.ratelist!= partial('share', shares) script KISSY.use('rate/ajax');