Paul: Check-in [8e47d9ffd1]

Online event coordination and survey application

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add moment.js and some default values
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:8e47d9ffd1f3cfb73ed5b16e98a25f0cb2c18451620bd3e5f711a24c4cddc505
User & Date: milouse 2018-11-19 20:52:46
Context
2018-11-19
22:29
Add support for multiple time per day check-in: f9c38e4f0a user: milouse tags: trunk
20:52
Add moment.js and some default values check-in: 8e47d9ffd1 user: milouse tags: trunk
2018-11-16
16:09
Refactor main.coffee script check-in: 05a8e83286 user: milouse tags: trunk
Changes

Changes to assets/coffee/main.coffee.



1
2
3
4
5
6
7
..
14
15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
..
84
85
86
87
88
89
90





91
92
93
94
95
96
97
98
99
100
101
102
103


class SurveyManager
  constructor: (@poll_form) ->
    pt = @poll_form.elements.poll_type
    return null unless pt?
    nb = document.getElementById 'new_prop'
    return null unless nb?
    nb.addEventListener 'click', (event) ->
................................................................................
  make_question_input: (input) ->
    input['oldDateValue'] = input.value
    input.value = input['oldTextValue'] ? ''
    input.setAttribute 'type', 'text'
    input.setAttribute 'name', 'proposals[][label]'
    input.className = 'prop-field'

  make_date_input: (input) ->
    input['oldTextValue'] = input.value

    input.value = input['oldDateValue'] ? ''
    input.setAttribute 'type', 'date'
    input.setAttribute 'name', 'proposals[][date]'
    input.className = 'prop-field'

  add_time_input: (date_rel) ->
    input = document.createElement 'INPUT'
    input.setAttribute 'type', 'time'
................................................................................
    input = document.createElement 'INPUT'
    input.setAttribute 'id', "prop_#{prop}_field"
    input.setAttribute 'data-prop-id', prop
    newProp.appendChild input
    if @poll_type == 'yesno'
      @make_question_input input
    else





      @make_date_input input
      @add_time_input input
    if allProps.children.length > 0
      input.setAttribute('required', 'required')
      newProp.appendChild @create_remove_link()
    allProps.appendChild(newProp)

window['currentSurveyManager'] = null
document.addEventListener 'DOMContentLoaded', ->
  cp = document.getElementById('poll_form')
  return unless cp?
  window.currentSurveyManager = new SurveyManager(cp)
  window.currentSurveyManager.insert_template()
>
>







 







|

>
|







 







>
>
>
>
>
|


<









1
2
3
4
5
6
7
8
9
..
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
..
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

102
103
104
105
106
107
108
109
110
moment = require('moment')

class SurveyManager
  constructor: (@poll_form) ->
    pt = @poll_form.elements.poll_type
    return null unless pt?
    nb = document.getElementById 'new_prop'
    return null unless nb?
    nb.addEventListener 'click', (event) ->
................................................................................
  make_question_input: (input) ->
    input['oldDateValue'] = input.value
    input.value = input['oldTextValue'] ? ''
    input.setAttribute 'type', 'text'
    input.setAttribute 'name', 'proposals[][label]'
    input.className = 'prop-field'

  make_date_input: (input, cur_date) ->
    input['oldTextValue'] = input.value
    cur_date ?= moment().format('YYYY-MM-DD')
    input.value = input['oldDateValue'] ? cur_date
    input.setAttribute 'type', 'date'
    input.setAttribute 'name', 'proposals[][date]'
    input.className = 'prop-field'

  add_time_input: (date_rel) ->
    input = document.createElement 'INPUT'
    input.setAttribute 'type', 'time'
................................................................................
    input = document.createElement 'INPUT'
    input.setAttribute 'id', "prop_#{prop}_field"
    input.setAttribute 'data-prop-id', prop
    newProp.appendChild input
    if @poll_type == 'yesno'
      @make_question_input input
    else
      last_date = null
      ldd = allProps.lastElementChild?.querySelector('input[type=date]')
      if ldd?
        last_date = moment(ldd.value, 'YYYY-MM-DD') \
                    .add(1, 'days').format('YYYY-MM-DD')
      @make_date_input input, last_date
      @add_time_input input
    if allProps.children.length > 0

      newProp.appendChild @create_remove_link()
    allProps.appendChild(newProp)

window['currentSurveyManager'] = null
document.addEventListener 'DOMContentLoaded', ->
  cp = document.getElementById('poll_form')
  return unless cp?
  window.currentSurveyManager = new SurveyManager(cp)
  window.currentSurveyManager.insert_template()

Changes to package-lock.json.

3934
3935
3936
3937
3938
3939
3940





3941
3942
3943
3944
3945
3946
3947
      "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
      "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
      "dev": true,
      "requires": {
        "minimist": "0.0.8"
      }
    },





    "move-concurrently": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
      "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=",
      "dev": true,
      "requires": {
        "aproba": "^1.1.1",







>
>
>
>
>







3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
      "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
      "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
      "dev": true,
      "requires": {
        "minimist": "0.0.8"
      }
    },
    "moment": {
      "version": "2.22.2",
      "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz",
      "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y="
    },
    "move-concurrently": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
      "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=",
      "dev": true,
      "requires": {
        "aproba": "^1.1.1",

Changes to package.json.

3
4
5
6
7
8
9
10


11
12
13
14
15
16
17
  "version": "0.0.1",
  "author": "√Čtienne Deparis <etienne@depar.is>",
  "scripts": {
    "dev": "NODE_ENV=development webpack-dev-server --inline --hot",
    "build": "NODE_ENV=production webpack --progress --hide-modules",
    "lint": "coffeelint assets/coffee"
  },
  "dependencies": {},


  "devDependencies": {
    "babel-core": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "coffee-loader": "^0.9.0",
    "coffeelint": "^2.0",
    "coffeescript": "^2.1",
    "compression-webpack-plugin": "^1.1.0",







|
>
>







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  "version": "0.0.1",
  "author": "√Čtienne Deparis <etienne@depar.is>",
  "scripts": {
    "dev": "NODE_ENV=development webpack-dev-server --inline --hot",
    "build": "NODE_ENV=production webpack --progress --hide-modules",
    "lint": "coffeelint assets/coffee"
  },
  "dependencies": {
    "moment": "^2.22"
  },
  "devDependencies": {
    "babel-core": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "coffee-loader": "^0.9.0",
    "coffeelint": "^2.0",
    "coffeescript": "^2.1",
    "compression-webpack-plugin": "^1.1.0",