Add alpha label
Merge pull request #46 from alphagov/add-alpha-label

Add alpha label https://trello.com/c/0eHTxG4j/141-add-alpha-label-to-eim-manual
Add redirect for /guidance

Requests to www.gov.uk/guidance should respond with something other than
a 404 in case people request it via URL hacking from a manual page.

Until we build a better option, the list of guidance publications
published in Whitehall is the best we have.
Merge pull request #47 from alphagov/add-redirect-for-guidance

Add redirect for /guidance
404 if the Repo can't find a document

With the introduction of a Repo for fetching documents, the Repo would
throw an error if params[:section_id] didn't match a placeholder file
instead of allowing the controller to respond with a 404. This commit
checks for the existence of a file first, which if false allows the
controller to respond with a 404.
Add cucumber to manuals-frontend.

Gem versions are pessimistically fixed to match those in other projects
(rspec 2 rather than 3, for example).

Also include two passing tests covering local manual and section
browsing and the fix introduced in 465ef06.
Refactor HTML for non-hmrc manuals

Collapsable sections in non-hmrc manuals will not be split out in the json returned from GDS-API but rather they will exist as a load of markdown in the body and anything under an H2 will be made collapsible. This commit rebuilds templates so that either schema types will produce the same HTML.
Make section.url work

Pass the manual_id down to the section so that it can form its url properly.
Style new HTML layout

WIP.
Implemented no-js fallback styles.
Lot of css now no longer being used that will be removed as part of a later commit
Fix spelling of "collapsible"

Clearly changed my mind about the spelling of collapsible half way through this. Well done me.
Shuffle HTML around for more uniform approach

unify approach to HMRC manual sections and sections within the body of non-hmrc manuals
Update tests for new markup for both manual types

Add HTML generated by blobs and HTML generated by sections. Test both where sensible and add a third generically named 'collection' where the source is not relevant.
markupSections function and tests

markupSections takes content that doesn't have enough semantic meaning to form collapsible sections and adds tags/classes to make this work. Works for data from hmrc manuals or the simpler data from the specialist publisher.

markupSections takes:
(1)
<h2>title</h2>
<p>some</p>
<p>tags</p>
<h2>another title</h2>
<p>more</p>
<p>tags</p>

or
(2)
<h2 class="subsection-with-id">
  <span class="subsection-id">HMRCID</span>
  <span class="subsection-title-text">Title</span>
  <span class="subsection-summary">Here is a concise summary of the content</span>
</h2>
<div class="js-ignore-h2s">
  <p>some</p>
  <h2>ignored h2</h2>
  <p>tags</p>
  <h2>ignored h2</h2>
  <p>tags</p>
</div>
<h2 class="subsection-with-id linked-title">
  <a href="#">
    <span class="subsection-id">EIM1234</span>
    <span class="subsection-title-text">Subsection title</span>
    <span class="subsection-summary">Here is a concise summary of the content</span>
  </a>
</h2>

and adds additional html and classes to them so they can be collapsible giving:

(1)
<div class='js-openable manual-subsection'>
  <h2 class='subsection-title'>title</h2>
  <div class='subsection-body'>
    <p>some</p>
    <p>tags</p>
  </div>
</div>
<div class='js-openable manual-subsection'>
  <div class='subsection-body'>
    <h2 class='subsection-title'>another title</h2>
    <p>more</p>
    <p>tags</p>
  </div>
</div>

or

(2)
<div class='js-openable manual-subsection'>
  <h2 class="subsection-with-id subsection-title">
    <span class="subsection-id">HMRCID</span>
    <span class="subsection-title-text">Title</span>
    <span class="subsection-summary">Here is a concise summary of the content</span>
  </h2>
  <div class='subsection-body'>
    <div class="js-ignore-h2s">
      <p>some</p>
      <h2>ignored h2</h2>
      <p>tags</p>
      <h2>ignored h2</h2>
      <p>tags</p>
    </div>
  </div>
</div>
<h2 class="subsection-with-id linked-title">
  <a href="#">
    <span class="subsection-id">EIM1234</span>
    <span class="subsection-title-text">Subsection title</span>
    <span class="subsection-summary">Here is a concise summary of the content</span>
  </a>
</h2>
Add styles for collapsibles  that have been marked up by javascript
Add data-section-id for HMRC manuals and fallback for non-hmrc manuals
Change el to $el as it is a jQuery object
Refactor CSS

- Delete unused CSS
- Tweak padding and add in styles for mobile
Rename classes added by javascript

Add js prefix to classes that are added by JavaScript
- Rename collection-controls to js-collection-controls
- Rename subsection-title to js-subsection-title
- Rename subsection-body to js-subsection-body
Update language used to match the rest of the spec
Fixes to things that broke after the merge

- Add a collapsible? method to section_presenter
- Update index to new style
- fix typo from merge in _non_collapsible_subsection.html.erb