robin_cms 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +183 -0
  4. data/lib/jekyll/commands/serve.rb +35 -0
  5. data/lib/robin_cms/auth.rb +39 -0
  6. data/lib/robin_cms/cms.rb +200 -0
  7. data/lib/robin_cms/collection_item.rb +82 -0
  8. data/lib/robin_cms/configuration-schema.json +116 -0
  9. data/lib/robin_cms/configuration.rb +181 -0
  10. data/lib/robin_cms/data_item.rb +88 -0
  11. data/lib/robin_cms/flash.rb +24 -0
  12. data/lib/robin_cms/helpers.rb +60 -0
  13. data/lib/robin_cms/item.rb +34 -0
  14. data/lib/robin_cms/itemable.rb +124 -0
  15. data/lib/robin_cms/queryable.rb +47 -0
  16. data/lib/robin_cms/sluggable.rb +22 -0
  17. data/lib/robin_cms/static_item.rb +92 -0
  18. data/lib/robin_cms/version.rb +5 -0
  19. data/lib/robin_cms/views/change_password.erb +22 -0
  20. data/lib/robin_cms/views/delete_dialog.erb +25 -0
  21. data/lib/robin_cms/views/error.erb +1 -0
  22. data/lib/robin_cms/views/filter_form.erb +37 -0
  23. data/lib/robin_cms/views/flash.erb +6 -0
  24. data/lib/robin_cms/views/hidden_field.erb +6 -0
  25. data/lib/robin_cms/views/image_field.erb +20 -0
  26. data/lib/robin_cms/views/input_field.erb +9 -0
  27. data/lib/robin_cms/views/layout.erb +59 -0
  28. data/lib/robin_cms/views/library.erb +70 -0
  29. data/lib/robin_cms/views/library_actions.erb +4 -0
  30. data/lib/robin_cms/views/library_item.erb +44 -0
  31. data/lib/robin_cms/views/login.erb +17 -0
  32. data/lib/robin_cms/views/logo.erb +82 -0
  33. data/lib/robin_cms/views/nav.erb +11 -0
  34. data/lib/robin_cms/views/new_tab.erb +4 -0
  35. data/lib/robin_cms/views/profile.erb +12 -0
  36. data/lib/robin_cms/views/richtext_field.erb +10 -0
  37. data/lib/robin_cms/views/select_field.erb +23 -0
  38. data/lib/robin_cms/views/style.erb +441 -0
  39. data/lib/robin_cms.rb +45 -0
  40. metadata +139 -0
@@ -0,0 +1,25 @@
1
+ <dialog id="<%= safe_id(@item.id, 'dialog_delete') %>" class="card">
2
+ <h2>Delete <%= @item.attributes[:title] %>?</h2>
3
+ <p>
4
+ Are you sure you want to delete <%= @item.attributes[:title] %>? This is a
5
+ permanent action and it cannot be undone.
6
+ </p>
7
+ <div class="controls">
8
+ <form method="dialog">
9
+ <button type="submit">Close</button>
10
+ </form>
11
+ <form
12
+ action='<%= url("/libraries/#{@library[:id]}/item/delete?id=#{@item.id}") %>'
13
+ method="post"
14
+ >
15
+ <button type="submit" class="--danger">Delete</button>
16
+ </form>
17
+ </div>
18
+ </dialog>
19
+ <button
20
+ type="button"
21
+ class="--danger"
22
+ onclick="<%= safe_id(@item.id, 'dialog_delete') %>.showModal()"
23
+ >
24
+ Delete
25
+ </button>
@@ -0,0 +1 @@
1
+ <p><%= @error %></p>
@@ -0,0 +1,37 @@
1
+ <form id="filter-form" class="card --clear controls --align-right" action="" method="get">
2
+ <select id="sort" name="sort">
3
+ <% for option in SORT_OPTIONS %>
4
+ <option
5
+ value="<%= option[:value] %>"
6
+ <% if query_params["sort"] == option[:value] %>
7
+ selected
8
+ <% end %>
9
+ >
10
+ <%= option[:label] %>
11
+ </option>
12
+ <% end %>
13
+ </select>
14
+ <% if @config.drafts_enabled?(@library) %>
15
+ <select id="published" name="published">
16
+ <% for option in PUBLISHED_OPTIONS%>
17
+ <option
18
+ value="<%= option[:value] %>"
19
+ <% if query_params["published"] == option[:value] %>
20
+ selected
21
+ <% end %>
22
+ >
23
+ <%= option[:label] %>
24
+ </option>
25
+ <% end %>
26
+ </select>
27
+ <% end %>
28
+ <input
29
+ id="search"
30
+ name="q"
31
+ type="search"
32
+ value="<%= query_params['q'] %>"
33
+ placeholder="Search <%= @library[:label].downcase %>..."
34
+ />
35
+ <button type="submit">Apply</button>
36
+ <a href="/admin/libraries/<%= @library[:id] %>">Clear filters</a>
37
+ </form>
@@ -0,0 +1,6 @@
1
+ <% if flash[:error] %>
2
+ <small class="flash --danger"><%= flash[:error] %></small>
3
+ <% end %>
4
+ <% if flash[:success] %>
5
+ <small class="flash --success"><%= flash[:success] %></small>
6
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <input
2
+ id="<%= safe_id(field[:id], 'field') %>"
3
+ type="hidden"
4
+ name="<%= field[:id] %>"
5
+ value="<%= @item.attributes[field[:id].to_sym] || field[:default] %>"
6
+ />
@@ -0,0 +1,20 @@
1
+ <label for="<%= safe_id('image', 'field') %>"><%= field[:label] %></label>
2
+ <%#
3
+ There is a bug here where if you upload a different image with the
4
+ same name, it shows the old image due to caching. This is a very
5
+ low priority because a) the user should be naming things in a
6
+ reasonable way and b) you can always just do a hard refresh.
7
+ %>
8
+ <img
9
+ id="image-preview"
10
+ class="image-preview"
11
+ src="<%= url(@item.attributes[:image_src]) %>"
12
+ alt="<%= @item.attributes[:image_alt] %>"
13
+ />
14
+ <input
15
+ id="<%= safe_id('image', 'field') %>"
16
+ type="file"
17
+ name="image"
18
+ accept="image/png, image/jpeg"
19
+ <% if field[:required] %>required<% end %>
20
+ />
@@ -0,0 +1,9 @@
1
+ <label for="<%= safe_id(field[:id], 'field') %>"><%= field[:label] %></label>
2
+ <input
3
+ id="<%= safe_id(field[:id], 'field') %>"
4
+ type="<%= field[:type] %>"
5
+ name="<%= field[:id] %>"
6
+ value="<%= @item.attributes[field[:id].to_sym] || field[:default] %>"
7
+ <% if field[:required] %>required<% end %>
8
+ <% if field[:readonly] %>readonly<% end %>
9
+ />
@@ -0,0 +1,59 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6
+ <title><%= @config[:title] %> | admin</title>
7
+ <%= erb :style %>
8
+ </head>
9
+ <body <% if flash[:success_dialog] %>onload="successdialog.showModal()"<% end %>>
10
+ <% if session[:auth_user] %>
11
+ <header id="site-header">
12
+ <span class="controls">
13
+ <h1><a href="/admin"><%= @config[:title] %> admin</a></h1>
14
+ </span>
15
+ <span class="controls --gap-md">
16
+ <a href="<%= @config[:url] %>" target="_blank">
17
+ <%= @config[:url] %><%= erb :new_tab %>
18
+ </a>
19
+ <% if @config[:build_command] %>
20
+ <form id="publish-form" action="/admin/publish" method="post">
21
+ <button type="submit" form="publish-form">Publish site</button>
22
+ </form>
23
+ <% end %>
24
+ <a href='<%= url("/profile") %>'>Account</a>
25
+ <a href='<%= url("/logout") %>'>Log out</a>
26
+ </span>
27
+ </header>
28
+ <% end %>
29
+ <main id="site-content">
30
+ <%= yield %>
31
+ <footer id="site-footer" class="card --clear">
32
+ <%= erb :logo %>
33
+ <p>
34
+ Made with 🧡
35
+ <br />
36
+ <a href="https://git.sr.ht/~evencuriouser/robin-cms">Robin CMS</a> <%= RobinCMS::VERSION %>
37
+ </p>
38
+ </footer>
39
+ </main>
40
+ <dialog id="successdialog" class="card">
41
+ <h2>Success!</h2>
42
+ <p><%= flash[:success_dialog] %></p>
43
+ <div class="controls">
44
+ <form id="dialog-close" method="dialog">
45
+ <button type="submit" form="dialog-close">Continue</button>
46
+ </form>
47
+ </div>
48
+ </dialog>
49
+ </body>
50
+ <script>
51
+ const image = document.getElementById("__field_image")
52
+ if (image) {
53
+ image.onchange = function () {
54
+ const src = URL.createObjectURL(this.files[0]);
55
+ document.getElementById("image-preview").src = src
56
+ }
57
+ }
58
+ </script>
59
+ </html>
@@ -0,0 +1,70 @@
1
+ <header class="card --clear">
2
+ <%= erb :nav %>
3
+ </header>
4
+ <div class="card">
5
+ <% if @library[:description] %>
6
+ <p><%= @library[:description] %></p>
7
+ <% end %>
8
+ <% if @library[:can_create] %>
9
+ <form action='<%= url("/libraries/#{@library[:id]}/item") %>'>
10
+ <button type="submit">
11
+ New <%= @library[:label_singular].downcase %>
12
+ </button>
13
+ </form>
14
+ <% end %>
15
+ </div>
16
+ <%= erb :filter_form %>
17
+ <% if @items.empty? %>
18
+ <div class="no-items">
19
+ Nothing to show.
20
+ <br />
21
+ <br />
22
+ <% if @library[:can_create] %>
23
+ Create a <a href='<%= url("/libraries/#{@library[:id]}/item") %>'>new <%= @library[:label_singular].downcase %></a>
24
+ or try <a href='<%= url("/libraries/#{@library[:id]}") %>'>clearing</a> your search filters.
25
+ <% end %>
26
+ </div>
27
+ <% else %>
28
+ <table>
29
+ <thead>
30
+ <tr>
31
+ <th class="grow-column">Name</th>
32
+ <% if @config.drafts_enabled?(@library) %>
33
+ <th>Status</th>
34
+ <% end %>
35
+ <th>Created</th>
36
+ <th>Last updated</th>
37
+ </tr>
38
+ </thead>
39
+ <tbody>
40
+ <% for item in @items %>
41
+ <tr>
42
+ <td>
43
+ <a href='<%= url("/libraries/#{@library[:id]}/item?id=#{item.id}") %>'>
44
+ <%= item.display_name %>
45
+ </a>
46
+ </td>
47
+ <% if @config.drafts_enabled?(@library) %>
48
+ <td>
49
+ <a href='<%= url("/libraries/#{@library[:id]}/item?id=#{item.id}") %>'>
50
+ <span class="badge --<%= item.published? ? 'published' : 'draft' %>">
51
+ <%= item.published_label %>
52
+ </span>
53
+ </a>
54
+ </td>
55
+ <% end %>
56
+ <td>
57
+ <a href='<%= url("/libraries/#{@library[:id]}/item?id=#{item.id}") %>'>
58
+ <%= item.created_at.strftime("%b %d, %Y") %>
59
+ </a>
60
+ </td>
61
+ <td>
62
+ <a href='<%= url("/libraries/#{@library[:id]}/item?id=#{item.id}") %>'>
63
+ <%= item.updated_at.strftime("%b %d, %Y") %>
64
+ </a>
65
+ </td>
66
+ </tr>
67
+ <% end %>
68
+ </tbody>
69
+ </table>
70
+ <% end %>
@@ -0,0 +1,4 @@
1
+ <span class="controls">
2
+ <a href='<%= url("/libraries/#{@library[:id]}") %>'>Back</a>
3
+ <button type="submit">Save</button>
4
+ </span>
@@ -0,0 +1,44 @@
1
+ <header class="card">
2
+ <h2>
3
+ <% if @item.id %>Edit<% else %>New<% end %> <%= @library[:label_singular].downcase %>
4
+ </h2>
5
+ <%= erb :library_actions %>
6
+ </header>
7
+ <form
8
+ class="card"
9
+ <% if @item.id %>
10
+ action='<%= url("/libraries/#{@library[:id]}/item?id=#{@item.id}") %>'
11
+ <% else %>
12
+ action='<%= url("/libraries/#{@library[:id]}/item") %>'
13
+ <% end %>
14
+ method="post"
15
+ enctype="multipart/form-data"
16
+ >
17
+ <% for field in @sorted_fields %>
18
+ <div class="field">
19
+ <% case field[:type]
20
+ when "text", "date", "number", "color", "email", "url" %>
21
+ <%= erb :input_field, locals: { :field => field } %>
22
+ <% when "hidden" %>
23
+ <%= erb :hidden_field, locals: { :field => field } %>
24
+ <% when "select" %>
25
+ <%= erb :select_field, locals: { :field => field } %>
26
+ <% when "image" %>
27
+ <%= erb :image_field, locals: { :field => field } %>
28
+ <% when "richtext" %>
29
+ <%= erb :richtext_field, locals: { :field => field } %>
30
+ <% else %>
31
+ <div></div>
32
+ <% end %>
33
+ </div>
34
+ <% end %>
35
+ <%= erb :flash %>
36
+ <footer class="controls --align-space">
37
+ <% if @library[:can_delete] && @item.id %>
38
+ <%= erb :delete_dialog %>
39
+ <% else %>
40
+ <span></span>
41
+ <% end %>
42
+ <%= erb :library_actions %>
43
+ </footer>
44
+ </form>
@@ -0,0 +1,17 @@
1
+ <form id="login-form" name="login" method="post">
2
+ <fieldset>
3
+ <h1>Log in to <%= @config[:title] %> admin</h1>
4
+ <div class="field">
5
+ <label for="username">Username</label>
6
+ <input id="username" name="username" required />
7
+ </div>
8
+ <div class="field">
9
+ <label for="password">Password</label>
10
+ <input id="password" type="password" name="password" required />
11
+ </div>
12
+ <%= erb :flash %>
13
+ <footer>
14
+ <button type="submit">Log in</button>
15
+ </footer>
16
+ </fieldset>
17
+ </form>
@@ -0,0 +1,82 @@
1
+ <svg
2
+ viewBox="0 0 79.375 77.726425"
3
+ version="1.1"
4
+ id="robin-logo"
5
+ xml:space="preserve"
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ xmlns:svg="http://www.w3.org/2000/svg"
8
+ >
9
+ <defs id="defs1" />
10
+ <g id="g6-4" transform="matrix(0.61904331,0,0,0.61904331,-24.97431,-44.010203)">
11
+ <path
12
+ style="fill:#953e0b;fill-opacity:1;stroke:none;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"
13
+ d="m 102.24773,165.35552 c 0,0 9.3266,14.76615 9.78455,16.03983 0.45795,1.27369 -0.24369,1.79232 -0.50759,1.79232 -0.26389,0 -1.52854,0.40323 -1.52854,0.40323 0,0 -1.2259,1.08556 0.28103,1.48948 1.50692,0.40393 2.72185,0.36716 4.79451,5.4238 2.07266,5.05663 1.95136,-0.69812 1.54692,-1.19189 -0.40444,-0.49378 -0.44442,-1.82656 -0.44442,-1.82656 0,0 3.71489,4.90789 4.36668,6.07938 0.6518,1.17149 2.77107,3.0151 2.53756,0.18463 -0.23351,-2.83047 -3.29212,-6.94723 -3.78591,-7.0662 -0.49378,-0.11898 0.8551,-0.63098 1.52105,-0.69606 0.66594,-0.0651 2.81256,0.25243 3.29054,0.99251 0.47798,0.74008 2.01776,1.21754 2.07752,-0.20111 0.0598,-1.41865 -0.50663,-4.04448 -3.42072,-4.02653 -2.91409,0.0179 -3.55451,0.379 -3.99975,0.52445 -0.44523,0.14546 -1.48949,0.10215 -2.26597,-0.78805 -0.77647,-0.89019 -1.8125,-2.33154 -2.89737,-3.55633 -1.08487,-1.22479 -6.67198,-9.18363 -7.89937,-12.8823 -1.22739,-3.69866 -3.45072,-0.6946 -3.45072,-0.6946 z"
14
+ id="path5-5"
15
+ />
16
+ <path
17
+ style="fill:#953e0b;fill-opacity:1;stroke:none;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"
18
+ d="m 124.2895,168.97404 c 0,0 1.41827,2.85616 3.99034,3.44834 2.57207,0.59218 4.68636,1.20292 6.19452,2.37898 1.50816,1.17605 11.71746,6.79931 12.49746,8.34756 0.78,1.54826 0.063,2.55137 0.13647,2.81082 0.0734,0.25944 -0.0477,3.662 0.36486,4.29413 0.4126,0.63213 2.08871,1.38884 2.69329,0.0282 0.60457,-1.36059 0.49466,-3.38076 2.54945,-3.1016 2.05479,0.27916 3.80988,1.96247 4.18013,3.19456 0.37025,1.23209 1.30437,2.52408 1.62849,4.04456 0.32413,1.52048 2.21051,2.72991 2.14505,0.0752 -0.0655,-2.65474 -0.50874,-3.84168 -1.23288,-5.07583 -0.72414,-1.23416 -0.919,-2.54167 0.60073,-2.39031 1.51973,0.15135 2.14542,1.47778 2.67939,2.01399 0.53396,0.53621 2.1381,-0.0193 1.73478,-0.97408 -0.40332,-0.95482 -1.38532,-3.20076 -3.36298,-3.77753 -1.97767,-0.57677 -5.57479,-0.17682 -7.62376,-0.72601 -2.04897,-0.5492 -4.26923,-2.54531 -5.34826,-3.20346 -1.07903,-0.65815 -9.49254,-7.08434 -11.61428,-8.02069 -2.12174,-0.93636 -4.64209,-2.54317 -5.28019,-3.68624 -0.63809,-1.14307 -0.79128,-1.91872 -0.79128,-1.91872 z"
19
+ id="path6-0"
20
+ />
21
+ <path
22
+ style="fill:#42240f;fill-opacity:1;stroke:none;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"
23
+ d="m 87.929952,140.67474 c 0,0 -12.546266,10.3513 -24.221905,17.20711 -11.675636,6.85581 -9.888262,5.80574 -18.385094,13.00959 -9.851549,8.3524 1.049359,6.27971 3.159754,5.72937 0.963861,-0.25135 2.266466,-0.14887 2.566276,-0.0383 1.724284,0.63594 1.464268,1.88819 4.091733,0.86224 2.627466,-1.02596 19.987332,-10.4786 22.275607,-12.61343 2.288275,-2.13483 4.362564,-4.4542 4.362564,-4.4542 z"
24
+ id="path4-0"
25
+ />
26
+ <path
27
+ style="display:inline;fill:#f4e6e6;fill-opacity:1;stroke:none;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"
28
+ d="m 119.18693,77.444946 c 0,0 7.41777,-5.335313 12.56437,-5.680075 5.1466,-0.344763 14.14552,0.971285 18.07302,3.22154 3.92749,2.250255 6.30287,4.500142 7.92767,8.50959 1.6248,4.009451 0.15323,4.165319 3.13713,8.519639 2.98389,4.354319 6.4348,8.46631 7.17189,14.19937 0.7371,5.73307 -0.17458,18.02948 -3.13095,32.40657 -2.95637,14.37709 -18.7598,23.08559 -22.41084,24.50483 -3.65105,1.41923 -14.29313,5.08893 -17.32805,5.80831 -3.03491,0.71939 -6.05091,0.6702 -8.15204,-1.86997 -2.10114,-2.54017 -2.59621,-2.20375 -4.60887,-1.9907 -2.01265,0.21306 -3.24194,-0.13855 -7.68137,0.45455 -4.43943,0.5931 -6.859625,-1.01565 -7.836662,-3.0573 -0.977038,-2.04166 -2.582283,-4.98824 -2.925982,-6.37597 -0.343699,-1.38773 -3.443452,8.17425 -3.641969,8.81242 -0.198517,0.63817 -2.496919,11.33275 -7.396093,10.89645 -2.255412,-0.20086 -2.307776,-1.9432 -2.263421,-3.28647 0.04435,-1.34327 0.203549,-10.28832 2.235647,-16.61101 2.032098,-6.3227 3.501882,-12.70159 8.231264,-22.63827 4.729385,-9.93668 19.833096,-26.04807 21.627276,-27.7269 1.79419,-1.67882 5.16574,-6.06388 5.53445,-8.317961 0.36871,-2.25408 0.52811,-5.915832 0.0852,-7.382785 -0.44286,-1.466953 -0.9256,-3.082197 -3.33609,-3.779401 -2.41048,-0.697206 -7.23545,-1.304946 -9.11955,-1.669743 -1.88411,-0.364794 -4.98788,-1.542988 -1.8166,-2.875142 1.98356,-0.833228 4.25122,-1.270516 7.69857,-1.632876 3.44734,-0.362362 5.91199,-1.564132 7.36196,-2.438696 z"
29
+ id="path1-83"
30
+ />
31
+ <path
32
+ style="display:inline;fill:#794316;fill-opacity:1;stroke:none;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"
33
+ d="m 116.98699,166.68463 c -2.10114,-2.54017 -2.59621,-2.20375 -4.60887,-1.9907 -2.01265,0.21306 -3.24194,-0.13855 -7.68137,0.45455 -4.43943,0.5931 -6.859625,-1.01565 -7.836662,-3.0573 -0.977038,-2.04166 -2.582283,-4.98824 -2.925982,-6.37597 -0.343699,-1.38773 -3.443452,8.17425 -3.641969,8.81242 -0.198517,0.63817 -2.496919,11.33275 -7.396093,10.89645 -2.255412,-0.20086 -2.307776,-1.9432 -2.263421,-3.28647 0.04435,-1.34327 0.203549,-10.28832 2.235647,-16.61101 2.032098,-6.3227 3.501882,-12.70159 8.231264,-22.63827 0,0 13.726686,-20.92063 23.594566,-28.85775 9.86787,-7.937117 -6.80934,13.78823 -5.68644,14.12229 1.1229,0.33406 5.68429,-4.97683 5.95042,-3.77434 0.26613,1.20248 -5.77701,10.62315 -6.11442,11.59464 -0.33742,0.97149 -0.46414,1.43204 1.51917,0.27758 1.98331,-1.15446 2.46579,-1.79258 2.41541,-0.78152 -0.0504,1.01107 -3.70596,8.62346 -5.49499,10.74053 -1.78903,2.11706 -2.43896,4.42729 -0.29692,3.44303 2.14205,-0.98427 6.62062,-5.53695 6.51335,-2.74698 -0.10726,2.78997 -0.39892,3.21415 0.66154,3.30286 1.06046,0.0887 1.94231,-0.33391 1.34406,0.92567 -0.59824,1.25958 -4.55217,7.52905 -5.07467,8.90986 -0.52251,1.38081 -1.46678,3.21165 -0.29637,2.70729 1.17042,-0.50436 2.66596,-1.94098 4.37419,-1.71656 1.70824,0.22442 3.31195,-1.1782 3.41498,1.31959 0.10302,2.49779 -2.42509,3.82249 -0.01,3.29263 2.41555,-0.52986 4.33052,-5.25181 5.03164,-2.72726 0.70111,2.52454 0.23135,10.46755 -0.9548,12.41095 -1.18616,1.9434 -5.00372,1.35379 -5.00372,1.35379 z"
34
+ id="path1-8-2"
35
+ />
36
+ <path
37
+ style="fill:#fd8a13;fill-opacity:1;stroke:none;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"
38
+ d="m 112.25793,79.971809 c 0,0 7.3453,-2.315612 9.96449,-4.35402 2.61919,-2.038408 10.8931,3.918979 16.25562,8.924734 5.36253,5.005758 5.89542,5.60728 11.14067,6.972271 5.24525,1.364991 10.04625,6.619298 12.76051,12.929296 2.71426,6.30999 6.33923,9.4729 5.51939,16.07749 -0.81984,6.60459 -4.58519,21.80555 -4.58519,21.80555 0,0 -0.26992,-4.87525 -2.61595,-9.44666 -2.34604,-4.5714 -3.6849,0.43828 -4.69201,-0.78671 -2.85207,-3.46911 3.01707,-9.16895 0.38376,-13.46751 -2.63331,-4.29856 0.79678,-8.991 -3.03611,3.75017 -3.8329,12.74117 -5.60436,16.6854 -8.14654,18.36415 -2.54218,1.67875 -2.40926,-5.71984 -2.40926,-5.71984 0,0 -1.49833,-3.15898 -2.7906,-1.16223 -1.29228,1.99676 -10.49008,10.49457 -11.49638,10.39768 -1.0063,-0.0969 -0.76812,-2.79042 -0.88632,-4.18043 -0.11819,-1.39001 -0.40247,-1.89006 -1.45296,-1.39793 -1.05049,0.49212 -1.54262,1.29727 -2.40245,3.05512 -0.85982,1.75786 -1.61142,1.25171 -1.96246,-0.39088 -0.35105,-1.6426 -0.97925,-3.40962 -0.31107,-6.86419 0.66818,-3.45458 0.90795,-13.13004 0.29992,-20.56995 -0.60804,-7.43991 -0.0645,-12.81285 -1.02836,-15.223947 -0.96388,-2.411092 -2.16327,-3.857136 -2.16327,-3.857136 0,0 0.96119,-6.198883 -3.31101,-8.864689 -4.2722,-2.665807 -3.03442,-5.990339 -3.03442,-5.990339 z"
39
+ id="path2-3"
40
+ />
41
+ <path
42
+ style="fill:#d11b05;fill-opacity:1;stroke:none;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"
43
+ d="m 140.2112,133.96769 c -1.29228,1.99676 -10.49008,10.49457 -11.49638,10.39768 -1.0063,-0.0969 -0.76812,-2.79042 -0.88632,-4.18043 -0.11819,-1.39001 -0.40247,-1.89006 -1.45296,-1.39793 -1.05049,0.49212 -1.54262,1.29727 -2.40245,3.05512 -0.85982,1.75786 -1.61142,1.25171 -1.96246,-0.39088 -0.35105,-1.6426 -0.97925,-3.40962 -0.31107,-6.86419 0.66818,-3.45458 0.90795,-13.13004 0.29992,-20.56995 -0.60804,-7.43991 -0.0645,-12.81285 -1.02836,-15.223944 0,0 3.42152,3.794294 5.28983,8.802854 1.86831,5.00856 1.28608,7.37661 2.7356,5.12 1.44952,-2.25661 1.00716,-7.19525 2.4291,-5.31444 1.42195,1.88081 2.30945,3.49089 2.61588,8.76075 0.30644,5.26986 -0.79372,8.72143 1.75912,7.088 2.55284,-1.63343 5.12856,-1.00076 5.06289,1.95883 -0.0657,2.95958 -0.65234,8.75853 -0.65234,8.75853 z"
44
+ id="path2-5-2"
45
+ />
46
+ <path
47
+ style="fill:#120800;fill-opacity:1;stroke:none;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"
48
+ d="m 134.14235,78.859951 c 0,0 -1.27848,0.278357 -1.439,2.645801 -0.16053,2.367441 1.69397,2.649159 2.12633,2.771058 0.43235,0.121899 2.41989,0.731705 3.11981,-0.04841 0.69992,-0.780116 1.42395,-2.235028 0.93639,-3.380856 -0.48756,-1.145826 -1.07651,-1.837825 -1.99579,-2.213846 -0.91927,-0.376023 -2.74774,0.226254 -2.74774,0.226253 z"
49
+ id="path3-6"
50
+ />
51
+ <path
52
+ style="fill:#50475f;fill-opacity:1;stroke:none;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"
53
+ d="m 119.07767,77.467727 h 4e-5 m -4.3079,8.546336 c -2.41048,-0.697206 -7.05197,-1.234825 -8.93607,-1.599622 -1.88411,-0.364794 -4.98788,-1.542988 -1.8166,-2.875142 1.98356,-0.833228 4.25122,-1.270516 7.69857,-1.632876 0,0 11.44463,2.260634 14.08539,3.871962 4.51194,2.753075 -7.81747,2.380648 -11.03129,2.235678 z"
54
+ id="path1-7-5"
55
+ />
56
+ <path
57
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"
58
+ d="m 102.41494,165.52715 c 0,0 8.97811,14.21515 9.43606,15.48883 0.45795,1.27369 -0.24369,1.79232 -0.50759,1.79232 -0.26389,0 -1.52854,0.40323 -1.52854,0.40323 0,0 -1.2259,1.08556 0.28103,1.48948 1.50692,0.40393 2.72185,0.36716 4.79451,5.4238 2.07266,5.05663 1.69074,-0.57004 1.54692,-1.19189 -0.15613,-0.67509 -0.89008,-2.26705 -0.44442,-1.82656 1.70944,1.68959 3.71489,4.90789 4.36668,6.07938 0.6518,1.17149 2.77107,3.0151 2.53756,0.18463 -0.23351,-2.83047 -3.29212,-6.94723 -3.78591,-7.0662 -0.49378,-0.11898 0.8551,-0.63098 1.52105,-0.69606 0.66594,-0.0651 2.81256,0.25243 3.29054,0.99251 0.47798,0.74008 2.01776,1.21754 2.07752,-0.20111 0.0598,-1.41865 -0.50663,-4.04448 -3.42072,-4.02653 -2.91409,0.0179 -3.55451,0.379 -3.99975,0.52445 -0.44523,0.14546 -1.48949,0.10215 -2.26597,-0.78805 -0.77647,-0.89019 -1.8125,-2.33154 -2.89737,-3.55633 -1.08487,-1.22479 -6.67198,-9.18363 -7.89937,-12.8823"
59
+ id="path5-5-0"
60
+ />
61
+ <path
62
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"
63
+ d="m 124.18016,169.08036 c 0,0 1.41827,2.85616 3.99034,3.44834 2.57207,0.59218 4.68636,1.20292 6.19452,2.37898 1.50816,1.17605 11.71746,6.79931 12.49746,8.34756 0.78,1.54826 0.063,2.55137 0.13647,2.81082 0.0734,0.25944 -0.0477,3.662 0.36486,4.29413 0.4126,0.63213 2.08871,1.38884 2.69329,0.0282 0.60457,-1.36059 0.49466,-3.38076 2.54945,-3.1016 2.05479,0.27916 3.80988,1.96247 4.18013,3.19456 0.37025,1.23209 1.30437,2.52408 1.62849,4.04456 0.32413,1.52048 2.21051,2.72991 2.14505,0.0752 -0.0655,-2.65474 -0.50874,-3.84168 -1.23288,-5.07583 -0.72414,-1.23416 -0.919,-2.54167 0.60073,-2.39031 1.51973,0.15135 2.14542,1.47778 2.67939,2.01399 0.53396,0.53621 2.1381,-0.0193 1.73478,-0.97408 -0.40332,-0.95482 -1.38532,-3.20076 -3.36298,-3.77753 -1.97767,-0.57677 -5.57479,-0.17682 -7.62376,-0.72601 -2.04897,-0.5492 -4.26923,-2.54531 -5.34826,-3.20346 -1.07903,-0.65815 -9.49254,-7.08434 -11.61428,-8.02069 -2.12174,-0.93636 -4.64209,-2.54317 -5.28019,-3.68624 -0.63809,-1.14307 -0.79128,-1.91872 -0.79128,-1.91872"
64
+ id="path6-0-6"
65
+ />
66
+ <path
67
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"
68
+ d="m 119.35254,77.359644 h 4e-5 m -7.46653,2.359392 c 0,0 11.54916,2.339938 14.18992,3.951266 4.51194,2.753075 -8.09435,2.416945 -11.30817,2.271975"
69
+ id="path1-7-5-3"
70
+ />
71
+ <path
72
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"
73
+ d="m 87.614178,140.59412 c 0,0 -12.65503,10.45228 -24.330669,17.30809 -11.675636,6.85581 -9.888262,5.80574 -18.385094,13.00959 -9.851549,8.3524 1.049359,6.27971 3.159754,5.72937 0.963861,-0.25135 2.266466,-0.14887 2.566276,-0.0383 1.724284,0.63594 1.464268,1.88819 4.091733,0.86224 2.627466,-1.02596 19.987332,-10.4786 22.275607,-12.61343 2.288275,-2.13483 4.64053,-4.6554 4.64053,-4.6554"
74
+ id="path4-0-4"
75
+ />
76
+ <path
77
+ style="display:inline;fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-dasharray:none;stroke-opacity:1"
78
+ d="m 118.94522,77.331232 c 0,0 7.41777,-5.335313 12.56437,-5.680075 5.1466,-0.344763 14.14552,0.971285 18.07302,3.22154 3.92749,2.250255 6.30287,4.500142 7.92767,8.50959 1.6248,4.009449 0.15323,4.165319 3.13713,8.519639 2.98389,4.35432 6.4348,8.466314 7.17189,14.199374 0.7371,5.73307 -0.17458,18.02948 -3.13096,32.40657 -2.95636,14.37709 -18.7598,23.08559 -22.41083,24.50483 -3.65105,1.41923 -14.29313,5.08893 -17.32805,5.80831 -3.03491,0.71939 -6.05091,0.6702 -8.15204,-1.86997 -2.10114,-2.54017 -2.59621,-2.20375 -4.60887,-1.9907 -2.01265,0.21306 -3.24194,-0.13855 -7.68137,0.45455 -4.43943,0.5931 -6.85963,-1.01565 -7.836667,-3.0573 -0.977038,-2.04166 -2.582283,-4.98824 -2.925982,-6.37597 -0.343699,-1.38773 -3.443452,8.17425 -3.641969,8.81242 -0.198517,0.63817 -2.496919,11.33275 -7.396093,10.89645 -2.255412,-0.20086 -2.307776,-1.9432 -2.263421,-3.28647 0.04435,-1.34327 0.203549,-10.28832 2.235647,-16.61101 2.032098,-6.3227 3.501882,-12.70159 8.231264,-22.63827 4.729385,-9.93668 19.833101,-26.04807 21.627281,-27.7269 1.79419,-1.67882 5.16574,-6.063884 5.53445,-8.317964 0.36871,-2.25408 0.52811,-5.91583 0.0852,-7.38279 -0.44286,-1.46695 -0.9256,-3.08219 -3.33609,-3.7794 -2.41048,-0.697203 -7.23545,-1.304943 -9.11955,-1.66974 -1.88411,-0.364794 -4.98788,-1.542988 -1.8166,-2.875142 1.98356,-0.833228 4.25122,-1.270516 7.69857,-1.632876 3.44734,-0.362362 5.91199,-1.564132 7.36196,-2.438696 z"
79
+ id="path1-83-0"
80
+ />
81
+ </g>
82
+ </svg>
@@ -0,0 +1,11 @@
1
+ <nav id="site-nav">
2
+ <ul class="controls">
3
+ <% for library in @config[:libraries] %>
4
+ <li <% if current_page == library[:id].to_s %>class="current"<% end %>>
5
+ <a href='<%= url("/libraries/#{library[:id]}") %>'>
6
+ <%= library[:label] %>
7
+ </a>
8
+ </li>
9
+ <% end %>
10
+ </ul>
11
+ </nav>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <svg fill="#000000" width="12px" height="12px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
3
+ <path fill-rule="evenodd" d="M5,2 L7,2 C7.55228475,2 8,2.44771525 8,3 C8,3.51283584 7.61395981,3.93550716 7.11662113,3.99327227 L7,4 L5,4 C4.48716416,4 4.06449284,4.38604019 4.00672773,4.88337887 L4,5 L4,19 C4,19.5128358 4.38604019,19.9355072 4.88337887,19.9932723 L5,20 L19,20 C19.5128358,20 19.9355072,19.6139598 19.9932723,19.1166211 L20,19 L20,17 C20,16.4477153 20.4477153,16 21,16 C21.5128358,16 21.9355072,16.3860402 21.9932723,16.8833789 L22,17 L22,19 C22,20.5976809 20.75108,21.9036609 19.1762728,21.9949073 L19,22 L5,22 C3.40231912,22 2.09633912,20.75108 2.00509269,19.1762728 L2,19 L2,5 C2,3.40231912 3.24891996,2.09633912 4.82372721,2.00509269 L5,2 L7,2 L5,2 Z M21,2 L21.081,2.003 L21.2007258,2.02024007 L21.2007258,2.02024007 L21.3121425,2.04973809 L21.3121425,2.04973809 L21.4232215,2.09367336 L21.5207088,2.14599545 L21.5207088,2.14599545 L21.6167501,2.21278596 L21.7071068,2.29289322 L21.7071068,2.29289322 L21.8036654,2.40469339 L21.8036654,2.40469339 L21.8753288,2.5159379 L21.9063462,2.57690085 L21.9063462,2.57690085 L21.9401141,2.65834962 L21.9401141,2.65834962 L21.9641549,2.73400703 L21.9641549,2.73400703 L21.9930928,2.8819045 L21.9930928,2.8819045 L22,3 L22,3 L22,9 C22,9.55228475 21.5522847,10 21,10 C20.4477153,10 20,9.55228475 20,9 L20,5.414 L13.7071068,11.7071068 C13.3466228,12.0675907 12.7793918,12.0953203 12.3871006,11.7902954 L12.2928932,11.7071068 C11.9324093,11.3466228 11.9046797,10.7793918 12.2097046,10.3871006 L12.2928932,10.2928932 L18.584,4 L15,4 C14.4477153,4 14,3.55228475 14,3 C14,2.44771525 14.4477153,2 15,2 L21,2 Z"/>
4
+ </svg>
@@ -0,0 +1,12 @@
1
+ <header class="card">
2
+ <h2>Account details</h2>
3
+ </header>
4
+ <section class="card">
5
+ <p>You are currently logged in as <b><%= @username %></b>.</p>
6
+ <div class="controls --align-right">
7
+ <a href="/admin">Back</a>
8
+ <form action="<%= url('/change-password') %>">
9
+ <button type="submit">Change password</button>
10
+ </form>
11
+ </div>
12
+ </section>
@@ -0,0 +1,10 @@
1
+ <link rel="stylesheet" type="text/css" href="https://unpkg.com/trix@2.0.8/dist/trix.css">
2
+ <script type="text/javascript" src="https://unpkg.com/trix@2.0.8/dist/trix.umd.min.js"></script>
3
+ <label for="<%= safe_id(field[:id], 'field') %>"><%= field[:label] %></label>
4
+ <input
5
+ id="richtext-content"
6
+ type="hidden"
7
+ name="<%= field[:id] %>"
8
+ value="<%= @item.attributes[field[:id].to_sym] || field[:default] %>"
9
+ >
10
+ <trix-editor input="richtext-content"></trix-editor>
@@ -0,0 +1,23 @@
1
+ <label for="<%= safe_id(field[:id], 'field') %>"><%= field[:label] %></label>
2
+ <select
3
+ id="<%= safe_id(field[:id], 'field') %>"
4
+ name="<%= field[:id] %>"
5
+ value="<%= @item.attributes[field[:id].to_sym] || field[:default] %>"
6
+ >
7
+ <% for option in field[:options] %>
8
+ <option
9
+ value="<%= option[:value] %>"
10
+ <% if field[:id] == "published" %>
11
+ <% if option[:value] == true && @item.published? %>
12
+ selected
13
+ <% end %>
14
+ <% else %>
15
+ <% if option[:value].to_s == (@item.attributes[field[:id].to_sym] || field[:default]).to_s %>
16
+ selected
17
+ <% end %>
18
+ <% end %>
19
+ >
20
+ <%= option[:label] %>
21
+ </option>
22
+ <% end %>
23
+ </select>