1
0
mirror of https://github.com/fazo96/markcloud.git synced 2025-01-10 11:04:21 +01:00

cool new links

This commit is contained in:
Enrico Fasoli 2014-10-08 22:11:31 +02:00
parent f742c2ba8b
commit 66f31be280
3 changed files with 31 additions and 25 deletions

View File

@ -57,15 +57,16 @@ Router.map ->
waitOn: -> Meteor.subscribe 'doc', @params._id waitOn: -> Meteor.subscribe 'doc', @params._id
data: -> docs.findOne @params._id data: -> docs.findOne @params._id
@route 'profile', @route 'profile',
path: '/u/:user?' path: '/@:user?'
waitOn: -> waitOn: ->
[Meteor.subscribe('docs', @params.user), [Meteor.subscribe('docs', @params.user),
Meteor.subscribe('user',@params.user)] Meteor.subscribe('user', @params.user)]
data: -> Meteor.users.findOne @params.user data: -> Meteor.users.findOne()
onBeforeAction: -> onBeforeAction: ->
if Meteor.user() and !@params.user if Meteor.user() and !@params.user
Router.go 'profile', user: Meteor.user()._id @params.user = Meteor.user()._id
action: -> action: ->
console.log @data()
if !@data() then @render '404' if !@data() then @render '404'
else if @ready() then @render() else if @ready() then @render()
else @render 'loading' else @render 'loading'

View File

@ -11,11 +11,11 @@
<h1>MarkCloud <h1>MarkCloud
{{#if currentUser}} {{#if currentUser}}
{{#if amIValid}} {{#if amIValid}}
<a class="pull-right" href="/u"> <a class="pull-right" href="{{pathFor 'profile'}}">
<small><i class="fa fa-chevron-right"></i></small> <small><i class="fa fa-chevron-right"></i></small>
</a> </a>
{{else}} {{else}}
<a class="pull-right ttip" href="/u" data-toggle="tooltip" data-placement="left" title="Need email verification"> <a class="pull-right ttip" href="{{pathFor 'profile'}}" data-toggle="tooltip" data-placement="left" title="Need email verification">
<small><i class="fa fa-envelope"></i></small> <small><i class="fa fa-envelope"></i></small>
</a> </a>
{{/if}} {{/if}}
@ -29,7 +29,7 @@
<small><i class="fa fa-home"></i></small> <small><i class="fa fa-home"></i></small>
</a> </a>
{{else}} {{else}}
<a class="pull-right" href="/signup"> <a class="pull-right" href="{{pathFor 'signup'}}">
<small><i class="fa fa-user"></i></small> <small><i class="fa fa-user"></i></small>
</a> </a>
{{/if}} {{/if}}
@ -63,7 +63,7 @@ Made by [some guy in the internet](http://github.com/fazo96) that you probably s
You can create a document _right now_. It will expire in 7 days. You can create a document _right now_. It will expire in 7 days.
This home page is written in markdown too! This home page is written in markdown too!
{{/markdown}} {{/markdown}}
<div class="text-center"><a class="btn btn-success" id="new" href="/new"> <div class="text-center"><a class="btn btn-success" id="new" href="{{pathFor 'new'}}">
<i class="fa fa-file-text"></i> New Document</a></div> <i class="fa fa-file-text"></i> New Document</a></div>
{{#markdown}} {{#markdown}}
### But with an account... ### But with an account...
@ -78,9 +78,9 @@ You will be able to delete your account and all your data whenever you want.
<a class="btn btn-primary" id="twitter-login"> <a class="btn btn-primary" id="twitter-login">
<i class="fa fa-twitter"></i> Log In With Twitter</a> <i class="fa fa-twitter"></i> Log In With Twitter</a>
<br>or<br> <br>or<br>
<a class="btn btn-primary" href="/signup"> <a class="btn btn-primary" href="{{pathFor 'signup'}}">
<i class="fa fa-user"></i> Sign Up</a> <i class="fa fa-user"></i> Sign Up</a>
<a class="btn btn-success" href="/login"> <a class="btn btn-success" href="{{pathFor 'signin'}}">
<i class="fa fa-sign-in"></i> Log In</a> <i class="fa fa-sign-in"></i> Log In</a>
</div> </div>
@ -108,11 +108,11 @@ You will be able to delete your account and all your data whenever you want.
<hr> <hr>
<div class="text-center"> <div class="text-center">
{{#unless currentUser}} {{#unless currentUser}}
<p><a href="/login">Log in</a> to edit and delete your documents<br></p> <p><a href="{{pathFor 'signin'}}">Log in</a> to edit and delete your documents<br></p>
{{/unless}} {{/unless}}
{{#if valid}} {{#if valid}}
{{#if owned}} {{#if owned}}
<p>This document is <a href="/u">yours</a>.</p> <p>This document is <a href="{{pathFor 'profile'}}">yours</a>.</p>
{{else}} {{else}}
{{#unless owner}} {{#unless owner}}
<p>This anonymous document will <b>expire {{expirationDays}}</b></p> <p>This anonymous document will <b>expire {{expirationDays}}</b></p>
@ -170,7 +170,7 @@ You will be able to delete your account and all your data whenever you want.
<button class="btn btn-primary" id="signup"> <button class="btn btn-primary" id="signup">
<i class="fa fa-user"></i> Sign Up</button> <i class="fa fa-user"></i> Sign Up</button>
<hr> <hr>
<div class="text-center">Already have an account? <a href="/login">Sign in!</a></div> <div class="text-center">Already have an account? <a href="{{pathFor 'signin'}}">Sign in!</a></div>
</div> </div>
</template> </template>
@ -182,7 +182,7 @@ You will be able to delete your account and all your data whenever you want.
<button class="btn btn-primary" id="signin"> <button class="btn btn-primary" id="signin">
<i class="fa fa-sign-in"></i> Sign In</button> <i class="fa fa-sign-in"></i> Sign In</button>
<hr> <hr>
<div class="text-center">Need an account? <a href="/signup">Sign Up!</a></div> <div class="text-center">Need an account? <a href="{{pathFor 'signup'}}">Sign Up!</a></div>
</div> </div>
</template> </template>
@ -207,7 +207,7 @@ You will be able to delete your account and all your data whenever you want.
<a class="btn btn-primary" id="logout"> <a class="btn btn-primary" id="logout">
<i class="fa fa-sign-out"></i> Logout</a> <i class="fa fa-sign-out"></i> Logout</a>
{{#if amIValid}} {{#if amIValid}}
<a class="btn btn-success" href="/new"> <a class="btn btn-success" href="{{pathFor 'new'}}">
<i class="fa fa-file-text"></i> New Document</a> <i class="fa fa-file-text"></i> New Document</a>
{{/if}} {{/if}}
<a class="btn btn-danger" id="deleteme"> <a class="btn btn-danger" id="deleteme">

View File

@ -20,17 +20,22 @@ validatedUser = (uid) ->
return yes for mail in u.emails when mail.verified is yes; no return yes for mail in u.emails when mail.verified is yes; no
Meteor.publish 'doc', (id) -> docs.find {_id: id}, limit: 1 Meteor.publish 'doc', (id) -> docs.find {_id: id}, limit: 1
Meteor.publish 'docs', (userId) -> Meteor.publish 'docs', (owner) ->
if userId? if owner?
if userId is @userId u = Meteor.users.findOne username: owner
docs.find {owner: userId}, fields: text: 0 if @userId and Meteor.users.findOne(@userId)._id is u._id
else docs.find {owner: userId, public: yes}, fields: text: 0 docs.find {owner: u._id}, fields: text: 0
else docs.find {owner: u._id, public: yes}, fields: text: 0
else docs.find {}, fields: text: 0 else docs.find {}, fields: text: 0
Meteor.publish 'user', (id) -> Meteor.publish 'user', (name) ->
id ?= @userId if !name?
if @userId is id u = Meteor.users.findOne @userId
Meteor.users.find id, fields: { username: 1, emails: 1, profile: 1 } if u then name = u.username
else Meteor.users.find id, fields: { username : 1, profile: 1 } return @ready() unless name?
if u and u.username is name
Meteor.users.find {username: name},
fields: { username: 1, emails: 1, profile: 1 }
else Meteor.users.find {username: name}, fields: { username : 1, profile: 1 }
docs.allow docs.allow
insert: (uid,doc) -> insert: (uid,doc) ->