coursegen 0.8.3 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/pr.yml +19 -0
  3. data/.gitignore +3 -0
  4. data/Gemfile.lock +60 -35
  5. data/README.md +285 -69
  6. data/Rakefile +10 -1
  7. data/coursegen.gemspec +26 -26
  8. data/lib/coursegen.rb +5 -2
  9. data/lib/coursegen/cli.rb +49 -14
  10. data/lib/coursegen/course/data/citem.rb +10 -1
  11. data/lib/coursegen/course/data/data_adaptor.rb +16 -6
  12. data/lib/coursegen/course/data/section.rb +1 -1
  13. data/lib/coursegen/course/helpers/bootstrap_markup.rb +15 -15
  14. data/lib/coursegen/course/helpers/content_helpers.rb +86 -71
  15. data/lib/coursegen/course/helpers/formatting_helpers.rb +6 -10
  16. data/lib/coursegen/course/helpers/ical_feed_helpers.rb +2 -1
  17. data/lib/coursegen/course/helpers/lecture_helpers.rb +3 -2
  18. data/lib/coursegen/course/helpers/list_of.rb +40 -20
  19. data/lib/coursegen/course/helpers/list_of_helpers.rb +20 -14
  20. data/lib/coursegen/course/helpers/logging_helpers.rb +13 -12
  21. data/lib/coursegen/course/helpers/navigation_helpers.rb +62 -23
  22. data/lib/coursegen/course/helpers/sidebar_helpers.rb +19 -18
  23. data/lib/coursegen/course/helpers/table_helpers.rb +5 -4
  24. data/lib/coursegen/course/schedule/scheduler.rb +52 -19
  25. data/lib/coursegen/templates.rb +30 -23
  26. data/lib/coursegen/version.rb +3 -1
  27. data/spec/lectures_spec.rb +60 -50
  28. data/spec/play_spec.rb +24 -12
  29. data/spec/scheduler_spec.rb +87 -27
  30. data/tech_debt.md +5 -0
  31. data/templates/Rules +14 -19
  32. data/templates/cg_config.rb +105 -21
  33. data/templates/content/bootstrap/css/custom.css +87 -151
  34. data/templates/content/bootstrap/css/full-width-pics.css +8 -64
  35. data/templates/content/bootstrap/css/postit.css +7 -0
  36. data/templates/content/bootstrap/css/toasty.css +3 -0
  37. data/templates/content/content/index.md.erb +1 -1
  38. data/templates/content/content/intro/course_toc.md.erb +0 -1
  39. data/templates/content/content/intro/welcome.md.erb +1 -3
  40. data/templates/content/content/lectures/part1/02_here_we_go.md.erb +22 -1
  41. data/templates/content/content/lectures/part2/01_start_part2.md.erb +2 -1
  42. data/templates/content/content/lectures/part2/02_continue_part2.md.erb +3 -2
  43. data/templates/layouts/banner.html.erb +4 -4
  44. data/templates/layouts/body_footer.html +3 -4
  45. data/templates/layouts/body_header.html.erb +25 -7
  46. data/templates/layouts/bottom_includes.html.erb +21 -10
  47. data/templates/layouts/course.html.erb +7 -21
  48. data/templates/layouts/helpful_box.html +1 -1
  49. data/templates/layouts/nav-menus.html.erb +16 -36
  50. data/templates/layouts/sidebar.html.erb +9 -8
  51. data/templates/layouts/slides.html.erb +69 -0
  52. data/templates/layouts/top_includes.html.erb +24 -23
  53. metadata +32 -24
  54. data/.DS_Store +0 -0
  55. data/.vscode/settings.json +0 -2
  56. data/templates/.DS_Store +0 -0
  57. data/templates/Guardfile +0 -9
  58. data/templates/content/bootstrap/css/tipuesearch.css +0 -163
  59. data/templates/content/bootstrap/js/tipuesearch.js +0 -379
  60. data/templates/content/bootstrap/js/tipuesearch.min.js +0 -12
  61. data/templates/content/bootstrap/js/tipuesearch_content.js +0 -13
  62. data/templates/content/bootstrap/js/tipuesearch_set.js +0 -23
  63. data/templates/layouts/main_navbar.html.erb +0 -21
@@ -1,64 +1,8 @@
1
- /*
2
- * Start Bootstrap - Full Width Pics (http://startbootstrap.com/)
3
- * Copyright 2013-2016 Start Bootstrap
4
- * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE)
5
- */
6
-
7
- body {
8
- margin-top: 50px; /* Required margin for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */
9
- }
10
-
11
- .image-bg-fluid-height,
12
- .image-bg-fixed-height {
13
- text-align: center;
14
- -webkit-background-size: cover;
15
- -moz-background-size: cover;
16
- background-size: cover;
17
- -o-background-size: cover;
18
- }
19
-
20
- .image-bg-fluid-height {
21
- background: url('/bootstrap/images/image4.jpg') no-repeat center center scroll;
22
- padding: 100px 0;
23
- }
24
-
25
- .image-bg-fixed-height {
26
- background: url('/bootstrap/images/image4.jpg') no-repeat center center scroll;
27
- height: 70px;
28
- }
29
-
30
- .img-center {
31
- margin: 0 auto;
32
- }
33
-
34
- section {
35
- padding: 15px 0;
36
- }
37
-
38
- .section-heading {
39
- margin: 30px 0;
40
- font-size: 4em;
41
- }
42
-
43
- .section-lead {
44
- margin: 30px 0;
45
- }
46
-
47
- .section-paragraph {
48
- margin: 30px 0;
49
- }
50
-
51
- footer {
52
- margin: 50px 0;
53
- }
54
-
55
- @media(max-width:768px) {
56
- section {
57
- padding-top: 25px;
58
- padding-bottom: 25px;
59
- }
60
-
61
- .section-heading {
62
- font-size: 2em;
63
- }
64
- }
1
+ .masthead {
2
+ height: 70px;
3
+ background-image: url('/bootstrap/images/image1.jpg');
4
+ background-size: cover;
5
+ background-position: center;
6
+ background-repeat: no-repeat;
7
+
8
+ }
@@ -0,0 +1,7 @@
1
+ .postit {
2
+ background: hsl(56, 83%, 73%);
3
+ margin: 15px 30px auto;
4
+ padding: 10px 15px;
5
+ box-shadow: 0px 10px 10px rgba(0, 0, 0, 0.2);
6
+ color: #424242;
7
+ }
@@ -0,0 +1,3 @@
1
+ .toasty {
2
+ background-color: yellow;
3
+ }
@@ -3,7 +3,7 @@ title: Welcome!
3
3
  section: extras
4
4
  ---
5
5
  <div class="jumbotron">
6
- <h2>Welcome to the Sample Course!</h2>
6
+ <h1>Welcome to the Sample Course!</h1>
7
7
  <p>This course is generated when you first install Coursegen. It uses all the features (almost) of the software, to allow you to see what is possible.</p>
8
8
 
9
9
  <p>Pito Salas, pitosalas@brandeis.edu</p>
@@ -1,5 +1,4 @@
1
1
  ---
2
2
  title: List of lectures
3
3
  ---
4
- <%= list_of(source: "lectures", rows: ["subsection","page"], cols: [:number, :date, :title, :desc, :homework], items: @items) %>
5
4
  <%= list_of(source: "lectures", rows: ["subsection","page"], cols: [:number, :date, :title, :cat, :desc, :homework], items: @items) %>
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  title: Welcome to Sample Course
3
3
  ---
4
- ### Welcome!
4
+ ## Welcome!
5
5
 
6
6
  This page is part of the sample course in Coursegen
7
-
8
- Also it is used as the home page.
@@ -1,5 +1,26 @@
1
1
  ---
2
2
  title: Second Lecture - Here we go
3
+ desc: Advanced Features
4
+ slides: true
3
5
  ---
4
- ### Continuing
6
+ ## Continuing
7
+
5
8
  This page is the second one in the first part. It is the second lecture of the Sample Course.
9
+
10
+ <%= slide %>
11
+
12
+ ## Headings
13
+
14
+ # h1
15
+
16
+ ## h2
17
+
18
+ ### h3
19
+
20
+ #### h4
21
+
22
+ <%= slide %>
23
+
24
+ ## Next Lecture
25
+
26
+ Click "Third Lecture" on the sidebar to go to the next lecture.
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  title: Third Lecture - Launching Part 2
3
3
  ---
4
- ### Part 2 starts here
4
+ ## Part 2 starts here
5
+
5
6
  In the sample course, there are two sections or parts. This page is the first page of the second part.
@@ -1,5 +1,6 @@
1
1
  ---
2
- title: Fourth Lecture - Part2s second lecture
2
+ title: Fourth Lecture - Part2's second lecture
3
3
  ---
4
- ### Second lecture of part 2
4
+ ## Second lecture of part 2
5
+
5
6
  This is actually the fourth lecture of the Sample course.
@@ -1,9 +1,9 @@
1
- <aside class="image-bg-fixed-height">
1
+ <aside class="masthead">
2
2
  <div class="container">
3
3
  <div class="row">
4
- <div class="col-xs-7">
5
- <a class="navbar-title" href="/"><%= COURSE_SHORT_NAME %> - <%= COURSE_LONG_NAME %></a>
4
+ <div class="col-md-7">
5
+ <a href="/"><%= COURSE_SHORT_NAME %> - <%= COURSE_LONG_NAME %></a>
6
6
  </div>
7
7
  </div>
8
8
  </div>
9
- </aside>
9
+ </aside>
@@ -1,8 +1,7 @@
1
1
  <div class="container">
2
2
  <div class="row">
3
- <div class="col-xs-12">
3
+ <div class="col-md-12">
4
4
  <footer><%= COPYRIGHT_STRING %></footer>
5
- </div>
5
+ </div>
6
6
  </div>
7
- </div>
8
-
7
+ </div>
@@ -1,7 +1,25 @@
1
- <h3 class="body-header">
2
- <%= citem.title %>
3
- <% if citem.lecture? %>
4
- <small>(<%= citem.lecture_date_s %>, <%= citem.lecture_number_s.to_s %>)</small>
5
- <% end %>
6
- <br/><small> <%= citem.desc %> </small>
7
- </h3>
1
+ <div class="row">
2
+ <div class="col-12">
3
+ <h1>
4
+ <%= citem.title %>
5
+ <span style="font-size: 1rem;">
6
+ <% if citem.lecture? %>
7
+ (<%= citem.lecture_date_s %>, lect <%= citem.lecture_number.to_s %>, wk <%= ((citem.lecture_number)/2).to_s %>)
8
+ <span class="float-right">
9
+ <% if citem.lecture? && citem.section != "root" %>
10
+ | <%= link_to_prev(toc, item) %>
11
+ <% end %>
12
+ <% if citem.lecture? && citem.section != "root" %>
13
+ | <%=link_to_next(toc, item) %>
14
+ <% end %>
15
+ <% if citem.slides %> |
16
+ <%= link_to_slides %>
17
+ <% end %>
18
+ | <%= link_to_homework citem %>
19
+ </span>
20
+ <% end %>
21
+ </span>
22
+ </h1>
23
+ </div>
24
+ </div>
25
+ <h3 class="subheader"><%= citem.desc %></h3>
@@ -1,15 +1,26 @@
1
-
2
1
  <!-- Latest compiled and minified JavaScript -->
3
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
2
+ <!-- Optional JavaScript -->
3
+ <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
4
+ integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
4
5
 
5
6
  <script src="/bootstrap/js/custom.js"></script>
6
- <script src="/tipuesearch/tipuesearch_content.js"></script>
7
-
7
+ <script src="https://cdn.jsdelivr.net/npm/docsearch.js@2.6.3/dist/cdn/docsearch.min.js"></script>
8
8
  <script>
9
- $(document).ready(function() {
10
- $('#tipue_search_input').tipuesearch({
11
- 'show': 20,
12
- 'contextBuffer': 100
13
- });
14
- });
9
+ docsearch({
10
+ // Your apiKey and indexName will be given to you once
11
+ // we create your config
12
+ apiKey: '<%= SEARCH_CONFIG[:api_key] %>',
13
+ indexName: '<%= SEARCH_CONFIG[:index_name] %>',
14
+ <% if SEARCH_CONFIG[:app_id] != '' %>
15
+ appId: '<%= SEARCH_CONFIG[:app_id] %>',
16
+ <% end %>
17
+ algoliaOptions: {
18
+ hitsPerPage: 30
19
+ },
20
+ // Replace inputSelector with a CSS selector
21
+ // matching your search input
22
+ inputSelector: '#tipue_search_input',
23
+ // Set debug to true to inspect the dropdown
24
+ debug: <%= SEARCH_CONFIG[:debug] %>,
25
+ });
15
26
  </script>
@@ -1,5 +1,6 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
+
3
4
  <head>
4
5
  <%= render "/top_includes.*" %>
5
6
  <title><%= @item[:title] %> - <%= COURSE_SHORT_NAME %></title>
@@ -7,38 +8,23 @@
7
8
 
8
9
  <body>
9
10
  <% @citem = Toc.instance.n2c(@item) %>
10
- <!-- Navigation -->
11
- <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
12
- <%= render "/banner.*", toc: Toc.instance, item: item, citem: @citem %>
13
- <%= render "/nav-menus.*", toc: Toc.instance, item: item, citem: @citem %>
14
- </nav>
15
-
16
- <!-- Content Section -->
11
+ <%= render "/banner.*", toc: Toc.instance, item: item, citem: @citem %>
12
+ <%= render "/nav-menus.*", toc: Toc.instance, item: item, citem: @citem %>
17
13
  <section>
18
- <div class="container-fluid">
14
+ <div class="container DocSearch-content">
19
15
  <div class="row">
20
- <div class="col-sm-12 header-main">
16
+ <div class="col-md-9">
21
17
  <%= render "/body_header.*", toc: Toc.instance, item: item, citem: @citem %>
22
- </div>
23
- </div>
24
- <div class="row">
25
- <div class="body-main col-sm-9">
26
18
  <%= yield %>
27
19
  </div>
28
20
  <%= render "/sidebar.*" %>
29
- <!-- /.row -->
30
21
  </div>
31
- <!-- /.container -->
32
22
  </div>
33
23
  </section>
34
- <!-- Footer -->
24
+ <%= render "/bottom_includes.*" %>
35
25
  <footer>
36
26
  <%= render "/body_footer.*" %>
37
27
  </footer>
38
-
39
- <!-- jQuery -->
40
- <%= render "/bottom_includes.*" %>
41
-
42
28
  </body>
43
29
 
44
- </html>
30
+ </html>
@@ -1,3 +1,3 @@
1
1
  <div id="helpful" class="text-center">Was this helpful!?
2
- <a id="yes-link">yes</a> / <a id="no-link">no</a>
2
+ <a id="yes-link">yes</a> / <a id="no-link">no</a>
3
3
  </div>
@@ -1,37 +1,17 @@
1
- <div class="container">
2
- <div class="row">
3
- <button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse">
4
- <span class="sr-only">Toggle navigation</span>
5
- <span class="icon-bar"></span>
6
- <span class="icon-bar"></span>
7
- <span class="icon-bar"></span>
8
- </button>
9
- <div class="collapse navbar-collapse navHeaderCollapse">
10
- <ul class="nav navbar-nav col-xs-7">
11
- <li>
12
- <a href="/content/intro/10_course_toc.md/">TOC</a>
13
- </li>
14
- <li>
15
- <a href="/content/topics/nt/nt_outline.md/">Project Outline</a>
16
- </li>
17
- <li>
18
- <a href="/content/intro/15_nt_links.md/">NanoTwitter</a>
19
- </li>
20
- <li>
21
- <a href="/content/topics/syllabus/cosi105b_final_deliverables.md/">Deliverables</a>
22
- </li>
23
- </ul>
24
- <div class="navbar-control col-xs-3">
25
- <form role="form" class="form-inline" action="/content/tipuesearch/search.md/index.html">
26
- <div class="input-group input-group-sm">
27
- <input type="text" class="form-control" placeholder="search..." name="q" id="tipue_search_input" autocomplete="off" required>
28
- </div>
29
- </form>
30
- </div>
31
- <div class="btn-group btn-group-xs col-xs-2">
32
- <%if citem.section != "root" %>
33
- <%= link_to_prev toc, item %> <%= link_to_next toc, item %>
34
- <% end %>
35
- </div>
1
+ <nav class="navbar navbar-expand-lg bg-dark py-0">
2
+ <nav class="nav py-0">
3
+ <% MENULINKS.each do |label, link| %>
4
+ <a class="nav-link py-0 text-light" href="<%= link %>">
5
+ <%= label %>
6
+ </a>
7
+ <% end %>
8
+ </nav>
9
+ <div class="navbar-control py-0">
10
+ <form role="form" class="form-inline">
11
+ <div class="input-group input-group-sm">
12
+ <input type="search" class="form-control" placeholder="search..." id="tipue_search_input"
13
+ autocomplete="off" required />
14
+ </div>
15
+ </form>
36
16
  </div>
37
- </div>
17
+ </nav>
@@ -1,13 +1,14 @@
1
- <div class="col-xs-3">
2
- <% if (HELPFUL_BOX) %>
3
- <div class="row well right-nav" style="color: rgb(158, 48, 48);padding-top: 4px;padding-bottom: 4px;padding-left: 8px;padding-right: 8px;margin-bottom: 8px;">
4
- <%= render "/helpful_box.*" %>
5
- </div>
6
- <% end %>
7
- <div class="row well right-nav" style="padding: 5px;">
1
+ <div class="col-md-3 border rounded-lg sidebar">
2
+ <% if HELPFUL_BOX %>
3
+ <div class="row well"
4
+ style="color: rgb(158, 48, 48);padding: 4px 8px;margin-bottom: 8px;">
5
+ <%= render "/helpful_box.*" %>
6
+ </div>
7
+ <% end %>
8
+ <div class="row">
8
9
  <ul>
9
10
  <% SECTION_CONFIG.each do |sbb| %>
10
- <%= section_helper(title: sbb.title, selector: sbb.selector) unless sbb.options[:hidden] %>
11
+ <%= section_helper(title: sbb.title, selector: sbb.selector) unless sbb.options[:hidden] %>
11
12
  <% end %>
12
13
  </ul>
13
14
  </div>
@@ -0,0 +1,69 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title><%= COURSE_SHORT_NAME %></title>
6
+ <meta name="apple-mobile-web-app-capable" content="yes">
7
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
8
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
9
+ <link rel="stylesheet" href="https://unpkg.com/reveal.js@4.0.2/dist/reset.css">
10
+ <link rel="stylesheet" href="https://unpkg.com/reveal.js@4.0.2/dist/reveal.css">
11
+ <link rel="stylesheet" href="https://unpkg.com/reveal.js@4.0.2/dist/theme/white.css" id="theme">
12
+ <!--[if lt IE 9]>
13
+ <script src="https://unpkg.com/reveal.js@4.0.2/lib/js/html5shiv.js"></script>
14
+ <![endif]-->
15
+
16
+ <!-- Custom CSS -->
17
+ <link rel="stylesheet" href="/bootstrap/css/customslides.css">
18
+
19
+ <style>
20
+ .scrollable {
21
+ bottom: 0;
22
+ overflow-y: auto !important;
23
+ overflow-x: hidden !important;
24
+ }
25
+
26
+ <% SLIDES_CONFIG[:ignore_selectors].each do |s| %>
27
+ .slides <%= s %> {
28
+ display: none;
29
+ }
30
+ <% end %>
31
+ </style>
32
+ </head>
33
+
34
+ <body>
35
+ <div class="reveal">
36
+ <div class="slides">
37
+ <section data-markdown data-separator="^<slide_break></slide_break>" class="scrollable">
38
+ <textarea data-template>
39
+ <%= yield %>
40
+ </textarea>
41
+ </section>
42
+ </div>
43
+ </div>
44
+
45
+ <script src="https://unpkg.com/reveal.js@4.0.2/dist/reveal.js"></script>
46
+ <!-- Plugins -->
47
+ <script src="https://unpkg.com/reveal.js@4.0.2/plugin/markdown/markdown.js"></script>
48
+ <script src="https://unpkg.com/reveal.js@4.0.2/plugin/highlight/highlight.js"></script>
49
+
50
+ <script>
51
+ // Full list of configuration options available at:
52
+ // https://github.com/hakimel/reveal.js#configuration
53
+ Reveal.initialize({
54
+ minScale: 0.2,
55
+ maxScale: 1.4,
56
+
57
+ markdown: {
58
+ breaks: true
59
+ },
60
+
61
+ <% SLIDES_CONFIG[:revealjs_opts].each do |k, v| %>
62
+ <%= k %>: <%= v.to_json %>,
63
+ <% end %>
64
+
65
+ // Optional reveal.js plugins
66
+ plugins: [ RevealMarkdown, RevealHighlight ]
67
+ })
68
+ </script>
69
+ </body>