]> gitweb.mndrdr.org Git - arelpe.git/commitdiff
stylesheet tweaks; generators with templates
authorAidan Cornelius-Bell <[email protected]>
Sat, 14 Sep 2024 22:18:23 +0000 (07:48 +0930)
committerAidan Cornelius-Bell <[email protected]>
Sun, 15 Sep 2024 00:28:47 +0000 (09:58 +0930)
34 files changed:
.DS_Store
Gemfile
Gemfile.lock
app/.DS_Store
app/assets/.DS_Store [copied from app/views/.DS_Store with 97% similarity]
app/assets/images/.DS_Store [copied from app/controllers/concerns/.DS_Store with 100% similarity]
app/assets/images/logo-192.png
app/assets/images/porter.svg [new file with mode: 0644]
app/assets/stylesheets/application.css
app/controllers/api_keys_controller.rb
app/controllers/concerns/admin_authenticatable.rb
app/controllers/posts_controller.rb
app/models/concerns/url_title_fetchable.rb [new file with mode: 0644]
app/models/post.rb
app/views/posts/importer.html.erb [new file with mode: 0644]
app/views/posts/index.html.erb
app/views/posts/show.html.erb
app/views/pubview/index.html.erb
app/views/pubview/post.html.erb
config/application.rb
config/routes.rb
lib/templates/erb/scaffold/_edit.html.erb.tt [new file with mode: 0644]
lib/templates/erb/scaffold/_form.html.erb.tt [new file with mode: 0644]
lib/templates/erb/scaffold/_index.html.erb.tt [new file with mode: 0644]
lib/templates/erb/scaffold/_new.html.erb.tt [new file with mode: 0644]
lib/templates/erb/scaffold/_show.html.erb.tt [new file with mode: 0644]
public/apple-touch-icon.png
public/favicon.ico
public/icon-192-maskable.png
public/icon-192.png
public/icon-512-maskable.png
public/icon-512.png
public/icon.png
public/logo-192.png

index 285cf43acff88b8c7a8338bc42d97942f0a199bb..92ecf43fe5720d707c85feca2ddac237312cf676 100644 (file)
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/Gemfile b/Gemfile
index 51d9fad39547b3b508801422a93ea19d915c03e1..895f6f5f357d6af7ede3d6f598b904aae48d1453 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -16,6 +16,8 @@ gem "kaminari"
 gem "redcarpet"
 #syntax
 gem "rouge"
+#html crawling
+gem "httparty"
 # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
 # gem "kredis"
 
index a2e4ba8bd06bbbb8a0481c0ed04326706dcb258f..bc777133129a3fbc14f60c3dab7b01710a1e6052 100644 (file)
@@ -95,6 +95,7 @@ GEM
     concurrent-ruby (1.3.4)
     connection_pool (2.4.1)
     crass (1.0.6)
+    csv (3.3.0)
     date (3.3.4)
     debug (1.9.2)
       irb (~> 1.10)
@@ -109,6 +110,10 @@ GEM
     erubi (1.13.0)
     globalid (1.2.1)
       activesupport (>= 6.1)
+    httparty (0.22.0)
+      csv
+      mini_mime (>= 1.0.0)
+      multi_xml (>= 0.5.2)
     i18n (1.14.5)
       concurrent-ruby (~> 1.0)
     io-console (0.7.2)
@@ -143,6 +148,8 @@ GEM
     mini_mime (1.1.5)
     minitest (5.25.1)
     msgpack (1.7.2)
+    multi_xml (0.7.1)
+      bigdecimal (~> 3.1)
     mysql2 (0.5.6)
     net-imap (0.4.16)
       date
@@ -308,6 +315,7 @@ DEPENDENCIES
   capybara
   debug
   devise
+  httparty
   kaminari
   mysql2 (~> 0.5)
   puma (>= 5.0)
index 3ced85bb24c192da38038eb45d71c80317977d29..3031a206d50c35c24d17bc3f6d647c4cb87390e5 100644 (file)
Binary files a/app/.DS_Store and b/app/.DS_Store differ
similarity index 97%
copy from app/views/.DS_Store
copy to app/assets/.DS_Store
index 21c52c5c7010b3404f459a2a3cdc3a86d6e5d196..893ce86f37176531c698d5acc0dd0e12bc2c753c 100644 (file)
Binary files a/app/views/.DS_Store and b/app/assets/.DS_Store differ
index d6baf797f821670c3921b60608ec51c5d3251563..a28fdb9c9a2d3c3d7f11344acdc9a8abb54e052b 100644 (file)
Binary files a/app/assets/images/logo-192.png and b/app/assets/images/logo-192.png differ
diff --git a/app/assets/images/porter.svg b/app/assets/images/porter.svg
new file mode 100644 (file)
index 0000000..57e7c32
--- /dev/null
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="100%" height="100%" viewBox="0 0 948 1883" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
+    <g transform="matrix(1,0,0,1,-1045.98,-404.552)">
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M857.217,1406.59C687.022,1406.59 549.051,1399.96 549.051,1391.79C549.051,1383.61 687.022,1376.99 857.217,1376.99C1027.41,1376.99 1165.38,1383.61 1165.38,1391.79C1165.38,1399.96 1027.41,1406.59 857.217,1406.59Z" style="fill:rgb(242,242,242);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M983.943,1395.97C963.75,1397.35 943.476,1397.45 923.27,1396.27C913.356,1395.69 903.022,1395.39 893.241,1393.53C890.033,1392.91 887.365,1391.86 884.048,1391.95C879.94,1392.05 875.805,1392.02 872.715,1388.7C871.715,1387.62 870.953,1386.33 870.634,1384.86C870.388,1383.72 870.404,1382.54 870.421,1381.38C870.49,1376.69 870.489,1371.99 870.628,1367.3C870.704,1364.73 870.673,1361.62 872.352,1359.52C876.071,1354.87 886.959,1357.39 891.997,1357.47C893.478,1357.49 895.041,1357.53 896.302,1358.35C897.685,1359.24 898.43,1360.87 899.438,1362.2C902.097,1365.71 905.839,1366.54 909.845,1367.05C922.107,1368.6 934.116,1371.19 946.322,1373.25C952.571,1374.31 958.684,1376.07 964.958,1377.25C969.849,1378.17 974.894,1379.15 979.037,1382.02C983.18,1384.9 986.216,1390.19 985.055,1395.24L983.943,1395.97Z" style="fill:rgb(6,31,51);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M707.612,1382.97C708.9,1379.45 710.188,1375.93 711.476,1372.41C712.12,1370.65 712.763,1368.88 713.408,1367.12C713.947,1365.65 714.606,1364.51 715.82,1363.5C718.369,1361.37 721.352,1361.44 724.43,1361.64C728.254,1361.89 732.079,1362.14 735.903,1362.39C737.604,1362.5 739.385,1362.63 740.826,1363.59C742.657,1364.8 743.551,1367.05 744.335,1369.16C746.063,1373.81 747.79,1378.46 749.518,1383.11C750.479,1385.7 751.44,1388.62 750.368,1391.16C748.734,1395.03 743.725,1395.44 739.685,1395.25C730.939,1394.84 722.192,1394.44 713.446,1394.03C711.401,1393.94 709.147,1393.75 707.711,1392.22C705.518,1389.89 706.495,1386.02 707.612,1382.97Z" style="fill:rgb(6,31,51);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M784.943,291.303C774.846,287.84 764.464,285.07 754.491,280.864C736.34,273.21 735.067,287.183 735.016,307.587C734.955,332.268 734.892,356.949 734.83,381.632C734.774,404.43 753.775,410.235 767.881,411.464C775.636,412.139 783.561,411.58 790.548,407.605C797.533,403.63 803.493,395.812 805.188,385.666C806.461,378.053 805.29,369.915 804.12,362.06C801.456,344.181 798.793,326.301 796.13,308.422C795.42,303.655 794.536,298.475 791.767,295.253C789.851,293.023 787.345,292.127 784.943,291.303Z" style="fill:rgb(255,145,123);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M889.12,533.893C888.123,496.186 881.474,458.935 866.266,423.181C861.331,411.58 855.494,400.182 847.115,390.762C843.47,386.664 808.169,365.614 804.996,376.719C799.721,395.183 765.595,397.355 748.723,386.39C743.748,383.158 737.84,374.186 731.138,374.081C713.777,373.809 685.254,375.123 668.712,380.4C662.706,382.316 657.218,384.29 652.312,388.229C646.711,392.727 641.268,397.507 636.828,403.187C630.91,410.76 626.842,420.225 627.612,429.805C628.209,437.257 631.628,444.15 634.984,450.831C644.882,470.527 653.776,491.427 665.233,510.217C670.219,518.395 672.168,529.81 674.629,539.057C677.401,549.475 679.758,560.006 681.612,570.627C683.697,582.58 685.151,594.654 685.759,606.776C687.409,639.645 690.291,671.876 684.621,704.777C682.672,716.086 680.79,729.758 689.53,737.194C694.608,741.515 701.762,742.152 708.415,742.593C752.097,745.496 795.779,748.398 839.461,751.3C848.531,751.902 858.922,752.011 865.101,745.345C869.529,740.568 870.453,733.615 871.168,727.141C871.168,695.203 878.401,661.617 881.909,629.844C885.437,597.883 889.972,566.123 889.12,533.893Z" style="fill:rgb(137,192,255);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M895.217,1356.21C894.554,1347.9 893.645,1339.63 893.425,1331.32C893.212,1323.26 892.998,1315.21 892.784,1307.16C892.358,1291.06 891.931,1274.96 891.504,1258.86C891.078,1242.76 890.651,1226.65 890.225,1210.55C889.798,1194.45 889.371,1178.35 888.944,1162.25C888.017,1127.27 887.09,1092.28 886.163,1057.3C884.309,987.339 882.454,917.376 880.6,847.413C880.144,830.171 879.065,812.554 880.153,795.434C880.497,790.011 879.218,784.089 878.745,778.675C878.242,772.918 877.759,767.158 877.32,761.395C876.442,749.878 875.731,738.344 875.351,726.799C874.595,703.793 875.16,680.688 878.342,657.866C879.439,649.998 880.793,642.123 880.977,634.164C881.065,630.383 880.9,626.584 880.266,622.851C879.714,619.589 878.092,616.346 877.965,613.08C877.339,596.917 878.049,580.675 876.962,564.442C875.939,549.177 874.611,533.613 872.96,518.504C871.384,504.085 866.192,490.415 867.269,475.606C868.565,457.79 868.335,439.868 868.112,421.828C867.982,411.291 866.714,403.321 860.567,394.526C858.762,391.944 856.991,388.609 854.462,386.671C852.326,385.034 850.969,382.682 848.823,381.018C846.94,379.558 844.702,378.646 842.495,377.752C838.921,376.304 835.223,374.823 831.332,374.589C828.156,374.397 824.225,374.692 821.462,376.384C822.052,376.022 825.969,382.825 826.305,383.504C827.641,386.212 828.592,389.108 829.131,392.079C829.658,394.98 829.792,397.954 829.503,400.889C829.163,404.338 828.075,406.915 826.347,409.902C822.609,416.363 819.156,423.132 815.078,429.383C812.025,434.062 806.869,436.654 801.614,438.628C789.224,443.283 779.496,440.643 768.299,435.044C758.945,427.969 753.749,416.846 748.672,406.274C739.256,386.67 722.596,364.926 697.792,370.616C694.711,371.323 691.524,372.605 689.783,375.244C687.461,378.764 688.436,383.464 689.91,387.415C692.532,394.443 697.387,400.099 700.249,406.922C703.258,414.095 707.498,419.817 711.861,426.273C726.433,447.837 728.308,475.84 723.862,501.482C719.415,527.125 709.279,551.369 701.408,576.176C691.236,608.235 684.832,641.365 680.419,674.672C678.204,691.391 676.486,708.171 675.024,724.971C673.622,741.094 670.458,756.965 669.273,773.143C667.272,800.448 668.795,828.015 673.835,854.926C676.007,866.52 675.041,878.999 675.952,890.904C677.041,905.135 678.367,919.346 679.699,933.555C681.051,947.975 682.404,962.396 683.757,976.816C688.281,1025.06 692.948,1072.54 695.823,1121.01C698.219,1161.42 700.614,1201.82 703.358,1242.19C705.933,1280.1 715.104,1317.02 717.718,1354.92C717.931,1358 718.094,1364.04 721.388,1365.43C722.328,1365.82 723.377,1365.77 724.387,1365.71C729.872,1365.39 735.358,1365.06 740.843,1364.74C742.047,1352.49 743.882,1340.12 744.47,1327.82C745.046,1315.77 745.595,1303.68 746.205,1291.62C747.832,1259.46 749.459,1227.3 751.085,1195.14C752.712,1162.99 754.339,1130.83 755.965,1098.67C757.591,1066.51 759.219,1034.35 760.845,1002.2C762.471,970.04 764.098,937.881 765.725,905.723C767.292,874.745 768.859,843.767 770.426,812.789C770.663,812.783 770.899,812.776 771.136,812.769C774.053,831.319 778.844,850.406 778.692,868.923C778.515,890.405 779.687,911.897 782.174,933.221C787.221,976.46 797.683,1019.01 813.316,1059.39C819.705,1075.89 826.987,1092.18 830.508,1109.59C834.538,1129.53 833.435,1150.05 831.281,1170.15C829.32,1188.44 832.221,1206 836.126,1224.09C839.366,1239.11 842.798,1254.08 846.454,1268.99C850.109,1283.9 853.989,1298.75 858.126,1313.52C862.267,1328.3 866.604,1343 871.664,1357.46C872.317,1359.32 873.078,1361.33 874.709,1362.35C875.961,1363.13 877.496,1363.17 878.953,1363.18C882.223,1363.22 885.494,1363.26 888.764,1363.3C891.827,1363.34 894.51,1363.97 895.199,1360.06C895.422,1358.79 895.32,1357.49 895.217,1356.21Z" style="fill:rgb(11,46,78);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M812.283,356.264C798.152,345.774 778.822,347.53 764.474,337.45C751.906,328.62 745.26,312.76 747.453,297.624C747.593,296.657 749.077,296.984 748.938,297.949C746.588,314.163 754.938,331.119 769.529,338.752C783.478,346.05 800.379,345.543 813.298,355.134C814.084,355.717 813.063,356.843 812.283,356.264Z" style="fill:rgb(25,56,79);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M799.452,199.468C807.081,202.622 812.072,207.966 816.967,214.369C817.805,215.465 818.678,216.55 819.375,217.745C819.708,218.314 819.997,218.908 820.224,219.527C820.422,220.065 820.457,220.818 820.758,221.285C821.099,221.815 821.797,222.235 822.2,222.752C822.626,223.298 822.988,223.893 823.28,224.521C823.863,225.777 823.197,227.175 823.149,228.56C823.097,230.064 823.546,231.515 823.224,232.985C821.743,239.736 822.864,246.931 824.461,253.577C826.252,261.032 829.561,268.017 832.615,275.049C835.67,282.081 838.518,289.331 839.296,296.958C839.847,302.359 839.279,307.998 837.107,313.009C836.164,315.186 834.891,317.021 834.207,319.268C833.491,321.614 832.924,323.877 831.874,326.137C827.529,335.486 819.845,343.265 810.532,347.692C798.44,353.44 783.881,353.528 771.555,348.301C762.093,344.289 753.351,337.761 744.415,332.638C741.948,331.223 739.332,329.65 738.145,327.065C736.774,324.08 737.679,320.611 737.759,317.327C737.862,313.089 736.863,306.58 732.135,306.159C726.656,305.672 721.995,305.621 716.985,302.849C710.837,299.445 706.101,293.575 704.076,286.846C702.633,282.049 702.61,276.604 705.133,272.278C706.801,269.419 709.775,267.162 713.046,266.518C714.327,266.267 717.039,267.039 718.01,266.45C719.21,265.723 720.147,262.197 720.754,260.928C724.702,252.678 728.706,244.452 732.983,236.367C740.366,222.416 749.265,208.211 763.295,200.982C774.362,195.279 787.947,194.71 799.452,199.468Z" style="fill:rgb(254,165,135);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M729.37,204.615C718.546,202.885 707.013,208.479 702.145,218.435C697.127,228.697 700.206,241.62 708.743,248.992C709.47,249.62 708.517,250.769 707.789,250.14C698.757,242.341 695.482,228.664 700.792,217.803C705.955,207.246 718.148,201.31 729.633,203.145C730.582,203.296 730.321,204.767 729.37,204.615Z" style="fill:rgb(11,46,78);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M742.039,190.617C747.673,182.535 755.993,177.157 765.034,173.537C775.22,169.459 786.559,166.842 797.476,165.877C808.044,164.943 819.163,166.319 828.128,172.381C836.39,177.967 841.448,187.522 841.403,197.507C841.355,208.295 835.146,218.259 825.811,223.508C824.703,224.13 823.537,222.516 824.652,221.889C832.854,217.278 838.602,208.94 839.345,199.469C840.136,189.401 835.188,179.522 826.856,173.911C818.153,168.051 807.239,166.933 797.037,167.919C787.264,168.864 777.318,171.133 768.091,174.501C758.458,178.019 749.522,183.35 743.569,191.889C742.835,192.941 741.31,191.662 742.039,190.617Z" style="fill:rgb(11,46,78);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M838.185,288.374C836.512,297.717 828.29,304.858 819.252,307.757C810.214,310.655 800.447,310.02 791.033,308.812C778.337,307.184 765.455,304.444 754.627,297.62C745.045,291.582 731.764,277.612 737.384,265.621C738.857,262.476 740.4,259.273 742.029,256.077C742.54,255.641 743.087,255.245 743.658,254.903C745.677,253.691 747.949,252.982 750.134,252.104C756.915,249.38 762.99,244.918 767.62,239.264C774.171,231.264 778.128,220.712 786.934,215.291C788.688,214.211 790.595,213.393 792.576,212.835C793.239,212.807 793.903,212.789 794.569,212.797C806.714,212.944 819.057,220.126 823.282,231.513C823.432,231.916 824.135,231.12 825.112,229.652C825.292,229.721 825.466,229.797 825.664,229.847C827.655,230.35 829.791,229.462 831.295,228.065C832.8,226.667 833.792,224.818 834.747,223C837.015,218.689 839.26,214.291 840.297,209.531C842.328,200.209 835.876,189.696 827.227,186.082C826.229,185.665 825.239,185.364 824.25,185.136C815.177,172.519 800.913,163.44 785.343,161.899C769.031,160.286 752.507,167.069 741.006,178.659C735.209,180.426 729.71,183.037 724.816,186.636C714.66,194.103 707.555,206.182 707.219,218.649C705.421,221.65 703.959,224.855 702.894,228.174C698.845,240.783 699.42,254.768 710.468,262.584C725.472,273.199 735.996,290.179 738.675,308.37C740.066,317.81 739.62,327.995 744.638,336.11C750.149,345.025 760.786,349.095 770.671,352.579C787.459,358.496 804.247,364.413 821.034,370.33C839.027,347.663 845.579,316.354 838.185,288.374Z" style="fill:rgb(11,46,78);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M723.572,414.248C722.563,411.054 719.283,403.961 718.183,400.676C716.799,392.646 710.589,389.414 704.633,383.863C698.955,378.572 688.217,374.138 680.685,377.614C680.164,377.854 679.652,378.104 679.14,378.353C675.654,378.875 672.216,379.857 669.001,381.215C661.409,384.421 654.784,389.428 648.512,394.691C643.185,399.161 637.799,402.132 633.175,407.6C623.202,419.391 616.705,433.677 610.744,447.924C597.893,478.642 586.947,510.155 577.973,542.221C582.534,544.041 587.245,545.75 592.29,547.127C597.779,548.393 603.267,551.771 608.756,554.304C627.486,563.461 646.627,570.977 666.178,578.874C679.191,562.725 691.958,546.331 702.44,528.455C714.438,507.995 723.422,485.356 725.301,461.711C726.626,445.03 728.538,429.955 723.572,414.248Z" style="fill:rgb(137,192,255);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <rect x="680.515" y="381.205" width="385.115" height="272.722" style="fill:rgb(218,166,120);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <rect x="680.515" y="381.205" width="109.948" height="272.722" style="fill:rgb(196,149,108);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <rect x="1016.56" y="635.372" width="25.389" height="2.628" style="fill:rgb(160,124,92);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M1037.32,632.074L1034.52,632.074L1034.52,617.395L1029.89,617.395L1035.92,606.954L1041.95,617.395L1037.32,617.395L1037.32,632.074Z" style="fill:rgb(160,124,92);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M1023.99,632.074L1021.19,632.074L1021.19,617.395L1016.56,617.395L1022.59,606.954L1028.62,617.395L1023.99,617.395L1023.99,632.074Z" style="fill:rgb(160,124,92);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M972.239,637.972L961.045,637.972C961.045,636.915 961.902,636.058 962.959,636.058L964.957,636.058L964.957,623.303C962.689,622.588 961.045,620.468 961.045,617.964L961.045,606.982L972.239,606.982L972.239,617.964C972.239,620.468 970.595,622.588 968.328,623.303L968.328,636.058L970.326,636.058C971.383,636.058 972.239,636.915 972.239,637.972Z" style="fill:rgb(160,124,92);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M986.989,637.972L975.793,637.972C975.793,636.915 976.65,636.058 977.707,636.058L979.705,636.058L979.705,623.323C977.382,622.608 975.68,620.352 975.68,617.686L975.68,606.982L986.876,606.982L986.876,617.686C986.876,620.266 985.283,622.461 983.075,623.249L983.075,636.058L985.074,636.058C986.131,636.058 986.989,636.915 986.989,637.972ZM977.315,608.698L977.315,617.686C977.315,619.979 979.093,621.846 981.278,621.846C983.463,621.846 985.241,619.979 985.241,617.686L985.241,608.698L977.315,608.698Z" style="fill:rgb(160,124,92);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M992.306,646.133L955.728,646.133C952.769,646.133 950.361,643.726 950.361,640.767L950.361,604.188C950.361,601.229 952.769,598.822 955.728,598.822L992.306,598.822C995.264,598.822 997.671,601.229 997.671,604.188L997.671,640.767C997.671,643.726 995.264,646.133 992.306,646.133ZM955.728,601.155C954.055,601.155 952.694,602.515 952.694,604.188L952.694,640.767C952.694,642.439 954.055,643.799 955.728,643.799L992.306,643.799C993.978,643.799 995.338,642.439 995.338,640.767L995.338,604.188C995.338,602.515 993.978,601.155 992.306,601.155L955.728,601.155Z" style="fill:rgb(160,124,92);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M1047.54,646.133L1010.97,646.133C1008.01,646.133 1005.6,643.726 1005.6,640.767L1005.6,604.188C1005.6,601.229 1008.01,598.822 1010.97,598.822L1047.54,598.822C1050.5,598.822 1052.91,601.229 1052.91,604.188L1052.91,640.767C1052.91,643.726 1050.5,646.133 1047.54,646.133ZM1010.97,601.155C1009.29,601.155 1007.93,602.515 1007.93,604.188L1007.93,640.767C1007.93,642.439 1009.29,643.799 1010.97,643.799L1047.54,643.799C1049.22,643.799 1050.58,642.439 1050.58,640.767L1050.58,604.188C1050.58,602.515 1049.22,601.155 1047.54,601.155L1010.97,601.155Z" style="fill:rgb(160,124,92);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M896.103,406.485L810.034,406.485C808.059,406.485 806.457,404.883 806.457,402.908L806.457,401.758C806.457,399.782 808.059,398.181 810.034,398.181L896.103,398.181C898.078,398.181 899.68,399.782 899.68,401.758L899.68,402.908C899.68,404.883 898.078,406.485 896.103,406.485Z" style="fill:rgb(188,145,106);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M896.103,423.278L810.034,423.278C808.059,423.278 806.457,421.676 806.457,419.7L806.457,418.551C806.457,416.575 808.059,414.974 810.034,414.974L896.103,414.974C898.078,414.974 899.68,416.575 899.68,418.551L899.68,419.7C899.68,421.676 898.078,423.278 896.103,423.278Z" style="fill:rgb(188,145,106);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M896.103,440.07L810.034,440.07C808.059,440.07 806.457,438.469 806.457,436.493L806.457,435.344C806.457,433.368 808.059,431.767 810.034,431.767L896.103,431.767C898.078,431.767 899.68,433.368 899.68,435.344L899.68,436.493C899.68,438.469 898.078,440.07 896.103,440.07Z" style="fill:rgb(188,145,106);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M896.103,456.863L810.034,456.863C808.059,456.863 806.457,455.262 806.457,453.287L806.457,452.136C806.457,450.161 808.059,448.559 810.034,448.559L896.103,448.56C898.078,448.56 899.68,450.161 899.68,452.136L899.68,453.287C899.68,455.262 898.078,456.863 896.103,456.863Z" style="fill:rgb(188,145,106);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M746.45,381.205L746.45,528.288C746.45,528.175 746.443,528.055 746.436,527.943C743.199,537.668 739.955,547.401 736.71,557.126C738.051,549.895 737.527,542.328 735.212,535.345C733.091,539.639 731.75,544.321 731.256,549.086C731.316,544.044 731.361,539.002 731.413,533.952C727.517,540.807 724.708,548.285 723.119,556.017C723.126,546.404 723.126,536.784 723.134,527.171C721.718,534.821 719.822,542.373 717.478,549.783L717.478,381.205L746.45,381.205Z" style="fill:rgb(152,152,152);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M794.661,614.995C792.523,614.416 790.264,614.983 788.116,615.517C751.422,624.63 712.376,624.094 675.947,613.977C671.325,612.693 666.433,611.252 661.82,612.57C657.221,613.884 653.729,617.806 651.768,622.168C649.807,626.532 649.155,631.351 648.524,636.092C647.952,640.391 647.38,644.767 648.103,649.043C648.825,653.319 651.051,657.558 654.847,659.654C658.731,661.799 663.465,661.378 667.879,660.919C691.07,658.511 714.326,656.735 737.613,655.592C743.435,655.306 749.259,655.06 755.084,654.853C757.71,654.76 760.459,654.328 762.989,655.067C765.66,655.849 768.346,656.566 771.06,657.183C782.685,659.741 798.801,661.036 810.688,661.526C812.436,661.598 814.297,661.697 815.975,661.138C817.384,660.669 818.718,660.363 819.401,658.863C820.659,658.546 822.155,658.287 823.106,657.313C823.723,656.681 823.858,655.461 823.095,655.016C823.885,655.476 826.023,654.032 826.603,653.581C827.441,652.929 828.103,651.968 828.14,650.906C828.176,649.845 827.442,648.734 826.392,648.578C828.203,648.213 829.619,646.552 829.883,644.724C830.148,642.895 829.349,640.995 827.987,639.747C826.844,638.698 825.347,638.092 823.819,637.895C822.119,637.676 820.427,637.446 818.707,637.342C812.815,636.989 802.702,636.635 796.81,636.281C794.015,636.113 790.721,635.637 789.442,633.146C788.453,631.22 789.167,628.806 790.468,627.075C791.768,625.344 793.575,624.075 795.121,622.559C797.741,619.989 799.313,616.254 794.661,614.995Z" style="fill:rgb(254,165,135);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M592.29,547.126C587.245,545.75 582.534,544.04 577.973,542.221C571.161,566.557 565.484,591.211 560.979,616.078C560.759,617.292 560.542,618.51 560.34,619.731C556.644,636.296 556.117,658.494 575.927,663.227C581.038,664.448 586.372,664.196 591.621,663.937C613.505,662.856 635.391,661.774 657.275,660.693C657.85,647.118 662.911,633.769 671.48,623.225C673.201,621.107 675.078,619.071 676.298,616.63C677.519,614.189 678.002,611.202 676.814,608.745C674.758,604.494 669.464,603.971 665.489,602.643C663.173,601.871 661.504,600.64 659.407,599.597C656.678,598.239 654.976,598.226 651.536,598.512C652.015,597.367 652.512,596.228 653.019,595.094C655.533,592.024 658.033,588.943 660.525,585.866C662.41,583.538 664.297,581.208 666.178,578.874C646.627,570.977 627.486,563.461 608.756,554.304C603.267,551.77 597.779,548.393 592.29,547.126Z" style="fill:rgb(137,192,255);fill-rule:nonzero;"/>
+        </g>
+        <g transform="matrix(-1.53712,0,0,1.51253,2837.31,160.031)">
+            <path d="M1058.26,549.744C1053.92,549.233 1049.51,549.273 1045.18,549.873C1044.22,550.007 1043.06,550.339 1042.83,551.286C1042.58,552.332 1043.67,553.175 1044.6,553.707C1051.24,557.48 1057.88,561.253 1064.52,565.026C1057.98,563.833 1051.37,562.636 1044.73,562.988C1043.89,563.033 1043.03,563.107 1042.26,563.461C1041.5,563.815 1040.84,564.503 1040.74,565.341C1040.64,566.157 1041.1,566.959 1041.72,567.492C1042.35,568.025 1043.13,568.339 1043.89,568.643C1046.65,569.743 1049.4,570.842 1052.16,571.941C1053.56,572.502 1054.97,573.062 1056.38,573.623C1057.33,574.003 1059.39,574.41 1059.99,575.217C1055.15,575.343 1050.36,575.121 1045.51,575.528C1044.63,575.602 1043.72,575.694 1042.93,576.101C1042.14,576.507 1041.49,577.305 1041.52,578.192C1041.55,579.151 1042.33,579.911 1043.13,580.442C1045.17,581.797 1047.62,582.376 1050.04,582.728C1054.94,583.443 1059.95,583.324 1064.82,582.392C1065.88,582.187 1067.23,582.065 1068.21,581.575C1068.87,581.241 1069.38,580.516 1069.85,579.961C1071.24,578.347 1071.97,576.303 1072.43,574.252C1073.59,569.036 1074.69,563.918 1074.39,558.531C1074.06,552.758 1072.16,546.934 1068.27,542.654C1064.39,538.373 1058.34,535.873 1052.67,537.033C1051.08,537.36 1049.33,538.183 1048.94,539.764C1048.66,540.887 1049.19,542.086 1050,542.913C1050.8,543.739 1051.86,544.266 1052.9,544.777C1057.32,546.954 1061.74,549.131 1066.16,551.309C1063.57,550.581 1060.93,550.058 1058.26,549.744Z" style="fill:rgb(254,165,135);fill-rule:nonzero;"/>
+        </g>
+    </g>
+</svg>
index 980697d075afa449fe9ad4f028b1970fbe8423eb..f4e73dab2ffb2f78a41271e984ccd11832ce8c42 100644 (file)
@@ -183,7 +183,6 @@ select {
     font-size: 16px;
 }
 
-/* Style for focus state */
 input[type="text"]:focus,
 input[type="email"]:focus,
 input[type="password"]:focus,
@@ -194,7 +193,6 @@ select:focus {
     outline: none;
 }
 
-/* Style for submit button */
 input[type="submit"] {
     padding: 14px 20px;
     margin: 8px 0;
@@ -204,13 +202,16 @@ input[type="submit"] {
     font-size: 16px;
 }
 
-/* Style for labels */
 label {
     font-weight: bold;
     margin-bottom: 5px;
     display: block;
 }
 
+.subheading {
+  margin-top: -25px;
+}
+
 .post {
  background-color: var(--post-bg);
  padding: 2em;
@@ -246,6 +247,12 @@ footer p {
  font-size: .8rem;
 }
 
+.porter {
+  max-width: 170px;
+  float: right;
+  padding: 20px;
+}
+
 .logo {
  max-width: 48px;
  float: right;
@@ -300,6 +307,19 @@ ul .pinned::before {
  white-space: nowrap;
 }
 
+.notice {
+  background: var(--post-bg);
+  border-radius: 4px;
+  padding: 1px 1.5em;
+  margin: 10px auto;
+  max-width: 290px;
+  color: var(--accent-c);
+}
+
+.notice h3 {
+  color: var(--accent-a);
+}
+
 .filter-buttons {
  margin-bottom: 20px;
  text-align: center;
@@ -334,7 +354,7 @@ ul .pinned::before {
 
 .bookmark-comment {
  font-style: italic;
- color: var(--code-text);
+ color: var(--accent-b);
  font-size: 0.9em;
 }
 
index d1898f784d4c98930517f12a40e3309736d7efa7..012a0f52bbcc5eef38b9c37ffe8c5df325711992 100644 (file)
@@ -1,7 +1,7 @@
 class ApiKeysController < ApplicationController
   before_action :set_api_key, only: [:show, :destroy]
-  before_action :authenticate_user! # Assuming you're using Devise for authentication
-  before_action :authorize_admin # You'll need to implement this method
+  #before_action :authenticate_user!
+  include AdminAuthenticatable
 
   def index
        @api_keys = ApiKey.all
index ebe9da5438ea377439c504f4f94bcfac3006b676..2397948ffae3ea3b703e16a3c77f3236ce22f54d 100644 (file)
@@ -9,7 +9,7 @@ module AdminAuthenticatable
 
   def authenticate_admin!
        unless current_user&.admin?
-         flash[:alert] = "You are not authorized to access this page."
+         flash[:alert] = "You are not authorised to access this page. If you have an account please log in first."
          redirect_to root_path
        end
   end
index d8e7f033dd42ec32c3b640e721d859953d12cdb4..4b39f116f1ee115c9de41e69956eb445462a56d0 100644 (file)
@@ -46,6 +46,47 @@ class PostsController < ApplicationController
     @post.destroy!
     redirect_to posts_url, notice: "Post was successfully destroyed.", status: :see_other
   end
+  
+  def export
+    @posts = Post.order(published_at: :desc)
+    send_data @posts.to_json, filename: "posts_export.json", type: "application/json"
+  end
+  
+  def importer
+  end
+
+  def import
+    if params[:file].present?
+      file = params[:file]
+      if file.content_type == "application/json"
+        begin
+          data = JSON.parse(file.read)
+          import_results = { success: 0, failed: 0, errors: [] }
+          
+          ActiveRecord::Base.transaction do
+            import_posts(data['posts'], import_results) if data['posts']
+            import_bookmarks(data['bookmarks'], import_results) if data['bookmarks']
+          end
+          
+          if import_results[:failed] > 0
+            flash[:warning] = "Import partially succeeded. Successful: #{import_results[:success]}, Failed: #{import_results[:failed]}. Check the logs for detailed errors."
+          else
+            flash[:notice] = "Data imported successfully. Total items: #{import_results[:success]}"
+          end
+        rescue JSON::ParserError
+          flash[:alert] = "Invalid JSON file."
+        rescue => e
+          flash[:alert] = "Error importing data: #{e.message}"
+          logger.error "Import Error: #{e.message}\n#{e.backtrace.join("\n")}"
+        end
+      else
+        flash[:alert] = "Please upload a JSON file."
+      end
+    else
+      flash[:alert] = "Please select a file to import."
+    end
+    redirect_to posts_path
+  end
 
   private
     # Use callbacks to share common setup or constraints between actions.
@@ -55,6 +96,70 @@ class PostsController < ApplicationController
 
     # Only allow a list of trusted parameters through.
     def post_params
-      params.require(:post).permit(:post_type, :title, :slug, :published_at, :excerpt, :tags, :content, :url)
+      params.require(:post).permit(:post_type, :title, :slug, :published_at, :excerpt, :tags, :content, :url, :file)
+    end
+    
+    def import_posts(posts_data, results)
+      return unless posts_data.is_a?(Array)
+      
+      posts_data.each do |post_data|
+        begin
+          post = Post.new(
+            post_type: 'dispatch',
+            title: post_data['title'],
+            slug: post_data['slug'],
+            published_at: post_data['date'],
+            content: post_data['content'],
+            tags: post_data['tags']
+          )
+          
+          if post.save
+            results[:success] += 1
+          else
+            results[:failed] += 1
+            results[:errors] << "Post '#{post_data['title']}': #{post.errors.full_messages.join(', ')}"
+          end
+        rescue => e
+          results[:failed] += 1
+          results[:errors] << "Post '#{post_data['title']}': #{e.message}"
+          logger.error "Error importing post: #{post_data.inspect}\nError: #{e.message}\n#{e.backtrace.join("\n")}"
+        end
+      end
+    end
+    
+    def import_bookmarks(bookmarks_data, results)
+      return unless bookmarks_data.is_a?(Array)
+      
+      bookmarks_data.each do |bookmark_data|
+        begin
+          comment = bookmark_data['comment']
+          title, content = if comment.include?('«')
+            comment.split('«', 2).map(&:strip)
+          else
+            [comment, nil]
+          end
+    
+          post = Post.new(
+            post_type: 'bookmark',
+            title: title,
+            published_at: bookmark_data['datetime'],
+            excerpt: title,
+            content: content,
+            tags: bookmark_data['starred'] == 1 ? 'starred' : '',
+            url: bookmark_data['url']
+          )
+          
+          if post.save
+            results[:success] += 1
+          else
+            results[:failed] += 1
+            results[:errors] << "Bookmark '#{bookmark_data['url']}': #{post.errors.full_messages.join(', ')}"
+          end
+        rescue => e
+          results[:failed] += 1
+          results[:errors] << "Bookmark '#{bookmark_data['url']}': #{e.message}"
+          logger.error "Error importing bookmark: #{bookmark_data.inspect}\nError: #{e.message}\n#{e.backtrace.join("\n")}"
+        end
+      end
     end
 end
diff --git a/app/models/concerns/url_title_fetchable.rb b/app/models/concerns/url_title_fetchable.rb
new file mode 100644 (file)
index 0000000..efa6338
--- /dev/null
@@ -0,0 +1,38 @@
+require 'open-uri'
+
+module UrlTitleFetchable
+  extend ActiveSupport::Concern
+
+  def fetch_title_from_url(url)
+       options = {
+         'User-Agent' => 'facebookexternalhit/1.0',
+         ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE,
+         read_timeout: 12
+       }
+
+       begin
+         doc = Nokogiri::HTML(URI.open(url, options))
+         title = doc.at_css('title')&.text&.strip
+         clean_title(title) if title.present?
+       rescue StandardError => e
+         Rails.logger.error("Error fetching title for URL #{url}: #{e.message}")
+         nil
+       end
+  end
+
+  private
+
+  def clean_title(title)
+       # List of common separators
+       separators = %w[| - : • · — – →]
+       
+       # Create a regex pattern from the separators
+       separator_pattern = Regexp.union(separators)
+
+       # Split the title at the first occurrence of any separator
+       cleaned_title = title.split(separator_pattern).first&.strip
+
+       # Return the cleaned title if it's not empty, otherwise return the original title
+       cleaned_title.present? ? cleaned_title : title
+  end
+end
\ No newline at end of file
index 4cc2ea72e1f75ec9e5a0f6bbe5edabfe4962b94e..64e613ef98c4c078613995ba23cc58e38a8b1d7c 100644 (file)
@@ -1,12 +1,15 @@
 class Post < ApplicationRecord
+  include UrlTitleFetchable
+  
   validates :post_type, presence: true, inclusion: { in: %w[dispatch bookmark] }
   validates :title, presence: true
-  validates :slug, presence: true, uniqueness: true
+  validates :slug, presence: true, uniqueness: true, if: :dispatch?
   validates :published_at, presence: true, if: :dispatch?
   validates :content, presence: true, if: :dispatch?
   validates :url, presence: true, if: :bookmark?
 
   before_validation :set_slug, if: :new_record?
+  before_validation :set_title_from_url, if: -> { bookmark? && title.blank? }
 
   scope :dispatches, -> { where(post_type: 'dispatch') }
   scope :bookmarks, -> { where(post_type: 'bookmark') }
@@ -59,4 +62,21 @@ class Post < ApplicationRecord
   def set_published_at
     self.published_at ||= Time.current
   end
+  
+  private
+  
+  def set_title_from_url
+    return unless bookmark? && url.present? && title.blank?
+    
+    Rails.logger.debug("Attempting to fetch title for URL: #{url}")
+    fetched_title = fetch_title_from_url(url)
+    
+    if fetched_title.present?
+      Rails.logger.debug("Successfully fetched title: #{fetched_title}")
+      self.title = fetched_title
+    else
+      Rails.logger.debug("Failed to fetch title, using default")
+      self.title = "Bookmark"
+    end
+  end
 end
\ No newline at end of file
diff --git a/app/views/posts/importer.html.erb b/app/views/posts/importer.html.erb
new file mode 100644 (file)
index 0000000..3a91bc6
--- /dev/null
@@ -0,0 +1,26 @@
+<div class="container">
+       <h1>Data im<em>porter</em></h1>
+       <%= link_to "Back to posts", posts_path, class: "button" %>
+</div>
+<div class="post">
+       <div class="container">
+               <%= image_tag "porter.svg", class: "porter" %>
+
+               <%= form_tag import_path, multipart: true do %>
+               <div class="field">
+                       <%= label_tag :file, "Select JSON file to import" %>
+                       <%= file_field_tag :file, accept: 'application/json' %>
+               </div>
+               <%= submit_tag "Import Data", class: "button" %>
+               <% end %>
+               
+               <h3>What are we doing here?</h3>
+               <p>“Give me your tired, your poor,<br>
+               Your huddled masses yearning to breathe free,<br>
+               The wretched refuse of your teeming shore.<br>
+               Send these, the homeless, tempest-tost to me,<br>
+               I lift my lamp beside the golden door!”</p>
+                                       <cite>&mdash; Emma Lazarus</cite>
+               
+       </div>
+</div>
\ No newline at end of file
index 748e7a6f38a84155f17d8c95ad88c228d3e7aa3e..70da4e4c941a64a607ca57d0c81c2cb7dd078f3f 100644 (file)
@@ -2,6 +2,8 @@
   <% content_for :title, "Posts" %>
   <h1>Posts</h1>
   <%= link_to "New post", new_post_path, class: "button" %> <%= link_to "Home", root_path, class: "button" %>
+  <%= link_to "Export Data", export_path, class: "button" %>
+  <%= link_to "Import Data", importer_path, class: "button" %>
 </div>
 
 <div class="post">
index cc3e9f3b6e5a85487a55f7cf26941a4566401b4a..d016f9d08a5d5740962f433bd4d0fcc5fdf51b10 100644 (file)
@@ -10,7 +10,7 @@
     <%= render @post %>
     
     <div>
-      <%= link_to "Edit this post", edit_post_path(@post) %>
+      <%= link_to "Edit this post", edit_post_path(@post), class: "button" %>
     
       <%= button_to "Destroy this post", @post, method: :delete %>
     </div>
index 0ed4eb068cee443c3f089c794faa6ce705496f2c..f78ca14be5f4e0acfb3a4e428b81b5f1d12207be 100644 (file)
@@ -1,8 +1,15 @@
 <div class="container">
+<% if notice or alert %>
+  <div class="notice">
+         <h3>Notice:</h3>
+         <p><%= notice or alert %></p>
+  </div>
+<% end %>
   <%= link_to root_path do %>
        <%= image_tag "logo-192.png", class: "logo" %>
   <% end %>
-  <h1>Arelpe</h1>
+  <h1 class="header">mind reader</h1>
+  <p class="subheading"><small>Aidan’s anti-capitalist posting and sharing project</small></p> 
 </div>
 
 <div class="filter-buttons">
@@ -30,7 +37,7 @@
                <% else %>
                  <span class="post-link">
                        <%= link_to item.title, item.url, target: "_blank" %>
-                       <abbr title="external link">&nearr;&#xFE0E;</abbr>
+                       <abbr title="external link">&nearr;&#xFE0E;</abbr> « <span class="bookmark-comment"><%= item.content %></span> 
                  </span>
                  <span class="dash">&mdash;</span>
                  <span class="meta">added <%= item.created_at.strftime('%l:%M%P on %d/%m/%y') if item.created_at.present? %></span>
index ad8cab456e37dd28cd7332c24ef9a1528436a88e..d5d8ceec9a21dc29e4df6c47646db67535915838 100644 (file)
@@ -1,4 +1,7 @@
 <div class="container" id="top">
+  <%= link_to root_path do %>
+  <%= image_tag "logo-192.png", class: "logo" %>
+  <% end %>
   <h1><%= @post.title %></h1>
   <%= link_to "↼ Back to some other ideas...", root_path %>
   <div class="postmeta">
index d3de08be0bf5e2445483c8e736c801e2d4dfe3ac..7cc7ce9fbacd51c3d5f1cf576a0de46a06c36d59 100644 (file)
@@ -33,7 +33,12 @@ module Arelpe
     # These settings can be overridden in specific environments using the files
     # in config/environments, which are processed later.
     #
-    # config.time_zone = "Central Time (US & Canada)"
+    config.time_zone = "Australia/Adelaide"
     # config.eager_load_paths << Rails.root.join("extras")
+    
+    config.generators do |g|
+      g.template_engine :erb
+      g.templates.unshift File.expand_path('lib/templates', Rails.root)
+    end
   end
 end
index e3570be355fe8f4edb1fdc2159a8170a9b489e9c..dd5a74d2db9b5fc520b40f9560916a92a6ce88f4 100644 (file)
@@ -7,6 +7,9 @@ Rails.application.routes.draw do
     end
   end
   
+  get 'importer', to: 'posts#importer'
+  get 'export', to: 'posts#export'
+  post 'import', to: 'posts#import'
   resources :api_keys
   devise_for :users
   resources :posts
diff --git a/lib/templates/erb/scaffold/_edit.html.erb.tt b/lib/templates/erb/scaffold/_edit.html.erb.tt
new file mode 100644 (file)
index 0000000..dd6c930
--- /dev/null
@@ -0,0 +1,12 @@
+<div class="container">
+  <%% content_for :title, "Editing <%= singular_table_name %>" %>
+  <h1>Editing <%= singular_table_name %></h1>
+  <%%= link_to "Back to <%= plural_table_name %>", <%= index_helper(type: :path) %>, class: "button" %> 
+  <%%= link_to "Show this <%= singular_table_name %>", @<%= singular_table_name %>, class: "button" %>
+</div>
+
+<div class="post">
+  <div class="container">
+       <%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %>
+  </div>
+</div>
\ No newline at end of file
diff --git a/lib/templates/erb/scaffold/_form.html.erb.tt b/lib/templates/erb/scaffold/_form.html.erb.tt
new file mode 100644 (file)
index 0000000..859263a
--- /dev/null
@@ -0,0 +1,36 @@
+<%%= form_with(model: <%= model_resource_name %>, local: true) do |form| %>
+  <%% if <%= singular_table_name %>.errors.any? %>
+       <div id="error_explanation">
+         <h2><%%= pluralize(<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
+         <ul>
+               <%% <%= singular_table_name %>.errors.full_messages.each do |message| %>
+                 <li><%%= message %></li>
+               <%% end %>
+         </ul>
+       </div>
+  <%% end %>
+
+<% attributes.each do |attribute| -%>
+  <div class="field">
+<% if attribute.password_digest? -%>
+       <%%= form.label :password %>
+       <%%= form.password_field :password %>
+  </div>
+
+  <div class="field">
+       <%%= form.label :password_confirmation %>
+       <%%= form.password_field :password_confirmation %>
+<% elsif attribute.attachments? -%>
+       <%%= form.label :<%= attribute.column_name %> %>
+       <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true %>
+<% else -%>
+       <%%= form.label :<%= attribute.column_name %> %>
+       <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %> %>
+<% end -%>
+  </div>
+
+<% end -%>
+  <div class="actions">
+       <%%= form.submit %>
+  </div>
+<%% end %>
\ No newline at end of file
diff --git a/lib/templates/erb/scaffold/_index.html.erb.tt b/lib/templates/erb/scaffold/_index.html.erb.tt
new file mode 100644 (file)
index 0000000..19f8431
--- /dev/null
@@ -0,0 +1,41 @@
+<div class="container">
+  <%% content_for :title, "<%= plural_table_name.titleize %>" %>
+  <h1><%= plural_table_name.titleize %></h1>
+  <%%= link_to "New <%= singular_table_name %>", new_<%= singular_route_name %>_path, class: "button" %>
+  <%%= link_to "Home", root_path, class: "button" %>
+</div>
+
+<div class="post">
+  <div class="container">
+       <table>
+         <thead>
+               <tr>
+<% attributes.reject(&:password_digest?).each do |attribute| -%>
+                 <th><%= attribute.human_name %></th>
+<% end -%>
+                 <th>Actions</th>
+               </tr>
+         </thead>
+         <tbody>
+               <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
+                 <tr>
+<% attributes.reject(&:password_digest?).each do |attribute| -%>
+                       <td><%%= <%= singular_table_name %>.<%= attribute.column_name %> %></td>
+<% end -%>
+                       <td>
+                         <%%= link_to "View", <%= singular_table_name %>, class: "button small" %>
+                         <%%= link_to "Edit", edit_<%= singular_route_name %>_path(<%= singular_table_name %>), class: "button small" %>
+                         <%%= link_to "Delete", <%= singular_table_name %>, method: :delete, data: { confirm: "Are you sure you want to delete this <%= singular_table_name %>?" }, class: "button small danger" %>
+                       </td>
+                 </tr>
+               <%% end %>
+         </tbody>
+       </table>
+  </div>
+</div>
+
+<%% if @<%= plural_table_name %>.respond_to?(:total_pages) %>
+  <div class="container">
+       <%%= paginate @<%= plural_table_name %> %>
+  </div>
+<%% end %>
\ No newline at end of file
diff --git a/lib/templates/erb/scaffold/_new.html.erb.tt b/lib/templates/erb/scaffold/_new.html.erb.tt
new file mode 100644 (file)
index 0000000..037d9ab
--- /dev/null
@@ -0,0 +1,11 @@
+<%% content_for :title, "New <%= singular_table_name %>" %>
+<div class="container">
+  <h1>New <%= singular_table_name %></h1>
+  <%%= link_to "Back to <%= plural_table_name %>", <%= index_helper(type: :path) %>, class: "button" %>
+</div>
+
+<div class="post">
+  <div class="container"> 
+       <%%= render "form", <%= singular_table_name %>: @<%= singular_table_name %> %>
+  </div>
+</div>
\ No newline at end of file
diff --git a/lib/templates/erb/scaffold/_show.html.erb.tt b/lib/templates/erb/scaffold/_show.html.erb.tt
new file mode 100644 (file)
index 0000000..33f8497
--- /dev/null
@@ -0,0 +1,16 @@
+<div class="container">
+  <h1><%= singular_table_name.titleize %> details</h1>
+  <%%= link_to "Back to <%= plural_table_name %>", <%= index_helper(type: :path) %>, class: "button" %>
+</div>
+<div class="post">
+  <div class="container">
+       <p style="color: green"><%%= notice %></p>
+       
+       <%%= render @<%= singular_table_name %> %>
+       
+       <div>
+         <%%= link_to "Edit this <%= singular_table_name %>", <%= edit_helper(type: :path) %>, class: "button" %>
+         <%%= button_to "Destroy this <%= singular_table_name %>", @<%= singular_table_name %>, method: :delete %>
+       </div>
+  </div>
+</div>
\ No newline at end of file
index 945de6ddefbc8b32222e85e817545988fa2c73a4..cb50f3fba7b1ae517745e03582a08f0efa429d83 100644 (file)
Binary files a/public/apple-touch-icon.png and b/public/apple-touch-icon.png differ
index 5e396ab6084fd27fa80c4009285af10db5e06f77..257f858f7f2963d7645ed8c639611946def536b2 100644 (file)
Binary files a/public/favicon.ico and b/public/favicon.ico differ
index c0eed3c9a4d1dfe6710c9242e05946b5210ed0d2..5365cce6d5b3f9a92b76b847683da348809964a9 100644 (file)
Binary files a/public/icon-192-maskable.png and b/public/icon-192-maskable.png differ
index 9f7a57fc6a204f231e1ea77f1f7ae33ef37597db..d5ec334c48a945a0df32e432b0f67f1a6a607619 100644 (file)
Binary files a/public/icon-192.png and b/public/icon-192.png differ
index 3577963393bc7757f9f9a5c752dc9293290f40cd..79cfa30862cea67d5051a648f70697fee31c5381 100644 (file)
Binary files a/public/icon-512-maskable.png and b/public/icon-512-maskable.png differ
index 6668b1b06f2bacf801846676dda2a4bf74341e4f..a28fdb9c9a2d3c3d7f11344acdc9a8abb54e052b 100644 (file)
Binary files a/public/icon-512.png and b/public/icon-512.png differ
index d6baf797f821670c3921b60608ec51c5d3251563..d5ec334c48a945a0df32e432b0f67f1a6a607619 100644 (file)
Binary files a/public/icon.png and b/public/icon.png differ
index d6baf797f821670c3921b60608ec51c5d3251563..d5ec334c48a945a0df32e432b0f67f1a6a607619 100644 (file)
Binary files a/public/logo-192.png and b/public/logo-192.png differ