Merge branch 'master' into 1856-legislation_processes_proposals_phase

This commit is contained in:
decabeza
2017-10-25 11:52:31 +02:00
186 changed files with 3595 additions and 1550 deletions

View File

@@ -1,12 +1,12 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-07-07 21:23:30 +0200 using RuboCop version 0.49.1.
# on 2017-10-17 22:05:23 +0200 using RuboCop version 0.49.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 45
# Offense count: 40
# Cop supports --auto-correct.
# Configuration parameters: EnforcedHashRocketStyle, SupportedHashRocketStyles, EnforcedColonStyle, SupportedColonStyles, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
# SupportedHashRocketStyles: key, separator, table
@@ -14,11 +14,10 @@
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
Layout/AlignHash:
Exclude:
- 'app/controllers/officing/results_controller.rb'
- 'spec/controllers/legislation/annotations_controller_spec.rb'
- 'spec/features/admin/banners_spec.rb'
# Offense count: 50
# Offense count: 52
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: with_first_parameter, with_fixed_indentation
@@ -33,7 +32,7 @@ Layout/ClosingParenthesisIndentation:
- 'spec/models/legislation/annotation_spec.rb'
- 'spec/rails_helper.rb'
# Offense count: 51
# Offense count: 37
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: leading, trailing
@@ -68,11 +67,10 @@ Layout/EmptyLines:
Exclude:
- 'app/controllers/admin/budget_investment_milestones_controller.rb'
# Offense count: 2
# Offense count: 1
# Cop supports --auto-correct.
Layout/EmptyLinesAroundMethodBody:
Exclude:
- 'app/models/abilities/administrator.rb'
- 'lib/graph_ql/api_types_creator.rb'
# Offense count: 2
@@ -126,13 +124,13 @@ Layout/IndentationConsistency:
- 'spec/models/legislation/draft_version_spec.rb'
- 'spec/models/proposal_spec.rb'
# Offense count: 23
# Offense count: 48
# Cop supports --auto-correct.
# Configuration parameters: Width, IgnoredPatterns.
Layout/IndentationWidth:
Enabled: false
# Offense count: 7
# Offense count: 6
# Cop supports --auto-correct.
Layout/LeadingCommentSpace:
Exclude:
@@ -140,7 +138,6 @@ Layout/LeadingCommentSpace:
- 'app/controllers/budgets/ballot/lines_controller.rb'
- 'spec/features/budgets/ballots_spec.rb'
- 'spec/features/comments/poll_questions_spec.rb'
- 'spec/features/officing/voters_spec.rb'
- 'spec/support/common_actions.rb'
# Offense count: 3
@@ -181,7 +178,7 @@ Layout/MultilineMethodCallBraceLayout:
- 'spec/models/legislation/annotation_spec.rb'
- 'spec/rails_helper.rb'
# Offense count: 71
# Offense count: 59
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: aligned, indented, indented_relative_to_receiver
@@ -201,7 +198,7 @@ Layout/MultilineMethodCallIndentation:
- 'spec/models/proposal_spec.rb'
- 'spec/models/user_spec.rb'
# Offense count: 8
# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: aligned, indented
@@ -264,29 +261,11 @@ Lint/LiteralInCondition:
Exclude:
- 'app/models/budget/investment.rb'
# Offense count: 51
Lint/ParenthesesAsGroupedExpression:
Exclude:
- 'spec/factories.rb'
- 'spec/features/admin/organizations_spec.rb'
- 'spec/features/budgets/investments_spec.rb'
- 'spec/features/campaigns_spec.rb'
- 'spec/features/debates_spec.rb'
- 'spec/features/management/managed_users_spec.rb'
- 'spec/features/management/proposals_spec.rb'
- 'spec/features/management/spending_proposals_spec.rb'
- 'spec/features/management/users_spec.rb'
- 'spec/features/proposals_spec.rb'
- 'spec/models/debate_spec.rb'
# Offense count: 13
# Offense count: 3
# Cop supports --auto-correct.
Lint/StringConversionInInterpolation:
Exclude:
- 'app/models/poll/null_result.rb'
- 'app/models/poll/partial_result.rb'
- 'app/models/poll/white_result.rb'
- 'app/models/poll/total_result.rb'
# Offense count: 15
# Cop supports --auto-correct.
@@ -311,7 +290,7 @@ Lint/UnusedMethodArgument:
- 'app/mailers/mailer.rb'
- 'app/models/abilities/everyone.rb'
# Offense count: 278
# Offense count: 325
Lint/UselessAssignment:
Enabled: false
@@ -320,35 +299,46 @@ Lint/Void:
Exclude:
- 'app/controllers/polls_controller.rb'
# Offense count: 74
# Offense count: 86
Metrics/AbcSize:
Max: 54
Max: 64
# Offense count: 454
# Offense count: 487
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/BlockLength:
Max: 1071
# Offense count: 8
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 256
Max: 1227
# Offense count: 10
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 262
# Offense count: 13
Metrics/CyclomaticComplexity:
Max: 10
# Offense count: 53
# Offense count: 25
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 248
# Offense count: 67
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 49
Max: 56
# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ModuleLength:
Max: 214
Max: 242
# Offense count: 7
# Offense count: 3
# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
Max: 7
# Offense count: 8
Metrics/PerceivedComplexity:
Max: 11
@@ -402,20 +392,20 @@ Rails/HttpPositionalArguments:
- 'spec/controllers/pages_controller_spec.rb'
- 'spec/controllers/users/registrations_controller_spec.rb'
# Offense count: 20
# Offense count: 18
Rails/OutputSafety:
Exclude:
- 'app/controllers/admin/legislation/draft_versions_controller.rb'
- 'app/controllers/admin/legislation/processes_controller.rb'
- 'app/controllers/admin/legislation/questions_controller.rb'
- 'app/controllers/budgets/investments_controller.rb'
- 'app/controllers/direct_uploads_controller.rb'
- 'app/controllers/spending_proposals_controller.rb'
- 'app/helpers/application_helper.rb'
- 'app/helpers/text_with_links_helper.rb'
- 'app/helpers/users_helper.rb'
- 'app/helpers/valuation_helper.rb'
# Offense count: 70
# Offense count: 71
# Configuration parameters: Blacklist.
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
Rails/SkipsModelValidations:
@@ -431,7 +421,7 @@ Style/AccessorMethodName:
- 'app/controllers/proposals_controller.rb'
- 'lib/merged_comment_tree.rb'
# Offense count: 1
# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: braces, no_braces, context_dependent
@@ -441,7 +431,7 @@ Style/BracesAroundHashParameters:
- 'spec/features/budgets/investments_spec.rb'
- 'spec/features/proposals_spec.rb'
# Offense count: 119
# Offense count: 123
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
@@ -454,14 +444,13 @@ Style/ClassVars:
- 'app/models/organization.rb'
- 'app/models/user.rb'
# Offense count: 12
# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly, IncludeTernaryExpressions.
# SupportedStyles: assign_to_condition, assign_inside_condition
Style/ConditionalAssignment:
Exclude:
- 'app/controllers/admin/poll/booth_assignments_controller.rb'
- 'app/controllers/admin/poll/officer_assignments_controller.rb'
- 'app/controllers/admin/poll/questions_controller.rb'
- 'app/controllers/comments_controller.rb'
- 'app/controllers/management/spending_proposals_controller.rb'
@@ -487,7 +476,7 @@ Style/FileName:
Style/GuardClause:
Enabled: false
# Offense count: 12
# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: MaxLineLength.
Style/IfUnlessModifier:
@@ -498,19 +487,19 @@ Style/IfUnlessModifier:
- 'app/controllers/legislation/annotations_controller.rb'
- 'app/controllers/valuation/budget_investments_controller.rb'
- 'app/controllers/verification/letter_controller.rb'
- 'app/controllers/welcome_controller.rb'
- 'app/helpers/embed_videos_helper.rb'
- 'app/mailers/mailer.rb'
- 'app/models/proposal.rb'
- 'app/models/spending_proposal.rb'
# Offense count: 4
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: line_count_dependent, lambda, literal
Style/Lambda:
Exclude:
- 'app/models/comment.rb'
- 'app/models/concerns/followable.rb'
- 'app/models/direct_message.rb'
- 'app/models/vote.rb'
- 'lib/graph_ql/api_types_creator.rb'
@@ -526,17 +515,14 @@ Style/MultilineIfThen:
Exclude:
- 'app/controllers/management/users_controller.rb'
# Offense count: 15
# Offense count: 13
# Cop supports --auto-correct.
Style/MutableConstant:
Exclude:
- 'app/models/activity.rb'
- 'app/models/budget/reclassified_vote.rb'
- 'app/models/legislation/draft_version.rb'
- 'app/models/poll/null_result.rb'
- 'app/models/poll/partial_result.rb'
- 'app/models/poll/white_result.rb'
- 'app/models/poll/total_result.rb'
- 'app/models/proposal.rb'
- 'app/models/signature_sheet.rb'
- 'app/models/site_customization/content_block.rb'
@@ -552,7 +538,7 @@ Style/MutableConstant:
Style/NumericLiterals:
MinDigits: 9
# Offense count: 19
# Offense count: 20
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles.
# SupportedStyles: predicate, comparison
@@ -580,7 +566,7 @@ Style/ParallelAssignment:
- 'lib/active_model/dates.rb'
- 'spec/support/common_actions.rb'
# Offense count: 11
# Offense count: 10
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
# NamePrefix: is_, has_, have_
# NamePrefixBlacklist: is_, has_, have_
@@ -594,7 +580,6 @@ Style/PredicateName:
- 'app/helpers/debates_helper.rb'
- 'app/models/budget/ballot.rb'
- 'app/models/user.rb'
- 'lib/census_api.rb'
# Offense count: 4
# Cop supports --auto-correct.
@@ -614,13 +599,14 @@ Style/RedundantBegin:
- 'app/controllers/graphql_controller.rb'
- 'app/models/legislation/annotation.rb'
# Offense count: 3
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed
Style/RegexpLiteral:
Exclude:
- 'app/helpers/embed_videos_helper.rb'
- 'app/models/poll/question/answer/video.rb'
- 'spec/customization_engine_spec.rb'
# Offense count: 6
@@ -639,22 +625,16 @@ Style/SafeNavigation:
Exclude:
- 'app/models/signature.rb'
# Offense count: 9
# Configuration parameters: SupportedStyles.
# SupportedStyles: snake_case, camelCase
Style/VariableName:
EnforcedStyle: snake_case
# Offense count: 107
# Offense count: 93
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: snake_case, normalcase, non_integer
Style/VariableNumber:
Enabled: false
# Offense count: 31
# Offense count: 34
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles, WordRegex.
# SupportedStyles: percent, brackets
Style/WordArray:
EnforcedStyle: percent
MinSize: 9
MinSize: 8

Binary file not shown.

View File

@@ -65,4 +65,9 @@
<glyph glyph-name="image" unicode="&#51;" d="M165 347c0-15-6-28-16-38-11-11-24-16-39-16-16 0-28 5-39 16-11 10-16 23-16 38 0 16 5 29 16 39 11 11 23 16 39 16 15 0 28-5 39-16 10-10 16-23 16-39z m292-109l0-128-402 0 0 55 91 91 46-46 146 147z m28 201l-458 0c-2 0-4-1-6-3-2-2-3-4-3-6l0-348c0-2 1-4 3-6 2-2 4-3 6-3l458 0c2 0 4 1 6 3 2 2 3 4 3 6l0 348c0 2-1 4-3 6-2 2-4 3-6 3z m45-9l0-348c0-12-4-23-13-32-9-9-20-13-32-13l-458 0c-12 0-23 4-32 13-9 9-13 20-13 32l0 348c0 12 4 23 13 32 9 9 20 13 32 13l458 0c12 0 23-4 32-13 9-9 13-20 13-32z"/>
<glyph glyph-name="search-plus" unicode="&#52;" d="M311 283l0-18c0-2-1-4-3-6-2-2-4-3-6-3l-64 0 0-64c0-2-1-5-3-6-2-2-4-3-6-3l-19 0c-2 0-4 1-6 3-2 1-3 4-3 6l0 64-64 0c-2 0-4 1-6 3-2 2-3 4-3 6l0 18c0 3 1 5 3 7 2 2 4 3 6 3l64 0 0 64c0 2 1 4 3 6 2 2 4 3 6 3l19 0c2 0 4-1 6-3 2-2 3-4 3-6l0-64 64 0c2 0 4-1 6-3 2-2 3-4 3-7z m36-9c0 36-12 66-37 91-25 25-55 37-91 37-35 0-65-12-90-37-25-25-38-55-38-91 0-35 13-65 38-90 25-25 55-38 90-38 36 0 66 13 91 38 25 25 37 55 37 90z m147-237c0-11-4-19-11-26-7-7-16-11-26-11-10 0-19 4-26 11l-98 98c-34-24-72-36-114-36-27 0-53 5-78 16-25 11-46 25-64 43-18 18-32 39-43 64-10 25-16 51-16 78 0 28 6 54 16 78 11 25 25 47 43 65 18 18 39 32 64 43 25 10 51 15 78 15 28 0 54-5 79-15 24-11 46-25 64-43 18-18 32-40 43-65 10-24 16-50 16-78 0-42-12-80-36-114l98-98c7-7 11-15 11-25z"/>
<glyph glyph-name="search-minus" unicode="&#53;" d="M311 283l0-18c0-2-1-4-3-6-2-2-4-3-6-3l-165 0c-2 0-4 1-6 3-2 2-3 4-3 6l0 18c0 3 1 5 3 7 2 2 4 3 6 3l165 0c2 0 4-1 6-3 2-2 3-4 3-7z m36-9c0 36-12 66-37 91-25 25-55 37-91 37-35 0-65-12-90-37-25-25-38-55-38-91 0-35 13-65 38-90 25-25 55-38 90-38 36 0 66 13 91 38 25 25 37 55 37 90z m147-237c0-11-4-19-11-26-7-7-16-11-26-11-10 0-19 4-26 11l-98 98c-34-24-72-36-114-36-27 0-53 5-78 16-25 11-46 25-64 43-18 18-32 39-43 64-10 25-16 51-16 78 0 28 6 54 16 78 11 25 25 47 43 65 18 18 39 32 64 43 25 10 51 15 78 15 28 0 54-5 79-15 24-11 46-25 64-43 18-18 32-40 43-65 10-24 16-50 16-78 0-42-12-80-36-114l98-98c7-7 11-15 11-25z"/>
<glyph glyph-name="calculator" unicode="&#54;" d="M110 73c0 10-4 19-11 26-7 7-16 11-26 11-10 0-19-4-26-11-7-7-10-16-10-26 0-10 3-19 10-26 7-7 16-10 26-10 10 0 19 3 26 10 7 7 11 16 11 26z m109 0c0 10-3 19-10 26-7 7-16 11-26 11-10 0-19-4-26-11-7-7-11-16-11-26 0-10 4-19 11-26 7-7 16-10 26-10 10 0 19 3 26 10 7 7 10 16 10 26z m-109 110c0 10-4 19-11 26-7 7-16 10-26 10-10 0-19-3-26-10-7-7-10-16-10-26 0-10 3-19 10-26 7-7 16-11 26-11 10 0 19 4 26 11 7 7 11 16 11 26z m219-110c0 10-3 19-11 26-7 7-15 11-25 11-11 0-19-4-26-11-7-7-11-16-11-26 0-10 4-19 11-26 7-7 15-10 26-10 10 0 18 3 25 10 8 7 11 16 11 26z m-110 110c0 10-3 19-10 26-7 7-16 10-26 10-10 0-19-3-26-10-7-7-11-16-11-26 0-10 4-19 11-26 7-7 16-11 26-11 10 0 19 4 26 11 7 7 10 16 10 26z m-109 110c0 10-4 18-11 25-7 8-16 11-26 11-10 0-19-3-26-11-7-7-10-15-10-25 0-11 3-19 10-26 7-7 16-11 26-11 10 0 19 4 26 11 7 7 11 15 11 26z m219-110c0 10-3 19-11 26-7 7-15 10-25 10-11 0-19-3-26-10-7-7-11-16-11-26 0-10 4-19 11-26 7-7 15-11 26-11 10 0 18 4 25 11 8 7 11 16 11 26z m-110 110c0 10-3 18-10 25-7 8-16 11-26 11-10 0-19-3-26-11-7-7-11-15-11-25 0-11 4-19 11-26 7-7 16-11 26-11 10 0 19 4 26 11 7 7 10 15 10 26z m220-220l0 110c0 10-4 18-11 26-7 7-16 10-26 10-10 0-18-3-25-10-8-8-11-16-11-26l0-110c0-10 3-18 11-26 7-7 15-10 25-10 10 0 19 3 26 10 7 8 11 16 11 26z m-110 220c0 10-3 18-11 25-7 8-15 11-25 11-11 0-19-3-26-11-7-7-11-15-11-25 0-11 4-19 11-26 7-7 15-11 26-11 10 0 18 4 25 11 8 7 11 15 11 26z m110 91l0 73c0 5-2 9-6 13-3 4-7 5-12 5l-366 0c-5 0-9-1-13-5-4-4-5-8-5-13l0-73c0-5 1-9 5-13 4-3 8-5 13-5l366 0c5 0 9 2 12 5 4 4 6 8 6 13z m0-91c0 10-4 18-11 25-7 8-16 11-26 11-10 0-18-3-26-11-7-7-10-15-10-25 0-11 3-19 10-26 8-7 16-11 26-11 10 0 19 4 26 11 7 7 11 15 11 26z m36 182l0-438c0-10-3-19-10-26-8-7-16-11-26-11l-402 0c-10 0-19 4-26 11-7 7-11 16-11 26l0 438c0 10 4 19 11 26 7 7 16 11 26 11l402 0c10 0 18-4 26-11 7-7 10-16 10-26z"/>
<glyph glyph-name="map-marker" unicode="&#55;" d="M329 329c0 20-7 38-21 52-15 14-32 21-52 21-20 0-37-7-52-21-14-14-21-32-21-52 0-20 7-37 21-52 15-14 32-21 52-21 20 0 37 7 52 21 14 15 21 32 21 52z m73 0c0-21-3-38-9-51l-104-221c-3-6-8-11-14-15-6-4-12-5-19-5-7 0-13 1-19 5-6 4-11 9-14 15l-104 221c-6 13-9 30-9 51 0 41 14 75 43 104 28 28 63 42 103 42 40 0 75-14 103-42 29-29 43-63 43-104z"/>
<glyph glyph-name="user-plus" unicode="&#56;" d="M165 256c-31 0-57 11-78 32-21 22-32 47-32 78 0 30 11 56 32 77 21 22 47 32 78 32 30 0 56-10 77-32 22-21 32-47 32-77 0-31-10-56-32-78-21-21-47-32-77-32z m274-37l100 0c3 0 5 0 7-2 2-2 3-4 3-7l0-55c0-2-1-4-3-6-2-2-4-3-7-3l-100 0 0-100c0-3-1-5-3-7-2-2-4-2-6-2l-55 0c-3 0-5 0-7 2-1 2-2 4-2 7l0 100-101 0c-2 0-4 1-6 3-2 2-3 4-3 6l0 55c0 3 1 5 3 7 2 2 4 2 6 2l101 0 0 101c0 2 1 5 2 6 2 2 4 3 7 3l55 0c2 0 4-1 6-3 2-1 3-4 3-6z m-210-64c0-9 3-18 10-25 8-8 16-11 26-11l73 0 0-68c-13-10-29-14-49-14l-249 0c-23 0-42 6-56 19-14 13-21 32-21 55 0 10 1 20 1 29 1 10 2 20 4 31 2 11 5 22 8 31 3 10 7 19 12 28 5 9 11 17 18 23 7 7 15 12 24 16 10 3 21 5 32 5 4 0 8-1 11-5 15-11 30-20 45-26 14-6 30-8 47-8 17 0 32 2 47 8 14 6 29 15 44 26 4 4 7 5 11 5 25 0 46-9 62-27l-64 0c-10 0-18-4-26-11-7-7-10-16-10-26z"/>
<glyph glyph-name="file-text-o" unicode="&#57;" d="M456 403c5-5 10-12 14-21 4-9 5-18 5-25l0-330c0-7-2-14-8-19-5-5-11-8-19-8l-384 0c-8 0-14 3-19 8-6 5-8 12-8 19l0 458c0 7 2 14 8 19 5 5 11 8 19 8l256 0c8 0 16-2 25-6 9-4 17-8 22-13z m-127 70l0-107 108 0c-2 5-4 9-7 11l-89 90c-2 2-6 4-12 6z m110-436l0 292-119 0c-8 0-14 3-19 8-6 5-8 12-8 20l0 118-220 0 0-438z m-293 246c0 3 1 5 3 7 2 2 4 3 6 3l202 0c2 0 4-1 6-3 2-2 3-4 3-7l0-18c0-3-1-5-3-6-2-2-4-3-6-3l-202 0c-2 0-4 1-6 3-2 1-3 3-3 6z m211-64c2 0 4 0 6-2 2-2 3-4 3-7l0-18c0-3-1-5-3-7-2-1-4-2-6-2l-202 0c-2 0-4 1-6 2-2 2-3 4-3 7l0 18c0 3 1 5 3 7 2 2 4 2 6 2z m0-73c2 0 4-1 6-2 2-2 3-4 3-7l0-18c0-3-1-5-3-7-2-1-4-2-6-2l-202 0c-2 0-4 1-6 2-2 2-3 4-3 7l0 18c0 3 1 5 3 7 2 1 4 2 6 2z"/>
<glyph glyph-name="file-text" unicode="&#33;" d="M456 376c3-3 5-6 8-10l-135 0 0 135c4-3 8-6 10-8z m-136-47l155 0 0-302c0-7-2-14-8-19-5-5-11-8-19-8l-384 0c-8 0-14 3-19 8-6 5-8 12-8 19l0 458c0 7 2 14 8 19 5 5 11 8 19 8l229 0 0-155c0-8 2-15 8-20 5-5 11-8 19-8z m46-210l0 18c0 3-1 5-3 7-2 1-4 2-6 2l-202 0c-2 0-4-1-6-2-2-2-3-4-3-7l0-18c0-3 1-5 3-7 2-1 4-2 6-2l202 0c2 0 4 1 6 2 2 2 3 4 3 7z m0 73l0 18c0 3-1 5-3 7-2 2-4 2-6 2l-202 0c-2 0-4 0-6-2-2-2-3-4-3-7l0-18c0-3 1-5 3-7 2-1 4-2 6-2l202 0c2 0 4 1 6 2 2 2 3 4 3 7z m0 73l0 18c0 3-1 5-3 7-2 2-4 3-6 3l-202 0c-2 0-4-1-6-3-2-2-3-4-3-7l0-18c0-3 1-5 3-6 2-2 4-3 6-3l202 0c2 0 4 1 6 3 2 1 3 3 3 6z"/>
</font></defs></svg>

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -15,6 +15,7 @@
//= require jquery-ui/widgets/datepicker
//= require jquery-ui/i18n/datepicker-es
//= require jquery-ui/widgets/autocomplete
//= require jquery-ui/widgets/sortable
//= require jquery-fileupload/basic
//= require foundation
//= require turbolinks
@@ -71,6 +72,7 @@
//= require leaflet
//= require map
//= require polls
//= require sortable
var initialize_modules = function() {
App.Comments.initialize();
@@ -110,6 +112,7 @@ var initialize_modules = function() {
App.PollsAdmin.initialize();
App.Map.initialize();
App.Polls.initialize();
App.Sortable.initialize();
};
$(function(){

View File

@@ -26,3 +26,19 @@ App.Polls =
token_message.html(token_message.html() + "<br><strong>" + @token + "</strong>");
token_message.show()
false
$(".zoom-link").on "click", (event) ->
element = event.target
answer = $(element).closest('div.answer')
if $(answer).hasClass('medium-6')
$(answer).removeClass("medium-6");
$(answer).addClass("answer-divider");
unless $(answer).hasClass('first')
$(answer).insertBefore($(answer).prev('div.answer'));
else
$(answer).addClass("medium-6");
$(answer).removeClass("answer-divider");
unless $(answer).hasClass('first')
$(answer).insertAfter($(answer).next('div.answer'));

View File

@@ -22,9 +22,11 @@ App.PreventDoubleSubmission =
initialize: ->
$('form').on('submit', (event) ->
unless event.target.id == "new_officing_voter"
buttons = $(this).find(':button, :submit')
App.PreventDoubleSubmission.disable_buttons(buttons)
).on('ajax:success', ->
).on('ajax:success', (event) ->
unless event.target.id == "new_officing_voter"
buttons = $(this).find(':button, :submit')
App.PreventDoubleSubmission.reset_buttons(buttons)
)

View File

@@ -0,0 +1,9 @@
App.Sortable =
initialize: ->
$(".sortable").sortable
update: (event, ui) ->
new_order = $(this).sortable('toArray', {attribute: 'data-answer-id'});
$.ajax
url: $('.sortable').data('js-url'),
data: {ordered_list: new_order},
type: 'POST'

View File

@@ -605,6 +605,7 @@ table {
.callout {
height: $line-height * 2;
line-height: $line-height * 2;
margin: 0;
padding: 0 $line-height / 2;
}
}

View File

@@ -18,4 +18,5 @@
@import 'datepicker_overrides';
@import 'jquery-ui/autocomplete';
@import 'autocomplete_overrides';
@import 'jquery-ui/sortable';
@import 'leaflet';

View File

@@ -268,3 +268,23 @@
.icon-search-minus::before {
content: '\35';
}
.icon-calculator::before {
content: '\36';
}
.icon-map-marker::before {
content: '\37';
}
.icon-user-plus::before {
content: '\38';
}
.icon-file-text-o::before {
content: '\39';
}
.icon-file-text::before {
content: '\21';
}

View File

@@ -155,6 +155,10 @@ a {
margin-bottom: $line-height;
}
.margin-left {
margin-left: $line-height;
}
.margin-right {
margin-right: $line-height;
}
@@ -210,6 +214,8 @@ a {
margin-bottom: $line-height / 2;
li {
font-size: $base-font-size;
margin-bottom: 0;
margin-right: $line-height / 2;
@include breakpoint(medium) {
@@ -312,13 +318,16 @@ a {
}
.tabs {
border: {
left: 0;
right: 0;
top: 0;
};
border-left: 0;
border-right: 0;
border-top: 0;
margin-bottom: $line-height;
.tabs-title {
font-size: $base-font-size;
margin-bottom: 0;
}
.tabs-title > a {
color: $text-medium;
margin-bottom: rem-calc(-1);
@@ -368,6 +377,14 @@ a {
display: table-cell;
}
.off-canvas-content {
box-shadow: none;
}
.uppercase {
text-transform: uppercase;
}
// 02. Header
// ----------
@@ -1131,8 +1148,13 @@ form {
color: #ecf00b;
font-size: rem-calc(10);
position: absolute;
right: 8px;
left: 12px;
top: 6px;
@include breakpoint(medium) {
left: auto;
right: 8px;
}
}
}
@@ -2020,7 +2042,6 @@ table {
// ------------
.activity {
margin-bottom: $line-height * 2;
.accordion li {
margin-bottom: $line-height / 2;
@@ -2052,62 +2073,15 @@ table {
}
}
table {
border: 0;
margin-bottom: 0;
}
td {
position: relative;
&:first-child {
padding-left: $line-height * 1.5;
width: 75%;
}
&::before {
color: $brand;
font-family: "icons" !important;
font-size: rem-calc(24);
left: 4px;
position: absolute;
}
}
.activity-comments td:first-child::before {
content: 'e';
top: 18px;
}
.activity-debates td:first-child::before {
content: 'i';
top: 14px;
}
.activity-proposals {
td:first-child::before {
content: 'h';
top: 18px;
}
.retired {
text-decoration: line-through;
}
}
.activity-investment-projects td:first-child::before,
.activity-ballot td:first-child::before {
content: '\53';
top: 10px;
}
}
.public-interests {
margin-top: $line-height;
.column {
padding-left: 0;
li {
margin-right: $line-height / 4;
}
}

View File

@@ -8,6 +8,7 @@
// 06. Budget
// 07. Proposals successful
// 08. Polls
// 09. Polls results and stats
//
// 01. Votes and supports
@@ -363,10 +364,6 @@
width: rem-calc(48);
}
.edit-debate {
margin-bottom: 0;
}
.debate-info,
.proposal-info,
.investment-project-info,
@@ -1478,33 +1475,6 @@
}
}
.featured-proposals-ballot-banner,
.sucessfull-proposals-banner {
background: #2d3e50 image-url('ballot_tiny.gif') no-repeat;
background-position: 75% 0;
position: relative;
@include breakpoint(medium) {
margin-left: 0 !important;
margin-right: 0 !important;
}
@include breakpoint(large) {
background: #2d3e50 image-url('ballot.gif') no-repeat;
background-position: 90% 0;
}
h2,
a:hover h2 {
color: #ffd200 !important;
}
p {
color: #fff;
}
}
.sucessfull-proposals-banner,
.successful .panel {
.icon-successful {
@@ -1596,7 +1566,7 @@
height: 100%;
&.short {
height: $line-height * 12;
height: rem-calc(300);
overflow: hidden;
}
}
@@ -1830,3 +1800,59 @@
}
}
}
// 09. Polls results and stats
// ---------------------------
.polls-results-stats {
.sidebar {
border-bottom: 1px solid $border;
margin-bottom: $line-height;
@include breakpoint(medium) {
border-bottom: 0;
border-right: 1px solid $border;
}
.menu {
padding: 0;
li a {
color: $link;
line-height: $line-height;
}
}
}
table {
table-layout: fixed;
caption {
padding: $line-height / 2 0;
text-align: left;
}
th {
text-align: left;
&.win {
background: #009fde;
}
}
td {
&.win {
background: #ccedf8;
font-weight: bold;
}
}
}
.number {
font-size: rem-calc(60);
font-weight: bold;
line-height: rem-calc(60);
}
}

View File

@@ -12,7 +12,7 @@
#print_link { display: none !important; }
#responsive-menu { display: none !important; }
#responsive_menu { display: none !important; }
.admin-sidebar { display: none !important; }

View File

@@ -18,21 +18,29 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController
@booth_assignment = @poll.booth_assignments.includes(:recounts, :voters,
officer_assignments: [officer: [:user]]).find(params[:id])
@voters_by_date = @booth_assignment.voters.group_by {|v| v.created_at.to_date}
@partial_results = @booth_assignment.partial_results
@recounts = @booth_assignment.recounts
end
def create
@booth_assignment = ::Poll::BoothAssignment.new(poll_id: booth_assignment_params[:poll_id],
booth_id: booth_assignment_params[:booth_id])
@poll = Poll.find(booth_assignment_params[:poll_id])
@booth = Poll::Booth.find(booth_assignment_params[:booth_id])
@booth_assignment = ::Poll::BoothAssignment.new(poll: @poll,
booth: @booth)
if @booth_assignment.save
notice = t("admin.poll_booth_assignments.flash.create")
else
notice = t("admin.poll_booth_assignments.flash.error_create")
end
redirect_to admin_poll_booth_assignments_path(@booth_assignment.poll_id), notice: notice
respond_to do |format|
format.js { render layout: false }
end
end
def destroy
@poll = Poll.find(booth_assignment_params[:poll_id])
@booth = Poll::Booth.find(booth_assignment_params[:booth_id])
@booth_assignment = ::Poll::BoothAssignment.find(params[:id])
if @booth_assignment.destroy
@@ -40,7 +48,14 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController
else
notice = t("admin.poll_booth_assignments.flash.error_destroy")
end
redirect_to admin_poll_booth_assignments_path(@booth_assignment.poll_id), notice: notice
respond_to do |format|
format.js { render layout: false }
end
end
def manage
@booths = ::Poll::Booth.all
@poll = Poll.find(params[:poll_id])
end
private

View File

@@ -25,7 +25,9 @@ class Admin::Poll::OfficerAssignmentsController < Admin::Poll::BaseController
def search_officers
load_search
@officers = User.joins(:poll_officer).search(@search).order(username: :asc)
poll_officers = User.where(id: @poll.officers.pluck(:user_id))
@officers = poll_officers.search(@search).order(username: :asc)
respond_to do |format|
format.js

View File

@@ -47,6 +47,10 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
redirect_to admin_poll_path(@poll), notice: notice
end
def booth_assignments
@polls = Poll.current_or_incoming
end
private
def load_geozones
@@ -54,7 +58,8 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
end
def poll_params
params.require(:poll).permit(:name, :starts_at, :ends_at, :geozone_restricted, :summary, :description,
params.require(:poll).permit(:name, :starts_at, :ends_at, :geozone_restricted,
:summary, :description, :results_enabled, :stats_enabled,
geozone_ids: [],
image_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy])
end

View File

@@ -33,10 +33,10 @@ class Admin::Poll::Questions::Answers::VideosController < Admin::Poll::BaseContr
end
def destroy
if @video.destroy
notice = t("flash.actions.destroy.poll_question_answer_video")
notice = if @video.destroy
t("flash.actions.destroy.poll_question_answer_video")
else
notice = t("flash.actions.destroy.error")
t("flash.actions.destroy.error")
end
redirect_to :back, notice: notice
end

View File

@@ -39,6 +39,11 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController
render 'admin/poll/questions/answers/documents'
end
def order_answers
::Poll::Question::Answer.order_answers(params[:ordered_list])
render nothing: true
end
private
def answer_params

View File

@@ -15,7 +15,6 @@ class Admin::Poll::QuestionsController < Admin::Poll::BaseController
def new
@polls = Poll.all
@question.valid_answers = I18n.t('poll_questions.default_valid_answers')
proposal = Proposal.find(params[:proposal_id]) if params[:proposal_id].present?
@question.copy_attributes_from_proposal(proposal)
end
@@ -56,7 +55,7 @@ class Admin::Poll::QuestionsController < Admin::Poll::BaseController
private
def question_params
params.require(:poll_question).permit(:poll_id, :title, :question, :proposal_id, :valid_answers, :video_url)
params.require(:poll_question).permit(:poll_id, :title, :question, :proposal_id, :video_url)
end
def search_params

View File

@@ -6,6 +6,8 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController
def new
load_shifts
@shift = ::Poll::Shift.new
@voting_polls = @booth.polls.current_or_incoming
@recount_polls = @booth.polls.current_or_recounting_or_incoming
end
def create

View File

@@ -18,8 +18,7 @@ class DirectUploadsController < ApplicationController
render json: { cached_attachment: @direct_upload.relation.cached_attachment,
filename: @direct_upload.relation.attachment.original_filename,
destroy_link: render_destroy_upload_link(@direct_upload).html_safe,
attachment_url: @direct_upload.relation.attachment.url
}
attachment_url: @direct_upload.relation.attachment.url}
else
@direct_upload.destroy_attachment
render json: { errors: @direct_upload.errors[:attachment].join(", ") },

View File

@@ -29,6 +29,8 @@ class NotificationsController < ApplicationController
case notification.linkable_resource.class.name
when "Budget::Investment"
budget_investment_path @notification.linkable_resource.budget, @notification.linkable_resource
when "Topic"
community_topic_path @notification.linkable_resource.community, @notification.linkable_resource
else
url_for @notification.linkable_resource
end

View File

@@ -7,6 +7,6 @@ class Officing::BaseController < ApplicationController
skip_authorization_check
def verify_officer
raise CanCan::AccessDenied unless current_user.try(:poll_officer?) || current_user.try(:administrator?)
raise CanCan::AccessDenied unless current_user.try(:poll_officer?)
end
end

View File

@@ -5,7 +5,7 @@ class Officing::ResultsController < Officing::BaseController
before_action :load_partial_results, only: :new
before_action :load_officer_assignment, only: :create
before_action :check_booth_and_date, only: :create
before_action :check_officer_assignment, only: :create
before_action :build_results, only: :create
def new
@@ -32,13 +32,9 @@ class Officing::ResultsController < Officing::BaseController
private
def check_booth_and_date
def check_officer_assignment
if @officer_assignment.blank?
go_back_to_new(t("officing.results.flash.error_wrong_booth"))
elsif results_params[:date].blank? ||
Date.parse(results_params[:date]) < @poll.starts_at.to_date ||
Date.parse(results_params[:date]) > @poll.ends_at.to_date
go_back_to_new(t("officing.results.flash.error_wrong_date"))
end
end
@@ -51,11 +47,11 @@ class Officing::ResultsController < Officing::BaseController
results.each_pair do |answer_index, count|
next if count.blank?
answer = question.valid_answers[answer_index.to_i]
answer = question.question_answers.where(given_order: answer_index.to_i + 1).first.title
go_back_to_new if question.blank?
partial_result = ::Poll::PartialResult.find_or_initialize_by(booth_assignment_id: @officer_assignment.booth_assignment_id,
date: results_params[:date],
date: Date.current,
question_id: question_id,
answer: answer)
partial_result.officer_assignment_id = @officer_assignment.id
@@ -71,7 +67,7 @@ class Officing::ResultsController < Officing::BaseController
def build_recounts
recount = ::Poll::Recount.find_or_initialize_by(booth_assignment_id: @officer_assignment.booth_assignment_id,
date: results_params[:date])
date: Date.current)
recount.officer_assignment_id = @officer_assignment.id
recount.author = current_user
recount.origin = 'booth'
@@ -84,7 +80,7 @@ class Officing::ResultsController < Officing::BaseController
end
def go_back_to_new(alert = nil)
params[:d] = results_params[:date]
params[:d] = Date.current
params[:oa] = results_params[:officer_assignment_id]
flash.now[:alert] = (alert || t("officing.results.flash.error_create"))
load_officer_assignments
@@ -108,7 +104,7 @@ class Officing::ResultsController < Officing::BaseController
final.
where(id: current_user.poll_officer.officer_assignment_ids).
where("poll_booth_assignments.poll_id = ?", @poll.id).
order(date: :asc)
where(date: Date.current)
end
def load_partial_results
@@ -119,7 +115,7 @@ class Officing::ResultsController < Officing::BaseController
end
def results_params
params.permit(:officer_assignment_id, :date, :questions, :whites, :nulls, :total)
params.permit(:officer_assignment_id, :questions, :whites, :nulls, :total)
end
def index_params

View File

@@ -13,6 +13,9 @@ class Polls::QuestionsController < ApplicationController
answer.touch if answer.persisted?
answer.save!
answer.record_voter_participation(token)
@question.question_answers.where(question_id: @question).each do |answer|
answer.set_most_voted
end
@answers_by_question_id = { @question.id => params[:answer] }
end

View File

@@ -1,10 +1,10 @@
class PollsController < ApplicationController
include PollsHelper
load_and_authorize_resource
has_filters %w{current expired incoming}
has_orders %w{most_voted newest oldest}, only: :show
::Poll::Answer # trigger autoload
@@ -15,11 +15,23 @@ class PollsController < ApplicationController
def show
@questions = @poll.questions.for_render.sort_for_list
@token = poll_voter_token(@poll, current_user)
@poll_questions_answers = Poll::Question::Answer.where(question: @poll.questions).where.not(description: "").order(:given_order)
@answers_by_question_id = {}
poll_answers = ::Poll::Answer.by_question(@poll.question_ids).by_author(current_user.try(:id))
poll_answers.each do |answer|
@answers_by_question_id[answer.question_id] = answer.answer
end
@commentable = @poll
@comment_tree = CommentTree.new(@commentable, params[:page], @current_order)
end
def stats
@stats = Poll::Stats.new(@poll).generate
end
def results
end
end

View File

@@ -12,7 +12,7 @@ module FlagsHelper
def flagged?(flaggable)
if flaggable.is_a? Comment
@comment_flags[flaggable.id]
@comment_flags[flaggable.id] unless flaggable.commentable_type == "Poll"
else
Flag.flagged?(current_user, flaggable)
end

View File

@@ -9,10 +9,10 @@ module ImageablesHelper
end
def imageable_max_file_size
bytesToMeg(Image::MAX_IMAGE_SIZE)
bytes_to_megabytes(Image::MAX_IMAGE_SIZE)
end
def bytesToMeg(bytes)
def bytes_to_megabytes(bytes)
bytes / Numeric::MEGABYTE
end
@@ -22,7 +22,7 @@ module ImageablesHelper
def imageable_accepted_content_types_extensions
Image::ACCEPTED_CONTENT_TYPE
.collect{ |content_type| ".#{content_type.split("/").last}" }
.collect{ |content_type| ".#{content_type.split('/').last}" }
.join(",")
end
@@ -32,7 +32,7 @@ module ImageablesHelper
.join(", ")
end
def imageables_note(imageable)
def imageables_note(_imageable)
t "images.form.note", accepted_content_types: imageable_humanized_accepted_content_types,
max_file_size: imageable_max_file_size
end

View File

@@ -22,7 +22,7 @@ module ImagesHelper
image.errors[:attachment].join(', ') if image.errors.key?(:attachment)
end
def image_bytesToMeg(bytes)
def image_bytes_to_megabytes(bytes)
bytes / Numeric::MEGABYTE
end

View File

@@ -1,19 +1,30 @@
module ShiftsHelper
def shift_vote_collection_dates(polls)
date_options((start_date(polls)..end_date(polls)))
def shift_vote_collection_dates(booth, polls)
return [] if polls.blank?
date_options((start_date(polls)..end_date(polls)), Poll::Shift.tasks[:vote_collection], booth)
end
def shift_recount_scrutiny_dates(polls)
date_options(polls.map(&:ends_at).map(&:to_date).sort.inject([]) { |total, date| total << (date..date + 1.week).to_a }.flatten.uniq)
def shift_recount_scrutiny_dates(booth, polls)
return [] if polls.blank?
dates = polls.map(&:ends_at).map(&:to_date).sort.inject([]) do |total, date|
initial_date = date < Date.current ? Date.current : date
total << (initial_date..date + Poll::RECOUNT_DURATION).to_a
end
date_options(dates.flatten.uniq, Poll::Shift.tasks[:recount_scrutiny], booth)
end
def date_options(dates)
dates.map { |date| [l(date, format: :long), l(date)] }
def date_options(dates, task_id, booth)
valid_dates(dates, task_id, booth).map { |date| [l(date, format: :long), l(date)] }
end
def valid_dates(dates, task_id, booth)
dates.reject { |date| officer_shifts(task_id, booth).include?(date) }
end
def start_date(polls)
polls.map(&:starts_at).min.to_date
start_date = polls.map(&:starts_at).min.to_date
start_date < Date.current ? Date.current : start_date
end
def end_date(polls)
@@ -24,4 +35,9 @@ module ShiftsHelper
officers.collect { |officer| [officer.name, officer.id] }
end
private
def officer_shifts(task_id, booth)
@officer.shifts.where(task: task_id, booth: booth).map(&:date)
end
end

View File

@@ -52,12 +52,8 @@ module UsersHelper
current_user && current_user.manager?
end
def current_poll_officer?
current_user && current_user.poll_officer?
end
def show_admin_menu?
current_administrator? || current_moderator? || current_valuator? || current_manager? || current_poll_officer?
current_administrator? || current_moderator? || current_valuator? || current_manager?
end
def interests_title_text(user)

View File

@@ -1,11 +1,11 @@
module WelcomeHelper
def active_class(index)
"is-active is-in" if index == 0
"is-active is-in" if index.zero?
end
def slide_display(index)
"display: none;" if index > 0
"display: none;" if index.positive?
end
def recommended_path(recommended)
@@ -46,17 +46,13 @@ module WelcomeHelper
end
def calculate_offset(debates, proposals, apply_offset)
if (debates.any? && proposals.any?)
if apply_offset
offset = "medium-offset-2 large-offset-2"
if debates.any? && proposals.any?
offset = if apply_offset
"medium-offset-2 large-offset-2"
else
offset = "end"
"end"
end
end
end
def highlight_background
(feature?("user.recommendations") && current_user) ? "highlight" : ""
end
end

View File

@@ -62,10 +62,10 @@ module Abilities
can [:index, :create, :edit, :update, :destroy], Geozone
can [:read, :create, :update, :destroy, :add_question, :search_booths, :search_officers], Poll
can [:read, :create, :update, :destroy, :add_question, :search_booths, :search_officers, :booth_assignments, :results, :stats], Poll
can [:read, :create, :update, :destroy, :available], Poll::Booth
can [:search, :create, :index, :destroy], ::Poll::Officer
can [:create, :destroy], ::Poll::BoothAssignment
can [:create, :destroy, :manage], ::Poll::BoothAssignment
can [:create, :destroy], ::Poll::OfficerAssignment
can [:read, :create, :update], Poll::Question
can :destroy, Poll::Question # , comments_count: 0, votes_up: 0

View File

@@ -7,6 +7,12 @@ module Abilities
can [:read, :map, :summary, :share], Proposal
can :read, Comment
can :read, Poll
can :results, Poll do |poll|
poll.expired? && poll.results_enabled?
end
can :stats, Poll do |poll|
poll.expired? && poll.stats_enabled?
end
can :read, Poll::Question
can [:read, :welcome], Budget
can :read, SpendingProposal

View File

@@ -3,7 +3,7 @@ class Comment < ActiveRecord::Base
include HasPublicAuthor
include Graphqlable
COMMENTABLE_TYPES = %w(Debate Proposal Budget::Investment Poll::Question Legislation::Question Legislation::Annotation Topic Legislation::Proposal).freeze
COMMENTABLE_TYPES = %w(Debate Proposal Budget::Investment Poll::Question Legislation::Question Legislation::Annotation Topic Legislation::Proposal Poll).freeze
acts_as_paranoid column: :hidden_at
include ActsAsParanoidAliases

View File

@@ -22,6 +22,7 @@ class CommentNotifier
end
def email_on_comment?
return false if @comment.commentable.is_a?(Poll)
commentable_author = @comment.commentable.author
commentable_author != @author && commentable_author.email_on_comment?
end

View File

@@ -48,8 +48,8 @@ class Debate < ActiveRecord::Base
attr_accessor :link_required
def self.recommendations(user)
tagged_with(user.interests, any: true).
where("author_id != ?", user.id)
tagged_with(user.interests, any: true)
.where("author_id != ?", user.id)
end
def searchable_values

View File

@@ -7,7 +7,7 @@ class DirectUpload
:relation, :resource_relation,
:attachment, :cached_attachment, :user
validates_presence_of :attachment, :resource_type, :resource_relation, :user
validates :attachment, :resource_type, :resource_relation, :user, presence: true
validate :parent_resource_attachment_validations,
if: -> { attachment.present? && resource_type.present? && resource_relation.present? && user.present? }
@@ -20,13 +20,13 @@ class DirectUpload
@resource = @resource_type.constantize.find_or_initialize_by(id: @resource_id)
# Refactor
if @resource.respond_to?(:images) &&
@relation = if @resource.respond_to?(:images) &&
((@attachment.present? && !@attachment.content_type.match(/pdf/)) || @cached_attachment.present?)
@relation = @resource.images.send("build", relation_attributtes)
@resource.images.send("build", relation_attributtes)
elsif @resource.class.reflections[@resource_relation].macro == :has_one
@relation = @resource.send("build_#{resource_relation}", relation_attributtes)
@resource.send("build_#{resource_relation}", relation_attributtes)
else
@relation = @resource.send(@resource_relation).build(relation_attributtes)
@resource.send(@resource_relation).build(relation_attributtes)
end
@relation.user = user
@@ -50,7 +50,7 @@ class DirectUpload
def parent_resource_attachment_validations
@relation.valid?
if @relation.errors.has_key? :attachment
if @relation.errors.key? :attachment
errors[:attachment] = @relation.errors[:attachment]
end
end

View File

@@ -44,7 +44,7 @@ class Document < ActiveRecord::Base
attachment.instance.prefix(attachment, style)
end
def prefix(attachment, style)
def prefix(attachment, _style)
if !attachment.instance.persisted?
"cached_attachments/user/#{attachment.instance.user_id}"
else

View File

@@ -5,7 +5,7 @@ class Image < ActiveRecord::Base
TITLE_LEGHT_RANGE = 4..80
MIN_SIZE = 475
MAX_IMAGE_SIZE = 1.megabyte
ACCEPTED_CONTENT_TYPE = %w(image/jpeg image/jpg)
ACCEPTED_CONTENT_TYPE = %w(image/jpeg image/jpg).freeze
has_attached_file :attachment, styles: { large: "x#{MIN_SIZE}", medium: "300x300#", thumb: "140x245#" },
url: "/system/:class/:prefix/:style/:hash.:extension",
@@ -52,7 +52,7 @@ class Image < ActiveRecord::Base
attachment.instance.prefix(attachment, style)
end
def prefix(attachment, style)
def prefix(attachment, _style)
if !attachment.instance.persisted?
"cached_attachments/user/#{attachment.instance.user_id}"
else

View File

@@ -1,5 +1,9 @@
class Poll < ActiveRecord::Base
include Imageable
acts_as_paranoid column: :hidden_at
include ActsAsParanoidAliases
RECOUNT_DURATION = 1.week
has_many :booth_assignments, class_name: "Poll::BoothAssignment"
has_many :booths, through: :booth_assignments
@@ -9,8 +13,10 @@ class Poll < ActiveRecord::Base
has_many :officer_assignments, through: :booth_assignments
has_many :officers, through: :officer_assignments
has_many :questions
has_many :comments, as: :commentable
has_and_belongs_to_many :geozones
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
validates :name, presence: true
@@ -19,11 +25,16 @@ class Poll < ActiveRecord::Base
scope :current, -> { where('starts_at <= ? and ? <= ends_at', Date.current.beginning_of_day, Date.current.beginning_of_day) }
scope :incoming, -> { where('? < starts_at', Date.current.beginning_of_day) }
scope :expired, -> { where('ends_at < ?', Date.current.beginning_of_day) }
scope :recounting, -> { Poll.where(ends_at: (Date.current.beginning_of_day - RECOUNT_DURATION)..Date.current.beginning_of_day) }
scope :published, -> { where('published = ?', true) }
scope :by_geozone_id, ->(geozone_id) { where(geozones: {id: geozone_id}.joins(:geozones)) }
scope :sort_for_list, -> { order(:geozone_restricted, :starts_at, :name) }
def title
name
end
def current?(timestamp = Date.current.beginning_of_day)
starts_at <= timestamp && timestamp <= ends_at
end
@@ -40,6 +51,10 @@ class Poll < ActiveRecord::Base
current + incoming
end
def self.current_or_recounting_or_incoming
current + recounting + incoming
end
def answerable_by?(user)
user.present? &&
user.level_two_or_three_verified? &&
@@ -65,6 +80,10 @@ class Poll < ActiveRecord::Base
Poll::Voter.where(poll: self, user: user, origin: "booth").exists?
end
def voted_in_web?(user)
Poll::Voter.where(poll: self, user: user, origin: "web").exists?
end
def date_range
unless starts_at.present? && ends_at.present? && starts_at <= ends_at
errors.add(:starts_at, I18n.t('errors.messages.invalid_date_range'))

View File

@@ -9,9 +9,8 @@ class Poll::Answer < ActiveRecord::Base
validates :author, presence: true
validates :answer, presence: true
# temporary skipping validation, review when removing valid_answers
# validates :answer, inclusion: { in: ->(a) { a.question.valid_answers }},
# unless: ->(a) { a.question.blank? }
validates :answer, inclusion: { in: ->(a) { a.question.question_answers.pluck(:title) }},
unless: ->(a) { a.question.blank? }
scope :by_author, ->(author_id) { where(author_id: author_id) }
scope :by_question, ->(question_id) { where(question_id: question_id) }

View File

@@ -12,8 +12,11 @@ class Poll
end
def self.available
where(polls: { id: Poll.current_or_incoming }).includes(:polls)
where(polls: { id: Poll.current_or_recounting_or_incoming }).includes(:polls)
end
def assignment_on_poll(poll)
booth_assignments.where(poll: poll).first
end
end
end

View File

@@ -1,23 +0,0 @@
class Poll::NullResult < ActiveRecord::Base
VALID_ORIGINS = %w{web booth}
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
belongs_to :booth_assignment
belongs_to :officer_assignment
validates :author, presence: true
validates :origin, inclusion: {in: VALID_ORIGINS}
scope :by_author, ->(author_id) { where(author_id: author_id) }
before_save :update_logs
def update_logs
if amount_changed? && amount_was.present?
self.amount_log += ":#{amount_was.to_s}"
self.officer_assignment_id_log += ":#{officer_assignment_id_was.to_s}"
self.author_id_log += ":#{author_id_was.to_s}"
end
end
end

View File

@@ -10,7 +10,8 @@ class Poll::PartialResult < ActiveRecord::Base
validates :question, presence: true
validates :author, presence: true
validates :answer, presence: true
validates :answer, inclusion: {in: ->(a) { a.question.valid_answers }}
validates :answer, inclusion: { in: ->(a) { a.question.question_answers.pluck(:title) }},
unless: ->(a) { a.question.blank? }
validates :origin, inclusion: { in: VALID_ORIGINS }
scope :by_author, ->(author_id) { where(author_id: author_id) }

View File

@@ -10,7 +10,7 @@ class Poll::Question < ActiveRecord::Base
has_many :comments, as: :commentable
has_many :answers, class_name: 'Poll::Answer'
has_many :question_answers, class_name: 'Poll::Question::Answer'
has_many :question_answers, -> { order 'given_order asc' }, class_name: 'Poll::Question::Answer'
has_many :partial_results
belongs_to :proposal
@@ -39,17 +39,12 @@ class Poll::Question < ActiveRecord::Base
author_visible_name => 'C' }
end
def valid_answers
(super.try(:split, ',').compact || []).map(&:strip)
end
def copy_attributes_from_proposal(proposal)
if proposal.present?
self.author = proposal.author
self.author_visible_name = proposal.author.name
self.proposal_id = proposal.id
self.title = proposal.title
self.valid_answers = I18n.t('poll_questions.default_valid_answers')
end
end
@@ -60,4 +55,8 @@ class Poll::Question < ActiveRecord::Base
where(poll_id: Poll.answerable_by(user).pluck(:id))
end
def answers_total_votes
question_answers.map { |a| Poll::Answer.where(question_id: self, answer: a.title).count }.sum
end
end

View File

@@ -10,8 +10,45 @@ class Poll::Question::Answer < ActiveRecord::Base
has_many :videos, class_name: 'Poll::Question::Answer::Video'
validates :title, presence: true
validates :given_order, presence: true, uniqueness: { scope: :question_id }
before_validation :set_order, on: :create
def description
super.try :html_safe
end
def self.order_answers(ordered_array)
ordered_array.each_with_index do |answer_id, order|
find(answer_id).update_attribute(:given_order, (order + 1))
end
end
def set_order
self.given_order = self.class.last_position(question_id) + 1
end
def self.last_position(question_id)
where(question_id: question_id).maximum('given_order') || 0
end
def total_votes
Poll::Answer.where(question_id: question, answer: title).count
end
def most_voted?
self.most_voted
end
def total_votes_percentage
question.answers_total_votes == 0 ? 0 : (total_votes * 100) / question.answers_total_votes
end
def set_most_voted
answers = question.question_answers
.map { |a| Poll::Answer.where(question_id: a.question, answer: a.title).count }
is_most_voted = !answers.any?{ |a| a > self.total_votes }
self.update(most_voted: is_most_voted)
end
end

143
app/models/poll/stats.rb Normal file
View File

@@ -0,0 +1,143 @@
class Poll
class Stats
def initialize(poll)
@poll = poll
end
def generate
stats = %w[total_participants total_participants_web total_web_valid total_web_white total_web_null
total_participants_booth total_booth_valid total_booth_white total_booth_null
total_valid_votes total_white_votes total_null_votes valid_percentage_web valid_percentage_booth
total_valid_percentage white_percentage_web white_percentage_booth total_white_percentage
null_percentage_web null_percentage_booth total_null_percentage total_participants_web_percentage
total_participants_booth_percentage]
stats.map { |stat_name| [stat_name.to_sym, send(stat_name)] }.to_h
end
private
def total_participants
stats_cache('total_participants') { total_participants_web + total_participants_booth }
end
def total_participants_web
stats_cache('total_participants_web') { total_web_valid + total_web_white + total_web_null }
end
def total_participants_web_percentage
stats_cache('total_participants_web_percentage') {
(total_participants) == 0 ? 0 : total_participants_web * 100 / total_participants
}
end
def total_participants_booth
stats_cache('total_participants_booth') { voters.where(origin: 'booth').count }
end
def total_participants_booth_percentage
stats_cache('total_participants_booth_percentage') {
(total_participants) == 0 ? 0 : total_participants_booth * 100 / total_participants.to_f
}
end
def total_web_valid
stats_cache('total_web_valid') { voters.where(origin: 'web').count }
end
def valid_percentage_web
stats_cache('valid_percentage_web') {
(total_valid_votes) == 0 ? 0 : total_web_valid * 100 / total_valid_votes.to_f
}
end
def total_web_white
stats_cache('total_web_white') { 0 }
end
def white_percentage_web
stats_cache('white_percentage_web') { 0 }
end
def total_web_null
stats_cache('total_web_null') { 0 }
end
def null_percentage_web
stats_cache('null_percentage_web') { 0 }
end
def total_booth_valid
stats_cache('total_booth_valid') { recounts.sum(:total_amount) }
end
def valid_percentage_booth
stats_cache('valid_percentage_booth') {
(total_valid_votes) == 0 ? 0 : total_booth_valid * 100 / total_valid_votes.to_f
}
end
def total_booth_white
stats_cache('total_booth_white') { recounts.sum(:white_amount) }
end
def white_percentage_booth
stats_cache('white_percentage_booth') {
(total_white_votes) == 0 ? 0 : total_booth_white * 100 / total_white_votes.to_f
}
end
def total_booth_null
stats_cache('total_booth_null') { recounts.sum(:null_amount) }
end
def null_percentage_booth
stats_cache('null_percentage_booth') {
(total_null_votes == 0) ? 0 : total_booth_null * 100 / total_null_votes.to_f
}
end
def total_valid_votes
stats_cache('total_valid_votes') { total_web_valid + total_booth_valid }
end
def total_valid_percentage
stats_cache('total_valid_percentage'){
(total_participants) == 0 ? 0 : total_valid_votes * 100 / total_participants.to_f
}
end
def total_white_votes
stats_cache('total_white_votes') { total_web_white + total_booth_white }
end
def total_white_percentage
stats_cache('total_white_percentage') {
(total_participants) == 0 ? 0 : total_white_votes * 100 / total_participants.to_f
}
end
def total_null_votes
stats_cache('total_null_votes') { total_web_null + total_booth_null }
end
def total_null_percentage
stats_cache('total_null_percentage') {
(total_participants) == 0 ? 0 : total_null_votes * 100 / total_participants.to_f
}
end
def voters
stats_cache('voters') { @poll.voters }
end
def recounts
stats_cache('recounts') { @poll.recounts }
end
def stats_cache(key, &block)
Rails.cache.fetch("polls_stats/#{@poll.id}/#{key}", &block)
end
end
end

View File

@@ -1,23 +0,0 @@
class Poll::TotalResult < ActiveRecord::Base
VALID_ORIGINS = %w{web booth}
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
belongs_to :booth_assignment
belongs_to :officer_assignment
validates :author, presence: true
validates :origin, inclusion: {in: VALID_ORIGINS}
scope :by_author, ->(author_id) { where(author_id: author_id) }
before_save :update_logs
def update_logs
if amount_changed? && amount_was.present?
self.amount_log += ":#{amount_was.to_s}"
self.officer_assignment_id_log += ":#{officer_assignment_id_was.to_s}"
self.author_id_log += ":#{author_id_was.to_s}"
end
end
end

View File

@@ -1,7 +1,7 @@
class Poll
class Voter < ActiveRecord::Base
VALID_ORIGINS = %w{ web booth }
VALID_ORIGINS = %w{web booth}.freeze
belongs_to :poll
belongs_to :user

View File

@@ -1,23 +0,0 @@
class Poll::WhiteResult < ActiveRecord::Base
VALID_ORIGINS = %w{web booth}
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
belongs_to :booth_assignment
belongs_to :officer_assignment
validates :author, presence: true
validates :origin, inclusion: {in: VALID_ORIGINS}
scope :by_author, ->(author_id) { where(author_id: author_id) }
before_save :update_logs
def update_logs
if amount_changed? && amount_was.present?
self.amount_log += ":#{amount_was.to_s}"
self.officer_assignment_id_log += ":#{officer_assignment_id_was.to_s}"
self.author_id_log += ":#{author_id_was.to_s}"
end
end
end

View File

@@ -69,10 +69,10 @@ class Proposal < ActiveRecord::Base
scope :public_for_api, -> { all }
def self.recommendations(user)
tagged_with(user.interests, any: true).
where("author_id != ?", user.id).
unsuccessful.
not_followed_by_user(user)
tagged_with(user.interests, any: true)
.where("author_id != ?", user.id)
.unsuccessful
.not_followed_by_user(user)
end
def self.not_followed_by_user(user)

View File

@@ -60,7 +60,8 @@
<strong><%= t("admin.menu.title_polls") %></strong>
</a>
<ul id="polls_menu" <%= "class=is-active" if menu_polls? || controller.class.parent == Admin::Poll::Questions::Answers %>>
<li <%= "class=active" if ["polls", "officer_assignments", "booth_assignments", "recounts", "results"].include? controller_name %>>
<li <%= "class=active" if controller_name == "polls" && action_name != "booth_assignments" ||
(["booth_assignments", "officer_assignments", "recounts", "results"].include? controller_name) %>>
<%= link_to t('admin.menu.polls'), admin_polls_path %>
</li>
@@ -79,6 +80,10 @@
<%= link_to t('admin.menu.poll_booths'), admin_booths_path %>
</li>
<li <%= "class=active" if (controller_name == "polls" && action_name == "booth_assignments") || (controller_name == "booth_assignments" && action_name == "manage") %>>
<%= link_to t('admin.menu.poll_booth_assignments'), booth_assignments_admin_polls_path %>
</li>
<li <%= "class=active" if controller_name == "shifts" ||
controller_name == "booths" &&
action_name == "available" %>>
@@ -136,7 +141,7 @@
<% if feature?(:legislation) %>
<li class="section-title <%= "active" if controller.class.parent == Admin::Legislation %>">
<%= link_to admin_legislation_processes_path do %>
<span class="icon-edit"></span>
<span class="icon-file-text"></span>
<strong><%= t("admin.menu.legislation") %></strong>
<% end %>
</li>
@@ -156,7 +161,7 @@
<li class="section-title">
<a href="#">
<span class="icon-settings"></span>
<span class="icon-edit"></span>
<strong><%= t("admin.menu.title_site_customization") %></strong>
</a>
<ul <%= "class=is-active" if menu_customization? &&
@@ -178,6 +183,7 @@
<li class="section-title <%= "active" if controller_name == "geozones" %>">
<%= link_to admin_geozones_path do %>
<span class="icon-map-marker"></span>
<strong><%= t('admin.menu.geozones') %></strong>
<% end %>
</li>
@@ -185,6 +191,7 @@
<% if feature?(:signature_sheets) %>
<li class="section-title <%= "active" if controller_name == "signature_sheets" %>">
<%= link_to admin_signature_sheets_path do %>
<span class="icon-file-text-o"></span>
<strong><%= t("admin.menu.signature_sheets") %></strong>
<% end %>
</li>

View File

@@ -2,9 +2,15 @@
<%= render 'shared/filter_subnav', i18n_namespace: "admin.comments.index" %>
<h3><%= page_entries_info @comments %></h3>
<% if @comments.any? %>
<h3 class="margin"><%= page_entries_info @comments %></h3>
<table>
<thead>
<th scope="col" class="small-9"><%= t("admin.shared.description") %></th>
<th scope="col"><%= t("admin.shared.actions") %></th>
</thead>
<tbody>
<% @comments.each do |comment| %>
<tr id="<%= dom_id(comment) %>">
<td>
@@ -15,21 +21,27 @@
<%= link_to comment.commentable.title, comment.commentable %>
<% end %>
</td>
<td class="text-right">
<td>
<%= link_to t("admin.actions.restore"),
restore_admin_comment_path(comment, request.query_parameters),
method: :put,
data: { confirm: t("admin.actions.confirm") },
class: "button hollow on-hover-block" %>
class: "button hollow warning" %>
<% unless comment.confirmed_hide? %>
<%= link_to t("admin.actions.confirm_hide"),
confirm_hide_admin_comment_path(comment, request.query_parameters),
method: :put,
class: "button hollow warning on-hover-block" %>
class: "button" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @comments %>
<% else %>
<div class="callout primary margin">
<%= t("admin.comments.index.no_hidden_comments") %>
</div>
<% end %>

View File

@@ -2,33 +2,47 @@
<%= render 'shared/filter_subnav', i18n_namespace: "admin.debates.index" %>
<h3><%= page_entries_info @debates %></h3>
<% if @debates.any? %>
<h3 class="margin"><%= page_entries_info @debates %></h3>
<table>
<thead>
<th scope="col"><%= t("admin.shared.title") %></th>
<th scope="col" class="small-6"><%= t("admin.shared.description") %></th>
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th>
</thead>
<tbody>
<% @debates.each do |debate| %>
<tr id="<%= dom_id(debate) %>">
<td>
<td class="align-top">
<strong><%= debate.title %></strong>
<br>
</td>
<td>
<div class="moderation-description">
<%= debate.description %>
</div>
</td>
<td class="text-right">
<td class="align-top">
<%= link_to t("admin.actions.restore"),
restore_admin_debate_path(debate, request.query_parameters),
method: :put,
data: { confirm: t("admin.actions.confirm") },
class: "button hollow on-hover" %>
class: "button hollow warning" %>
<% unless debate.confirmed_hide? %>
<%= link_to t("admin.actions.confirm_hide"),
confirm_hide_admin_debate_path(debate, request.query_parameters),
method: :put,
class: "button hollow warning on-hover" %>
class: "button" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @debates %>
<% else %>
<div class="callout primary margin">
<%= t("admin.debates.index.no_hidden_debates") %>
</div>
<% end %>

View File

@@ -2,32 +2,42 @@
<%= render 'shared/filter_subnav', i18n_namespace: "admin.hidden_users.index" %>
<h3><%= page_entries_info @users %></h3>
<% if @users.any? %>
<h3 class="margin"><%= page_entries_info @users %></h3>
<table>
<thead>
<th scope="col" class="small-9"><%= t("admin.hidden_users.index.user") %></th>
<th scope="col"><%= t("admin.shared.actions") %></th>
</thead>
<tbody>
<% @users.each do |user| %>
<tr id="<%= dom_id(user) %>">
<td>
<p><%= link_to user.name, admin_hidden_user_path(user) %></p>
</td>
<td class="text-right">
<td>
<%= link_to t("admin.actions.restore"),
restore_admin_hidden_user_path(user, request.query_parameters),
method: :put,
data: { confirm: t("admin.actions.confirm") },
class: "button hollow on-hover" %>
class: "button hollow warning" %>
<% unless user.confirmed_hide? %>
<%= link_to t("admin.actions.confirm_hide"),
confirm_hide_admin_hidden_user_path(user, request.query_parameters),
method: :put,
class: "button hollow warning on-hover" %>
class: "button" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @users %>
<% else %>
<div class="callout primary margin">
<%= t("admin.hidden_users.index.no_hidden_users") %>
</div>
<% end %>

View File

@@ -1,14 +1,41 @@
<ul class="menu simple clear">
<li <%= "class=active" if active == 'info' %>>
<% if active == 'info' %>
<li class="active">
<h2><%= t("admin.legislation.processes.subnav.info") %></h2>
</li>
<% else %>
<li>
<%= link_to t("admin.legislation.processes.subnav.info"), edit_admin_legislation_process_path(process) %>
</li>
<li <%= "class=active" if active == 'questions' %>>
<% end %>
<% if active == 'questions' %>
<li class="active">
<h2><%= t("admin.legislation.processes.subnav.questions") %></h2>
</li>
<% else %>
<li>
<%= link_to t("admin.legislation.processes.subnav.questions"), admin_legislation_process_questions_path(process) %>
</li>
<li <%= "class=active" if active == 'proposals' %>>
<% end %>
<% if active == 'proposals' %>
<li class="active">
<h2><%= t("admin.legislation.processes.subnav.proposals") %></h2>
</li>
<% else %>
<li>
<%= link_to t("admin.legislation.processes.subnav.proposals"), admin_legislation_process_proposals_path(process) %>
</li>
<li <%= "class=active" if active == 'draft_versions' %>>
<% end %>
<% if active == 'draft_versions' %>
<li class="active">
<h2><%= t("admin.legislation.processes.subnav.draft_texts") %></h2>
</li>
<% else %>
<li>
<%= link_to t("admin.legislation.processes.subnav.draft_texts"), admin_legislation_process_draft_versions_path(process) %>
</li>
<% end %>
</ul>

View File

@@ -0,0 +1,31 @@
<td>
<%= link_to booth.name, admin_booth_path(booth) %>
</td>
<td>
<%= booth.location || t("admin.booths.index.no_location") %>
</td>
<% if booth_assignment.present? %>
<td>
<span class="verified"><%= t("admin.booth_assignments.manage.status.assigned") %></span>
</td>
<td class="text-right">
<%= link_to t("admin.booth_assignments.manage.actions.unassign"),
admin_poll_booth_assignment_path(@poll, booth_assignment, booth_id: booth.id),
method: :delete,
remote: true,
title: t("admin.booth_assignments.manage.actions.unassign"),
class: "button hollow alert" %>
</td>
<% else %>
<td>
<span class="delete"><%= t("admin.booth_assignments.manage.status.unassigned") %></span>
</td>
<td class="text-right">
<%= link_to t("admin.booth_assignments.manage.actions.assign"),
admin_poll_booth_assignments_path(@poll, booth_id: booth.id),
method: :post,
remote: true,
title: t("admin.booth_assignments.manage.actions.assign"),
class: "button" %>
</td>
<% end %>

View File

@@ -0,0 +1,12 @@
<div id="poll-resources">
<h3><%= t("admin.results.index.title") %></h3>
<% if @partial_results.empty? %>
<div class="callout primary margin-top">
<%= t("admin.results.index.no_results") %>
</div>
<% else %>
<%= render "admin/poll/results/recount", resource: @booth_assignment %>
<%= render "admin/poll/results/result" %>
<% end %>
</div>

View File

@@ -12,7 +12,6 @@
<tr>
<th><%= t("admin.poll_booth_assignments.index.table_name") %></th>
<th><%= t("admin.poll_booth_assignments.index.table_location") %></th>
<th class="text-center"><%= t("admin.poll_booth_assignments.index.table_assignment") %></th>
</tr>
</thead>
<tbody>
@@ -24,14 +23,6 @@
<td>
<%= booth.location %>
</td>
<td class="text-center">
<% unless @poll.booth_ids.include?(booth.id) %>
<%= link_to t("admin.poll_booth_assignments.index.add_booth"),
admin_poll_booth_assignments_path(@poll, booth_id: booth.id),
method: :post,
class: "button hollow" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>

View File

@@ -0,0 +1 @@
$("#<%= dom_id(@booth) %>").html('<%= j render("booth_assignment", booth: @booth, booth_assignment: @booth.assignment_on_poll(@poll)) %>');

View File

@@ -0,0 +1 @@
$("#<%= dom_id(@booth) %>").html('<%= j render("booth_assignment", booth: @booth, booth_assignment: @booth.assignment_on_poll(@poll)) %>');

View File

@@ -1,10 +1,15 @@
<%= render "/admin/poll/polls/poll_header" %>
<div id="poll-resources">
<%= render "/admin/poll/polls/subnav" %>
<%= render "search_booths" %>
<h3><%= t("admin.poll_booth_assignments.index.booths_title") %></h3>
<%= link_to t("admin.booth_assignments.manage_assignments"),
manage_admin_poll_booth_assignments_path(@poll),
class: "button hollow float-right" %>
<% if @booth_assignments.empty? %>
<div class="callout primary margin-top">
<%= t("admin.poll_booth_assignments.index.no_booths") %>
@@ -14,7 +19,6 @@
<thead>
<th><%= t("admin.poll_booth_assignments.index.table_name") %></th>
<th><%= t("admin.poll_booth_assignments.index.table_location") %></th>
<th class="text-right"><%= t("admin.poll_booth_assignments.index.table_assignment") %></th>
</thead>
<tbody>
<% @booth_assignments.each do |booth_assignment| %>
@@ -25,13 +29,7 @@
</strong>
</td>
<td>
<%= booth_assignment.booth.location %>
</td>
<td class="text-right">
<%= link_to t("admin.poll_booth_assignments.index.remove_booth"),
admin_poll_booth_assignment_path(@poll, booth_assignment),
method: :delete,
class: "button hollow alert" %>
<%= booth_assignment.booth.location || t("admin.booths.index.no_location") %>
</td>
</tr>
<% end %>

View File

@@ -0,0 +1,28 @@
<%= link_to booth_assignments_admin_polls_path do %>
<span class="icon-angle-left"></span> <%= t("shared.back") %>
<% end %>
<hr>
<h2 class="inline-block"><%= t("admin.booth_assignments.manage.assignments_list", poll: @poll.name) %></h2>
<% if @booths.empty? %>
<div class="callout primary">
<%= t("admin.booths.index.no_booths") %>
</div>
<% else %>
<table>
<thead>
<th><%= t("admin.booths.index.name") %></th>
<th><%= t("admin.booths.index.location") %></th>
<th><%= t("admin.booth_assignments.manage.status.assign_status") %></th>
<th class="text-right"><%= t("admin.actions.actions") %></th>
</thead>
<tbody>
<% @booths.each do |booth| %>
<tr id="<%= dom_id(booth) %>" class="booth">
<%= render partial: "booth_assignment", locals: { booth: booth, booth_assignment: booth.assignment_on_poll(@poll) } %>
</tr>
<% end %>
</tbody>
</table>
<% end %>

View File

@@ -17,9 +17,12 @@
<li class="tabs-title">
<%= link_to t("admin.poll_booth_assignments.show.officers"), "#tab-officers" %>
</li>
<li class="tabs-title is-active">
<li class="tabs-title">
<%= link_to t("admin.poll_booth_assignments.show.recounts"), "#tab-recounts" %>
</li>
<li class="tabs-title is-active">
<%= link_to t("admin.poll_booth_assignments.show.results"), "#tab-results" %>
</li>
</ul>
<div class="tabs-panel" id="tab-officers">
@@ -43,7 +46,7 @@
<% end %>
</div>
<div class="tabs-panel is-active" id="tab-recounts">
<div class="tabs-panel" id="tab-recounts">
<h3><%= t("admin.poll_booth_assignments.show.recounts_list") %></h3>
<table id="totals">
@@ -55,8 +58,12 @@
</thead>
<tbody>
<tr>
<td class="text-center" id="total_final"><%= total_recounts_by_booth(@booth_assignment) || '-' %></td>
<td class="text-center" id="total_system"><%= @booth_assignment.voters.count %></td>
<td class="text-center" id="total_final">
<%= total_recounts_by_booth(@booth_assignment) || '-' %>
</td>
<td class="text-center" id="total_system">
<%= @booth_assignment.voters.count %>
</td>
</tr>
</tbody>
</table>
@@ -79,4 +86,7 @@
</tbody>
</table>
</div>
<div class="tabs-panel is-active" id="tab-results">
<%= render "results" %>
</div>
</div>

View File

@@ -10,7 +10,8 @@
<%= link_to t("admin.booths.booth.shifts"),
new_admin_booth_shift_path(booth),
class: "button hollow" %>
<%= link_to t("admin.actions.edit"),
<% else %>
<%= link_to t("admin.booths.booth.edit"),
edit_admin_booth_path(booth),
class: "button hollow" %>
<% end %>

View File

@@ -11,7 +11,7 @@
<%= t("admin.poll_officer_assignments.index.no_officers") %>
</div>
<% else %>
<table class="fixed margin">
<table class="fixed margin" id="officer_assignments">
<thead>
<th><%= t("admin.poll_officer_assignments.index.table_name") %></th>
<th><%= t("admin.poll_officer_assignments.index.table_email") %></th>

View File

@@ -53,6 +53,17 @@
</div>
</div>
<% if controller_name == "polls" && action_name == "edit" %>
<div class="row">
<fieldset class="fieldset">
<legend><%= t('admin.polls.new.show_results_and_stats') %></legend>
<%= f.check_box :results_enabled, checked: @poll.results_enabled?, label: t('admin.polls.new.show_results') %>
<%= f.check_box :stats_enabled, checked: @poll.stats_enabled?, label: t('admin.polls.new.show_stats') %>
<p class="small"><%= t('admin.polls.new.results_and_stats_reminder') %></p>
</fieldset>
</div>
<% end %>
<div class="row">
<div class="small-12 medium-4 column">
<%= f.submit t("admin.polls.#{admin_submit_action(@poll)}.submit_button"),

View File

@@ -7,7 +7,7 @@
<td>
<%= l poll.starts_at.to_date %> - <%= l poll.ends_at.to_date %>
</td>
<td>
<td class="text-right">
<%= link_to t("admin.actions.edit"),
edit_admin_poll_path(poll),
class: "button hollow" %>

View File

@@ -1,17 +1,25 @@
<%= link_to t("admin.actions.edit"),
<%= link_to t("admin.polls.edit.title"),
edit_admin_poll_path(@poll),
class: "button hollow float-right" %>
<h2 class="inline-block">
<%= @poll.name %>
</h2>
<div class="clear"></div>
<div class="callout highlight">
<div class="inline-block">
<strong><%= t("admin.polls.index.dates") %></strong>
<br>
<span>
(<%= l @poll.starts_at.to_date %> - <%= l @poll.ends_at.to_date %>)
</span>
<%= l @poll.starts_at.to_date %> - <%= l @poll.ends_at.to_date %>
</div>
<% if @poll.geozone_restricted %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span>
<div class="inline-block margin-left">
<strong><%= t("admin.polls.index.geozone_restricted") %></strong>
<br>
<%= @poll.geozones.pluck(:name).to_sentence %>
<span>
</div>
<% end %>
</div>

View File

@@ -0,0 +1,32 @@
<h2 class="inline-block"><%= t("admin.polls.index.title") %></h2>
<% if @polls.any? %>
<table>
<thead>
<th class="medium-6"><%= t("admin.polls.index.name") %></th>
<th><%= t("admin.polls.index.dates") %></th>
<th class="text-right"><%= t("admin.actions.actions") %></th>
</thead>
<tbody>
<% @polls.each do |poll| %>
<tr id="<%= dom_id(poll) %>" class="poll">
<td>
<strong><%= link_to poll.name, admin_poll_path(poll) %></strong>
</td>
<td>
<%= l poll.starts_at.to_date %> - <%= l poll.ends_at.to_date %>
</td>
<td class="text-right">
<%= link_to t("admin.booth_assignments.manage_assignments"),
manage_admin_poll_booth_assignments_path(poll),
class: "button hollow" %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<div class="callout primary">
<%= t("admin.polls.index.no_polls") %>
</div>
<% end %>

View File

@@ -5,11 +5,11 @@
class: "button success float-right" %>
<% if @polls.any? %>
<table class="fixed">
<table>
<thead>
<th><%= t("admin.polls.index.name") %></th>
<th class="medium-6"><%= t("admin.polls.index.name") %></th>
<th><%= t("admin.polls.index.dates") %></th>
<th><%= t("admin.actions.actions") %></th>
<th class="text-right"><%= t("admin.actions.actions") %></th>
</thead>
<tbody>
<%= render @polls %>

View File

@@ -1,6 +1,6 @@
<%= back_link_to %>
<%= link_to t('shared.edit'), edit_admin_answer_path(@answer),
<%= link_to t("admin.answers.show.edit"), edit_admin_answer_path(@answer),
class: "button hollow float-right" %>
<ul class="breadcrumbs margin-top">
@@ -10,23 +10,22 @@
<div class="clear"></div>
<div class="small-12 medium-6">
<div class="callout highlight">
<p>
<strong><%= t("admin.answers.show.title") %></strong>
<br>
<%= @answer.title %>
</p>
<p>
<strong><%= t("admin.answers.show.description") %></strong>
<%= @answer.description %>
</p>
<p>
<strong><%= t("admin.answers.show.images") %></strong>
<br>
<table>
<thead>
<tr>
<th scope="col"><%= t("admin.answers.show.title") %></th>
<th scope="col"><%= t("admin.answers.show.description") %></th>
<th scope="col" class="text-center"><%= t("admin.answers.show.images") %></th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @answer.title %></td>
<td><%= @answer.description %></td>
<td class="text-center">
(<%= @answer.images.count %>)<br>
<%= link_to t("admin.answers.show.images_list"), admin_answer_images_path(@answer) %>
</p>
</div>
</div>
</td>
</tr>
</tbody>
</table>

View File

@@ -1,6 +1,6 @@
<%= back_link_to %>
<%= link_to t('shared.edit'), edit_admin_question_path(@question),
<%= link_to t('admin.questions.show.edit_question'), edit_admin_question_path(@question),
class: "button hollow float-right" %>
<div class="clear"></div>
@@ -8,7 +8,7 @@
<div class="small-12 medium-6">
<div class="callout highlight">
<p>
<strong><%= t("admin.questions.show.title") %></strong>
<strong><%= t("admin.questions.show.question") %></strong>
<br>
<%= @question.title %>
</p>
@@ -35,7 +35,7 @@
<%= t('admin.questions.show.valid_answers') %>
<%= link_to t("admin.questions.show.add_answer"),
new_admin_question_answer_path(@question),
class: "button hollow float-right" %>
class: "button float-right" %>
</th>
</tr>
@@ -47,23 +47,24 @@
<th scope="col" class="text-center"><%= t("admin.questions.show.answers.videos") %></th>
</tr>
<tbody class="sortable" data-js-url="<%= admin_question_answers_order_answers_path(@question.id) %>">
<% @question.question_answers.each do |answer| %>
<tr id="<%= dom_id(answer) %>" class="poll_question_answer">
<td><%= link_to answer.title, admin_answer_path(answer) %></td>
<td><%= answer.description %></td>
<td class="text-center">
<tr id="<%= dom_id(answer) %>" class="poll_question_answer" data-answer-id="<%= answer.id %>">
<td class="align-top"><%= link_to answer.title, admin_answer_path(answer) %></td>
<td class="align-top break"><%= answer.description %></td>
<td class="align-top text-center">
(<%= answer.images.count %>)
<br>
<%= link_to t("admin.questions.show.answers.images_list"),
admin_answer_images_path(answer) %>
</td>
<td class="text-center">
<td class="align-top text-center">
(<%= answer.documents.count rescue 0 %>)
<br>
<%= link_to t("admin.questions.show.answers.documents_list"),
admin_answer_documents_path(answer) %>
</td>
<td class="text-center">
<td class="align-top text-center">
(<%= answer.videos.count %>)
<br>
<%= link_to t("admin.questions.show.answers.video_list"),
@@ -71,6 +72,7 @@
</td>
</tr>
<% end %>
</tbody>
</table>
<% if @question.video_url.present? %>

View File

@@ -0,0 +1,14 @@
<table class="margin">
<thead>
<th><%= t("admin.results.result.table_whites") %></th>
<th><%= t("admin.results.result.table_nulls") %></th>
<th><%= t("admin.results.result.table_total") %></th>
</thead>
<tbody>
<tr>
<td id="white_results"><%= resource.recounts.sum(:white_amount) %></td>
<td id="null_results"><%= resource.recounts.sum(:null_amount) %></td>
<td id="total_results"><%= resource.recounts.sum(:total_amount) %></td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,21 @@
<% by_question = @partial_results.group_by(&:question_id) %>
<% @poll.questions.each do |question| %>
<h3><%= question.title %></h3>
<table class="margin">
<thead>
<tr>
<th><%= t("admin.results.result.table_answer") %></th>
<th class="text-center"><%= t("admin.results.result.table_votes") %></th>
</tr>
</thead>
<tbody>
<% question.question_answers.each_with_index do |answer, i| %>
<% by_answer = by_question[question.id].present? ? by_question[question.id].group_by(&:answer) : {} %>
<tr id="question_<%= question.id %>_<%= i %>_result">
<td><%= answer.title %></td>
<td class="text-center"><%= by_answer[answer.title].present? ? by_answer[answer.title].sum(&:amount) : 0 %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>

View File

@@ -0,0 +1,20 @@
<h3><%= t("admin.results.results_by_booth.title") %></h3>
<table class="margin" id="booth_assignment_results">
<thead>
<tr>
<th><%= t("admin.results.results_by_booth.booth") %></th>
<th class="text-center"><%= t("admin.results.results_by_booth.results") %></th>
</tr>
</thead>
<tbody>
<% @poll.booth_assignments.sort_by {|ba| ba.booth.name }.each do |booth_assignment| %>
<tr id="booth_assignment_<%= booth_assignment.id %>_result">
<td><%= booth_assignment.booth.name %></td>
<td class="text-center">
<%= link_to t("admin.results.results_by_booth.see_results"),
admin_poll_booth_assignment_path(@poll, booth_assignment, anchor: "tab-results") %>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -9,44 +9,8 @@
<%= t("admin.results.index.no_results") %>
</div>
<% else %>
<table class="margin">
<thead>
<th><%= t("admin.results.index.table_whites") %></th>
<th><%= t("admin.results.index.table_nulls") %></th>
<th><%= t("admin.results.index.table_total") %></th>
</thead>
<tbody>
<tr>
<td id="white_results"><%= @poll.recounts.sum(:white_amount) %></td>
<td id="null_results"><%= @poll.recounts.sum(:null_amount) %></td>
<td id="total_results"><%= @poll.recounts.sum(:total_amount) %></td>
</tr>
</tbody>
</table>
<% by_question = @partial_results.group_by(&:question_id) %>
<% @poll.questions.each do |question| %>
<h3><%= question.title %></h3>
<table class="margin">
<thead>
<tr>
<th><%= t("admin.results.index.table_answer") %></th>
<th class="text-center"><%= t("admin.results.index.table_votes") %></th>
</tr>
</thead>
<tbody>
<% question.valid_answers.each_with_index do |answer, i| %>
<% by_answer = by_question[question.id].present? ? by_question[question.id].group_by(&:answer) : {} %>
<tr id="question_<%= question.id %>_<%= i %>_result">
<td><%= answer %></td>
<td class="text-center"><%= by_answer[answer].present? ? by_answer[answer].sum(&:amount) : 0 %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<%= render "recount", resource: @poll %>
<%= render "result" %>
<%= render "results_by_booth" %>
<% end %>
</div>

View File

@@ -24,12 +24,12 @@
<div class="small-12 medium-3 column">
<label><%= t("admin.poll_shifts.new.date") %></label>
<%= select 'shift[date]', 'vote_collection_date',
options_for_select(shift_vote_collection_dates(@booth.polls)),
{ prompt: t("admin.poll_shifts.new.select_date"),
options_for_select(shift_vote_collection_dates(@booth, @voting_polls)),
{ prompt: @voting_polls.present? ? t("admin.poll_shifts.new.select_date") : t("admin.poll_shifts.new.no_voting_days"),
label: false },
class: 'js-shift-vote-collection-dates' %>
<%= select 'shift[date]', 'recount_scrutiny_date',
options_for_select(shift_recount_scrutiny_dates(@booth.polls)),
options_for_select(shift_recount_scrutiny_dates(@booth, @recount_polls)),
{ prompt: t("admin.poll_shifts.new.select_date"),
label: false },
class: 'js-shift-recount-scrutiny-dates',

View File

@@ -1,4 +1,4 @@
<%= back_link_to admin_booths_path %>
<%= back_link_to available_admin_booths_path %>
<h2><%= @booth.name %></h2>

View File

@@ -2,16 +2,24 @@
<%= render 'shared/filter_subnav', i18n_namespace: "admin.proposals.index" %>
<h3><%= page_entries_info @proposals %></h3>
<% if @proposals.any? %>
<h3 class="margin"><%= page_entries_info @proposals %></h3>
<table>
<thead>
<th scope="col"><%= t("admin.shared.title") %></th>
<th scope="col" class="small-6"><%= t("admin.shared.description") %></th>
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th>
</thead>
<tbody>
<% @proposals.each do |proposal| %>
<tr id="<%= dom_id(proposal) %>">
<td>
<td class="align-top">
<strong><%= proposal.title %></strong>
<br>
</td>
<td>
<div class="moderation-description">
<p><%= proposal.summary %></p>
<p><small><%= proposal.summary %></small></p>
<%= proposal.description %>
<% if proposal.external_url.present? %>
<p><%= text_with_links proposal.external_url %></p>
@@ -22,21 +30,27 @@
<p><%= proposal.question %></p>
</div>
</td>
<td class="text-right">
<td class="align-top">
<%= link_to t("admin.actions.restore"),
restore_admin_proposal_path(proposal, request.query_parameters),
method: :put,
data: { confirm: t("admin.actions.confirm") },
class: "button hollow on-hover-block" %>
class: "button hollow warning" %>
<% unless proposal.confirmed_hide? %>
<%= link_to t("admin.actions.confirm_hide"),
confirm_hide_admin_proposal_path(proposal, request.query_parameters),
method: :put,
class: "button hollow warning on-hover-block" %>
class: "button" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @proposals %>
<% else %>
<div class="callout primary margin">
<%= t("admin.proposals.index.no_hidden_proposals") %>
</div>
<% end %>

View File

@@ -1,3 +1,4 @@
<% if current_user.administrator? %>
<li>
<%= link_to admin_stats_path, title: t("admin.menu.stats") do %>
<span class="icon-stats"></span>
@@ -8,3 +9,4 @@
<span class="icon-settings"></span>
<% end %>
</li>
<% end %>

View File

@@ -1,39 +1,40 @@
<h2><%= t("admin.tags.index.add_tag") %></h2>
<%= form_for(@tag, url: admin_tags_path, as: :tag) do |f| %>
<div class="row">
<div class="small-12 medium-6 column">
<div class="small-12 medium-6">
<%= f.label :name, t("admin.tags.name.placeholder") %>
<%= f.text_field :name, placeholder: t("admin.tags.name.placeholder"), label: false %>
</div>
</div>
<%= f.submit(t("admin.tags.create"), class: "button success") %>
<% end %>
<h3><%= t("admin.tags.index.title") %>: <%= page_entries_info @tags %></h3>
<hr>
<h3 class="margin"><%= t("admin.tags.index.title") %>: <%= page_entries_info @tags %></h3>
<table>
<thead>
<th scope="col" class="small-9"><%= t("admin.tags.index.topic") %></th>
<th scope="col"><%= t("admin.actions.actions") %></th>
</thead>
<tbody>
<% @tags.each do |tag| %>
<tr>
<td class="with-button">
<td>
<%= form_for(tag,
url: admin_tag_path(tag),
as: :tag,
html: { id: "edit_tag_#{tag.id}", class: "text-right"}) do |f| %>
html: { id: "edit_tag_#{tag.id}"}) do |f| %>
<span class="float-left text-left">
<strong><%= tag.name %></strong>
</span>
<%= link_to t("admin.tags.destroy"), admin_tag_path(tag), method: :delete, class: "button hollow alert on-hover" %>
<% end %>
</td>
<td id="tag_<%= tag.id %>">
<%= link_to t("admin.tags.destroy"), admin_tag_path(tag), method: :delete, class: "button hollow alert" %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @tags %>

View File

@@ -1,7 +1,7 @@
<div class="row">
<div class="small-12 column margin-top">
<%= back_link_to commentable_path(@comment),
t("comments.show.return_to_commentable") + @comment.commentable.title %>
t("comments.show.return_to_commentable") + @comment.commentable.title unless @commentable.class == Poll %>
</div>
</div>

View File

@@ -9,13 +9,6 @@
<div class="small-12 medium-9 column">
<%= back_link_to %>
<% if current_user && @debate.editable_by?(current_user) %>
<%= link_to edit_debate_path(@debate), class: 'edit-debate button success small float-right' do %>
<span class="icon-edit"></span>
<%= t("debates.show.edit_debate_link") %>
<% end %>
<% end %>
<h1><%= @debate.title %></h1>
<% if @debate.conflictive? %>
<div data-alert class="callout alert margin-top">
@@ -47,6 +40,15 @@
</div>
<aside class="small-12 medium-3 column">
<% if current_user && @debate.editable_by?(current_user) %>
<div class="sidebar-divider"></div>
<h2><%= t("debates.show.author") %></h2>
<%= link_to edit_debate_path(@debate), class: 'button hollow expanded' do %>
<span class="icon-edit"></span>
<%= t("debates.show.edit_debate_link") %>
<% end %>
<% end %>
<div class="sidebar-divider"></div>
<h2><%= t("votes.supports") %></h2>
<div id="<%= dom_id(@debate) %>_votes">

View File

@@ -6,8 +6,14 @@
<span class="icon-circle" aria-hidden="true"></span>
<span class="icon-notification" aria-hidden="true" title="<%= t('layouts.header.new_notifications', count: current_user.notifications_count).html_safe %>">
</span>
<small class="show-for-small-only">
<%= t('layouts.header.new_notifications', count: current_user.notifications_count).html_safe %>
</small>
<% else %>
<span class="icon-no-notification" aria-hidden="true" title="<%= t('layouts.header.no_notifications') %>"></span>
<small class="show-for-small-only">
<%= t('layouts.header.no_notifications') %>
</small>
<% end %>
<% end %>
</li>

View File

@@ -8,7 +8,7 @@
<div class="expanded row">
<div class="top-bar">
<span data-responsive-toggle="responsive-menu" data-hide-for="medium" class="float-right">
<span data-responsive-toggle="responsive_menu" data-hide-for="medium" class="float-right">
<span class="menu-icon dark" data-toggle></span>
<%= t("application.menu")%>
</span>
@@ -22,10 +22,10 @@
<% end %>
</h1>
</div>
<div id="responsive-menu">
<div id="responsive_menu">
<div class="top-bar-right">
<ul class="dropdown menu" data-dropdown-menu>
<ul class="menu" data-responsive-menu="medium-dropdown">
<%= render "admin/shared/admin_shortcuts" %>
<%= render "shared/admin_login_items" %>
<%= render "devise/menu/login_items" %>

View File

@@ -14,12 +14,12 @@
<%= link_to setting['org_name'], root_path, class: "logo show-for-small-only" %>
<span data-responsive-toggle="responsive-menu" data-hide-for="medium" class="float-right">
<span data-responsive-toggle="responsive_menu" data-hide-for="medium" class="float-right">
<span class="menu-icon dark" data-toggle></span>
<%= t("application.menu")%>
</span>
<div id="responsive-menu">
<div id="responsive_menu">
<div class="top-bar-title">
<%= link_to root_path, class: "hide-for-small-only", accesskey: "0" do %>
<%= image_tag(image_path_for('logo_header.png'), class: 'hide-for-small-only float-left', size: '80x80', alt: t("layouts.header.logo")) %>
@@ -28,7 +28,7 @@
</div>
<div class="top-bar-right">
<ul class="dropdown menu" data-dropdown-menu>
<ul class="menu" data-responsive-menu="medium-dropdown">
<%= render "shared/admin_login_items" %>
<%= render "devise/menu/login_items" %>
</ul>

View File

@@ -18,10 +18,6 @@
<div class="off-canvas-wrapper-inner" data-off-canvas-wrapper>
<div class="off-canvas position-left" id="offCanvas" data-off-canvas>
<button class="close-button" aria-label="Close menu" type="button" data-close>
<span aria-hidden="true">&times;</span>
</button>
<div class="show-for-small-only">
<%= side_menu %>
</div>

View File

@@ -15,30 +15,25 @@
</head>
<body class="admin">
<header>
<section class="top-links">
<header class="header">
<div class="top-links">
<div class="expanded row">
<%= render 'shared/locale_switcher' %>
</div>
</section>
</div>
<div class="expanded row">
<div class="top-bar">
<%= link_to setting['org_name'], management_root_path, class: "logo show-for-small-only" %>
<span data-responsive-toggle="responsive-menu" data-hide-for="medium" class="float-right">
<span class="menu-icon dark" data-toggle></span>
<%= t("application.menu")%>
</span>
<div id="responsive-menu">
<div class="top-bar-title">
<%= link_to management_root_path, class: "hide-for-small-only" do %>
<%= image_tag(image_path_for('logo_header.png'), class: 'hide-for-small-only float-left', size: '80x80', alt: t("layouts.header.logo")) %>
<h1>
<%= link_to management_root_path do %>
<%= setting['org_name'] %>
&nbsp;|&nbsp;<%= t("management.dashboard.index.title") %>
<br><small><%= t("management.dashboard.index.title") %></small>
<% end %>
</h1>
</div>
</div>
</div>

View File

@@ -40,11 +40,11 @@
</tr>
</thead>
<tbody>
<% question.valid_answers.each_with_index do |answer, i| %>
<% question.question_answers.each_with_index do |answer, i| %>
<% by_answer = by_question[question.id].present? ? by_question[question.id].group_by(&:answer) : {} %>
<tr id="question_<%= question.id %>_<%= i %>_result">
<td><%= answer %></td>
<td><%= by_answer[answer].present? ? by_answer[answer].first.amount : 0 %></td>
<td><%= answer.title %></td>
<td><%= by_answer[answer.title].present? ? by_answer[answer.title].first.amount : 0 %></td>
</tr>
<% end %>
</tbody>

View File

@@ -12,24 +12,14 @@
</div>
</div>
<div class="row">
<div class="small-12 medium-6 column">
<label><%= t("officing.results.new.date") %></label>
<%= select_tag :date,
poll_dates_select_options(@poll),
{ prompt: t("officing.results.new.select_date"),
label: false } %>
</div>
</div>
<% @poll.questions.each do |question| %>
<div class="row">
<div class="small-12 column">
<h3><%= question.title %></h3>
</div>
<% question.valid_answers.each_with_index do |answer, i| %>
<% question.question_answers.each_with_index do |answer, i| %>
<div class="small-12 medium-6 large-3 column end">
<label><%= answer %></label>
<label><%= answer.title %></label>
<%= text_field_tag "questions[#{question.id}][#{i}]", answer_result_value(question.id, i), placeholder: "0" %>
</div>
<% end %>
@@ -101,4 +91,3 @@
</table>
<% end %>

Some files were not shown because too many files have changed in this diff Show More