[Git][noosfero/noosfero][master] 4 commits: access: add profile access view models

Rodrigo Souto gitlab at mg.gitlab.com
Mon Sep 3 10:17:13 BRT 2018


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
98b80b4f by Rodrigo Souto at 2018-09-03T12:51:34Z
access: add profile access view models

- - - - -
08cb05c8 by Rodrigo Souto at 2018-09-03T13:01:24Z
custom-forms: remove rubyzip from Gemfile due to core inclusion of it

- - - - -
1c0a9979 by Rodrigo Souto at 2018-09-03T13:15:30Z
custom-forms: avoid crash on migration due to empty string value

- - - - -
b8bebbeb by Rodrigo Souto at 2018-09-03T13:16:57Z
custom-forms: fix graph script to EC5

- - - - -


5 changed files:

- + app/models/profile_access_friendship.rb
- + app/models/profile_access_membership.rb
- plugins/custom_forms/Gemfile
- plugins/custom_forms/db/migrate/20180815152844_add_form_answers_on_old_answers.rb
- plugins/custom_forms/public/javascripts/graph.js


Changes:

=====================================
app/models/profile_access_friendship.rb
=====================================
@@ -0,0 +1,11 @@
+class ProfileAccessFriendship < ActiveRecord::Base
+  def readonly
+    true
+  end
+
+  def self.refresh
+    Scenic.database.refresh_materialized_view(table_name,
+                                              concurrently: false,
+                                              cascade: false)
+  end
+end


=====================================
app/models/profile_access_membership.rb
=====================================
@@ -0,0 +1,11 @@
+class ProfileAccessMembership < ActiveRecord::Base
+  def readonly
+    true
+  end
+
+  def self.refresh
+    Scenic.database.refresh_materialized_view(table_name,
+                                              concurrently: false,
+                                              cascade: false)
+  end
+end


=====================================
plugins/custom_forms/Gemfile
=====================================
@@ -1,4 +1,3 @@
 source 'https://rubygems.org'
 
 gem 'chartkick', '~> 2.3.5'
-gem 'rubyzip', '~> 1.2.0'


=====================================
plugins/custom_forms/db/migrate/20180815152844_add_form_answers_on_old_answers.rb
=====================================
@@ -9,7 +9,7 @@ class AddFormAnswersOnOldAnswers < ActiveRecord::Migration
       INNER JOIN custom_forms_plugin_fields AS f ON a.field_id = f.id
       LEFT JOIN custom_forms_plugin_form_answers AS fa ON fa.answer_id = a.id
       INNER JOIN custom_forms_plugin_alternatives AS al ON al.id IN
-      (SELECT regexp_split_to_table(a.value, ',')::int) WHERE fa.id IS NULL 
+      (SELECT regexp_split_to_table(nullif(a.value, ''), ',')::int) WHERE fa.id IS NULL 
       AND f.type = 'CustomFormsPlugin::SelectField';"
     )
 


=====================================
plugins/custom_forms/public/javascripts/graph.js
=====================================
@@ -20,9 +20,9 @@
 
   function legend(chart, chartIndex) {
     var legendItems = chart.chart.legend.legendItems;
-    let html = ``;
+    var html = '';
     for (item in legendItems) {
-      var legend_text = `<div style="display: flex; margin: unset; margin-right: 5px; margin-bottom: 5px;"><div style="width: 10px; height: 10px; background: ${legendItems[item].fillStyle}; margin-right: 5px;"></div><span style="width: 130px; display: inline-block; font-size: 11px;">${legendItems[item].text} </span></div>`
+      var legend_text = '<div style="display: flex; margin: unset; margin-right: 5px; margin-bottom: 5px;"><div style="width: 10px; height: 10px; background: ${legendItems[item].fillStyle}; margin-right: 5px;"></div><span style="width: 130px; display: inline-block; font-size: 11px;">' + legendItems[item].text + '</span></div>'
       html += legend_text;
     }
     document.getElementById("legend-" + chartIndex).innerHTML = html;
@@ -38,24 +38,24 @@
           total += context.dataset.data[i];
         }
         var tooltipPercentage = Math.round((value / total) * 100);
-  
-        return `${tooltipPercentage}%`;
+
+        return tooltipPercentage + '%';
       };
-  
+
       Chart.defaults.global.plugins.datalabels.display = function (context) {
-        return context.dataset.data[context.dataIndex] !== 0;  
+        return context.dataset.data[context.dataIndex] !== 0;
       }
-  
+
       const charts = Chartkick.charts;
       const chartPrefix = "chart-";
       var chartIndex = 1;
-  
+
       while (true){
         var chart = charts[chartPrefix + chartIndex];
         legend(chart, chartIndex);
         if (typeof chart == "undefined")
           break;
-  
+
         var graph = chart.getChartObject();
         if (graph.config.type == 'pie' || graph.config.type == 'bar') {
           chart.redraw();



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/9336954eb7bee20b2969a1ddc6e7ac6b69f3d8af...b8bebbeb7ea9a43803aaec582f7d204cc24c0c10

-- 
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/9336954eb7bee20b2969a1ddc6e7ac6b69f3d8af...b8bebbeb7ea9a43803aaec582f7d204cc24c0c10
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/20180903/8b5477b3/attachment-0001.html>


More information about the Noosfero-dev mailing list