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
data: -> docs.findOne @params._id
@route 'profile',
path: '/u/:user?'
path: '/@:user?'
waitOn: ->
[Meteor.subscribe('docs', @params.user),
Meteor.subscribe('user',@params.user)]
data: -> Meteor.users.findOne @params.user
Meteor.subscribe('user', @params.user)]
data: -> Meteor.users.findOne()
onBeforeAction: ->
if Meteor.user() and !@params.user
Router.go 'profile', user: Meteor.user()._id
@params.user = Meteor.user()._id
action: ->
console.log @data()
if !@data() then @render '404'
else if @ready() then @render()
else @render 'loading'

View File

@ -11,11 +11,11 @@
<h1>MarkCloud
{{#if currentUser}}
{{#if amIValid}}
<a class="pull-right" href="/u">
<a class="pull-right" href="{{pathFor 'profile'}}">
<small><i class="fa fa-chevron-right"></i></small>
</a>
{{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>
</a>
{{/if}}
@ -29,7 +29,7 @@
<small><i class="fa fa-home"></i></small>
</a>
{{else}}
<a class="pull-right" href="/signup">
<a class="pull-right" href="{{pathFor 'signup'}}">
<small><i class="fa fa-user"></i></small>
</a>
{{/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.
This home page is written in markdown too!
{{/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>
{{#markdown}}
### 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">
<i class="fa fa-twitter"></i> Log In With Twitter</a>
<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>
<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>
</div>
@ -108,11 +108,11 @@ You will be able to delete your account and all your data whenever you want.
<hr>
<div class="text-center">
{{#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}}
{{#if valid}}
{{#if owned}}
<p>This document is <a href="/u">yours</a>.</p>
<p>This document is <a href="{{pathFor 'profile'}}">yours</a>.</p>
{{else}}
{{#unless owner}}
<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">
<i class="fa fa-user"></i> Sign Up</button>
<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>
</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">
<i class="fa fa-sign-in"></i> Sign In</button>
<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>
</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">
<i class="fa fa-sign-out"></i> Logout</a>
{{#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>
{{/if}}
<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
Meteor.publish 'doc', (id) -> docs.find {_id: id}, limit: 1
Meteor.publish 'docs', (userId) ->
if userId?
if userId is @userId
docs.find {owner: userId}, fields: text: 0
else docs.find {owner: userId, public: yes}, fields: text: 0
Meteor.publish 'docs', (owner) ->
if owner?
u = Meteor.users.findOne username: owner
if @userId and Meteor.users.findOne(@userId)._id is u._id
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
Meteor.publish 'user', (id) ->
id ?= @userId
if @userId is id
Meteor.users.find id, fields: { username: 1, emails: 1, profile: 1 }
else Meteor.users.find id, fields: { username : 1, profile: 1 }
Meteor.publish 'user', (name) ->
if !name?
u = Meteor.users.findOne @userId
if u then name = u.username
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
insert: (uid,doc) ->