Skip to content
This repository was archived by the owner on Apr 5, 2020. It is now read-only.

Conversation

@agnetedjupvik
Copy link
Contributor

This uses markdown-it-checkbox to support checkboxes for each subtask in a lesson, as adressed in issue #218 in codeclub-viewer.

The checkboxes here are dumb, and they only have a 1-indexed ID given by markdown-it-checkbox. They can become unique identificators by combining them with the task name (or path).

Merging this now, while checkboxes aren't in use in the oppgaver repo yet, will change the appearance of regular list items into actual lists, not fake checkboxes. Checkboxes can then be added into oppgaver by using [ ]  instead of +.

@arve0
Copy link
Owner

arve0 commented Apr 26, 2017

Thanks!

Do you have a build published in somewhere? If not, do not stress it, I'll try it local later today.

package.json Outdated
"jquery": "^2.1.3",
"js-cookie": "^2.0.4",
"json5": "^0.4.0",
"markdown-it-checkbox": "^1.1.0",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conventions in this repo are "build-deps" => development dependencies and "Client-deps" => dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh, so I should save-dev on this one. Should have spotted that. Thanks!

@agnetedjupvik
Copy link
Contributor Author

If we can merge this before the weekend, that would be great :)
I've gotten started on a branch of codeclub-viewer which introduces some rudimentary actions and reducers which will attempt to add state to these subtasks. I think the work with this would be soo much easier if we could test with these checkboxes, and I want to do all of that next week.

ul, ol {
padding: 0;
margin: 0 0 20px 0;
margin: 0 0 20px 20px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jeg har lyst å foreslå noen endringer. Jeg synes at listene skal ligne litt mer på det som er i dag enn det @agnetedjupvik foreslår. Så hvis vi dropper denne endringen...

}
li {
list-style: none;
list-style: circle;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...og dropper denne endringen...

list-style: circle;
padding-top: 10px;
padding-bottom: 10px;
margin-left: -30px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(denne linjen kan vi godt fjerne, for den blir jo "overskrevet" av neste linje)

// check box for list items
li:before {
content: " ";
border-radius: 8px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...øke denne, f.eks. til 20px, slik at det blir en sirkel...

content: " ";
border-radius: 8px;
border: 3px solid #ABDBEA;
padding: 10px 10px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... gjør sirkelen litt mindre, f.eks. padding: 8px (vi trenger tallet bare 1 gang)...

li:before {
content: " ";
border-radius: 8px;
border: 3px solid #ABDBEA;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... beholde denne...

padding-bottom: 10px;
margin-left: -30px;
// adjust all elements inside a list item
margin-left: 45px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...beholde denne...

}
// check box for list items
li:before {
content: " ";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...beholde denne...

margin-top: 10px;
}

label {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Når det gjelder denne, hadde det ikke vært lurt å legge denne inni en klasse, slik at det ikke ødelegger for bootstrap sin listevisning evt andre steder? Det kunne jo være innenfor .check, .activity, .save?


label {
font-weight: normal;
margin-left: 6px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Synes ikke disse checkboxene er så veldig fine. Hva om vi heller gjør noe slikt?

input[type="checkbox"] {
  opacity: 0;
  filter: alpha(opacity=0);
}
input[type="checkbox"] + label {
  position: relative;
  margin-left: 10px;
  font-weight: normal;
}
input[type="checkbox"] + label:before {
  content: '';
  display: inline-block;
  visibility: visible;
  left: 0;
  width: 1em;
  height: 1em;
  margin: 0 0.8em -0.1em -1em;
  line-height: 0.6;
  text-align: center;
  /* Put checkbox styles here: */
  border: 3px solid #ABDBEA;
}
input[type="checkbox"]:checked + label:before {
  content: '✔';
  line-height: 0.8em;
  text-align: center;
}

(fant dette på nettet, og tweaket littegrann, så kan sikkert gjøres bedre, men nå ligner det ihvertfall litt mer på listevisningen)

@NorwegianKiwi
Copy link
Contributor

NorwegianKiwi commented Apr 26, 2017

En ting som er litt dumt, er at det ser ut som om markdown-it-checkbox (tror det er denne) ikke parser innholdet helt riktig. For at alt skal komme inni <label>, så må det være på samme linje som [ ]...

Jeg tror det er dette som gjør at innholdet for hele checkbox-label (list item) ikke blir indendert riktig.

Det er mulig at mcecot/markdown-it-checkbox#5 løser dette, men da må den gjøres (evt at man forker markdown-it-checkbox og fikser det selv)...

@arve0
Copy link
Owner

arve0 commented Apr 26, 2017

Hi! As @NorwegianKiwi says, the style is a step back:

skjermbilde 2017-04-26 kl 21 17 28

What about another solution: I see you plan to persistent store the state. For that you need to implement some click event handler. Then, the same UI can be achieved by using similar styling as @NorwegianKiwi suggest.

Edit: To be clear, keeping the + and --syntax.

@arve0
Copy link
Owner

arve0 commented Apr 26, 2017

@agnetedjupvik
Copy link
Contributor Author

So now I have a .checked class, and I'm thinking that I'll use that for managing the subtask state in codeclub-viewer.

Why Travis fails and some links appear broken, though, is a mystery to me... I see that we've had problems with it in earlier commits and it has been solved in later commits for no apparent reason.

@arve0
Copy link
Owner

arve0 commented May 3, 2017

Why Travis fails and some links appear broken, though, is a mystery to me...

We use PhantomJS to generate PDFs. PhantomJS crashes sometimes due to a memory leak. The crash is not resolved gracefully. With headless Chrome in the making, the PDF generation will be better in near future (hopefully).

@arve0
Copy link
Owner

arve0 commented May 3, 2017

Doesn't look the plugin works well will list points which are several lines.

code

[ ] Prøv å klikk på de blå klossene midt på skjermen. For eksempel,
  om du klikker på

skjermbilde 2017-05-03 kl 22 22 05

As you can see in the picture, only the first line of the check point are contained in the <label>.

Link to lesson: https://raw.githubusercontent.com/Skagevang/oppgaver/076ea3184ed162886c5b59598efdd3c6d409b8e1/src/scratch/astrokatt/astrokatt.md

@agnetedjupvik
Copy link
Contributor Author

Yup, noticed it. I made a fork of the plugin and will try to see what I can do to fix it in the next couple of days. Don't hesitate to bring in any ideas for that :)

@arve0
Copy link
Owner

arve0 commented May 4, 2017 via email

@agnetedjupvik
Copy link
Contributor Author

We found a plugin which adds all text into labels in order for it to sound nicer using text-to-speech tools. However, we found out that it wrapped everything in so many other tags that it really doesn't give any value to the site at all. So, I'll add the clickable label thing as an issue in my fork, which can be solved later on, but is not required for this to be merged.

@arve0
Copy link
Owner

arve0 commented May 9, 2017

Still issue with list points over several lines, list points should be contained in a parent node.

For example

[ ] List point
  over several lines

should become something like

<li>
  <input type=checkbox>
  <p>list point</p>
  <p>over several lines</p>
</li>

but currently renders to

<p><input type=checkbox>list point</p>
<p>over several lines</p>

Which gives

skjermbilde 2017-05-09 kl 20 20 17

instead of

skjermbilde 2017-05-09 kl 20 19 57

This makes it hard to distinct "just text" vs "task".

@NorwegianKiwi
Copy link
Contributor

Tip: Perhaps correct alignment here as was done for kodeklubben/codeclub-viewer#267 ?

display: none;
}

input[type="checkbox"] + label {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, what does + label and + label::before do?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arve0 arve0 merged commit bca6146 into arve0:master Jun 5, 2017
@arve0
Copy link
Owner

arve0 commented Jun 5, 2017

Thanks :octocat:

@agnetedjupvik agnetedjupvik deleted the checkbox branch June 5, 2017 18:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants