mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-16 00:42:18 +00:00
start adding date field & ical support
This commit is contained in:
parent
8e39aa16c1
commit
6cffdfd1e8
2 changed files with 29 additions and 4 deletions
|
|
@ -12,6 +12,28 @@ module.exports = (expressApp, root, derby) ->
|
|||
expressApp.get '/terms', (req, res) ->
|
||||
staticPages.render 'terms', res
|
||||
|
||||
# localhost:3000/users/9/tasks.ics?apiToken=ae164366-f1ad-4a7d-83ef-b1d1085a96b6
|
||||
expressApp.get '/users/:uid/tasks.ics', (req, res, next) ->
|
||||
{uid} = req.params
|
||||
{apiToken} = req.query
|
||||
|
||||
model = req.getModel()
|
||||
query = model.query('users').withIdAndToken(uid, apiToken)
|
||||
query.fetch (err, result) ->
|
||||
return next(err) if err
|
||||
userObj = result.at(0).get()
|
||||
tasksWithDates = _.filter userObj.tasks, (task) -> !!task.date
|
||||
console.log("DATES LOLOL " + tasksWithDates)
|
||||
|
||||
ical = new icalendar.iCalendar()
|
||||
_.each tasksWithDates, (task) ->
|
||||
ical.addComponent event
|
||||
event2 = ical.addComponent("VEVENT")
|
||||
event2.setSummary "Second test event"
|
||||
event2.setDate new Date(2011, 11, 5, 12, 0, 0), 60 * 60 # Duration in seconds
|
||||
res.send(200, ical.generateIcs())
|
||||
next()
|
||||
|
||||
# ---------- Deprecated Paths ------------
|
||||
|
||||
deprecatedMessage = 'This API is no longer supported, see https://github.com/lefnire/habitrpg/wiki/API for new protocol'
|
||||
|
|
|
|||
|
|
@ -584,8 +584,7 @@ do a find for the string after "→"
|
|||
<label class="checkbox inline"><input type=checkbox checked={:task.up}>Up</label>
|
||||
<label class="checkbox inline"><input type=checkbox checked={:task.down}>Down</label>
|
||||
</div>
|
||||
{/}
|
||||
{#if equal(:task.type, 'daily')}
|
||||
{else if equal(:task.type, 'daily')}
|
||||
<label>Repeat</label>
|
||||
<div class="control-group btn-group repeat-days">
|
||||
<!-- note, does not use data-toggle="buttons-checkbox" - it would interfere with our own click binding -->
|
||||
|
|
@ -597,8 +596,7 @@ do a find for the string after "→"
|
|||
<button type="button" class="btn btn-info {#if :task.repeat.f}active{/}" data-day='f' x-bind=click:toggleDay>F</button>
|
||||
<button type="button" class="btn btn-info {#if :task.repeat.s}active{/}" data-day='s' x-bind=click:toggleDay>S</button>
|
||||
</div>
|
||||
{/}
|
||||
{#if equal(:task.type, 'reward')}
|
||||
{else if equal(:task.type, 'reward')}
|
||||
<div class=control-group>
|
||||
<label>Price
|
||||
<div class="input-append">
|
||||
|
|
@ -606,6 +604,11 @@ do a find for the string after "→"
|
|||
</div>
|
||||
</label>
|
||||
</div>
|
||||
{else if equal(:task.type, 'todo')}
|
||||
<div class=control-group>
|
||||
<label>Date</label>
|
||||
<input type="date" value={:task.date} />
|
||||
</div>
|
||||
{/}
|
||||
<button type=submit class="btn">Save & Close</button>
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Reference in a new issue