diff options
Diffstat (limited to 'app')
182 files changed, 2127 insertions, 619 deletions
diff --git a/app/assets/fonts/sBoiv/sboiv.eot b/app/assets/fonts/sBoiv/sboiv.eot Binary files differindex 0bc305533..7bf5449a2 100644 --- a/app/assets/fonts/sBoiv/sboiv.eot +++ b/app/assets/fonts/sBoiv/sboiv.eot diff --git a/app/assets/fonts/sBoiv/sboiv.svg b/app/assets/fonts/sBoiv/sboiv.svg index 018422b09..42e8988cb 100644 --- a/app/assets/fonts/sBoiv/sboiv.svg +++ b/app/assets/fonts/sBoiv/sboiv.svg @@ -11,4 +11,31 @@ <glyph unicode="" glyph-name="preparing" d="M1011.173 614.391l-80.38 80.38c-7.765 8.206-18.731 13.312-30.889 13.312-0.12 0-0.239 0-0.359-0.001-0.129 0.002-0.303 0.003-0.478 0.003-11.951 0-22.708-5.119-30.194-13.284l-56.856-56.347 142.328-142.84 56.829 54.781c7.9 7.644 12.802 18.341 12.802 30.183 0 0.188-0.001 0.376-0.004 0.563 0.035 0.625 0.055 1.389 0.055 2.159 0 12.137-4.911 23.128-12.854 31.092zM504.32 330.758v-142.84h142.84l285.17 285.681-142.328 142.328zM805.872 544.251l-185.847-185.847c-0.834-0.338-1.802-0.535-2.816-0.535s-1.982 0.196-2.868 0.553c-0.285-0.079-0.672-0.113-1.067-0.113-3.676 0-6.656 2.98-6.656 6.656 0 0.395 0.034 0.782 0.1 1.159-0.322 0.797-0.505 1.765-0.505 2.776s0.183 1.979 0.518 2.873l188.387 183.741c0.834 0.338 1.802 0.535 2.816 0.535s1.982-0.196 2.868-0.553c0.285 0.079 0.672 0.113 1.067 0.113 3.676 0 6.656-2.98 6.656-6.656 0-0.395-0.034-0.782-0.1-1.159-0.528-1.405-1.409-2.616-2.539-3.532zM592.38 231.948v44.030h-44.030v36.862l31.23 31.23 80.38-80.38-31.23-31.23zM0.028 239.627h416.234v-51.197h-416.234v51.197z" /> <glyph unicode="" glyph-name="current-ref" d="M530.92 258.291l-70.054 71.588c-17.993 18.204-42.963 29.478-70.566 29.478s-52.573-11.274-70.557-29.468l-30.178 30.159c18.419 18.312 29.902 43.583 30.169 71.537-0.795 26.578-11.995 50.343-29.636 67.527l-70.586 71.609c-17.861 17.868-42.538 28.92-69.798 28.92s-51.937-11.052-69.798-28.92l-51.134-51.134c-17.868-17.861-28.92-42.538-28.92-69.798s11.052-51.937 28.92-69.798l74.145-69.543c17.993-18.204 42.963-29.478 70.566-29.478s52.573 11.274 70.557 29.468l30.178-30.159c-18.419-18.312-29.902-43.583-30.169-71.537-0.004-0.365-0.006-0.734-0.006-1.105 0-25.692 9.92-49.067 26.139-66.504l70.511-71.528c17.835-17.716 42.411-28.665 69.543-28.665s51.708 10.949 69.549 28.67l51.128 51.129c17.992 17.803 29.134 42.5 29.134 69.798s-11.142 51.995-29.126 69.791zM241.499 405.047c-11.25 11.25-20.965 24.545-38.351 24.545-18.074 0-32.726-14.652-32.726-32.726 0-17.386 13.295-27.101 24.545-38.351-5.924-6.606-14.486-10.742-24.015-10.742-0.186 0-0.372 0.002-0.557 0.005-0.198-0.006-0.464-0.009-0.731-0.009-8.851 0-16.88 3.513-22.771 9.221l-71.068 71.58c-5.845 5.909-9.456 14.038-9.456 23.010s3.61 17.101 9.459 23.013l51.131 51.131c6.103 5.703 14.326 9.204 23.366 9.204 0.055 0 0.11 0 0.164 0 0.003 0 0.017 0 0.031 0 9.168 0 17.47-3.712 23.483-9.716l69.543-72.1c6.338-6.063 10.278-14.588 10.278-24.033s-3.94-17.97-10.266-24.021zM493.592 188.748c-0.074-9.007-3.775-17.135-9.713-23.007l-51.137-51.137c-5.96-5.4-13.905-8.705-22.623-8.705-0.317 0-0.631 0.004-0.946 0.013-0.18-0.007-0.446-0.010-0.713-0.010-8.851 0-16.88 3.513-22.771 9.221l-69.022 72.092c-6.338 6.063-10.278 14.588-10.278 24.033s3.94 17.97 10.266 24.021c11.262-11.238 20.977-24.533 38.363-24.533 0.611-0.041 1.326-0.064 2.045-0.064 18.074 0 32.726 14.652 32.726 32.726 0 0.023 0 0.045 0 0.068 0 17.382-13.295 27.097-24.545 38.347 5.712 7.509 14.519 12.409 24.486 12.782 0.070 0.002 0.084 0.002 0.098 0.002 9.168 0 17.47-3.712 23.483-9.716l71.077-71.077c5.998-5.856 9.719-14.023 9.719-23.059 0-0.163-0.001-0.325-0.004-0.487zM1013.117 794.18l-51.134 51.134c-6.502 6.632-15.554 10.743-25.567 10.743s-19.066-4.111-25.561-10.737l-245.451-243.917-107.894 108.405c-6.502 6.632-15.554 10.743-25.567 10.743s-19.066-4.111-25.561-10.737l-51.14-51.14c-6.632-6.502-10.743-15.554-10.743-25.567s4.111-19.066 10.737-25.561l135.512-133.978 51.134-51.134c6.502-6.632 15.554-10.743 25.567-10.743s19.066 4.111 25.561 10.737l51.14 51.14 268.967 269.99c6.632 6.502 10.743 15.554 10.743 25.567s-4.111 19.066-10.737 25.561z" /> <glyph unicode="" glyph-name="chrono" horiz-adv-x="931" d="M440.957-64c243.751 0 440.957 196.267 440.957 438.857 0 225.524-171.483 412.038-391.962 436.419v51.2h73.493v97.524h-244.976v-97.524h73.493v-51.2c-220.478-24.381-391.962-209.676-391.962-436.419 0-242.59 197.206-438.857 440.957-438.857zM756.974 864.917l-71.043-70.705c71.043-41.448 131.062-101.181 172.708-171.886l71.055 70.705c-44.108 69.486-104.115 128-172.72 171.886z" /> +<glyph unicode="" glyph-name="ZDLR" d="M510.771 898.56c248.837 0 450.56-201.723 450.56-450.56s-201.723-450.56-450.56-450.56c-248.837 0-450.56 201.723-450.56 450.56v0c0 248.837 201.723 450.56 450.56 450.56v0zM510.771 929.28c-265.804 0-481.28-215.476-481.28-481.28s215.476-481.28 481.28-481.28c265.804 0 481.28 215.476 481.28 481.28v0c-0.349 265.663-215.617 480.931-481.246 481.28h-0.034zM553.984 778.547c-12.888 4.792-27.778 7.565-43.315 7.565s-30.427-2.773-44.201-7.85l0.886 0.286c-164.787-22.179-290.509-161.908-290.509-331.002 0-184.366 149.458-333.824 333.824-333.824s333.824 149.458 333.824 333.824c0 169.093-125.722 308.823-288.79 330.812l-1.718 0.19zM410.624 655.667c-0.065 1.347-0.102 2.926-0.102 4.514 0 54.97 44.562 99.533 99.533 99.533s99.533-44.562 99.533-99.533c0-1.588-0.037-3.166-0.111-4.736l0.008 0.222c-0.119-4.799-0.561-9.394-1.308-13.886l0.079 0.574c0-2.662 0-5.12-1.229-7.578-8.335-37.442-36.943-66.529-73.458-75.431l-0.68-0.14v-125.952c0-12.668-10.27-22.938-22.938-22.938s-22.938 10.27-22.938 22.938v126.157c-37.195 9.042-65.803 38.129-74.014 74.909l-0.124 0.662c0 2.458 0 5.12-1.229 7.578-0.667 3.917-1.109 8.512-1.226 13.188l-0.002 0.124zM510.157 379.597c29.634 0 53.658 24.023 53.658 53.658v20.48c27.443-10.445 45.875-28.058 45.875-48.742 0-32.154-44.442-58.368-99.533-58.368s-98.918 27.443-98.918 60.416c0 20.48 18.432 38.298 45.875 48.742v-20.48c-0.016-0.488-0.025-1.062-0.025-1.638 0-29.634 24.023-53.658 53.658-53.658 0.009 0 0.018 0 0.026 0h-0.001zM510.157 236.237c-0.112 0-0.244 0-0.377 0-116.275 0-210.534 94.259-210.534 210.534 0 69.683 33.854 131.459 86.012 169.779l0.586 0.41c11.324-36.013 36.951-64.648 70.051-79.746l0.81-0.331v-50.381l-4.71-1.638c-44.237-14.95-70.861-44.646-70.861-79.462 0-50.79 55.91-89.088 130.253-89.088s130.253 38.298 130.253 89.088c0 34.611-26.419 64.307-70.861 79.462l-4.71 1.638v51.2c33.079 15.862 57.944 44.403 68.572 79.16l0.241 0.917c52.743-38.73 86.597-100.506 86.597-170.189 0-116.275-94.259-210.534-210.534-210.534-0.060 0-0.12 0-0.181 0h0.009z" /> +<glyph unicode="" glyph-name="ZDER" d="M510.771 898.56c248.837 0 450.56-201.723 450.56-450.56s-201.723-450.56-450.56-450.56c-248.837 0-450.56 201.723-450.56 450.56v0c0 248.837 201.723 450.56 450.56 450.56v0zM510.771 929.28c-265.804 0-481.28-215.476-481.28-481.28s215.476-481.28 481.28-481.28c265.804 0 481.28 215.476 481.28 481.28v0c-0.349 265.663-215.617 480.931-481.246 481.28h-0.034zM610.099 656.077c0 0.088 0 0.191 0 0.295 0 54.97-44.562 99.533-99.533 99.533s-99.533-44.562-99.533-99.533c0-46.684 32.14-85.862 75.501-96.612l0.684-0.144v-125.952c0-12.668 10.27-22.938 22.938-22.938s22.938 10.27 22.938 22.938v125.747c44.403 10.501 76.946 49.775 77.005 96.659v0.007zM614.4 732.672c8.961-12.008 15.986-26.074 20.264-41.289l0.216-0.9c89.003-46.035 148.787-137.4 148.787-242.728 0-150.434-121.95-272.384-272.384-272.384s-272.384 121.95-272.384 272.384c0 105.328 59.784 196.693 147.27 242.013l1.518 0.715c4.494 16.115 11.519 30.18 20.721 42.527l-0.241-0.338c-118.013-43.249-200.704-154.609-200.704-285.283 0-167.4 135.704-303.104 303.104-303.104s303.104 135.704 303.104 303.104c0 130.674-82.691 242.034-198.601 284.607l-2.103 0.676zM570.163 485.478l-4.71 1.638h-2.662v-31.539c28.467-10.24 47.514-28.467 47.514-49.357 0-32.154-44.442-58.368-99.533-58.368s-99.533 26.010-99.533 59.187c0 20.48 19.251 39.117 47.514 49.357v30.72h-2.662l-4.71-1.638c-44.237-14.95-70.861-44.646-70.861-79.462 0-50.79 55.91-89.088 130.253-89.088s130.253 38.298 130.253 89.088c-0.205 34.816-26.624 64.512-70.861 79.462z" /> +<glyph unicode="" glyph-name="ZDEP" d="M510.771 898.56c248.837 0 450.56-201.723 450.56-450.56s-201.723-450.56-450.56-450.56c-248.837 0-450.56 201.723-450.56 450.56v0c0 248.837 201.723 450.56 450.56 450.56v0zM510.771 929.28c-265.804 0-481.28-215.476-481.28-481.28s215.476-481.28 481.28-481.28c265.804 0 481.28 215.476 481.28 481.28v0c-0.349 265.663-215.617 480.931-481.246 481.28h-0.034zM616.653 731.443c-23.824 33.267-62.351 54.688-105.882 54.688s-82.057-21.421-105.615-54.297l-0.266-0.391c-116.172-44.199-197.222-154.639-197.222-284.009 0-167.4 135.704-303.104 303.104-303.104s303.104 135.704 303.104 303.104c0 129.37-81.050 239.81-195.142 283.312l-2.080 0.697zM545.587 748.851v0c5.438-2.071 10.025-4.275 14.399-6.806l-0.473 0.253 2.048-1.024c4.507-2.73 8.386-5.5 12.043-8.529l-0.164 0.132 2.048-1.638c3.771-3.26 7.185-6.674 10.338-10.319l0.106-0.126 1.024-1.434c3.219-3.804 6.26-8.019 8.965-12.46l0.251-0.443c9.009-14.585 14.347-32.266 14.347-51.194 0-46.344-32.002-85.213-75.113-95.714l-0.674-0.139v-125.952c0-12.668-10.27-22.938-22.938-22.938s-22.938 10.27-22.938 22.938v0 125.952c-43.785 10.64-75.787 49.509-75.787 95.853 0 18.928 5.338 36.609 14.591 51.619l-0.244-0.425c2.956 4.884 5.997 9.098 9.338 13.051l-0.122-0.148 1.024 1.229c3.26 3.771 6.674 7.185 10.319 10.338l0.126 0.106 2.048 1.638c3.492 2.896 7.371 5.666 11.443 8.15l0.435 0.247 2.048 1.024c13.841 8.242 30.52 13.114 48.337 13.114 12.527 0 24.492-2.409 35.457-6.788l-0.645 0.227zM510.976 175.411c-0.337-0.002-0.735-0.002-1.133-0.002-150.32 0-272.179 121.859-272.179 272.179 0 104.729 59.15 195.643 145.866 241.157l1.494 0.714c-2.847-10.119-4.483-21.74-4.483-33.742 0-52.303 31.072-97.348 75.763-117.684l0.81-0.33v-52.224l-4.506-1.638c-43.622-14.746-69.632-43.827-69.632-77.619 0-49.766 55.296-87.245 128.41-87.245s128.41 37.478 128.41 87.245c0 33.792-26.010 62.874-69.632 77.619l-4.506 1.638v52.224c45.501 20.666 76.573 65.712 76.573 118.014 0 12.003-1.636 23.623-4.698 34.651l0.215-0.908c87.994-46.294 146.97-137.094 146.97-241.67 0-150.32-121.859-272.179-272.179-272.179-0.621 0-1.242 0.002-1.863 0.006l0.095-0.001z" /> +<glyph unicode="" glyph-name="transporteur" d="M512 741.069c-81.92 0-147.661-73.318-147.661-163.84 0-93.389 69.018-175.104 147.661-175.104s147.661 81.92 147.661 175.104c0 90.522-65.741 163.84-147.661 163.84zM512 441.651c-56.73 0-108.339 64.717-108.339 135.782s48.538 124.109 108.339 124.109 108.339-55.706 108.339-124.109-51.61-135.782-108.339-135.782zM837.837 960h-651.674c-79.176 0-143.36-64.184-143.36-143.36v0-736.051l6.349-5.734c5.53-5.12 124.723-112.026 376.832-133.939l15.974-1.229 26.010-1.638c15.565 0 31.539-1.229 48.333-1.229s32.563 0 47.923 1.229c11.469 0 22.528 1.229 33.382 2.253h6.554c252.723 20.48 366.797 129.229 371.917 134.349l5.939 5.734v735.027c0.003 0.366 0.005 0.798 0.005 1.231 0 79.176-64.184 143.36-143.36 143.36-0.29 0-0.58-0.001-0.869-0.003h0.045zM586.547-21.197h-9.626l-19.046-1.024c-13.722 0-27.648 0-41.984 0s-28.672 0-42.394 0h-31.13c-36.211 2.821-68.876 7.322-100.909 13.59l5.472-0.892c3.223 88.741 75.939 159.457 165.171 159.457s161.948-70.716 165.163-159.163l0.008-0.293c-25.397-5.041-56.477-9.184-88.060-11.516l-2.666-0.158zM715.981-0.717c-9.114 105.498-97.002 187.68-204.083 187.68s-194.969-82.182-204.030-186.914l-0.053-0.766c-18.227 4.506-32.358 8.806-40.96 11.878 2.048 179.814 46.080 290.611 245.76 290.611s243.507-111.002 245.76-290.816c-9.83-2.253-23.757-6.758-41.574-11.469zM941.261 97.792c-41.585-32.278-89.897-58.509-142.149-76.192l-3.464-1.018c-3.277 162.406-44.646 321.331-284.672 321.331-137.011 0-276.89-38.707-284.467-319.488-55.233 19.071-103.124 44.821-145.948 76.957l1.359-0.976v716.8c0.462 57.303 46.908 103.604 104.221 103.834h651.696c57.264-0.228 103.666-46.414 104.243-103.574v-0.055z" /> +<glyph unicode="" glyph-name="trace" d="M220.57 153.702c7.656 11.232 12.225 25.102 12.225 40.038s-4.568 28.806-12.384 40.287l0.16-0.249c-5.259 7.728-11.728 14.197-19.207 19.296l-0.249 0.16c-11.212 7.698-25.077 12.294-40.016 12.294-0.332 0-0.663-0.002-0.994-0.007l0.050 0.001c-0.201 0.002-0.438 0.003-0.676 0.003-5.716 0-11.276-0.673-16.603-1.944l0.485 0.098c-3.413 6.868-10.381 11.506-18.432 11.506-11.331 0-20.517-9.186-20.517-20.517 0-3.28 0.77-6.381 2.139-9.13l-0.054 0.119c0.592-1.011 1.201-1.881 1.872-2.698l-0.028 0.036c-12.243-12.806-19.779-30.202-19.779-49.358 0-39.475 32.001-71.475 71.475-71.475 0.113 0 0.227 0 0.34 0.001h-0.017c0.281-0.004 0.612-0.006 0.944-0.006 14.939 0 28.804 4.596 40.259 12.452l-0.243-0.157c7.635 5.218 14.033 11.617 19.092 19.005l0.159 0.247zM561.357 67.072c-11.212 7.698-25.077 12.294-40.016 12.294-0.332 0-0.663-0.002-0.994-0.007l0.050 0.001c-0.080 0-0.175 0.001-0.27 0.001-31.454 0-58.121-20.493-67.378-48.856l-0.142-0.501c-2.637 2.573-5.971 4.443-9.693 5.298l-0.138 0.027c-1.139 0.221-2.449 0.348-3.789 0.348-11.503 0-20.828-9.325-20.828-20.828 0-10.163 7.279-18.626 16.909-20.459l0.13-0.021h3.891c0.198-0.007 0.43-0.011 0.663-0.011 4.002 0 7.736 1.148 10.891 3.133l-0.085-0.050c4.426-34.809 33.858-61.449 69.513-61.449 0.402 0 0.803 0.003 1.204 0.010l-0.060-0.001c0.281-0.004 0.612-0.006 0.944-0.006 14.939 0 28.804 4.596 40.259 12.452l-0.243-0.157c7.728 5.259 14.197 11.728 19.296 19.207l0.16 0.249c7.656 11.232 12.225 25.102 12.225 40.038s-4.568 28.806-12.384 40.287l0.16-0.249c-5.494 7.696-12.234 14.109-19.987 19.079l-0.288 0.173zM966.246 274.125c-3.801 5.452-8.124 10.165-12.995 14.244l-0.112 0.092c18.132 47.444 28.632 102.317 28.632 159.643 0 64.372-13.241 125.652-37.147 181.264l1.142-2.986c13.419 12.977 21.749 31.143 21.749 51.255 0 39.362-31.909 71.27-71.27 71.27-8.378 0-16.419-1.446-23.886-4.101l0.498 0.155c-70.085 82.874-167.895 140.378-278.969 158.168l-2.631 0.347c-2.074 9.484-5.766 17.855-10.808 25.23l0.158-0.245c-5.218 7.635-11.617 14.033-19.005 19.092l-0.247 0.159c-11.212 7.698-25.077 12.294-40.016 12.294-0.332 0-0.663-0.002-0.994-0.007l0.050 0.001c-34.182-0.131-62.713-24.169-69.75-56.255l-0.087-0.474c-138.493-22.099-254.554-103.131-323.456-216.080l-1.152-2.032c-3.778 0.747-8.123 1.175-12.567 1.175-9.827 0-19.165-2.091-27.595-5.852l0.431 0.172c-26.103-11.293-44.035-36.823-44.035-66.543 0-39.927 32.367-72.294 72.294-72.294s72.294 32.367 72.294 72.294c0 20.824-8.804 39.592-22.894 52.784l-0.040 0.037c63.358 102.396 166.932 174.75 288.137 195.238l2.474 0.346s0-1.434 0-2.048c11.157-25.972 36.517-43.831 66.049-43.831 0.252 0 0.503 0.001 0.754 0.004h-0.038c0.281-0.004 0.612-0.006 0.944-0.006 14.939 0 28.804 4.596 40.259 12.452l-0.243-0.157c7.728 5.259 14.197 11.728 19.296 19.207l0.16 0.249c2.682 3.948 5.090 8.467 6.998 13.24l0.17 0.482c101.026-16.869 187.935-67.795 250.419-140.354l0.461-0.548c-9.791-12.103-15.719-27.684-15.719-44.649 0-39.362 31.909-71.27 71.27-71.27 0.198 0 0.396 0.001 0.594 0.002h-0.030c0.015 0 0.033 0 0.051 0 5.056 0 9.99 0.522 14.752 1.515l-0.467-0.081c19.62-46.693 31.019-100.964 31.019-157.897 0-51.76-9.422-101.32-26.644-147.058l0.95 2.875c-3.225 0.59-6.936 0.928-10.725 0.928-9.403 0-18.32-2.078-26.319-5.799l0.385 0.161c-25.94-11.145-43.784-36.456-43.827-65.94v-0.006c0-39.588 32.092-71.68 71.68-71.68s71.68 32.092 71.68 71.68v0 0c0.001 0.129 0.001 0.282 0.001 0.436 0 14.807-4.515 28.559-12.244 39.955l0.16-0.25zM637.338 500.429c-5.189 5.188-12.356 8.398-20.274 8.398-0.072 0-0.145 0-0.217-0.001h0.011c-0.187 0.005-0.408 0.007-0.629 0.007-7.786 0-14.82-3.218-19.845-8.397l-0.007-0.007-36.864-36.659 92.365-92.16 36.864 36.864c5.067 5.137 8.196 12.196 8.196 19.987 0 0.173-0.002 0.347-0.005 0.519v-0.026c0 0.024 0 0.053 0 0.082 0 7.92-3.122 15.11-8.202 20.408l0.010-0.010zM361.677 265.114v-92.365h92.365l184.525 184.73-92.365 92.16-184.525-184.525zM299.008 91.853c-3.082 1.95-6.833 3.107-10.854 3.107-11.33 0-20.515-9.185-20.515-20.515 0-7.309 3.822-13.724 9.576-17.358l0.085-0.050c3.050-1.901 6.752-3.028 10.718-3.028 7.27 0 13.656 3.788 17.29 9.499l0.049 0.083c1.994 3.104 3.178 6.892 3.178 10.958 0 7.247-3.765 13.616-9.445 17.256l-0.082 0.049zM102.4 311.194c8.784 2.437 15.124 10.362 15.124 19.767 0 2.005-0.288 3.942-0.825 5.773l0.036-0.145c-2.519 8.66-10.383 14.881-19.7 14.881-1.954 0-3.845-0.274-5.635-0.785l0.144 0.035c-9.005-2.283-15.56-10.316-15.56-19.88 0-2.038 0.298-4.007 0.852-5.865l-0.037 0.145c2.491-8.702 10.376-14.964 19.723-14.964 0.266 0 0.531 0.005 0.795 0.015l-0.038-0.001c1.888 0.167 3.628 0.529 5.287 1.071l-0.167-0.047zM83.968 391.27c10.421 1.048 18.489 9.773 18.489 20.383 0 0.539-0.021 1.072-0.062 1.601l0.004-0.070c-0.84 10.616-9.661 18.912-20.42 18.912-0.598 0-1.19-0.026-1.775-0.076l0.076 0.005c-10.962-0.452-19.677-9.448-19.677-20.48 0-11.32 9.177-20.496 20.496-20.496 0.288 0 0.575 0.006 0.86 0.018l-0.041-0.001zM81.92 472.986h2.048c10.861 0.561 19.456 9.504 19.456 20.454 0 11.311-9.169 20.48-20.48 20.48s-20.48-9.169-20.48-20.48c0-10.951 8.595-19.894 19.406-20.452l0.050-0.002zM208.077 137.933c-3.68-3.702-5.955-8.804-5.955-14.438s2.275-10.737 5.956-14.439l-0.001 0.001c3.635-3.41 8.534-5.51 13.923-5.53h0.004c6.006 0.015 11.403 2.613 15.14 6.741l0.016 0.018c3.897 3.735 6.32 8.982 6.32 14.796 0 11.311-9.169 20.48-20.48 20.48-6.426 0-12.16-2.959-15.915-7.59l-0.030-0.038zM368.64 56.832c-2.218 0.878-4.787 1.387-7.475 1.387-11.511 0-20.843-9.332-20.843-20.843 0-8.823 5.482-16.365 13.226-19.407l0.142-0.049c2.143-0.907 4.635-1.434 7.25-1.434 0.043 0 0.086 0 0.129 0h-0.007c0.043 0 0.093-0.001 0.144-0.001 8.659 0 16.063 5.374 19.059 12.969l0.048 0.139c1.042 2.374 1.648 5.141 1.648 8.050 0 8.74-5.475 16.201-13.182 19.141l-0.141 0.047z" /> +<glyph unicode="" glyph-name="tableau-de-bord" d="M349.594 623.923c0-22.622-18.338-40.96-40.96-40.96v0h-134.963c-22.622 0-40.96 18.338-40.96 40.96v0 81.92c0 22.622 18.338 40.96 40.96 40.96v0h135.373c22.622 0 40.96-18.338 40.96-40.96v0zM349.594 407.45c0-22.622-18.338-40.96-40.96-40.96v0h-134.963c-22.622 0-40.96 18.338-40.96 40.96v0 81.51c0 22.622 18.338 40.96 40.96 40.96v0h135.373c22.622 0 40.96-18.338 40.96-40.96v0zM349.594 190.976c0-22.622-18.338-40.96-40.96-40.96v0h-134.963c-22.622 0-40.96 18.338-40.96 40.96v0 81.92c0 22.622 18.338 40.96 40.96 40.96v0h135.373c22.622 0 40.96-18.338 40.96-40.96v0zM620.339 623.923c0-22.622-18.338-40.96-40.96-40.96v0h-134.963c-22.622 0-40.96 18.338-40.96 40.96v0 81.92c0 22.622 18.338 40.96 40.96 40.96v0h135.168c22.622 0 40.96-18.338 40.96-40.96v0zM620.339 407.45c0-22.622-18.338-40.96-40.96-40.96v0h-134.963c-22.622 0-40.96 18.338-40.96 40.96v0 81.51c0 22.622 18.338 40.96 40.96 40.96v0h135.168c22.622 0 40.96-18.338 40.96-40.96v0zM620.339 190.976c0-22.622-18.338-40.96-40.96-40.96v0h-134.963c-22.622 0-40.96 18.338-40.96 40.96v0 81.92c0 22.622 18.338 40.96 40.96 40.96v0h135.168c22.622 0 40.96-18.338 40.96-40.96v0zM890.88 623.923c0-22.622-18.338-40.96-40.96-40.96v0h-134.963c-22.622 0-40.96 18.338-40.96 40.96v0 81.92c0 22.622 18.338 40.96 40.96 40.96v0h135.373c22.622 0 40.96-18.338 40.96-40.96v0zM890.88 407.040c0-22.622-18.338-40.96-40.96-40.96v0h-134.963c-22.622 0-40.96 18.338-40.96 40.96v0 81.92c0 22.622 18.338 40.96 40.96 40.96v0h135.373c22.622 0 40.96-18.338 40.96-40.96v0zM890.88 190.566c0-22.622-18.338-40.96-40.96-40.96v0h-134.963c-22.622 0-40.96 18.338-40.96 40.96v0 81.92c0 22.622 18.338 40.96 40.96 40.96v0h135.373c22.622 0 40.96-18.338 40.96-40.96v0z" /> +<glyph unicode="" glyph-name="synchro-ilico" d="M581.837 816.64l-139.674 143.36v-122.88c-0.227 0-0.496 0.001-0.765 0.001-214.905 0-389.12-174.215-389.12-389.12 0-134.343 68.080-252.785 171.622-322.707l1.379-0.878 22.733 33.997c-93.932 63.339-154.888 169.345-154.888 289.588 0 192.283 155.877 348.16 348.16 348.16 0.309 0 0.618 0 0.927-0.001h-0.048v-122.88zM277.914 537.907q0 17.818 20.48 17.818t20.48-17.818c0.024-0.344 0.038-0.745 0.038-1.15 0-4.734-1.89-9.027-4.956-12.165l0.003 0.003c-3.533-2.979-8.136-4.789-13.161-4.789-0.63 0-1.253 0.028-1.869 0.084l0.079-0.006q-21.094 0-21.094 18.022zM316.006 369.152h-36.454v133.939h36.659zM390.963 368.947h-36.454v186.778h36.659zM427.827 537.907q0 17.818 20.48 17.818t20.48-17.818c0.024-0.344 0.038-0.745 0.038-1.15 0-4.734-1.89-9.027-4.956-12.165l0.003 0.003c-3.533-2.979-8.136-4.789-13.161-4.789-0.63 0-1.253 0.028-1.869 0.084l0.079-0.006q-21.094 0-21.094 18.022zM465.92 369.152h-35.84v133.939h36.659zM558.899 366.080q-62.669 0-62.669 68.813c-0.112 1.517-0.176 3.287-0.176 5.071 0 18.008 6.492 34.5 17.264 47.262l-0.090-0.109c11.504 11.229 27.251 18.156 44.616 18.156 1.452 0 2.892-0.048 4.32-0.144l-0.194 0.010c0.164 0.001 0.357 0.002 0.551 0.002 14.696 0 28.597-3.402 40.958-9.461l-0.549 0.243-9.011-27.443q-8.602 3.482-16.179 5.734c-4.469 1.413-9.611 2.236-14.942 2.253h-0.009q-28.467 0-28.467-40.96t28.467-39.322c0.394-0.009 0.859-0.013 1.325-0.013 6.836 0 13.426 1.053 19.616 3.006l-0.461-0.126c6.87 2.249 12.839 5.237 18.262 8.962l-0.24-0.156v-31.334c-5.173-3.395-11.184-6.071-17.614-7.695l-0.409-0.087c-6.923-1.697-14.871-2.671-23.047-2.671-0.466 0-0.931 0.003-1.395 0.009l0.070-0.001zM752.64 436.326c0.082-1.289 0.129-2.795 0.129-4.311 0-17.949-6.559-34.365-17.412-46.984l0.080 0.095c-11.359-11.45-27.099-18.537-44.495-18.537-1.278 0-2.547 0.038-3.806 0.114l0.173-0.008c-0.416-0.009-0.906-0.014-1.397-0.014-11.964 0-23.2 3.118-32.939 8.586l0.339-0.175c-9.865 5.717-17.665 14.043-22.586 24.041l-0.147 0.331c-5.049 10.329-8.002 22.476-8.002 35.313 0 0.545 0.005 1.090 0.016 1.632l-0.001-0.081c-0.088 1.331-0.138 2.886-0.138 4.452 0 17.905 6.565 34.277 17.419 46.839l-0.077-0.091c11.402 11.337 27.119 18.345 44.473 18.345 1.358 0 2.706-0.043 4.043-0.127l-0.183 0.009c0.386 0.008 0.84 0.012 1.295 0.012 11.998 0 23.268-3.117 33.044-8.585l-0.343 0.176c9.848-5.656 17.644-13.913 22.586-23.841l0.147-0.326c4.927-10.221 7.806-22.224 7.806-34.9 0-0.691-0.009-1.379-0.026-2.066l0.002 0.102zM659.866 436.326c-0.044-0.833-0.069-1.808-0.069-2.789 0-9.7 2.452-18.827 6.77-26.795l-0.147 0.297c4.256-6.231 11.327-10.268 19.34-10.268 0.401 0 0.8 0.010 1.196 0.030l-0.056-0.002c0.404-0.025 0.876-0.040 1.351-0.040 7.954 0 14.962 4.048 19.077 10.197l0.052 0.083c4.075 7.663 6.469 16.756 6.469 26.408 0 1.301-0.043 2.592-0.129 3.871l0.009-0.173c0.072 1.055 0.112 2.287 0.112 3.529 0 9.662-2.469 18.748-6.811 26.66l0.145-0.288c-5.106 6.068-12.704 9.897-21.197 9.897s-16.091-3.829-21.162-9.855l-0.034-0.042c-3.28-6.858-5.197-14.907-5.197-23.403 0-2.58 0.177-5.119 0.519-7.605l-0.032 0.288zM581.837-64l-139.674 143.36 139.674 143.36v-122.88c0.017 0 0.037 0 0.058 0 192.283 0 348.16 155.877 348.16 348.16 0 120.242-60.955 226.247-153.651 288.801l-1.236 0.786 23.552 33.997c104.921-70.8 173.001-189.242 173.001-323.585 0-214.905-174.215-389.12-389.12-389.12-0.269 0-0.537 0-0.806 0.001h0.041z" /> +<glyph unicode="" glyph-name="synchro-icar" d="M581.837-64l-139.674 143.36 139.674 143.36v-122.88c0.017 0 0.037 0 0.058 0 192.283 0 348.16 155.877 348.16 348.16 0 120.242-60.955 226.247-153.651 288.801l-1.236 0.786 23.552 33.997c104.921-70.8 173.001-189.242 173.001-323.585 0-214.905-174.215-389.12-389.12-389.12-0.269 0-0.537 0-0.806 0.001h0.041zM581.837 816.64l-139.674 143.36v-122.88c-0.227 0-0.496 0.001-0.765 0.001-214.905 0-389.12-174.215-389.12-389.12 0-134.343 68.080-252.785 171.622-322.707l1.379-0.878 22.733 33.997c-93.932 63.339-154.888 169.345-154.888 289.588 0 192.283 155.877 348.16 348.16 348.16 0.309 0 0.618 0 0.927-0.001h-0.048v-122.88zM299.008 537.907q0 17.818 20.48 17.818t20.48-17.818c0.024-0.344 0.038-0.745 0.038-1.15 0-4.734-1.89-9.027-4.956-12.165l0.003 0.003c-3.533-2.979-8.136-4.789-13.161-4.789-0.63 0-1.253 0.028-1.869 0.084l0.079-0.006q-21.094 0-21.094 18.022zM337.101 369.152h-36.659v133.939h36.659zM430.080 366.080q-62.669 0-62.669 68.813c-0.112 1.517-0.176 3.287-0.176 5.071 0 18.008 6.492 34.5 17.264 47.262l-0.090-0.109c11.504 11.229 27.251 18.156 44.616 18.156 1.452 0 2.892-0.048 4.32-0.144l-0.194 0.010c0.164 0.001 0.357 0.002 0.551 0.002 14.696 0 28.597-3.402 40.958-9.461l-0.549 0.243-10.035-27.443q-8.602 3.482-16.179 5.734c-4.469 1.413-9.611 2.236-14.942 2.253h-0.009q-28.467 0-28.467-40.96t28.467-39.322c0.394-0.009 0.859-0.013 1.325-0.013 6.836 0 13.426 1.053 19.616 3.006l-0.461-0.126c6.704 2.019 12.546 4.737 17.897 8.157l-0.284-0.17v-31.334c-5.172-3.399-11.184-6.076-17.615-7.696l-0.407-0.087c-5.864-1.209-12.603-1.902-19.503-1.902-1.208 0-2.41 0.021-3.608 0.063l0.174-0.005zM586.957 368.947l-6.963 17.613c-5.005-6.763-11.38-12.222-18.745-16.037l-0.301-0.142c-6.763-2.787-14.615-4.405-22.844-4.405-1.258 0-2.506 0.038-3.745 0.112l0.17-0.008c-0.73-0.046-1.584-0.073-2.443-0.073-10.874 0-20.759 4.237-28.092 11.151l0.020-0.019c-6.917 7.519-11.157 17.595-11.157 28.662 0 1.013 0.035 2.017 0.105 3.012l-0.008-0.134c-0.059 0.767-0.093 1.66-0.093 2.562 0 11.93 5.896 22.483 14.934 28.903l0.109 0.074c12.294 7.103 27.043 11.294 42.77 11.294 0.804 0 1.605-0.011 2.404-0.033l-0.118 0.003h23.347v5.939c0.102 0.725 0.16 1.562 0.16 2.413 0 10.067-8.161 18.227-18.227 18.227-0.851 0-1.688-0.058-2.508-0.171l0.095 0.011c-13.895-0.602-26.841-4.090-38.44-9.875l0.552 0.249-12.083 24.781c14.51 7.621 31.702 12.093 49.939 12.093 0.515 0 1.030-0.004 1.544-0.011l-0.078 0.001c1.186 0.079 2.572 0.123 3.968 0.123 13.871 0 26.709-4.42 37.184-11.928l-0.192 0.131c8.901-7.985 14.475-19.523 14.475-32.364 0-1.223-0.051-2.435-0.15-3.633l0.010 0.157v-89.498zM576.102 430.387h-14.131c-0.493 0.019-1.072 0.030-1.653 0.030-8.119 0-15.739-2.138-22.328-5.882l0.224 0.117c-4.755-3.292-7.83-8.719-7.83-14.864 0-0.463 0.017-0.922 0.052-1.376l-0.004 0.060q0-15.565 17.818-15.565c0.442-0.025 0.96-0.039 1.48-0.039 7.339 0 14.019 2.817 19.019 7.429l-0.019-0.018c4.697 4.674 7.604 11.144 7.604 18.292 0 0.409-0.010 0.816-0.028 1.221l0.002-0.057zM725.197 505.754c0.379 0.009 0.825 0.014 1.273 0.014 3.896 0 7.703-0.378 11.388-1.098l-0.373 0.061-2.662-34.406c-3 0.786-6.444 1.238-9.994 1.238-0.303 0-0.605-0.003-0.906-0.010l0.045 0.001c-0.675 0.042-1.464 0.066-2.258 0.066-9.537 0-18.272-3.431-25.039-9.125l0.059 0.048c-6.098-5.925-9.882-14.203-9.882-23.365 0-0.642 0.019-1.28 0.055-1.913l-0.004 0.087v-68.198h-36.659v133.939h27.648l5.325-22.528h1.843c4.093 7.467 9.767 13.6 16.605 18.11l0.189 0.117c6.412 4.363 14.327 6.966 22.85 6.966 0.175 0 0.349-0.001 0.523-0.003h-0.026z" /> +<glyph unicode="" glyph-name="reseau" d="M977.51 251.597c26.584 59.488 42.066 128.918 42.066 201.963 0 103.349-30.993 199.459-84.191 279.543l1.165-1.865c8.182 11.447 13.082 25.728 13.082 41.153 0 39.362-31.909 71.27-71.27 71.27-12.124 0-23.54-3.027-33.535-8.367l0.383 0.187c-88.479 77.598-205.176 124.937-332.929 124.937-155.213 0-294.106-69.876-386.936-179.887l-0.621-0.756c-7.012 2.526-15.104 3.987-23.537 3.987-39.475 0-71.475-32.001-71.475-71.475 0-19.503 7.811-37.181 20.475-50.077l-0.010 0.011c-28.679-61.497-45.412-133.512-45.412-209.436 0-95.079 26.242-184.028 71.877-260.001l-1.275 2.288c-6.678-10.339-10.648-22.972-10.648-36.532 0-37.552 30.442-67.994 67.994-67.994 7.54 0 14.794 1.227 21.572 3.493l-0.48-0.139c91.659-91.687 218.299-148.399 358.186-148.399 160.251 0 303.119 74.426 395.924 190.597l0.783 1.014c6.094-2.102 13.12-3.368 20.426-3.481l0.054-0.001c0.141-0.001 0.308-0.002 0.475-0.002 37.891 0 68.608 30.717 68.608 68.608 0 19.37-8.027 36.864-20.936 49.34l-0.020 0.019zM940.851 270.029c-3.742 0.74-8.044 1.163-12.445 1.163-31.627 0-58.149-21.857-65.285-51.289l-0.094-0.459c-152.576 0-287.949 56.73-399.974 133.325 4.965 8.943 7.887 19.611 7.887 30.963 0 7.388-1.238 14.488-3.518 21.102l0.136-0.455 365.158 311.501c11.97-9.766 27.415-15.683 44.243-15.683 9.599 0 18.748 1.925 27.082 5.41l-0.464-0.172c46.912-71.411 74.829-158.943 74.829-252.995 0-65.983-13.74-128.756-38.515-185.615l1.165 3zM512 919.040c0.097 0 0.211 0 0.325 0 115.788 0 221.672-42.404 302.969-112.531l-0.599 0.505c-5.939-9.892-9.452-21.827-9.452-34.584 0-8.16 1.437-15.984 4.073-23.233l-0.15 0.473-364.954-311.501c-11.41 9.098-26.039 14.598-41.953 14.598-17.258 0-33.006-6.469-44.95-17.114l0.067 0.059c-75.968 67.814-143.303 142.429-202.013 223.686l-2.787 4.052c12.214 12.682 19.737 29.955 19.737 48.985 0 16.15-5.418 31.034-14.536 42.935l0.124-0.169c85.806 100.438 212.55 163.733 354.080 163.84h0.019zM86.221 642.355c4.797-1.221 10.304-1.921 15.974-1.921s11.177 0.7 16.439 2.020l-0.465-0.099c64.986-90.797 136.529-170.074 216.023-240.585l1.474-1.284c-1.426-5.076-2.245-10.906-2.245-16.926 0-12.023 3.268-23.282 8.964-32.938l-0.165 0.303-163.84-139.878c-11.916 10.631-27.72 17.127-45.041 17.127-9.626 0-18.783-2.006-27.076-5.623l0.437 0.17c-38.346 66.114-60.976 145.471-60.976 230.113 0 68.715 14.915 133.947 41.684 192.635l-1.188-2.907zM512-13.619c-0.055 0-0.12 0-0.186 0-125.876 0-240.057 50.071-323.713 131.383l0.11-0.106c8.961 11.164 14.382 25.504 14.382 41.109 0 6.14-0.839 12.083-2.409 17.722l0.11-0.464 171.622 146.432c8.912-4.75 19.49-7.539 30.72-7.539s21.808 2.79 31.079 7.713l-0.359-0.174c119.603-81.306 262.963-144.384 426.803-144.384h5.12c2.593-6.654 5.905-12.403 9.943-17.557l-0.112 0.149c-86.016-106.627-216.662-174.268-363.108-174.285h-0.003z" /> +<glyph unicode="" glyph-name="rapport-de-controle" d="M536.781 960h-467.763v-1002.496h527.565c-24.786 11.033-46.126 24.762-65.024 41.222l0.308-0.262h-421.888v920.576h397.312v-241.459h241.459v-234.496c15.787-3.204 29.504-7.303 42.682-12.474l-1.722 0.595v275.866zM548.25 890.573l172.032-172.032h-172.032zM210.33 619.008h437.862v-41.984h-437.862v41.984zM563.405 408.883h-353.075v-40.96h301.67c15.016 15.482 31.885 29.029 50.287 40.322l1.118 0.638zM210.33 304.64v-40.96h242.688c4.702 15.893 10.133 29.474 16.639 42.42l-0.665-1.46zM210.33 513.946h437.862v-41.984h-437.862v41.984zM698.982 407.040c118.763 0 215.040-96.277 215.040-215.040s-96.277-215.040-215.040-215.040c-118.763 0-215.040 96.277-215.040 215.040v0c0.117 118.716 96.324 214.923 215.029 215.040h0.011zM698.982 448c-141.385 0-256-114.615-256-256s114.615-256 256-256c141.385 0 256 114.615 256 256v0c0 141.385-114.615 256-256 256v0zM667.853 86.733c-5.799 0.023-11.026 2.452-14.738 6.341l-0.008 0.008-85.606 88.678c-3.557 3.681-5.749 8.701-5.749 14.234 0 11.319 9.176 20.495 20.495 20.495 5.787 0 11.013-2.398 14.74-6.255l0.006-0.006 70.042-72.499 119.603 136.806c3.784 4.313 9.307 7.021 15.462 7.021 11.343 0 20.538-9.195 20.538-20.538 0-5.187-1.923-9.925-5.095-13.54l0.020 0.023-134.144-153.6c-3.678-4.174-8.991-6.831-14.928-6.963h-0.023z" /> +<glyph unicode="" glyph-name="OAT" d="M1018.061 298.701l-125.952 125.952c-4.509 4.641-10.809 7.52-17.781 7.52-0.951 0-1.889-0.054-2.812-0.158l0.113 0.010c-14.131-2.048-20.48-14.336-28.467-28.672-5.72-11.506-12.549-21.411-20.572-30.208l0.092 0.102c-7.913-8.859-19.369-14.409-32.122-14.409-11.342 0-21.659 4.391-29.343 11.565l0.025-0.023c-6.865 7.041-11.1 16.675-11.1 27.298 0 0.627 0.015 1.251 0.044 1.871l-0.003-0.088c0.459 12.391 5.7 23.475 13.919 31.532l0.008 0.007c8.702 7.913 18.604 14.741 29.35 20.136l0.756 0.344c14.131 7.782 26.419 14.336 28.672 28.672 0.094 0.81 0.147 1.748 0.147 2.699 0 6.972-2.88 13.272-7.514 17.775l-0.006 0.006-124.928 125.542-111.821 111.821c14.183 7.172 26.383 15.775 37.153 25.883l-0.084-0.078c15.895 15.301 25.768 36.761 25.768 60.526 0 22.438-8.801 42.82-23.139 57.883l0.033-0.035c-14.404 14.341-34.269 23.206-56.205 23.206-1.121 0-2.236-0.023-3.346-0.069l0.159 0.005c-23.237-0.826-44.038-10.617-59.176-25.998l-0.011-0.011c-9.978-10.676-18.518-22.879-25.195-36.178l-0.405-0.89-111.616 111.616c-3.702 3.68-8.804 5.955-14.438 5.955s-10.737-2.275-14.439-5.956l-327.679-327.679c-3.68-3.702-5.955-8.804-5.955-14.438s2.275-10.737 5.956-14.439l655.359-655.359c3.702-3.68 8.804-5.955 14.438-5.955s10.737 2.275 14.439 5.956l327.679 327.679c3.68 3.702 5.955 8.804 5.955 14.438s-2.275 10.737-5.956 14.439l0.001-0.001zM348.16 910.438l111.206-111.206c4.509-4.641 10.809-7.52 17.781-7.52 0.951 0 1.889 0.054 2.812 0.158l-0.113-0.010c14.131 2.048 20.48 14.336 28.262 28.467 5.72 11.429 12.548 21.266 20.565 29.994l-0.085-0.093c8.064 8.227 19.148 13.467 31.455 13.924l0.084 0.002c0.556 0.028 1.208 0.045 1.863 0.045 10.599 0 20.208-4.237 27.225-11.11l-0.007 0.007c7.207-7.672 11.635-18.028 11.635-29.418 0-12.7-5.505-24.114-14.258-31.987l-0.039-0.035c-8.697-7.926-18.601-14.754-29.353-20.139l-0.752-0.341c-14.131-7.578-26.419-14.131-28.467-28.467-0.094-0.81-0.147-1.748-0.147-2.699 0-6.972 2.88-13.272 7.514-17.775l0.006-0.006 111.821-110.387-96.87-96.87c-7.241 14.336-15.911 26.669-26.095 37.57l0.085-0.092c-15.175 15.317-35.976 25.037-59.045 25.801l-0.142 0.004c-0.677 0.020-1.474 0.032-2.274 0.032-5.059 0-10.011-0.459-14.816-1.336l0.502 0.076c-2.048 0-3.891-1.229-5.939-1.638-3.827-0.81-7.052-1.728-10.186-2.835l0.561 0.173c-3.196-1.418-5.817-2.787-8.346-4.294l0.359 0.198c-2.048-1.229-4.506-2.048-6.349-3.277-2.516-1.849-4.719-3.661-6.819-5.584l0.060 0.055c-1.843-1.638-4.096-2.867-5.734-4.71v0c-14.096-14.361-22.797-34.060-22.797-55.791 0-1.122 0.023-2.239 0.069-3.351l-0.005 0.159c0.826-23.237 10.617-44.038 25.998-59.176l0.011-0.011c10.804-10.035 23.139-18.642 36.569-25.391l0.91-0.414-98.714-98.304-298.803 299.008zM675.84-14.438l-298.394 298.598 110.797 110.797c4.641 4.509 7.52 10.809 7.52 17.781 0 0.951-0.054 1.889-0.158 2.812l0.010-0.113c-2.048 14.336-14.541 20.48-28.672 28.467-11.504 5.728-21.408 12.557-30.21 20.574l0.104-0.094c-8.859 7.913-14.409 19.369-14.409 32.122 0 11.342 4.391 21.659 11.565 29.343l-0.023-0.025c7.305 6.857 17.163 11.069 28.004 11.069 0.307 0 0.613-0.003 0.918-0.010l-0.046 0.001c12.391-0.459 23.475-5.7 31.532-13.919l0.007-0.008c7.901-8.707 14.727-18.607 20.133-29.346l0.347-0.76c7.782-14.336 14.541-26.624 28.672-28.672 0.787-0.088 1.698-0.138 2.622-0.138 6.995 0 13.318 2.874 17.854 7.506l0.004 0.004 111.821 111.206 96.87-96.87c-14.259-7.241-26.525-15.91-37.357-26.087l0.083 0.078c-15.317-15.175-25.037-35.976-25.801-59.045l-0.004-0.142c-0.036-0.892-0.056-1.938-0.056-2.99 0-21.932 8.862-41.794 23.202-56.201l-0.003 0.003c14.978-14.069 35.195-22.713 57.432-22.713 23.873 0 45.419 9.963 60.708 25.958l0.030 0.032c10.045 10.74 18.65 23.009 25.395 36.377l0.41 0.896 97.894-97.894z" /> +<glyph unicode="" glyph-name="OAS" d="M1024 786.944v0c0.102 0.769 0.161 1.658 0.161 2.56s-0.058 1.791-0.172 2.663l0.011-0.103v1.638c-0.543 1.416-1.163 2.631-1.892 3.768l0.049-0.082v1.434c-1.188 1.483-2.535 2.766-4.036 3.85l-0.060 0.041c-1.702 1.208-3.676 2.186-5.794 2.829l-0.145 0.038-493.978 154.419c-1.807 0.578-3.885 0.911-6.042 0.911s-4.235-0.333-6.187-0.951l0.145 0.040-491.725-153.395c-1.951-0.631-3.647-1.465-5.193-2.504l0.073 0.046c-1.565-1.182-2.914-2.531-4.059-4.044l-0.037-0.052v-1.434c-0.753-1.063-1.438-2.275-1.997-3.554l-0.051-0.132v-1.638c-1.23-1.529-2.265-3.288-3.023-5.187l-0.049-0.138v-663.552c0-0.016 0-0.034 0-0.053 0-8.965 5.761-16.585 13.783-19.36l0.144-0.043 491.52-166.912c1.9-0.991 4.11-1.71 6.446-2.036l0.108-0.012c2.979 0.046 5.789 0.72 8.318 1.896l-0.126-0.053 489.882 166.093c8.166 2.818 13.926 10.438 13.926 19.403 0 0.019 0 0.037 0 0.056v-0.003 663.347zM512 919.040l425.165-133.12-110.182-37.069c-10.612-3.423-19.141-10.752-24.059-20.252l-0.108-0.228c-9.421-19.251-1.434-40.96 7.578-66.97 6.735-15.859 11.518-34.244 13.452-53.47l0.065-0.802c0.266-2.661 0.418-5.752 0.418-8.878 0-21.818-7.401-41.908-19.829-57.895l0.159 0.213c-7.007-7.22-16.801-11.701-27.642-11.701-0.506 0-1.010 0.010-1.512 0.029l0.072-0.002c-35.021 0-37.683 46.694-37.683 61.44 1.205 23.344 6.059 45.208 14.006 65.522l-0.489-1.419c7.578 22.733 13.312 40.96 0 53.453-5.866 4.359-13.251 6.978-21.248 6.978-6.247 0-12.122-1.598-17.236-4.409l0.186 0.094-201.114-68.813-130.867 44.442c43.622 11.674 95.232 27.034 95.232 71.066 0 35.84-31.949 59.187-81.92 59.187-37.951-2.214-72.007-17.288-98.246-40.885l0.146 0.13c-9.306-7.308-19.766-14.104-30.815-19.935l-1.134-0.545c-33.587-15.77-40.96-16.179-55.501-11.264l-73.318 25.6-48.742 16.589zM40.96 758.477l53.248-18.022 67.584-23.142 33.792-11.469c30.515-10.445 50.586-3.686 86.221 12.902 14.766 7.506 27.447 15.604 39.25 24.777l-0.543-0.406c19.79 18.314 45.69 30.283 74.321 32.536l0.431 0.027c1.638 0 40.96 0 40.96-18.227 0-14.131-45.056-26.214-69.222-32.563-22.672-4.119-42.85-12.348-60.638-23.938l0.631 0.386c-4.426-3.78-7.214-9.366-7.214-15.602 0-8.982 5.782-16.614 13.828-19.375l0.144-0.043 178.79-61.44v-209.306c-19.852 15.013-44.473 24.719-71.254 26.6l-0.426 0.024c-0.391 0.005-0.853 0.008-1.315 0.008-30.197 0-57.643-11.775-77.998-30.984l0.055 0.052c-15.44-15.359-24.996-36.622-24.996-60.116 0-0.466 0.004-0.931 0.011-1.394l-0.001 0.070c0-59.392 31.744-92.774 96.051-102.4 5.251-0.664 11.326-1.042 17.49-1.042 20.21 0 39.47 4.072 57.002 11.439l-0.97-0.362 5.939 2.048c0-2.253 0-4.915 0-8.602v0-245.76l-451.174 152.986zM983.040 138.138l-450.56-152.781v245.76c0.365 2.33 0.574 5.017 0.574 7.753 0 14.99-6.266 28.516-16.323 38.103l-0.021 0.020c-6.503 3.629-14.266 5.765-22.528 5.765s-16.025-2.136-22.767-5.887l0.239 0.122c-12.684-5.532-27.462-8.751-42.992-8.751-3.901 0-7.754 0.203-11.55 0.599l0.474-0.040c-50.586 7.373-61.44 29.286-61.44 61.44-0.011 0.359-0.017 0.782-0.017 1.206 0 11.965 4.773 22.816 12.518 30.752l-0.009-0.009c12.913 11.815 30.184 19.054 49.146 19.054 0.362 0 0.724-0.003 1.085-0.008l-0.055 0.001c22.378-3.426 42.162-12.605 58.367-25.968l-0.204 0.164c15.565-10.65 28.058-19.251 41.984-11.674 8.068 3.912 13.533 12.040 13.533 21.444 0 0.309-0.006 0.617-0.018 0.923l0.001-0.044v239.411l181.043 61.44c-8.811-22.683-14.422-48.919-15.549-76.312l-0.016-0.488c0-61.44 30.925-102.4 78.643-102.4 0.442-0.009 0.964-0.014 1.487-0.014 22.29 0 42.436 9.177 56.866 23.96l0.015 0.016c19.402 22.74 31.206 52.475 31.206 84.968 0 3.974-0.177 7.906-0.522 11.79l0.036-0.502c-1.983 24.524-7.67 47.199-16.517 68.217l0.543-1.452c-4.748 10.183-7.9 22.025-8.788 34.493l-0.018 0.323 142.131 48.538z" /> +<glyph unicode="" glyph-name="modele-calendrier" d="M190.464 803.738h43.213v-40.96h-43.213v40.96zM93.389 628.224h40.96v-61.44h-40.96v61.44zM93.389 730.624h40.96v-61.44h-40.96v61.44zM134.349 474.214v51.61h-40.96v-61.44h40.96v9.83zM93.389 116.224h40.96v-61.44h-40.96v61.44zM93.389 218.624h40.96v-61.44h-40.96v61.44zM93.389 423.424h40.96v-61.44h-40.96v61.44zM93.389 321.024h40.96v-61.44h-40.96v61.44zM276.48-8.909h61.44v-40.96h-61.44v40.96zM174.080-8.909h61.44v-40.96h-61.44v40.96zM378.88-8.909h61.44v-40.96h-61.44v40.96zM481.28-8.909h61.44v-40.96h-61.44v40.96zM583.68-8.909h61.44v-40.96h-61.44v40.96zM686.080-8.909h61.44v-40.96h-61.44v40.96zM788.48-8.909h61.44v-40.96h-61.44v40.96zM889.651 218.624h40.96v-61.44h-40.96v61.44zM889.651 116.224h40.96v-61.44h-40.96v61.44zM889.651 423.424h40.96v-61.44h-40.96v61.44zM889.651 321.024h40.96v-61.44h-40.96v61.44zM889.651 730.624h40.96v-61.44h-40.96v61.44zM889.651 525.005v-60.621h40.96v61.44h-40.96v-0.819zM889.651 628.224h40.96v-61.44h-40.96v61.44zM481.28 494.694h61.44v-40.96h-61.44v40.96zM174.080 494.694h61.44v-40.96h-61.44v40.96zM276.48 494.694h61.44v-40.96h-61.44v40.96zM686.080 494.694h61.44v-40.96h-61.44v40.96zM788.48 494.694h61.44v-40.96h-61.44v40.96zM583.68 494.694h61.44v-40.96h-61.44v40.96zM378.88 494.694h61.44v-40.96h-61.44v40.96zM710.246 743.526h40.96v-61.44h-40.96v61.44zM710.246 845.926h40.96v-61.44h-40.96v61.44zM313.754 682.086h-40.96v61.44h40.96zM313.754 784.486h-40.96v61.44h40.96zM136.192 750.899c3.97 6.299 10.504 10.672 18.101 11.66l0.127 0.013-4.915 40.96c-21.267-2.501-39.179-14.926-49.189-32.448l-0.168-0.32zM481.28 803.738h61.44v-40.96h-61.44v40.96zM378.88 803.738h61.44v-40.96h-61.44v40.96zM583.68 803.738h61.44v-40.96h-61.44v40.96zM790.323 803.738h43.213v-40.96h-43.213v40.96zM887.808 750.899c-3.97 6.299-10.504 10.672-18.101 11.66l-0.127 0.013 4.915 40.96c21.267-2.501 39.179-14.926 49.189-32.448l0.168-0.32zM710.246 948.326h40.96v-61.44h-40.96v61.44zM272.794 948.326h40.96v-61.44h-40.96v61.44zM143.36-4.403c-4.788 3.295-8.076 8.474-8.797 14.443l-0.010 0.098v3.686h-40.96c-0.057-0.963-0.089-2.090-0.089-3.224 0-20.354 10.455-38.266 26.288-48.659l0.22-0.136zM880.64-4.403c4.788 3.295 8.076 8.474 8.797 14.443l0.010 0.098v3.686h40.96c0.057-0.963 0.089-2.090 0.089-3.224 0-20.354-10.455-38.266-26.288-48.659l-0.22-0.136z" /> +<glyph unicode="" glyph-name="mission" d="M344.883 737.792l-17.203-59.392 62.874-17.408c-55.891-35.521-104.315-75.352-147.391-120.344l-0.269-0.283 43.827-42.803c41.083 43.148 87.186 80.915 137.535 112.545l2.958 1.734-20.48-71.68 59.187-16.384 46.49 168.141zM592.896 6.656c0-39.588-32.092-71.68-71.68-71.68s-71.68 32.092-71.68 71.68c0 39.588 32.092 71.68 71.68 71.68s71.68-32.092 71.68-71.68zM521.216 78.336c-39.588 0-71.68-32.092-71.68-71.68s32.092-71.68 71.68-71.68c39.588 0 71.68 32.092 71.68 71.68v0c0 39.588-32.092 71.68-71.68 71.68v0zM333.619 25.702c-28.662 12.576-53.144 26.267-76.132 41.983l1.585-1.023 23.347 33.587c19.57-13.754 41.889-26.542 65.367-37.227l2.627-1.070zM73.728 341.504c-5.080 25.685-7.988 55.216-7.988 85.426 0 0.208 0 0.415 0 0.623v-0.032h40.96c0.036-27.474 2.718-54.298 7.804-80.262l-0.431 2.643zM232.858 192.819c0-39.588-32.092-71.68-71.68-71.68s-71.68 32.092-71.68 71.68c0 39.588 32.092 71.68 71.68 71.68s71.68-32.092 71.68-71.68zM161.178 263.68c-39.588 0-71.68-32.092-71.68-71.68s32.092-71.68 71.68-71.68c39.588 0 71.68 32.092 71.68 71.68v0c0 39.588-32.092 71.68-71.68 71.68v0zM952.934 287.437c18.132 47.444 28.632 102.317 28.632 159.643 0 64.372-13.241 125.652-37.147 181.264l1.142-2.986c13.419 12.977 21.749 31.143 21.749 51.255 0 39.362-31.909 71.27-71.27 71.27-8.378 0-16.419-1.446-23.886-4.101l0.498 0.155c-70.037 82.835-167.769 140.329-278.759 158.166l-2.636 0.349c-2.074 9.484-5.766 17.855-10.808 25.23l0.158-0.245c-5.259 7.728-11.728 14.197-19.207 19.296l-0.249 0.16c-11.212 7.698-25.077 12.294-40.016 12.294-0.332 0-0.663-0.002-0.994-0.007l0.050 0.001c-34.154-0.253-62.606-24.354-69.546-56.462l-0.086-0.472c-138.318-22.577-254.211-103.458-323.454-216.094l-1.154-2.018c-3.814 0.759-8.199 1.194-12.686 1.194-9.858 0-19.226-2.098-27.682-5.872l0.432 0.172c-25.827-11.283-43.549-36.604-43.549-66.064 0-39.701 32.184-71.885 71.885-71.885s71.885 32.184 71.885 71.885c0 20.509-8.589 39.013-22.366 52.109l-0.031 0.029c63.709 102.142 167.215 174.376 288.298 195.225l2.518 0.359s0-1.434 0-2.048c11.145-25.94 36.456-43.784 65.94-43.827h0.006c0.281-0.004 0.612-0.006 0.944-0.006 14.939 0 28.804 4.596 40.259 12.452l-0.243-0.157c7.728 5.259 14.197 11.728 19.296 19.207l0.16 0.249c2.682 3.948 5.090 8.467 6.998 13.24l0.17 0.482c101.238-16.67 188.38-67.553 251.039-140.158l0.455-0.54c-9.753-12.040-15.657-27.544-15.657-44.428 0-9.991 2.068-19.5 5.799-28.121l-0.177 0.459c11.185-25.907 36.512-43.709 65.997-43.709 4.836 0 9.56 0.479 14.127 1.392l-0.457-0.076c19.767-46.851 31.254-101.32 31.254-158.471 0-51.163-9.205-100.175-26.050-145.472l0.94 2.886c-1.286 0.083-2.788 0.131-4.301 0.131s-3.015-0.048-4.505-0.141l0.204 0.010c-0.367 0.007-0.799 0.010-1.233 0.010-40.606 0-73.523-32.917-73.523-73.523s32.917-73.523 73.523-73.523c40.606 0 73.523 32.917 73.523 73.523 0 22.44-10.053 42.532-25.902 56.018l-0.104 0.086z" /> +<glyph unicode="" glyph-name="ligne_commerciale" d="M921.6 960h-819.2c-56.554 0-102.4-45.846-102.4-102.4v0-819.2c0-56.554 45.846-102.4 102.4-102.4v0h819.2c56.554 0 102.4 45.846 102.4 102.4v0 819.2c0 56.554-45.846 102.4-102.4 102.4v0zM565.453 278.221c47.452 1.66 92.195 11.209 133.631 27.368l-2.764-0.949v-90.931c-40.084-16.608-86.635-26.253-135.439-26.253-1.849 0-3.695 0.014-5.537 0.041l0.278-0.003q-111.616 0-170.803 67.789t-59.597 194.765c-0.049 2.078-0.077 4.526-0.077 6.981 0 48.212 10.748 93.913 29.978 134.839l-0.82-1.941c18.41 38.818 47.109 70.217 82.601 91.425l0.958 0.53c35.125 20.385 77.29 32.416 122.265 32.416 1.873 0 3.741-0.021 5.603-0.062l-0.278 0.005c54.657-0.612 106.081-13.859 151.675-36.948l-1.966 0.903-35.021-88.269c-15.061 7.462-34.135 15.484-53.693 22.488l-4.060 1.269c-16.98 6.327-36.596 10.066-57.063 10.239l-0.076 0.001c-1.246 0.050-2.709 0.079-4.178 0.079-36.983 0-69.726-18.153-89.805-46.036l-0.225-0.328c-21.292-32.696-33.954-72.707-33.954-115.675 0-4.408 0.133-8.785 0.396-13.127l-0.029 0.597q-0.614-171.213 128-171.213z" /> +<glyph unicode="" glyph-name="ligne_administrative" d="M921.6 960h-819.2c-56.554 0-102.4-45.846-102.4-102.4v0-819.2c0-56.554 45.846-102.4 102.4-102.4v0h819.2c56.554 0 102.4 45.846 102.4 102.4v0 819.2c0 56.554-45.846 102.4-102.4 102.4v0zM102.4-23.040c-33.932 0-61.44 27.508-61.44 61.44v0 819.2c0 33.932 27.508 61.44 61.44 61.44v0h819.2c33.932 0 61.44-27.508 61.44-61.44v0-819.2c0-33.932-27.508-61.44-61.44-61.44v0zM642.458 194.867l-37.069 121.856h-186.573l-37.069-121.856h-116.941l180.634 513.843h132.71l181.248-513.843zM579.379 407.040q-51.405 165.478-57.958 187.187t-9.421 35.021q-11.264-44.851-65.946-222.208z" /> +<glyph unicode="" glyph-name="LDA" d="M510.771-64c-282.77 0-512 229.23-512 512s229.23 512 512 512c282.77 0 512-229.23 512-512v0c0-282.77-229.23-512-512-512v0zM510.771 837.12c-214.905 0-389.12-174.215-389.12-389.12s174.215-389.12 389.12-389.12c214.905 0 389.12 174.215 389.12 389.12v0c0 214.905-174.215 389.12-389.12 389.12v0zM616.653 731.443c-23.824 33.267-62.351 54.688-105.882 54.688s-82.057-21.421-105.615-54.297l-0.266-0.391c-116.172-44.199-197.222-154.639-197.222-284.009 0-167.4 135.704-303.104 303.104-303.104s303.104 135.704 303.104 303.104c0 129.37-81.050 239.81-195.142 283.312l-2.080 0.697zM545.587 748.851c5.438-2.071 10.025-4.275 14.399-6.806l-0.473 0.253 2.048-1.024c4.507-2.73 8.386-5.5 12.043-8.529l-0.164 0.132 2.048-1.638c3.771-3.259 7.185-6.673 10.338-10.319l0.106-0.126 1.024-1.229c3.219-3.804 6.26-8.019 8.965-12.46l0.251-0.443c9.009-14.585 14.347-32.266 14.347-51.194 0-46.344-32.002-85.213-75.113-95.714l-0.674-0.139v-125.952c0-12.668-10.27-22.938-22.938-22.938s-22.938 10.27-22.938 22.938v0 125.747c-44.128 10.565-76.423 49.674-76.423 96.327 0 24.298 8.761 46.55 23.296 63.77l-0.121-0.147 1.024 1.229c3.26 3.771 6.674 7.185 10.319 10.338l0.126 0.106 2.048 1.638c3.492 2.896 7.371 5.666 11.443 8.15l0.435 0.247 2.048 1.024c13.841 8.242 30.52 13.114 48.337 13.114 12.527 0 24.492-2.409 35.457-6.788l-0.645 0.227zM510.976 380.211c29.634 0 53.658 24.023 53.658 53.658v0 20.48c27.443-10.445 45.875-28.058 45.875-48.742 0-32.154-44.442-58.368-99.533-58.368s-99.738 26.624-99.738 59.802c0 20.48 18.432 38.298 45.875 48.742v-20.48c-0.016-0.488-0.025-1.062-0.025-1.638 0-29.634 24.023-53.658 53.658-53.658 0.009 0 0.018 0 0.026 0h-0.001zM510.976 175.411c-0.337-0.002-0.735-0.002-1.133-0.002-150.32 0-272.179 121.859-272.179 272.179 0 104.729 59.15 195.643 145.866 241.157l1.494 0.714c-2.847-10.119-4.483-21.74-4.483-33.742 0-52.303 31.072-97.348 75.763-117.684l0.81-0.33v-50.381l-4.71-1.638c-44.237-14.95-70.861-44.646-70.861-79.462 0-50.79 55.91-89.088 130.253-89.088s130.253 38.298 130.253 89.088c0 34.611-26.419 64.307-70.861 79.462l-4.71 1.638v50.176c45.501 20.666 76.573 65.712 76.573 118.014 0 12.003-1.636 23.623-4.698 34.651l0.215-0.908c87.779-46.36 146.582-137.047 146.582-241.468 0-150.32-121.859-272.179-272.179-272.179-0.773 0-1.545 0.003-2.316 0.010l0.118-0.001z" /> +<glyph unicode="" glyph-name="jeux-de-donnees" d="M512-34.304l-482.304 482.304 482.304 482.304 161.587-161.178 2.253 6.554c9.971 20.297 22.001 37.758 36.19 53.204l-0.145-0.16c21.959 20.774 51.675 33.547 84.374 33.547 2.234 0 4.455-0.060 6.66-0.177l-0.308 0.013c34.426-0.938 65.025-16.562 85.886-40.806l0.13-0.154c20.245-21.611 32.679-50.754 32.679-82.802 0-32.882-13.090-62.707-34.343-84.547l0.027 0.027c-15.289-14.109-32.749-26.203-51.749-35.666l-1.295-0.584-6.144-3.277 166.502-166.298-180.019-180.224c-4.745-4.964-11.419-8.049-18.813-8.049-1.311 0-2.599 0.097-3.858 0.284l0.142-0.017c-16.179 2.458-24.371 17.613-35.635 38.502-8.399 18.002-18.531 33.507-30.524 47.356l0.214-0.252c-13.732 15.139-33.48 24.608-55.439 24.608-20.971 0-39.925-8.636-53.5-22.545l-0.015-0.015c-14.161-13.751-22.948-32.968-22.948-54.239 0-0.444 0.004-0.887 0.011-1.329l-0.001 0.067c0.098-22.48 9.235-42.807 23.962-57.549l-0.001 0.001c12.632-11.4 26.802-21.521 42.050-29.928l1.163-0.588c20.48-12.698 36.659-21.914 38.707-38.298 0.124-0.963 0.195-2.077 0.195-3.208 0-7.514-3.137-14.295-8.173-19.106l-0.010-0.010zM87.45 448l424.55-424.55 139.878 137.83-11.878 7.373c-19.452 10.737-36.246 22.897-51.385 36.827l0.185-0.168c-22.147 22.222-35.84 52.881-35.84 86.738 0 0.034 0 0.068 0 0.102v-0.005c0.136 32.656 13.589 62.144 35.206 83.335l0.019 0.019c21.003 21.332 50.194 34.548 82.473 34.548 33.277 0 63.273-14.047 84.382-36.535l0.058-0.062c14.704-16.045 27.284-34.386 37.079-54.342l0.605-1.364 4.915-9.011 138.854 139.264-149.094 148.685c-5.080 4.792-8.242 11.569-8.242 19.084 0 1.287 0.093 2.552 0.272 3.79l-0.017-0.141c2.253 15.77 16.998 23.757 35.43 33.792 16.592 8.179 30.876 17.948 43.58 29.431l-0.163-0.145c14.023 14.438 22.669 34.164 22.669 55.91s-8.646 41.473-22.688 55.93l0.019-0.019c-13.846 15.876-33.963 25.979-56.449 26.418l-0.076 0.001c-1.677 0.122-3.632 0.192-5.605 0.192-20.919 0-40.006-7.841-54.483-20.743l0.081 0.071c-11.525-12.98-21.384-27.818-29.008-43.921l-0.483-1.135c-10.035-18.637-17.818-33.382-33.587-35.635-1.038-0.144-2.237-0.227-3.455-0.227-7.919 0-15.024 3.484-19.867 9.003l-0.026 0.030-143.36 144.179z" /> +<glyph unicode="" glyph-name="jeux-de-controle" d="M597.811 448c-141.385 0-256-114.615-256-256s114.615-256 256-256c141.385 0 256 114.615 256 256v0c0 141.385-114.615 256-256 256v0zM597.811-23.040c-118.763 0-215.040 96.277-215.040 215.040s96.277 215.040 215.040 215.040c118.763 0 215.040-96.277 215.040-215.040v0c-0.117-118.716-96.324-214.923-215.029-215.040h-0.011zM1009.050 471.757l-162.611 161.997 7.987 4.301c21.47 10.68 39.939 23.523 56.27 38.644l-0.155-0.141c22.279 22.974 36.013 54.346 36.013 88.925 0 33.744-13.078 64.433-34.442 87.275l0.067-0.072c-22.091 25.622-54.317 41.98-90.381 42.801l-0.141 0.003c-2.19 0.134-4.749 0.21-7.326 0.21-34.182 0-65.23-13.42-88.162-35.28l0.051 0.049c-14.917-16.17-27.696-34.643-37.683-54.747l-0.615-1.368-4.301-8.192-157.696 157.491c-3.702 3.68-8.804 5.955-14.438 5.955s-10.737-2.275-14.439-5.956l0.001 0.001-482.099-483.328c-3.68-3.702-5.955-8.804-5.955-14.438s2.275-10.737 5.956-14.439l-0.001 0.001 345.498-344.678c-9.159 22.101-15.43 47.705-17.556 74.477l-0.057 0.889-284.467 283.853 453.632 454.246 154.214-155.034c4.904-5.199 11.84-8.436 19.532-8.436 1.273 0 2.526 0.089 3.752 0.26l-0.141-0.016c16.179 2.458 23.962 16.998 34.816 37.274 8.656 17.849 19.047 33.216 31.295 46.882l-0.166-0.188c15.793 14.879 37.134 24.023 60.611 24.023 1.156 0 2.307-0.022 3.452-0.066l-0.165 0.005c24.497-0.367 46.377-11.272 61.358-28.372l0.082-0.096c15.181-15.589 24.544-36.909 24.544-60.416s-9.363-44.827-24.562-60.435l0.019 0.019c-13.427-12.136-28.723-22.588-45.32-30.81l-1.17-0.524c-20.48-10.854-34.816-18.842-37.069-35.021-0.148-1.053-0.232-2.27-0.232-3.506 0-7.658 3.233-14.561 8.41-19.418l0.014-0.013 159.539-159.13-143.36-143.36c6.302-11.528 12.194-25.071 16.889-39.162l0.519-1.798 168.55 169.37c4.378 3.778 7.132 9.334 7.132 15.533 0 5.4-2.090 10.312-5.505 13.97l0.011-0.012zM566.682 87.142c-5.799 0.023-11.026 2.452-14.738 6.341l-0.008 0.008-85.606 88.269c-3.557 3.681-5.749 8.701-5.749 14.234 0 11.319 9.176 20.495 20.495 20.495 5.787 0 11.013-2.398 14.74-6.255l0.006-0.006 70.042-72.499 119.603 136.806c3.805 4.426 9.411 7.211 15.667 7.211 11.391 0 20.625-9.234 20.625-20.625 0-5.135-1.876-9.832-4.981-13.442l0.023 0.027-134.144-153.6c-3.678-4.174-8.991-6.831-14.928-6.963h-0.023z" /> +<glyph unicode="" glyph-name="itl" d="M958.054 287.642c18.122 47.443 28.617 102.315 28.617 159.638 0 64.372-13.235 125.654-37.132 181.271l1.142-2.989c13.282 13.021 21.516 31.15 21.516 51.201 0 39.588-32.092 71.68-71.68 71.68-0.148 0-0.296 0-0.444-0.001h0.023c-7.957-0.123-15.543-1.538-22.614-4.044l0.496 0.153c-70.137 82.717-167.943 140.079-278.977 157.761l-2.623 0.344c-7.254 32.506-35.853 56.442-70.042 56.442s-62.787-23.936-69.952-55.964l-0.090-0.478c-135.004-21.385-248.625-98.727-318.18-207.060l-1.103-1.836c-5.207 1.178-11.188 1.853-17.325 1.853-45.243 0-81.92-36.677-81.92-81.92 0-28.864 14.928-54.241 37.485-68.833l0.321-0.194c-6.72-29.308-10.572-62.963-10.572-97.518 0-71.069 16.291-138.333 45.343-198.26l-1.185 2.709c-14.18-14.707-22.916-34.747-22.916-56.828 0-45.243 36.677-81.92 81.92-81.92 12.397 0 24.151 2.754 34.683 7.683l-0.503-0.211c66.833-66.398 153.998-112.405 251.338-127.863l2.614-0.342c7.028-32.914 35.862-57.239 70.377-57.239 39.701 0 71.885 32.184 71.885 71.885s-32.184 71.885-71.885 71.885c-30.229 0-56.1-18.659-66.724-45.087l-0.172-0.484c-88.483 14.724-165.626 55.364-225.36 113.742l0.080-0.078c8.895 12.911 14.207 28.888 14.207 46.106 0 45.243-36.677 81.92-81.92 81.92-7.678 0-15.109-1.056-22.156-3.031l0.577 0.138c-24.691 51.022-39.122 110.966-39.122 174.281 0 30.547 3.359 60.309 9.728 88.938l-0.507-2.713h3.891c0.148-0.001 0.323-0.002 0.498-0.002 45.243 0 81.92 36.677 81.92 81.92 0 24.427-10.691 46.357-27.65 61.366l-0.087 0.075c64.055 98.243 165.816 167.32 284.28 186.855l2.44 0.332c10.705-26.821 36.459-45.428 66.56-45.428s55.855 18.607 66.39 44.946l0.17 0.482c100.98-17.46 187.671-68.923 249.771-141.945l0.494-0.596c-9.562-12.045-15.34-27.47-15.34-44.244 0-39.475 32.001-71.475 71.475-71.475 0.353 0 0.705 0.003 1.057 0.008l-0.053-0.001c0.015 0 0.033 0 0.051 0 5.056 0 9.99 0.522 14.752 1.515l-0.467-0.081c19.478-46.54 30.793-100.619 30.793-157.342 0-51.738-9.414-101.278-26.622-146.999l0.949 2.876c-1.286 0.083-2.788 0.131-4.301 0.131s-3.015-0.048-4.505-0.141l0.204 0.010c-39.588 0-71.68-32.092-71.68-71.68v0 0c-0.008-0.395-0.012-0.86-0.012-1.327 0-39.814 32.276-72.090 72.090-72.090s72.090 32.276 72.090 72.090c0 22.325-10.148 42.28-26.083 55.503l-0.119 0.096zM227.738 193.024c0-33.932-27.508-61.44-61.44-61.44s-61.44 27.508-61.44 61.44c0 33.932 27.508 61.44 61.44 61.44v0c33.932 0 61.44-27.508 61.44-61.44v0zM180.634 613.888c0-33.932-27.508-61.44-61.44-61.44s-61.44 27.508-61.44 61.44c0 33.932 27.508 61.44 61.44 61.44v0c33.932 0 61.44-27.508 61.44-61.44v0zM525.926 673.28c-124.419 0-225.28-100.861-225.28-225.28s100.861-225.28 225.28-225.28c124.419 0 225.28 100.861 225.28 225.28v0c0 124.419-100.861 225.28-225.28 225.28v0zM525.926 263.68c-101.797 0-184.32 82.523-184.32 184.32s82.523 184.32 184.32 184.32c101.797 0 184.32-82.523 184.32-184.32v0c0.003-0.365 0.004-0.797 0.004-1.229 0-101.797-82.523-184.32-184.32-184.32-0.001 0-0.003 0-0.004 0v0zM405.914 486.912h240.026v-79.258h-240.026v79.258z" /> +<glyph unicode="" glyph-name="itineraire" d="M966.042 274.125c-3.801 5.452-8.124 10.165-12.995 14.244l-0.112 0.092c18.122 47.443 28.617 102.315 28.617 159.638 0 64.372-13.235 125.654-37.132 181.271l1.142-2.989c13.419 12.977 21.749 31.143 21.749 51.255 0 39.362-31.909 71.27-71.27 71.27-8.378 0-16.419-1.446-23.886-4.101l0.498 0.155c-70.037 82.835-167.769 140.329-278.759 158.166l-2.636 0.349c-2.074 9.484-5.766 17.855-10.808 25.23l0.158-0.245c-5.218 7.635-11.617 14.033-19.005 19.092l-0.247 0.159c-11.212 7.698-25.077 12.294-40.016 12.294-0.332 0-0.663-0.002-0.994-0.007l0.050 0.001c-34.155-0.028-62.702-24.010-69.749-56.051l-0.087-0.474c-138.515-22.176-254.573-103.274-323.455-216.281l-1.153-2.035c-3.778 0.747-8.123 1.175-12.567 1.175-9.827 0-19.165-2.091-27.595-5.852l0.431 0.172c-25.899-11.189-43.695-36.512-43.695-65.991 0-24.202 11.994-45.602 30.363-58.581l0.225-0.151c-8.163-32.383-12.847-69.56-12.847-107.83 0-74.679 17.836-145.192 49.481-207.511l-1.203 2.612c-11.866-12.696-19.153-29.804-19.153-48.613 0-10.032 2.073-19.58 5.814-28.24l-0.178 0.462c11.081-25.999 36.42-43.894 65.939-43.894 10.375 0 20.235 2.211 29.132 6.187l-0.454-0.181c67.716-70.683 157.509-119.73 258.272-136.044l2.643-0.353c6.969-32.512 35.461-56.533 69.564-56.533 0.384 0 0.767 0.003 1.15 0.009l-0.058-0.001c0.281-0.004 0.612-0.006 0.944-0.006 14.939 0 28.804 4.596 40.259 12.452l-0.243-0.157c7.728 5.259 14.197 11.728 19.296 19.207l0.16 0.249c7.656 11.232 12.225 25.102 12.225 40.038s-4.568 28.806-12.384 40.287l0.16-0.249c-5.259 7.728-11.728 14.197-19.207 19.296l-0.249 0.16c-11.212 7.698-25.077 12.294-40.016 12.294-0.332 0-0.663-0.002-0.994-0.007l0.050 0.001c-0.037 0-0.081 0-0.125 0-30.078 0-55.804-18.632-66.266-44.984l-0.169-0.482c-92.341 15.058-172.625 58.425-233.603 120.756l-0.074 0.076c7.513 11.137 11.992 24.86 11.992 39.629s-4.479 28.492-12.154 39.884l0.162-0.255c-5.259 7.728-11.728 14.197-19.207 19.296l-0.249 0.16c-11.212 7.698-25.077 12.294-40.016 12.294-0.332 0-0.663-0.002-0.994-0.007l0.050 0.001c-6.135-0.052-12.055-0.871-17.7-2.365l0.497 0.112c-26.921 53.265-42.688 116.111-42.688 182.64 0 34.396 4.214 67.808 12.155 99.747l-0.596-2.835h1.843c39.256 0.288 70.968 32.177 70.968 71.473 0 20.172-8.356 38.392-21.796 51.387l-0.020 0.019c63.41 102.775 167.346 175.348 288.976 195.655l2.455 0.339v-1.638c11.158-25.971 36.517-43.829 66.048-43.829 0.18 0 0.36 0.001 0.54 0.002h-0.028c0.281-0.004 0.612-0.006 0.944-0.006 14.939 0 28.804 4.596 40.259 12.452l-0.243-0.157c7.728 5.259 14.197 11.728 19.296 19.207l0.16 0.249c2.682 3.948 5.090 8.467 6.998 13.24l0.17 0.482c101.026-16.869 187.935-67.795 250.419-140.354l0.461-0.548c-9.791-12.103-15.719-27.684-15.719-44.649 0-39.362 31.909-71.27 71.27-71.27 0.198 0 0.396 0.001 0.594 0.002h-0.030c0.015 0 0.033 0 0.051 0 5.056 0 9.99 0.522 14.752 1.515l-0.467-0.081c19.62-46.693 31.019-100.964 31.019-157.897 0-51.76-9.422-101.32-26.644-147.058l0.95 2.875c-1.286 0.083-2.788 0.131-4.301 0.131s-3.015-0.048-4.505-0.141l0.204 0.010c-39.588 0-71.68-32.092-71.68-71.68v0 0c0-39.588 32.092-71.68 71.68-71.68s71.68 32.092 71.68 71.68v0 0c0.003 0.253 0.005 0.551 0.005 0.85 0 15.066-4.675 29.040-12.653 40.55l0.155-0.236zM346.522 738.816l-16.384-59.187 62.874-17.408c-55.726-35.538-104.014-75.364-146.969-120.329l-0.282-0.298 43.827-43.008c40.758 42.703 86.451 80.126 136.318 111.523l2.946 1.731-20.48-71.68 59.187-16.384 46.49 168.141z" /> +<glyph unicode="" glyph-name="importer" d="M953.754 216.986c-12.448 125.912-114.58 224.369-241.035 230.988l-0.629 0.026c-4.301 0-8.602 0-13.107 0-141.385 0-256-114.615-256-256s114.615-256 256-256c141.385 0 256 114.615 256 256v0c0 8.397-0.41 16.794-1.229 24.986zM698.982-23.040c-118.763 0-215.040 96.277-215.040 215.040s96.277 215.040 215.040 215.040c118.763 0 215.040-96.277 215.040-215.040v0c-0.117-118.716-96.324-214.923-215.029-215.040h-0.011zM731.136 309.555c-3.723 3.8-8.908 6.157-14.643 6.157-11.318 0-20.493-9.175-20.493-20.493 0-5.582 2.232-10.644 5.853-14.339l65.533-67.171h-187.802c-11.311 0-20.48-9.169-20.48-20.48s9.169-20.48 20.48-20.48v0h187.802l-65.536-67.174c-3.617-3.692-5.849-8.754-5.849-14.336 0-11.318 9.175-20.493 20.493-20.493 5.735 0 10.92 2.356 14.64 6.153l0.003 0.003 113.254 116.326zM536.781 960h-467.763v-1002.496h527.565c-24.786 11.033-46.126 24.762-65.024 41.222l0.308-0.262h-421.888v920.576h397.312v-241.459h241.459v-234.496c15.786-3.202 29.503-7.302 42.681-12.473l-1.721 0.595v275.866zM548.25 890.573l172.032-172.032h-172.032z" /> +<glyph unicode="" glyph-name="horaires-des-courses" d="M512 919.040c260.148 0 471.040-210.892 471.040-471.040s-210.892-471.040-471.040-471.040c-260.148 0-471.040 210.892-471.040 471.040v0c0 260.148 210.892 471.040 471.040 471.040v0zM512 960c-282.77 0-512-229.23-512-512s229.23-512 512-512c282.77 0 512 229.23 512 512v0c0 282.77-229.23 512-512 512v0zM761.651 468.48h-177.971c-7.25 24.808-26.392 43.95-50.673 51.068l-0.527 0.132v266.24h-40.96v-266.24c-31.737-9.111-54.567-37.877-54.567-71.975 0-41.284 33.468-74.752 74.752-74.752 34.098 0 62.864 22.831 71.845 54.040l0.13 0.528h177.971z" /> +<glyph unicode="" glyph-name="calendrier-application" d="M314.573 660.582c11.311 0 20.48 9.169 20.48 20.48v0 244.326c0 11.311-9.169 20.48-20.48 20.48s-20.48-9.169-20.48-20.48v0-244.326c0-11.311 9.169-20.48 20.48-20.48v0zM376.013 803.738h270.746v-40.96h-270.746v40.96zM707.994 660.582c11.311 0 20.48 9.169 20.48 20.48v0 244.326c0 11.311-9.169 20.48-20.48 20.48s-20.48-9.169-20.48-20.48v0-244.326c0-11.311 9.169-20.48 20.48-20.48v0zM930.611 494.694v0 249.242c-1.563 33.365-28.994 59.825-62.604 59.825-0.599 0-1.196-0.008-1.79-0.025l0.087 0.002h-96.87v-40.96h96.87c0.438 0.031 0.95 0.049 1.466 0.049 11.077 0 20.251-8.142 21.866-18.768l0.015-0.123v-249.242h-755.302v249.242c1.63 10.748 10.805 18.89 21.882 18.89 0.516 0 1.027-0.018 1.534-0.052l-0.068 0.004h95.437v40.96h-95.437c-0.507 0.015-1.104 0.023-1.703 0.023-33.611 0-61.041-26.459-62.599-59.685l-0.005-0.14v-734.003c1.563-33.365 28.994-59.825 62.604-59.825 0.599 0 1.196 0.008 1.79 0.025l-0.087-0.002h708.608c0.507-0.015 1.104-0.023 1.703-0.023 33.611 0 61.041 26.459 62.599 59.685l0.005 0.14v443.802zM889.651 438.17v-428.032c-1.63-10.748-10.805-18.89-21.882-18.89-0.516 0-1.027 0.018-1.534 0.052l0.068-0.004h-708.608c-0.438-0.031-0.95-0.049-1.466-0.049-11.077 0-20.251 8.142-21.866 18.768l-0.015 0.123v443.597h755.302z" /> +<glyph unicode="" glyph-name="arret" d="M921.6 960h-819.2c-56.554 0-102.4-45.846-102.4-102.4v0-819.2c0-56.554 45.846-102.4 102.4-102.4v0h819.2c56.554 0 102.4 45.846 102.4 102.4v0 819.2c0 56.554-45.846 102.4-102.4 102.4v0zM102.4-23.040c-33.932 0-61.44 27.508-61.44 61.44v0 221.184c60.305 19.387 129.686 30.612 201.674 30.72h0.054c0.213 0 0.465 0 0.716 0 38.796 0 77.035-2.381 114.58-7.006l-4.5 0.452c6.144-40.96 64.102-72.294 134.758-72.294 0.656-0.008 1.431-0.012 2.207-0.012 27.309 0 53.369 5.345 77.192 15.046l-1.37-0.493c156.058-70.656 234.086-183.091 257.638-249.037zM488.243 259.789c17.192 0 31.13 13.937 31.13 31.13v0 58.573c51.814-7.987 86.016-34.406 86.016-58.573 0-28.877-48.128-61.44-117.146-61.44s-117.146 32.358-117.146 61.44c0 24.371 34.202 50.79 86.016 58.573v-58.573c0-17.192 13.937-31.13 31.13-31.13v0zM983.040 38.4c0-33.932-27.508-61.44-61.44-61.44v0h-28.058c-20.48 84.378-107.52 212.992-273.203 296.96v0c2.010 5.035 3.206 10.867 3.277 16.969v0.029c0 37.478-44.442 68.813-104.243 77.21v131.277c60.423 14.435 104.653 67.973 104.653 131.841 0 74.764-60.608 135.373-135.373 135.373s-135.373-60.608-135.373-135.373c0-63.868 44.23-117.406 103.731-131.655l0.922-0.186v-131.482c-25.035-3.073-47.693-10.979-67.796-22.771l0.827 0.448c-43.823 7.040-94.344 11.062-145.805 11.062-0.796 0-1.593-0.001-2.389-0.003h0.123c-0.615 0.002-1.344 0.003-2.072 0.003-71.124 0-139.943-9.871-205.161-28.318l5.3 1.281v527.974c0 33.932 27.508 61.44 61.44 61.44v0h819.2c33.932 0 61.44-27.508 61.44-61.44v0z" /> +<glyph unicode="" glyph-name="Acces" d="M631.194 810.701l-36.864-35.84 117.35-121.242h-352.461v-51.405h352.461l-117.35-121.446 36.864-35.635 176.947 182.682-176.947 182.886zM685.261 293.99h-373.146l117.555 121.242-36.864 35.635-176.947-182.682 176.947-182.682 36.864 35.635-117.555 121.446h373.146v51.405zM880.64-64h-737.28c-79.176 0-143.36 64.184-143.36 143.36v0 737.28c0 79.176 64.184 143.36 143.36 143.36v0h737.28c79.176 0 143.36-64.184 143.36-143.36v0-737.28c0-79.176-64.184-143.36-143.36-143.36v0zM143.36 919.040c-56.554 0-102.4-45.846-102.4-102.4v0-737.28c0-56.554 45.846-102.4 102.4-102.4v0h737.28c56.554 0 102.4 45.846 102.4 102.4v0 737.28c0 56.554-45.846 102.4-102.4 102.4v0z" /> +<glyph unicode="" glyph-name="ligne" d="M966.042 274.125c-3.801 5.452-8.124 10.165-12.995 14.244l-0.112 0.092c18.122 47.443 28.617 102.315 28.617 159.638 0 64.372-13.235 125.654-37.132 181.271l1.142-2.989c13.419 12.977 21.749 31.143 21.749 51.255 0 39.362-31.909 71.27-71.27 71.27-8.378 0-16.419-1.446-23.886-4.101l0.498 0.155c-70.037 82.835-167.769 140.329-278.759 158.166l-2.636 0.349c-2.074 9.484-5.766 17.855-10.808 25.23l0.158-0.245c-5.218 7.635-11.617 14.033-19.005 19.092l-0.247 0.159c-11.212 7.698-25.077 12.294-40.016 12.294-0.332 0-0.663-0.002-0.994-0.007l0.050 0.001c-34.155-0.028-62.702-24.010-69.749-56.051l-0.087-0.474c-138.515-22.176-254.573-103.274-323.455-216.281l-1.153-2.035c-3.778 0.747-8.123 1.175-12.567 1.175-9.827 0-19.165-2.091-27.595-5.852l0.431 0.172c-25.899-11.189-43.695-36.512-43.695-65.991 0-24.202 11.994-45.602 30.363-58.581l0.225-0.151c-8.163-32.383-12.847-69.56-12.847-107.83 0-74.679 17.836-145.192 49.481-207.511l-1.203 2.612c-11.866-12.696-19.153-29.804-19.153-48.613 0-10.032 2.073-19.58 5.814-28.24l-0.178 0.462c11.081-25.999 36.42-43.894 65.939-43.894 10.375 0 20.235 2.211 29.132 6.187l-0.454-0.181c67.716-70.683 157.509-119.73 258.272-136.044l2.643-0.353c6.969-32.512 35.461-56.533 69.564-56.533 0.384 0 0.767 0.003 1.15 0.009l-0.058-0.001c0.281-0.004 0.612-0.006 0.944-0.006 14.939 0 28.804 4.596 40.259 12.452l-0.243-0.157c7.728 5.259 14.197 11.728 19.296 19.207l0.16 0.249c7.656 11.232 12.225 25.102 12.225 40.038s-4.568 28.806-12.384 40.287l0.16-0.249c-5.259 7.728-11.728 14.197-19.207 19.296l-0.249 0.16c-11.212 7.698-25.077 12.294-40.016 12.294-0.332 0-0.663-0.002-0.994-0.007l0.050 0.001c-0.037 0-0.081 0-0.125 0-30.078 0-55.804-18.632-66.266-44.984l-0.169-0.482c-92.341 15.058-172.625 58.425-233.603 120.756l-0.074 0.076c7.513 11.137 11.992 24.86 11.992 39.629s-4.479 28.492-12.154 39.884l0.162-0.255c-5.259 7.728-11.728 14.197-19.207 19.296l-0.249 0.16c-11.212 7.698-25.077 12.294-40.016 12.294-0.332 0-0.663-0.002-0.994-0.007l0.050 0.001c-6.135-0.052-12.055-0.871-17.7-2.365l0.497 0.112c-26.921 53.265-42.688 116.111-42.688 182.64 0 34.396 4.214 67.808 12.155 99.747l-0.596-2.835h1.843c39.256 0.288 70.968 32.177 70.968 71.473 0 20.172-8.356 38.392-21.796 51.387l-0.020 0.019c63.41 102.775 167.346 175.348 288.976 195.655l2.455 0.339v-1.638c11.158-25.971 36.517-43.829 66.048-43.829 0.18 0 0.36 0.001 0.54 0.002h-0.028c0.281-0.004 0.612-0.006 0.944-0.006 14.939 0 28.804 4.596 40.259 12.452l-0.243-0.157c7.728 5.259 14.197 11.728 19.296 19.207l0.16 0.249c2.682 3.948 5.090 8.467 6.998 13.24l0.17 0.482c101.026-16.869 187.935-67.795 250.419-140.354l0.461-0.548c-9.791-12.103-15.719-27.684-15.719-44.649 0-39.362 31.909-71.27 71.27-71.27 0.198 0 0.396 0.001 0.594 0.002h-0.030c0.015 0 0.033 0 0.051 0 5.056 0 9.99 0.522 14.752 1.515l-0.467-0.081c19.62-46.693 31.019-100.964 31.019-157.897 0-51.76-9.422-101.32-26.644-147.058l0.95 2.875c-1.286 0.083-2.788 0.131-4.301 0.131s-3.015-0.048-4.505-0.141l0.204 0.010c-39.588 0-71.68-32.092-71.68-71.68v0 0c0-39.588 32.092-71.68 71.68-71.68s71.68 32.092 71.68 71.68v0 0c0.003 0.253 0.005 0.551 0.005 0.85 0 15.066-4.675 29.040-12.653 40.55l0.155-0.236z" /> </font></defs></svg>
\ No newline at end of file diff --git a/app/assets/fonts/sBoiv/sboiv.ttf b/app/assets/fonts/sBoiv/sboiv.ttf Binary files differindex 21c79549a..d6b4d8441 100644 --- a/app/assets/fonts/sBoiv/sboiv.ttf +++ b/app/assets/fonts/sBoiv/sboiv.ttf diff --git a/app/assets/fonts/sBoiv/sboiv.woff b/app/assets/fonts/sBoiv/sboiv.woff Binary files differindex fa2e097d7..8e10ad072 100644 --- a/app/assets/fonts/sBoiv/sboiv.woff +++ b/app/assets/fonts/sBoiv/sboiv.woff diff --git a/app/assets/javascripts/es6_browserified/itineraries/index.js b/app/assets/javascripts/es6_browserified/itineraries/index.js index a8f3048fa..ad32b9519 100644 --- a/app/assets/javascripts/es6_browserified/itineraries/index.js +++ b/app/assets/javascripts/es6_browserified/itineraries/index.js @@ -69,28 +69,15 @@ document.querySelector('input[name=commit]').addEventListener('click', (event)=> if(state.stopPoints.length >= 2) { state.stopPoints.map((stopPoint, i) => { - addInput('id', (datas[i]) ? datas[i].stoppoint_id : '', i) + addInput('id', stopPoint.stoppoint_id ? stopPoint.stoppoint_id : '', i) addInput('stop_area_id',stopPoint.stoparea_id, i) addInput('position',i, i) addInput('for_boarding',stopPoint.for_boarding, i) addInput('for_alighting',stopPoint.for_alighting, i) }) - if(state.stopPoints.length < datas.length){ - for(var j= state.stopPoints.length; j < datas.length; j++){ - updateFormForDeletion(datas[j]) - } - } } else { event.preventDefault() let msg = "L'itinéraire doit comporter au moins deux arrêts" $('#stop_points').find('.subform').after("<div class='alert alert-danger'><span class='fa fa-lg fa-exclamation-circle'></span><span>" + msg + "</span></div>") } }) - -const updateFormForDeletion = (stop) =>{ - if (stop.stoppoint_id !== undefined){ - let now = Date.now() - addInput('id', stop.stoppoint_id, now) - addInput('_destroy', 'true', now) - } -} diff --git a/app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js b/app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js index 24c3e5d87..a3b8accb3 100644 --- a/app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js +++ b/app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js @@ -20,6 +20,14 @@ const stopPoint = (state = {}, action, length) => { } } +const updateFormForDeletion = (stop) =>{ + if (stop.stoppoint_id !== undefined){ + let now = Date.now() + addInput('id', stop.stoppoint_id, now) + addInput('_destroy', 'true', now) + } +} + const stopPoints = (state = [], action) => { switch (action.type) { case 'ADD_STOP': @@ -30,18 +38,19 @@ const stopPoints = (state = [], action) => { case 'MOVE_STOP_UP': return [ ...state.slice(0, action.index - 1), - state[action.index], - state[action.index - 1], + _.assign({}, state[action.index], { stoppoint_id: state[action.index - 1].stoppoint_id }), + _.assign({}, state[action.index - 1], { stoppoint_id: state[action.index].stoppoint_id }), ...state.slice(action.index + 1) ] case 'MOVE_STOP_DOWN': return [ ...state.slice(0, action.index), - state[action.index + 1], - state[action.index], + _.assign({}, state[action.index + 1], { stoppoint_id: state[action.index].stoppoint_id }), + _.assign({}, state[action.index], { stoppoint_id: state[action.index + 1].stoppoint_id }), ...state.slice(action.index + 2) ] case 'DELETE_STOP': + updateFormForDeletion(state[action.index]) return [ ...state.slice(0, action.index), ...state.slice(action.index + 1).map((stopPoint)=>{ @@ -56,7 +65,7 @@ const stopPoints = (state = [], action) => { {}, t, { - stoppoint_id: "", + stoppoint_id: t.stoppoint_id, text: action.text.text, stoparea_id: action.text.stoparea_id, user_objectid: action.text.user_objectid, diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/actions/index.js b/app/assets/javascripts/es6_browserified/journey_patterns/actions/index.js index 0ed961f44..3577df2b6 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/actions/index.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/actions/index.js @@ -6,6 +6,12 @@ if (!window.Promise) { } const actions = { + enterEditMode: () => ({ + type: "ENTER_EDIT_MODE" + }), + exitEditMode: () => ({ + type: "EXIT_EDIT_MODE" + }), receiveJourneyPatterns : (json) => ({ type: "RECEIVE_JOURNEY_PATTERNS", json @@ -138,6 +144,7 @@ const actions = { dispatch(actions.updateTotalCount(window.currentItemsLength - json.length)) } window.currentItemsLength = json.length + dispatch(actions.exitEditMode()) dispatch(actions.receiveJourneyPatterns(json)) } } diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/components/CreateModal.js b/app/assets/javascripts/es6_browserified/journey_patterns/components/CreateModal.js index b446e2b37..12871431a 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/components/CreateModal.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/components/CreateModal.js @@ -17,7 +17,7 @@ class CreateModal extends Component { } render() { - if(this.props.status.isFetching == true || this.props.status.policy['journey_patterns.update'] == false) { + if(this.props.status.isFetching == true || this.props.status.policy['journey_patterns.create'] == false || this.props.editMode == false) { return false } if(this.props.status.fetchSuccess == true) { diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js b/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js index 286cfc454..377fd0612 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js @@ -34,7 +34,7 @@ class JourneyPattern extends Component{ type='checkbox' id={sp.id} checked={sp.checked} - disabled={(this.props.value.deletable || this.props.status.policy['journey_patterns.update'] == false) ? 'disabled' : ''} + disabled={(this.props.value.deletable || this.props.status.policy['journey_patterns.update'] == false || this.props.editMode == false) ? 'disabled' : ''} > </input> <span className='radio-label'></span> @@ -78,7 +78,7 @@ class JourneyPattern extends Component{ <span className='fa fa-cog'></span> </div> <ul className='dropdown-menu'> - <li className={(this.props.value.deletable || this.props.status.policy['journey_patterns.update'] == false) ? 'disabled' : ''}> + <li className={(this.props.status.policy['journey_patterns.update'] == false || this.props.editMode == false) ? 'disabled' : ''}> <button type='button' onClick={this.props.onOpenEditModal} @@ -91,10 +91,10 @@ class JourneyPattern extends Component{ <li className={this.props.value.object_id ? '' : 'disabled'}> {this.vehicleJourneyURL(this.props.value.object_id)} </li> - <li className={'delete-action' + ((this.props.status.policy['journey_patterns.update'] == false)? ' disabled' : '')}> + <li className={'delete-action' + ((this.props.status.policy['journey_patterns.destroy'] == false || this.props.editMode == false) ? ' disabled' : '')}> <button type='button' - disabled={(this.props.status.policy['journey_patterns.update'] == false)? 'disabled' : ''} + disabled={(this.props.status.policy['journey_patterns.destroy'] == false || this.props.editMode == false)? 'disabled' : ''} onClick={(e) => { e.preventDefault() this.props.onDeleteJourneyPattern(this.props.index)} diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPatterns.js b/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPatterns.js index f7a84cc22..6506b706c 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPatterns.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPatterns.js @@ -95,7 +95,15 @@ class JourneyPatterns extends Component{ { _.some(this.props.journeyPatterns, 'errors') && ( <div className="alert alert-danger mt-sm"> <strong>Erreur : </strong> - une erreur bloque la validation des modifications. + {this.props.journeyPatterns.map((jp, index) => + jp.errors && jp.errors.map((err, i) => { + return ( + <ul key={i}> + <li>{err}</li> + </ul> + ) + }) + )} </div> )} @@ -125,6 +133,7 @@ class JourneyPatterns extends Component{ onOpenEditModal= {() => this.props.onOpenEditModal(index, journeyPattern)} onDeleteJourneyPattern={() => this.props.onDeleteJourneyPattern(index)} status= {this.props.status} + editMode= {this.props.editMode} /> )} </div> diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/components/SaveJourneyPattern.js b/app/assets/javascripts/es6_browserified/journey_patterns/components/SaveJourneyPattern.js index 871ba00e1..767dab088 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/components/SaveJourneyPattern.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/components/SaveJourneyPattern.js @@ -21,10 +21,10 @@ class SaveJourneyPattern extends Component{ type='button' onClick={e => { e.preventDefault() - actions.submitJourneyPattern(this.props.dispatch, this.props.journeyPatterns) + this.props.editMode ? this.props.onSubmitJourneyPattern(this.props.dispatch, this.props.journeyPatterns) : this.props.onEnterEditMode() }} > - Valider + {this.props.editMode ? "Valider" : "Editer"} </button> </form> </div> diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/containers/AddJourneyPattern.js b/app/assets/javascripts/es6_browserified/journey_patterns/containers/AddJourneyPattern.js index ee13819fd..7aa27754e 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/containers/AddJourneyPattern.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/containers/AddJourneyPattern.js @@ -6,6 +6,7 @@ const mapStateToProps = (state) => { return { modal: state.modal, journeyPatterns: state.journeyPatterns, + editMode: state.editMode, status: state.status } } diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/containers/JourneyPatternList.js b/app/assets/javascripts/es6_browserified/journey_patterns/containers/JourneyPatternList.js index bc2aaf95b..228df3ede 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/containers/JourneyPatternList.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/containers/JourneyPatternList.js @@ -6,6 +6,7 @@ const mapStateToProps = (state) => { return { journeyPatterns: state.journeyPatterns, status: state.status, + editMode: state.editMode, stopPointsList: state.stopPointsList } } diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/containers/SaveJourneyPattern.js b/app/assets/javascripts/es6_browserified/journey_patterns/containers/SaveJourneyPattern.js index 33442c5a0..434264fea 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/containers/SaveJourneyPattern.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/containers/SaveJourneyPattern.js @@ -6,11 +6,23 @@ var SaveJourneyPatternComponent = require('../components/SaveJourneyPattern') const mapStateToProps = (state) => { return { journeyPatterns: state.journeyPatterns, + editMode: state.editMode, page: state.pagination.page, status: state.status } } -const SaveJourneyPattern = connect(mapStateToProps)(SaveJourneyPatternComponent) +const mapDispatchToProps = (dispatch) => { + return { + onEnterEditMode: () => { + dispatch(actions.enterEditMode()) + }, + onSubmitJourneyPattern: (next, state) => { + actions.submitJourneyPattern(dispatch, state, next) + } + } +} + +const SaveJourneyPattern = connect(mapStateToProps, mapDispatchToProps)(SaveJourneyPatternComponent) module.exports = SaveJourneyPattern diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/index.js b/app/assets/javascripts/es6_browserified/journey_patterns/index.js index b06957e0f..ca9efd2d0 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/index.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/index.js @@ -12,6 +12,7 @@ var App = require('./components/App') // var promise = require('redux-promise') var initialState = { + editMode: false, status: { policy: window.perms, fetchSuccess: true, @@ -35,7 +36,7 @@ var initialState = { let store = createStore( journeyPatternsApp, - initialState + initialState, // applyMiddleware(thunkMiddleware, promise, loggerMiddleware) ) diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/editMode.js b/app/assets/javascripts/es6_browserified/journey_patterns/reducers/editMode.js new file mode 100644 index 000000000..2e8af1aa8 --- /dev/null +++ b/app/assets/javascripts/es6_browserified/journey_patterns/reducers/editMode.js @@ -0,0 +1,12 @@ +const editMode = (state = {}, action ) => { + switch (action.type) { + case "ENTER_EDIT_MODE": + return true + case "EXIT_EDIT_MODE": + return false + default: + return state + } +} + +module.exports = editMode diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/index.js b/app/assets/javascripts/es6_browserified/journey_patterns/reducers/index.js index aa35adf0e..a9c28b83e 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/index.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/reducers/index.js @@ -1,4 +1,5 @@ var combineReducers = require('redux').combineReducers +var editMode = require('./editMode') var status = require('./status') var journeyPatterns = require('./journeyPatterns') var pagination = require('./pagination') @@ -6,6 +7,7 @@ var modal = require('./modal') var stopPointsList = require('./stopPointsList') const journeyPatternsApp = combineReducers({ + editMode, status, journeyPatterns, pagination, diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/status.js b/app/assets/javascripts/es6_browserified/journey_patterns/reducers/status.js index d7ef12d0b..07bbdc249 100644 --- a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/status.js +++ b/app/assets/javascripts/es6_browserified/journey_patterns/reducers/status.js @@ -11,6 +11,10 @@ const status = (state = {}, action) => { return _.assign({}, state, {fetchSuccess: true, isFetching: false}) case 'RECEIVE_ERRORS': return _.assign({}, state, {isFetching: false}) + case 'ENTER_EDIT_MODE': + return _.assign({}, state, {editMode: true}) + case 'EXIT_EDIT_MODE': + return _.assign({}, state, {editMode: false}) default: return state } diff --git a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js index 951664129..02ece1654 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js +++ b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js @@ -96,34 +96,42 @@ const actions = { closePeriodForm: () => ({ type: 'CLOSE_PERIOD_FORM' }), + resetModalErrors: () => ({ + type: 'RESET_MODAL_ERRORS' + }), updatePeriodForm: (val, group, selectType) => ({ type: 'UPDATE_PERIOD_FORM', val, group, selectType }), - validatePeriodForm: (modalProps, timeTablePeriods, metas) => ({ + validatePeriodForm: (modalProps, timeTablePeriods, metas, timetableInDates, error) => ({ type: 'VALIDATE_PERIOD_FORM', modalProps, timeTablePeriods, - metas + metas, + timetableInDates, + error }), - includeDateInPeriod: (index, dayTypes) => ({ + includeDateInPeriod: (index, dayTypes, date) => ({ type: 'INCLUDE_DATE_IN_PERIOD', index, - dayTypes + dayTypes, + date }), - excludeDateFromPeriod: (index, dayTypes) => ({ + excludeDateFromPeriod: (index, dayTypes, date) => ({ type: 'EXCLUDE_DATE_FROM_PERIOD', index, - dayTypes + dayTypes, + date }), openConfirmModal : (callback) => ({ type : 'OPEN_CONFIRM_MODAL', callback }), - showErrorModal: () => ({ - type: 'OPEN_ERROR_MODAL' + showErrorModal: (error) => ({ + type: 'OPEN_ERROR_MODAL', + error }), closeModal : () => ({ type : 'CLOSE_MODAL' @@ -161,16 +169,15 @@ const actions = { // We compare periods & currentDate, to determine if it is included or not let testDate = false periods.map((p, i) => { - if(p.deleted){ - return false - } + if (p.deleted) return false + let begin = new Date(p.period_start) let end = new Date(p.period_end) if(testDate === false){ if(currentDate >= begin && currentDate <= end) { testDate = true - p.include_date = false + // p.include_date = false } } }) @@ -187,11 +194,11 @@ const actions = { }) return improvedCM }, - checkConfirmModal: (event, callback, stateChanged, dispatch, metas, timetable) => { - if(stateChanged === true){ - if(timetable.time_table_periods.length == 0 && _.some(metas.day_types)){ - return actions.showErrorModal() + if(stateChanged){ + const error = actions.errorModalKey(timetable.time_table_periods, metas.day_types) + if(error){ + return actions.showErrorModal(error) }else{ return actions.openConfirmModal(callback) } @@ -207,12 +214,29 @@ const actions = { let error = '' start = new Date(start) end = new Date(end) - _.each(periods, (period, i) => { - if(index !== i && !period.deleted){ - if((new Date(period.period_start) <= start && new Date(period.period_end) >= start) || (new Date(period.period_start) <= end && new Date(period.period_end) >= end) || (start >= new Date(period.period_start) && end <= new Date(period.period_end)) || (start <= new Date(period.period_start) && end >= new Date(period.period_end))) - error = 'Les périodes ne peuvent pas se chevaucher' + + for (let i = 0; i < periods.length; i++) { + let period = periods[i] + if (index !== i && !period.deleted) { + if (new Date(period.period_start) <= end && new Date(period.period_end) >= start) { + error = 'Les périodes ne peuvent pas se chevaucher' + break + } } - }) + } + return error + }, + checkErrorsInDates: (start, end, in_days) => { + let error = '' + start = new Date(start) + end = new Date(end) + + for (let day of in_days) { + if (start <= new Date(day.date) && end >= new Date(day.date)) { + error = 'Une période ne peut chevaucher une date dans un calendrier' + break + } + } return error }, fetchTimeTables: (dispatch, nextPage) => { @@ -275,6 +299,31 @@ const actions = { } } }) + }, + errorModalKey: (periods, dayTypes) => { + const withoutPeriodsWithDaysTypes = _.reject(periods, 'deleted').length == 0 && _.some(dayTypes) && "withoutPeriodsWithDaysTypes" + const withPeriodsWithoutDayTypes = _.reject(periods, 'deleted').length > 0 && _.every(dayTypes, dt => dt == false) && "withPeriodsWithoutDayTypes" + + return (withoutPeriodsWithDaysTypes || withPeriodsWithoutDayTypes) && (withoutPeriodsWithDaysTypes ? "withoutPeriodsWithDaysTypes" : "withPeriodsWithoutDayTypes") + + }, + errorModalMessage: (errorKey) => { + switch (errorKey) { + case "withoutPeriodsWithDaysTypes": + return window.I18n.fr.time_tables.edit.error_modal.withoutPeriodsWithDaysTypes + case "withPeriodsWithoutDayTypes": + return window.I18n.fr.time_tables.edit.error_modal.withPeriodsWithoutDayTypes + default: + return errorKey + + } + }, + checkIfTTHasDate: (dates, date) => { + if (_.some(dates, date)) { + return _.reject(dates, ['date', date.date]) + } else { + return dates.concat(date) + } } } diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/ErrorModal.js b/app/assets/javascripts/es6_browserified/time_tables/components/ErrorModal.js index 31ed256ea..4e8f7e363 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/ErrorModal.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/ErrorModal.js @@ -1,18 +1,19 @@ var React = require('react') var Component = require('react').Component var PropTypes = require('react').PropTypes +var errorModalMessage = require('../actions').errorModalMessage -const ErrorModal = ({dispatch, modal, onModalClose}) => ( +const ErrorModal = ({dispatch, modal, I18n, onModalClose}) => ( <div className={ 'modal fade ' + ((modal.type == 'error') ? 'in' : '') } id='ErrorModal'> <div className='modal-container'> <div className='modal-dialog'> <div className='modal-content'> <div className='modal-header'> - <h4 className='modal-title'>Erreur</h4> + <h4 className='modal-title'>{window.I18n.fr.time_tables.edit.error_modal.title}</h4> </div> <div className='modal-body'> <div className='mt-md mb-md'> - <p>Un calendrier d'application ne peut pas avoir de journée(s) d'application sans période(s).</p> + <p>{errorModalMessage(modal.modalProps.error)}</p> </div> </div> <div className='modal-footer'> diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/ExceptionsInDay.js b/app/assets/javascripts/es6_browserified/time_tables/components/ExceptionsInDay.js index 10b558373..4879e537f 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/ExceptionsInDay.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/ExceptionsInDay.js @@ -20,7 +20,7 @@ class ExceptionsInDay extends Component { data-actiontype='remove' onClick={(e) => { $(e.currentTarget).toggleClass('active') - this.props.onExcludeDateFromPeriod(this.props.index, this.props.metas.day_types) + this.props.onExcludeDateFromPeriod(this.props.index, this.props.metas.day_types, this.props.currentDate) }} > <span className='fa fa-times'></span> @@ -36,7 +36,7 @@ class ExceptionsInDay extends Component { data-actiontype='add' onClick={(e) => { $(e.currentTarget).toggleClass('active') - this.props.onIncludeDateInPeriod(this.props.index, this.props.metas.day_types) + this.props.onIncludeDateInPeriod(this.props.index, this.props.metas.day_types, this.props.currentDate) }} > <span className='fa fa-plus'></span> diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodForm.js b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodForm.js index 028974fc8..3234a3fd7 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodForm.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodForm.js @@ -1,5 +1,6 @@ var React = require('react') var PropTypes = require('react').PropTypes +var _ = require('lodash') let monthsArray = ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'] const formatNumber = (val) => { @@ -107,7 +108,7 @@ const PeriodForm = ({modal, timetable, metas, onOpenAddPeriodForm, onClosePeriod <button type='button' className='btn btn-outline-primary mr-sm' - onClick={() => onValidatePeriodForm(modal.modalProps, timetable.time_table_periods, metas)} + onClick={() => onValidatePeriodForm(modal.modalProps, timetable.time_table_periods, metas, _.filter(timetable.time_table_dates, ['in_out', true]))} > Valider </button> diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/SaveTimetable.js b/app/assets/javascripts/es6_browserified/time_tables/components/SaveTimetable.js index e8c0aa3ba..779fd8e25 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/SaveTimetable.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/SaveTimetable.js @@ -10,6 +10,8 @@ class SaveTimetable extends Component{ } render() { + const error = actions.errorModalKey(this.props.timetable.time_table_periods, this.props.metas.day_types) + return ( <div className='row mt-md'> <div className='col-lg-12 text-right'> @@ -19,9 +21,9 @@ class SaveTimetable extends Component{ type='button' onClick={e => { e.preventDefault() - if(this.props.timetable.time_table_periods.length == 0 && _.some(this.props.metas.day_types)){ - this.props.onShowErrorModal() - }else{ + if (error) { + this.props.onShowErrorModal(error) + } else { actions.submitTimetable(this.props.getDispatch(), this.props.timetable, this.props.metas) } }} diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/TagsSelect2.js b/app/assets/javascripts/es6_browserified/time_tables/components/TagsSelect2.js index f1b999cff..a1f41a693 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/TagsSelect2.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/TagsSelect2.js @@ -49,9 +49,9 @@ class TagsSelect2 extends React.Component{ }; }, processResults: function(data, params) { - + let items = _.filter(data, ({name}) => name.includes(params.term) ) return { - results: data.map( + results: items.map( item => _.assign( {}, item, @@ -62,7 +62,7 @@ class TagsSelect2 extends React.Component{ }, cache: true }, - minimumInputLength: 3, + minimumInputLength: 1, templateResult: formatRepo }} /> diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/Timetable.js b/app/assets/javascripts/es6_browserified/time_tables/components/Timetable.js index d562655b9..3af1a11a4 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/Timetable.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/Timetable.js @@ -79,6 +79,7 @@ class Timetable extends Component{ <ExceptionsInDay index={i} value={this.props.timetable} + currentDate={d.date} metas={this.props.metas} blueDaytype={this.props.metas.day_types[d.wday]} onExcludeDateFromPeriod={this.props.onExcludeDateFromPeriod} diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/ErrorModal.js b/app/assets/javascripts/es6_browserified/time_tables/containers/ErrorModal.js index 16a7d45dd..e0b2c1240 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/containers/ErrorModal.js +++ b/app/assets/javascripts/es6_browserified/time_tables/containers/ErrorModal.js @@ -12,6 +12,7 @@ const mapDispatchToProps = (dispatch) => { return { onModalClose: () =>{ dispatch(actions.closeModal()) + dispatch(actions.resetModalErrors()) } } } diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/PeriodForm.js b/app/assets/javascripts/es6_browserified/time_tables/containers/PeriodForm.js index 7f2db785a..951a09741 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/containers/PeriodForm.js +++ b/app/assets/javascripts/es6_browserified/time_tables/containers/PeriodForm.js @@ -7,7 +7,7 @@ const mapStateToProps = (state) => { return { modal: state.modal, timetable: state.timetable, - metas: state.metas + metas: state.metas, } } @@ -27,8 +27,14 @@ const mapDispatchToProps = (dispatch) => { val = (val < 10) ? '0' + String(val) : String(val) dispatch(actions.updatePeriodForm(val, group, 'day')) }, - onValidatePeriodForm: (modalProps, timeTablePeriods, metas) => { - dispatch(actions.validatePeriodForm(modalProps, timeTablePeriods, metas)) + onValidatePeriodForm: (modalProps, timeTablePeriods, metas, timetableInDates) => { + let period_start = actions.formatDate(modalProps.begin) + let period_end = actions.formatDate(modalProps.end) + let error = '' + if (new Date(period_end) <= new Date(period_start)) error = 'La date de départ doit être antérieure à la date de fin' + if (error == '') error = actions.checkErrorsInPeriods(period_start, period_end, modalProps.index, timeTablePeriods) + if (error == '') error = actions.checkErrorsInDates(period_start, period_end, timetableInDates) + dispatch(actions.validatePeriodForm(modalProps, timeTablePeriods, metas, timetableInDates, error)) } } } diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/SaveTimetable.js b/app/assets/javascripts/es6_browserified/time_tables/containers/SaveTimetable.js index b5539e7d8..6287da15b 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/containers/SaveTimetable.js +++ b/app/assets/javascripts/es6_browserified/time_tables/containers/SaveTimetable.js @@ -13,8 +13,8 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { - onShowErrorModal: () => { - dispatch(actions.showErrorModal()) + onShowErrorModal: (errorKey) => { + dispatch(actions.showErrorModal(errorKey)) }, getDispatch: () => { return dispatch diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js b/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js index c6b5fcc6b..639a1e2ab 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js +++ b/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js @@ -15,11 +15,11 @@ const mapDispatchToProps = (dispatch) => { onDeletePeriod: (index, dayTypes) =>{ dispatch(actions.deletePeriod(index, dayTypes)) }, - onExcludeDateFromPeriod: (index, dayTypes) => { - dispatch(actions.excludeDateFromPeriod(index, dayTypes)) + onExcludeDateFromPeriod: (index, dayTypes, date) => { + dispatch(actions.excludeDateFromPeriod(index, dayTypes, date)) }, - onIncludeDateInPeriod: (index, dayTypes) => { - dispatch(actions.includeDateInPeriod(index, dayTypes)) + onIncludeDateInPeriod: (index, dayTypes, date) => { + dispatch(actions.includeDateInPeriod(index, dayTypes, date)) }, onOpenEditPeriodForm: (period, index) => { dispatch(actions.openEditPeriodForm(period, index)) diff --git a/app/assets/javascripts/es6_browserified/time_tables/index.js b/app/assets/javascripts/es6_browserified/time_tables/index.js index 01f8c428e..a91747991 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/index.js +++ b/app/assets/javascripts/es6_browserified/time_tables/index.js @@ -22,7 +22,8 @@ var initialState = { current_month: [], current_periode_range: '', periode_range: [], - time_table_periods: [] + time_table_periods: [], + time_table_dates: [] }, metas: { comment: '', @@ -61,7 +62,7 @@ var initialState = { let store = createStore( timeTablesApp, - initialState + initialState, // applyMiddleware(thunkMiddleware, promise, loggerMiddleware) ) diff --git a/app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js b/app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js index 69f7b206e..c61296f1c 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js +++ b/app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js @@ -21,9 +21,13 @@ const modal = (state = {}, action) => { }) case 'OPEN_ERROR_MODAL': $('#ErrorModal').modal('show') - return _.assign({}, state, {type: 'error'}) + newModalProps = _.assign({}, state.modalProps, {error: action.error}) + return _.assign({}, state, {type: 'error'}, {modalProps: newModalProps}) + case 'RESET_MODAL_ERRORS': + newModalProps = _.assign({}, state.modalProps, {error: ''}) + return _.assign({}, state, {type: ''}, {modalProps: newModalProps}) case 'CLOSE_PERIOD_FORM': - newModalProps = _.assign({}, state.modalProps, {active: false}) + newModalProps = _.assign({}, state.modalProps, {active: false, error: ""}) return _.assign({}, state, {modalProps: newModalProps}) case 'OPEN_EDIT_PERIOD_FORM': period_start = action.period.period_start.split('-') @@ -50,19 +54,9 @@ const modal = (state = {}, action) => { newModalProps[action.group][action.selectType] = action.val return _.assign({}, state, {modalProps: newModalProps}) case 'VALIDATE_PERIOD_FORM': - period_start = actions.formatDate(action.modalProps.begin) - period_end = actions.formatDate(action.modalProps.end) - newModalProps = _.assign({}, state.modalProps) - - if(new Date(period_end) <= new Date(period_start)){ - newModalProps.error = 'La date de départ doit être antérieure à la date de fin' - return _.assign({}, state, {modalProps: newModalProps}) - } - - let newPeriods = JSON.parse(JSON.stringify(action.timeTablePeriods)) - let error = actions.checkErrorsInPeriods(period_start, period_end, action.modalProps.index, newPeriods) - newModalProps.error = error - newModalProps.active = (error == '') ? false : true + newModalProps = JSON.parse(JSON.stringify(state.modalProps)) + newModalProps.error = action.error + newModalProps.active = (newModalProps.error == '') ? false : true return _.assign({}, state, {modalProps: newModalProps}) default: return state diff --git a/app/assets/javascripts/es6_browserified/time_tables/reducers/pagination.js b/app/assets/javascripts/es6_browserified/time_tables/reducers/pagination.js index 3d96fb7b7..45fec6b5f 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/reducers/pagination.js +++ b/app/assets/javascripts/es6_browserified/time_tables/reducers/pagination.js @@ -26,6 +26,8 @@ const pagination = (state = {}, action) => { case 'VALIDATE_PERIOD_FORM': case 'UPDATE_COMMENT': case 'UPDATE_COLOR': + case 'UPDATE_DAY_TYPES': + case 'UPDATE_CURRENT_MONTH_FROM_DAYTYPES': toggleOnConfirmModal('modal') return _.assign({}, state, {stateChanged: true}) default: diff --git a/app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js b/app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js index 65cd9231a..390bdffb0 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js +++ b/app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js @@ -1,6 +1,7 @@ const _ = require('lodash') var actions = require('../actions') let newState = {} +let newDates = [] const timetable = (state = {}, action) => { switch (action.type) { @@ -9,7 +10,8 @@ const timetable = (state = {}, action) => { current_month: action.json.current_month, current_periode_range: action.json.current_periode_range, periode_range: action.json.periode_range, - time_table_periods: action.json.time_table_periods + time_table_periods: action.json.time_table_periods, + time_table_dates: action.json.time_table_dates }) return _.assign({}, fetchedState, {current_month: actions.updateSynthesis(fetchedState, actions.strToArrayDayTypes(action.json.day_types))}) case 'RECEIVE_MONTH': @@ -38,36 +40,46 @@ const timetable = (state = {}, action) => { newState = _.assign({}, state, {time_table_periods : ttperiods}) return _.assign({}, newState, {current_month: actions.updateSynthesis(newState, action.dayTypes)}) case 'INCLUDE_DATE_IN_PERIOD': + newDates = actions.checkIfTTHasDate(state.time_table_dates, {date: action.date, in_out: true}) let newCMi = state.current_month.map((d, i) => { if(i == action.index){ d.include_date = !d.include_date } return d }) - newState = _.assign({}, state, {current_month: newCMi}) + newState = _.assign({}, state, {current_month: newCMi, time_table_dates: newDates}) return _.assign({}, newState, {current_month: actions.updateSynthesis(newState, action.dayTypes)}) case 'EXCLUDE_DATE_FROM_PERIOD': + newDates = actions.checkIfTTHasDate(state.time_table_dates, {date: action.date, in_out: false}) let newCMe = state.current_month.map((d, i) => { if(i == action.index){ d.excluded_date = !d.excluded_date } return d }) - newState = _.assign({}, state, {current_month: newCMe}) + newState = _.assign({}, state, {current_month: newCMe, time_table_dates: newDates}) return _.assign({}, newState, {current_month: actions.updateSynthesis(newState, action.dayTypes)}) + case 'UPDATE_DAY_TYPES': + // We get the week days of the activated day types to reject the out_dates that that are out of newDayTypes + let weekDays = _.reduce(action.dayTypes, (array, dt, i) => { + if (dt) array.push(i) + return array + }, []) + + newDates = _.reject(state.time_table_dates, (d) => { + return d.in_out == false && !weekDays.includes(new Date(d.date).getDay()) + }) + return _.assign({}, state, {time_table_dates: newDates}) case 'UPDATE_CURRENT_MONTH_FROM_DAYTYPES': return _.assign({}, state, {current_month: actions.updateSynthesis(state, action.dayTypes)}) case 'VALIDATE_PERIOD_FORM': + if (action.error != '') return state + let period_start = actions.formatDate(action.modalProps.begin) let period_end = actions.formatDate(action.modalProps.end) - if(new Date(period_end) <= new Date(period_start)){ - return state - } + let newPeriods = JSON.parse(JSON.stringify(action.timeTablePeriods)) - let error = actions.checkErrorsInPeriods(period_start, period_end, action.modalProps.index, newPeriods) - if(error != ''){ - return state - } + if (action.modalProps.index !== false){ newPeriods[action.modalProps.index].period_start = period_start newPeriods[action.modalProps.index].period_end = period_end @@ -80,7 +92,6 @@ const timetable = (state = {}, action) => { } newState =_.assign({}, state, {time_table_periods: newPeriods}) return _.assign({}, newState, {current_month: actions.updateSynthesis(newState, action.metas.day_types)}) - default: return state } diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js index c30f460d8..2fde0d76f 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js @@ -7,6 +7,12 @@ if (!window.Promise) { var batchActions = require('../batch').batchActions const actions = { + enterEditMode: () => ({ + type: "ENTER_EDIT_MODE" + }), + exitEditMode: () => ({ + type: "EXIT_EDIT_MODE" + }), receiveVehicleJourneys : (json) => ({ type: "RECEIVE_VEHICLE_JOURNEYS", json @@ -121,6 +127,9 @@ const actions = { objectid: selectedCompany.objectid } }), + unselect2Company: () => ({ + type: 'UNSELECT_CP_EDIT_MODAL', + }), editVehicleJourney : (data, selectedCompany) => ({ type: 'EDIT_VEHICLEJOURNEY', data, @@ -130,13 +139,14 @@ const actions = { type: 'EDIT_VEHICLEJOURNEY_NOTES', footnotes }), - shiftVehicleJourney : (data) => ({ + shiftVehicleJourney : (addtionalTime) => ({ type: 'SHIFT_VEHICLEJOURNEY', - data + addtionalTime }), - duplicateVehicleJourney : (data, departureDelta) => ({ + duplicateVehicleJourney : (addtionalTime, duplicateNumber, departureDelta) => ({ type: 'DUPLICATE_VEHICLEJOURNEY', - data, + addtionalTime, + duplicateNumber, departureDelta }), deleteVehicleJourneys : () => ({ @@ -371,6 +381,7 @@ const actions = { dispatch(actions.updateTotalCount(window.currentItemsLength - json.length)) } window.currentItemsLength = json.length + dispatch(actions.exitEditMode()) dispatch(actions.receiveVehicleJourneys(json)) } } @@ -384,7 +395,7 @@ const actions = { }, simplePad: (d) => { if(d.toString().length == 1){ - return (d < 10) ? '0' + d.toString() : d.toString(); + return '0' + d.toString() }else{ return d.toString() } @@ -418,8 +429,8 @@ const actions = { return vjas }, getDuplicateDelta: (original, newDeparture) => { - if (original.departure_time.hour != '' && original.departure_time.minute != '' && newDeparture.departure_time.hour != '' && newDeparture.departure_time.minute != ''){ - return (parseInt(newDeparture.departure_time.hour) - parseInt(original.departure_time.hour)) * 60 + (parseInt(newDeparture.departure_time.minute) - parseInt(original.departure_time.minute)) + if (original.departure_time.hour != '' && original.departure_time.minute != '' && newDeparture.departure_time.hour != undefined && newDeparture.departure_time.minute != undefined){ + return (newDeparture.departure_time.hour - parseInt(original.departure_time.hour)) * 60 + (newDeparture.departure_time.minute - parseInt(original.departure_time.minute)) } return 0 }, @@ -431,69 +442,25 @@ const actions = { vjas.delta = delta return vjas }, - checkSchedules: (schedule) => { - let hours = 0 - let minutes = 0 - if (parseInt(schedule.departure_time.minute) > 59){ - hours = Math.floor(parseInt(schedule.departure_time.minute) / 60) - minutes = parseInt(schedule.departure_time.minute) % 60 - schedule.departure_time.minute = actions.simplePad(minutes, 'minute') - schedule.departure_time.hour = parseInt(schedule.departure_time.hour) + hours - } - if (parseInt(schedule.arrival_time.minute) > 59){ - hours = Math.floor(parseInt(schedule.arrival_time.minute) / 60) - minutes = parseInt(schedule.arrival_time.minute) % 60 - schedule.arrival_time.minute = actions.simplePad(minutes, 'minute') - schedule.arrival_time.hour = parseInt(schedule.arrival_time.hour) + hours - } - if (parseInt(schedule.departure_time.minute) < 0){ - hours = Math.floor(parseInt(schedule.departure_time.minute) / 60) - minutes = (parseInt(schedule.departure_time.minute) % 60) + 60 - if(minutes == 60){ - minutes = 0 - } - schedule.departure_time.minute = actions.simplePad(minutes, 'minute') - schedule.departure_time.hour = parseInt(schedule.departure_time.hour) + hours - } - if (parseInt(schedule.arrival_time.minute) < 0){ - hours = Math.floor(parseInt(schedule.arrival_time.minute) / 60) - minutes = (parseInt(schedule.arrival_time.minute) % 60) + 60 - if(minutes == 60){ - minutes = 0 - } - schedule.arrival_time.minute = actions.simplePad(minutes, 'minute') - schedule.arrival_time.hour = parseInt(schedule.arrival_time.hour) + hours - } + getShiftedSchedule: ({departure_time, arrival_time}, additional_time) => { + // We create dummy dates objects to manipulate time more easily + let departureDT = new Date (Date.UTC(2017, 2, 1, parseInt(departure_time.hour), parseInt(departure_time.minute))) + let arrivalDT = new Date (Date.UTC(2017, 2, 1, parseInt(arrival_time.hour), parseInt(arrival_time.minute))) - if(parseInt(schedule.departure_time.hour) > 23){ - schedule.departure_time.hour = '23' - schedule.departure_time.minute = '59' - } - if(parseInt(schedule.arrival_time.hour) > 23){ - schedule.arrival_time.hour = '23' - schedule.arrival_time.minute = '59' - } + let newDepartureDT = new Date (departureDT.getTime() + additional_time * 60000) + let newArrivalDT = new Date (arrivalDT.getTime() + additional_time * 60000) - if(parseInt(schedule.departure_time.hour) < 0){ - schedule.departure_time.hour = '00' - schedule.departure_time.minute = '00' - } - if(parseInt(schedule.arrival_time.hour) < 0){ - schedule.arrival_time.hour = '00' - schedule.arrival_time.minute = '00' + return { + departure_time: { + hour: actions.simplePad(newDepartureDT.getUTCHours()), + minute: actions.simplePad(newDepartureDT.getUTCMinutes()) + }, + arrival_time: { + hour: actions.simplePad(newArrivalDT.getUTCHours()), + minute: actions.simplePad(newArrivalDT.getUTCMinutes()) + } } - - schedule.departure_time.hour = actions.simplePad(parseInt(schedule.departure_time.hour), 'hour') - schedule.arrival_time.hour = actions.simplePad(parseInt(schedule.arrival_time.hour), 'hour') - // if (parseInt(schedule.departure_time.hour) > 23){ - // schedule.departure_time.hour = parseInt(schedule.departure_time.hour) - 24 - // } - // if (parseInt(schedule.arrival_time.hour) > 23){ - // schedule.arrival_time.hour = parseInt(schedule.arrival_time.hour) - 24 - // } - // schedule.departure_time.hour = actions.pad(schedule.departure_time.hour, 'hour') - // schedule.arrival_time.hour = actions.pad(schedule.arrival_time.hour, 'hour') - } + }, } module.exports = actions diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/SaveVehicleJourneys.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/SaveVehicleJourneys.js index 05dda976d..3c45e5758 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/SaveVehicleJourneys.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/SaveVehicleJourneys.js @@ -9,7 +9,7 @@ class SaveVehicleJourneys extends Component{ } render() { - if(this.props.filters.policy['vehicle_journeys.update'] == false) { + if (this.props.filters.policy['vehicle_journeys.update'] == false) { return false }else{ return ( @@ -21,10 +21,10 @@ class SaveVehicleJourneys extends Component{ type='button' onClick={e => { e.preventDefault() - actions.submitVehicleJourneys(this.props.dispatch, this.props.vehicleJourneys) + this.props.editMode ? this.props.onSubmitVehicleJourneys(this.props.dispatch, this.props.vehicleJourneys) : this.props.onEnterEditMode() }} > - Valider + {this.props.editMode ? "Valider" : "Editer"} </button> </form> </div> @@ -38,7 +38,9 @@ SaveVehicleJourneys.propTypes = { vehicleJourneys: PropTypes.array.isRequired, page: PropTypes.number.isRequired, status: PropTypes.object.isRequired, - filters: PropTypes.object.isRequired + filters: PropTypes.object.isRequired, + onEnterEditMode: PropTypes.func.isRequired, + onSubmitVehicleJourneys: PropTypes.func.isRequired } module.exports = SaveVehicleJourneys diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/Tools.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/Tools.js index b417828db..4948e6b1a 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/Tools.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/Tools.js @@ -9,28 +9,34 @@ var NotesEditVehicleJourney = require('../containers/tools/NotesEditVehicleJourn var TimetablesEditVehicleJourney = require('../containers/tools/TimetablesEditVehicleJourney') var actions = require('../actions') -const Tools = ({vehicleJourneys, onCancelSelection}) => { +const Tools = ({vehicleJourneys, onCancelSelection, filters: {policy}, editMode}) => { return ( - <div className='select_toolbox'> - <ul> - <AddVehicleJourney /> - <DuplicateVehicleJourney /> - <ShiftVehicleJourney /> - <EditVehicleJourney /> - <TimetablesEditVehicleJourney /> - <NotesEditVehicleJourney /> - <DeleteVehicleJourneys /> - </ul> + <div> + { + (policy['vehicle_journeys.create'] && policy['vehicle_journeys.update'] && policy['vehicle_journeys.destroy'] && editMode) && + <div className='select_toolbox'> + <ul> + <AddVehicleJourney /> + <DuplicateVehicleJourney /> + <ShiftVehicleJourney /> + <EditVehicleJourney /> + <TimetablesEditVehicleJourney /> + <NotesEditVehicleJourney /> + <DeleteVehicleJourneys /> + </ul> - <span className='info-msg'>{actions.getSelected(vehicleJourneys).length} course(s) sélectionnée(s)</span> - <button className='btn btn-xs btn-link pull-right' onClick={onCancelSelection}>Annuler la sélection</button> + <span className='info-msg'>{actions.getSelected(vehicleJourneys).length} course(s) sélectionnée(s)</span> + <button className='btn btn-xs btn-link pull-right' onClick={onCancelSelection}>Annuler la sélection</button> + </div> + } </div> ) } Tools.propTypes = { vehicleJourneys : PropTypes.array.isRequired, - onCancelSelection: PropTypes.func.isRequired + onCancelSelection: PropTypes.func.isRequired, + filters: PropTypes.object.isRequired } module.exports = Tools diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js index f2bd0c3cd..ca6694f61 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js @@ -58,7 +58,7 @@ class VehicleJourney extends Component { )} </div> - {(this.props.filters.policy['vehicle_journeys.update'] == true) && + {(this.props.filters.policy['vehicle_journeys.update'] == true && this.props.editMode) && <div className={(this.props.value.deletable ? 'disabled ' : '') + 'checkbox'}> <input id={this.props.index} @@ -79,13 +79,13 @@ class VehicleJourney extends Component { <div className={'cellwrap' + (this.cityNameChecker(vj) ? ' headlined' : '')}> {this.props.filters.toggleArrivals && <div data-headline='Arrivée à'> - <span className={((this.isDisabled(this.props.value.deletable, vj.dummy) || this.props.filters.policy['vehicle_journeys.update'] == false) ? 'disabled ' : '') + 'input-group time'}> + <span className={((this.isDisabled(this.props.value.deletable, vj.dummy) || this.props.filters.policy['vehicle_journeys.update'] == false || this.props.editMode == false) ? 'disabled ' : '') + 'input-group time'}> <input type='number' min='00' max='23' className='form-control' - disabled={(this.isDisabled(this.props.value.deletable, vj.dummy) || this.props.filters.policy['vehicle_journeys.update'] == false)} + disabled={(this.isDisabled(this.props.value.deletable, vj.dummy) || this.props.filters.policy['vehicle_journeys.update'] == false || this.props.editMode == false)} onChange={(e) => {this.props.onUpdateTime(e, i, this.props.index, 'hour', false, false)}} value={vj.arrival_time['hour']} /> @@ -95,7 +95,7 @@ class VehicleJourney extends Component { min='00' max='59' className='form-control' - disabled={((this.isDisabled(this.props.value.deletable), vj.dummy) || this.props.filters.policy['vehicle_journeys.update'] == false)} + disabled={((this.isDisabled(this.props.value.deletable), vj.dummy) || this.props.filters.policy['vehicle_journeys.update'] == false || this.props.editMode == false)} onChange={(e) => {this.props.onUpdateTime(e, i, this.props.index, 'minute', false, false)}} value={vj.arrival_time['minute']} /> @@ -108,13 +108,13 @@ class VehicleJourney extends Component { } </div> <div data-headline='Départ à'> - <span className={((this.isDisabled(this.props.value.deletable, vj.dummy) || this.props.filters.policy['vehicle_journeys.update'] == false) ? 'disabled ' : '') + 'input-group time'}> + <span className={((this.isDisabled(this.props.value.deletable, vj.dummy) || this.props.filters.policy['vehicle_journeys.update'] == false || this.props.editMode == false) ? 'disabled ' : '') + 'input-group time'}> <input type='number' min='00' max='23' className='form-control' - disabled={(this.isDisabled(this.props.value.deletable, vj.dummy) || this.props.filters.policy['vehicle_journeys.update'] == false)} + disabled={(this.isDisabled(this.props.value.deletable, vj.dummy) || this.props.filters.policy['vehicle_journeys.update'] == false || this.props.editMode == false)} onChange={(e) => {this.props.onUpdateTime(e, i, this.props.index, 'hour', true, this.props.filters.toggleArrivals)}} value={vj.departure_time['hour']} /> @@ -124,7 +124,7 @@ class VehicleJourney extends Component { min='00' max='59' className='form-control' - disabled={(this.isDisabled(this.props.value.deletable, vj.dummy) || this.props.filters.policy['vehicle_journeys.update'] == false)} + disabled={(this.isDisabled(this.props.value.deletable, vj.dummy) || this.props.filters.policy['vehicle_journeys.update'] == false || this.props.editMode == false)} onChange={(e) => {this.props.onUpdateTime(e, i, this.props.index, "minute", true, this.props.filters.toggleArrivals)}} value={vj.departure_time['minute']} /> diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourneys.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourneys.js index 8575c076f..8f3f91b25 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourneys.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourneys.js @@ -96,7 +96,15 @@ class VehicleJourneys extends Component{ { _.some(this.props.vehicleJourneys, 'errors') && ( <div className="alert alert-danger mt-sm"> <strong>Erreur : </strong> - une erreur bloque la validation des modifications. + {this.props.vehicleJourneys.map((vj, index) => + vj.errors && vj.errors.map((err, i) => { + return ( + <ul key={i}> + <li>{err}</li> + </ul> + ) + }) + )} </div> )} @@ -123,6 +131,7 @@ class VehicleJourneys extends Component{ value={vj} key={index} index={index} + editMode={this.props.editMode} filters={this.props.filters} onUpdateTime={this.props.onUpdateTime} onSelectVehicleJourney={this.props.onSelectVehicleJourney} diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/DuplicateVehicleJourney.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/DuplicateVehicleJourney.js index 34463600a..9446b993a 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/DuplicateVehicleJourney.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/DuplicateVehicleJourney.js @@ -7,33 +7,64 @@ var _ = require('lodash') class DuplicateVehicleJourney extends Component { constructor(props) { super(props) + this.state = {} + this.onFormChange = this.onFormChange.bind(this) + this.handleSubmit = this.handleSubmit.bind(this) + } + + componentWillReceiveProps() { + if (actions.getSelected(this.props.vehicleJourneys).length > 0) { + let hour = parseInt(this.getDefaultValue('hour')) + let miunte = parseInt(this.getDefaultValue('minute')) + this.setState((state, props) => { + return { + originalDT: { + hour: hour, + minute: miunte + }, + duplicate_time_hh: hour, + duplicate_time_mm: miunte, + additional_time: 0, + duplicate_number: 1 + } + }) + } } handleSubmit() { if(actions.validateFields(this.refs) == true) { let newDeparture = { departure_time : { - hour: this.refs.duplicate_time_hh.value, - minute: this.refs.duplicate_time_mm.value + hour: this.state.duplicate_time_hh, + minute: this.state.duplicate_time_mm } } let val = actions.getDuplicateDelta(_.find(actions.getSelected(this.props.vehicleJourneys)[0].vehicle_journey_at_stops, {'dummy': false}), newDeparture) - this.refs.additional_time.value = parseInt(this.refs.additional_time.value) - this.props.onDuplicateVehicleJourney(this.refs, val) + this.props.onDuplicateVehicleJourney(this.state.additional_time, this.state.duplicate_number, val) this.props.onModalClose() $('#DuplicateVehicleJourneyModal').modal('hide') } } + onFormChange(e) { + let {name, value} = e.target + this.setState((state, props) => { + return { + [name]: parseInt(value) + } + }) + } + getDefaultValue(type) { let vjas = _.find(actions.getSelected(this.props.vehicleJourneys)[0].vehicle_journey_at_stops, {'dummy': false}) return vjas.departure_time[type] } + render() { if(this.props.status.isFetching == true) { return false } - if(this.props.status.fetchSuccess == true) { + if(this.props.status.fetchSuccess == true && actions.getSelected(this.props.vehicleJourneys).length > 0) { return ( <li className='st_action'> <button @@ -65,22 +96,26 @@ class DuplicateVehicleJourney extends Component { <span className={'input-group time' + (actions.getSelected(this.props.vehicleJourneys).length > 1 ? ' disabled' : '')}> <input type='number' + name='duplicate_time_hh' ref='duplicate_time_hh' min='00' max='23' className='form-control' - defaultValue={this.getDefaultValue('hour')} - disabled={(actions.getSelected(this.props.vehicleJourneys).length > 1 ? 'disabled' : '')} + value={this.state.duplicate_time_hh} + onChange={e => this.onFormChange(e)} + disabled={actions.getSelected(this.props.vehicleJourneys) && (actions.getSelected(this.props.vehicleJourneys).length > 1 ? 'disabled' : '')} /> <span>:</span> <input type='number' + name='duplicate_time_mm' ref='duplicate_time_mm' min='00' max='59' className='form-control' - defaultValue={this.getDefaultValue('minute')} - disabled={(actions.getSelected(this.props.vehicleJourneys).length > 1 ? 'disabled' : '')} + value={this.state.duplicate_time_mm} + onChange={e => this.onFormChange(e)} + disabled={actions.getSelected(this.props.vehicleJourneys) && (actions.getSelected(this.props.vehicleJourneys).length > 1 ? 'disabled' : '')} /> </span> </span> @@ -92,11 +127,13 @@ class DuplicateVehicleJourney extends Component { <input type='number' style={{'width': 104}} + name='duplicate_number' ref='duplicate_number' min='1' max='20' - defaultValue='1' + value={this.state.duplicate_number} className='form-control' + onChange={e => this.onFormChange(e)} onKeyDown={(e) => actions.resetValidation(e.currentTarget)} required /> @@ -105,19 +142,21 @@ class DuplicateVehicleJourney extends Component { <div className='form-group'> <label className='control-label is-required col-sm-8'>Décalage à partir duquel on créé les courses</label> - <div className="col-sm-4"> + <span className="col-sm-4"> <input type='number' style={{'width': 104}} + name='additional_time' ref='additional_time' - min='-59' - max='59' - defaultValue='0' - className='form-control' + min='-720' + max='720' + value={this.state.additional_time} + className='form-control disabled' + onChange={e => this.onFormChange(e)} onKeyDown={(e) => actions.resetValidation(e.currentTarget)} required - /> - </div> + /> + </span> </div> </div> @@ -131,9 +170,9 @@ class DuplicateVehicleJourney extends Component { Annuler </button> <button - className='btn btn-primary' + className={'btn btn-primary ' + (this.state.additional_time == 0 && this.state.originalDT.hour == this.state.duplicate_time_hh && this.state.originalDT.minute == this.state.duplicate_time_mm ? 'disabled' : '')} type='button' - onClick={this.handleSubmit.bind(this)} + onClick={this.handleSubmit} > Valider </button> diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/EditVehicleJourney.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/EditVehicleJourney.js index d49ea578a..2ff4999c6 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/EditVehicleJourney.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/EditVehicleJourney.js @@ -14,8 +14,10 @@ class EditVehicleJourney extends Component { var company; if(this.props.modal.modalProps.selectedCompany) { company = this.props.modal.modalProps.selectedCompany - } else { + } else if (typeof this.props.modal.modalProps.vehicleJourney.company === Object) { company = this.props.modal.modalProps.vehicleJourney.company + } else { + company = undefined } this.props.onEditVehicleJourney(this.refs, company) this.props.onModalClose() @@ -96,6 +98,7 @@ class EditVehicleJourney extends Component { <CompanySelect2 company = {this.props.modal.modalProps.vehicleJourney.company} onSelect2Company = {(e) => this.props.onSelect2Company(e)} + onUnselect2Company = {() => this.props.onUnselect2Company()} /> </div> </div> diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/ShiftVehicleJourney.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/ShiftVehicleJourney.js index 269bb1b8c..dd0bade39 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/ShiftVehicleJourney.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/ShiftVehicleJourney.js @@ -6,16 +6,27 @@ var actions = require('../../actions') class ShiftVehicleJourney extends Component { constructor(props) { super(props) + this.state = { + additional_time: 0 + } } handleSubmit() { if(actions.validateFields(this.refs) == true) { - this.props.onShiftVehicleJourney(this.refs) + this.props.onShiftVehicleJourney(this.state.additional_time) this.props.onModalClose() $('#ShiftVehicleJourneyModal').modal('hide') } } + handleAdditionalTimeChange() { + this.setState((state, props) => { + return { + additional_time: parseInt(this.refs.additional_time.value) + } + }) + } + render() { if(this.props.status.isFetching == true) { return false @@ -53,14 +64,16 @@ class ShiftVehicleJourney extends Component { <label className='control-label is-required'>Avec un décalage de</label> <input type='number' + style={{'width': 104}} ref='additional_time' - min='-59' - max='59' + min='-720' + max='720' + value={this.state.additional_time} className='form-control' - defaultValue='0' + onChange={this.handleAdditionalTimeChange.bind(this)} onKeyDown={(e) => actions.resetValidation(e.currentTarget)} required - /> + /> </div> </div> </div> @@ -75,7 +88,7 @@ class ShiftVehicleJourney extends Component { Annuler </button> <button - className='btn btn-primary' + className={'btn btn-primary ' + (this.state.additional_time == 0 ? 'disabled' : '')} type='button' onClick={this.handleSubmit.bind(this)} > diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js index d277be003..c1ce0e92a 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js @@ -20,10 +20,11 @@ class BSelect4 extends React.Component{ data={(this.props.company) ? [this.props.company.name] : undefined} value={(this.props.company) ? this.props.company.name : undefined} onSelect={(e) => this.props.onSelect2Company(e) } + onUnselect={() => this.props.onUnselect2Company()} multiple={false} ref='company_id' options={{ - allowClear: false, + allowClear: true, theme: 'bootstrap', width: '100%', placeholder: 'Filtrer par transporteur...', diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js index c04a1d642..922a1e5ee 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js @@ -34,7 +34,7 @@ class BSelect4 extends React.Component{ delay: '500', data: function(params) { return { - q: {published_name_or_objectid_or_registration_number_cont: params.term}, + q: {published_name_cont_or_short_id_or_registration_number_cont: params.term}, }; }, processResults: function(data, params) { @@ -43,7 +43,7 @@ class BSelect4 extends React.Component{ item => _.assign( {}, item, - { text: "<strong>" + item.published_name + _.last(_.split(item.object_id, ':')) + "</strong><br/><small>" + item.registration_number + "</small>" } + { text: "<strong>" + item.published_name + " - " + item.short_id + "</strong><br/><small>" + item.registration_number + "</small>" } ) ) }; diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js index 3e81290f5..5157300ba 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js @@ -33,8 +33,13 @@ class BSelect4 extends React.Component{ dataType: 'json', delay: '500', data: function(params) { + let newParmas = params.term.split(" ") return { - q: {comment_cont: params.term}, + q: { + objectid_cont_any: newParmas, + comment_cont_any: newParmas, + m: 'or' + } }; }, processResults: function(data, params) { @@ -43,7 +48,7 @@ class BSelect4 extends React.Component{ item => _.assign( {}, item, - {text: '<strong>' + (item.color ? "<span class='fa fa-circle' style='color:" + item.color + "'></span> " : '') + item.comment + ' - ' + item.short_id + '</strong><br/><small>' + item.day_types.match(/[A-Z]?[a-z]+/g).join(', ') + '</small>'} + {text: '<strong>' + "<span class='fa fa-circle' style='color:" + (item.color ? item.color : '#4B4B4B') + "'></span> " + item.comment + ' - ' + item.short_id + '</strong><br/><small>' + (item.day_types ? item.day_types.match(/[A-Z]?[a-z]+/g).join(', ') : "") + '</small>'} ) ) }; diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/SaveVehicleJourneys.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/SaveVehicleJourneys.js index 87bbe5353..c1ce90d38 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/SaveVehicleJourneys.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/SaveVehicleJourneys.js @@ -5,6 +5,7 @@ var SaveVehicleJourneysComponent = require('../components/SaveVehicleJourneys') const mapStateToProps = (state) => { return { + editMode: state.editMode, vehicleJourneys: state.vehicleJourneys, page: state.pagination.page, status: state.status, @@ -12,6 +13,17 @@ const mapStateToProps = (state) => { } } -const SaveVehicleJourneys = connect(mapStateToProps)(SaveVehicleJourneysComponent) +const mapDispatchToProps = (dispatch) => { + return { + onEnterEditMode: () => { + dispatch(actions.enterEditMode()) + }, + onSubmitVehicleJourneys: (next, state) => { + actions.submitVehicleJourneys(dispatch, state, next) + } + } +} + +const SaveVehicleJourneys = connect(mapStateToProps, mapDispatchToProps)(SaveVehicleJourneysComponent) module.exports = SaveVehicleJourneys diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/Tools.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/Tools.js index 35f492c98..a4b3056ac 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/Tools.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/Tools.js @@ -4,7 +4,9 @@ var actions = require('../actions') const mapStateToProps = (state) => { return { - vehicleJourneys: state.vehicleJourneys + vehicleJourneys: state.vehicleJourneys, + editMode: state.editMode, + filters: state.filters } } diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/VehicleJourneysList.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/VehicleJourneysList.js index 176a68500..f834e4457 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/VehicleJourneysList.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/VehicleJourneysList.js @@ -4,6 +4,7 @@ var VehicleJourneys = require('../components/VehicleJourneys') const mapStateToProps = (state) => { return { + editMode: state.editMode, vehicleJourneys: state.vehicleJourneys, status: state.status, filters: state.filters, diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/DuplicateVehicleJourney.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/DuplicateVehicleJourney.js index 224b52a19..70e8fde4d 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/DuplicateVehicleJourney.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/DuplicateVehicleJourney.js @@ -19,8 +19,8 @@ const mapDispatchToProps = (dispatch) => { onOpenDuplicateModal: () =>{ dispatch(actions.openDuplicateModal()) }, - onDuplicateVehicleJourney: (data, departureDelta) =>{ - dispatch(actions.duplicateVehicleJourney(data, departureDelta)) + onDuplicateVehicleJourney: (addtionalTime, duplicateNumber, departureDelta) =>{ + dispatch(actions.duplicateVehicleJourney(addtionalTime, duplicateNumber, departureDelta)) } } } diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/EditVehicleJourney.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/EditVehicleJourney.js index 8f4d43519..ac9772b8a 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/EditVehicleJourney.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/EditVehicleJourney.js @@ -24,7 +24,10 @@ const mapDispatchToProps = (dispatch) => { }, onSelect2Company: (e) => { dispatch(actions.select2Company(e.params.data)) - } + }, + onUnselect2Company: () => { + dispatch(actions.unselect2Company()) + }, } } diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/index.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/index.js index 97aa60526..53bbcf952 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/index.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/index.js @@ -19,6 +19,7 @@ if (window.journeyPatternId) selectedJP.push(window.journeyPatternId) var initialState = { + editMode: false, filters: { selectedJourneyPatterns : selectedJP, policy: window.perms, @@ -89,7 +90,7 @@ if (window.jpOrigin){ let store = createStore( enableBatching(vehicleJourneysApp), - initialState + initialState, // applyMiddleware(thunkMiddleware, promise, loggerMiddleware) ) diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/editMode.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/editMode.js new file mode 100644 index 000000000..2e8af1aa8 --- /dev/null +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/editMode.js @@ -0,0 +1,12 @@ +const editMode = (state = {}, action ) => { + switch (action.type) { + case "ENTER_EDIT_MODE": + return true + case "EXIT_EDIT_MODE": + return false + default: + return state + } +} + +module.exports = editMode diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/index.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/index.js index bd4d7226b..4e0839102 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/index.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/index.js @@ -4,6 +4,7 @@ var pagination = require('./pagination') var modal = require('./modal') var status = require('./status') var filters = require('./filters') +var editMode = require('./editMode') var stopPointsList = require('./stopPointsList') const vehicleJourneysApp = combineReducers({ @@ -12,6 +13,7 @@ const vehicleJourneysApp = combineReducers({ modal, status, filters, + editMode, stopPointsList }) diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/modal.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/modal.js index 229fd2058..1e5ff4294 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/modal.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/modal.js @@ -57,6 +57,9 @@ const modal = (state = {}, action) => { case 'SELECT_CP_EDIT_MODAL': newModalProps = _.assign({}, state.modalProps, {selectedCompany : action.selectedItem}) return _.assign({}, state, {modalProps: newModalProps}) + case 'UNSELECT_CP_EDIT_MODAL': + newModalProps = _.assign({}, state.modalProps, {selectedCompany : undefined}) + return _.assign({}, state, {modalProps: newModalProps}) case 'SELECT_TT_CALENDAR_MODAL': newModalProps = _.assign({}, state.modalProps, {selectedTimetable : action.selectedItem}) return _.assign({}, state, {modalProps: newModalProps}) diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/vehicleJourneys.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/vehicleJourneys.js index d463d4b8f..969b2ddd8 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/vehicleJourneys.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/vehicleJourneys.js @@ -51,17 +51,8 @@ const vehicleJourney= (state = {}, action, keep) => { let shiftedArray, shiftedSchedule, shiftedVjas shiftedArray = state.vehicle_journey_at_stops.map((vjas, i) => { if (!vjas.dummy){ - shiftedSchedule = { - departure_time: { - hour: vjas.departure_time.hour, - minute: actions.simplePad(parseInt(vjas.departure_time.minute) + parseInt(action.data.additional_time.value)) - }, - arrival_time: { - hour: vjas.arrival_time.hour, - minute: actions.simplePad(parseInt(vjas.arrival_time.minute) + parseInt(action.data.additional_time.value)) - } - } - actions.checkSchedules(shiftedSchedule) + shiftedSchedule = actions.getShiftedSchedule(vjas, action.addtionalTime) + shiftedVjas = _.assign({}, state.vehicle_journey_at_stops[i], shiftedSchedule) vjas = _.assign({}, state.vehicle_journey_at_stops[i], shiftedVjas) if(!keep){ @@ -181,13 +172,16 @@ const vehicleJourneys = (state = [], action) => { let dupeVj let dupes = [] let selectedIndex - let val = action.data.additional_time.value + let val = action.addtionalTime let departureDelta = action.departureDelta state.map((vj, i) => { if(vj.selected){ selectedIndex = i - for (i = 0; i< action.data.duplicate_number.value; i++){ - action.data.additional_time.value = (parseInt(val) * (i + 1)) + departureDelta + for (i = 0; i< action.duplicateNumber; i++){ + // We check if the departureDelta is != 0 to create the first VJ on the updated deparure time if it is the case + // let delta = departureDelta == 0 ? 1 : 0 + // action.addtionalTime = (val * (i + delta)) + departureDelta + action.addtionalTime = (val * (i + 1)) + departureDelta dupeVj = vehicleJourney(vj, action, false) dupeVj.published_journey_name = dupeVj.published_journey_name + '-' + i dupeVj.selected = false diff --git a/app/assets/javascripts/routing_constraint_zones.coffee b/app/assets/javascripts/routing_constraint_zones.coffee index c01c9ca2f..8fdcb3b50 100644 --- a/app/assets/javascripts/routing_constraint_zones.coffee +++ b/app/assets/javascripts/routing_constraint_zones.coffee @@ -1,18 +1,17 @@ -$ -> - - update_stop_points = () -> - url = $('#routing_constraint_zone_route_id').attr("data-url") - routing_constraint_zone_json = $('#routing_constraint_zone_route_id').attr("data-object") - route_id = $('#routing_constraint_zone_route_id').val() - $.ajax - url: url - dataType: 'script' - data: { route_id: route_id, routing_constraint_zone_json: routing_constraint_zone_json } - error: (jqXHR, textStatus, errorThrown) -> - console.log("ERROR") - success: (data, textStatus, jqXHR) -> - console.log("SUCCESS") +update_stop_points = () -> + url = $('#routing_constraint_zone_route_id').attr("data-url") + routing_constraint_zone_json = $('#routing_constraint_zone_route_id').attr("data-object") + route_id = $('#routing_constraint_zone_route_id').val() + $.ajax + url: url + dataType: 'script' + data: { route_id: route_id, routing_constraint_zone_json: routing_constraint_zone_json } + error: (jqXHR, textStatus, errorThrown) -> + console.log("ERROR") + success: (data, textStatus, jqXHR) -> + console.log("SUCCESS") - $("#itl_form #routing_constraint_zone_route_id").on 'change', -> update_stop_points() - - update_stop_points() +$ -> + if $('#routing_constraint_zone_route_id').hasClass('new_routing_constraint_zone_route') + $("#routing_constraint_zone_route_id").on 'change', -> update_stop_points() + update_stop_points() diff --git a/app/assets/javascripts/select2.coffee b/app/assets/javascripts/select2.coffee index 1c03fe451..2e3884d7f 100644 --- a/app/assets/javascripts/select2.coffee +++ b/app/assets/javascripts/select2.coffee @@ -25,6 +25,8 @@ bind_select2_ajax = (el, cfg = {}) -> item.text templateSelection: (item) -> item.text + escapeMarkup: (markup) -> + markup bind_select2(el, cfg) diff --git a/app/assets/javascripts/time_table.coffee b/app/assets/javascripts/time_table.coffee new file mode 100644 index 000000000..8789cb226 --- /dev/null +++ b/app/assets/javascripts/time_table.coffee @@ -0,0 +1,14 @@ + $(document).on("click", "#time_table_filter_btn", (e) -> + dates = [1, 2, 3].reduce (arr, key) -> + arr.push $("#q_start_date_gteq_#{key}i").val(), $("#q_end_date_lteq_#{key}i").val() + arr + , [] + + validDate = dates.every (date) -> !!date + + noDate = dates.every (date) -> !date + + unless (validDate || noDate) + e.preventDefault() + alert(window.I18n.fr.time_tables.error_period_filter) + ) diff --git a/app/assets/javascripts/workbench.coffee b/app/assets/javascripts/workbench.coffee new file mode 100644 index 000000000..0e9fe62a3 --- /dev/null +++ b/app/assets/javascripts/workbench.coffee @@ -0,0 +1,18 @@ + $(document).on("click", "#referential_filter_btn", (e) -> + dates = [1, 2, 3].reduce (arr, key) -> + arr.push $("#q_validity_period_begin_gteq_#{key}i").val(), $("#q_validity_period_end_lteq_#{key}i").val() + arr + , [] + + validDate = dates.every (date) -> !!date + + noDate = dates.every (date) -> !date + + console.log("valid dates :", validDate) + console.log("no dates :", noDate) + console.log(dates) + + unless (validDate || noDate) + e.preventDefault() + alert(window.I18n.fr.referentials.error_period_filter) + ) diff --git a/app/assets/stylesheets/components/_page_header.sass b/app/assets/stylesheets/components/_page_header.sass index 18985083d..566f46d6b 100644 --- a/app/assets/stylesheets/components/_page_header.sass +++ b/app/assets/stylesheets/components/_page_header.sass @@ -9,13 +9,15 @@ .page-icon display: inline-block vertical-align: middle - width: 45px - height: 45px - background-color: rgba(#fff, 0.2) - line-height: 45px + width: 49px + height: 49px + line-height: 49px text-align: center - margin-right: 20px + margin-right: 15px + + > .sb + font-size: 3.5em .page-title display: inline-block diff --git a/app/assets/stylesheets/components/_tables.sass b/app/assets/stylesheets/components/_tables.sass index 3fc92d348..8fe7be374 100644 --- a/app/assets/stylesheets/components/_tables.sass +++ b/app/assets/stylesheets/components/_tables.sass @@ -85,6 +85,74 @@ border-top: 2px solid $darkgrey margin-top: 15px + // Overhead + > thead > tr.overhead + > th + font-size: 1.4rem + text-align: center + + &.overheaded-default + background-color: rgba($grey, 0.15) + + &.full-border + border-left: 2px solid rgba($grey, 0.15) + border-right: 2px solid rgba($grey, 0.15) + + &.overheaded-danger + background-color: $red + color: #fff + + &.full-border + border-left: 2px solid $red + border-right: 2px solid $red + + &.overheaded-warning + background-color: $orange + color: #fff + + &.full-border + border-left: 2px solid $orange + border-right: 2px solid $orange + + &.overheaded-success + background-color: $green + color: #fff + + &.full-border + border-left: 2px solid $green + border-right: 2px solid $green + + tr:not([class*='overhead']) > th, td + &.overheaded-default + border-left: 2px solid rgba($grey, 0.15) + border-right: 2px solid rgba($grey, 0.15) + + &.overheaded-danger + border-left: 2px solid $red + border-right: 2px solid $red + + &.overheaded-warning + border-left: 2px solid $orange + border-right: 2px solid $orange + + &.overheaded-success + border-left: 2px solid $green + border-right: 2px solid $green + + tr:last-child + td + &.overheaded-default + border-bottom: 2px solid rgba($grey, 0.15) + + &.overheaded-danger + border-bottom: 2px solid $red + + &.overheaded-warning + border-bottom: 2px solid $orange + + &.overheaded-success + border-bottom: 2px solid $green + // Specific for tables displaying stop points &.has-stoppoints tbody @@ -144,7 +212,6 @@ margin-top: -8px - // select_toolbox .select_toolbox padding: 10px diff --git a/app/assets/stylesheets/typography/_fonts.sass b/app/assets/stylesheets/typography/_fonts.sass index 0cc387d74..03ef0b42d 100644 --- a/app/assets/stylesheets/typography/_fonts.sass +++ b/app/assets/stylesheets/typography/_fonts.sass @@ -7,34 +7,34 @@ @font-face // Regular font-family: 'Open Sans' - src: url(asset-path('OpenSans/Regular/OpenSans-Regular.woff2')) format('woff2'), url(asset-path('OpenSans/Regular/OpenSans-Regular.woff')) format('woff'), url(asset-path('OpenSans/Regular/OpenSans-Regular.ttf')) format('ttf') + src: url(asset-path('OpenSans/Regular/OpenSans-Regular.woff2')) format('woff2'), url(asset-path('OpenSans/Regular/OpenSans-Regular.woff')) format('woff'), url(asset-path('OpenSans/Regular/OpenSans-Regular.ttf')) format('truetype') font-weight: 400 font-style: normal @font-face // Regular Italic font-family: 'Open Sans' - src: url(asset-path('OpenSans/Regular/OpenSans-Italic.woff2')) format('woff2'), url(asset-path('OpenSans/Regular/OpenSans-Italic.woff')) format('woff'), url(asset-path('OpenSans/Regular/OpenSans-Italic.ttf')) format('ttf') + src: url(asset-path('OpenSans/Regular/OpenSans-Italic.woff2')) format('woff2'), url(asset-path('OpenSans/Regular/OpenSans-Italic.woff')) format('woff'), url(asset-path('OpenSans/Regular/OpenSans-Italic.ttf')) format('truetype') font-weight: 400 font-style: italic @font-face // Bold font-family: 'Open Sans' - src: url(asset-path('OpenSans/Bold/OpenSans-Bold.woff2')) format('woff2'), url(asset-path('OpenSans/Bold/OpenSans-Bold.woff')) format('woff'), url(asset-path('OpenSans/Bold/OpenSans-Bold.ttf')) format('ttf') + src: url(asset-path('OpenSans/Bold/OpenSans-Bold.woff2')) format('woff2'), url(asset-path('OpenSans/Bold/OpenSans-Bold.woff')) format('woff'), url(asset-path('OpenSans/Bold/OpenSans-Bold.ttf')) format('truetype') font-weight: 700 font-style: normal @font-face // Bold Italic font-family: 'Open Sans' - src: url(asset-path('OpenSans/Bold/OpenSans-BoldItalic.woff2')) format('woff2'), url(asset-path('OpenSans/Bold/OpenSans-BoldItalic.woff')) format('woff'), url(asset-path('OpenSans/Bold/OpenSans-BoldItalic.ttf')) format('ttf') + src: url(asset-path('OpenSans/Bold/OpenSans-BoldItalic.woff2')) format('woff2'), url(asset-path('OpenSans/Bold/OpenSans-BoldItalic.woff')) format('woff'), url(asset-path('OpenSans/Bold/OpenSans-BoldItalic.ttf')) format('truetype') font-weight: 700 font-style: italic //-- sBoiv --// @font-face font-family: 'sboiv' - src: url(asset-path('sBoiv/sboiv.woff?vhxdui')) format('woff'), url(asset-path('sBoiv/sboiv.ttf?vhxdui')) format('ttf') + src: url(asset-path('sBoiv/sboiv.woff?ctftl5')) format('woff'), url(asset-path('sBoiv/sboiv.ttf?ctftl5')) format('truetype') font-weight: normal font-style: normal diff --git a/app/assets/stylesheets/typography/_sboiv.sass b/app/assets/stylesheets/typography/_sboiv.sass index 1f89bad74..e37f89f2d 100644 --- a/app/assets/stylesheets/typography/_sboiv.sass +++ b/app/assets/stylesheets/typography/_sboiv.sass @@ -53,8 +53,86 @@ font-size: 5em -.sb-update-vj:before - content: '\e900' +.sb-ZDLR:before + content: '\e904' + +.sb-ZDER:before + content: '\e905' + +.sb-ZDEP:before + content: '\e906' + +.sb-transporteur:before + content: '\e907' + +.sb-trace:before + content: '\e908' + +.sb-tableau-de-bord:before + content: '\e909' + +.sb-synchro-ilico:before + content: '\e90a' + +.sb-synchro-icar:before + content: '\e90b' + +.sb-reseau:before + content: '\e90c' + +.sb-rapport-de-controle:before + content: '\e90d' + +.sb-OAT:before + content: '\e90e' + +.sb-OAS:before + content: '\e90f' + +.sb-modele-calendrier:before + content: '\e910' + +.sb-mission:before + content: '\e911' + +.sb-ligne_commerciale:before + content: '\e912' + +.sb-ligne_administrative:before + content: '\e913' + +.sb-LDA:before + content: '\e914' + +.sb-jeux-de-donnees:before + content: '\e915' + +.sb-jeux-de-controle:before + content: '\e916' + +.sb-itl:before + content: '\e917' + +.sb-itineraire:before + content: '\e918' + +.sb-importer:before + content: '\e919' + +.sb-horaires-des-courses:before + content: '\e91a' + +.sb-calendrier-application:before + content: '\e91b' + +.sb-arret:before + content: '\e91c' + +.sb-Acces:before + content: '\e91d' + +.sb-chrono:before + content: '\e903' .sb-preparing:before content: '\e901' @@ -62,5 +140,8 @@ .sb-current-ref:before content: '\e902' -.sb-chrono:before - content: '\e903' +.sb-update-vj:before + content: '\e900' + +.sb-ligne:before + content: '\e91e' diff --git a/app/concerns/configurable.rb b/app/concerns/configurable.rb new file mode 100644 index 000000000..c7d0f1fd9 --- /dev/null +++ b/app/concerns/configurable.rb @@ -0,0 +1,26 @@ +module Configurable + + module ClassMethods + def config &blk + blk ? blk.(configuration) : configuration + end + + private + def configuration + @__configuration__ ||= Rails::Application::Configuration.new + end + end + + module InstanceMethods + private + + def config + self.class.config + end + end + + def self.included(into) + into.extend ClassMethods + into.send :include, InstanceMethods + end +end diff --git a/app/controllers/api/v1/chouette_controller.rb b/app/controllers/api/v1/chouette_controller.rb index 7805074ee..98c2fff05 100644 --- a/app/controllers/api/v1/chouette_controller.rb +++ b/app/controllers/api/v1/chouette_controller.rb @@ -7,7 +7,6 @@ module Api before_action :authenticate private - def authenticate authenticate_or_request_with_http_token do |token, options| @referential = Api::V1::ApiKey.referential_from_token(token) @@ -16,10 +15,10 @@ module Api switch_referential if @api_key end end + def switch_referential Apartment::Tenant.switch!(@api_key.referential.slug) - end - + end end end end diff --git a/app/controllers/api/v1/iboo_controller.rb b/app/controllers/api/v1/iboo_controller.rb new file mode 100644 index 000000000..4db9e9007 --- /dev/null +++ b/app/controllers/api/v1/iboo_controller.rb @@ -0,0 +1,21 @@ +class Api::V1::IbooController < Api::V1::ChouetteController + protected + def begin_of_association_chain + @current_organisation + end + + private + def authenticate + authenticate_with_http_basic do |code, token| + if organisation = Organisation.find_by(code: code) + if organisation.api_keys.exists?(token: token) + @current_organisation = organisation + end + end + end + + unless @current_organisation + request_http_basic_authentication + end + end +end diff --git a/app/controllers/api/v1/imports_controller.rb b/app/controllers/api/v1/imports_controller.rb new file mode 100644 index 000000000..6050418d8 --- /dev/null +++ b/app/controllers/api/v1/imports_controller.rb @@ -0,0 +1,15 @@ +class Api::V1::ImportsController < Api::V1::IbooController + defaults :resource_class => WorkbenchImport + belongs_to :workbench + + def create + args = workbench_import_params.merge(creator: 'Webservice') + @import = parent.workbench_imports.create(args) + create! + end + + private + def workbench_import_params + params.require(:workbench_import).permit(:file, :name) + end +end diff --git a/app/controllers/api/v1/netex_imports_controller.rb b/app/controllers/api/v1/netex_imports_controller.rb new file mode 100644 index 000000000..046802ff9 --- /dev/null +++ b/app/controllers/api/v1/netex_imports_controller.rb @@ -0,0 +1,87 @@ +module Api + module V1 + class NetexImportsController < ChouetteController + include ControlFlow + + skip_before_action :authenticate + + def create + respond_to do | format | + format.json(&method(:create_models)) + end + end + + + private + + def find_workbench + @workbench = Workbench.find(netex_import_params['workbench_id']) + rescue ActiveRecord::RecordNotFound + render json: {errors: {'workbench_id' => 'missing'}}, status: 406 + finish_action! + end + + def create_models + find_workbench + create_referential + create_netex_import + end + + def create_netex_import + attributes = netex_import_params.merge creator: "Webservice" + + if @new_referential.persisted? + attributes = attributes.merge referential_id: @new_referential.id + else + attributes = attributes.merge status: "failed" + end + + @netex_import = NetexImport.new attributes + @netex_import.save! + + unless @netex_import.referential + Rails.logger.info "Can't create referential for import #{@netex_import.id}: #{@new_referential.inspect} #{@new_referential.metadatas.inspect} #{@new_referential.errors.full_messages}" + @netex_import.messages.create criticity: :error, message_key: "cant_create_referential" + end + rescue ActiveRecord::RecordInvalid + render json: {errors: @netex_import.errors}, status: 406 + finish_action! + end + + def create_referential + @new_referential = + Referential.new( + name: netex_import_params['name'], + organisation_id: @workbench.organisation_id, + workbench_id: @workbench.id, + metadatas: [metadata] + ) + @new_referential.save + end + + def metadata + metadata = ReferentialMetadata.new + + if netex_import_params['file'] + netex_file = STIF::NetexFile.new(netex_import_params['file'].to_io) + frame = netex_file.frames.first + + if frame + metadata.periodes = frame.periods + + line_objectids = frame.line_refs.map { |ref| "STIF:CODIFLIGNE:Line:#{ref}" } + metadata.line_ids = @workbench.lines.where(objectid: line_objectids).pluck(:id) + end + end + + metadata + end + + def netex_import_params + params + .require('netex_import') + .permit(:file, :name, :workbench_id, :parent_id, :parent_type) + end + end + end +end diff --git a/app/controllers/api/v1/workbenches_controller.rb b/app/controllers/api/v1/workbenches_controller.rb new file mode 100644 index 000000000..3c07997ce --- /dev/null +++ b/app/controllers/api/v1/workbenches_controller.rb @@ -0,0 +1,3 @@ +class Api::V1::WorkbenchesController < Api::V1::IbooController + defaults :resource_class => Workbench +end diff --git a/app/controllers/api_keys_controller.rb b/app/controllers/api_keys_controller.rb index 35a84da87..7059cf52e 100644 --- a/app/controllers/api_keys_controller.rb +++ b/app/controllers/api_keys_controller.rb @@ -1,22 +1,32 @@ -class ApiKeysController < ChouetteController - defaults :resource_class => Api::V1::ApiKey - - belongs_to :referential +class ApiKeysController < BreadcrumbController + defaults resource_class: Api::V1::ApiKey def create - create! { referential_path(@referential) } + @api_key = Api::V1::ApiKey.new(api_key_params.merge(organisation: current_organisation)) + create! { organisation_api_keys_path } + end + + def index + @api_keys = decorate_api_keys(current_organisation.api_keys.paginate(page: params[:page])) end + def update - update! { referential_path(@referential) } + update! { organisation_api_key_path(resource) } end + def destroy - destroy! { referential_path(@referential) } + destroy! { organisation_api_keys_path } end private def api_key_params - params.require(:api_key).permit( :name ) - end - -end + params.require(:api_key).permit(:name, :referential_id) + end + def decorate_api_keys(api_keys) + ModelDecorator.decorate( + api_keys, + with: ApiKeyDecorator, + ) + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8fcaa3b1b..d15aa336d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -37,6 +37,7 @@ class ApplicationController < ActionController::Base current_organisation end + # Overwriting the sign_out redirect path method def after_sign_out_path_for(resource_or_scope) new_user_session_path diff --git a/app/controllers/autocomplete_time_tables_controller.rb b/app/controllers/autocomplete_time_tables_controller.rb index e977a28b0..375928aeb 100644 --- a/app/controllers/autocomplete_time_tables_controller.rb +++ b/app/controllers/autocomplete_time_tables_controller.rb @@ -15,11 +15,11 @@ class AutocompleteTimeTablesController < InheritedResources::Base protected def select_time_tables - scope = referential.time_tables + scope = params[:source_id] ? referential.time_tables.where("time_tables.id != ?", params[:source_id]) : referential.time_tables if params[:route_id] scope = scope.joins(vehicle_journeys: :route).where( "routes.id IN (#{params[:route_id]})") end - scope + scope.distinct end def collection diff --git a/app/controllers/concerns/control_flow.rb b/app/controllers/concerns/control_flow.rb new file mode 100644 index 000000000..0f41a1cda --- /dev/null +++ b/app/controllers/concerns/control_flow.rb @@ -0,0 +1,14 @@ +module ControlFlow + FinishAction = Class.new RuntimeError + + def self.included into + into.rescue_from FinishAction, with: :catch_finish_action + end + + # Allow to exit locally inside an action after rendering (especially in error cases) + def catch_finish_action; end + + def finish_action! msg = 'finish action' + raise FinishAction, msg + end +end diff --git a/app/controllers/import_tasks_controller.rb b/app/controllers/import_tasks_controller.rb index 0e3ed6445..cb377ec5a 100644 --- a/app/controllers/import_tasks_controller.rb +++ b/app/controllers/import_tasks_controller.rb @@ -1,4 +1,3 @@ -# coding: utf-8 class ImportTasksController < ChouetteController defaults :resource_class => ImportTask diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb index 70c5c1a0d..b1b34731b 100644 --- a/app/controllers/imports_controller.rb +++ b/app/controllers/imports_controller.rb @@ -6,12 +6,24 @@ class ImportsController < BreadcrumbController def show show! do + @import = @import.decorate(context: { + workbench: @workbench + }) + build_breadcrumb :show end end def index - index! do + index! do |format| + format.html { + if collection.out_of_bounds? + redirect_to params.merge(:page => 1) + end + + @imports = decorate_imports(@imports) + } + build_breadcrumb :index end end @@ -22,10 +34,6 @@ class ImportsController < BreadcrumbController end end - def create - create! { workbench_import_path(parent, resource) } - end - def download if params[:token] == resource.token_download send_file resource.file.path @@ -34,16 +42,49 @@ class ImportsController < BreadcrumbController end end + protected + def collection + @q = parent.imports.where(type: "WorkbenchImport").search(params[:q]) + + if sort_column && sort_direction + @imports ||= @q.result(distinct: true).order(sort_column + ' ' + sort_direction).paginate(page: params[:page], per_page: 10) + else + @imports ||= @q.result(distinct: true).order(:name).paginate(page: params[:page], per_page: 10) + end + end + private def build_resource - # Manage only NetexImports for the moment - @import ||= NetexImport.new(*resource_params) do |import| + @import ||= WorkbenchImport.new(*resource_params) do |import| import.workbench = parent + import.creator = current_user.name end end def import_params - params.require(:import).permit(:name, :file, :type, :referential_id) + params.require(:import).permit( + :name, + :file, + :type, + :referential_id + ) + end + + def sort_column + parent.imports.column_names.include?(params[:sort]) ? params[:sort] : 'name' + end + def sort_direction + %w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc' + end + + def decorate_imports(imports) + ModelDecorator.decorate( + imports, + with: ImportDecorator, + context: { + workbench: @workbench + } + ) end end diff --git a/app/controllers/routing_constraint_zones_controller.rb b/app/controllers/routing_constraint_zones_controller.rb index 6c3cb8a29..78cd0e209 100644 --- a/app/controllers/routing_constraint_zones_controller.rb +++ b/app/controllers/routing_constraint_zones_controller.rb @@ -55,26 +55,43 @@ class RoutingConstraintZonesController < ChouetteController alias_method :line, :parent def collection - @q = current_referential.routing_constraint_zones.search(params[:q]) + @q = line.routing_constraint_zones.search(params[:q]) @routing_constraint_zones ||= begin - if sort_column && sort_direction - routing_constraint_zones = @q.result(distinct: true).order(sort_column + ' ' + sort_direction) - else - routing_constraint_zones = @q.result(distinct: true).order(:name) - end - routing_constraint_zones = routing_constraint_zones.paginate(page: params[:page], per_page: 10) + routing_constraint_zones = sort_collection + routing_constraint_zones = routing_constraint_zones.paginate( + page: params[:page], + per_page: 10 + ) end end private def sort_column - (Chouette::RoutingConstraintZone.column_names).include?(params[:sort]) ? params[:sort] : 'name' + ( + Chouette::RoutingConstraintZone.column_names + + [ + 'stop_points_count', + 'route' + ] + ).include?(params[:sort]) ? params[:sort] : 'name' end def sort_direction %w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc' end + def sort_collection + sort_by = sort_column + + if sort_by == 'stop_points_count' + @q.result.order_by_stop_points_count(sort_direction) + elsif sort_by == 'route' + @q.result.order_by_route_name(sort_direction) + else + @q.result.order(sort_column + ' ' + sort_direction) + end + end + def routing_constraint_zone_params params.require(:routing_constraint_zone).permit( :name, diff --git a/app/controllers/time_table_combinations_controller.rb b/app/controllers/time_table_combinations_controller.rb index 32f1818b0..ba61a2ea4 100644 --- a/app/controllers/time_table_combinations_controller.rb +++ b/app/controllers/time_table_combinations_controller.rb @@ -3,13 +3,17 @@ class TimeTableCombinationsController < ChouetteController belongs_to :time_table, :parent_class => Chouette::TimeTable end + # include PolicyChecker + def new @combination = TimeTableCombination.new(source_id: parent.id) + authorize @combination @combination.combined_type = 'time_table' end def create @combination = TimeTableCombination.new(params[:time_table_combination].merge(source_id: parent.id)) + authorize @combination @combination.valid? ? perform_combination : render(:new) end diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index b0f346c5c..0054963c9 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -35,7 +35,7 @@ class TimeTablesController < ChouetteController def create tt_params = time_table_params - unless tt_params[:calendar_id] && tt_params[:calendar_id] == "" + if tt_params[:calendar_id] && tt_params[:calendar_id] != "" %i(monday tuesday wednesday thursday friday saturday sunday).map { |d| tt_params[d] = true } calendar = Calendar.find(tt_params[:calendar_id]) tt_params[:calendar_id] = nil if tt_params.has_key?(:dates_attributes) || tt_params.has_key?(:periods_attributes) diff --git a/app/decorators/api_key_decorator.rb b/app/decorators/api_key_decorator.rb new file mode 100644 index 000000000..def3a6a01 --- /dev/null +++ b/app/decorators/api_key_decorator.rb @@ -0,0 +1,30 @@ +class ApiKeyDecorator < Draper::Decorator + decorates Api::V1::ApiKey + delegate_all + + + def action_links + links = [] + + links << Link.new( + content: h.t('api_keys.actions.show'), + href: h.organisation_api_key_path(object), + ) + + links << Link.new( + content: h.t('api_keys.actions.edit'), + href: h.edit_organisation_api_key_path(object), + ) + + if h.policy(object).destroy? + links << Link.new( + content: h.destroy_link_content, + href: h.organisation_api_key_path(object), + method: :delete, + data: { confirm: h.t('api_keys.actions.destroy_confirm') } + ) + end + + links + end +end diff --git a/app/decorators/import_decorator.rb b/app/decorators/import_decorator.rb new file mode 100644 index 000000000..eb6a34a13 --- /dev/null +++ b/app/decorators/import_decorator.rb @@ -0,0 +1,36 @@ +class ImportDecorator < Draper::Decorator + decorates Import + + delegate_all + + def action_links + links = [] + + links << Link.new( + content: h.t('imports.actions.show'), + href: h.workbench_import_path( + context[:workbench], + object + ) + ) + + links << Link.new( + content: h.t('imports.actions.download'), + href: object.file.url + ) + + # if h.policy(object).destroy? + links << Link.new( + content: h.destroy_link_content, + href: h.workbench_import_path( + context[:workbench], + object + ), + method: :delete, + data: { confirm: h.t('imports.actions.destroy_confirm') } + ) + + links + end + +end diff --git a/app/decorators/time_table_decorator.rb b/app/decorators/time_table_decorator.rb index 526537310..c6eeac176 100644 --- a/app/decorators/time_table_decorator.rb +++ b/app/decorators/time_table_decorator.rb @@ -21,13 +21,15 @@ class TimeTableDecorator < Draper::Decorator ) end - links << Link.new( - content: h.t('actions.combine'), - href: h.new_referential_time_table_time_table_combination_path( - context[:referential], - object + if h.policy(object).edit? + links << Link.new( + content: h.t('actions.combine'), + href: h.new_referential_time_table_time_table_combination_path( + context[:referential], + object + ) ) - ) + end if h.policy(object).duplicate? links << Link.new( diff --git a/app/helpers/breadcrumb_helper.rb b/app/helpers/breadcrumb_helper.rb index 1f8690f38..55031d4f3 100644 --- a/app/helpers/breadcrumb_helper.rb +++ b/app/helpers/breadcrumb_helper.rb @@ -73,13 +73,13 @@ module BreadcrumbHelper end def calendar_breadcrumb(action) - add_breadcrumb I18n.t('breadcrumbs.referentials'), referentials_path + add_breadcrumb I18n.t('breadcrumbs.referentials'), workbenches_path add_breadcrumb I18n.t('calendars.index.title'), calendars_path add_breadcrumb @calendar.name if %i(show edit).include? action end def workbench_breadcrumb(action) - add_breadcrumb I18n.t("breadcrumbs.referentials"), referentials_path + add_breadcrumb I18n.t("breadcrumbs.referentials"), workbenches_path add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench) end @@ -215,7 +215,7 @@ module BreadcrumbHelper end def import_breadcrumb (action) - add_breadcrumb I18n.t("breadcrumbs.referentials"), referentials_path + add_breadcrumb I18n.t("breadcrumbs.referentials"), workbenches_path add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench) add_breadcrumb I18n.t("breadcrumbs.imports"), workbench_imports_path(@workbench) @@ -257,7 +257,7 @@ module BreadcrumbHelper end def organisation_breadcrumb (action = :index) - add_breadcrumb I18n.t("breadcrumbs.referentials"), referentials_path + add_breadcrumb I18n.t("breadcrumbs.referentials"), workbenches_path add_breadcrumb breadcrumb_label(@organisation), organisation_path,:title => breadcrumb_tooltip(@organisation) unless action == :index end diff --git a/app/helpers/newapplication_helper.rb b/app/helpers/newapplication_helper.rb index ac57997d1..df19113db 100644 --- a/app/helpers/newapplication_helper.rb +++ b/app/helpers/newapplication_helper.rb @@ -222,7 +222,7 @@ module NewapplicationHelper # Left part with pageicon & pagetitle & desc left = content_tag :div, '', class: 'col-lg-9 col-md-8 col-sm-7 col-xs-7' do picon = content_tag :div, '', class: 'page-icon' do - content_tag :span, '', class: "fa fa-lg fa-#{pageicon}" + content_tag :span, '', class: "sb sb-#{pageicon}" end ptitle = content_tag :div, '', class: 'page-title' do content_tag :h1, pagetitle, title: desc diff --git a/app/helpers/table_builder_helper.rb b/app/helpers/table_builder_helper.rb index 897e842a8..f15019458 100644 --- a/app/helpers/table_builder_helper.rb +++ b/app/helpers/table_builder_helper.rb @@ -42,7 +42,8 @@ require 'table_builder_helper/url' # ), # ], # links: [:show, :edit], -# cls: 'table has-search' +# cls: 'table has-search', +# overhead: [ {title: 'one', width: 1, cls: 'toto'}, {title: 'two <span class="test">Info</span>', width: 2, cls: 'default'} ] # ) module TableBuilderHelper # TODO: rename this after migration from `table_builder` @@ -65,19 +66,36 @@ module TableBuilderHelper links: [], # A CSS class to apply to the <table> - cls: '' + cls: '', + + # A set of content, over the th line... + overhead: [] ) content_tag :table, - thead(collection, columns, sortable, selectable, links.any?) + - tbody(collection, columns, selectable, links), + thead(collection, columns, sortable, selectable, links.any?, overhead) + + tbody(collection, columns, selectable, links, overhead), class: cls end private - def thead(collection, columns, sortable, selectable, has_links) + def thead(collection, columns, sortable, selectable, has_links, overhead) content_tag :thead do - content_tag :tr do + # Inserts overhead content if any specified + over_head = '' + + unless overhead.empty? + over_head = content_tag :tr, class: 'overhead' do + oh_cont = [] + + overhead.each do |h| + oh_cont << content_tag(:th, raw(h[:title]), colspan: h[:width], class: h[:cls]) + end + oh_cont.join.html_safe + end + end + + main_head = content_tag :tr do hcont = [] if selectable @@ -85,25 +103,73 @@ module TableBuilderHelper end columns.each do |column| - hcont << content_tag(:th, build_column_header( - column, - sortable, - collection.model, - params, - params[:sort], - params[:direction] - )) + if overhead.empty? + hcont << content_tag(:th, build_column_header( + column, + sortable, + collection.model, + params, + params[:sort], + params[:direction] + )) + + else + i = columns.index(column) + + if overhead[i].blank? + if (i > 0) && (overhead[i - 1][:width] > 1) + clsArrayH = overhead[i - 1][:cls].split + + hcont << content_tag(:th, build_column_header( + column, + sortable, + collection.model, + params, + params[:sort], + params[:direction] + ), class: td_cls(clsArrayH)) + + else + hcont << content_tag(:th, build_column_header( + column, + sortable, + collection.model, + params, + params[:sort], + params[:direction] + )) + end + + else + clsArrayH = overhead[i][:cls].split + + hcont << content_tag(:th, build_column_header( + column, + sortable, + collection.model, + params, + params[:sort], + params[:direction] + ), class: td_cls(clsArrayH)) + + end + + end end # Inserts a blank column for the gear menu - hcont << content_tag(:th, '') if has_links + if has_links || collection.last.try(:action_links).try(:any?) + hcont << content_tag(:th, '') + end hcont.join.html_safe end + + (over_head + main_head).html_safe end end - def tbody(collection, columns, selectable, links) + def tbody(collection, columns, selectable, links, overhead) content_tag :tbody do collection.map do |item| @@ -126,13 +192,57 @@ module TableBuilderHelper item, referential ) - bcont << content_tag(:td, link_to(value, polymorph_url), title: 'Voir') + + if overhead.empty? + bcont << content_tag(:td, link_to(value, polymorph_url), title: 'Voir') + + else + i = columns.index(column) + + if overhead[i].blank? + if (i > 0) && (overhead[i - 1][:width] > 1) + clsArrayAlt = overhead[i - 1][:cls].split + + bcont << content_tag(:td, link_to(value, polymorph_url), title: 'Voir', class: td_cls(clsArrayAlt)) + + else + bcont << content_tag(:td, link_to(value, polymorph_url), title: 'Voir') + end + + else + clsArray = overhead[columns.index(column)][:cls].split + + bcont << content_tag(:td, link_to(value, polymorph_url), title: 'Voir', class: td_cls(clsArray)) + end + end + else - bcont << content_tag(:td, value) + if overhead.empty? + bcont << content_tag(:td, value) + + else + i = columns.index(column) + + if overhead[i].blank? + if (i > 0) && (overhead[i - 1][:width] > 1) + clsArrayAlt = overhead[i - 1][:cls].split + + bcont << content_tag(:td, value, class: td_cls(clsArrayAlt)) + + else + bcont << content_tag(:td, value) + end + + else + clsArray = overhead[i][:cls].split + + bcont << content_tag(:td, value, class: td_cls(clsArray)) + end + end end end - if links.any? + if links.any? || item.try(:action_links).try(:any?) bcont << content_tag( :td, build_links(item, links), @@ -146,6 +256,14 @@ module TableBuilderHelper end end + def td_cls(a) + if a.include? 'full-border' + a.slice!(a.index('full-border')) + + return a.join(' ') + end + end + def build_links(item, links) trigger = content_tag( :div, @@ -175,12 +293,11 @@ module TableBuilderHelper sort_on, sort_direction ) - if !table_is_sortable + + if !table_is_sortable || !column.sortable return column.header_label(collection_model) end - return column.name if !column.sortable - direction = if column.key.to_s == sort_on && sort_direction == 'desc' 'asc' diff --git a/app/helpers/table_builder_helper/url.rb b/app/helpers/table_builder_helper/url.rb index 0894df0fe..f7ba703ae 100644 --- a/app/helpers/table_builder_helper/url.rb +++ b/app/helpers/table_builder_helper/url.rb @@ -12,7 +12,12 @@ module TableBuilderHelper polymorph_url << item.stop_area if item.respond_to? :stop_area polymorph_url << item if item.respond_to?(:stop_points) || item.is_a?(Chouette::TimeTable) elsif item.respond_to? :referential - polymorph_url << item.referential + if item.respond_to? :workbench + polymorph_url << item.workbench + polymorph_url << item + else + polymorph_url << item.referential + end end else polymorph_url << item diff --git a/app/models/api/v1/api_key.rb b/app/models/api/v1/api_key.rb index 7390db232..767e65f3a 100644 --- a/app/models/api/v1/api_key.rb +++ b/app/models/api/v1/api_key.rb @@ -3,9 +3,32 @@ module Api class ApiKey < ::ActiveRecord::Base before_create :generate_access_token belongs_to :referential, :class_name => '::Referential' + belongs_to :organisation, :class_name => '::Organisation' - def self.model_name - ActiveModel::Name.new self, Api::V1, self.name.demodulize + validates_presence_of :organisation + + class << self + def from(referential, name:) + find_or_create_by!(name: name, referential: referential) + end + + def referential_from_token(token) + array = token.split('-') + if !array.first.empty? && array.size > 1 + ::Referential.find array.first + end + end + + def model_name + ActiveModel::Name.new self, Api::V1, self.name.demodulize + end + + def organisation_from_token(token) + array = token.split('-') + if !array[1].empty? && array.size > 1 + ::Organisation.find array[1] + end + end end def eql?(other) @@ -13,16 +36,11 @@ module Api other.token == self.token end - def self.referential_from_token(token) - array = token.split('-') - return nil unless array.size==2 - ::Referential.find( array.first) - end private def generate_access_token begin - self.token = "#{referential.id}-#{SecureRandom.hex}" + self.token = "#{referential_id}-#{organisation_id}-#{SecureRandom.hex}" end while self.class.exists?(:token => self.token) end end diff --git a/app/models/calendar.rb b/app/models/calendar.rb index fb575515a..bb38e74df 100644 --- a/app/models/calendar.rb +++ b/app/models/calendar.rb @@ -31,6 +31,7 @@ class Calendar < ActiveRecord::Base self.periods.each do |p| tt.periods << Chouette::TimeTablePeriod.new(period_start: p.begin, period_end: p.end) end + tt.int_day_types = 508 end end diff --git a/app/models/chouette/access_point.rb b/app/models/chouette/access_point.rb index c81867b52..4a1ae8a0e 100644 --- a/app/models/chouette/access_point.rb +++ b/app/models/chouette/access_point.rb @@ -34,6 +34,10 @@ class Chouette::AccessPoint < Chouette::ActiveRecord @referential ||= Referential.where(:slug => Apartment::Tenant.current).first! end + def referential + @referential ||= Referential.where(:slug => Apartment::Tenant.current).first! + end + def combine_lat_lng if self.latitude.nil? || self.longitude.nil? "" diff --git a/app/models/chouette/footnote.rb b/app/models/chouette/footnote.rb index de427b249..1664faf23 100644 --- a/app/models/chouette/footnote.rb +++ b/app/models/chouette/footnote.rb @@ -1,6 +1,13 @@ class Chouette::Footnote < Chouette::ActiveRecord + include ChecksumSupport + belongs_to :line, inverse_of: :footnotes has_and_belongs_to_many :vehicle_journeys, :class_name => 'Chouette::VehicleJourney' validates_presence_of :line + + def checksum_attributes + attrs = ['code', 'label'] + self.slice(*attrs).values + end end diff --git a/app/models/chouette/journey_pattern.rb b/app/models/chouette/journey_pattern.rb index 0761b052d..55a42002b 100644 --- a/app/models/chouette/journey_pattern.rb +++ b/app/models/chouette/journey_pattern.rb @@ -1,4 +1,5 @@ class Chouette::JourneyPattern < Chouette::TridentActiveRecord + include ChecksumSupport include JourneyPatternRestrictions # FIXME http://jira.codehaus.org/browse/JRUBY-6358 self.primary_key = "id" @@ -14,16 +15,23 @@ class Chouette::JourneyPattern < Chouette::TridentActiveRecord validates_presence_of :route validates_presence_of :name - validates :stop_points, length: { minimum: 2, too_short: :minimum }, on: :update + #validates :stop_points, length: { minimum: 2, too_short: :minimum }, on: :update enum section_status: { todo: 0, completed: 1, control: 2 } attr_accessor :control_checked after_update :control_route_sections, :unless => "control_checked" + def local_id "#{self.try(:route).try(:line).try(:objectid).try(:local_id)}-#{self.referential.id}-#{self.id}" end + def checksum_attributes + values = self.slice(*['name', 'published_name', 'registration_number']).values + values << self.stop_points.map(&:stop_area).map(&:user_objectid) + values.flatten + end + def self.state_update route, state transaction do state.each do |item| @@ -174,4 +182,3 @@ class Chouette::JourneyPattern < Chouette::TridentActiveRecord end end - diff --git a/app/models/chouette/route.rb b/app/models/chouette/route.rb index 81c16f62f..1f59bb7fd 100644 --- a/app/models/chouette/route.rb +++ b/app/models/chouette/route.rb @@ -1,5 +1,6 @@ class Chouette::Route < Chouette::TridentActiveRecord include RouteRestrictions + include ChecksumSupport extend Enumerize extend ActiveModel::Naming @@ -103,6 +104,14 @@ class Chouette::Route < Chouette::TridentActiveRecord end end + def checksum_attributes + values = self.slice(*['name', 'published_name', 'wayback']).values + values.tap do |attrs| + attrs << self.stop_points.map{|sp| "#{sp.stop_area.user_objectid}#{sp.for_boarding}#{sp.for_alighting}" }.join + attrs << self.routing_constraint_zones.map(&:checksum) + end + end + def geometry points = stop_areas.map(&:to_lat_lng).compact.map do |loc| [loc.lng, loc.lat] diff --git a/app/models/chouette/routing_constraint_zone.rb b/app/models/chouette/routing_constraint_zone.rb index 89f221f0a..3b379fcda 100644 --- a/app/models/chouette/routing_constraint_zone.rb +++ b/app/models/chouette/routing_constraint_zone.rb @@ -1,15 +1,30 @@ class Chouette::RoutingConstraintZone < Chouette::TridentActiveRecord + include ChecksumSupport + belongs_to :route has_array_of :stop_points, class_name: 'Chouette::StopPoint' validates_presence_of :name, :stop_points, :route - validates :stop_point_ids, length: { minimum: 2, too_short: I18n.t('activerecord.errors.models.routing_constraint_zone.attributes.stop_points.not_enough_stop_points') } + # validates :stop_point_ids, length: { minimum: 2, too_short: I18n.t('activerecord.errors.models.routing_constraint_zone.attributes.stop_points.not_enough_stop_points') } validate :stop_points_belong_to_route, :not_all_stop_points_selected def local_id "#{self.route.line.objectid.local_id}-#{self.route.objectid.local_id}-#{self.objectid.local_id}" end + scope :order_by_stop_points_count, ->(direction) do + order("array_length(stop_point_ids, 1) #{direction}") + end + + scope :order_by_route_name, ->(direction) do + joins(:route) + .order("routes.name #{direction}") + end + + def checksum_attributes + self.stop_points.map(&:stop_area).map(&:user_objectid) + end + def stop_points_belong_to_route errors.add(:stop_point_ids, I18n.t('activerecord.errors.models.routing_constraint_zone.attributes.stop_points.stop_points_not_from_route')) unless stop_points.all? { |sp| route.stop_points.include? sp } end diff --git a/app/models/chouette/time_table.rb b/app/models/chouette/time_table.rb index 448070bcf..d5c168a8f 100644 --- a/app/models/chouette/time_table.rb +++ b/app/models/chouette/time_table.rb @@ -1,4 +1,5 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord + include ChecksumSupport include TimeTableRestrictions # FIXME http://jira.codehaus.org/browse/JRUBY-6358 self.primary_key = "id" @@ -21,7 +22,11 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord belongs_to :created_from, class_name: 'Chouette::TimeTable' scope :overlapping, -> (date_start, date_end) do - joins(:periods).where('(period_start, period_end) OVERLAPS (?, ?)', date_start, date_end) + joins(" + LEFT JOIN time_table_periods ON time_tables.id = time_table_periods.time_table_id + LEFT JOIN time_table_dates ON time_tables.id = time_table_dates.time_table_id + ") + .where("(time_table_periods.period_start <= :end AND time_table_periods.period_end >= :start) OR (time_table_dates.date BETWEEN :start AND :end)", {start: date_start, end: date_end}) end after_save :save_shortcuts @@ -30,6 +35,18 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord "#{self.referential.id}-#{self.id}" end + def checksum_attributes + [].tap do |attrs| + attrs << self.int_day_types + attrs << self.dates.map(&:checksum).map(&:to_s).sort + attrs << self.periods.map(&:checksum).map(&:to_s).sort + end + end + + def self.object_id_key + "Timetable" + end + accepts_nested_attributes_for :dates, :allow_destroy => :true accepts_nested_attributes_for :periods, :allow_destroy => :true @@ -297,7 +314,7 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord end def display_day_types - %w(monday tuesday wednesday thursday friday saturday sunday).select{ |d| self.send(d) }.map{ |d| self.human_attribute_name(d).first(2)}.join('') + %w(monday tuesday wednesday thursday friday saturday sunday).select{ |d| self.send(d) }.map{ |d| self.human_attribute_name(d).first(2)}.join(', ') end def day_by_mask(flag) @@ -461,53 +478,6 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord optimized.sort { |a,b| a.period_start <=> b.period_start} end - def continuous_periods - periods = self.periods.sort_by(&:period_start) - chunk = {} - group = nil - periods.each_with_index do |period, index| - group ||= index - group = (period.period_start - 1.day == periods[index - 1].period_end) ? group : group + 1 - chunk[group] ||= [] - chunk[group] << period - end - chunk.values.delete_if {|periods| periods.count < 2} - end - - def convert_continuous_periods_into_one - chunks = self.continuous_periods - - transaction do - chunks.each do |chunk| - self.periods.create!(period_start: chunk.first.period_start, period_end: chunk.last.period_end) - self.periods.delete(chunk) - end - end - end - - #update a period if a in_day is just before or after - def optimize_continuous_dates_and_periods - - - in_days = self.dates.where(in_out: true).sort_by(&:date) - periods = self.clone_periods - optimized = [] - - periods.each do |period| - in_days.each do |day| - if period.period_start - 1.day === day.date - period.period_start = day.date - self.dates.delete(day) - elsif period.period_end + 1.day === day.date - period.period_end = day.date - self.dates.delete(day) - end - end - optimized << period - end - optimized - end - # add a peculiar day or switch it from excluded to included def add_included_day(d) if self.excluded_date?(d) @@ -524,24 +494,20 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord # merge effective days from another timetable def merge!(another_tt) transaction do - self.periods = another_tt.clone_periods + self.periods + days = [].tap do |array| + array.push(*self.effective_days, *another_tt.effective_days) + array.uniq! + end - # For included dates - another_tt.included_days.map{ |d| add_included_day(d) } + self.dates.clear + self.periods.clear - # For excluded dates - existing_out_date = self.dates.where(in_out: false).map(&:date) - another_tt.dates.where(in_out: false).each do |d| - unless existing_out_date.include?(d.date) - self.dates << Chouette::TimeTableDate.new(:date => d.date, :in_out => false) - end - self.save! + days.each do |day| + self.dates << Chouette::TimeTableDate.new(date: day, in_out: true) end - self.convert_continuous_dates_to_periods - self.periods = self.optimize_continuous_dates_and_periods - self.convert_continuous_periods_into_one - self.periods = self.optimize_overlapping_periods + self.save! end + self.convert_continuous_dates_to_periods end def included_days_in_dates_and_periods @@ -554,12 +520,18 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord days end - # remove dates form tt which aren't in another_tt + # keep common dates with another_tt def intersect!(another_tt) transaction do - days = self.included_days_in_dates_and_periods & another_tt.included_days_in_dates_and_periods + days = [].tap do |array| + array.push(*self.effective_days) + array.delete_if {|day| !another_tt.effective_days.include?(day) } + array.uniq! + end + self.dates.clear self.periods.clear + days.sort.each do |d| self.dates << Chouette::TimeTableDate.new(:date => d, :in_out => true) end @@ -568,12 +540,18 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord self.convert_continuous_dates_to_periods end - # remove days from another calendar + # remove common dates with another_tt def disjoin!(another_tt) transaction do - days = self.included_days_in_dates_and_periods - another_tt.included_days_in_dates_and_periods + days = [].tap do |array| + array.push(*self.effective_days) + array.delete_if {|day| another_tt.effective_days.include?(day) } + array.uniq! + end + self.dates.clear self.periods.clear + days.sort.each do |d| self.dates << Chouette::TimeTableDate.new(:date => d, :in_out => true) end diff --git a/app/models/chouette/time_table_date.rb b/app/models/chouette/time_table_date.rb index b881c9a5d..1893eae91 100644 --- a/app/models/chouette/time_table_date.rb +++ b/app/models/chouette/time_table_date.rb @@ -1,4 +1,6 @@ class Chouette::TimeTableDate < Chouette::ActiveRecord + include ChecksumSupport + self.primary_key = "id" belongs_to :time_table, inverse_of: :dates acts_as_list :scope => 'time_table_id = #{time_table_id}',:top_of_list => 0 @@ -12,5 +14,9 @@ class Chouette::TimeTableDate < Chouette::ActiveRecord ActiveModel::Name.new Chouette::TimeTableDate, Chouette, "TimeTableDate" end + def checksum_attributes + attrs = ['date', 'in_out'] + self.slice(*attrs).values + end end diff --git a/app/models/chouette/time_table_period.rb b/app/models/chouette/time_table_period.rb index 6d3486bb6..ed136f3b9 100644 --- a/app/models/chouette/time_table_period.rb +++ b/app/models/chouette/time_table_period.rb @@ -1,4 +1,6 @@ class Chouette::TimeTablePeriod < Chouette::ActiveRecord + include ChecksumSupport + self.primary_key = "id" belongs_to :time_table, inverse_of: :periods acts_as_list :scope => 'time_table_id = #{time_table_id}',:top_of_list => 0 @@ -7,6 +9,10 @@ class Chouette::TimeTablePeriod < Chouette::ActiveRecord validate :start_must_be_before_end + def checksum_attributes + attrs = ['period_start', 'period_end'] + self.slice(*attrs).values + end def self.model_name ActiveModel::Name.new Chouette::TimeTablePeriod, Chouette, "TimeTablePeriod" diff --git a/app/models/chouette/vehicle_journey.rb b/app/models/chouette/vehicle_journey.rb index 3a887744e..0fcd08a01 100644 --- a/app/models/chouette/vehicle_journey.rb +++ b/app/models/chouette/vehicle_journey.rb @@ -1,5 +1,6 @@ module Chouette class VehicleJourney < TridentActiveRecord + include ChecksumSupport include VehicleJourneyRestrictions include StifTransportModeEnumerations # FIXME http://jira.codehaus.org/browse/JRUBY-6358 @@ -23,11 +24,11 @@ module Chouette validates_presence_of :route validates_presence_of :journey_pattern - validates :vehicle_journey_at_stops, + # validates :vehicle_journey_at_stops, # Validation temporarily removed for day offsets # :vjas_departure_time_must_be_before_next_stop_arrival_time, - vehicle_journey_at_stops_are_in_increasing_time_order: true + # vehicle_journey_at_stops_are_in_increasing_time_order: false validates_presence_of :number has_many :vehicle_journey_at_stops, -> { includes(:stop_point).order("stop_points.position") }, :dependent => :destroy @@ -59,6 +60,16 @@ module Chouette "#{self.route.line.objectid.local_id}-#{self.objectid.local_id}" end + def checksum_attributes + [].tap do |attrs| + attrs << self.published_journey_name + attrs << self.published_journey_identifier + attrs << self.try(:company).try(:objectid).try(:local_id) + attrs << self.footnotes.map(&:checksum).sort + attrs << self.vehicle_journey_at_stops.map(&:checksum).sort + end + end + def set_default_values if number.nil? self.number = 0 diff --git a/app/models/chouette/vehicle_journey_at_stop.rb b/app/models/chouette/vehicle_journey_at_stop.rb index 35d94aa75..156cc761f 100644 --- a/app/models/chouette/vehicle_journey_at_stop.rb +++ b/app/models/chouette/vehicle_journey_at_stop.rb @@ -2,6 +2,7 @@ module Chouette class VehicleJourneyAtStop < ActiveRecord include ForBoardingEnumerations include ForAlightingEnumerations + include ChecksumSupport DAY_OFFSET_MAX = 1 @@ -66,6 +67,13 @@ module Chouette offset < 0 || offset > DAY_OFFSET_MAX end - + def checksum_attributes + [].tap do |attrs| + attrs << self.departure_time.try(:to_s, :time) + attrs << self.arrival_time.try(:to_s, :time) + attrs << self.departure_day_offset.to_s + attrs << self.arrival_day_offset.to_s + end + end end end diff --git a/app/models/concerns/checksum_support.rb b/app/models/concerns/checksum_support.rb new file mode 100644 index 000000000..c95e23bcf --- /dev/null +++ b/app/models/concerns/checksum_support.rb @@ -0,0 +1,29 @@ +module ChecksumSupport + extend ActiveSupport::Concern + SEPARATOR = '|' + VALUE_FOR_NIL_ATTRIBUTE = '-' + + included do + before_save :set_current_checksum_source, :update_checksum + end + + def checksum_attributes + self.attributes.values + end + + def current_checksum_source + source = self.checksum_attributes.map{ |x| x unless x.try(:empty?) } + source = source.map{ |x| x || VALUE_FOR_NIL_ATTRIBUTE } + source.map(&:to_s).join(SEPARATOR) + end + + def set_current_checksum_source + self.checksum_source = self.current_checksum_source + end + + def update_checksum + if self.checksum_source_changed? + self.checksum = Digest::SHA256.new.hexdigest(self.checksum_source) + end + end +end diff --git a/app/models/concerns/error_format.rb b/app/models/concerns/error_format.rb new file mode 100644 index 000000000..158edb6e4 --- /dev/null +++ b/app/models/concerns/error_format.rb @@ -0,0 +1,29 @@ +# TODO: This module should be moved out of concerns to somewhere that makes +# more sense. + +module ErrorFormat extend self + + def details error_object + error_object.errors.messages.inject({}) do |hash, error| + hash.merge(partial(:detail, error_object, error).call) + end + end + + private + + def detail error_object, error + { + error.first => { + error: error.last.first, + value: error_object[error.first] + } + } + end + + def partial name, *partial_args + -> *lazy_args do + send(name, *(partial_args + lazy_args)) + end + end + +end diff --git a/app/models/import.rb b/app/models/import.rb index d0736ab0b..9daff0494 100644 --- a/app/models/import.rb +++ b/app/models/import.rb @@ -3,13 +3,95 @@ class Import < ActiveRecord::Base belongs_to :workbench belongs_to :referential + belongs_to :parent, polymorphic: true + + has_many :messages, class_name: "ImportMessage" + has_many :children, foreign_key: :parent_id, class_name: "Import" + extend Enumerize - enumerize :status, in: %i(new pending successful failed running aborted canceled) + enumerize :status, in: %i(new pending successful failed running aborted canceled), scope: true validates :file, presence: true + validates_presence_of :workbench, :creator + + before_create :initialize_fields + + def self.model_name + ActiveModel::Name.new Import, Import, "Import" + end + + def children_succeedeed + children.with_status(:successful).count + end - before_create do + def self.failing_statuses + symbols_with_indifferent_access(%i(failed aborted canceled)) + end + + def self.finished_statuses + symbols_with_indifferent_access(%i(successful failed aborted canceled)) + end + + def notify_parent + parent.child_change + update(notified_parent_at: DateTime.now) + end + + def child_change + return if self.class.finished_statuses.include?(status) + + update_status + update_referentials + end + + def update_status + status_count = children.group(:status).count + children_finished_count = children_failed_count = children_count = 0 + + status_count.each do |status, count| + if self.class.failing_statuses.include?(status) + children_failed_count += count + end + if self.class.finished_statuses.include?(status) + children_finished_count += count + end + children_count += count + end + + attributes = { + current_step: children_finished_count + } + + status = + if children_failed_count > 0 + 'failed' + elsif status_count['successful'] == children_count + 'successful' + end + + if self.class.finished_statuses.include?(status) + attributes[:ended_at] = Time.now + end + + update attributes.merge(status: status) + end + + def update_referentials + return unless self.class.finished_statuses.include?(status) + + children.each do |import| + import.referential.update(ready: true) if import.referential + end + end + + private + + def initialize_fields self.token_download = SecureRandom.urlsafe_base64 self.status = Import.status.new end + + def self.symbols_with_indifferent_access(array) + array.flat_map { |symbol| [symbol, symbol.to_s] } + end end diff --git a/app/models/netex_import.rb b/app/models/netex_import.rb index de5b84537..90ac42f2c 100644 --- a/app/models/netex_import.rb +++ b/app/models/netex_import.rb @@ -1,14 +1,20 @@ require 'net/http' class NetexImport < Import - after_commit :launch_java_import + after_commit :launch_java_import, on: :create + + validates_presence_of :parent def launch_java_import + return if self.class.finished_statuses.include?(status) logger.warn "Call iev get #{Rails.configuration.iev_url}/boiv_iev/referentials/importer/new?id=#{id}" - begin - Net::HTTP.get(URI("#{Rails.configuration.iev_url}/boiv_iev/referentials/importer/new?id=#{id}")) - rescue Exception => e - logger.error "IEV server error : e.message" - logger.error e.backtrace.inspect + + Thread.new do + begin + Net::HTTP.get(URI("#{Rails.configuration.iev_url}/boiv_iev/referentials/importer/new?id=#{id}")) + rescue Exception => e + logger.error "IEV server error : #{e.message}" + logger.error e.backtrace.inspect + end end end end diff --git a/app/models/organisation.rb b/app/models/organisation.rb index d0742bda6..895ca03d9 100644 --- a/app/models/organisation.rb +++ b/app/models/organisation.rb @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- class Organisation < ActiveRecord::Base include DataFormatEnumerations @@ -14,6 +13,7 @@ class Organisation < ActiveRecord::Base has_many :workbenches has_many :calendars + has_many :api_keys, class_name: 'Api::V1::ApiKey' validates_presence_of :name validates_uniqueness_of :code @@ -26,19 +26,12 @@ class Organisation < ActiveRecord::Base def self.portail_api_request conf = Rails.application.config.try(:stif_portail_api) - raise 'Rails.application.config.stif_portail_api settings is not defined' unless conf + raise 'Rails.application.config.stif_portail_api configuration is not defined' unless conf - conn = Faraday.new(:url => conf[:url]) do |c| - c.headers['Authorization'] = "Token token=\"#{conf[:key]}\"" - c.adapter Faraday.default_adapter - end - - resp = conn.get '/api/v1/organizations' - if resp.status == 200 - JSON.parse resp.body - else - raise "Error on api request status : #{resp.status} => #{resp.body}" - end + HTTPService.get_json_resource( + host: conf[:url], + path: '/api/v1/organizations', + token: conf[:key]) end def self.sync_update code, name, scope diff --git a/app/models/user.rb b/app/models/user.rb index c2aa14bda..37d35209a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -41,19 +41,12 @@ class User < ActiveRecord::Base def self.portail_api_request conf = Rails.application.config.try(:stif_portail_api) - raise 'Rails.application.config.stif_portail_api settings is not defined' unless conf + raise 'Rails.application.config.stif_portail_api configuration is not defined' unless conf - conn = Faraday.new(:url => conf[:url]) do |c| - c.headers['Authorization'] = %{Token token="#{conf[:key]}"} - c.adapter Faraday.default_adapter - end - - resp = conn.get '/api/v1/users' - if resp.status == 200 - JSON.parse resp.body - else - raise "Error on api request status : #{resp.status} => #{resp.body}" - end + HTTPService.get_json_resource( + host: conf[:url], + path: '/api/v1/users', + token: conf[:key]) end def self.portail_sync diff --git a/app/models/workbench.rb b/app/models/workbench.rb index 775affcc7..30692e625 100644 --- a/app/models/workbench.rb +++ b/app/models/workbench.rb @@ -9,7 +9,7 @@ class Workbench < ActiveRecord::Base has_many :group_of_lines, through: :line_referential has_many :stop_areas, through: :stop_area_referential has_many :imports - has_many :workbench_object_identifiers + has_many :workbench_imports validates :name, presence: true validates :organisation, presence: true diff --git a/app/models/workbench_import.rb b/app/models/workbench_import.rb new file mode 100644 index 000000000..27f53a44f --- /dev/null +++ b/app/models/workbench_import.rb @@ -0,0 +1,7 @@ +class WorkbenchImport < Import + after_commit :launch_worker, :on => :create + + def launch_worker + WorkbenchImportWorker.perform_async(id) + end +end diff --git a/app/policies/api_key_policy.rb b/app/policies/api_key_policy.rb new file mode 100644 index 000000000..7b4c22e33 --- /dev/null +++ b/app/policies/api_key_policy.rb @@ -0,0 +1,19 @@ +class ApiKeyPolicy < ApplicationPolicy + class Scope < Scope + def resolve + scope + end + end + + def destroy? + organisation_match? && user.has_permission?('api_keys.destroy') + end + + def create? + organisation_match? && user.has_permission?('api_keys.create') + end + + def update? + organisation_match? && user.has_permission?('api_keys.update') + end +end diff --git a/app/policies/import_policy.rb b/app/policies/import_policy.rb new file mode 100644 index 000000000..9e1d99a66 --- /dev/null +++ b/app/policies/import_policy.rb @@ -0,0 +1,7 @@ +class ImportPolicy < ApplicationPolicy + class Scope < Scope + def resolve + scope + end + end +end diff --git a/app/policies/time_table_combination_policy.rb b/app/policies/time_table_combination_policy.rb new file mode 100644 index 000000000..daa6808e4 --- /dev/null +++ b/app/policies/time_table_combination_policy.rb @@ -0,0 +1,12 @@ +class TimeTableCombinationPolicy < ApplicationPolicy + + class Scope < Scope + def resolve + scope + end + end + + def create? + !archived? && organisation_match? && user.has_permission?('time_tables.update') + end +end diff --git a/app/services/http_service.rb b/app/services/http_service.rb new file mode 100644 index 000000000..d3999f293 --- /dev/null +++ b/app/services/http_service.rb @@ -0,0 +1,42 @@ +module HTTPService extend self + + Timeout = Faraday::TimeoutError + + def get_resource(host:, path:, token: nil, params: {}) + Faraday.new(url: host) do |c| + c.headers['Authorization'] = "Token token=#{token.inspect}" if token + c.adapter Faraday.default_adapter + + return c.get path, params + end + end + + def get_json_resource(host:, path:, token: nil, params: {}) + # Stupid Ruby!!! (I mean I just **need** Pattern Matching, maybe I need to write it myself :O) + resp = get_resource(host: host, path: path, token: token, params: params) + if resp.status == 200 + return JSON.parse(resp.body) + else + raise "Error on api request status : #{resp.status} => #{resp.body}" + end + end + # host: 'http://localhost:3000', + # path: '/api/v1/netex_imports.json', + # token: '13-74009c36638f587c9eafb1ce46e95585', + # params: { netex_import: {referential_id: 13, workbench_id: 1}}, + # upload: {file: [StringIO.new('howdy'), 'application/zip', 'greeting']}) + def post_resource(host:, path:, token: nil, params: {}, upload: nil) + result = Faraday.new(url: host) do |c| + c.headers['Authorization'] = "Token token=#{token.inspect}" if token + c.request :multipart + c.request :url_encoded + c.adapter Faraday.default_adapter + return c.post path, params + end + end + + # Expose this in order to make the service replaceable + def upload(*triple) + Faraday::UploadIO.new(*triple) + end +end diff --git a/app/services/parent_import_notifier.rb b/app/services/parent_import_notifier.rb new file mode 100644 index 000000000..47e6755e4 --- /dev/null +++ b/app/services/parent_import_notifier.rb @@ -0,0 +1,15 @@ +class ParentImportNotifier + def self.notify_when_finished(imports = nil) + imports ||= imports_pending_notification + imports.each(&:notify_parent) + end + + def self.imports_pending_notification + Import + .where( + notified_parent_at: nil, + status: Import.finished_statuses + ) + .where.not(parent: nil) + end +end diff --git a/app/services/zip_service.rb b/app/services/zip_service.rb new file mode 100644 index 000000000..cab301b01 --- /dev/null +++ b/app/services/zip_service.rb @@ -0,0 +1,68 @@ +class ZipService + # TODO: Remove me before merge https://github.com/rubyzip/rubyzip + + class Subdir < Struct.new(:name, :stream) + end + + attr_reader :current_key, :current_output, :yielder + + def initialize data + @zip_data = StringIO.new(data) + @current_key = nil + @current_output = nil + end + + def subdirs + Enumerator.new do |yielder| + @yielder = yielder + Zip::File.open_buffer(@zip_data, &(method :_subdirs)) + end + end + + def _subdirs zip_file + zip_file.each do | entry | + add_entry entry + end + finish_current_output + end + + def add_entry entry + key = entry_key entry + unless key == current_key + finish_current_output + open_new_output key + end + add_to_current_output entry + end + + def add_to_current_output entry + current_output.put_next_entry entry.name + write_to_current_output entry.get_input_stream + end + + def write_to_current_output input_stream + # the condition below is true for directory entries + return if Zip::NullInputStream == input_stream + current_output.write input_stream.read + end + + def finish_current_output + if current_output + @yielder << Subdir.new( + current_key, + # Second part of the solution, yield the closed stream + current_output.close_buffer) + end + end + + def open_new_output entry_key + @current_key = entry_key + # First piece of the solution, use internal way to create a Zip::OutputStream + @current_output = Zip::OutputStream.new(StringIO.new(''), true, nil) + end + + def entry_key entry + # last dir name File.dirname.split("/").last + entry.name.split('/', -1)[-2] + end +end diff --git a/app/views/api/v1/imports/index.rabl b/app/views/api/v1/imports/index.rabl new file mode 100644 index 000000000..e8cfd101e --- /dev/null +++ b/app/views/api/v1/imports/index.rabl @@ -0,0 +1,3 @@ +collection @imports + +extends "api/v1/imports/show" diff --git a/app/views/api/v1/imports/show.rabl b/app/views/api/v1/imports/show.rabl new file mode 100644 index 000000000..180894cb8 --- /dev/null +++ b/app/views/api/v1/imports/show.rabl @@ -0,0 +1,6 @@ +object @import + +attributes :id, :name, :status +node :referential_ids do |i| + i.workbench.referentials.map(&:id) +end diff --git a/app/views/api/v1/journey_patterns/show.rabl b/app/views/api/v1/journey_patterns/show.rabl index 21f25e480..7c3af52fc 100644 --- a/app/views/api/v1/journey_patterns/show.rabl +++ b/app/views/api/v1/journey_patterns/show.rabl @@ -5,6 +5,13 @@ extends "api/v1/trident_objects/show" attributes attr, :unless => lambda { |m| m.send( attr).nil?} end +node do |jp| + { + short_id: jp.objectid.parts.try(:third) + } + +end + node(:route_short_description) do |journey_pattern| partial("api/v1/routes/short_description", :object => journey_pattern.route) end @@ -18,4 +25,3 @@ child :stop_points => :stop_area_short_descriptions do |stop_points| partial("api/v1/stop_areas/short_description", :object => stop_point.stop_area) end end - diff --git a/app/views/api/v1/netex_imports/create.json.rabl b/app/views/api/v1/netex_imports/create.json.rabl new file mode 100644 index 000000000..f37703349 --- /dev/null +++ b/app/views/api/v1/netex_imports/create.json.rabl @@ -0,0 +1,3 @@ + +object @netex_import +attributes :id, :workbench_id, :referential_id diff --git a/app/views/api/v1/workbenches/index.rabl b/app/views/api/v1/workbenches/index.rabl new file mode 100644 index 000000000..2f0bf5fee --- /dev/null +++ b/app/views/api/v1/workbenches/index.rabl @@ -0,0 +1,3 @@ +collection @workbenches + +extends "api/v1/workbenches/show" diff --git a/app/views/api/v1/workbenches/show.rabl b/app/views/api/v1/workbenches/show.rabl new file mode 100644 index 000000000..d43727809 --- /dev/null +++ b/app/views/api/v1/workbenches/show.rabl @@ -0,0 +1,3 @@ +object @workbench + +attributes :id, :name diff --git a/app/views/api_keys/_form.html.slim b/app/views/api_keys/_form.html.slim index 74b806677..f3ebf3fe1 100644 --- a/app/views/api_keys/_form.html.slim +++ b/app/views/api_keys/_form.html.slim @@ -1,10 +1,7 @@ -= semantic_form_for [@referential, @api_key] do |form| - = form.inputs do - = form.input :name - += simple_form_for @api_key, url: action_url do |f| + = f.input :name - unless @api_key.new_record? - = form.input :token, :input_html => { :readonly => true } + = f.input :token, :input_html => { readonly: true } - = form.actions do - = form.action :submit, as: :button - = form.action :cancel, as: :link
\ No newline at end of file + = f.association :referential + = f.button :submit, 'submit', class: 'btn-primary' diff --git a/app/views/api_keys/edit.html.slim b/app/views/api_keys/edit.html.slim index 110f0775d..e47deddf7 100644 --- a/app/views/api_keys/edit.html.slim +++ b/app/views/api_keys/edit.html.slim @@ -1,3 +1,2 @@ = title_tag t('api_keys.edit.title') - -== render 'form'
\ No newline at end of file +== render partial: 'form', locals: {action_url: organisation_api_key_path} diff --git a/app/views/api_keys/index.html.slim b/app/views/api_keys/index.html.slim new file mode 100644 index 000000000..fc8d95c7a --- /dev/null +++ b/app/views/api_keys/index.html.slim @@ -0,0 +1,24 @@ +- header_params = ['map-marker', + t('.title'), + ''] +- header_params << link_to(t('actions.add'), new_organisation_api_key_path, class: 'btn btn-default') if policy(Api::V1::ApiKey).create? += pageheader(*header_params) do + + +- if @api_keys.any? + .row + .col-lg-12 + = table_builder_2 @api_keys, + [ \ + TableBuilderHelper::Column.new( \ + key: :name, \ + attribute: 'name' \ + ), \ + TableBuilderHelper::Column.new( \ + key: :token, \ + attribute: 'token' \ + ), \ + ], + cls: 'table has-search' + + = new_pagination @api_keys, 'pull-right' diff --git a/app/views/api_keys/new.html.slim b/app/views/api_keys/new.html.slim index f7b1dd99b..291c9f8a6 100644 --- a/app/views/api_keys/new.html.slim +++ b/app/views/api_keys/new.html.slim @@ -1,3 +1,2 @@ = title_tag t('api_keys.new.title') - -== render "form"
\ No newline at end of file +== render partial: 'form', locals: {action_url: organisation_api_keys_path} diff --git a/app/views/api_keys/show.html.slim b/app/views/api_keys/show.html.slim index b65717408..de30ac125 100644 --- a/app/views/api_keys/show.html.slim +++ b/app/views/api_keys/show.html.slim @@ -12,7 +12,6 @@ - content_for :sidebar do ul.actions - li = link_to t('api_keys.actions.new'), new_referential_api_key_path(@referential), class: "add" - li = link_to t('api_keys.actions.edit'), edit_referential_api_key_path(@referential, @api_key), class: "edit" - li = link_to t('api_keys.actions.destroy'), referential_api_key_path(@referential, @api_key), :method => :delete, :data => {:confirm => t('api_keys.actions.destroy_confirm')}, class: "remove" - br
\ No newline at end of file + li = link_to t('api_keys.actions.edit'), edit_organisation_api_key_path(@api_key), class: "edit" + li = link_to t('api_keys.actions.destroy'), organisation_api_key_path(@api_key), :method => :delete, :data => {:confirm => t('api_keys.actions.destroy_confirm')}, class: "remove" + br diff --git a/app/views/autocomplete_calendars/autocomplete.rabl b/app/views/autocomplete_calendars/autocomplete.rabl index 9aba2c37b..3a7703c53 100644 --- a/app/views/autocomplete_calendars/autocomplete.rabl +++ b/app/views/autocomplete_calendars/autocomplete.rabl @@ -1,5 +1,6 @@ collection @calendars, :object_root => false attribute :id, :name, :short_name, :shared + node :text do |cal| - "#{cal.id} - #{cal.name}" + "<strong>" + cal.name + " - " + cal.id.to_s + "</strong>" end diff --git a/app/views/autocomplete_time_tables/index.rabl b/app/views/autocomplete_time_tables/index.rabl index 80e3f8684..7aafdca16 100644 --- a/app/views/autocomplete_time_tables/index.rabl +++ b/app/views/autocomplete_time_tables/index.rabl @@ -2,14 +2,15 @@ collection @time_tables, :object_root => false node do |time_table| { - :id => time_table.id, :comment => time_table.comment, :objectid => time_table.objectid, + :id => time_table.id, + :comment => time_table.comment, + :objectid => time_table.objectid, :time_table_bounding => time_table.presenter.time_table_bounding, :composition_info => time_table.presenter.composition_info, :tags => time_table.tags.join(','), - :text => "#{time_table.comment} - #{time_table.display_day_types} - #{time_table.objectid.parts.try(:third)}", :color => time_table.color, :day_types => time_table.display_day_types, - :short_id => time_table.objectid.parts.try(:third) + :short_id => time_table.objectid.parts.try(:third), + :text => "<strong><span class='fa fa-circle' style='color:" + (time_table.color ? time_table.color : '#4b4b4b') + "'></span> " + time_table.comment + " - " + time_table.objectid.parts.try(:third) + "</strong><br/><small>" + time_table.display_day_types + "</small>" } end - diff --git a/app/views/calendar_mailer/created.html.slim b/app/views/calendar_mailer/created.html.slim index da15b7189..37b2a86ea 100644 --- a/app/views/calendar_mailer/created.html.slim +++ b/app/views/calendar_mailer/created.html.slim @@ -1 +1,25 @@ div = t('mailers.calendar_mailer.created.body', cal_name: @calendar.name, cal_index_url: calendars_url) + +table style="border-collapse:collapse;font-family:'Open Sans', Arial, sans serif;width:550px;margin:0px auto;color:#333333;" + + thead + tr + th + .jumbotron style="background-color:#007fbb;color:#fff;padding:20px 25px;margin-bottom:0px;text-align:left;" + h1.brandname style="display:inline-block;font-size:20px;font-weight:700;text-transform:uppercase;margin:0;" + = t('brandname') + + tbody + tr + td style="padding:40px 0px 60px 0px;" + p style="font-size:14px;font-weight:700;margin:0px 0px 10px 0px;" + = t('mailers.calendar_mailer.updated.subject') + + p style="font-size:14px;margin:0px 0px 10px 0px;" + = t('mailers.calendar_mailer.created.body', cal_name: @calendar.name, cal_index_url: calendars_url).html_safe + + tr + td style="text-align:center;padding:20px 0 0 0;border-top:1px solid #007fbb;" + p style="font-size:12px;font-weight:700;margin:0px 0px 10px 0px;opacity:0.85;" + em = t('mailers.calendar_mailer.sent_by') + " " + = link_to t('brandname'), unauthenticated_root_url, style: "color:#333333;text-decoration:underline;" diff --git a/app/views/calendar_mailer/updated.html.slim b/app/views/calendar_mailer/updated.html.slim index f70480107..bf128439a 100644 --- a/app/views/calendar_mailer/updated.html.slim +++ b/app/views/calendar_mailer/updated.html.slim @@ -1,2 +1,23 @@ -div = t('mailers.calendar_mailer.updated.body', cal_name: @calendar.name, cal_index_url: calendars_url) +table style="border-collapse:collapse;font-family:'Open Sans', Arial, sans serif;width:550px;margin:0px auto;color:#333333;" + thead + tr + th + .jumbotron style="background-color:#007fbb;color:#fff;padding:20px 25px;margin-bottom:0px;text-align:left;" + h1.brandname style="display:inline-block;font-size:20px;font-weight:700;text-transform:uppercase;margin:0;" + = t('brandname') + + tbody + tr + td style="padding:40px 0px 60px 0px;" + p style="font-size:14px;font-weight:700;margin:0px 0px 10px 0px;" + = t('mailers.calendar_mailer.updated.subject') + + p style="font-size:14px;margin:0px 0px 10px 0px;" + = t('mailers.calendar_mailer.updated.body', cal_name: @calendar.name, cal_index_url: calendars_url).html_safe + + tr + td style="text-align:center;padding:20px 0 0 0;border-top:1px solid #007fbb;" + p style="font-size:12px;font-weight:700;margin:0px 0px 10px 0px;opacity:0.85;" + em = t('mailers.calendar_mailer.sent_by') + " " + = link_to t('brandname'), unauthenticated_root_url, style: "color:#333333;text-decoration:underline;" diff --git a/app/views/calendars/edit.html.slim b/app/views/calendars/edit.html.slim index 6668630e8..426f27881 100644 --- a/app/views/calendars/edit.html.slim +++ b/app/views/calendars/edit.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'modele-calendrier', t('.title', calendar: @calendar.name), '', t('last_update', time: l(@calendar.updated_at, format: :short)) diff --git a/app/views/calendars/index.html.slim b/app/views/calendars/index.html.slim index e3ac16505..757ade89b 100644 --- a/app/views/calendars/index.html.slim +++ b/app/views/calendars/index.html.slim @@ -1,6 +1,6 @@ / PageHeader -- header_params = ['map-marker', +- header_params = ['modele-calendrier', t('.title'), ''] - header_params << link_to(t('actions.add'), new_calendar_path, class: 'btn btn-default') if policy(Calendar).create? diff --git a/app/views/calendars/new.html.slim b/app/views/calendars/new.html.slim index 7faecf587..2cb6f8061 100644 --- a/app/views/calendars/new.html.slim +++ b/app/views/calendars/new.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'modele-calendrier', t('.title'), '', '' diff --git a/app/views/calendars/show.html.slim b/app/views/calendars/show.html.slim index 4ce5de57f..eda4ef97c 100644 --- a/app/views/calendars/show.html.slim +++ b/app/views/calendars/show.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'modele-calendrier', @calendar.name, '', t('last_update', time: l(@calendar.updated_at, format: :short)), diff --git a/app/views/companies/index.html.slim b/app/views/companies/index.html.slim index ceea385b3..90d5e8c96 100644 --- a/app/views/companies/index.html.slim +++ b/app/views/companies/index.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'transporteur', t('companies.index.title'), 'Lorem ipsum dolor sit amet', '', diff --git a/app/views/companies/show.html.slim b/app/views/companies/show.html.slim index a5c7347a8..4fb437115 100644 --- a/app/views/companies/show.html.slim +++ b/app/views/companies/show.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'transporteur', @company.name, 'Lorem ipsum dolor sit amet', t('last_update', time: l(@company.updated_at, format: :short)) do diff --git a/app/views/imports/_filters.html.slim b/app/views/imports/_filters.html.slim new file mode 100644 index 000000000..99fcb0232 --- /dev/null +++ b/app/views/imports/_filters.html.slim @@ -0,0 +1,21 @@ += search_form_for @q, url: workbench_imports_path(@workbench), html: { method: :get, class: 'form form-filter' } do |f| + .ffg-row + .input-group.search_bar + = f.search_field :name_or_creator_cont, class: 'form-control', placeholder: t('imports.filters.name_or_creator_cont') + span.input-group-btn + button.btn.btn-default#search_btn type='submit' + span.fa.fa-search + + .ffg-row + .form-group.togglable + = f.label Import.human_attribute_name(:status), required: false, class: 'control-label' + = f.input :status_eq_any, collection: @imports.map(&:status).uniq.compact, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + l + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'} + + .form-group.togglable + = f.label Import.human_attribute_name(:started_at), required: false, class: 'control-label' + .filter_menu + = f.input :started_at_eq, as: :date, label: false, wrapper_html: { class: 'date smart_date filter_menu-item' }, include_blank: true + + .actions + = link_to t('actions.erase'), workbench_imports_path(@workbench), class: 'btn btn-link' + = f.submit t('actions.filter'), class: 'btn btn-default' diff --git a/app/views/imports/_form.html.slim b/app/views/imports/_form.html.slim index b795e908f..0fbf578be 100644 --- a/app/views/imports/_form.html.slim +++ b/app/views/imports/_form.html.slim @@ -1,6 +1,14 @@ -= simple_form_for import, as: :import, url: workbench_imports_path(workbench) do |f| - = f.input :name - = f.input :file - = f.association :referential, collection: workbench.referentials - = f.input :type, as: :hidden - = f.button :submit += simple_form_for import, as: :import, url: workbench_imports_path(workbench), html: {class: 'form-horizontal', id: 'wb_import_form'}, wrapper: :horizontal_form do |form| + + .row + .col-lg-12 + = form.input :name + + .row + .col-lg-12 + .form-group + = form.label :file, t('activerecord.attributes.import.resources'), class: 'control-label col-sm-4 col-xs-5' + .col-sm-8.col-xs-7 + = form.input_field :file, label: false, class: 'form-control' + + = form.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'wb_import_form' diff --git a/app/views/imports/index.html.slim b/app/views/imports/index.html.slim index 6e2d49f73..09014350f 100644 --- a/app/views/imports/index.html.slim +++ b/app/views/imports/index.html.slim @@ -1,12 +1,46 @@ -= title_tag t('.title') -- @imports.each do |import| - .import - li = link_to import.name, workbench_import_path(@workbench, import) - li = import.referential.name if import.referential - li = link_to import.file.file.filename, import.file.url, target: :_blank - hr - -.warning = t('.warning') -- content_for :sidebar do - ul.actions - li = link_to t('imports.actions.new'), new_workbench_import_path(workbench_id: @workbench), class: 'add' +/ PageHeader += pageheader 'importer', + t('.title'), + '', + '', + link_to(t('imports.actions.new'), new_workbench_import_path(workbench_id: @workbench), class: 'btn btn-primary') + +/ PageContent +.page_content + .container-fluid + - if params[:q].present? or @imports.any? + .row + .col-lg-12 + = render 'filters' + + - if @imports.any? + .row + .col-lg-12 + = table_builder_2 @imports, + [ \ + TableBuilderHelper::Column.new( \ + key: :status, \ + attribute: 'status' \ + ), \ + TableBuilderHelper::Column.new( \ + key: :started_at, \ + attribute: 'started_at' \ + ), \ + TableBuilderHelper::Column.new( \ + key: :name, \ + attribute: 'name' \ + ), \ + TableBuilderHelper::Column.new( \ + key: :creator, \ + attribute: 'creator' \ + ) \ + ], + links: [], + cls: 'table has-search' + + = new_pagination @imports, 'pull-right' + + - unless @imports.any? + .row.mt-xs + .col-lg-12 + = replacement_msg t('imports.search_no_results') diff --git a/app/views/imports/new.html.slim b/app/views/imports/new.html.slim index 55b655a85..5d5df0857 100644 --- a/app/views/imports/new.html.slim +++ b/app/views/imports/new.html.slim @@ -1,4 +1,10 @@ -= title_tag t('.title') -.row - .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-8.col-sm-offset-2 - = render 'form', import: @import, workbench: @workbench +/ PageHeader += pageheader 'importer', + t('.title') + +/ PageContent +.page_content + .container-fluid + .row + .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 + = render 'form', import: @import, workbench: @workbench diff --git a/app/views/imports/show.html.slim b/app/views/imports/show.html.slim index b40e11ea4..5518e1a47 100644 --- a/app/views/imports/show.html.slim +++ b/app/views/imports/show.html.slim @@ -1,14 +1,58 @@ -.title.row - .col-md-8 - = title_tag job_status_title(@import) +/ PageHeader += pageheader 'importer', + @import.name, + '', + t('last_update', time: l(@import.updated_at, format: :short)) do -.import_show - .links - = link_to font_awesome_classic_tag("fa-file-#{@import.file.file.extension}-o") + t("imports.show.imported_file"), @import.file.url + / Below is secundary actions & optional contents (filters, ...) + .row + .col-lg-12.text-right.mb-sm + - @import.action_links.each do |link| + = link_to link.href, + method: link.method, + data: link.data, + class: 'btn btn-primary' do + = link.content -- content_for :sidebar do - ul.actions - li - = link_to t('imports.actions.destroy'), workbench_import_path(@workbench, @import.id), method: :delete, data: {confirm: t('imports.actions.destroy_confirm')}, class: 'remove' +/ PageContent +.page_content + .container-fluid + .row + .col-lg-6.col-md-6.col-sm-12.col-xs-12 + = definition_list t('metadatas'), { 'Récupération des données' => '-', "Nom de l'archive" => @import.try(:file_identifier)} - = history_tag(@import) + .row + .col-lg-12 + = table_builder_2 @import.children, + [ \ + TableBuilderHelper::Column.new( \ + name: 'Nom du jeu de données', \ + attribute: 'name' \ + ), \ + TableBuilderHelper::Column.new( \ + key: :status, \ + attribute: 'status' \ + ), \ + TableBuilderHelper::Column.new( \ + name: 'Contrôle STIF', \ + attribute: '' \ + ), \ + TableBuilderHelper::Column.new( \ + name: 'Contrôle organisation', \ + attribute: '' \ + ) \ + ], + links: [], + cls: 'table', + overhead: [ \ + {}, \ + { \ + title: "#{@import.children_succeedeed} jeu de données validé sur #{@import.children.count} présents dans l'archive", \ + width: 1, \ + cls: 'overheaded-danger full-border' \ + }, { \ + title: 'Bilan des jeux de contrôles d\'import <span title="Lorem ipsum..." class="fa fa-lg fa-info-circle text-info"></span>', \ + width: 2, \ + cls: 'overheaded-default colspan="2"' \ + } \ + ] diff --git a/app/views/journey_patterns_collections/show.html.slim b/app/views/journey_patterns_collections/show.html.slim index eb6dfb650..bce4f28b5 100644 --- a/app/views/journey_patterns_collections/show.html.slim +++ b/app/views/journey_patterns_collections/show.html.slim @@ -1,5 +1,5 @@ / pageheader -= pageheader 'map-marker', += pageheader 'mission', "Missions de #{@route.try(:stop_points).first.try(:stop_area).name} vers #{@route.try(:stop_points).last.try(:stop_area).name}", 'Lorem ipsum dolor sit amet', '' diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index 6eab2a761..d6a22c4f8 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -6,7 +6,7 @@ html lang=I18n.locale = csrf_meta_tag - title STIF BOIV + title = t('brandname') = stylesheet_link_tag 'base' = stylesheet_link_tag 'application' diff --git a/app/views/layouts/mailer.html.slim b/app/views/layouts/mailer.html.slim index 1485e8188..5db6917b3 100644 --- a/app/views/layouts/mailer.html.slim +++ b/app/views/layouts/mailer.html.slim @@ -2,21 +2,6 @@ doctype html html head meta charset="utf-8" - title= message.subject - - body style="font-family: Verdana, Helvetica, Arial, MS Trebuchet, sans-serif; font-size: 14px; width: 600px; background: #E5E5E5; padding: 15px" - - <style> - h2 { font-size: 18px; } - h3 { font-size: 14px; } - a { color: black; } - </style> - - h1 style="background: #61970B; height: 75px; font-size: 24px; font-weight: normal; color: white; padding: 20px 0 0 30px;" - |Chouette - - div style="background: white; margin-bottom: 10px; padding: 15px; -moz-box-shadow: 3px 3px 4px #bbbbbb; -webkit-box-shadow: 3px 3px 4px #BBB; box-shadow: 3px 3px 4px #BBB; border-right: 1px solid #BBB; border-bottom: 1px solid #BBB;" - = yield - - div style="color: #333333; text-align:center; font-size: 10px;" - = "Envoyé par #{link_to 'Chouette', unauthenticated_root_url}" + /!* Email styles need to be inline */ + body + = yield diff --git a/app/views/layouts/navigation/_main_nav_left.html.slim b/app/views/layouts/navigation/_main_nav_left.html.slim index 9dfc828c0..74442692d 100644 --- a/app/views/layouts/navigation/_main_nav_left.html.slim +++ b/app/views/layouts/navigation/_main_nav_left.html.slim @@ -5,7 +5,7 @@ .menu-content .closeMenu title='Fermer le menu' - .brandname = "IBOO" + .brandname = t('brandname') #menu-items.panel-group .menu-item.panel @@ -33,8 +33,14 @@ .list-group = link_to '#', class: "list-group-item #{params[:controller] == 'workbenches' ? 'active' : ''}" do span Jeux de données - = link_to '#', class: 'list-group-item' do - span Import + + - if @workbench + = link_to workbench_imports_path(@workbench), class: "list-group-item #{(params[:controller] == 'imports') ? 'active' : ''}" do + span Import + - else + = link_to '#', class: 'list-group-item disabled' do + span Import + = link_to calendars_path, class: 'list-group-item' do span Modèles de calendrier = link_to '#', class: 'list-group-item' do diff --git a/app/views/layouts/navigation/_main_nav_top.html.slim b/app/views/layouts/navigation/_main_nav_top.html.slim index 4cdd5f053..d6c849d3f 100644 --- a/app/views/layouts/navigation/_main_nav_top.html.slim +++ b/app/views/layouts/navigation/_main_nav_top.html.slim @@ -1,5 +1,5 @@ .nav-menu#menu_top - .brandname IBOO + .brandname = t('brandname') .menu-content .menu-item diff --git a/app/views/line_footnotes/edit.html.slim b/app/views/line_footnotes/edit.html.slim index fcd7a47e0..4a0fbb931 100644 --- a/app/views/line_footnotes/edit.html.slim +++ b/app/views/line_footnotes/edit.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'ligne', "Notes sur la ligne #{@line.name}", 'Lorem ipsum dolor sit amet', (@line.footnotes.any? ? t('last_update', time: l(@line.footnotes.last.updated_at, format: :short)) : '') diff --git a/app/views/line_footnotes/show.html.slim b/app/views/line_footnotes/show.html.slim index 6ad721711..8138c1383 100644 --- a/app/views/line_footnotes/show.html.slim +++ b/app/views/line_footnotes/show.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'ligne', "Notes sur la ligne #{@line.name}", 'Lorem ipsum dolor sit amet', '', diff --git a/app/views/line_referentials/show.html.slim b/app/views/line_referentials/show.html.slim index e2381e7e9..d2527f360 100644 --- a/app/views/line_referentials/show.html.slim +++ b/app/views/line_referentials/show.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'synchro-ilico', t('.title'), 'Lorem ipsum dolor sit amet', t('last_update', time: l(@line_referential.updated_at, format: :short)), diff --git a/app/views/lines/index.html.slim b/app/views/lines/index.html.slim index 630d63068..e4a29b182 100644 --- a/app/views/lines/index.html.slim +++ b/app/views/lines/index.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'ligne', t('lines.index.title'), 'Lorem ipsum dolor sit amet', '', diff --git a/app/views/lines/show.html.slim b/app/views/lines/show.html.slim index 6f75432e1..0779a0f5a 100644 --- a/app/views/lines/show.html.slim +++ b/app/views/lines/show.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'ligne', @line.name, 'Lorem ipsum dolor sit amet', t('last_update', time: l(@line.updated_at, format: :short)) do diff --git a/app/views/networks/index.html.slim b/app/views/networks/index.html.slim index 4c1f9783c..bd1f3d15a 100644 --- a/app/views/networks/index.html.slim +++ b/app/views/networks/index.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'reseau', t('networks.index.title'), 'Lorem ipsum dolor sit amet', '', @@ -40,6 +40,6 @@ = new_pagination @networks, 'pull-right' - unless @networks.any? - .row + .row.mt-xs .col-lg-12 = replacement_msg t('networks.search_no_results') diff --git a/app/views/networks/show.html.slim b/app/views/networks/show.html.slim index 09edbad2e..d237351c4 100644 --- a/app/views/networks/show.html.slim +++ b/app/views/networks/show.html.slim @@ -1,7 +1,7 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'reseau', @network.name, - 'Lorem ipsum dolor sit amet', + '', t('last_update', time: l(@network.updated_at, format: :short)) do / Below is secundary actions & optional contents (filters, ...) diff --git a/app/views/referential_companies/index.html.slim b/app/views/referential_companies/index.html.slim index 23eea40ce..1946bbab5 100644 --- a/app/views/referential_companies/index.html.slim +++ b/app/views/referential_companies/index.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'transporteur', t('companies.index.title'), '', '', diff --git a/app/views/referential_companies/show.html.slim b/app/views/referential_companies/show.html.slim index 177ce2d69..1d71c778a 100644 --- a/app/views/referential_companies/show.html.slim +++ b/app/views/referential_companies/show.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'transporteur', @company.name, 'Lorem ipsum dolor sit amet', t('last_update', time: l(@company.updated_at, format: :short)) do diff --git a/app/views/referential_lines/show.html.slim b/app/views/referential_lines/show.html.slim index 34c296932..f20b59d3e 100644 --- a/app/views/referential_lines/show.html.slim +++ b/app/views/referential_lines/show.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'ligne', @line.name, '', t('last_update', time: l(@line.updated_at, format: :short)) do diff --git a/app/views/referential_networks/index.html.slim b/app/views/referential_networks/index.html.slim index c58a91321..747143c94 100644 --- a/app/views/referential_networks/index.html.slim +++ b/app/views/referential_networks/index.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'reseau', t('networks.index.title'), 'Lorem ipsum dolor sit amet', '', diff --git a/app/views/referential_networks/show.html.slim b/app/views/referential_networks/show.html.slim index b9d9d5d8b..d7095561e 100644 --- a/app/views/referential_networks/show.html.slim +++ b/app/views/referential_networks/show.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'reseau', @network.name, 'Lorem ipsum dolor sit amet', t('last_update', time: l(@network.updated_at, format: :short)) do diff --git a/app/views/referential_stop_areas/show.html.slim b/app/views/referential_stop_areas/show.html.slim index d594665f7..fa383c82d 100644 --- a/app/views/referential_stop_areas/show.html.slim +++ b/app/views/referential_stop_areas/show.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'arret', @stop_area.name, 'Lorem ipsum dolor sit amet' diff --git a/app/views/referentials/_filters.html.slim b/app/views/referentials/_filters.html.slim index 9302ccaa8..1cc6bb410 100644 --- a/app/views/referentials/_filters.html.slim +++ b/app/views/referentials/_filters.html.slim @@ -20,5 +20,5 @@ = f.input :company_id_eq_any, collection: LineReferential.first.companies.order('name').pluck(:id), as: :check_boxes, label: false, label_method: lambda{|l| ("<span>#{LineReferential.first.companies.find(l).name}</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' } .actions - = link_to 'Effacer', @workbench, class: 'btn btn-link' - = f.submit 'Filtrer', class: 'btn btn-default' + = link_to t('actions.erase'), @workbench, class: 'btn btn-link' + = f.submit t('actions.filter'), class: 'btn btn-default' diff --git a/app/views/referentials/_form.html.slim b/app/views/referentials/_form.html.slim index 31d71bcdc..a9e308699 100644 --- a/app/views/referentials/_form.html.slim +++ b/app/views/referentials/_form.html.slim @@ -42,11 +42,11 @@ = render 'period_fields', f: period_form .links.nested-linker - = link_to_add_association 'Ajouter une période', subform, :periods, class: 'btn btn-outline-primary' + = link_to_add_association t('simple_form.labels.referential.actions.add_period'), subform, :periods, class: 'btn btn-outline-primary' .separator - = subform.input :lines, as: :select, collection: @referential.workbench.lines.includes(:company).order(:name), selected: subform.object.line_ids, label_method: :display_name, input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': 'Sélection de lignes', 'multiple': 'multiple', style: 'width: 100%' } + = subform.input :lines, as: :select, collection: @referential.workbench.lines.includes(:company).order(:name), selected: subform.object.line_ids, label_method: :display_name, input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': t('simple_form.labels.referential.placeholders.select_lines'), 'multiple': 'multiple', style: 'width: 100%' } .hidden = form.input :workbench_id, as: :hidden diff --git a/app/views/referentials/_period_fields.html.slim b/app/views/referentials/_period_fields.html.slim index 95e204554..4d2372f7b 100644 --- a/app/views/referentials/_period_fields.html.slim +++ b/app/views/referentials/_period_fields.html.slim @@ -12,4 +12,4 @@ div = f.input :end, as: :date, label: false, wrapper_html: { class: 'date smart_date' } div - = link_to_remove_association '', f, class: 'fa fa-trash', data: { confirm: 'Etes-vous sûr(e) ?' }, title: t('actions.delete') + = link_to_remove_association '', f, class: 'fa fa-trash', data: { confirm: t('are_you_sure')}, title: t('actions.delete') diff --git a/app/views/referentials/edit.html.slim b/app/views/referentials/edit.html.slim index d54b63135..1fac626e6 100644 --- a/app/views/referentials/edit.html.slim +++ b/app/views/referentials/edit.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'jeux-de-donnees', t('.title'), '', t('last_update', time: l(@referential.updated_at, format: :short)) diff --git a/app/views/referentials/index.html.slim b/app/views/referentials/index.html.slim index 8943d419c..8bb66da21 100644 --- a/app/views/referentials/index.html.slim +++ b/app/views/referentials/index.html.slim @@ -1,7 +1,7 @@ / FIXME #827 - current_organisation.workbenches.each do |workbench| h2 = link_to workbench.name, workbench - p = "#{workbench.referentials.count} jeu(x) de données à l'heure actuelle" + p = t('workbenches.referential_count', count: workbench.referentials.count) / FIXME #823 - if false @@ -11,8 +11,8 @@ - content_for :sidebar do ul.actions - li = link_to 'Données Reflex', stop_area_referential_path(1) - li = link_to 'Données CodifLigne', line_referential_path(1) + li = link_to t('reflex_data'), stop_area_referential_path(1) + li = link_to t('codif_data'), line_referential_path(1) li = link_to t('calendars.standard_calendars'), calendars_path - if false li = link_to t('referentials.actions.new'), new_referential_path, class: 'add' diff --git a/app/views/referentials/new.html.slim b/app/views/referentials/new.html.slim index 55f38eb33..f4a7e4707 100644 --- a/app/views/referentials/new.html.slim +++ b/app/views/referentials/new.html.slim @@ -1,9 +1,9 @@ / PageHeader - if @referential.created_from.present? - = pageheader 'map-marker', + = pageheader 'jeux-de-donnees', t('.duplicated.title') - else - = pageheader 'map-marker', + = pageheader 'jeux-de-donnees', t('.title') / PageContent diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim index 425f8014a..5229c3d7d 100644 --- a/app/views/referentials/show.html.slim +++ b/app/views/referentials/show.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'jeux-de-donnees', @referential.name, 'Lorem ipsum dolor sit amet', t('last_update', time: l(@referential.updated_at, format: :short)), @@ -24,7 +24,7 @@ .row .col-lg-6.col-md-6.col-sm-12.col-xs-12 = definition_list t('metadatas'), - { 'Statut' => @referential.archived? ? "<div class='td-block'><span class='fa fa-archive'></span><span>Conservé</span></div>".html_safe : "<div class='td-block'><span class='sb sb-lg sb-preparing'></span><span>En préparation</span></div>".html_safe, + { t('activerecord.attributes.referential.status') => @referential.archived? ? "<div class='td-block'><span class='fa fa-archive'></span><span>#{t('activerecord.attributes.referential.archived_at')}</span></div>".html_safe : "<div class='td-block'><span class='sb sb-lg sb-preparing'></span><span>#{t('activerecord.attributes.referential.archived_at_null')}</span></div>".html_safe, @referential.human_attribute_name(:validity_period) => (@referential.validity_period.present? ? t('validity_range', debut: l(@referential.try(:validity_period).try(:begin), format: :short), end: l(@referential.try(:validity_period).try(:end), format: :short)) : '-'), @referential.human_attribute_name(:organisation) => @referential.organisation.name, @referential.human_attribute_name(:published_at) => '-' } @@ -41,7 +41,7 @@ = table_builder_2 @reflines, [ \ TableBuilderHelper::Column.new( \ - name: 'ID Codifligne', \ + name: t('id_codif'), \ attribute: Proc.new { |n| n.objectid.local_id }, \ sortable: false \ ), \ @@ -85,7 +85,7 @@ = modalbox 'purgeModal' do = simple_form_for [@referential, CleanUp.new] do |f| .modal-header - h4.modal-title Purger le JDD + h4.modal-title #{t('simple_form.labels.clean_up.title')} .modal-body .container-fluid .row @@ -100,6 +100,6 @@ = f.input :end_date, as: :date, label: t('titles.clean_up.end_date'), wrapper_html: { class: 'date cleanup_end_date_wrapper smart_date', id: "end_date" } .modal-footer - button.btn.btn-link type='button' data-dismiss='modal' Annuler + button.btn.btn-link type='button' data-dismiss='modal' #{t('cancel')} - unless policy(@referential).archived? = f.button :submit, t('actions.clean_up') , class: 'btn btn-primary' diff --git a/app/views/routes/edit.html.slim b/app/views/routes/edit.html.slim index c854bc867..850588aef 100644 --- a/app/views/routes/edit.html.slim +++ b/app/views/routes/edit.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'itineraire', @route.name, 'Lorem ipsum dolor sit amet', t('last_update', time: l(@route.updated_at, format: :short)) diff --git a/app/views/routes/new.html.slim b/app/views/routes/new.html.slim index 102467677..a68f8ae4e 100644 --- a/app/views/routes/new.html.slim +++ b/app/views/routes/new.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'itineraire', t('routes.new.title'), '' diff --git a/app/views/routes/show.html.slim b/app/views/routes/show.html.slim index f2f8f1a9d..1e3fac723 100644 --- a/app/views/routes/show.html.slim +++ b/app/views/routes/show.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'itineraire', @route.name, '', t('last_update', time: l(@route.updated_at, format: :short)), @@ -37,8 +37,7 @@ [ \ TableBuilderHelper::Column.new( \ name: 'ID Reflex', \ - attribute: Proc.new { |s| s.try(:stop_area).try(:user_objectid) }, \ - sortable: false \ + attribute: Proc.new { |s| s.try(:stop_area).try(:user_objectid) } \ ), \ TableBuilderHelper::Column.new( \ key: :name, \ @@ -46,7 +45,7 @@ ), \ TableBuilderHelper::Column.new( \ key: :deleted_at, \ - attribute: Proc.new { |s| s.try(:stop_area).deleted_at ? t('false') : t('true') } \ + attribute: Proc.new { |s| s.try(:stop_area).deleted_at ? t('false') : t('true') }, \ ), \ TableBuilderHelper::Column.new( \ key: :zip_code, \ @@ -63,14 +62,11 @@ TableBuilderHelper::Column.new( \ key: :for_alighting, \ attribute: Proc.new { |s| t("stop_points.stop_point.for_alighting.#{s.for_alighting}") } \ - ), \ - TableBuilderHelper::Column.new( \ - key: :position, \ - attribute: 'position' \ - ), \ + ) \ ], links: [:show], - cls: 'table' + sortable: false, + cls: 'table has-stoppoints' - else = replacement_msg t('stop_areas.search_no_results') diff --git a/app/views/routing_constraint_zones/edit.html.slim b/app/views/routing_constraint_zones/edit.html.slim index d0e0ded32..2c23344df 100644 --- a/app/views/routing_constraint_zones/edit.html.slim +++ b/app/views/routing_constraint_zones/edit.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'itl', t('.title', routing_constraint_zone: @routing_constraint_zone.name), '', t('last_update', time: l(@routing_constraint_zone.updated_at, format: :short)) diff --git a/app/views/routing_constraint_zones/index.html.slim b/app/views/routing_constraint_zones/index.html.slim index 6b3e73096..d7e15a2da 100644 --- a/app/views/routing_constraint_zones/index.html.slim +++ b/app/views/routing_constraint_zones/index.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'itl', t('routing_constraint_zones.index.title'), '', '', diff --git a/app/views/routing_constraint_zones/new.html.slim b/app/views/routing_constraint_zones/new.html.slim index 4e792f8af..1ed65335f 100644 --- a/app/views/routing_constraint_zones/new.html.slim +++ b/app/views/routing_constraint_zones/new.html.slim @@ -1,6 +1,6 @@ / PageHeader -= pageheader 'map-marker', - t('.title') += pageheader 'itl', + t('.title') / PageContent .page_content @@ -12,7 +12,7 @@ .row .col-lg-12 = form.input :name - = form.input :route_id, collection: @line.routes, include_blank: false, input_html: {data: {url: new_referential_line_routing_constraint_zone_path(@referential, @line), object: @routing_constraint_zone.to_json }} + = form.input :route_id, collection: @line.routes, include_blank: false, input_html: { class: 'new_routing_constraint_zone_route', data: {url: new_referential_line_routing_constraint_zone_path(@referential, @line), object: @routing_constraint_zone.to_json }} .separator diff --git a/app/views/routing_constraint_zones/show.html.slim b/app/views/routing_constraint_zones/show.html.slim index 07b5ac6e6..b5aa199c6 100644 --- a/app/views/routing_constraint_zones/show.html.slim +++ b/app/views/routing_constraint_zones/show.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'itl', @routing_constraint_zone.name, '', t('last_update', time: l(@routing_constraint_zone.updated_at, format: :short)) do diff --git a/app/views/stop_area_referentials/show.html.slim b/app/views/stop_area_referentials/show.html.slim index 56ecbf6da..dc90def50 100644 --- a/app/views/stop_area_referentials/show.html.slim +++ b/app/views/stop_area_referentials/show.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'synchro-icar', t('.title'), 'Lorem ipsum dolor sit amet', t('last_update', time: l(@stop_area_referential.updated_at, format: :short)), @@ -37,6 +37,6 @@ td.text-center .fa.fa-circle class="text-#{criticity_class(log.criticity)}" td - - data = log.message_attributs.symbolize_keys! + - data = log.message_attributes.symbolize_keys! - data[:processing_time] = distance_of_time_in_words(data[:processing_time].to_i) - = t("stop_area_referential_sync.message.#{log.message_key}", log.message_attributs.symbolize_keys!).html_safe + = t("stop_area_referential_sync.message.#{log.message_key}", log.message_attributes.symbolize_keys!).html_safe diff --git a/app/views/stop_areas/index.html.slim b/app/views/stop_areas/index.html.slim index adb023633..795c773ec 100644 --- a/app/views/stop_areas/index.html.slim +++ b/app/views/stop_areas/index.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'arret', t('stop_areas.index.title'), '', '', diff --git a/app/views/stop_areas/show.html.slim b/app/views/stop_areas/show.html.slim index 05f66a33a..dce5bdbad 100644 --- a/app/views/stop_areas/show.html.slim +++ b/app/views/stop_areas/show.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'arret', @stop_area.name, 'Lorem ipsum dolor sit amet' diff --git a/app/views/time_table_combinations/_form.html.slim b/app/views/time_table_combinations/_form.html.slim index b4f818828..8e2d77d46 100644 --- a/app/views/time_table_combinations/_form.html.slim +++ b/app/views/time_table_combinations/_form.html.slim @@ -7,7 +7,7 @@ abbr title='Champ requis' * = f.input :combined_type, as: :boolean, checked_value: 'time_table', unchecked_value: 'calendar', required: false, label: content_tag(:span, t("time_table_combinations.combined_type.#{@combination.combined_type}"), class: 'switch-label', data: { checkedValue: 'Calendriers', uncheckedValue: 'Modèles de calendriers' }), wrapper_html: { class: 'col-sm-8 col-xs-7' } - = f.input :time_table_id, as: :select, input_html: {class: 'tt_combination_target', style: "width: 100%", data: { 'select2-ajax': 'true', 'select2ed-placeholder': 'Indiquez un calendrier...', term: 'comment_or_objectid_cont', url: referential_autocomplete_time_tables_path(@referential, format: :json)}}, wrapper_html: {class: @combination.combined_type != 'time_table' ? 'hidden' : ''} + = f.input :time_table_id, as: :select, input_html: {class: 'tt_combination_target', style: "width: 100%", data: { 'select2-ajax': 'true', 'select2ed-placeholder': 'Indiquez un calendrier...', term: 'comment_cont_or_objectid_cont', url: referential_autocomplete_time_tables_path(@referential, format: :json, :source_id => @combination.source_id)}}, wrapper_html: {class: @combination.combined_type != 'time_table' ? 'hidden' : ''} = f.input :calendar_id, as: :select, input_html: { class: 'tt_combination_target', style: "width: 100%", data: { 'select2-ajax': 'true', 'select2ed-placeholder': 'Indiquez un modèle de calendrier...', term: 'name_cont', url: autocomplete_calendars_path}}, wrapper_html: {class: @combination.combined_type != 'calendar' ? 'hidden' : ''} diff --git a/app/views/time_tables/_filter.html.slim b/app/views/time_tables/_filter.html.slim index 392dc4f50..043aa87d0 100644 --- a/app/views/time_tables/_filter.html.slim +++ b/app/views/time_tables/_filter.html.slim @@ -20,4 +20,4 @@ .actions = link_to 'Effacer', @workbench, class: 'btn btn-link' - = f.submit 'Filtrer', class: 'btn btn-default' + = f.submit 'Filtrer', class: 'btn btn-default', id: 'time_table_filter_btn' diff --git a/app/views/time_tables/edit.html.slim b/app/views/time_tables/edit.html.slim index f129cd63a..ed55dc4e3 100644 --- a/app/views/time_tables/edit.html.slim +++ b/app/views/time_tables/edit.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'calendrier-application', @time_table.comment, '', '' @@ -10,6 +10,7 @@ #periods = javascript_tag do - | window.actionType = "#{raw params[:action]}" + | window.actionType = "#{raw params[:action]}"; + | window.I18n = #{(I18n.backend.send(:translations).to_json).html_safe}; = javascript_include_tag 'es6_browserified/time_tables/index.js' diff --git a/app/views/time_tables/index.html.slim b/app/views/time_tables/index.html.slim index 72c025bc1..05be460d4 100644 --- a/app/views/time_tables/index.html.slim +++ b/app/views/time_tables/index.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'calendrier-application', t('time_tables.index.title'), '', ((policy(Chouette::TimeTable).create? && @referential.organisation == current_organisation) ? link_to(t('actions.add'), new_referential_time_table_path(@referential), class: 'btn btn-default') : '') @@ -62,3 +62,6 @@ .row.mt-xs .col-lg-12 = replacement_msg t('time_tables.search_no_results') + += javascript_tag do + | window.I18n = #{(I18n.backend.send(:translations).to_json).html_safe}; diff --git a/app/views/time_tables/new.html.slim b/app/views/time_tables/new.html.slim index 8d72f49b6..8a6930b9c 100644 --- a/app/views/time_tables/new.html.slim +++ b/app/views/time_tables/new.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'calendrier-application', t("time_tables.#{params[:action]}.title"), '', '' diff --git a/app/views/time_tables/show.html.slim b/app/views/time_tables/show.html.slim index 36b79cc25..021b55058 100644 --- a/app/views/time_tables/show.html.slim +++ b/app/views/time_tables/show.html.slim @@ -2,7 +2,7 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'calendrier-application', @time_table.comment, '', t('last_update', time: l(@time_table.updated_at, format: :short)), diff --git a/app/views/vehicle_journeys/index.html.slim b/app/views/vehicle_journeys/index.html.slim index 93f4e3221..4efc34eaa 100644 --- a/app/views/vehicle_journeys/index.html.slim +++ b/app/views/vehicle_journeys/index.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'horaires-des-courses', t('vehicle_journeys.index.title', route: @route.name ), 'Lorem ipsum dolor sit amet', '' do diff --git a/app/views/workbenches/_filters.html.slim b/app/views/workbenches/_filters.html.slim index d7ac79577..8da629e9c 100644 --- a/app/views/workbenches/_filters.html.slim +++ b/app/views/workbenches/_filters.html.slim @@ -1,24 +1,24 @@ = search_form_for @q_for_form, url: workbench_path(@workbench.id), builder: SimpleForm::FormBuilder, class: 'form form-filter' do |f| .ffg-row .input-group.search_bar - = f.search_field :name_cont, class: 'form-control', placeholder: 'Indiquez un nom de référentiel...' + = f.search_field :name_cont, class: 'form-control', placeholder: t('referentials.filters.name') span.input-group-btn button.btn.btn-default type='submit' span.fa.fa-search .ffg-row .form-group - = f.label 'Ligne', required: false, class: 'control-label' - = f.input :associated_lines_id_eq, as: :select, collection: @workbench.lines.includes(:company).order(:name), input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': 'Indiquez une ligne...' }, label: false, label_method: :display_name, wrapper_html: { class: 'select2ed'} + = f.label t('activerecord.models.line.one').upcase, required: false, class: 'control-label' + = f.input :associated_lines_id_eq, as: :select, collection: @workbench.lines.includes(:company).order(:name), input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': t('referentials.filters.line') }, label: false, label_method: :display_name, wrapper_html: { class: 'select2ed'} .form-group.togglable = f.label Referential.human_attribute_name(:status), required: false, class: 'control-label' .form-group.checkbox_list - = f.input :archived_at_not_null, label: ("<span>Conservé<span class='fa fa-archive'></span></span>").html_safe, as: :boolean, wrapper_html: { class: 'checkbox-wrapper' } - = f.input :archived_at_null, label: ("<span>En préparation<span class='sb sb-lg sb-preparing'></span></span>").html_safe, as: :boolean, wrapper_html: { class: 'checkbox-wrapper' } + = f.input :archived_at_not_null, label: ("<span>#{t('activerecord.attributes.referential.archived_at')}<span class='fa fa-archive'></span></span>").html_safe, as: :boolean, wrapper_html: { class: 'checkbox-wrapper' } + = f.input :archived_at_null, label: ("<span>#{t('activerecord.attributes.referential.archived_at_null')}<span class='sb sb-lg sb-preparing'></span></span>").html_safe, as: :boolean, wrapper_html: { class: 'checkbox-wrapper' } .form-group.togglable - = f.label 'Organisation(s)', required: false, class: 'control-label' + = f.label t('activerecord.models.organisation.one'), required: false, class: 'control-label' = f.input :organisation_name_eq_any, collection: Organisation.order('name').pluck(:name), as: :check_boxes, label: false, label_method: lambda{|w| ("<span>#{w}</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' } .form-group.togglable @@ -29,5 +29,5 @@ = p.input :end_lteq, as: :date, label: t('simple_form.to'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @end_range, include_blank: @end_range ? false : true .actions - = link_to 'Effacer', @workbench, class: 'btn btn-link' - = f.submit 'Filtrer', class: 'btn btn-default' + = link_to t('actions.erase'), @workbench, class: 'btn btn-link' + = f.submit t('actions.filter'), class: 'btn btn-default', id: 'referential_filter_btn' diff --git a/app/views/workbenches/index.html.slim b/app/views/workbenches/index.html.slim index ca61d439d..54d50d114 100644 --- a/app/views/workbenches/index.html.slim +++ b/app/views/workbenches/index.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'tableau-de-bord', t('.title', organisation: current_organisation.name) / PageContent diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim index bb8b71ab2..8d924b360 100644 --- a/app/views/workbenches/show.html.slim +++ b/app/views/workbenches/show.html.slim @@ -1,5 +1,5 @@ / PageHeader -= pageheader 'map-marker', += pageheader 'jeux-de-donnees', t('referentials.index.title'), '', '' do @@ -7,8 +7,8 @@ / Below is secundary actions & optional contents (filters, ...) .row.mb-sm .col-lg-12.text-right - = link_to t('actions.import'), workbench_imports_path(@workbench), class: 'btn btn-primary' - if policy(Referential).create? + = link_to t('actions.import'), workbench_imports_path(@workbench), class: 'btn btn-primary' = link_to t('actions.add'), new_referential_path(workbench_id: @workbench), class: 'btn btn-primary' / PageContent @@ -31,7 +31,7 @@ ), \ TableBuilderHelper::Column.new( \ key: :status, \ - attribute: Proc.new {|w| w.archived? ? ("<div class='td-block'><span class='fa fa-archive'></span><span>Conservé</span></div>").html_safe : ("<div class='td-block'><span class='sb sb-lg sb-preparing'></span><span>En préparation</span></div>").html_safe} \ + attribute: Proc.new {|w| w.archived? ? ("<div class='td-block'><span class='fa fa-archive'></span><span>#{t('activerecord.attributes.referential.archived_at')}</span></div>").html_safe : ("<div class='td-block'><span class='sb sb-lg sb-preparing'></span><span>#{t('activerecord.attributes.referential.archived_at_null')}</span></div>").html_safe} \ ), \ TableBuilderHelper::Column.new( \ key: :organisation, \ @@ -43,7 +43,7 @@ ), \ TableBuilderHelper::Column.new( \ key: :lines, \ - name: 'Nb lignes', \ + name: t('activerecord.attributes.referential.number_of_lines'), \ attribute: Proc.new {|w| w.lines.count} \ ), \ TableBuilderHelper::Column.new( \ @@ -71,3 +71,6 @@ .row.mt-xs .col-lg-12 = replacement_msg t('referentials.search_no_results') + += javascript_tag do + | window.I18n = #{(I18n.backend.send(:translations).to_json).html_safe}; diff --git a/app/workers/workbench_import_worker.rb b/app/workers/workbench_import_worker.rb new file mode 100644 index 000000000..706c3fc63 --- /dev/null +++ b/app/workers/workbench_import_worker.rb @@ -0,0 +1,114 @@ +class WorkbenchImportWorker + include Sidekiq::Worker + include Rails.application.routes.url_helpers + include Configurable + + # Workers + # ======= + + def perform(import_id) + @workbench_import = WorkbenchImport.find(import_id) + @response = nil + @workbench_import.update_attributes(status: 'running', started_at: Time.now) + downloaded = download + zip_service = ZipService.new(downloaded) + upload zip_service + @workbench_import.update(ended_at: Time.now) + end + + def download + logger.info "HTTP GET #{import_url}" + @zipfile_data = HTTPService.get_resource( + host: import_host, + path: import_path, + params: {token: @workbench_import.token_download}).body + end + + def execute_post eg_name, eg_file + logger.info "HTTP POST #{export_url} (for #{complete_entry_group_name(eg_name)})" + HTTPService.post_resource( + host: export_host, + path: export_path, + params: params(eg_file, eg_name)) + end + + def upload zip_service + entry_group_streams = zip_service.subdirs + @workbench_import.update total_steps: entry_group_streams.size + entry_group_streams.each_with_index(&method(:upload_entry_group)) + rescue Exception => e + logger.error e.message + @workbench_import.update( current_step: entry_group_streams.size, status: 'failed' ) + raise + end + + def upload_entry_group entry_pair, element_count + @workbench_import.update( current_step: element_count.succ ) + # status = retry_service.execute(&upload_entry_group_proc(entry_pair)) + eg_name = entry_pair.name + eg_stream = entry_pair.stream + + FileUtils.mkdir_p(Rails.root.join('tmp', 'imports')) + + eg_file = File.new(Rails.root.join('tmp', 'imports', "WorkbenchImport_#{eg_name}_#{$$}.zip"), 'wb').tap do |file| + eg_stream.rewind + file.write eg_stream.read + end + eg_file.close + eg_file = File.new(Rails.root.join('tmp', 'imports', "WorkbenchImport_#{eg_name}_#{$$}.zip")) + result = execute_post eg_name, eg_file + if result && result.status < 400 + result + else + raise StopIteration, result.body + end + ensure + eg_file.close rescue nil + eg_file.unlink rescue nil + end + + + # Queries + # ======= + + def complete_entry_group_name entry_group_name + [@workbench_import.name, entry_group_name].join("--") + end + + # Constants + # ========= + + def export_host + Rails.application.config.rails_host + end + def export_path + api_v1_netex_imports_path(format: :json) + end + def export_url + @__export_url__ ||= File.join(export_host, export_path) + end + + def import_host + Rails.application.config.rails_host + end + def import_path + @__import_path__ ||= download_workbench_import_path(@workbench_import.workbench, @workbench_import) + end + def import_url + @__import_url__ ||= File.join(import_host, import_path) + end + + def params file, name + if dest = ENV["DEBUG_TEMPFILE"] + require 'pry' + binding.pry + %x{unzip -oqq #{file.path} -d #{dest}} + end + { netex_import: + { parent_id: @workbench_import.id, + parent_type: @workbench_import.class.name, + workbench_id: @workbench_import.workbench_id, + name: name, + file: HTTPService.upload(file, 'application/zip', "#{name}.zip") } } + end +end |
