Commit f2224fbc authored by Adrien Dorsaz's avatar Adrien Dorsaz

add tab system and use it for the news toolbar

parent aa8a8540
$ = window.jQuery
# Tabs management: on click hide data from all other sibling tabs
$(".tab").click ->
# Update active tab to the one which were clicked
tab = $(@)
tab.attr("data-show-content", true)
tab.siblings().removeAttr("data-show-content")
# Show active content linked to the newly activated tab
content = $("#" + $(@).data("tab-content-id"))
content.attr("data-show-content", true)
content.siblings().removeAttr("data-show-content")
false
......@@ -46,6 +46,9 @@ body.chat_n_edit {
background: #f9f9f9;
min-height: 100vh;
max-width: none;
#tab-chat .inbox-container {
height: 72vh;
}
}
body#redaction-index {
......
.tab-header-container {
display: -ms-flexbox;
display: flex;
justify-content: space-between;
.tab {
font-size: 1.5em;
line-height: 1.3em;
// Use background to display a little border below tabs
background: no-repeat 0px 1.65rem / 2rem transparent;
background-image: url("/images/icones/underline.png");
background-image: url("/images/icones/underline.svg"), none;
padding-bottom: 5px;
// For tabs not active, show an alternative background
&:not([data-show-content]) {
background-image: url("/images/icones/not-active-underline.png");
background-image: url("/images/icones/not-active-underline.svg"), none;
}
}
}
// Hide all content which are not active
.tab-content:not([data-show-content]) {
display: none;
}
- if news.urgent?
%h1.urgent Dépêche urgente !
%h3 Participants
= render 'attendees', attendees: news.attendees, enable_reassign: enable_reassign
= render 'editions', news: news
= render 'boards/large', boards: boards, box: false
%p
.tab-header-container
.tab{'data-tab-content-id' => 'tab-chat', 'data-show-content' => true}
Discussions
.tab{'data-tab-content-id' => 'tab-details'}
Détails
.tab{'data-tab-content-id' => 'tab-history'}
Historique
%hr
%div
#tab-chat.tab-content{'data-show-content' => true}
= render 'boards/large', boards: boards, box: false
#tab-details.tab-content
%p
Titre:
= news.title
%p
Rédaction:
- if news.node.cc_licensed?
collective
%p
Licence:
- if news.node.cc_licensed?
= link_to "CC by-sa", cc_url(news), rel: 'license'
%p
Catégorie:
= link_to(news.section.title, news.section)
%hr
- news_content = strip_tags(news.body + ' ' + news.second_part).strip()
- sentences = news_content.split(/[…!\.\?]{1,3}/).count - 1
- words = news_content.split(' ').count
#news_statistics
%p
#{number_with_delimiter(1 + news.nb_editors)}
#{"participant".pluralize(1 + news.nb_editors)}
%p
#{number_with_delimiter(news.versions.count)}
#{"révision".pluralize(news.versions.count)}
%p
#{number_with_delimiter(sentences)}
#{"phrase".pluralize(sentences)}
%p
#{number_with_delimiter(words)}
#{"mot".pluralize(words)}
%p
#{number_with_delimiter(news.paragraphs.count)}
#{"paragraphe".pluralize(news.paragraphs.count)}
%p
#{number_with_delimiter(news_content.length)}
#{"caractère".pluralize(news_content.length)}
%hr
%p Participants
= render 'attendees', attendees: news.attendees, enable_reassign: enable_reassign
#tab-history.tab-content
= render 'editions', news: news
%hr
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="1"
height="4"
viewBox="0 0 1 4"
version="1.1"
id="svg4"
sodipodi:docname="not-active-underline.svg"
inkscape:version="0.92.1 r15371"
inkscape:export-filename="/home/adrien/linuxfr.org/public/images/icones/line.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1600"
inkscape:window-height="836"
id="namedview6"
showgrid="false"
inkscape:snap-page="true"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="22.627417"
inkscape:cx="-13.537478"
inkscape:cy="-5.2032048"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg4" />
<path
d="m 1,7.7006055e-5 -1,-1.533e-4 V 3.9998466 l 1,1.533e-4 z"
id="path2"
inkscape:connector-curvature="0"
style="fill:#4e4e50;stroke-width:0.93332553;opacity:0.3"
sodipodi:nodetypes="ccccc"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
</svg>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment