Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better style for challenges (+ allow inline placement) #11

Closed
wants to merge 2 commits into from
Closed

Better style for challenges (+ allow inline placement) #11

wants to merge 2 commits into from

Conversation

pbanaszkiewicz
Copy link
Contributor

This PR changes style for challenges.

Following discussion (#9) about challenges, this should enable us to put them inside a lesson (not at the lesson's end, as it was before).

Additional styling was added that resembles "a box with header-title" (see below).

BEFORE:
screenshot from 2015-02-14 21 28 30

AFTER:
screenshot from 2015-02-14 21 27 32

@gvwilson
Copy link
Contributor

gvwilson commented Feb 14, 2015 via email

@jduckles
Copy link
Contributor

FWIW 👍 I like the proposed new style.

@pbanaszkiewicz
Copy link
Contributor Author

Thanks, @jduckles!

I forgot to mention pros and cons of this solution.

Pros:

  • almost no change in current challenge syntax in lessons Markdown
  • works with any header (h1-h5)

Cons:

  • we can't add "Challenge:" in CSS using element::before { content: "Challenge:"; } (what if someone decides to translate the lessons?). So it should be added in the lesson .md itself, for example:
> ## **Challenge:** Query Style {.challenge}
>
> Many people format queries as:
>
> ~~~
> SELECT personal, family FROM person;
> ~~~
>
> or as:
>
> ~~~
> select Personal, Family from PERSON;
> ~~~
>
> What style do you find easiest to read, and why?

Of course last point is invalid if we don't want to highlight that this specific box is a challenge. However, in my opinion we should include **Challenge:** - it makes things clearer, at least for me.

@gvwilson
Copy link
Contributor

gvwilson commented Feb 15, 2015 via email

@orchid00
Copy link
Contributor

@pbanaszkiewicz I agree the new style looks better :)

@pbanaszkiewicz
Copy link
Contributor Author

Thanks, @orchid00!

@gvwilson: not sure if I understand correctly. Are you saying that:

  1. we should omit "Challenge:" completely? Preview:
    screenshot from 2015-02-15 15 15 34
  2. we should omit **Challenge:** in Markdown source, but add it in CSS via element::before? The result would be the same as in Better style for challenges (+ allow inline placement) #11 (comment).

@gvwilson
Copy link
Contributor

gvwilson commented Feb 15, 2015 via email

@pbanaszkiewicz
Copy link
Contributor Author

@gvwilson OK, in that case I think this PR is ready to be merged in (unless we're waiting for @fmichonneau's thoughts).

I'll propose an additional filter, but it'll go to https://github.com/swcarpentry/lesson-template, not here.

@gvwilson
Copy link
Contributor

@fmichonneau any thoughts on this one?

@fmichonneau
Copy link
Contributor

The CSS affected by this PR doesn't conflict with what I am working on so I
don't have any issue with it. And I also think it looks much better than we
currently have!

As I was getting more familiar with Bootstrap, I had initially thought we
could replace the styles associated with challenges, objectives, and key
points with Bootstrap's "panels alternatives":
http://getbootstrap.com/components/#panels-alternatives as it would reduce
the amount of CSS we have to manage across the repositories. However, I
don't have strong feelings either way.

@rgaiacs
Copy link
Contributor

rgaiacs commented Feb 17, 2015

I think we should insert the word Challenge during the
Markdown-to-HTML conversion process. That saves typing (and possible
inconsistency) in the Markdown, and avoids cleverness in the CSS.

I'm -1 to have the word "Challenge" in the HTML. I'm +1 for use CSS, element::before { content: "Challenge:"; }. We can also use CSS for handle localization, http://css-tricks.com/almanac/selectors/l/lang/.

@gvwilson
Copy link
Contributor

gvwilson commented Feb 17, 2015 via email

@fmichonneau
Copy link
Contributor

If we use an icon, we should probably get one from bootstrap:
http://getbootstrap.com/components/#glyphicons (certificate?)

Browser compatibility for ::before seems pretty good:
https://developer.mozilla.org/en-US/docs/Web/CSS/::before#Browser_compatibility

@gvwilson
Copy link
Contributor

gvwilson commented Feb 17, 2015 via email

@pbanaszkiewicz
Copy link
Contributor Author

@r-gaia-cs: what do you prefer me to do:

  1. throw this PR away and rewrite lesson-template/tools/filters/blockquote2div.py to add Bootstrap's panel class attribute and appropriate icon?
  2. rewrite our CSS class for .challenge that it looks like Bootstrap's?

@rgaiacs
Copy link
Contributor

rgaiacs commented Feb 18, 2015

OK, how about a small icon inserted into the text instead of the word "Challenge"?

👍 I like the glyphicon-pencil from Bootstrap.

@pbanaszkiewicz Can you change lesson-template/tools/filters/blockquote2div.py? I would like avoid code duplication.

@pbanaszkiewicz
Copy link
Contributor Author

@pbanaszkiewicz Can you change lesson-template/tools/filters/blockquote2div.py? I would like avoid code duplication.

Yes, sir!

This PR will remove styles for ".challenge" and other classes, instead of providing styles for boxes.

This makes some things look nicer (e.g. adds gradients, etc).
There's a note in
swcarpentry/DEPRECATED-lesson-template#182
explaining why we need to fix style for panel heading.
@pbanaszkiewicz
Copy link
Contributor Author

I used force to rewrite this PR (sorry).

@r-gaia-cs now it's in your hands (together with swcarpentry/DEPRECATED-lesson-template#182). Please review and merge.

@rgaiacs
Copy link
Contributor

rgaiacs commented Feb 25, 2015

@pbanaszkiewicz Sorry for the delay.

I follow

$ git clone git@github.com:pbanaszkiewicz/lesson-template.git
$ cd lesson-template
$ git remote add style git@github.com:pbanaszkiewicz/styles.git
$ git fetch style
$ git checkout bootstrap-panels
$ git subtree pull -P css/ style fix-challenge -m 'Merge new style'
$ make -B preview
$ firefox 01-one.html

and (1) I couldn't read "Lessons Objectives"

o

and (2) I couldn't see the icon of "Callout box".

c

Can you help me with it?

@rgaiacs rgaiacs self-assigned this Feb 25, 2015
@pbanaszkiewicz
Copy link
Contributor Author

Hi @r-gaia-cs!

Regarding (2): icon fonts won't work until you merge #12, and I rebase against it.

Regarding (1): I'm not sure what's happening here… at first I'd say something is making box's title header have white background. I'm pretty sure I did not introduce such styles.

I'm running into issues with git subtree pull -P css/ style fix-challenges -m 'Merge new style':

From github.com:pbanaszkiewicz/styles
 * branch            fix-challenges -> FETCH_HEAD
fatal: entry  not found in tree ddb226a6b45bec8af629b537f6f292e32821ac84

Can you put your branch as it is somewhere so that we can take a look at the styles and what they are doing?

@rgaiacs
Copy link
Contributor

rgaiacs commented Feb 25, 2015 via email

@rgaiacs
Copy link
Contributor

rgaiacs commented Mar 15, 2015

@pbanaszkiewicz Sorry for the long delay. You can find the bug at https://github.com/r-gaia-cs/swc-lesson-template/tree/bug-with-challenge-style. The problem is that

<div id="learning-objectives" class="objectives panel panel-primary">
<div class="panel-heading">
<h2 id="learning-objectives" class="objectives panel panel-primary"><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
</div>
<div class="panel-body">
<ul>
<li>Learning objective 1</li>
<li>Learning objective 2</li>
</ul>
</div>
</div>

when it should be

<div id="learning-objectives" class="objectives panel panel-info">
<div class="panel-heading">
<h2 id="learning-objectives" class="objectives panel panel-info"><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
</div>
<div class="panel-body">
<ul>
<li>Learning objective 1</li>
<li>Learning objective 2</li>
</ul>
</div>
</div>

like

<div id="callout-box" class="callout panel panel-info">
<div class="panel-heading">
<h2 id="callout-box" class="callout panel panel-info"><span class="glyphicon glyphicon-pushpin"></span>Callout Box</h2>
</div>
<div class="panel-body">
<p>An aside of some kind.</p>
</div>
</div>

@rgaiacs
Copy link
Contributor

rgaiacs commented Mar 15, 2015

@pbanaszkiewicz The problem is

.panel-primary > .panel-heading {
    color: #FFF;
}

and

.panel {
    background-color: #FFF;
}

from css/bootstrap/bootstrap.css. You need to change

.panel-primary > .panel-heading {
    color: #FFF;
}

so the color isn't #FFF.

And could you rebase this pull request and swcarpentry/DEPRECATED-lesson-template#182?
I will merge it after the rebase.

rgaiacs pushed a commit to rgaiacs/swc-lesson-template that referenced this pull request Mar 21, 2015
Blockquotes that have a header (with class "callout", "challenge",
"prereq", "objectives") as their first element will get rendered as
<div>s.  Their structure will resemble Bootstrap's panel:
http://getbootstrap.com/components/#panels-alternatives

There's currently an issue with pandoc: the header nested under the
blockquote will never have assigned attributes.  This is causing the
panel's heading to look enormous.  I'll fix it in
carpentries/styles#11.

BTW: glyphicons won't render correctly unless 'fonts' directory gets
moved up one level to the 'css' directory. I'll fix that in
carpentries/styles#11 too.
@rgaiacs
Copy link
Contributor

rgaiacs commented Mar 21, 2015

I'm closing this in favor of #17.

@rgaiacs rgaiacs closed this Mar 21, 2015
rgaiacs added a commit to rgaiacs/swc-styles that referenced this pull request Mar 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants