[Git][noosfero/noosfero][master-1.x] 2 commits: custom-forms: add alternative preselected option on polls

Gabriel Silva gitlab at mg.gitlab.com
Thu May 10 16:30:41 BRT 2018


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


Commits:
cc03dd24 by Rodrigo Souto at 2018-05-09T21:07:35Z
custom-forms: add alternative preselected option on polls

- - - - -
62b36fa3 by Gabriel Silva at 2018-05-10T19:30:35Z
Merge branch 'poll-preselected-alternative-option' into 'master-1.x'

custom-forms: add alternative preselected option on polls

See merge request noosfero/noosfero!1473
- - - - -


2 changed files:

- plugins/custom_forms/public/style.scss
- plugins/custom_forms/views/custom_forms_plugin_myprofile/_poll.html.erb


Changes:

=====================================
plugins/custom_forms/public/style.scss
=====================================
--- a/plugins/custom_forms/public/style.scss
+++ b/plugins/custom_forms/public/style.scss
@@ -208,13 +208,18 @@ tr.addition-buttons {
 }
 
 .poll-option {
-  width: 75%;
+  width: 50%;
   padding-left: 0px;
 }
 
+.poll-preselected {
+  text-align: center;
+  width: 20%;
+}
+
 .poll-remove {
   text-align: center;
-  width: 15%;
+  width: 20%;
 }
 
 .poll-type-icon {


=====================================
plugins/custom_forms/views/custom_forms_plugin_myprofile/_poll.html.erb
=====================================
--- a/plugins/custom_forms/views/custom_forms_plugin_myprofile/_poll.html.erb
+++ b/plugins/custom_forms/views/custom_forms_plugin_myprofile/_poll.html.erb
@@ -25,6 +25,7 @@
       <tr>
         <th class="poll-type"><%= _('Type') %></th>
         <th class="poll-option"><%= _('Option') %></th>
+        <th class="poll-preselected"><%= _('Preselected') %></th>
         <th class="poll-remove"><%= _('Remove') %></th>
       </tr>
     </thead>
@@ -38,6 +39,9 @@
             <%= alternative.text_field(:label, placeholder: _('Add option'), class: 'poll-option-input', 'data-default-placeholder' => _('Option')) %>
             <%= alternative.hidden_field(:position) %>
           </td>
+          <td class="poll-preselected">
+            <%= alternative.check_box(:selected_by_default) %>
+          </td>
           <td class="poll-remove">
             <%= button_without_text :remove, _('Remove field'), '#', class: 'remove-poll-option' %>
             <%= alternative.hidden_field :_destroy, :class => 'destroy-field' %>
@@ -52,6 +56,9 @@
           <%= text_field_tag("form[fields_attributes][0][alternatives_attributes][#{field.alternatives.size}][label]", '', placeholder: _('Add option'), class: 'poll-option-input', 'data-default-placeholder' => _('Option')) %>
           <%= hidden_field_tag("form[fields_attributes][0][alternatives_attributes][#{field.alternatives.size}][position]", field.alternatives.size, class: 'poll-option-position') %>
         </td>
+        <td class="poll-preselected">
+          <%= check_box_tag("form[fields_attributes][0][alternatives_attributes][#{field.alternatives.size}][selected_by_default]", '1', false) %>
+        </td>
         <td class="poll-remove">
           <%= button_without_text :remove, _('Remove field'), '#', class: 'remove-poll-option' %>
         </td>



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/612120166997945fb84343f1566cf112d5d311da...62b36fa3103093ae6f0b17c63e85266e4dc816f2

-- 
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/612120166997945fb84343f1566cf112d5d311da...62b36fa3103093ae6f0b17c63e85266e4dc816f2
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/1a21b4fd/attachment-0001.html>


More information about the Noosfero-dev mailing list