be able to delete projects; closes #51

This commit is contained in:
Radek Stepan 2016-01-30 18:14:00 +01:00
parent de4129a2dd
commit 0f8b412ab2
18 changed files with 448 additions and 115 deletions

View File

@ -1,6 +1,6 @@
{
"name": "burnchart",
"version": "3.0.2",
"version": "3.0.3",
"description": "GitHub Burndown Chart as a Service",
"author": "Radek Stepan <dev@radekstepan.com> (http://radekstepan.com)",
"license": "AGPL-3.0",

View File

@ -369,8 +369,8 @@ th {
}
@font-face {
font-family: 'Fontello';
src: url("../fonts/fontello.eot?74672344");
src: url("../fonts/fontello.eot?74672344#iefix") format('embedded-opentype'), url("../fonts/fontello.woff?74672344") format('woff'), url("../fonts/fontello.ttf?74672344") format('truetype'), url("../fonts/fontello.svg?74672344#fontello") format('svg');
src: url("../fonts/fontello.eot");
src: url("../fonts/fontello.eot#iefix") format('embedded-opentype'), url("../fonts/fontello.woff") format('woff'), url("../fonts/fontello.ttf") format('truetype'), url("../fonts/fontello.svg#fontello") format('svg');
font-weight: normal;
font-style: normal;
}
@ -966,6 +966,15 @@ ul li {
#page #content #projects table tr td:first-child {
color: #3e4457;
}
#page #content #projects table tr td.action {
text-align: right;
cursor: pointer;
color: #77000e;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#page #content #projects table tr:nth-child(even) td {
background: #fefefe;
}
@ -1003,6 +1012,7 @@ ul li {
border-top: 1px solid #dde1ed;
text-align: right;
font-family: 'MuseoSlab500Regular', serif;
font-size: 14px;
}
#page #content #projects .footer .icon {
color: #aaafbf;

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,26 +1,28 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Copyright (C) 2014 by original authors @ fontello.com</metadata>
<metadata>Copyright (C) 2016 by original authors @ fontello.com</metadata>
<defs>
<font id="fontello" horiz-adv-x="1000" >
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
<missing-glyph horiz-adv-x="1000" />
<glyph glyph-name="cog" unicode="&#xe800;" d="m0 289v124q0 7 5 13t10 7l104 16q8 25 22 51-23 32-60 77-6 7-6 14 0 5 5 12 15 20 55 60t53 40q7 0 15-5l77-60q24 13 50 21 9 76 17 104 3 15 20 15h124q7 0 13-4t7-12l15-103q28-9 50-21l80 60q5 5 13 5 7 0 14-5 72-67 92-95 4-5 4-13 0-6-4-12-9-12-29-38t-30-39q14-28 23-55l102-15q7-1 12-7t4-13v-124q0-7-4-13t-11-7l-104-16q-10-30-21-51 19-28 59-77 6-6 6-14t-5-12q-15-21-55-61t-53-39q-7 0-14 5l-77 60q-25-13-51-21-9-76-16-104-4-16-20-16h-124q-8 0-14 5t-6 12l-16 103q-27 9-50 20l-79-59q-6-5-14-5-8 0-14 6-70 63-92 94-4 5-4 12 0 7 5 13 8 12 28 37t30 40q-15 28-23 55l-102 15q-7 1-11 7t-5 13z m286 61q0-59 42-101t101-42 101 42 41 101-41 101-101 42-101-42-42-101z" horiz-adv-x="857.1" />
<glyph glyph-name="search" unicode="&#xe801;" d="m0 386q0 80 31 152t84 126 125 84 153 31 152-31 126-84 84-126 31-152q0-123-69-223l191-191q21-21 21-51 0-29-22-50t-50-21q-30 0-50 21l-191 191q-100-69-223-69-80 0-153 31t-125 83-84 126-31 153z m143 0q0-103 73-177t177-73 176 73 74 177-74 176-176 74-177-74-73-176z" horiz-adv-x="928.6" />
<glyph glyph-name="github" unicode="&#xe802;" d="m0 270q0 132 76 221-15 45-15 94 0 65 28 122 61 0 106-22t106-69q82 20 172 20 83 0 156-18 59 46 105 67t105 22q29-57 29-122 0-48-15-93 76-90 76-222 0-116-34-185-22-43-59-74t-79-48-95-27-96-12-93-3q-43 0-79 2t-82 7-85 17-77 28-67 46-48 64q-35 69-35 185z m125-99q0-49 18-85t45-58 68-33 78-17 83-4h94q46 0 83 4t78 17 69 33 45 58 18 85q0 67-39 114t-104 47q-23 0-109-12-40-6-88-6t-87 6q-85 12-109 12-66 0-104-47t-39-114z m89 0q0 23 7 46t24 43 41 19 40-19 24-43 7-46-7-45-24-43-40-19-41 19-24 43-7 45z m357 0q0 23 7 46t24 43 41 19 40-19 24-43 7-46-7-45-24-43-40-19-41 19-24 43-7 45z" horiz-adv-x="928.6" />
<glyph glyph-name="address" unicode="&#xe803;" d="m426 800q20 0 20-20l0-860q0-20-20-20l-46 0q-20 0-20 20l0 440-176 0q-16 0-28 6-12 2-26 12l-120 82q-10 6-10 16t10 16l120 82q14 10 26 12 8 4 28 4l176 0 0 190q0 20 20 20l46 0z m564-208q10-6 10-16t-10-16l-118-82q-22-12-26-12-14-6-28-6l-302 0-40 230 342 0q18 0 28-4t26-12z" horiz-adv-x="1000" />
<glyph glyph-name="plus-circled" unicode="&#xe804;" d="m0 350q0 117 58 215t155 156 216 58 215-58 156-156 57-215-57-215-156-156-215-58-216 58-155 156-58 215z m179-36q0-14 10-25t25-10h143v-143q0-15 11-25t25-11h71q15 0 25 11t11 25v143h143q14 0 25 10t11 25v72q0 14-11 25t-25 10h-143v143q0 15-11 25t-25 11h-71q-15 0-25-11t-11-25v-143h-143q-14 0-25-10t-10-25v-72z" horiz-adv-x="857.1" />
<glyph glyph-name="fire-station" unicode="&#xe805;" d="m425 775l-175-250-100 150c-33-58-150-200-150-350 0-221 204-400 425-400 221 0 425 179 425 400 0 150-117 292-150 350l-100-150z m0-400s175-134 175-250c0-50-75-100-175-100s-175 50-175 100c0 112 175 250 175 250z" horiz-adv-x="850" />
<glyph glyph-name="sort-alphabet" unicode="&#xe806;" d="m516 165q12-25-2-50t-44-25q-33 0-47 29l-37 75-249 0-37-75q-9-20-30-27t-40 3q-20 9-27 29t3 41l209 417q13 27 47 27t46-27z m-326 134l143 0-72 143z m905-209l-313 0q-30 0-45 27t4 57l250 332-209 0q-21 0-37 16t-15 37 15 36 37 16l313 0q30 0 45-28t-4-56l-250-333 209 0q21 0 37-15t15-37-15-37-37-15z m-417 209l-105 0q-21 0-36 15t-15 36 15 37 36 15l105 0q22 0 37-15t15-37-15-36-37-15z" horiz-adv-x="1147" />
<glyph glyph-name="desktop" unicode="&#xe807;" d="m0 154v607q0 37 26 63t63 26h893q37 0 63-26t26-63v-607q0-37-26-63t-63-27h-303q0-20 9-43t17-40 9-24q0-14-10-25t-25-11h-286q-15 0-25 11t-11 25q0 8 9 25t18 39 9 43h-304q-36 0-63 27t-26 63z m71 142q0-7 6-12t12-5h893q7 0 13 5t5 12v465q0 7-5 12t-13 6h-893q-7 0-12-6t-6-12v-465z" horiz-adv-x="1071.4" />
<glyph glyph-name="megaphone" unicode="&#xe808;" d="m792 500q58-138 67-258t-39-140q-28-12-61 3t-65 40-99 41-149 8q-28-4-42-19t-6-37q22-56 46-108 4-10 24-22t24-20q14-34-22-46-50-22-102-40-30-10-54 42-32 76-58 132-6 12-34 17t-46 31q-30-10-38-14-34-12-74 12t-54 60q-17 32-5 79t43 61q126 52 213 108t124 103 59 92 25 78 15 59 36 36q48 20 130-70t142-228z m-28-300q8 4 10 38t-11 98-41 128q-28 66-67 123t-67 84-36 23-10-42 10-105 40-133 68-119 68-76 36-19z" horiz-adv-x="860" />
<glyph glyph-name="logout" unicode="&#xe809;" d="m0 154v392q0 67 47 114t114 47h178q8 0 13-5t5-13q0-2 1-11t0-15-2-13-5-11-12-3h-178q-37 0-63-27t-27-63v-392q0-37 27-63t63-27h174t6 0 7-2 4-3 4-5 1-8q0-2 1-11t0-14-2-14-5-11-12-3h-178q-67 0-114 47t-47 114z m214 89v214q0 15 11 25t25 11h250v161q0 14 11 25t25 10 25-10l303-304q11-10 11-25t-11-25l-303-304q-11-10-25-10t-25 10-11 25v161h-250q-14 0-25 11t-11 25z" horiz-adv-x="928.6" />
<glyph glyph-name="rocket" unicode="&#xe80a;" d="m20 252l125 214q6 8 15 9l211 11q54 64 98 109 105 104 200 144t241 40q7 0 13-6t6-12q0-139-43-241t-141-201q-45-44-109-98l-11-211q-1-9-9-15l-214-125q-4-2-9-2-7 0-13 5l-36 36q-7 7-4 17l47 155-156 156-155-47q-1-1-5-1-7 0-12 5l-36 36q-10 11-3 22z m676 348q0-22 16-38t38-16 38 16 16 38-16 38-38 16-38-16-16-38z" horiz-adv-x="928.6" />
<glyph glyph-name="spinner1" unicode="&#xe80b;" d="m469 614v204q129 0 237-61t169-170 62-237h-204q0 72-36 133t-95 96-133 35z" horiz-adv-x="937.5" />
<glyph glyph-name="attention" unicode="&#xe80c;" d="m957-24q10-16 0-34-10-16-30-16l-892 0q-18 0-28 16-13 18-2 34l446 782q8 18 30 18t30-18z m-420 50l0 100-110 0 0-100 110 0z m0 174l0 300-110 0 0-300 110 0z" horiz-adv-x="962" />
<glyph glyph-name="heart" unicode="&#xe80e;" d="m508-66q-17 0-29 9-26 17-85 58t-154 112-134 110q-106 106-106 264 0 116 82 198t198 82q143 0 228-118 38 55 99 86t129 32q117 0 198-82t81-198q0-158-106-264-38-38-133-110t-155-113-83-57q-13-9-30-9z m-228 729q-72 0-124-51t-52-125q0-114 76-190 79-79 328-248 248 169 327 248 76 76 76 190 0 73-51 125t-124 51q-73 0-125-51t-51-125q0-22-16-37t-36-15-37 15-15 37q0 73-52 125t-124 51z" horiz-adv-x="1015" />
<glyph glyph-name="lifebuoy" unicode="&#xe80f;" d="m0 350q0 102 40 194t106 160 160 106 194 40 194-40 160-106 106-160 40-194-40-194-106-160-160-106-194-40-194 40-160 106-106 160-40 194z m71 0q0-106 51-201l108 108q-16 46-16 93t16 93l-108 108q-51-95-51-201z m215 0q0-89 63-151t151-63 152 63 62 151-62 152-152 62-151-62-63-152z m13-378q95-51 201-51t201 51l-108 108q-46-16-93-16t-93 16z m0 756l108-108q46 16 93 16t93-16l108 108q-95 51-201 51t-201-51z m471-471l108-108q51 95 51 201t-51 201l-108-108q16-46 16-93t-16-93z" horiz-adv-x="1000" />
<glyph glyph-name="trash-empty" unicode="&#xe800;" d="m286 439v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m143 0v-321q0-8-5-13t-13-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q8 0 13-5t5-13z m142 0v-321q0-8-5-13t-12-5h-36q-8 0-13 5t-5 13v321q0 8 5 13t13 5h36q7 0 12-5t5-13z m72-404v529h-500v-529q0-12 4-22t8-15 6-5h464q2 0 6 5t8 15 4 22z m-375 601h250l-27 65q-4 5-9 6h-177q-6-1-10-6z m518-18v-36q0-8-5-13t-13-5h-54v-529q0-46-26-80t-63-34h-464q-37 0-63 33t-27 79v531h-53q-8 0-13 5t-5 13v36q0 8 5 13t13 5h172l39 93q9 21 31 35t44 15h178q22 0 44-15t30-35l39-93h173q8 0 13-5t5-13z" horiz-adv-x="785.7" />
<glyph glyph-name="cog" unicode="&#xe801;" d="m571 350q0 59-41 101t-101 42-101-42-42-101 42-101 101-42 101 42 41 101z m286 61v-124q0-7-4-13t-11-7l-104-16q-10-30-21-51 19-27 59-77 6-6 6-13t-5-13q-15-21-55-61t-53-39q-7 0-14 5l-77 60q-25-13-51-21-9-76-16-104-4-16-20-16h-124q-8 0-14 5t-6 12l-16 103q-27 9-50 21l-79-60q-6-5-14-5-8 0-14 6-70 64-92 94-4 5-4 13 0 6 5 12 8 12 28 37t30 40q-15 28-23 55l-102 15q-7 1-11 7t-5 13v124q0 7 5 13t10 7l104 16q8 25 22 51-23 32-60 77-6 7-6 14 0 5 5 12 15 20 55 60t53 40q7 0 15-5l77-60q24 13 50 21 9 76 17 104 3 15 20 15h124q7 0 13-4t7-12l15-103q28-9 50-21l80 60q5 5 13 5 7 0 14-5 72-67 92-95 4-5 4-13 0-6-4-12-9-12-29-38t-30-39q14-28 23-55l102-15q7-1 12-7t4-13z" horiz-adv-x="857.1" />
<glyph glyph-name="pencil" unicode="&#xe802;" d="m203-7l50 51-131 131-51-51v-60h72v-71h60z m291 518q0 12-12 12-5 0-9-4l-303-302q-4-4-4-10 0-12 13-12 5 0 9 4l303 302q3 4 3 10z m-30 107l232-232-464-465h-232v233z m381-54q0-29-20-50l-93-93-232 233 93 92q20 21 50 21 29 0 51-21l131-131q20-22 20-51z" horiz-adv-x="857.1" />
<glyph glyph-name="menu" unicode="&#xe803;" d="m857 100v-71q0-15-10-25t-26-11h-785q-15 0-25 11t-11 25v71q0 15 11 25t25 11h785q15 0 26-11t10-25z m0 286v-72q0-14-10-25t-26-10h-785q-15 0-25 10t-11 25v72q0 14 11 25t25 10h785q15 0 26-10t10-25z m0 285v-71q0-15-10-25t-26-11h-785q-15 0-25 11t-11 25v71q0 15 11 26t25 10h785q15 0 26-10t10-26z" horiz-adv-x="857.1" />
<glyph glyph-name="wrench" unicode="&#xe804;" d="m214 29q0 14-10 25t-25 10-26-10-10-25 10-26 26-10 25 10 10 26z m360 234l-381-381q-21-20-50-20-29 0-51 20l-59 61q-21 20-21 50 0 29 21 51l380 380q22-55 64-97t97-64z m353 243q0-22-12-59-27-75-92-122t-144-46q-104 0-177 73t-73 177 73 176 177 74q32 0 67-10t60-26q9-6 9-15t-9-16l-163-94v-125l108-60q2 2 44 27t75 45 40 20q8 0 13-5t4-14z" horiz-adv-x="928.6" />
<glyph glyph-name="graduation-cap" unicode="&#xe805;" d="m990 383l10-176q2-38-46-71t-131-52-180-20-180 20-131 52-46 71l10 176 320-101q12-3 27-3t27 3z m296 181q0-13-13-17l-625-196q-2-1-5-1t-6 1l-364 115q-24-19-39-63t-19-99q35-20 35-61 0-39-32-60l32-241q1-8-4-14-5-7-14-7h-107q-8 0-13 7-6 6-5 14l33 241q-33 21-33 60 0 41 36 62 7 115 55 184l-186 58q-12 4-12 17t12 18l625 196q3 1 6 1t5-1l625-196q13-5 13-18z" horiz-adv-x="1285.7" />
<glyph glyph-name="plus-circled" unicode="&#xe806;" d="m679 314v72q0 14-11 25t-25 10h-143v143q0 15-11 25t-25 11h-71q-15 0-25-11t-11-25v-143h-143q-14 0-25-10t-10-25v-72q0-14 10-25t25-11h143v-142q0-15 11-25t25-11h71q15 0 25 11t11 25v142h143q14 0 25 11t11 25z m178 36q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z" horiz-adv-x="857.1" />
<glyph glyph-name="rocket" unicode="&#xe807;" d="m804 600q0 22-16 38t-38 16-38-16-16-38 16-38 38-16 38 16 16 38z m125 161q0-139-43-241t-141-201q-45-44-109-98l-11-211q-1-9-9-15l-214-125q-4-2-9-2-7 0-13 5l-36 36q-7 7-4 17l47 155-156 156-155-47q-1-1-5-1-7 0-12 5l-36 36q-10 11-3 22l125 214q6 8 15 9l211 11q54 64 98 109 105 104 200 144t241 40q7 0 13-6t6-12z" horiz-adv-x="928.6" />
<glyph glyph-name="desktop" unicode="&#xe808;" d="m1000 296v465q0 7-5 12t-13 6h-893q-7 0-12-6t-6-12v-465q0-7 6-12t12-5h893q7 0 13 5t5 12z m71 465v-607q0-37-26-63t-63-27h-303q0-20 9-43t17-40 9-24q0-14-10-25t-25-11h-286q-15 0-25 11t-11 25q0 8 9 25t18 39 9 43h-304q-36 0-63 27t-26 63v607q0 37 26 63t63 26h893q37 0 63-26t26-63z" horiz-adv-x="1071.4" />
<glyph glyph-name="logout" unicode="&#xe809;" d="m357 46q0-2 1-11t0-14-2-14-5-11-12-3h-178q-67 0-114 47t-47 114v392q0 67 47 114t114 47h178q8 0 13-5t5-13q0-2 1-11t0-15-2-13-5-11-12-3h-178q-37 0-63-27t-27-63v-392q0-37 27-63t63-27h174t6 0 7-2 4-3 4-5 1-8z m518 304q0-14-11-25l-303-304q-11-10-25-10t-25 10-11 25v161h-250q-14 0-25 11t-11 25v214q0 15 11 25t25 11h250v161q0 14 11 25t25 10 25-10l303-304q11-10 11-25z" horiz-adv-x="928.6" />
<glyph glyph-name="github" unicode="&#xe80a;" d="m357 171q0-22-7-45t-24-43-40-19-41 19-24 43-7 45 7 46 24 43 41 19 40-19 24-43 7-46z m357 0q0-22-7-45t-24-43-40-19-41 19-24 43-7 45 7 46 24 43 41 19 40-19 24-43 7-46z m90 0q0 67-39 114t-104 47q-23 0-109-12-40-6-88-6t-87 6q-85 12-109 12-66 0-104-47t-39-114q0-49 18-85t45-58 68-33 78-17 83-4h94q46 0 83 4t78 17 69 33 45 58 18 85z m125 99q0-116-34-185-22-43-59-74t-79-48-95-27-96-12-93-3q-43 0-79 2t-82 7-85 17-77 28-67 46-48 64q-35 69-35 185 0 132 76 221-15 45-15 94 0 65 28 122 61 0 106-22t106-69q82 20 172 20 83 0 156-18 59 46 105 67t105 22q29-57 29-122 0-48-15-93 76-90 76-222z" horiz-adv-x="928.6" />
<glyph glyph-name="attention" unicode="&#xe80b;" d="m957-24q10-16 0-34-10-16-30-16l-892 0q-18 0-28 16-13 18-2 34l446 782q8 18 30 18t30-18z m-420 50l0 100-110 0 0-100 110 0z m0 174l0 300-110 0 0-300 110 0z" horiz-adv-x="962" />
<glyph glyph-name="address" unicode="&#xe80c;" d="m426 800q20 0 20-20l0-860q0-20-20-20l-46 0q-20 0-20 20l0 440-176 0q-16 0-28 6-12 2-26 12l-120 82q-10 6-10 16t10 16l120 82q14 10 26 12 8 4 28 4l176 0 0 190q0 20 20 20l46 0z m564-208q10-6 10-16t-10-16l-118-82q-22-12-26-12-14-6-28-6l-302 0-40 230 342 0q18 0 28-4t26-12z" horiz-adv-x="1000" />
<glyph glyph-name="megaphone" unicode="&#xe80d;" d="m792 500q58-138 67-258t-39-140q-28-12-61 3t-65 40-99 41-149 8q-28-4-42-19t-6-37q22-56 46-108 4-10 24-22t24-20q14-34-22-46-50-22-102-40-30-10-54 42-32 76-58 132-6 12-34 17t-46 31q-30-10-38-14-34-12-74 12t-54 60q-17 32-5 79t43 61q126 52 213 108t124 103 59 92 25 78 15 59 36 36q48 20 130-70t142-228z m-28-300q8 4 10 38t-11 98-41 128q-28 66-67 123t-67 84-36 23-10-42 10-105 40-133 68-119 68-76 36-19z" horiz-adv-x="860" />
<glyph glyph-name="sort-alphabet" unicode="&#xe80e;" d="m516 165q12-25-2-50t-44-25q-33 0-47 29l-37 75-249 0-37-75q-9-20-30-27t-40 3q-20 9-27 29t3 41l209 417q13 27 47 27t46-27z m-326 134l143 0-72 143z m905-209l-313 0q-30 0-45 27t4 57l250 332-209 0q-21 0-37 16t-15 37 15 36 37 16l313 0q30 0 45-28t-4-56l-250-333 209 0q21 0 37-15t15-37-15-37-37-15z m-417 209l-105 0q-21 0-36 15t-15 36 15 37 36 15l105 0q22 0 37-15t15-37-15-36-37-15z" horiz-adv-x="1147" />
<glyph glyph-name="spinner1" unicode="&#xe80f;" d="m469 614v204q129 0 237-61t169-170 62-237h-204q0 72-36 133t-95 96-133 35z" horiz-adv-x="937.5" />
<glyph glyph-name="fire-station" unicode="&#xe810;" d="m425 775l-175-250-100 150c-33-58-150-200-150-350 0-221 204-400 425-400 221 0 425 179 425 400 0 150-117 292-150 350l-100-150z m0-400s175-134 175-250c0-50-75-100-175-100s-175 50-175 100c0 112 175 250 175 250z" horiz-adv-x="850" />
</font>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,58 @@
import React from 'react';
import _ from 'lodash';
import cls from 'classnames';
import actions from '../actions/appActions.js';
import Icon from './Icon.jsx';
import Link from './Link.jsx';
export default React.createClass({
displayName: 'EditProjects.jsx',
_onDelete(project) {
actions.emit('projects.delete', project);
},
render() {
let { projects } = this.props;
let list = _(projects.list)
.sortBy(({ owner, name }) => `${owner}/${name}`)
.map(({owner, name}, i) => {
return (
<tr key={`${owner}-${name}`}>
<td className="repo" colSpan="2">
<Link
route={{ 'to': 'milestones', 'params': { owner, name } }}
className="project"
>
{owner}/{name}
</Link>
</td>
<td
className="action"
onClick={this._onDelete.bind(this, { owner, name })}
><Icon name="delete" /> Delete</td>
</tr>
);
}).value();
// Wait for something to show.
if (!list.length) return false;
return (
<div id="projects">
<div className="header"><h2>Edit Projects</h2></div>
<table>
<tbody>{list}</tbody>
</table>
<div className="footer">
<a onClick={this.props.onToggleMode}>View Projects</a>
</div>
</div>
);
}
});

View File

@ -4,27 +4,29 @@ import format from '../modules/format.js';
// Fontello icon hex codes.
let codes = {
'spyglass': '\e801', // Font Awesome - search
'plus': '\e804', // Font Awesome - plus-circled
'settings': '\e800', // Font Awesome - cog
'rocket': '\e80a', // Font Awesome - rocket
'computer': '\e807', // Font Awesome - desktop
'help': '\e80f', // Font Awesome - lifebuoy
'delete': '\e800', // Font Awesome - trash-empty
'settings': '\e801', // Font Awesome - cog
'pencil': '\e802', // Font Awesome - pencil
'menu': '\e803', // Font Awesome - menu
'wrench': '\e804', // Font Awesome - wrench
'protip': '\e805', // Font Awesome - graduation-cap
'plus': '\e806', // Font Awesome - plus-circled
'rocket': '\e807', // Font Awesome - rocket
'computer': '\e808', // Font Awesome - desktop
'signout': '\e809', // Font Awesome - logout
'github': '\e802', // Font Awesome - github
'warning': '\e80c', // Entypo - attention
'direction': '\e803', // Entypo - address
'megaphone': '\e808', // Entypo - megaphone
'heart': '\e80e', // Typicons - heart
'sort': '\e806', // Typicons - sort-alphabet
'spinner': '\e80b', // MFG Labs - spinner1
'fire': '\e805' // Maki - fire-station
'github': '\e80a', // Font Awesome - github
'warning': '\e80b', // Entypo - attention
'direction': '\e80c', // Entypo - address
'megaphone': '\e80d', // Entypo - megaphone
'sort': '\e80e', // Typicons - sort-alphabet
'spinner': '\e80f', // MFG Labs - spinner1
'fire': '\e810' // Maki - fire-station
};
export default React.createClass({
displayName: 'Icon.jsx',
render() {
let name = this.props.name;

View File

@ -84,7 +84,7 @@ export default React.createClass({
if (!errors.length && !list.length) return false;
if (project) {
// List of projects and their milestones.
// Project-specific milestones.
return (
<div id="projects">
<div className="header">
@ -98,7 +98,7 @@ export default React.createClass({
</div>
);
} else {
// Project-specific milestones.
// List of projects and their milestones.
return (
<div id="projects">
<div className="header">
@ -111,7 +111,9 @@ export default React.createClass({
{list}
</tbody>
</table>
<div className="footer" />
<div className="footer">
<a onClick={this.props.onToggleMode}>Edit Projects</a>
</div>
</div>
);
}

View File

@ -6,6 +6,7 @@ import Notify from '../Notify.jsx';
import Header from '../Header.jsx';
import Footer from '../Footer.jsx';
import Milestones from '../Milestones.jsx';
import EditProjects from '../EditProjects.jsx';
import Hero from '../Hero.jsx';
export default React.createClass({
@ -14,12 +15,38 @@ export default React.createClass({
mixins: [ Page ],
// Toggle between edit and view mode.
_onToggleMode() {
this.setState({ 'edit': !this.state.edit });
},
getInitialState() {
return {
// Start the page in a view mode.
'edit': false
};
},
render() {
let content;
if (!this.state.app.loading) {
let projects = this.state.projects;
if (projects.list.length) {
content = <Milestones projects={projects} />;
if (!this.state.edit) {
content = (
<Milestones
projects={projects}
onToggleMode={this._onToggleMode}
/>
);
} else {
content = (
<EditProjects
projects={projects}
onToggleMode={this._onToggleMode}
/>
);
}
} else {
content = <Hero />;
}

View File

@ -77,6 +77,7 @@ export default class Store extends EventEmitter {
}
// Push a value on an array or init it.
// TODO: emit flag
push(key, val) {
// Make sure the key is an array.
if (!_.isArray(key)) key = key.split('.');
@ -98,11 +99,22 @@ export default class Store extends EventEmitter {
if (!_.isFunction(cb)) return val;
if (opa.has(this[DATA], path)) return cb(val);
this.on(path, (...args) => {
this.off(path, cb);
cb.apply(this, args);
});
}
// Delete a path.
// TODO: emit flag
del(path) {
// Make sure the key is an array.
if (!_.isArray(path)) path = path.split('.');
// Actually delete.
opa.del(this[DATA], path);
// Emit event.
this.emit(path, this.get(path.splice(-1,1).join('.')));
}
}

View File

@ -167,6 +167,16 @@ class ProjectsStore extends Store {
}));
}
// Delete a project.
onProjectsDelete(project) {
let i = this.findIndex(project);
// Delete the project.
this.del(`list.${i}`);
// And the index, sorting again.
this.set('index', []);
this.sort();
}
// Return a sort order comparator.
comparator() {
let { list, sortBy } = this.get();

View File

@ -301,7 +301,7 @@ ul {
}
}
#add {
#add {
h2 {
color: #3e4457;
}
@ -458,9 +458,16 @@ ul {
&:first-child {
color: #3e4457;
}
&.action {
text-align: right;
cursor: pointer;
color: #77000e;
.user-select(none);
}
}
tr {
tr {
&:nth-child(even) td {
background: #fefefe;
}
@ -500,6 +507,7 @@ ul {
border-top: 1px solid #dde1ed;
text-align: right;
font-family: @serif_font;
font-size: 14px;
.icon {
color: #aaafbf;
@ -527,4 +535,4 @@ ul {
text-align: center;
padding: 30px;
font-family: @serif_font;
}
}

View File

@ -22,11 +22,11 @@
@font-face {
font-family: 'Fontello';
src: url("../fonts/fontello.eot?74672344");
src: url("../fonts/fontello.eot?74672344#iefix") format('embedded-opentype'),
url("../fonts/fontello.woff?74672344") format('woff'),
url("../fonts/fontello.ttf?74672344") format('truetype'),
url("../fonts/fontello.svg?74672344#fontello") format('svg');
src: url("../fonts/fontello.eot");
src: url("../fonts/fontello.eot#iefix") format('embedded-opentype'),
url("../fonts/fontello.woff") format('woff'),
url("../fonts/fontello.ttf") format('truetype'),
url("../fonts/fontello.svg#fontello") format('svg');
font-weight: normal;
font-style: normal;
}
}

View File

@ -14,7 +14,7 @@ export default {
assert.deepEqual(projects.get('list'), []);
done();
},
'projects - sorts on new milestones': (done) => {
projects.set({ 'list': [], 'index': [] });
@ -26,12 +26,12 @@ export default {
'title': '1.0.0',
'stats': {}
};
projects.push('list', project);
projects.addMilestone(project, milestone);
assert.deepEqual(projects.get('index'), [[0, 0]]);
done();
},
@ -62,9 +62,9 @@ export default {
projects.push('list', project);
projects.addMilestone(project, milestone1);
projects.addMilestone(project, milestone2);
assert.deepEqual(projects.get('index'), [[0, 1], [0, 0]]);
done();
},
@ -110,9 +110,9 @@ export default {
projects.addMilestone(project, milestone1);
projects.addMilestone(project, milestone2);
projects.addMilestone(project, milestone3);
assert.deepEqual(projects.get('index'), [[0, 2], [0, 0], [0, 1]]);
done();
},
@ -152,9 +152,9 @@ export default {
projects.addMilestone(project, milestone1);
projects.addMilestone(project, milestone2);
projects.addMilestone(project, milestone3);
assert.deepEqual(projects.get('index'), [[0, 2], [0, 1], [0, 0]]);
done();
},
@ -177,9 +177,9 @@ export default {
projects.push('list', project);
projects.addMilestone(project, milestone1);
projects.addMilestone(project, milestone2);
assert.deepEqual(projects.get('index'), [[0, 1], [0, 0]]);
done();
},
@ -207,9 +207,9 @@ export default {
projects.addMilestone(project, milestone1);
projects.addMilestone(project, milestone2);
projects.addMilestone(project, milestone3);
assert.deepEqual(projects.get('index'), [[0, 2], [0, 1], [0, 0]]);
done();
},
@ -241,6 +241,26 @@ export default {
projects.onProjectsSearch('radek/a');
assert.deepEqual(projects.get('suggestions'), [ 'radek/aA' ]);
done();
},
'projects - delete': (done) => {
let a = { 'owner': 'company', 'name': 'netflix', 'milestones': [ { 'title': 'A', 'stats': {} } ] };
let b = { 'owner': 'company', 'name': 'space-x' };
let c = { 'owner': 'company', 'name': 'tesla-m', 'milestones': [ { 'title': 'C', 'stats': {} } ] };
projects.set({
'list': [ a, b, c ],
'index': [ [ 0, 0 ], [ 1, 0 ], [ 2, 0 ] ],
'sortBy': 'name',
'user': null
});
projects.onProjectsDelete(b);
assert.deepEqual(projects.get('list'), [ a, c ]);
assert.deepEqual(projects.get('index'), [ [ 0, 0 ], [ 1, 0 ] ]);
done();
}
};