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

added anonymous and public links and fixed profile links

This commit is contained in:
Enrico Fasoli 2014-10-09 15:07:00 +02:00
parent be8309d014
commit 1879b974c1
2 changed files with 26 additions and 17 deletions

View File

@ -43,7 +43,7 @@ Router.map ->
path: '/d/:_id'
controller: docController
@route 'userDoc',
path: '/@:owner/:_id'
path: '/@:user/:_id'
controller: docController
@route 'src',
path:'/src/:_id'
@ -62,20 +62,18 @@ Router.map ->
waitOn: -> Meteor.subscribe 'doc', @params._id
data: -> docs.findOne @params._id
@route 'profile',
path: '/@:user?'
path: '/@:user'
waitOn: ->
[Meteor.subscribe('docs', @params.user),
Meteor.subscribe('user', @params.user)]
data: -> Meteor.users.findOne()
onBeforeAction: ->
if Meteor.user() and !@params.user
@params.user = Meteor.user().username
data: -> Meteor.users.findOne username: @params.user
action: ->
if !@ready() or Meteor.loggingIn() then @render 'loading'
else if !@data() then @render '404' else @render()
if Meteor.loggingIn() then @render 'loading'
else if @ready()
if !@data() then @render '404' else @render()
else @render 'loading'
@route 'new', template: 'editor'
@route 'signup',
controller: loggedOutController
@route 'signup', controller: loggedOutController
@route 'signin',
path: 'login'
controller: loggedOutController
@ -160,7 +158,12 @@ Template.profile.events
Template.doc.valid = -> @text?
Template.doc.source = -> Router.current().route.name is 'src'
Template.doc.rows = -> ""+@text.split('\n').length
Template.doc.owned = -> Meteor.user()._id is @owner
Template.doc.owned = -> Meteor.user() and Meteor.user()._id is @owner
Template.doc.privateUrl = ->
Template.doc.ownerName = ->
if Router.current().route.name is 'userDoc'
console.log Router.current()
return Router.current().params.owner
Template.doc.expirationDays = ->
if @owner then return 'never'
else return moment.unix(@dateCreated).add(7,'days').fromNow()

View File

@ -11,11 +11,11 @@
<h1>MarkCloud
{{#if currentUser}}
{{#if amIValid}}
<a class="pull-right" href="{{pathFor 'profile'}}">
<a id="icon" class="pull-right" href="{{pathFor 'profile' user=currentUser.username}}">
<small><i class="fa fa-chevron-right"></i></small>
</a>
{{else}}
<a class="pull-right ttip" href="{{pathFor 'profile'}}" data-toggle="tooltip" data-placement="left" title="Need email verification">
<a class="pull-right" id="icon" href="{{pathFor 'profile' user=currentUser.username}}" data-toggle="tooltip" data-placement="left" title="Need email verification">
<small><i class="fa fa-envelope"></i></small>
</a>
{{/if}}
@ -114,11 +114,17 @@ You will be able to delete your account and all your data whenever you want.
{{/unless}}
{{#if valid}}
{{#if owned}}
<p>This document is <a href="{{pathFor 'profile'}}">yours</a>.</p>
<p>This document is <a id="owner-link" href="{{pathFor 'profile' user=currentUser.username}}">yours</a>.</p>
<p>You can link this document using a <a href="{{pathFor 'userDoc' user=currentUser.username _id=this._id}}">public</a> or <a href="{{pathFor 'doc'}}">anonymous link</a>.</p>
<p>Anonymous links don't reveal your profile.</p>
{{else}}
{{#unless owner}}
<p>This anonymous document will <b>expire {{expirationDays}}</b></p>
{{/unless}}
{{#if ownerName}}
<p>Document owned by <a href="{{pathFor 'profile' user=currentUser.username}}">{{ownerName}}</a></p>
{{else}}
{{#unless owner}}
<p>This anonymous document will <b>expire {{expirationDays}}</b></p>
{{/unless}}
{{/if}}
{{/if}}
<div class="btn-group" id="tools">
{{#if currentUser}}{{#if owned}}