[Git][noosfero/noosfero][master-1.x] 2 commits: custom-forms: truncate big legends on graph

Gabriel Silva gitlab at mg.gitlab.com
Thu May 10 10:33:58 BRT 2018


Gabriel Silva pushed to branch master-1.x at Noosfero / noosfero


Commits:
cf6794c7 by Rodrigo Souto at 2018-05-04T14:44:37Z
custom-forms: truncate big legends on graph

- - - - -
35f6faa2 by Gabriel Silva at 2018-05-10T13:33:34Z
Merge branch 'graph-big-legends' into 'master-1.x'

custom-forms: truncate big legends on graph

See merge request noosfero/noosfero!1457
- - - - -


2 changed files:

- plugins/custom_forms/lib/custom_forms_plugin/graph.rb
- plugins/custom_forms/views/custom_forms_plugin_profile/_pizza.html.erb


Changes:

=====================================
plugins/custom_forms/lib/custom_forms_plugin/graph.rb
=====================================
--- a/plugins/custom_forms/lib/custom_forms_plugin/graph.rb
+++ b/plugins/custom_forms/lib/custom_forms_plugin/graph.rb
@@ -64,7 +64,9 @@ class CustomFormsPlugin::Graph
     end
 
     alternatives.map do |alternative|
-      answer_and_label.merge!({alternative.id.to_s => {alternative.label => 0}})
+      label = alternative.label
+      short_label = label.present? && label.length > 70 ? label[0..70] + '...' : label
+      answer_and_label.merge!({alternative.id.to_s => {short_label => 0}})
     end
     answer_and_label.merge!({ "show_as" => field.show_as,
                               "summary" => field.summary,


=====================================
plugins/custom_forms/views/custom_forms_plugin_profile/_pizza.html.erb
=====================================
--- a/plugins/custom_forms/views/custom_forms_plugin_profile/_pizza.html.erb
+++ b/plugins/custom_forms/views/custom_forms_plugin_profile/_pizza.html.erb
@@ -4,5 +4,5 @@
 
 <%= render partial: 'results_table', locals: { result: result } %>
 
-<%= pie_chart result["data"], donut: true, legend: 'left',
+<%= pie_chart result["data"], donut: true, legend: 'bottom',
               summary: (result['summary'] if current_person.try(:can_see_summary?, profile)) %>



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/523b2e8a9da79c6797106e88f1fe3ce0e4f5c762...35f6faa217bc0d0df9ad410882db62269450965c

-- 
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/523b2e8a9da79c6797106e88f1fe3ce0e4f5c762...35f6faa217bc0d0df9ad410882db62269450965c
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180510/41d843f5/attachment-0001.html>


More information about the Noosfero-dev mailing list