coursegen 0.7.1 → 0.7.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +43 -35
  3. data/lib/coursegen/course/data/citem.rb +2 -1
  4. data/lib/coursegen/course/data/data_adaptor.rb +2 -0
  5. data/lib/coursegen/course/helpers/content_helpers.rb +79 -37
  6. data/lib/coursegen/course/helpers/list_of_helpers.rb +1 -0
  7. data/lib/coursegen/templates.rb +0 -3
  8. data/lib/coursegen/version.rb +1 -1
  9. data/templates/Guardfile +3 -3
  10. data/templates/Rules +21 -42
  11. data/templates/cg_config.rb +2 -1
  12. data/templates/cg_config.rb_sample +24 -30
  13. data/templates/content/bootstrap/css/custom.css +65 -23
  14. data/templates/content/bootstrap/css/full-width-pics.css +64 -0
  15. data/templates/content/bootstrap/css/prettyquote.css +31 -0
  16. data/templates/content/bootstrap/css/tipuesearch.css +163 -0
  17. data/templates/content/bootstrap/images/image1.jpg +0 -0
  18. data/templates/content/bootstrap/images/image10.jpg +0 -0
  19. data/templates/content/bootstrap/images/image2.jpg +0 -0
  20. data/templates/content/bootstrap/images/image22.jpg +0 -0
  21. data/templates/content/bootstrap/images/image3.png +0 -0
  22. data/templates/content/bootstrap/images/image4.jpg +0 -0
  23. data/templates/content/bootstrap/images/image8.jpg +0 -0
  24. data/templates/content/bootstrap/images/image8.png +0 -0
  25. data/templates/content/bootstrap/images/image9.jpg +0 -0
  26. data/templates/content/{tipuesearch/img → bootstrap/images}/loader.gif +0 -0
  27. data/templates/content/bootstrap/images/search.png +0 -0
  28. data/templates/content/{tipuesearch/tipuesearchnomin.js → bootstrap/js/tipuesearch.js} +106 -171
  29. data/templates/content/bootstrap/js/tipuesearch.min.js +12 -0
  30. data/templates/content/bootstrap/js/tipuesearch_content.js +13 -0
  31. data/templates/content/{tipuesearch → bootstrap/js}/tipuesearch_set.js +8 -7
  32. data/templates/content/content/intro/course_toc.md.erb +1 -0
  33. data/templates/layouts/banner.html.erb +9 -0
  34. data/templates/layouts/body_header.html.erb +4 -3
  35. data/templates/layouts/bottom_includes.html.erb +15 -0
  36. data/templates/layouts/course.html.erb +44 -0
  37. data/templates/layouts/main_navbar.html.erb +1 -1
  38. data/templates/layouts/nav-menus.html.erb +37 -0
  39. data/templates/layouts/sidebar.html.erb +14 -0
  40. data/templates/layouts/top_includes.html.erb +31 -0
  41. metadata +27 -19
  42. data/deleteme.rb +0 -2
  43. data/templates/body_footer.html +0 -8
  44. data/templates/body_header.html.erb +0 -6
  45. data/templates/content/chalkmark/chalkmark.js +0 -30
  46. data/templates/content/tipuesearch/img/search.png +0 -0
  47. data/templates/content/tipuesearch/tipuesearchmin.js +0 -14
  48. data/templates/content/tipuesearch_logic/search.md.erb +0 -8
  49. data/templates/content/tipuesearch_logic/tipuesearch_content.js.erb +0 -6
  50. data/templates/course.html +0 -59
  51. data/templates/helpful_box.html +0 -3
  52. data/templates/layouts/course.html +0 -59
  53. data/templates/main_navbar.html.erb +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cbb8c92d9286443400bc58faf5177ff3d146b2b05e41575f5e5884c0993c92f
4
- data.tar.gz: 17838a1463efab4249cb1cdd1d8d5d78600bc3c66173b4f19d39165d8bec9810
3
+ metadata.gz: 2e9403029aa45dfc8bf3dc63e07b8fdec5c10dedc74ff77d48043e8a61ac1bdb
4
+ data.tar.gz: 257ec234d1ea117bf214ba4231d56fce4c561514d8d59161c39873502deab8aa
5
5
  SHA512:
6
- metadata.gz: 6addf58a4a5f1d156a7f72e1eeb7ed572713d9e311d7894d222ef0e21189a0e5d84ac66d3df9f71ee287d79883991a3d866a94b42943f64fc996a372e264cccb
7
- data.tar.gz: 90b3bb4e3b38a15d2deb5cd7abb18bfa6689f4b1a988244f9e386405365c632488bc8230d4c119b93f5c5c5c692fc86bae47583f08de51f8001b002945b8b93c
6
+ metadata.gz: b643b2ef9603c77fb13d4239a788c857d82c90dba2caa25137065e4b780e0c8868ce356e7257ab582686b6bf2b95a882f53c07208d324e1f8738697bee41f1db
7
+ data.tar.gz: 9df9e0a79160473a63f201352aaf047b4c08383be236b1b98cf1902bc90c211018765db85658b5b26abd945ddd5678995634b1f067f62b36f5996d3256a60215
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coursegen (0.6.2)
4
+ coursegen (0.7.6)
5
5
  activesupport
6
6
  adsf
7
7
  byebug
@@ -19,29 +19,29 @@ PATH
19
19
  GEM
20
20
  remote: https://rubygems.org/
21
21
  specs:
22
- activesupport (5.2.0)
22
+ activesupport (5.2.3)
23
23
  concurrent-ruby (~> 1.0, >= 1.0.2)
24
24
  i18n (>= 0.7, < 2)
25
25
  minitest (~> 5.1)
26
26
  tzinfo (~> 1.1)
27
- addressable (2.5.2)
27
+ addressable (2.6.0)
28
28
  public_suffix (>= 2.0.2, < 4.0)
29
- adsf (1.4.0)
29
+ adsf (1.4.1)
30
30
  rack (>= 1.0.0, < 3.0.0)
31
- byebug (10.0.2)
31
+ byebug (11.0.1)
32
32
  coderay (1.1.2)
33
33
  colored (1.2)
34
- concurrent-ruby (1.0.5)
35
- cri (2.10.1)
34
+ concurrent-ruby (1.1.5)
35
+ cri (2.15.3)
36
36
  colored (~> 1.2)
37
- ddmemoize (1.0.0a3)
38
- ddtelemetry (= 1.0.0a2)
37
+ ddmemoize (1.0.0)
38
+ ddmetrics (~> 1.0)
39
39
  ref (~> 2.0)
40
- ddplugin (1.0.1)
41
- ddtelemetry (1.0.0a2)
42
- ffi (1.9.25)
40
+ ddmetrics (1.0.1)
41
+ ddplugin (1.0.2)
42
+ ffi (1.10.0)
43
43
  formatador (0.2.5)
44
- guard (2.14.2)
44
+ guard (2.15.0)
45
45
  formatador (>= 0.2.4)
46
46
  listen (>= 2.7, < 4.0)
47
47
  lumberjack (>= 1.0.12, < 2.0)
@@ -56,53 +56,61 @@ GEM
56
56
  guard-compat (~> 1.0)
57
57
  hamster (3.0.0)
58
58
  concurrent-ruby (~> 1.0)
59
- i18n (1.0.1)
59
+ i18n (1.6.0)
60
60
  concurrent-ruby (~> 1.0)
61
- icalendar (2.4.1)
62
- json (2.1.0)
63
- kramdown (1.16.2)
61
+ icalendar (2.5.3)
62
+ ice_cube (~> 0.16)
63
+ ice_cube (0.16.3)
64
+ json (2.2.0)
65
+ json_schema (0.20.4)
66
+ kramdown (2.1.0)
64
67
  listen (3.1.5)
65
68
  rb-fsevent (~> 0.9, >= 0.9.4)
66
69
  rb-inotify (~> 0.9, >= 0.9.7)
67
70
  ruby_dep (~> 1.2)
68
- lumberjack (1.0.12)
69
- method_source (0.9.0)
70
- mini_portile2 (2.3.0)
71
+ lumberjack (1.0.13)
72
+ method_source (0.9.2)
73
+ mini_portile2 (2.4.0)
71
74
  minitest (5.11.3)
72
- nanoc (4.8.19)
75
+ nanoc (4.11.0)
73
76
  addressable (~> 2.5)
74
- cri (~> 2.8)
75
- ddmemoize (= 1.0.0a3)
77
+ cri (~> 2.15)
78
+ ddmemoize (~> 1.0)
79
+ ddmetrics (~> 1.0)
76
80
  ddplugin (~> 1.0)
77
- ddtelemetry (= 1.0.0a2)
78
81
  hamster (~> 3.0)
82
+ json_schema (~> 0.19)
83
+ parallel (~> 1.12)
79
84
  ref (~> 2.0)
80
85
  slow_enumerator_tools (~> 1.0)
86
+ tomlrb (~> 1.2)
81
87
  nenv (0.3.0)
82
- nokogiri (1.8.4)
83
- mini_portile2 (~> 2.3.0)
88
+ nokogiri (1.10.2)
89
+ mini_portile2 (~> 2.4.0)
84
90
  notiffany (0.1.1)
85
91
  nenv (~> 0.1)
86
92
  shellany (~> 0.0)
87
- pry (0.11.3)
93
+ parallel (1.17.0)
94
+ pry (0.12.2)
88
95
  coderay (~> 1.1.0)
89
96
  method_source (~> 0.9.0)
90
- public_suffix (3.0.2)
91
- rack (2.0.5)
92
- rake (11.3.0)
97
+ public_suffix (3.0.3)
98
+ rack (2.0.7)
99
+ rake (12.3.2)
93
100
  rb-fsevent (0.10.3)
94
- rb-inotify (0.9.10)
95
- ffi (>= 0.5.0, < 2)
101
+ rb-inotify (0.10.0)
102
+ ffi (~> 1.0)
96
103
  ref (2.0.0)
97
104
  ruby_dep (1.5.0)
98
- rubytree (1.0.0)
105
+ rubytree (1.0.1)
99
106
  json (~> 2.1)
100
107
  structured_warnings (~> 0.3)
101
108
  shellany (0.0.1)
102
109
  slow_enumerator_tools (1.1.0)
103
110
  structured_warnings (0.3.0)
104
- thor (0.20.0)
111
+ thor (0.20.3)
105
112
  thread_safe (0.3.6)
113
+ tomlrb (1.2.8)
106
114
  tzinfo (1.2.5)
107
115
  thread_safe (~> 0.1)
108
116
 
@@ -115,4 +123,4 @@ DEPENDENCIES
115
123
  rake
116
124
 
117
125
  BUNDLED WITH
118
- 1.16.1
126
+ 1.17.2
@@ -6,7 +6,7 @@ require 'active_support/inflector'
6
6
  #
7
7
  class CItem
8
8
  attr_reader :order, :section, :subsection, :subsection_citem, :title,
9
- :type, :identifier, :short_name, :status, :nitem, :css_class, :homework, :desc, :cat
9
+ :type, :identifier, :short_name, :status, :nitem, :css_class, :homework, :desc, :cat, :assigned
10
10
  attr_accessor :lecture_number, :lecture_date, :start_time, :end_time
11
11
 
12
12
  # Callable with nitem=nil to create a mock
@@ -85,6 +85,7 @@ class CItem
85
85
  @homework = @nitem[:homework]
86
86
  @desc = @nitem[:desc]
87
87
  @cat = @nitem[:cat]
88
+ @assigned = @nitem[:assigned]
88
89
  end
89
90
 
90
91
  def parse_identifier(ident)
@@ -32,6 +32,8 @@ class DataAdaptor
32
32
  citem.desc
33
33
  when :homework
34
34
  citem.homework
35
+ when :assigned
36
+ citem.assigned
35
37
  when :start_date_time
36
38
  citem.schedule_start_date_time
37
39
  when :end_date_time
@@ -1,54 +1,55 @@
1
1
  # Helpers to be used to annotate content
2
+ require 'byebug'
2
3
  module ContentHelpers
3
- def include_topic item_symbol
4
+ def include_topic(item_symbol)
4
5
  incorporated_topic = lookup_nitem("topics", item_symbol.to_s)
5
6
  items[incorporated_topic.identifier.to_s].compiled_content
6
7
  end
7
8
 
8
- def include_page item_symbol
9
+ def include_page(item_symbol)
9
10
  incorporated_topic = lookup_nitem("pages", item_symbol.to_s)
10
11
  items[incorporated_topic.identifier.to_s].compiled_content
11
12
  end
12
13
 
13
- def include_background item_symbol
14
+ def include_background(item_symbol)
14
15
  incorporated_topic = lookup_nitem("background", item_symbol.to_s)
15
16
  items[incorporated_topic.identifier.to_s].compiled_content
16
17
  end
17
18
 
18
- def include_intro item_symbol
19
+ def include_intro(item_symbol)
19
20
  incorporated_topic = lookup_nitem("intro", item_symbol.to_s)
20
21
  items[incorporated_topic.identifier.to_s].compiled_content
21
22
  end
22
23
 
23
- def include_from_section sect_symbol, item_symbol
24
+ def include_from_section(sect_symbol, item_symbol)
24
25
  incorporated_item = lookup_nitem(sect_symbol.to_s, item_symbol.to_s)
25
26
  Toc.instance.record_inclusion @item, incorporated_item
26
27
  items[incorporated_item.identifier.to_s].compiled_content
27
28
  end
28
29
 
29
- def lookup_nitem the_sect, short_name
30
+ def lookup_nitem(the_sect, short_name)
30
31
  Toc.instance.lookup_citem(the_sect, short_name).nitem
31
32
  end
32
33
 
33
- def link_to_doc label, file_name
34
+ def link_to_doc(label, file_name)
34
35
  "<a href=\"/docs/#{file_name}\">#{label}</a>"
35
36
  end
36
37
 
37
- def toc_link_to item
38
+ def toc_link_to(item)
38
39
  link_to_unless_current item[:title], item
39
40
  end
40
41
 
41
- def bold_red string
42
+ def bold_red(string)
42
43
  "<span style=\"color: red; font-style: italic;\">#{string}</span>"
43
44
  end
44
45
 
45
- def italic_red string
46
+ def italic_red(string)
46
47
  " *#{string}*{: style=\"color: red\"} "
47
48
  end
48
49
 
49
- def ir string; italic_red(string); end
50
+ def ir(string); italic_red(string); end
50
51
 
51
- def callout title, body
52
+ def callout(title, body)
52
53
  <<-HTMLSTRING
53
54
  <div class="well well-sm">
54
55
  <span class="themebg label label-primary">#{title}</span>#{body}
@@ -56,11 +57,11 @@ module ContentHelpers
56
57
  HTMLSTRING
57
58
  end
58
59
 
59
- def textbadge text, tooltip
60
+ def textbadge(text, tooltip)
60
61
  %(<span class="label label-info" data-toggle="tooltip" data-placement="top" title="#{tooltip}">#{text}</span>)
61
62
  end
62
63
 
63
- def iconbadge icon, tooltip
64
+ def iconbadge(icon, tooltip)
64
65
  %(<span class="glyphicon glyphicon-#{icon} themefg" data-toggle="tooltip" data-placement="top" title="#{tooltip}"></span>)
65
66
  end
66
67
 
@@ -77,11 +78,11 @@ HTMLSTRING
77
78
  end
78
79
 
79
80
  def zipbadge
80
- iconbadge("briefcase", "Submit code as a .zip file")
81
+ iconbadge("briefcase", "Submit work as an attachment")
81
82
  end
82
83
 
83
84
  def partbadge
84
- iconbadge("check", "Graded for participation only")
85
+ iconbadge("check", "Graded for participation only - pass/fail")
85
86
  end
86
87
 
87
88
  def timebadge
@@ -92,8 +93,7 @@ HTMLSTRING
92
93
  iconbadge("tent", "Team Deliverable")
93
94
  end
94
95
 
95
-
96
- def include_image_old filename_string, extra_class: nil
96
+ def include_image_old(filename_string, extra_class: nil)
97
97
  css_class = "img-responsive"
98
98
  css_class += " img-" + extra_class unless extra_class.nil?
99
99
  <<-HTMLSTRING
@@ -101,7 +101,7 @@ HTMLSTRING
101
101
  HTMLSTRING
102
102
  end
103
103
 
104
- def include_image filename_string, extra: ""
104
+ def include_image(filename_string, extra: "")
105
105
  <<-HTMLSTRING
106
106
  <div class="row">
107
107
  <div class="col-md-offset-2 col-md-8">
@@ -111,7 +111,13 @@ HTMLSTRING
111
111
  HTMLSTRING
112
112
  end
113
113
 
114
- def important string = ":"
114
+ def image(filename_string, extra: "")
115
+ <<-HTMLSTRING
116
+ <img src="/content/topics/images/#{filename_string}" class="img-responsive img-thumbnail" #{extra}/>
117
+ HTMLSTRING
118
+ end
119
+
120
+ def important(string = ":")
115
121
  <<-HTMLSTRING
116
122
  <div class="cg-important">
117
123
  #{string}
@@ -119,17 +125,17 @@ HTMLSTRING
119
125
  HTMLSTRING
120
126
  end
121
127
 
122
- def nb string = ":"
128
+ def nb(string = ":")
123
129
  <<-HTMLSTRING
124
130
  <div class="label label-info">#{string}</div>
125
131
  HTMLSTRING
126
132
  end
127
133
 
128
- def tbd string = ""
134
+ def tbd(string = "")
129
135
  "*[TO BE DETERMINED#{string}]*{: style=\"color: red\"}"
130
136
  end
131
137
 
132
- def deliverable string, append=""
138
+ def deliverable(string, append = "")
133
139
  "*Deliverable:*{: style=\"color: red\"} #{string + append} "
134
140
  end
135
141
 
@@ -141,20 +147,23 @@ HTMLSTRING
141
147
  deliverable(string, " *(pdf with name and hw number, graded for participation only)*")
142
148
  end
143
149
 
144
- def team_deliverable string
150
+ def team_deliverable(string)
145
151
  "*Team Deliverable:*{: style=\"color: red\"} *#{string}*"
146
152
  end
147
153
 
148
- def discussion string
154
+ def discussion(string)
149
155
  "*Discussion:*{: style=\"color: blue\"} *#{string}*"
150
156
  end
151
157
 
152
- def discussion_box string
158
+ def discussion_box(string)
153
159
  %(<div class="alert alert-info"><strong>Discussion:</strong> #{string}</div>)
154
160
  end
155
161
 
156
- def homework_hdr
157
- "#### Homework due for today"
162
+ def homework_hdr(show_legend: :on)
163
+ body = "#### Homework due for today"
164
+ legend = "\n**Legend**: #{partbadge}: Participation (pass/fail) | #{pdfbadge}: PDF | #{teambadge}: Team | #{zipbadge}: Attachment"
165
+ body += legend if show_legend == :on
166
+ body
158
167
  end
159
168
 
160
169
  def carousel(filenames)
@@ -175,7 +184,7 @@ HTMLSTRING
175
184
  end
176
185
 
177
186
  def carousel_new(filenames)
178
- carousel_work(filenames.map {|filename| "/content/topics/images/" + filename })
187
+ carousel_work(filenames.map { |filename| "/content/topics/images/" + filename })
179
188
  end
180
189
 
181
190
  def carousel_work(filenames)
@@ -218,32 +227,31 @@ HTMLSTRING
218
227
  "~~~~~~\n {: .language-python}"
219
228
  end
220
229
 
221
- def ruby_string str
230
+ def ruby_string(str)
222
231
  ruby_begin + "\n" + str + "\n" + ruby_end
223
232
  end
224
233
 
225
- def python_string str
234
+ def python_string(str)
226
235
  python_begin + "\n" + str + "\n" + python_end
227
236
  end
228
237
 
229
- def include_ruby name
238
+ def include_ruby(name)
230
239
  filename = Dir.pwd + "/content/content/topics/scripts/" + name.to_s + ".rb"
231
240
  filecontents = File.new(filename).read
232
241
  ruby_string filecontents
233
242
  end
234
243
 
235
- def include_python name
244
+ def include_python(name)
236
245
  filename = Dir.pwd + "/content/content/topics/robotcode/" + name.to_s + ".py"
237
246
  filecontents = File.new(filename).read
238
247
  ruby_string filecontents
239
248
  end
240
249
 
241
-
242
250
  def code_begin
243
251
  "\n~~~~~~"
244
252
  end
245
253
 
246
- def code_end lang=""
254
+ def code_end(lang = "")
247
255
  str = "~~~~~~\n"
248
256
  if ["ruby", "css", "java", "html"].include? lang
249
257
  str += "{: .language-#{lang}}"
@@ -251,13 +259,47 @@ HTMLSTRING
251
259
  str
252
260
  end
253
261
 
254
- def code_string str
262
+ def code_string(str)
255
263
  code_begin + "\n" + str + code_end
256
264
  end
257
265
 
258
- def include_code name
266
+ def include_code(name)
259
267
  filename = Dir.pwd + "/content/content/topics/scripts/" + name
260
268
  filecontents = File.new(filename).read
261
269
  code_string filecontents
262
270
  end
271
+
272
+ def postit_begin title
273
+ "<div class=\"postit\">" + "<h5>" + title + "</h5>"
274
+ end
275
+
276
+ def postit_end
277
+ "</div>"
278
+ end
279
+
280
+ def ul_begin
281
+ "<ul>"
282
+ end
283
+
284
+ def ul_end
285
+ "</ul>"
286
+ end
287
+
288
+ def ul body
289
+ "<ul>#{body}</ul>"
290
+ end
291
+
292
+ def list_items *items
293
+ items.reduce("") do |s, i|
294
+ if i.start_with?("<ul>")
295
+ s + i
296
+ else
297
+ s + "<li>" + i + "</li>"
298
+ end
299
+ end
300
+ end
301
+
302
+ def lab_note(title)
303
+ "<h5 style=\"font-family:cursive; font-weight:bold; font-szie:18px; color: red;\">#{title}</h5>"
304
+ end
263
305
  end
@@ -9,6 +9,7 @@ module ListOfHelpers
9
9
  # :number
10
10
  # :title
11
11
  # :homeworks
12
+ # :assigned
12
13
 
13
14
  def list_of(source:, rows:, cols:, subsections: [], items:)
14
15
  markup_adaptor = BootstrapMarkup.new