Skip to content

Change surveys public page and use TOS#1410

Merged
beagleknight merged 6 commits intofeature/surveysfrom
feature/surveys-public-page
May 31, 2017
Merged

Change surveys public page and use TOS#1410
beagleknight merged 6 commits intofeature/surveysfrom
feature/surveys-public-page

Conversation

@beagleknight
Copy link
Copy Markdown
Contributor

@beagleknight beagleknight commented May 29, 2017

🎩 What? Why?

I used survey's TOS and fix a few issues of the public survey form. I also changed some styles.

📌 Related Issues

📋 Subtasks

  • Use better style for the public page
  • Use TOS
  • Fix tests
  • Fix some weird paddings/margins

📷 Screenshots (optional)

image

👻 GIF

@beagleknight beagleknight changed the base branch from master to feature/surveys May 29, 2017 14:37
@beagleknight beagleknight force-pushed the feature/surveys-public-page branch from 770aad2 to 1ef26f8 Compare May 29, 2017 14:41
@codecov
Copy link
Copy Markdown

codecov bot commented May 29, 2017

Codecov Report

Merging #1410 into feature/surveys will decrease coverage by 27.05%.
The diff coverage is n/a.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           feature/surveys   #1410       +/-   ##
===================================================
- Coverage            94.86%   67.8%   -27.06%     
===================================================
  Files                  444      62      -382     
  Lines                 7554     966     -6588     
===================================================
- Hits                  7166     655     -6511     
+ Misses                 388     311       -77
Impacted Files Coverage Δ
...n/app/models/decidim/admin/abilities/admin_user.rb 21.42% <0%> (-78.58%) ⬇️
...mments/lib/decidim/comments/mutation_extensions.rb 25% <0%> (-75%) ⬇️
...-comments/lib/decidim/comments/query_extensions.rb 36.36% <0%> (-63.64%) ⬇️
...im-proposals/lib/decidim/proposals/admin_engine.rb 50% <0%> (-50%) ⬇️
decidim-surveys/lib/decidim/surveys/engine.rb 50% <0%> (-50%) ⬇️
decidim-core/lib/decidim/stats_registry.rb 51.35% <0%> (-48.65%) ⬇️
decidim-budgets/lib/decidim/budgets/list_engine.rb 53.33% <0%> (-46.67%) ⬇️
decidim-proposals/lib/decidim/proposals/engine.rb 56.25% <0%> (-43.75%) ⬇️
...dim-core/lib/decidim/features/settings_manifest.rb 51.28% <0%> (-43.59%) ⬇️
...ecidim-surveys/lib/decidim/surveys/admin_engine.rb 62.5% <0%> (-37.5%) ⬇️
... and 396 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d660080...1ef26f8. Read the comment docs.

@codecov
Copy link
Copy Markdown

codecov bot commented May 29, 2017

Codecov Report

Merging #1410 into feature/surveys will increase coverage by <.01%.
The diff coverage is 100%.

@@                 Coverage Diff                 @@
##           feature/surveys    #1410      +/-   ##
===================================================
+ Coverage            94.89%   94.89%   +<.01%     
===================================================
  Files                  445      445              
  Lines                 7593     7599       +6     
===================================================
+ Hits                  7205     7211       +6     
  Misses                 388      388

@beagleknight beagleknight changed the title Feature/surveys public page Change surveys public page and use TOC May 29, 2017
@beagleknight beagleknight mentioned this pull request May 29, 2017
8 tasks
@beagleknight beagleknight self-assigned this May 29, 2017
@josepjaume
Copy link
Copy Markdown
Contributor

Careful with the margins and paddings, especially on the bottom part (the disclaimer)

@beagleknight
Copy link
Copy Markdown
Contributor Author

@josepjaume Yeah! I'll fix it but we have the same problem in decidim-hospitalet :(

@beagleknight beagleknight force-pushed the feature/surveys-public-page branch 2 times, most recently from 3a57a3b to 14e5bb2 Compare May 30, 2017 13:01
@beagleknight beagleknight force-pushed the feature/surveys-public-page branch from 14e5bb2 to 7a9a741 Compare May 30, 2017 13:06
@mention-bot
Copy link
Copy Markdown

@beagleknight, thanks for your PR! By analyzing the history of the files in this pull request, we identified @mrcasals and @oriolgual to be potential reviewers.

end

def body_not_blank
errors.add("body", :blank) if body.all?(&:blank?)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be any??

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm no. Since body is an array it prevents submitting this [""].

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm missing something, why is body an array? What I meant is that if any element of the array is blank we should fail.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The body is an array because the user can choose multiple answers like: ["Answer A", "Answer B"]. I'm using the same field to store single answer questions as well so if the user doesn't fill in the answer it sends [""] to the server.

title: Answer the survey
are_you_sure: This action cannot be undone and you will not be able to edit
your answers. Are you sure?
authorize_toc: Authorize toc
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This text is confusing

@beagleknight beagleknight changed the title Change surveys public page and use TOC Change surveys public page and use TOS May 30, 2017
oriolgual
oriolgual previously approved these changes May 31, 2017
# locale - the ID of the locale to check
def have_i18n_content(field, locale: I18n.locale)
have_content(stripped(translated(field, locale: locale)))
# upcase - a boolean to indicate wether the string must be checked upcased or not.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to change this to "whether"...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xDDDDDDDDDDD

<div class="callout success">
<h5><%= t('.survey_answered.title') %></h5>
<p><%= t('.survey_answered.body') %></p>
<% else %>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate these unless ... else ..., I feels it's hard to grasp the logic. Can you switch the order of the blocks?

if survey.published?
  <the part below>
else
  <the part above

You can do this in another PR

@beagleknight beagleknight merged commit 349f400 into feature/surveys May 31, 2017
@beagleknight beagleknight deleted the feature/surveys-public-page branch May 31, 2017 08:09
@oriolgual oriolgual restored the feature/surveys-public-page branch May 31, 2017 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants