File: test_task_lists_behavior.html

package info (click to toggle)
ruby-task-list 2.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 256 kB
  • sloc: ruby: 308; javascript: 58; sh: 14; makefile: 8
file content (146 lines) | stat: -rw-r--r-- 4,271 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <script type="text/javascript" src="/assets/functional/helpers/remote.js"></script>
  <script type="text/javascript">
    function logEvent(event) {
      console.log(event)
      $('.log').prepend("<li>" + event.type + "</li>")
    }

    setInterval(function() {
      if (!$('.log li:first').first().hasClass("timestamp"))
        $('.log').prepend("<li class='timestamp'><time>" + new Date + "</time></li>")
    }, 3000)

    $(document).on('tasklist:enabled', logEvent)
    $(document).on('tasklist:disabled', logEvent)
    $(document).on('tasklist:change', '.js-task-list-field', function(event){
      logEvent(event)
      $(this).closest('.js-task-list-container').taskList('disable')
    })
    $(document).on('tasklist:changed', '.js-task-list-field', function(event){
      logEvent(event)
      $(this).closest('form').submit()
    })

    $(document).on('ajaxStart', logEvent)
    $(document).on('ajaxSuccess', '.js-task-list-container', function(event){
      logEvent(event)
      $(this).taskList()
    })
    $(function() {
      $('.js-task-list-container').taskList()
    })
  </script>

  <style>
    body {
      font: 13px Helvetica;
      padding: 20px;
    }
    input {
      font-size: 20px;
    }
    time {
      font-size: 10px;
      font-style: oblique;
    }

    .task-list {
      list-style-type: none;
    }
    .task-list .task-list-item {
      opacity: 0.75;
    }
    .task-list .task-list-item.enabled {
      opacity: 1.0;
    }

    .log {
      position: absolute;
      top: 20px;
      right: 50px;
      color: #222;
      list-style: none;
      margin: 0;
      padding: 0;
    }
  </style>
</head>
<body>
  <div class="js-task-list-container js-task-list-enable">
    <h2>Using Regex Parsing</h2>
    <div class="markdown">
      <ul class="task-list">
        <li>
          [ ]
        </li>
        <li class="task-list-item">
          <input type="checkbox" class="task-list-item-checkbox" disabled />
          I'm a task list item
        </li>
        <li class="task-list-item">
          <input type="checkbox" class="task-list-item-checkbox" disabled />
          with non-breaking space
        </li>
        <li class="task-list-item">
          <input type="checkbox" class="task-list-item-checkbox" disabled checked />
          completed, lower
        </li>
        <li class="task-list-item">
          <input type="checkbox" class="task-list-item-checkbox" disabled checked />
          completed capitalized
        </li>
      </ul>
    </div>
    <form action="/update" method="POST" data-remote data-type="json">
      <textarea name="comment[body]" class="js-task-list-field" cols="40" rows="10">
- [ ]  
- [ ] I'm a task list item
- [ ] with non-breaking space
- [x] completed, lower
- [X] completed capitalized</textarea>
    </form>
  </div>

  <div class="js-task-list-container js-task-list-enable">
    <h2>Using CommonMark Source Positioning</h2>
    <div class="markdown">
      <ul class="task-list" data-sourcepos="1:1-5:27">
        <li data-sourcepos="1:1-1:8">
          [ ]
        </li>
        <li class="task-list-item" data-sourcepos="2:1-2:26">
          <input type="checkbox" class="task-list-item-checkbox" disabled />
          I'm a task list item
        </li>
        <li class="task-list-item" data-sourcepos="3:1-3:30">
          <input type="checkbox" class="task-list-item-checkbox" disabled />
          with non-breaking space
        </li>
        <li class="task-list-item" data-sourcepos="4:1-4:22">
          <input type="checkbox" class="task-list-item-checkbox" disabled checked />
          completed, lower
        </li>
        <li class="task-list-item" data-sourcepos="5:1-5:27">
          <input type="checkbox" class="task-list-item-checkbox" disabled checked />
          completed capitalized
        </li>
      </ul>
    </div>
    <form action="/update" method="POST" data-remote data-type="json">
      <textarea name="comment[body]" class="js-task-list-field" cols="40" rows="10">
- [ ]  
- [ ] I'm a task list item
- [ ] with non-breaking space
- [x] completed, lower
- [X] completed capitalized</textarea>
    </form>
  </div>

  <ul class="log">
  </ul>
</body>
</html>