govuk_publishing_components 21.62.0 → 21.64.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/components/govspeak.js +17 -15
  3. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +402 -340
  4. data/app/assets/javascripts/govuk_publishing_components/dependencies.js +0 -5
  5. data/app/assets/javascripts/govuk_publishing_components/lib.js +1 -0
  6. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/barchart-enhancement.js +18 -11
  7. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +423 -0
  8. data/app/assets/javascripts/govuk_publishing_components/lib/toggle.js +126 -65
  9. data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills/closest.js +23 -0
  10. data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills/indexOf.js +9 -0
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +3 -16
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_panel.scss +7 -1
  13. data/app/views/govuk_publishing_components/component_guide/example.html.erb +4 -1
  14. data/app/views/govuk_publishing_components/component_guide/show.html.erb +3 -1
  15. data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +1 -1
  16. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +1 -1
  17. data/app/views/govuk_publishing_components/components/_document_list.html.erb +18 -9
  18. data/app/views/govuk_publishing_components/components/_panel.html.erb +13 -11
  19. data/app/views/govuk_publishing_components/components/_radio.html.erb +3 -1
  20. data/app/views/govuk_publishing_components/components/_search.html.erb +6 -2
  21. data/app/views/govuk_publishing_components/components/docs/document_list.yml +18 -0
  22. data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +6 -6
  23. data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +6 -6
  24. data/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +8 -10
  25. data/config/locales/en.yml +18 -0
  26. data/lib/govuk_publishing_components/presenters/breadcrumb_selector.rb +5 -0
  27. data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_priority.rb +19 -5
  28. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +1 -1
  29. data/lib/govuk_publishing_components/version.rb +1 -1
  30. metadata +5 -3
  31. data/app/assets/javascripts/govuk_publishing_components/vendor/magna-charta.min.js +0 -4
@@ -2,12 +2,16 @@
2
2
  size ||= ""
3
3
  no_border ||= false
4
4
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
5
- classes = %w(gem-c-search gem-c-search--on-white)
5
+ classes = %w(gem-c-search)
6
6
  classes << (shared_helper.get_margin_top)
7
7
  classes << (shared_helper.get_margin_bottom) if local_assigns[:margin_bottom]
8
8
  classes << "gem-c-search--large" if size == 'large'
9
9
  classes << "gem-c-search--no-border" if no_border
10
- classes << "gem-c-search--on-govuk-blue" if local_assigns[:on_govuk_blue].eql?(true)
10
+ if local_assigns[:on_govuk_blue].eql?(true)
11
+ classes << "gem-c-search--on-govuk-blue"
12
+ else
13
+ classes << "gem-c-search--on-white"
14
+ end
11
15
  classes << "gem-c-search--separate-label" if local_assigns.include?(:inline_label)
12
16
 
13
17
  value ||= ""
@@ -262,3 +262,21 @@ examples:
262
262
  - link:
263
263
  text: 'Criteria'
264
264
  description: 'no url provided, just text'
265
+ with_locale_specified:
266
+ description: |
267
+ The component is used on translated pages that don’t have a translation for the document link text or the metadata. This means that it could display the fallback English string if the translate method can’t find an appropriate translation. This makes sure that the lang can be set to ensure that browsers understand which parts of the page are in each language.
268
+
269
+ Locales can be set separately for the document link text and individual metadata items. To set link text locale, pass a locale attribute along with the link object. To set metadata locale, pass a locale attribute containing a parallel object to your metadata (depending on which metadata have translations and which need a lang attribute to specify that they are in a different language).
270
+
271
+ The lang attribute must be set to a [valid BCP47 string](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang#Language_tag_syntax). A valid code can be the two or three letter language code - for example, English is en or eng, Korean is ko or kor - but if in doubt please check.
272
+ data:
273
+ items:
274
+ - link:
275
+ text: 'Tryloywder Uwch Staff Ysgrifennydd Gwladol Cymru Ionawr-Mawrth 2020'
276
+ path: '/government/publications/office-of-the-secretary-of-state-for-wales-senior-staff-transparency-january-march-2020'
277
+ locale: 'cy'
278
+ metadata:
279
+ public_updated_at: 2016-06-27 10:29:44
280
+ document_type: 'Data tryloywder'
281
+ locale:
282
+ document_type: 'cy'
@@ -10,7 +10,7 @@
10
10
  data-track-action="GOV.UK Close Form"
11
11
  aria-controls="something-is-wrong"
12
12
  aria-expanded="true"
13
- role="button">Close</a>
13
+ role="button"><%= t("components.feedback.close", default: "Close") %></a>
14
14
 
15
15
  <div class="govuk-grid-row">
16
16
  <div class="govuk-grid-column-two-thirds">
@@ -18,12 +18,12 @@
18
18
 
19
19
  <input type="hidden" name="url" value="<%= url_without_pii %>">
20
20
 
21
- <h3 class="gem-c-feedback__form-heading">Help us improve GOV.UK</h3>
22
- <p id="feedback_explanation" class="gem-c-feedback__form-paragraph">Don’t include personal or financial information like your National Insurance number or credit card details.</p>
21
+ <h3 class="gem-c-feedback__form-heading"><%= t("components.feedback.help_us_improve_govuk", default: "Help us improve GOV.UK") %></h3>
22
+ <p id="feedback_explanation" class="gem-c-feedback__form-paragraph"><%= t("components.feedback.dont_include_personal_info", default: "Don’t include personal or financial information like your National Insurance number or credit card details.") %></p>
23
23
 
24
24
  <%= render "govuk_publishing_components/components/input", {
25
25
  label: {
26
- text: "What were you doing?"
26
+ text: t("components.feedback.what_doing", default: "What were you doing?")
27
27
  },
28
28
  name: "what_doing",
29
29
  describedby: "feedback_explanation"
@@ -31,13 +31,13 @@
31
31
 
32
32
  <%= render "govuk_publishing_components/components/input", {
33
33
  label: {
34
- text: "What went wrong?"
34
+ text: t("components.feedback.what_wrong", default: "What went wrong?")
35
35
  },
36
36
  name: "what_wrong"
37
37
  } %>
38
38
 
39
39
  <%= render "govuk_publishing_components/components/button", {
40
- text: "Send"
40
+ text: t("components.feedback.send", default: "Send")
41
41
  } %>
42
42
  </div>
43
43
  </div>
@@ -10,7 +10,7 @@
10
10
  data-track-action="ffFormClose"
11
11
  aria-controls="page-is-not-useful"
12
12
  aria-expanded="true"
13
- role="button">Close</a>
13
+ role="button"><%= t("components.feedback.close", default: "Close") %></a>
14
14
 
15
15
  <div class="govuk-grid-row">
16
16
  <div class="govuk-grid-column-two-thirds" id="survey-wrapper">
@@ -19,12 +19,12 @@
19
19
  <input name="email_survey_signup[survey_id]" type="hidden" value="footer_satisfaction_survey">
20
20
  <input name="email_survey_signup[survey_source]" type="hidden" value="<%= path_without_pii %>">
21
21
 
22
- <h3 class="gem-c-feedback__form-heading">Help us improve GOV.UK</h3>
23
- <p id="survey_explanation" class="gem-c-feedback__form-paragraph">To help us improve GOV.UK, we’d like to know more about your visit today. We’ll send you a link to a feedback form. It will take only 2 minutes to fill in. Don’t worry we won’t send you spam or share your email address with anyone.</p>
22
+ <h3 class="gem-c-feedback__form-heading"><%= t("components.feedback.help_us_improve_govuk", default: "Help us improve GOV.UK") %></h3>
23
+ <p id="survey_explanation" class="gem-c-feedback__form-paragraph"><%= t("components.feedback.more_about_visit", default: "To help us improve GOV.UK, we’d like to know more about your visit today. We’ll send you a link to a feedback form. It will take only 2 minutes to fill in. Don’t worry we won’t send you spam or share your email address with anyone.") %></p>
24
24
 
25
25
  <%= render "govuk_publishing_components/components/input", {
26
26
  label: {
27
- text: "Email address"
27
+ text: t("components.feedback.email_address", default: "Email address")
28
28
  },
29
29
  name: "email_survey_signup[email_address]",
30
30
  type: "email",
@@ -32,8 +32,8 @@
32
32
  describedby: "survey_explanation"
33
33
  } %>
34
34
 
35
- <%= render "govuk_publishing_components/components/button", {
36
- text: "Send me the survey",
35
+ <%= render "govuk_publishing_components/components/button", {
36
+ text: t("components.feedback.send_me_survey", default: "Send me the survey"),
37
37
  } %>
38
38
  </div>
39
39
  </div>
@@ -4,9 +4,9 @@
4
4
 
5
5
  <div class="gem-c-feedback__prompt gem-c-feedback__js-show js-prompt" tabindex="-1">
6
6
  <div class="gem-c-feedback__prompt-questions js-prompt-questions">
7
- <h2 class="gem-c-feedback__prompt-question">Is this page useful?</h2>
7
+ <h2 class="gem-c-feedback__prompt-question"><%= t("components.feedback.is_this_page_useful", default: "Is this page useful?") %></h2>
8
8
  <!-- Maybe button exists only to try and capture clicks by bots -->
9
- <%= link_to contact_govuk_path, {
9
+ <%= link_to t("components.feedback.maybe", default: "Maybe"), contact_govuk_path, {
10
10
  class: 'gem-c-feedback__prompt-link',
11
11
  data: {
12
12
  'track-category' => 'yesNoFeedbackForm',
@@ -17,9 +17,7 @@
17
17
  style: 'display: none;',
18
18
  hidden: 'hidden',
19
19
  'aria-hidden': 'true',
20
- } do %>
21
- Maybe
22
- <% end %>
20
+ } %>
23
21
  <ul class="gem-c-feedback__option-list">
24
22
  <li class="gem-c-feedback__option-list-item">
25
23
  <%= link_to contact_govuk_path, {
@@ -31,7 +29,7 @@
31
29
  'aria-expanded': false,
32
30
  role: 'button',
33
31
  } do %>
34
- Yes <span class="govuk-visually-hidden">this page is useful</span>
32
+ <%= t("components.feedback.yes", default: "Yes") %> <span class="govuk-visually-hidden"><%= t("components.feedback.is_useful", default: "this page is useful") %></span>
35
33
  <% end %>
36
34
  </li>
37
35
  <li class="gem-c-feedback__option-list-item">
@@ -45,13 +43,13 @@
45
43
  'aria-expanded': false,
46
44
  role: 'button',
47
45
  } do %>
48
- No <span class="govuk-visually-hidden">this page is not useful</span>
46
+ <%= t("components.feedback.no", default: "No") %> <span class="govuk-visually-hidden"><%= t("components.feedback.is_not_useful", default: "this page is not useful") %></span>
49
47
  <% end %>
50
48
  </li>
51
49
  </ul>
52
50
  </div>
53
- <div class="gem-c-feedback__prompt-questions gem-c-feedback__prompt-success js-prompt-success js-hidden" tabindex="-1">
54
- Thank you for your feedback
51
+ <div class="gem-c-feedback__prompt-questions gem-c-feedback__prompt-success js-prompt-success js-hidden" role="alert">
52
+ <%= t("components.feedback.thank_you_for_feedback", default: "Thank you for your feedback") %>
55
53
  </div>
56
54
  <div class="gem-c-feedback__prompt-questions gem-c-feedback__prompt-questions--something-is-wrong js-prompt-questions">
57
55
  <%= link_to contact_govuk_path, {
@@ -64,7 +62,7 @@
64
62
  'aria-expanded': false,
65
63
  role: 'button',
66
64
  } do %>
67
- Is there anything wrong with this page?
65
+ <%= t("components.feedback.anything_wrong", default: "Is there anything wrong with this page?") %>
68
66
  <% end %>
69
67
  </div>
70
68
  </div>
@@ -36,6 +36,24 @@ en:
36
36
  or: 'or'
37
37
  contents_list:
38
38
  contents: Contents
39
+ feedback:
40
+ is_this_page_useful: "Is this page useful?"
41
+ yes: "Yes"
42
+ no: "No"
43
+ maybe: "Maybe"
44
+ is_useful: "this page is useful"
45
+ is_not_useful: "this page is not useful"
46
+ thank_you_for_feedback: "Thank you for your feedback"
47
+ anything_wrong: "Is there anything wrong with this page?"
48
+ close: "Close"
49
+ help_us_improve_govuk: "Help us improve GOV.UK"
50
+ more_about_visit: "To help us improve GOV.UK, we’d like to know more about your visit today. We’ll send you a link to a feedback form. It will take only 2 minutes to fill in. Don’t worry we won’t send you spam or share your email address with anyone."
51
+ dont_include_personal_info: "Don’t include personal or financial information like your National Insurance number or credit card details."
52
+ email_address: "Email address"
53
+ what_doing: "What were you doing?"
54
+ what_wrong: "What went wrong?"
55
+ send_me_survey: "Send me the survey"
56
+ send: "Send"
39
57
  organisation_schema:
40
58
  all_content_search_description: "Find all content from %{organisation}"
41
59
  radio:
@@ -18,6 +18,7 @@ module GovukPublishingComponents
18
18
  end
19
19
 
20
20
  def priority_breadcrumbs
21
+ return if hide_priority_breadcrumb?
21
22
  return parent_item_navigation.priority_breadcrumbs if content_item_navigation.html_publication_with_parent?
22
23
 
23
24
  content_item_navigation.priority_breadcrumbs
@@ -25,6 +26,10 @@ module GovukPublishingComponents
25
26
 
26
27
  private
27
28
 
29
+ def hide_priority_breadcrumb?
30
+ content_item_navigation.content_tagged_to_current_step_by_step? && content_item_navigation.tagged_to_brexit?
31
+ end
32
+
28
33
  def best_match_option
29
34
  return content_item_options unless content_item_navigation.html_publication_with_parent?
30
35
 
@@ -12,18 +12,22 @@ module GovukPublishingComponents
12
12
  }.freeze
13
13
 
14
14
  # Returns the highest priority taxon that has a content_id matching those in PRIORITY_TAXONS
15
- def self.call(content_item)
16
- new(content_item).breadcrumbs
15
+ def self.call(content_item, query_parameters = nil)
16
+ new(content_item, query_parameters).breadcrumbs
17
17
  end
18
18
 
19
- attr_reader :content_item
19
+ attr_reader :content_item, :query_parameters
20
20
 
21
- def initialize(content_item)
21
+ def initialize(content_item, query_parameters = nil)
22
22
  @content_item = content_item
23
+ @query_parameters = query_parameters
23
24
  end
24
25
 
25
26
  def taxon
26
- @taxon ||= priority_taxons.min_by { |t| PRIORITY_TAXONS.values.index(t["content_id"]) }
27
+ @taxon ||= begin
28
+ default_taxon = priority_taxons.min_by { |t| PRIORITY_TAXONS.values.index(t["content_id"]) }
29
+ preferred_taxon || default_taxon
30
+ end
27
31
  end
28
32
 
29
33
  def breadcrumbs
@@ -39,6 +43,12 @@ module GovukPublishingComponents
39
43
 
40
44
  private
41
45
 
46
+ def preferred_taxon
47
+ if preferred_priority_taxon
48
+ priority_taxons.find { |t| t["content_id"] == preferred_priority_taxon }
49
+ end
50
+ end
51
+
42
52
  def priority_taxons
43
53
  return [] unless content_item["links"].is_a?(Hash)
44
54
 
@@ -57,6 +67,10 @@ module GovukPublishingComponents
57
67
  def priority_taxon?(taxon)
58
68
  PRIORITY_TAXONS.values.include?(taxon["content_id"])
59
69
  end
70
+
71
+ def preferred_priority_taxon
72
+ query_parameters["priority-taxon"] if query_parameters
73
+ end
60
74
  end
61
75
  end
62
76
  end
@@ -30,7 +30,7 @@ module GovukPublishingComponents
30
30
  end
31
31
 
32
32
  def priority_breadcrumbs
33
- @priority_breadcrumbs ||= ContentBreadcrumbsBasedOnPriority.call(content_item)
33
+ @priority_breadcrumbs ||= ContentBreadcrumbsBasedOnPriority.call(content_item, query_parameters)
34
34
  end
35
35
 
36
36
  def topic_breadcrumbs
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "21.62.0".freeze
2
+ VERSION = "21.64.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 21.62.0
4
+ version: 21.64.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-20 00:00:00.000000000 Z
11
+ date: 2020-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -419,6 +419,7 @@ files:
419
419
  - app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js
420
420
  - app/assets/javascripts/govuk_publishing_components/lib/current-location.js
421
421
  - app/assets/javascripts/govuk_publishing_components/lib/govspeak/barchart-enhancement.js
422
+ - app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js
422
423
  - app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js
423
424
  - app/assets/javascripts/govuk_publishing_components/lib/header-navigation.js
424
425
  - app/assets/javascripts/govuk_publishing_components/lib/primary-links.js
@@ -428,8 +429,9 @@ files:
428
429
  - app/assets/javascripts/govuk_publishing_components/modules.js
429
430
  - app/assets/javascripts/govuk_publishing_components/vendor/html5shiv-printshiv.js
430
431
  - app/assets/javascripts/govuk_publishing_components/vendor/json2.js
431
- - app/assets/javascripts/govuk_publishing_components/vendor/magna-charta.min.js
432
432
  - app/assets/javascripts/govuk_publishing_components/vendor/modernizr.js
433
+ - app/assets/javascripts/govuk_publishing_components/vendor/polyfills/closest.js
434
+ - app/assets/javascripts/govuk_publishing_components/vendor/polyfills/indexOf.js
433
435
  - app/assets/stylesheets/component_guide/application.scss
434
436
  - app/assets/stylesheets/component_guide/print.scss
435
437
  - app/assets/stylesheets/govuk_publishing_components/_all_components.scss
@@ -1,4 +0,0 @@
1
- /*! Magna Charta - v3.0.0 - 2012-12-04
2
- * https://github.com/alphagov/magna-charta
3
- */
4
- (function(e){var t=function(){this.init=function(t,n){var r={outOf:65,applyOnInit:!0,toggleText:"Toggle between chart and table",autoOutdent:!1,outdentAll:!1};this.options=e.extend({},r,n);var i=function(){var e,t=3,n=document.createElement("div"),r=n.getElementsByTagName("i");do n.innerHTML="<!--[if gt IE "+ ++t+"]><i></i><![endif]-->";while(t<10&&r[0]);return t>4?t:e}();return this.ENABLED=!(i&&i<8),this.$table=t,this.$graph=e("<div/>").attr("aria-hidden","true"),this.$graph.attr("class",this.$table.attr("class")).addClass("mc-chart"),this.options.stacked=this.$table.hasClass("mc-stacked"),this.options.negative=this.$table.hasClass("mc-negative"),this.options.multiple=!this.options.stacked&&(this.$table.hasClass("mc-multiple")||this.$table.find("tbody tr").first().find("td").length>2),this.options.autoOutdent=this.options.autoOutdent||this.$table.hasClass("mc-auto-outdent"),this.options.outdentAll=this.options.outdentAll||this.$table.hasClass("mc-outdented"),this.options.multiple&&this.$graph.addClass("mc-multiple"),this.options.hasCaption=!!this.$table.find("caption").length,this.ENABLED&&(this.apply(),this.options.applyOnInit||this.toggle()),this}};t.prototype.construct={},t.prototype.construct.thead=function(){var t=e("<div />",{"class":"mc-thead"}),n=e("<div />",{"class":"mc-tr"}),r="";return this.$table.find("th").each(function(t,n){r+='<div class="mc-th">',r+=e(n).html(),r+="</div>"}),n.append(r),t.append(n),t},t.prototype.construct.tbody=function(){var t=e("<div />",{"class":"mc-tbody"}),n="";return this.$table.find("tbody tr").each(function(n,r){var i=e("<div />",{"class":"mc-tr"}),s="";e(r).find("td").each(function(t,n){s+='<div class="mc-td">',s+=e(n).html(),s+="</div>"}),i.append(s),t.append(i)}),t},t.prototype.construct.caption=function(){var e=this.$table.find("caption");return e.clone()},t.prototype.construct.toggleLink=function(){var t=this;return e("<a />",{href:"#","class":"mc-toggle-link",text:this.options.toggleText}).on("click",function(e){t.toggle(e)})},t.prototype.constructChart=function(){var e=this.construct.thead.call(this),t=this.construct.tbody.call(this),n=this.construct.toggleLink.call(this);if(this.options.hasCaption){var r=this.construct.caption.call(this);this.$graph.append(r)}this.$table.before(n),this.$graph.append(e),this.$graph.append(t)},t.prototype.apply=function(){this.ENABLED&&(this.constructChart(),this.addClassesToHeader(),this.calculateMaxWidth(),this.applyWidths(),this.insert(),this.$table.addClass("visually-hidden"),this.applyOutdent())},t.prototype.toggle=function(e){this.$graph.toggle(),this.$table.toggleClass("visually-hidden"),e&&e.preventDefault()},t.prototype.utils={isFloat:function(e){return!isNaN(parseFloat(e))},stripValue:function(e){var t=new RegExp("\\,|£|%|[a-z]","gi");return e.replace(t,"")},returnMax:function(e){var t=0;for(var n=0;n<e.length;n++)e[n]>t&&(t=e[n]);return t},isNegative:function(e){return e<0}},t.prototype.addClassesToHeader=function(){var t=this.$graph.find(".mc-th").filter(":not(:first)");this.options.stacked&&(t.last().addClass("mc-stacked-header mc-header-total"),t=t.filter(":not(:last)")),t.addClass("mc-key-header").filter(":not(.mc-stacked-header)").each(function(t,n){e(n).addClass("mc-key-"+(t+1))})},t.prototype.calculateMaxWidth=function(){var t=this,n=[],r=0;this.$graph.find(".mc-tr").each(function(i,s){var o=e(s),u=o.find(".mc-td:not(:first)");if(t.options.stacked){var a=u.last().addClass("mc-stacked-total");u=u.filter(":not(:last)")}o.find(".mc-td:first").addClass("mc-key-cell");var f=0;u.each(function(i,s){var o=e(s).addClass("mc-bar-cell").addClass("mc-bar-"+(i+1)),u=t.utils.stripValue(o.text());if(t.utils.isFloat(u)){var a=parseFloat(u,10),l=Math.abs(a);a===0&&o.addClass("mc-bar-zero"),t.options.negative&&(t.utils.isNegative(a)?(o.addClass("mc-bar-negative"),l>r&&(r=l)):o.addClass("mc-bar-positive")),a=l,t.options.stacked?f+=a:(f=a,n.push(a))}}),t.options.stacked&&n.push(f)});var i={};return i.max=parseFloat(t.utils.returnMax(n),10),i.single=parseFloat(this.options.outOf/i.max,10),this.options.negative&&(i.marginLeft=parseFloat(r,10)*i.single,i.maxNegative=parseFloat(r,10)),i},t.prototype.applyWidths=function(){this.dimensions=this.calculateMaxWidth();var t=this;this.$graph.find(".mc-tr").each(function(n,r){var i=e(r),s=i.find(".mc-bar-cell:not(.mc-bar-zero)").length;i.find(".mc-bar-cell").each(function(n,r){var i=e(r),s=parseFloat(t.utils.stripValue(i.text()),10),o=s*t.dimensions.single,u=Math.abs(s),a=Math.abs(o);if(t.options.negative)if(i.hasClass("mc-bar-positive"))i.css("margin-left",t.dimensions.marginLeft+"%");else if(u<t.dimensions.maxNegative){var f=(t.dimensions.maxNegative-u)*t.dimensions.single;i.css("margin-left",f+"%")}i.wrapInner("<span />"),i.css("width",a+"%")})})},t.prototype.insert=function(){this.$table.after(this.$graph)},t.prototype.applyOutdent=function(){var t=this,n=this.$graph.find(".mc-bar-cell");this.$graph.find(".mc-bar-cell").each(function(n,r){var i=e(r),s=parseFloat(t.utils.stripValue(i.text()),10),o=i.children("span"),u=o.width()+10,a=i.width(),f=parseFloat(i[0].style.width,10),l=i.height();t.options.stacked?u>a&&s>0&&i.addClass("mc-value-overflow"):(s===0&&i.addClass("mc-bar-outdented"),t.options.autoOutdent&&u>a||t.options.outdentAll?(i.addClass("mc-bar-outdented"),o.css({"margin-left":"100%",display:"inline-block"})):i.addClass("mc-bar-indented"))})},e.magnaCharta=function(e,n){return(new t).init(e,n)}})(jQuery);