Merge branch 'master' into budget

This commit is contained in:
kikito
2016-11-28 11:41:49 +01:00
219 changed files with 3311 additions and 1189 deletions

56
.rubocop.yml Normal file
View File

@@ -0,0 +1,56 @@
inherit_from: .rubocop_todo.yml
AllCops:
Include:
- '**/Rakefile'
- '**/config.ru'
Exclude:
- 'db/**/*'
- 'config/**/*'
- 'script/**/*'
TargetRubyVersion: 2.3
Rails:
Enabled: true
Documentation:
Enabled: false
Metrics/LineLength:
Max: 140
Style/IndentationConsistency:
EnforcedStyle: rails
Style/StringLiterals:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
Style/PercentLiteralDelimiters:
Enabled: false
Style/EmptyLinesAroundClassBody:
Enabled: false
Style/EmptyLinesAroundBlockBody:
Enabled: false
Style/EmptyLinesAroundModuleBody:
Enabled: false
Style/SpaceBeforeBlockBraces:
Enabled: false
Style/SpaceInsideBrackets:
Enabled: false
Style/SpaceInsideHashLiteralBraces:
Enabled: false
Style/SpaceInsideBlockBraces:
Enabled: false
Style/TrailingBlankLines:
Enabled: false

838
.rubocop_todo.yml Normal file
View File

@@ -0,0 +1,838 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2016-11-25 13:34:56 +0100 using RuboCop version 0.45.0.
# 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: 3
Lint/AmbiguousRegexpLiteral:
Exclude:
- 'app/helpers/verification_helper.rb'
- 'spec/features/verification/residence_spec.rb'
# Offense count: 3
# Configuration parameters: AllowSafeAssignment.
Lint/AssignmentInCondition:
Exclude:
- 'app/controllers/management/sessions_controller.rb'
- 'app/models/notification.rb'
- 'lib/capistrano/template.rb'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: AlignWith, SupportedStyles.
# SupportedStyles: either, start_of_block, start_of_line
Lint/BlockAlignment:
Exclude:
- 'spec/features/tracks_spec.rb'
- 'spec/models/proposal_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
# SupportedStyles: start_of_line, def
Lint/DefEndAlignment:
Exclude:
- 'app/controllers/comments_controller.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: runtime_error, standard_error
Lint/InheritException:
Exclude:
- 'app/controllers/concerns/feature_flags.rb'
# Offense count: 7
Lint/NestedMethodDefinition:
Exclude:
- 'lib/acts_as_paranoid_aliases.rb'
# Offense count: 13
Lint/ParenthesesAsGroupedExpression:
Exclude:
- 'spec/features/admin/organizations_spec.rb'
- 'spec/features/debates_spec.rb'
- 'spec/features/proposals_spec.rb'
- 'spec/models/debate_spec.rb'
# Offense count: 1
Lint/UnderscorePrefixedVariableName:
Exclude:
- 'lib/manager_authenticator.rb'
# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
Lint/UnusedBlockArgument:
Exclude:
- 'app/controllers/admin/spending_proposals_controller.rb'
- 'app/models/ahoy/data_source.rb'
- 'spec/spec_helper.rb'
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
Lint/UnusedMethodArgument:
Exclude:
- 'app/controllers/organizations/registrations_controller.rb'
- 'app/controllers/users/omniauth_callbacks_controller.rb'
- 'app/controllers/users/registrations_controller.rb'
- 'app/models/abilities/everyone.rb'
- 'app/models/abilities/valuator.rb'
# Offense count: 135
Lint/UselessAssignment:
Enabled: false
# Offense count: 41
Metrics/AbcSize:
Max: 44
# Offense count: 4
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 205
# Offense count: 5
Metrics/CyclomaticComplexity:
Max: 8
# Offense count: 52
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives.
# URISchemes: http, https
Metrics/LineLength:
Max: 307
# Offense count: 28
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 38
# Offense count: 2
# Configuration parameters: CountComments.
Metrics/ModuleLength:
Max: 193
# Offense count: 3
Metrics/PerceivedComplexity:
Max: 11
# Offense count: 1
# Cop supports --auto-correct.
Performance/RedundantBlockCall:
Exclude:
- 'app/mailers/mailer.rb'
# Offense count: 4
# Cop supports --auto-correct.
Performance/RedundantMatch:
Exclude:
- 'app/controllers/valuation/spending_proposals_controller.rb'
- 'app/helpers/embed_videos_helper.rb'
# Offense count: 2
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: strict, flexible
Rails/Date:
Exclude:
- 'app/controllers/concerns/commentable_actions.rb'
- 'app/models/direct_message.rb'
# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: Whitelist.
# Whitelist: find_by_sql
Rails/DynamicFindBy:
Exclude:
- 'app/controllers/users/confirmations_controller.rb'
- 'app/controllers/users/registrations_controller.rb'
- 'spec/features/management/users_spec.rb'
# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/FindBy:
Exclude:
- 'app/models/setting.rb'
- 'app/models/verification/email.rb'
- 'app/models/verification/management/email.rb'
- 'app/models/verification/residence.rb'
# Offense count: 24
# Cop supports --auto-correct.
# Configuration parameters: Include.
# Include: spec/**/*, test/**/*
Rails/HttpPositionalArguments:
Exclude:
- 'spec/controllers/admin/api/stats_controller_spec.rb'
- 'spec/controllers/concerns/has_filters_spec.rb'
- 'spec/controllers/concerns/has_orders_spec.rb'
- 'spec/controllers/debates_controller_spec.rb'
- 'spec/controllers/management/sessions_controller_spec.rb'
- 'spec/controllers/pages_controller_spec.rb'
- 'spec/controllers/users/registrations_controller_spec.rb'
# Offense count: 12
Rails/OutputSafety:
Exclude:
- '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: 6
# Cop supports --auto-correct.
Rails/PluralizationGrammar:
Exclude:
- 'spec/features/admin/banners_spec.rb'
- 'spec/features/debates_spec.rb'
- 'spec/features/proposals_spec.rb'
- 'spec/models/residence_spec.rb'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: referer, referrer
Rails/RequestReferer:
Exclude:
- 'app/controllers/users/sessions_controller.rb'
# Offense count: 11
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: strict, flexible
Rails/TimeZone:
Exclude:
- 'lib/score_calculator.rb'
- 'spec/controllers/admin/api/stats_controller_spec.rb'
- 'spec/models/ahoy/data_source_spec.rb'
# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/Validation:
Exclude:
- 'app/models/comment.rb'
- 'app/models/spending_proposal.rb'
- 'app/models/verification/residence.rb'
- 'app/models/verification/sms.rb'
# Offense count: 9
Style/AccessorMethodName:
Exclude:
- 'app/controllers/application_controller.rb'
- 'app/controllers/concerns/commentable_actions.rb'
- 'app/controllers/management/proposals_controller.rb'
- 'app/controllers/management/spending_proposals_controller.rb'
- 'app/controllers/proposals_controller.rb'
# Offense count: 30
# Cop supports --auto-correct.
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
Style/AlignHash:
Exclude:
- 'spec/features/admin/banners_spec.rb'
# Offense count: 21
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: with_first_parameter, with_fixed_indentation
Style/AlignParameters:
Exclude:
- 'app/helpers/search_helper.rb'
- 'app/models/verification/management/email.rb'
- 'bin/rspec'
- 'bin/spring'
- 'spec/features/admin/spending_proposals_spec.rb'
- 'spec/features/spending_proposals_spec.rb'
- 'spec/features/valuation/spending_proposals_spec.rb'
- 'spec/features/verification/verified_user_spec.rb'
- 'spec/i18n_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/rails_helper.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: always, conditionals
Style/AndOr:
Exclude:
- 'app/helpers/embed_videos_helper.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
# SupportedStyles: line_count_based, semantic, braces_for_chaining
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
# FunctionalMethods: let, let!, subject, watch
# IgnoredMethods: lambda, proc, it
Style/BlockDelimiters:
Exclude:
- 'spec/features/users_auth_spec.rb'
# Offense count: 2
# Cop supports --auto-correct.
Style/BlockEndNewline:
Exclude:
- 'app/models/banner.rb'
- 'spec/features/users_auth_spec.rb'
# Offense count: 19
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: braces, no_braces, context_dependent
Style/BracesAroundHashParameters:
Exclude:
- 'app/controllers/valuation/spending_proposals_controller.rb'
- 'app/models/concerns/searchable.rb'
- 'app/models/verification/residence.rb'
- 'lib/manager_authenticator.rb'
- 'spec/controllers/management/users_controller_spec.rb'
- 'spec/features/admin/spending_proposals_spec.rb'
- 'spec/lib/manager_authenticator_spec.rb'
- 'spec/models/residence_spec.rb'
- 'spec/models/user_spec.rb'
# Offense count: 57
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Enabled: false
# Offense count: 5
Style/ClassVars:
Exclude:
- 'app/models/concerns/measurable.rb'
- 'app/models/organization.rb'
- 'app/models/user.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/ClosingParenthesisIndentation:
Exclude:
- 'spec/rails_helper.rb'
# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly.
# SupportedStyles: assign_to_condition, assign_inside_condition
Style/ConditionalAssignment:
Exclude:
- 'app/controllers/comments_controller.rb'
- 'app/controllers/management/spending_proposals_controller.rb'
- 'app/controllers/spending_proposals_controller.rb'
- 'app/controllers/verification/sms_controller.rb'
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: leading, trailing
Style/DotPosition:
Exclude:
- 'app/models/banner.rb'
- 'app/models/tag_cloud.rb'
- 'app/models/verification/management/managed_user.rb'
# Offense count: 1
Style/DoubleNegation:
Exclude:
- 'app/models/flag.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/EmptyCaseCondition:
Exclude:
- 'app/models/concerns/verification.rb'
# Offense count: 9
# Cop supports --auto-correct.
Style/EmptyLines:
Exclude:
- 'app/models/concerns/search_cache.rb'
- 'app/models/notification.rb'
- 'spec/features/admin/spending_proposals_spec.rb'
- 'spec/features/admin/verifications_spec.rb'
- 'spec/features/debates_spec.rb'
- 'spec/features/registration_form_spec.rb'
- 'spec/features/users_auth_spec.rb'
- 'spec/features/verification/verified_user_spec.rb'
- 'spec/support/verifiable.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/EmptyLinesAroundAccessModifier:
Exclude:
- 'app/controllers/users_controller.rb'
# Offense count: 29
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
Style/ExtraSpacing:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: consistent, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
Style/FirstParameterIndentation:
Exclude:
- 'app/controllers/users_controller.rb'
# Offense count: 32
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Enabled: false
# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
Style/HashSyntax:
Exclude:
- 'lib/sms_api.rb'
- 'spec/factories.rb'
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: MaxLineLength.
Style/IfUnlessModifier:
Exclude:
- 'app/controllers/annotations_controller.rb'
- 'app/controllers/verification/letter_controller.rb'
- 'app/controllers/welcome_controller.rb'
- 'app/helpers/embed_videos_helper.rb'
- 'app/models/proposal.rb'
- 'app/models/spending_proposal.rb'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
Style/IndentArray:
EnforcedStyle: consistent
# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_braces
Style/IndentHash:
EnforcedStyle: consistent
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: normal, rails
Style/IndentationConsistency:
Exclude:
- 'spec/features/tracks_spec.rb'
- 'spec/models/proposal_spec.rb'
# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: Width.
Style/IndentationWidth:
Exclude:
- 'app/controllers/annotations_controller.rb'
- 'app/helpers/flags_helper.rb'
- 'app/mailers/devise_mailer.rb'
- 'app/mailers/mailer.rb'
- 'app/models/ahoy/data_source.rb'
- 'app/models/comment_notifier.rb'
- 'app/models/concerns/search_cache.rb'
- 'spec/features/comments/proposals_spec.rb'
- 'spec/features/moderation/users_spec.rb'
- 'spec/features/tracks_spec.rb'
- 'spec/features/verification/verified_user_spec.rb'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: line_count_dependent, lambda, literal
Style/Lambda:
Exclude:
- 'app/models/banner.rb'
- 'app/models/direct_message.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/MethodCallParentheses:
Exclude:
- 'app/controllers/management/document_verifications_controller.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
Style/MethodDefParentheses:
Exclude:
- 'spec/helpers/comments_helper_spec.rb'
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: symmetrical, new_line, same_line
Style/MultilineArrayBraceLayout:
Exclude:
- 'app/controllers/valuation/spending_proposals_controller.rb'
- 'app/helpers/search_helper.rb'
# Offense count: 1
Style/MultilineBlockChain:
Exclude:
- 'app/controllers/valuation/spending_proposals_controller.rb'
# Offense count: 2
# Cop supports --auto-correct.
Style/MultilineBlockLayout:
Exclude:
- 'app/models/banner.rb'
- 'spec/features/users_auth_spec.rb'
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: symmetrical, new_line, same_line
Style/MultilineHashBraceLayout:
Exclude:
- 'app/controllers/valuation/spending_proposals_controller.rb'
- 'app/models/debate.rb'
- 'app/models/proposal.rb'
- 'app/models/spending_proposal.rb'
# Offense count: 2
# Cop supports --auto-correct.
Style/MultilineIfThen:
Exclude:
- 'app/controllers/management/users_controller.rb'
- 'lib/census_api.rb'
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: symmetrical, new_line, same_line
Style/MultilineMethodCallBraceLayout:
Exclude:
- 'app/controllers/users_controller.rb'
- 'app/models/comment.rb'
- 'app/models/organization.rb'
- 'app/models/user.rb'
- 'spec/rails_helper.rb'
# Offense count: 33
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: aligned, indented, indented_relative_to_receiver
Style/MultilineMethodCallIndentation:
Exclude:
- 'app/models/banner.rb'
- 'app/models/tag_cloud.rb'
- 'app/models/verification/management/managed_user.rb'
- 'spec/models/comment_spec.rb'
- 'spec/models/debate_spec.rb'
- 'spec/models/proposal_spec.rb'
- 'spec/models/user_spec.rb'
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: aligned, indented
Style/MultilineOperationIndentation:
Exclude:
- 'app/helpers/users_helper.rb'
- 'app/helpers/valuation_helper.rb'
- 'app/models/verification/letter.rb'
# Offense count: 5
# Cop supports --auto-correct.
Style/MutableConstant:
Exclude:
- 'app/models/activity.rb'
- 'app/models/proposal.rb'
- 'lib/tag_sanitizer.rb'
- 'lib/wysiwyg_sanitizer.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/NegatedIf:
Exclude:
- 'spec/spec_helper.rb'
# Offense count: 17
# Cop supports --auto-correct.
Style/NestedParenthesizedCalls:
Exclude:
- 'spec/features/debates_spec.rb'
- 'spec/features/valuation/spending_proposals_spec.rb'
- 'spec/helpers/settings_helper_spec.rb'
- 'spec/helpers/verification_helper_spec.rb'
# Offense count: 12
# Cop supports --auto-correct.
Style/NumericLiterals:
MinDigits: 9
# Offense count: 19
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
- 'spec/**/*'
- 'app/controllers/users_controller.rb'
- 'app/controllers/valuation/spending_proposals_controller.rb'
- 'app/helpers/banners_helper.rb'
- 'app/helpers/debates_helper.rb'
- 'app/helpers/votes_helper.rb'
- 'app/models/concerns/conflictable.rb'
- 'app/models/concerns/taggable.rb'
- 'app/models/concerns/verification.rb'
- 'app/models/debate.rb'
- 'app/models/lock.rb'
- 'app/models/user.rb'
- 'app/models/verification/management/email.rb'
- 'lib/score_calculator.rb'
# Offense count: 2
# Cop supports --auto-correct.
Style/ParallelAssignment:
Exclude:
- 'lib/active_model/dates.rb'
- 'spec/support/common_actions.rb'
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: AllowSafeAssignment.
Style/ParenthesesAroundCondition:
Exclude:
- 'app/controllers/proposals_controller.rb'
- 'app/models/debate.rb'
- 'app/models/proposal.rb'
# Offense count: 6
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
# NamePrefix: is_, has_, have_
# NamePrefixBlacklist: is_, has_, have_
# NameWhitelist: is_a?
Style/PredicateName:
Exclude:
- 'spec/**/*'
- 'app/controllers/concerns/has_filters.rb'
- 'app/controllers/concerns/has_orders.rb'
- 'app/helpers/banners_helper.rb'
- 'app/helpers/debates_helper.rb'
- 'app/models/user.rb'
- 'lib/census_api.rb'
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: compact, exploded
Style/RaiseArgs:
Exclude:
- 'app/controllers/management/base_controller.rb'
- 'app/controllers/users/omniauth_callbacks_controller.rb'
- 'app/controllers/valuation/spending_proposals_controller.rb'
# Offense count: 16
# Cop supports --auto-correct.
Style/RedundantParentheses:
Exclude:
- 'app/controllers/admin/settings_controller.rb'
- 'app/helpers/proposals_helper.rb'
- 'spec/features/admin/organizations_spec.rb'
- 'spec/features/debates_spec.rb'
- 'spec/features/proposals_spec.rb'
- 'spec/models/debate_spec.rb'
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: AllowMultipleReturnValues.
Style/RedundantReturn:
Exclude:
- 'app/models/ahoy/data_source.rb'
- 'app/models/verification/management/document.rb'
- 'lib/capistrano/template.rb'
- 'lib/census_api.rb'
# Offense count: 49
# Cop supports --auto-correct.
Style/RedundantSelf:
Enabled: false
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed
Style/RegexpLiteral:
Exclude:
- 'app/helpers/embed_videos_helper.rb'
- 'spec/customization_engine_spec.rb'
# Offense count: 2
# Cop supports --auto-correct.
Style/RescueModifier:
Exclude:
- 'app/controllers/concerns/commentable_actions.rb'
- 'app/controllers/verification/sms_controller.rb'
# Offense count: 2
# Cop supports --auto-correct.
Style/SpaceAfterColon:
Exclude:
- 'spec/models/user_spec.rb'
# Offense count: 14
# Cop supports --auto-correct.
Style/SpaceAfterComma:
Exclude:
- 'app/models/ahoy/data_source.rb'
- 'app/models/banner.rb'
- 'app/models/concerns/search_cache.rb'
- 'app/models/concerns/taggable.rb'
- 'app/models/spending_proposal.rb'
- 'app/models/user.rb'
- 'spec/features/valuation/spending_proposals_spec.rb'
- 'spec/lib/census_api_spec.rb'
- 'spec/models/abilities/moderator_spec.rb'
- 'spec/models/verification/management/email_spec.rb'
# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceAfterNot:
Exclude:
- 'app/models/flag.rb'
# Offense count: 20
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: space, no_space
Style/SpaceAroundEqualsInParameterDefault:
Exclude:
- 'app/helpers/cache_keys_helper.rb'
- 'app/helpers/proposals_helper.rb'
- 'app/helpers/spending_proposals_helper.rb'
- 'app/helpers/stats_helper.rb'
- 'app/helpers/tracks_helper.rb'
- 'app/helpers/valuation_helper.rb'
- 'app/mailers/devise_mailer.rb'
- 'app/models/comment.rb'
- 'app/models/tag_cloud.rb'
- 'app/models/verification/residence.rb'
- 'lib/acts_as_paranoid_aliases.rb'
- 'lib/capistrano/template.rb'
- 'lib/census_api.rb'
- 'lib/manager_authenticator.rb'
- 'spec/support/common_actions.rb'
# Offense count: 66
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment.
Style/SpaceAroundOperators:
Enabled: false
# Offense count: 6
# Cop supports --auto-correct.
Style/SpaceBeforeComma:
Exclude:
- 'app/models/proposal.rb'
- 'spec/controllers/management/sessions_controller_spec.rb'
- 'spec/controllers/management/users_controller_spec.rb'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment.
Style/SpaceBeforeFirstArg:
Exclude:
- 'spec/factories.rb'
# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: require_no_space, require_space
Style/SpaceInLambdaLiteral:
Exclude:
- 'app/models/concerns/filterable.rb'
- 'app/models/spending_proposal.rb'
- 'app/models/user.rb'
- 'app/models/verified_user.rb'
# Offense count: 8
# Cop supports --auto-correct.
Style/SpaceInsideParens:
Exclude:
- 'app/models/user.rb'
- 'lib/manager_authenticator.rb'
- 'spec/features/proposals_spec.rb'
- 'spec/models/abilities/moderator_spec.rb'
# Offense count: 2
# Cop supports --auto-correct.
Style/SpaceInsidePercentLiteralDelimiters:
Exclude:
- 'app/models/activity.rb'
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiteralsInInterpolation:
Exclude:
- 'app/controllers/stats_controller.rb'
- 'app/models/proposal.rb'
# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: IgnoredMethods.
# IgnoredMethods: respond_to, define_method
Style/SymbolProc:
Exclude:
- 'app/controllers/admin/settings_controller.rb'
- 'app/controllers/notifications_controller.rb'
- 'app/controllers/organizations/registrations_controller.rb'
- 'lib/manager_authenticator.rb'
- 'spec/factories.rb'
# Offense count: 2
# Cop supports --auto-correct.
Style/TrailingWhitespace:
Exclude:
- 'app/controllers/admin/api/stats_controller.rb'
# Offense count: 31
# Cop supports --auto-correct.
Style/UnneededInterpolation:
Exclude:
- 'app/controllers/users/omniauth_callbacks_controller.rb'
- 'spec/factories.rb'
- 'spec/features/campaigns_spec.rb'
- 'spec/features/management/managed_users_spec.rb'
- 'spec/features/management/proposals_spec.rb'
- 'spec/features/management/spending_proposals_spec.rb'
- 'spec/models/residence_spec.rb'
- 'spec/models/spending_proposal_spec.rb'
# Offense count: 13
# Configuration parameters: SupportedStyles.
# SupportedStyles: snake_case, normalcase, non_integer
Style/VariableNumber:
EnforcedStyle: normalcase
# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles, WordRegex.
# SupportedStyles: percent, brackets
Style/WordArray:
EnforcedStyle: percent
MinSize: 3
# Offense count: 1
# Cop supports --auto-correct.
Style/ZeroLengthPredicate:
Exclude:
- 'app/models/concerns/verification.rb'

View File

@@ -1 +1 @@
2.3.1
2.3.2

View File

@@ -2,9 +2,13 @@ language: ruby
addons:
postgresql: "9.4"
rvm:
- "2.2.3"
- "2.3.2"
cache: bundler
before_script:
- "for i in config/*.example; do cp \"$i\" \"${i/.example}\"; done"
- bundle exec rake db:setup
script: bundle exec rake
script:
- "bundle exec rake knapsack:rspec"
env:
- CI_NODE_TOTAL=2 CI_NODE_INDEX=0
- CI_NODE_TOTAL=2 CI_NODE_INDEX=1

View File

@@ -34,6 +34,16 @@ If you want to contribute code to solve an issue:
* Follow these [best practices](https://github.com/styleguide/ruby)
* Open a *pull request* to the main repository describing what issue you are addressing.
## Cleaning up
In the rush of time sometimes things get messy, you can help us cleaning things up:
* implement [pending specs](https://travis-ci.org/consul/consul)
* increase [code coverage](https://coveralls.io/github/consul/consul?branch=master)
* improve [code quality](https://codeclimate.com/github/consul/consul)
* update [dependencies](https://gemnasium.com/consul/consul)
* make [code consistent](https://github.com/bbatsov/rubocop)
## Other ways of contributing without coding
* If you think there's a feature missing, or find a bug, create an issue (make sure it has not already been reported).

View File

@@ -34,6 +34,16 @@ Cuando quieras resolver una incidencia mediante código:
* Sigue estas [buenas prácticas](https://github.com/styleguide/ruby)
* Envía una *pull request* al repositorio principal indicando la incidencia que se está arreglando
## Limpiar
En la urgencia del momento, las cosas a veces se ensucian, puedes ayudarnos a limpiar la casa:
* implementando [tests pendientes](https://travis-ci.org/consul/consul)
* incrementando la [cobertura de tests](https://coveralls.io/github/consul/consul?branch=master)
* mejorando la [calidad del código](https://codeclimate.com/github/consul/consul)
* actualizando [dependecias](https://gemnasium.com/consul/consul)
* haciendo el [código consistente](https://github.com/bbatsov/rubocop)
## Otras formas de contribuir sin código
* Si crees que hay una funcionalidad que hace falta, o descubres un problema, abre una incidencia (asegúrate de que

View File

@@ -1,8 +1,8 @@
# Personalización
Puedes modificar consul y ponerle tu propia imagen, para esto debes primero hacer un fork de https://github.com/consul/consul creando un repositorio nuevo en Github. Puedes usar otro servicio como Gitlab, pero no te olvides de poner el enlace en el footer a tu repositorio en cumplimiento con la licencia de este proyecto (GPL Affero 3).
Puedes modificar consul y ponerle tu propia imagen, para esto debes primero hacer un fork de https://github.com/consul/consul creando un repositorio nuevo en Github. Puedes usar otro servicio como Gitlab, pero no te olvides de poner el enlace en el footer a tu repositorio en cumplimiento con la licencia de este proyecto (GPL Affero 3).
Hemos creado una estructura específica donde puedes sobreescribir y personalizar la aplicación para que puedas actualizar sin que tengas problemas al hacer merge y se sobreescriban por error tus cambios. Intentamos que Consul sea una aplicación Ruby on Rails lo más plain vanilla posible para facilitar el acceso de nuevas desarrolladoras.
Hemos creado una estructura específica donde puedes sobreescribir y personalizar la aplicación para que puedas actualizar sin que tengas problemas al hacer merge y se sobreescriban por error tus cambios. Intentamos que Consul sea una aplicación Ruby on Rails lo más plain vanilla posible para facilitar el acceso de nuevas desarrolladoras.
## Ficheros y directorios especiales
@@ -21,16 +21,16 @@ Aparte de estos directorios también cuentas con ciertos ficheros para:
* Gemfile_custom
* config/application.custom.rb
### Internacionalización
### Internacionalización
Si quieres modificar algún texto de la web deberías encontrarlos en los ficheros formato YML disponibles en *config/locales/*. Puedes leer la [guía de internacionalización](http://guides.rubyonrails.org/i18n.html) de Ruby on Rails sobre como funciona este sistema.
Si quieres modificar algún texto de la web deberías encontrarlos en los ficheros formato YML disponibles en *config/locales/*. Puedes leer la [guía de internacionalización](http://guides.rubyonrails.org/i18n.html) de Ruby on Rails sobre como funciona este sistema.
Las adaptaciones los debes poner en el directorio *config/locales/custom/*, recomendamos poner solo los textos que quieras personalizar. Por ejemplo si quieres personalizar el texto de "Ayuntamiento de Madrid, 2016" que se encuentra en el footer en todas las páginas, primero debemos ubicar en que plantilla se encuentra (app/views/layouts/_footer.html.erb), vemos que en el código pone lo siguiente:
Las adaptaciones los debes poner en el directorio *config/locales/custom/*, recomendamos poner solo los textos que quieras personalizar. Por ejemplo si quieres personalizar el texto de "Ayuntamiento de Madrid, 2016" que se encuentra en el footer en todas las páginas, primero debemos ubicar en que plantilla se encuentra (app/views/layouts/_footer.html.erb), vemos que en el código pone lo siguiente:
```
<%= t("layouts.footer.copyright", year: Time.now.year) %>
<%= t("layouts.footer.copyright", year: Time.current.year) %>
```
Y que en el fichero config/locales/es.yml sigue esta estructura (solo ponemos lo relevante para este caso):
Y que en el fichero config/locales/es.yml sigue esta estructura (solo ponemos lo relevante para este caso):
```
es:
@@ -40,11 +40,11 @@ es:
```
Si creamos el fichero config/locales/custom/es.yml y modificamos "Ayuntamiento de Madrid" por el nombre de la organización que se este haciendo la modificación. Recomendamos directamente copiar los ficheros config/locales/ e ir revisando y corrigiendo las que querramos, borrando las líneas que no querramos traducir.
Si creamos el fichero config/locales/custom/es.yml y modificamos "Ayuntamiento de Madrid" por el nombre de la organización que se este haciendo la modificación. Recomendamos directamente copiar los ficheros config/locales/ e ir revisando y corrigiendo las que querramos, borrando las líneas que no querramos traducir.
### Imágenes
Si quieres sobreescribir alguna imagen debes primero fijarte el nombre que tiene, por defecto se encuentran en *app/assets/images*. Por ejemplo si quieres modificar *app/assets/images/logo_header.png* debes poner otra con ese mismo nombre en el directorio app/assets/images/custom. Los iconos que seguramente quieras modificar son:
Si quieres sobreescribir alguna imagen debes primero fijarte el nombre que tiene, por defecto se encuentran en *app/assets/images*. Por ejemplo si quieres modificar *app/assets/images/logo_header.png* debes poner otra con ese mismo nombre en el directorio app/assets/images/custom. Los iconos que seguramente quieras modificar son:
* apple-touch-icon-200.png
* icon_home.png
@@ -59,7 +59,7 @@ Si quieres modificar el HTML de alguna página puedes hacerlo copiando el HTML d
### CSS
Si quieres cambiar algun selector CSS (de las hojas de estilo) puedes hacerlo en el fichero *app/assets/stylesheets/custom.scss*. Por ejemplo si quieres cambiar el color del header (.top-links) puedes hacerlo agregando:
Si quieres cambiar algun selector CSS (de las hojas de estilo) puedes hacerlo en el fichero *app/assets/stylesheets/custom.scss*. Por ejemplo si quieres cambiar el color del header (.top-links) puedes hacerlo agregando:
```
.top-links {
@@ -67,11 +67,11 @@ Si quieres cambiar algun selector CSS (de las hojas de estilo) puedes hacerlo en
}
```
Usamos un preprocesador de CSS, [SASS, con la sintaxis SCSS](http://sass-lang.com/guide).
Usamos un preprocesador de CSS, [SASS, con la sintaxis SCSS](http://sass-lang.com/guide).
### Javascript
Si quieres agregar código Javascript puedes hacerlo en el fichero *app/assets/javascripts/custom.js". Por ejemplo si quieres que salga una alerta puedes poner lo siguiente:
Si quieres agregar código Javascript puedes hacerlo en el fichero *app/assets/javascripts/custom.js". Por ejemplo si quieres que salga una alerta puedes poner lo siguiente:
```
$(function(){
@@ -81,9 +81,9 @@ $(function(){
### Modelos
Si quieres agregar modelos nuevos, o modificar o agregar métodos a uno ya existente puedes hacerlo en *app/models/custom*. En el caso de los modelos antiguos debes primero hacer un require de la dependencia.
Si quieres agregar modelos nuevos, o modificar o agregar métodos a uno ya existente puedes hacerlo en *app/models/custom*. En el caso de los modelos antiguos debes primero hacer un require de la dependencia.
Por ejemplo en el caso del Ayuntamiento de Madrid se requiere comprobar que el código postal durante la verificación sigue un cierto formato (empieza con 280). Esto se realiza creando este fichero en *app/models/custom/verification/residence.rb*:
Por ejemplo en el caso del Ayuntamiento de Madrid se requiere comprobar que el código postal durante la verificación sigue un cierto formato (empieza con 280). Esto se realiza creando este fichero en *app/models/custom/verification/residence.rb*:
```
require_dependency Rails.root.join('app', 'models', 'verification', 'residence').to_s
@@ -123,10 +123,10 @@ No olvides poner los tests relevantes en *spec/models/custom*, siguiendo con el
require 'rails_helper'
describe Verification::Residence do
let(:residence) { build(:verification_residence, document_number: "12345678Z") }
describe "verification" do
describe "verification" do
describe "postal code" do
it "should be valid with postal codes starting with 280" do
@@ -162,7 +162,7 @@ TODO
### Gemfile
Para agregar librerías (gems) nuevas puedes hacerlo en el fichero *Gemfile_custom*. Por ejemplo si quieres agregar la gema [rails-footnotes](https://github.com/josevalim/rails-footnotes) debes hacerlo agregandole
Para agregar librerías (gems) nuevas puedes hacerlo en el fichero *Gemfile_custom*. Por ejemplo si quieres agregar la gema [rails-footnotes](https://github.com/josevalim/rails-footnotes) debes hacerlo agregandole
```
gem 'rails-footnotes', '~> 4.0'
@@ -170,9 +170,9 @@ gem 'rails-footnotes', '~> 4.0'
Y siguiendo el flujo clásico en Ruby on Rails (bundle install y seguir con los pasos específicos de la gema en la documentación)
### application.rb
### application.rb
Cuando necesites extender o modificar el *config/application.rb* puedes hacerlo a través del fichero *config/application_custom.rb*. Por ejemplo si quieres modificar el idioma por defecto al inglés pondrías lo siguiente:
Cuando necesites extender o modificar el *config/application.rb* puedes hacerlo a través del fichero *config/application_custom.rb*. Por ejemplo si quieres modificar el idioma por defecto al inglés pondrías lo siguiente:
```
@@ -198,15 +198,15 @@ TODO
TODO
## Actualizar
## Actualizar
Te recomendamos que agregues el remote de consul para facilitar este proceso de merge:
Te recomendamos que agregues el remote de consul para facilitar este proceso de merge:
```
$ git remote add consul https://github.com/consul/consul
$ git remote add consul https://github.com/consul/consul
```
Con esto puedes actualizarte con
Con esto puedes actualizarte con
```
git checkout -b consul_update

View File

@@ -4,13 +4,13 @@ require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'
require 'capistrano/rvm'
require 'capistrano/bundler'
require "capistrano/bundler"
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
#require 'capistrano/passenger'
require 'capistrano/delayed_job'
require 'whenever/capistrano'
require 'rvm1/capistrano3'
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

43
Gemfile
View File

@@ -3,26 +3,27 @@ source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.7.1'
# Use PostgreSQL
gem 'pg'
gem 'pg', '~> 0.19.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0', '>= 5.0.4'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
gem 'uglifier', '>= 3.0.3'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2.1'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'jquery-rails', '~> 4.2.1'
gem 'jquery-ui-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Fix sprockets on the
gem 'sprockets', '~> 3.6.3'
gem 'sprockets', '~> 3.7.0'
gem 'devise', '~> 3.5.7'
gem 'devise_security_extension'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'omniauth'
@@ -31,36 +32,36 @@ gem 'omniauth-facebook', '~> 3.0.0'
gem 'omniauth-google-oauth2', '~> 0.4.0'
gem 'kaminari'
gem 'ancestry'
gem 'ancestry', '~> 2.2.2'
gem 'acts-as-taggable-on'
gem 'responders'
gem 'foundation-rails'
gem 'foundation_rails_helper'
gem 'responders', '~> 2.3.0'
gem 'foundation-rails', '~> 6.2.4.0'
gem 'foundation_rails_helper', '~> 2.0.0'
gem 'acts_as_votable'
gem 'ckeditor', '~> 4.2.0'
gem 'invisible_captcha', '~> 0.9.1'
gem 'cancancan'
gem 'social-share-button'
gem 'initialjs-rails', '0.2.0.1'
gem 'initialjs-rails', '0.2.0.4'
gem 'unicorn', '~> 5.1.0'
gem 'paranoia'
gem 'rinku', require: 'rails_rinku'
gem 'paranoia', '~> 2.2.0'
gem 'rinku', '~> 2.0.2', require: 'rails_rinku'
gem 'savon'
gem 'dalli'
gem 'rollbar', '~> 2.12.0'
gem 'rollbar', '~> 2.13.3'
gem 'delayed_job_active_record', '~> 4.1.0'
gem 'daemons'
gem 'devise-async'
gem 'newrelic_rpm', '~> 3.16'
gem 'newrelic_rpm', '~> 3.17.0.325'
gem 'whenever', require: false
gem 'pg_search'
gem 'ahoy_matey', '~> 1.4.0'
gem 'groupdate' # group temporary data
gem 'tolk' # Web interface for translations
gem 'ahoy_matey', '~> 1.4.2'
gem 'groupdate', '~> 3.1.0' # group temporary data
gem 'tolk', '~> 2.0.0' # Web interface for translations
gem 'browser'
gem 'turnout'
gem 'turnout', '~> 2.4.0'
gem 'redcarpet'
group :development, :test do
@@ -78,12 +79,14 @@ group :development, :test do
gem 'letter_opener_web', '~> 1.3.0'
gem 'i18n-tasks'
gem 'capistrano', '3.5.0', require: false
gem "capistrano-bundler", '1.1.4', require: false
gem "capistrano-rails", '1.1.7', require: false
gem "capistrano-rvm", require: false
gem 'capistrano-bundler', '~> 1.2', require: false
gem "capistrano-rails", '1.1.8', require: false
gem 'rvm1-capistrano3', require: false
gem 'capistrano3-delayed-job', '~> 1.0'
gem "bullet"
gem "faker"
gem 'rubocop', '~> 0.45.0', require: false
gem 'knapsack'
end
group :test do

View File

@@ -51,26 +51,26 @@ GEM
safely_block (>= 0.1.1)
user_agent_parser
uuidtools
airbrussh (1.0.2)
airbrussh (1.1.1)
sshkit (>= 1.6.1, != 1.7.0)
akami (1.3.1)
gyoku (>= 0.4.0)
nokogiri
ancestry (2.1.0)
ancestry (2.2.2)
activerecord (>= 3.0.0)
arel (6.0.3)
ast (2.2.0)
ast (2.3.0)
babel-source (5.8.35)
babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
bcrypt (3.1.11)
browser (2.2.0)
browser (2.3.0)
builder (3.2.2)
bullet (5.2.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.10.0)
byebug (9.0.5)
byebug (9.0.6)
cancancan (1.15.0)
capistrano (3.5.0)
airbrussh (>= 1.0.0)
@@ -78,16 +78,13 @@ GEM
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (1.1.4)
capistrano-bundler (1.2.0)
capistrano (~> 3.1)
sshkit (~> 1.2)
capistrano-harrow (0.5.2)
capistrano-rails (1.1.7)
capistrano-harrow (0.5.3)
capistrano-rails (1.1.8)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-rvm (0.1.2)
capistrano (~> 3.0)
sshkit (~> 1.2)
capistrano3-delayed-job (1.7.2)
capistrano (~> 3.0, >= 3.0.0)
capybara (2.7.1)
@@ -120,7 +117,7 @@ GEM
term-ansicolor (~> 1.3)
thor (~> 0.19.1)
tins (>= 1.6.0, < 2)
daemons (1.2.3)
daemons (1.2.4)
dalli (2.7.6)
database_cleaner (1.5.3)
debug_inspector (0.0.2)
@@ -138,6 +135,9 @@ GEM
warden (~> 1.2.3)
devise-async (0.10.2)
devise (>= 3.2, < 4.0)
devise_security_extension (0.10.0)
devise (>= 3.0.0, < 4.0)
railties (>= 3.2.6, < 5.0)
diff-lcs (1.2.5)
docile (1.1.5)
easy_translate (0.5.0)
@@ -160,11 +160,11 @@ GEM
i18n (~> 0.5)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
foundation-rails (6.2.3.0)
foundation-rails (6.2.4.0)
railties (>= 3.1.0)
sass (>= 3.3.0, < 3.5)
sprockets-es6 (>= 0.9.0)
foundation_rails_helper (1.2.1)
foundation_rails_helper (2.0.0)
actionpack (>= 4.1)
activemodel (>= 4.1)
activesupport (>= 4.1)
@@ -173,14 +173,14 @@ GEM
fuubar (2.1.1)
rspec (~> 3.0)
ruby-progressbar (~> 1.4)
geocoder (1.3.7)
geocoder (1.4.0)
globalid (0.3.7)
activesupport (>= 4.1.0)
groupdate (3.0.1)
groupdate (3.1.1)
activesupport (>= 3)
gyoku (1.3.1)
builder (>= 2.1.2)
hashie (3.4.3)
hashie (3.4.6)
highline (1.7.8)
htmlentities (4.3.4)
httpi (2.4.1)
@@ -196,11 +196,11 @@ GEM
parser (>= 2.2.3.0)
term-ansicolor (>= 1.3.2)
terminal-table (>= 1.5.1)
initialjs-rails (0.2.0.1)
railties (>= 3.1, < 5.0)
initialjs-rails (0.2.0.4)
railties (>= 3.1, < 6.0)
invisible_captcha (0.9.1)
rails
jquery-rails (4.1.1)
jquery-rails (4.2.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
@@ -212,6 +212,9 @@ GEM
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.10.0)
knapsack (1.13.0)
rake
timecop (>= 0.1.0)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.4.1)
@@ -228,17 +231,16 @@ GEM
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.9.0)
minitest (5.9.1)
multi_json (1.12.1)
multi_xml (0.5.5)
multipart-post (2.0.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (3.2.0)
newrelic_rpm (3.16.0.318)
nokogiri (1.6.8)
newrelic_rpm (3.17.0.325)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
nori (2.6.0)
oauth (0.5.0)
oauth2 (1.0.0)
@@ -267,26 +269,26 @@ GEM
json (~> 1.3)
omniauth-oauth (~> 1.1)
orm_adapter (0.5.0)
paranoia (2.1.5)
activerecord (~> 4.0)
parser (2.3.0.6)
paranoia (2.2.0)
activerecord (>= 4.0, < 5.1)
parser (2.3.1.4)
ast (~> 2.2)
pg (0.18.4)
pg (0.19.0)
pg_search (1.0.6)
activerecord (>= 3.1)
activesupport (>= 3.1)
arel
pkg-config (1.1.7)
poltergeist (1.10.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)
powerpack (0.1.1)
quiet_assets (1.1.0)
railties (>= 3.1, < 5.0)
rack (1.6.4)
rack (1.6.5)
rack-accept (0.4.5)
rack (>= 0.4)
rack-attack (4.4.1)
rack-attack (5.0.1)
rack
rack-test (0.6.3)
rack (>= 1.0)
@@ -314,21 +316,22 @@ GEM
activesupport (= 4.2.7.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.16.0)
rake (11.2.2)
rainbow (2.1.0)
raindrops (0.17.0)
rake (11.3.0)
redcarpet (3.3.4)
referer-parser (0.3.0)
request_store (1.3.1)
responders (2.2.0)
responders (2.3.0)
railties (>= 4.2.0, < 5.1)
rinku (2.0.0)
rollbar (2.12.0)
rinku (2.0.2)
rollbar (2.13.3)
multi_json
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-core (3.5.1)
rspec-core (3.5.4)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
@@ -336,7 +339,7 @@ GEM
rspec-mocks (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-rails (3.5.1)
rspec-rails (3.5.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
@@ -345,7 +348,16 @@ GEM
rspec-mocks (~> 3.5.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
rubocop (0.45.0)
parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
rvm1-capistrano3 (1.4.0)
capistrano (~> 3.0)
sshkit (>= 1.2)
safe_yaml (1.0.4)
safely_block (0.1.1)
errbase
@@ -375,18 +387,18 @@ GEM
spring (1.7.2)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (3.6.3)
sprockets (3.7.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-es6 (0.9.0)
sprockets-es6 (0.9.2)
babel-source (>= 5.8.11)
babel-transpiler
sprockets (>= 3.0.0)
sprockets-rails (3.1.1)
sprockets-rails (3.2.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sshkit (1.11.1)
sshkit (1.11.4)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
term-ansicolor (1.3.2)
@@ -396,20 +408,23 @@ GEM
thread (0.2.2)
thread_safe (0.3.5)
tilt (2.0.5)
timecop (0.8.1)
tins (1.11.0)
tolk (1.9.3)
rails (>= 4.0, < 4.3)
tolk (2.0.0)
rails (>= 4.0)
safe_yaml (>= 0.8.6)
turbolinks (2.5.3)
coffee-rails
turnout (2.3.1)
rack (~> 1.3)
turnout (2.4.0)
i18n (~> 0.7)
rack (>= 1.3, < 3)
rack-accept (~> 0.4)
tilt (>= 1.4, < 3)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (3.0.1)
uglifier (3.0.3)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.1.1)
unicorn (5.1.0)
kgio (~> 2.6)
raindrops (~> 0.7)
@@ -439,16 +454,15 @@ PLATFORMS
DEPENDENCIES
acts-as-taggable-on
acts_as_votable
ahoy_matey (~> 1.4.0)
ancestry
ahoy_matey (~> 1.4.2)
ancestry (~> 2.2.2)
browser
bullet
byebug
cancancan
capistrano (= 3.5.0)
capistrano-bundler (= 1.1.4)
capistrano-rails (= 1.1.7)
capistrano-rvm
capistrano-bundler (~> 1.2)
capistrano-rails (= 1.1.8)
capistrano3-delayed-job (~> 1.0)
capybara
ckeditor (~> 4.2.0)
@@ -460,50 +474,51 @@ DEPENDENCIES
delayed_job_active_record (~> 4.1.0)
devise (~> 3.5.7)
devise-async
devise_security_extension
email_spec
factory_girl_rails
faker
foundation-rails
foundation_rails_helper
foundation-rails (~> 6.2.4.0)
foundation_rails_helper (~> 2.0.0)
fuubar
groupdate
groupdate (~> 3.1.0)
i18n-tasks
initialjs-rails (= 0.2.0.1)
initialjs-rails (= 0.2.0.4)
invisible_captcha (~> 0.9.1)
jquery-rails
jquery-rails (~> 4.2.1)
jquery-ui-rails
kaminari
knapsack
launchy
letter_opener_web (~> 1.3.0)
newrelic_rpm (~> 3.16)
newrelic_rpm (~> 3.17.0.325)
omniauth
omniauth-facebook (~> 3.0.0)
omniauth-google-oauth2 (~> 0.4.0)
omniauth-twitter
paranoia
pg
paranoia (~> 2.2.0)
pg (~> 0.19.0)
pg_search
poltergeist
quiet_assets
rails (= 4.2.7.1)
redcarpet
responders
rinku
rollbar (~> 2.12.0)
responders (~> 2.3.0)
rinku (~> 2.0.2)
rollbar (~> 2.13.3)
rspec-rails (~> 3.5)
rubocop (~> 0.45.0)
rvm1-capistrano3
sass-rails (~> 5.0, >= 5.0.4)
savon
social-share-button
spring
spring-commands-rspec
sprockets (~> 3.6.3)
tolk
sprockets (~> 3.7.0)
tolk (~> 2.0.0)
turbolinks
turnout
uglifier (>= 1.3.0)
turnout (~> 2.4.0)
uglifier (>= 3.0.3)
unicorn (~> 5.1.0)
web-console (= 3.3.0)
whenever
BUNDLED WITH
1.12.5

View File

@@ -24,7 +24,9 @@ Frontend tools used include [SCSS](http://sass-lang.com/) over [Foundation](http
## Configuration for development and test environments
Prerequisites: install git, Ruby 2.2.3, bundler gem, ghostscript and PostgreSQL (>=9.4).
**NOTE**: For more detailed instructions check the [docs](https://github.com/consul/consul/tree/master/doc/en/dev_test_setup.md)
Prerequisites: install git, Ruby 2.3.2, bundler gem, ghostscript and PostgreSQL (>=9.4).
```
git clone https://github.com/consul/consul.git
@@ -32,7 +34,6 @@ cd consul
bundle install
cp config/database.yml.example config/database.yml
cp config/secrets.yml.example config/secrets.yml
rake db:create
bin/rake db:setup
bin/rake db:dev_seed
RAILS_ENV=test rake db:setup

View File

@@ -23,7 +23,9 @@ Las herramientas utilizadas para el frontend no están cerradas aún. Los estilo
## Configuración para desarrollo y tests
Prerequisitos: tener instalado git, Ruby 2.2.3, la gema `bundler`, ghostscript y PostgreSQL (9.4 o superior).
**NOTA**: para unas instrucciones más detalladas consulta la [documentación](https://github.com/consul/consul/tree/master/doc/es/dev_test_setup.md)
Prerequisitos: tener instalado git, Ruby 2.3.2, la gema `bundler`, ghostscript y PostgreSQL (9.4 o superior).
```
@@ -32,7 +34,6 @@ cd consul
bundle install
cp config/database.yml.example config/database.yml
cp config/secrets.yml.example config/secrets.yml
rake db:create
bin/rake db:setup
bin/rake db:dev_seed
RAILS_ENV=test rake db:setup

View File

@@ -4,3 +4,4 @@
require File.expand_path('../config/application', __FILE__)
Rails.application.load_tasks
Knapsack.load_tasks if defined?(Knapsack)

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -46,6 +46,7 @@
//= require valuation_spending_proposal_form
//= require embed_video
//= require banners
//= require social_share
//= require custom
var initialize_modules = function() {
@@ -68,6 +69,7 @@ var initialize_modules = function() {
App.ValuationSpendingProposalForm.initialize();
App.EmbedVideo.initialize();
App.Banners.initialize();
App.SocialShare.initialize();
};
$(function(){

View File

@@ -0,0 +1,7 @@
App.SocialShare =
initialize: ->
$(".social-share-button a").each ->
element = $(this)
site = element.data('site')
element.append("<span class='sr-only'>#{site}</span>")

View File

@@ -3,17 +3,11 @@ App.Votes =
hoverize: (votes) ->
$(document).on {
'mouseenter focus': ->
$("div.anonymous-votes", this).show();
$("div.organizations-votes", this).show();
$("div.not-logged", this).show();
$("div.no-supports-allowed", this).show();
$("div.logged", this).hide();
$("div.participation-not-allowed", this).show();
$("div.participation-allowed", this).hide();
mouseleave: ->
$("div.anonymous-votes", this).hide();
$("div.organizations-votes", this).hide();
$("div.not-logged", this).hide();
$("div.no-supports-allowed", this).hide();
$("div.logged", this).show();
$("div.participation-not-allowed", this).hide();
$("div.participation-allowed", this).show();
}, votes
initialize: ->

View File

@@ -48,47 +48,39 @@
// --------------------
$base-font-size: rem-calc(17);
$base-line-height: rem-calc(26);
$base-line: rem-calc(26);
$small-font-size: rem-calc(14);
$line-height: rem-calc(24);
$tiny-font-size: rem-calc(12);
$brand: #004A83;
$body: #E9E9E9;
$background: #EDEFF0;
$border: #DEE0E3;
$dark: darken($brand, 10%);
$text: #222222;
$text-medium: #999999;
$text-light: #CCCCCC;
$border: #DEE0E3;
$link: #2895F1;
$link-hover: #2178BF;
$link-hover: darken($link, 20%);
$debates: #008CCF;
$votes-bg: #26AEEE;
$votes-border: #1F94CB;
$votes-like: #7BD2A8;
$votes-like-act: #5D9E7F;
$votes-unlike: #EF8585;
$votes-unlike-act: #BD6A6A;
$like: #7BD2A8;
$unlike: #EF8585;
$delete: #F04124;
$check: #46DB91;
$proposals: #FFA42D;
$proposals-border: #CC8425;
$budget: #454372;
$budget-hover: #7571BF;
$highlight: #E7F2FC;
$featured: #FED900;
$featured: #FFDC5C;
$footer-bg: #DEE0E2;
$footer-color: #171819;
$footer-link: #454A4C;
$footer-border: #BFC1C3;
$success-bg: #DFF0D8;

View File

@@ -91,7 +91,7 @@ body.admin {
.admin-content {
.proposal-new, .proposal-edit {
.proposal-form {
padding-top: 0;
}

View File

@@ -23,6 +23,11 @@
// 01. Global styles
// -----------------
::selection {
color: white;
background-color: $brand;
}
body {
font-size: $base-font-size;
}
@@ -35,7 +40,7 @@ h1, h2, h3, h4, h5, h6 {
p {
font-size: $base-font-size;
font-weight: 400;
line-height: $base-line-height;
line-height: $base-line;
}
a {
@@ -148,10 +153,6 @@ a {
height: 100%;
}
.wrap {
background: white;
}
.footer, .push {
clear: both;
min-height: $line-height*12;
@@ -479,8 +480,16 @@ header {
&.active {
border-bottom: 2px solid $brand;
color: $brand;
&:hover {
text-decoration: none;
}
}
}
h2 {
font-size: $base-font-size;
}
}
.search-form-header input[type=text] {
@@ -491,7 +500,7 @@ header {
// ----------
footer {
color: $footer-color;
color: $text;
.logo a {
font-family: 'Lato' !important;
@@ -511,10 +520,11 @@ footer {
}
a, a:active, a:focus {
color: $footer-link;
color: $text;
text-decoration: underline;
&:hover {
color: $footer-color;
color: $text-medium;
}
}
@@ -523,7 +533,7 @@ footer {
}
h2 a {
border-bottom: 1px solid $footer-border;
border-bottom: 1px solid $text-light;
display: block;
font-size: rem-calc(24);
line-height: rem-calc(31);
@@ -533,14 +543,14 @@ footer {
}
.footer {
background: $footer-bg;
background: $border;
border-top: 6px solid $brand;
margin-top: $line-height*2;
padding-top: $line-height;
}
.subfooter {
border-top: 1px solid $footer-border;
border-top: 1px solid $text-light;
padding-top: $line-height/2;
}
@@ -567,8 +577,8 @@ footer {
color: $link;
&:hover {
background: $highlight;
color: $link-hover;
background: $brand;
color: white;
}
}
@@ -737,6 +747,56 @@ form {
// 07. Callout
// -----------
.callout-slide {
animation-duration: 1s;
-webkit-animation-duration: 1s;
animation-fill-mode: both;
-webkit-animation-fill-mode: both;
animation-name: slide;
-webkit-animation-name: slide;
}
@-webkit-keyframes slide {
from {
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
@keyframes slide {
from {
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
.notice-container {
min-width: $line-height*12;
position: absolute;
right: 24px;
top: 24px;
.notice {
height: $line-height*4;
.notice-text {
width: 95%;
}
}
}
.callout {
font-size: $small-font-size;
@@ -956,15 +1016,6 @@ img.avatar, img.admin-avatar, img.moderator-avatar, img.initialjs-avatar {
// 09. Search
// ----------
.search-form h3 {
border-top: 1px solid $votes-border;
display: inline-block;
font-size: rem-calc(16);
margin: -1px 0 $line-height/2;
padding-top: $line-height/4;
text-transform: uppercase;
}
.search-results h2 {
margin-bottom: 0;
}
@@ -1209,13 +1260,14 @@ table {
}
.share-supported {
text-align: center;
.social-share-button {
display: inline-block;
}
.ssb-twitter {
background: none;
background: #45B0E3;
color: white;
height: $line-height;
position: relative;
@@ -1238,7 +1290,7 @@ table {
}
.ssb-facebook {
background: none;
background: #3B5998;
color: white;
height: rem-calc(24);
position: relative;
@@ -1261,7 +1313,7 @@ table {
}
.ssb-google_plus {
background: none;
background: #DE4C34;
color: white;
height: rem-calc(24);
position: relative;
@@ -1512,7 +1564,7 @@ table {
.comment-votes {
color: $text-medium;
font-size: rem-calc(14);
font-size: $small-font-size;
line-height: $line-height;
a {
@@ -1522,12 +1574,21 @@ table {
&:hover {
color: $text-medium;
text-decoration: none;
.icon-like {
color: $like;
}
.icon-unlike {
color: $unlike;
}
}
}
[class^="icon-"] {
font-size: rem-calc(20);
vertical-align: middle;
font-size: $base-font-size;
vertical-align: sub;
}
}
@@ -1542,6 +1603,7 @@ table {
font-size: $small-font-size;
margin: rem-calc(6) 0;
padding: rem-calc(6);
position: relative;
[class^="icon-arrow"] {
font-size: rem-calc(18);
@@ -1646,7 +1708,8 @@ table {
}
.flag-disable, .flag-active {
vertical-align: middle;
line-height: 0;
vertical-align: sub;
}
.flag-disable {

View File

@@ -13,7 +13,7 @@
font-size: rem-calc(24);
font-weight: lighter;
@include breakpoint(small) {
@include breakpoint(medium) {
line-height: $line-height*2;
margin-top: 0;
}
@@ -22,7 +22,7 @@
height: 48px;
width: 48px;
@include breakpoint(small) {
@include breakpoint(medium) {
height: 80px;
margin-right: $line-height/2;
margin-top: 0;

View File

@@ -6,21 +6,28 @@
// 04. List participation
// 05. Featured
// 06. Budget
// 07. Proposals successfull
//
// 01. Votes and supports
// ----------------------
@mixin votes {
background: $votes-bg;
border-top: 1px solid $votes-border;
margin: 0 rem-calc(-12);
padding: rem-calc(14) rem-calc(12);
border-top: 1px solid $border;
margin-top: $line-height;
padding: $line-height 0;
position: relative;
.icon-like {
@include breakpoint(medium) {
border-left: 1px solid $border;
border-top: 0;
margin-top: 0;
padding-top: $line-height*2;
}
.icon-like, .icon-unlike {
background: white;
border: 2px solid $votes-border;
border: 2px solid $text-light;
border-radius: rem-calc(3);
color: $text-light;
display: inline-block;
@@ -29,191 +36,150 @@
padding: rem-calc(3) rem-calc(6);
position: relative;
&:hover {
background: $votes-like;
border-color: white;
&:hover, &:active {
color: white;
cursor: pointer;
opacity: 1 !important;
}
}
&:active {
border-color: $votes-like-act;
.icon-like {
&:hover, &:active {
background: $like;
border: 2px solid $like;
}
}
.icon-unlike {
background: white;
border: 2px solid $votes-border;
border-radius: rem-calc(3);
color: $text-light;
display: inline-block;
font-size: rem-calc(30);
line-height: rem-calc(30);
padding: rem-calc(3) rem-calc(6);
position: relative;
&:hover {
background: $votes-unlike;
border-color: white;
color: white;
cursor: pointer;
opacity: 1 !important;
}
&:active {
border-color: $votes-unlike-act;
&:hover, &:active {
background: $unlike;
border: 2px solid $unlike;
}
}
.like, .unlike {
line-height: rem-calc(48);
vertical-align: super;
text-decoration: none;
span.percentage {
color: white;
color: $text;
display: inline-block;
font-size: rem-calc(16);
font-size: $small-font-size;
line-height: $line-height*2;
padding-left: rem-calc(8);
padding-right: $line-height/2;
vertical-align: top;
@include breakpoint(medium) {
display: block;
line-height: $line-height;
padding-right: 0;
}
}
}
.voted {
.icon-like {
background: $votes-like;
border-color: white;
.icon-like, .icon-unlike {
color: white;
}
.icon-like {
background: $like;
border: 2px solid $like;
}
.icon-unlike {
background: $votes-unlike;
border-color: white;
color: white;
background: $unlike;
border: 2px solid $unlike;
}
}
.no-voted {
.icon-like, .icon-unlike {
opacity: .5;
opacity: .3;
}
}
.total-votes {
color: white;
font-weight: bold;
float: right;
line-height: $line-height*2;
@include breakpoint(medium) {
display: block;
float: none;
}
}
.divider {
margin: 0 rem-calc(6);
}
.not-logged {
background: rgba(22,99,135,.9);
color: white;
font-size: $small-font-size;
height: 100%;
left: 0;
position: absolute;
text-align: center;
top: 0;
width: 100%;
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#222222', endColorstr='#222222'); /* IE */
a {
color: white;
text-decoration: underline;
}
}
.anonymous-votes, .organizations-votes {
background: $warning-bg;
color: $color-warning;
height: 100%;
left: 0;
line-height: $line-height;
padding-top: rem-calc(12);
position: absolute;
text-align: center;
top: 0;
width: 100%;
p {
color: $color-warning;
margin: 0 rem-calc(12);
text-align: left;
}
a {
color: $color-warning;
font-weight: bold;
text-decoration: underline;
}
}
}
@mixin supports {
background: $proposals;
border-top: 1px solid $proposals-border;
margin: 0 rem-calc(-12);
padding: rem-calc(14) rem-calc(12);
padding: $line-height 0;
position: relative;
.progress {
background-color: rgba(255,255,255,.8);
height: $line-height/2;
background: lighten($proposals, 35%);
border: 1px solid lighten($proposals, 35%);
height: rem-calc(14);
position: relative;
.meter {
background: $votes-like;
background: $proposals;
border-radius: 0;
border-bottom-right-radius: rem-calc(3);
border-top-right-radius: rem-calc(3);
display: block;
height: $line-height/2;
}
}
.percentage {
font-size: rem-calc(10);
color: $brand;
vertical-align: top;
color: $text;
font-size: $tiny-font-size;
position: absolute;
top: 13px;
right: 20px;
right: 6px;
top: -2px;
vertical-align: top;
}
abbr {
color: white;
color: $text-medium;
&[title] {
border-bottom: 1px dotted white;
border-bottom: 1px dotted $text-medium;
}
}
.button-support {
background: white;
background: $proposals;
color: $text;
display: inline-block;
font-size: $small-font-size;
margin-top: rem-calc(12);
&:hover {
background: $proposals-border;
color: white;
&:hover, &:active {
background: lighten($proposals, 25%);
cursor: pointer;
}
&:active {
opacity: .75;
}
}
.total-supports {
color: white;
color: $text;
display: block;
font-weight: bold;
text-align: center;
font-size: $small-font-size;
span {
display: block;
font-size: $small-font-size;
font-weight: normal;
}
}
@@ -221,82 +187,77 @@
margin: 0 rem-calc(6);
}
.not-logged {
background: rgba(255,164,45,.9);
color: white;
font-size: $small-font-size;
height: 100%;
left: 0;
position: absolute;
text-align: center;
top: 0;
width: 100%;
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#222222', endColorstr='#222222'); /* IE */
a {
color: white;
text-decoration: underline;
}
}
.anonymous-votes, .organizations-votes, .no-supports-allowed {
background: $warning-bg;
color: $color-warning;
height: 100%;
left: 0;
line-height: $line-height;
padding-top: rem-calc(12);
position: absolute;
text-align: center;
top: 0;
width: 100%;
p {
color: $color-warning;
margin: 0 rem-calc(12);
text-align: left;
}
a {
color: $color-warning;
font-weight: bold;
text-decoration: underline;
}
}
.supported {
color: white;
color: $text;
margin-top: rem-calc(12);
}
}
.supports-container {
border-top: 1px solid $border;
@include breakpoint(medium) {
border-left: 1px solid $border;
border-top: 0;
}
}
.participation-not-allowed {
background: $warning-bg;
color: $color-warning;
height: 100%;
left: 0;
line-height: $line-height;
padding: $line-height $line-height/2;
position: absolute;
text-align: center;
top: 0;
width: 100%;
z-index: 2;
p {
color: $color-warning !important;
margin: 0 rem-calc(12);
text-align: left;
}
a {
color: $color-warning !important;
font-weight: bold;
text-decoration: underline;
}
}
.reply .participation-not-allowed {
padding-right: $line-height/2;
padding-top: $line-height/6;
text-align: right;
}
// 02. New participation
// ---------------------
.debate-new, .debate-edit,
.proposal-new, .proposal-edit,
.budget-proposal-new, .budget-proposal-edit,
.spending-proposal-new, .spending-proposal-edit {
.debate-form,
.proposal-form,
.budget-investment-form,
.spending-proposal-form {
.icon-debates, .icon-proposals, .icon-budget {
font-size: rem-calc(50);
line-height: $line-height;
opacity: .5;
}
.icon-debates {
color: $debates;
font-size: rem-calc(60);
line-height: $line-height;
opacity: .5;
}
.icon-proposals {
color: $proposals;
font-size: rem-calc(50);
line-height: $line-height;
opacity: .5;
}
.icon-budget {
color: $budget;
font-size: rem-calc(50);
line-height: $line-height;
opacity: .5;
}
.recommendations {
@@ -316,14 +277,14 @@
}
}
.debate-new, .debate-edit {
.debate-form {
.recommendations li:before {
color: $debates;
}
}
.proposal-new, .proposal-edit {
.proposal-form {
.recommendations li:before {
color: $proposals;
@@ -333,7 +294,10 @@
// 03. Show participation
// ----------------------
.debate-show, .proposal-show, .investment-project-show, .budget-investment-show {
.debate-show,
.proposal-show,
.investment-project-show,
.budget-investment-show {
p {
word-wrap: break-word;
@@ -470,57 +434,8 @@
}
}
.votes {
@include votes;
border: 0;
border-radius: 0;
margin: 0;
.total-votes {
display: block;
float: none;
line-height: $line-height;
}
.not-logged {
line-height: $line-height;
padding: rem-calc(24);
}
@include breakpoint(small + rem-calc(1) and medium down) {
.in-favor, .against {
text-align: left;
width: rem-calc(100);
}
}
.divider {
display: none;
}
@include breakpoint(medium) {
.divider {
display: inline-block;
}
}
}
.supports {
@include supports;
border: 0;
border-radius: 0;
margin: 0;
.total-supports {
display: block;
float: none;
line-height: $line-height;
}
.not-logged {
line-height: $line-height;
padding: rem-calc(24);
}
}
.leave-comment {
@@ -545,26 +460,36 @@
word-break: break-word;
}
.proposal-show, .investment-project-show {
.supports {
padding: $line-height/2 0 0;
}
.share-supported {
display: none;
}
}
// 04. List participation
// ----------------------
.debates-list, .proposals-list, .investment-projects-list, .budget-investments-list {
@include breakpoint(small) {
@include breakpoint(medium) {
margin-bottom: rem-calc(48);
}
}
.investment-projects-list, .budget-investments-list {
@include breakpoint(small) {
@include breakpoint(medium) {
min-height: $line-height*15;
}
}
.debate, .proposal, .investment-project, .budget-investment {
margin-bottom: 0;
margin-top: 0;
margin: $line-height/4 0;
.panel {
background: white;
@@ -576,7 +501,7 @@
min-height: rem-calc(192);
padding: rem-calc(12) rem-calc(12) 0 rem-calc(12);
@include breakpoint(small) {
@include breakpoint(medium) {
margin-bottom: rem-calc(-1);
padding-bottom: rem-calc(12);
}
@@ -701,15 +626,6 @@
}
}
.not-logged {
line-height: $line-height;
padding-top: rem-calc(24);
}
.anonymous-votes, .organizations-votes {
padding-top: rem-calc(24);
}
.divider {
display: none;
}
@@ -731,107 +647,30 @@
}
}
.debate {
.debate, .debate-show {
.votes {
@include votes;
border: 1px solid $votes-border;
margin: 0 rem-calc(-12);
@include breakpoint(small) {
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
margin: 0 rem-calc(-25) 0 rem-calc(12);
.against {
margin-left: $line-height/4;
}
&:after {
content: none;
position: absolute;
display: block;
border-style: solid;
border-color: #166387 transparent transparent transparent;
bottom: -14px;
border-left-width: 0;
border-right-color: transparent;
right: -1px;
border-width: 13px 13px 0 0;
@include breakpoint(small) {
content: "";
}
}
.total-votes {
display: inline-block;
line-height: $line-height;
margin-left: rem-calc(24);
padding-top: rem-calc(12);
vertical-align: top;
@include breakpoint(small) {
display: block;
float: none;
line-height: $line-height*2;
margin-left: 0;
padding-top: 0;
}
}
@include breakpoint(small) {
.like, .unlike {
span.percentage {
display: block;
line-height: $line-height/2;
}
}
@include breakpoint(medium) {
text-align: center;
}
}
}
.debate-show .votes {
border: 0;
padding: $line-height/2 0;
}
.proposal {
.supports {
@include supports;
border: 1px solid $proposals-border;
margin: 0 rem-calc(-12);
@include breakpoint(small) {
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
margin: 0 rem-calc(-25) 0 rem-calc(12);
}
&:after {
content: none;
position: absolute;
display: block;
border-style: solid;
border-color: #664212 transparent transparent transparent;
bottom: -14px;
border-left-width: 0;
border-right-color: transparent;
right: -1px;
border-width: 13px 13px 0 0;
@include breakpoint(small) {
content: "";
}
}
.total-supports {
display: inline-block;
line-height: $line-height;
padding-top: rem-calc(12);
vertical-align: top;
@include breakpoint(small) {
display: block;
float: none;
margin-left: 0;
padding-top: 0;
}
}
}
}
@@ -840,20 +679,6 @@
.supports {
@include supports;
background: none;
border: 0;
border-left: 1px solid $border;
margin: 0 rem-calc(-12);
min-height: rem-calc(180);
padding-top: 0;
@include breakpoint(small) {
padding-top: $line-height*1.5;
}
&:after {
content: none;
}
.investment-project-amount,
.budget-investment-amount {
@@ -884,36 +709,11 @@
font-weight: bold;
}
.supported {
color: $budget;
margin-top: 0;
width: 100%;
}
.remove .icon-check-circle {
display: block;
font-size: rem-calc(70);
line-height: rem-calc(70);
}
.no-supports-allowed {
background: rgba(69,67,114,.96);
color: white;
padding: rem-calc(12);
}
.no-supports-allowed p, .no-supports-allowed a {
color: white;
}
.share-supported {
.ssb-twitter,
.ssb-facebook,
.ssb-google_plus {
color: $budget;
}
}
}
}
@@ -940,7 +740,8 @@
// 05. Featured
// ------------
.featured-debates, .featured-proposals {
.featured-debates, .featured-proposals,
.proposals-ballot, .proposals-ballot-list {
padding: $line-height/2 0;
@include breakpoint(medium) {
@@ -997,21 +798,23 @@
}
.button-support {
background: $text;
color: $featured;
margin-top: 0;
&:hover {
background: white;
color: $text;
}
}
.not-logged,
.organizations-votes,
.anonymous-votes {
.participation-not-allowed {
background: $featured;
color: $color-warning;
font-size: $small-font-size;
line-height: $line-height;
padding-top: 0;
a {
color: $color-warning;
font-weight: bold;
}
p {
@@ -1023,6 +826,7 @@
.supported {
margin-top: 0;
font-size: $small-font-size;
}
.share-supported {
@@ -1030,7 +834,10 @@
.ssb-twitter,
.ssb-facebook,
.ssb-google_plus {
height: rem-calc(33);
background: none;
color: $text;
height: rem-calc(33) !important;
&:before {
font-size: rem-calc(18);
@@ -1175,6 +982,36 @@
}
}
// 07. Proposals successfull
// -------------------------
.dark-heading {
background: #2D3E50;
color: white;
@include breakpoint(medium) {
padding-bottom: $line-height;
}
p {
margin-bottom: 0;
&.title {
color: #FFD200;
}
}
.info {
background: #314253;
padding-top: $line-height;
@include breakpoint(medium) {
border-top: rem-calc(6) solid #FFD200;
}
}
}
.big-number {
color: $budget;
font-size: rem-calc(60);
@@ -1302,3 +1139,83 @@ ul.ballot-list {
}
}
}
.featured-proposals-ballot-banner {
background: #2D3E50 image-url("ballot_tiny.gif") no-repeat;
background-position: 75% 0;
position: relative;
h2, a:hover h2 {
color: #FFD200 !important;
}
p {
color: white;
}
@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;
}
}
.featured-proposals-ballot-banner,
.successfull .panel {
.icon-successfull {
border-right: 60px solid #FFD200;
border-top: 0;
border-bottom: 60px solid transparent;
height: 0;
position: absolute;
right: 0;
top: 0;
width: 0;
&:after {
color: #1B254C;
content: "\59";
font-family: "icons" !important;
left: 34px;
position: absolute;
top: 5px;
}
}
}
.proposals-ballot-list {
.proposal-sucessfull {
background: white;
border-top: 1px solid $border;
padding: $line-height 0;
position: relative;
}
}
.successfull {
.panel {
position: relative;
}
.truncate {
display: none;
}
.message {
@include supports;
background: none;
border-top: 0;
@include breakpoint(medium) {
border-left: 1px solid $border;
margin: $line-height rem-calc(-25) 0 rem-calc(12);
}
}
}

View File

@@ -29,4 +29,4 @@ class AccountController < ApplicationController
end
end
end
end

View File

@@ -38,6 +38,7 @@ class Admin::BannersController < Admin::BaseController
end
private
def banner_params
params.require(:banner).permit(:title, :description, :target_url, :style, :image, :post_started_at, :post_ended_at)
end
@@ -53,4 +54,5 @@ class Admin::BannersController < Admin::BaseController
def banner_imgs
@banner_imgs = Setting.all.banner_img.map { |banner_img| [banner_img.value, banner_img.key.split('.')[1]] }
end
end

View File

@@ -20,8 +20,9 @@ class Admin::CommentsController < Admin::BaseController
end
private
def load_comment
@comment = Comment.with_hidden.find(params[:id])
end
end
end

View File

@@ -3,4 +3,4 @@ class Admin::DashboardController < Admin::BaseController
def index
end
end
end

View File

@@ -29,4 +29,4 @@ class Admin::DebatesController < Admin::BaseController
@debate = Debate.with_hidden.find(params[:id])
end
end
end

View File

@@ -25,8 +25,9 @@ class Admin::OfficialsController < Admin::BaseController
end
private
def user_params
params.require(:user).permit(:official_position, :official_level)
end
end
end

View File

@@ -27,4 +27,4 @@ class Admin::OrganizationsController < Admin::BaseController
redirect_to request.query_parameters.merge(action: :index)
end
end
end

View File

@@ -25,4 +25,4 @@ class Admin::ProposalsController < Admin::BaseController
@proposal = Proposal.with_hidden.find(params[:id])
end
end
end

View File

@@ -15,7 +15,9 @@ class Admin::SettingsController < Admin::BaseController
end
private
def settings_params
params.require(:setting).permit(:value)
end
end

View File

@@ -54,4 +54,4 @@ class Admin::SpendingProposalsController < Admin::BaseController
@tags = ActsAsTaggableOn::Tag.spending_proposal_tags
end
end
end

View File

@@ -32,4 +32,5 @@ class Admin::StatsController < Admin::BaseController
@direct_messages = DirectMessage.count
@users_who_have_sent_message = DirectMessage.select(:sender_id).distinct.count
end
end
end

View File

@@ -30,4 +30,4 @@ class Admin::UsersController < Admin::BaseController
@user = User.with_hidden.find(params[:id])
end
end
end

View File

@@ -30,8 +30,10 @@ class Admin::ValuatorsController < Admin::BaseController
end
private
def create_params
params[:valuator][:description] = nil if params[:valuator][:description].blank?
params.require(:valuator).permit(:user_id, :description)
end
end
end

View File

@@ -77,4 +77,4 @@ class CommentsController < ApplicationController
Notification.add(notifiable.author_id, notifiable) unless comment.author_id == notifiable.author_id
end
end
end

View File

@@ -12,7 +12,7 @@ module CommentableActions
@tag_cloud = tag_cloud
@banners = Banner.with_active
set_resource_votes(@resources)
set_resources_instance
end
@@ -155,4 +155,4 @@ module CommentableActions
nil
end
end
end

View File

@@ -4,9 +4,9 @@ module ModerateActions
def index
@resources = @resources.send(@current_filter)
.send("sort_by_#{@current_order}")
.page(params[:page])
.per(50)
.send("sort_by_#{@current_order}")
.page(params[:page])
.per(50)
set_resources_instance
end

View File

@@ -1,6 +1,7 @@
module Polymorphic
private
def resource
@resource ||= instance_variable_get("@#{resource_name}")
end

View File

@@ -21,7 +21,8 @@ class DebatesController < ApplicationController
respond_to :html, :js
def index_customization
@featured_debates = @debates.featured
@featured_debates = @debates.featured
@proposal_successfull_exists = Proposal.successfull.exists?
end
def show
@@ -40,7 +41,7 @@ class DebatesController < ApplicationController
end
def mark_featured
@debate.update_attribute(:featured_at, Time.now)
@debate.update_attribute(:featured_at, Time.current)
redirect_to request.query_parameters.merge(action: :index)
end

View File

@@ -6,6 +6,7 @@ class Management::AccountController < Management::BaseController
end
private
def only_verified_users
check_verified_user t("management.account.alert.unverified_user")
end

View File

@@ -3,4 +3,4 @@ class Management::DashboardController < Management::BaseController
def index
end
end
end

View File

@@ -33,17 +33,17 @@ class Management::DocumentVerificationsController < Management::BaseController
private
def document_verification_params
params.require(:document_verification).permit(:document_type, :document_number)
end
def document_verification_params
params.require(:document_verification).permit(:document_type, :document_number)
end
def set_document
session[:document_type] = params[:document_verification][:document_type]
session[:document_number] = params[:document_verification][:document_number]
end
def set_document
session[:document_type] = params[:document_verification][:document_type]
session[:document_number] = params[:document_verification][:document_number]
end
def clean_document_number
params[:document_verification][:document_number] = params[:document_verification][:document_number].gsub(/[^a-z0-9]+/i, "").upcase unless params[:document_verification][:document_number].blank?
end
def clean_document_number
params[:document_verification][:document_number] = params[:document_verification][:document_number].gsub(/[^a-z0-9]+/i, "").upcase unless params[:document_verification][:document_number].blank?
end
end

View File

@@ -16,8 +16,8 @@ class Management::EmailVerificationsController < Management::BaseController
private
def email_verification_params
params.require(:email_verification).permit(:document_type, :document_number, :email)
end
def email_verification_params
params.require(:email_verification).permit(:document_type, :document_number, :email)
end
end

View File

@@ -53,4 +53,4 @@ class Management::ProposalsController < Management::BaseController
@comment_flags = managed_user ? managed_user.comment_flags(comments) : {}
end
end
end

View File

@@ -42,4 +42,4 @@ class Management::SessionsController < ActionController::Base
end
end
end
end

View File

@@ -10,4 +10,4 @@ class Management::UserInvitesController < Management::BaseController
end
end
end
end

View File

@@ -8,8 +8,8 @@ class Management::UsersController < Management::BaseController
@user = User.new(user_params)
@user.skip_password_validation = true
@user.terms_of_service = '1'
@user.residence_verified_at = Time.now
@user.verified_at = Time.now
@user.residence_verified_at = Time.current
@user.verified_at = Time.current
if @user.save then
render :show

View File

@@ -21,13 +21,13 @@ class Moderation::UsersController < Moderation::BaseController
private
def load_users
@users = User.with_hidden.search(params[:name_or_email]).page(params[:page]).for_render
end
def load_users
@users = User.with_hidden.search(params[:name_or_email]).page(params[:page]).for_render
end
def block_user
@user.block
Activity.log(current_user, :block, @user)
end
def block_user
@user.block
Activity.log(current_user, :block, @user)
end
end

View File

@@ -24,6 +24,7 @@ class Organizations::RegistrationsController < Devise::RegistrationsController
end
protected
def after_inactive_sign_up_path_for(resource)
organizations_sign_up_success_path
end

View File

@@ -0,0 +1,8 @@
class ProposalBallotsController < ApplicationController
skip_authorization_check
def index
@proposal_ballots = Proposal.successfull.sort_by_confidence_score
end
end

View File

@@ -26,8 +26,8 @@ class ProposalNotificationsController < ApplicationController
private
def proposal_notification_params
params.require(:proposal_notification).permit(:title, :body, :proposal_id)
end
def proposal_notification_params
params.require(:proposal_notification).permit(:title, :body, :proposal_id)
end
end

View File

@@ -12,7 +12,7 @@ class ProposalsController < ApplicationController
invisible_captcha only: [:create, :update], honeypot: :subtitle
has_orders %w{hot_score confidence_score created_at relevance}, only: :index
has_orders %w{hot_score confidence_score created_at relevance archival_date}, only: :index
has_orders %w{most_voted newest oldest}, only: :show
load_and_authorize_resource
@@ -26,8 +26,10 @@ class ProposalsController < ApplicationController
end
def index_customization
discard_archived
load_retired
load_featured
load_proposal_ballots
load_featured unless @proposal_successfull_exists
end
def vote
@@ -36,7 +38,7 @@ class ProposalsController < ApplicationController
end
def retire
if valid_retired_params? && @proposal.update(retired_params.merge(retired_at: Time.now))
if valid_retired_params? && @proposal.update(retired_params.merge(retired_at: Time.current))
redirect_to proposal_path(@proposal), notice: t('proposals.notice.retired')
else
render action: :retire_form
@@ -80,6 +82,10 @@ class ProposalsController < ApplicationController
@featured_proposals_votes = current_user ? current_user.proposal_votes(proposals) : {}
end
def discard_archived
@resources = @resources.not_archived unless @current_order == "archival_date"
end
def load_retired
if params[:retired].present?
@resources = @resources.retired
@@ -90,11 +96,15 @@ class ProposalsController < ApplicationController
end
def load_featured
@featured_proposals = Proposal.all.sort_by_confidence_score.limit(3) if (!@advanced_search_terms && @search_terms.blank? && @tag_filter.blank? && params[:retired].blank?)
@featured_proposals = Proposal.not_archived.sort_by_confidence_score.limit(3) if (!@advanced_search_terms && @search_terms.blank? && @tag_filter.blank? && params[:retired].blank?)
if @featured_proposals.present?
set_featured_proposal_votes(@featured_proposals)
@resources = @resources.where('proposals.id NOT IN (?)', @featured_proposals.map(&:id))
end
end
def load_proposal_ballots
@proposal_successfull_exists = Proposal.successfull.exists?
end
end

View File

@@ -23,6 +23,6 @@ class StatsController < ApplicationController
private
def daily_cache(key, &block)
Rails.cache.fetch("public_stats/#{Time.now.strftime("%Y-%m-%d")}/#{key}", &block)
Rails.cache.fetch("public_stats/#{Time.current.strftime("%Y-%m-%d")}/#{key}", &block)
end
end

View File

@@ -44,4 +44,4 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
@user.save || @user.save_requiring_finish_signup
end
end
end

View File

@@ -77,4 +77,4 @@ class Valuation::SpendingProposalsController < Valuation::BaseController
@spending_proposal.errors.empty?
end
end
end

View File

@@ -6,7 +6,7 @@ class Verification::EmailController < ApplicationController
def show
if Verification::Email.find(current_user, params[:email_verification_token])
current_user.update(verified_at: Time.now)
current_user.update(verified_at: Time.current)
redirect_to account_path, notice: t('verification.email.show.flash.success')
else
redirect_to verified_user_path, alert: t('verification.email.show.alert.failure')

View File

@@ -29,7 +29,7 @@ class Verification::LetterController < ApplicationController
def update
@letter = Verification::Letter.new(letter_params.merge(user: current_user, verify: true))
if @letter.valid?
current_user.update(verified_at: Time.now)
current_user.update(verified_at: Time.current)
redirect_to account_path, notice: t('verification.letter.update.flash.success')
else
Lock.increase_tries(@letter.user) if @letter.user
@@ -56,5 +56,4 @@ class Verification::LetterController < ApplicationController
end
end
end

View File

@@ -31,7 +31,7 @@ class Verification::SmsController < ApplicationController
ahoy.track(:level_2_user, user_id: current_user.id) rescue nil
if VerifiedUser.phone?(current_user)
current_user.update(verified_at: Time.now)
current_user.update(verified_at: Time.current)
end
redirect_to_next_path
@@ -69,4 +69,4 @@ class Verification::SmsController < ApplicationController
end
end
end
end

View File

@@ -9,6 +9,7 @@ class Verification::VerifiedUserController < ApplicationController
end
private
def user_data_present?
return false if @verified_users.blank?

View File

@@ -16,5 +16,4 @@ class WelcomeController < ApplicationController
redirect_to verification_path if signed_in?
end
end

View File

@@ -5,7 +5,7 @@ module AdminHelper
end
def official_level_options
options = [["",0]]
options = [["", 0]]
(1..5).each do |i|
options << [[t("admin.officials.level_#{i}"), setting["official_level_#{i}_name"]].compact.join(': '), i]
end

View File

@@ -1,5 +1,7 @@
module BannersHelper
def has_banners
@banners.count > 0
end
end

View File

@@ -39,4 +39,5 @@ module CommentsHelper
"" # Default not author class
end
end
end
end

View File

@@ -1,6 +1,7 @@
module DebatesHelper
def has_featured?
def has_featured?
Debate.all.featured.count > 0
end
end

View File

@@ -9,15 +9,15 @@ module EmbedVideosHelper
end
if server == "Vimeo"
regExp = /vimeo.*(staffpicks\/|channels\/|videos\/|video\/|\/)([^#\&\?]*).*/
reg_exp = /vimeo.*(staffpicks\/|channels\/|videos\/|video\/|\/)([^#\&\?]*).*/
src = "https://player.vimeo.com/video/"
elsif server == "YouTube"
regExp = /youtu.*(be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/
reg_exp = /youtu.*(be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/
src = "https://www.youtube.com/embed/"
end
if regExp
match = link.match(regExp)
if reg_exp
match = link.match(reg_exp)
end
if match and match[2]

View File

@@ -26,4 +26,4 @@ module FlagsHelper
end
end
end
end

View File

@@ -0,0 +1,8 @@
module LocalesHelper
def name_for_locale(locale)
default = I18n.t("locale", locale: locale)
I18n.backend.translate(locale, "i18n.language.name", default: default)
end
end

View File

@@ -1,4 +1,2 @@
module NotificationsHelper
end

View File

@@ -2,19 +2,19 @@ module ProposalsHelper
def progress_bar_percentage(proposal)
case proposal.cached_votes_up
when 0 then 0
when 1..Proposal.votes_needed_for_success then (proposal.total_votes.to_f * 100 / Proposal.votes_needed_for_success).floor
else 100
when 0 then 0
when 1..Proposal.votes_needed_for_success then (proposal.total_votes.to_f * 100 / Proposal.votes_needed_for_success).floor
else 100
end
end
def supports_percentage(proposal)
percentage = (proposal.total_votes.to_f * 100 / Proposal.votes_needed_for_success)
case percentage
when 0 then "0%"
when 0..(0.1) then "0.1%"
when (0.1)..100 then number_to_percentage(percentage, strip_insignificant_zeros: true, precision: 1)
else "100%"
when 0 then "0%"
when 0..(0.1) then "0.1%"
when (0.1)..100 then number_to_percentage(percentage, strip_insignificant_zeros: true, precision: 1)
else "100%"
end
end

View File

@@ -8,4 +8,4 @@ module SettingsHelper
@all_settings ||= Hash[ Setting.all.map{|s| [s.key, s.value.presence]} ]
end
end
end

View File

@@ -20,4 +20,5 @@ module StatsHelper
opt[:data][:graph] = admin_api_stats_path(spending_proposals: true)
content_tag :div, "", opt
end
end

View File

@@ -1,4 +1,5 @@
module TracksHelper
def track_event(data={})
track_data = ""
prefix = " data-track-event-"
@@ -9,4 +10,5 @@ module TracksHelper
track_data
end
end
end

View File

@@ -12,9 +12,9 @@ class Banner < ActiveRecord::Base
validates :post_started_at, presence: true
validates :post_ended_at, presence: true
scope :with_active, -> {where("post_started_at <= ?", Time.now).
where("post_ended_at >= ?", Time.now) }
scope :with_active, -> {where("post_started_at <= ?", Time.current).
where("post_ended_at >= ?", Time.current) }
scope :with_inactive,-> {where("post_started_at > ? or post_ended_at < ?", Time.now, Time.now) }
scope :with_inactive,-> {where("post_started_at > ? or post_ended_at < ?", Time.current, Time.current) }
end
end

View File

@@ -24,8 +24,8 @@ class Comment < ActiveRecord::Base
scope :not_as_admin_or_moderator, -> { where("administrator_id IS NULL").where("moderator_id IS NULL")}
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
scope :sort_by_most_voted , -> { order(confidence_score: :desc, created_at: :desc) }
scope :sort_descendants_by_most_voted , -> { order(confidence_score: :desc, created_at: :asc) }
scope :sort_by_most_voted, -> { order(confidence_score: :desc, created_at: :desc) }
scope :sort_descendants_by_most_voted, -> { order(confidence_score: :desc, created_at: :asc) }
scope :sort_by_newest, -> { order(created_at: :desc) }
scope :sort_descendants_by_newest, -> { order(created_at: :desc) }
@@ -95,7 +95,7 @@ class Comment < ActiveRecord::Base
end
def self.body_max_length
Setting['comments_body_max_length'].to_i
Setting['comments_body_max_length'].to_i
end
def calculate_confidence_score

View File

@@ -13,7 +13,7 @@ module Flaggable
end
def ignore_flag
update(ignored_flag_at: Time.now)
update(ignored_flag_at: Time.current)
end
end

View File

@@ -28,7 +28,7 @@ class Debate < ActiveRecord::Base
before_save :calculate_hot_score, :calculate_confidence_score
scope :for_render, -> { includes(:tags) }
scope :sort_by_hot_score , -> { reorder(hot_score: :desc) }
scope :sort_by_hot_score, -> { reorder(hot_score: :desc) }
scope :sort_by_confidence_score, -> { reorder(confidence_score: :desc) }
scope :sort_by_created_at, -> { reorder(created_at: :desc) }
scope :sort_by_most_commented, -> { reorder(comments_count: :desc) }

View File

@@ -4,7 +4,7 @@ class Lock < ActiveRecord::Base
before_save :set_locked_until
def locked?
locked_until > Time.now
locked_until > Time.current
end
def set_locked_until
@@ -12,7 +12,7 @@ class Lock < ActiveRecord::Base
end
def lock_time
Time.now + (2**tries).minutes
Time.current + (2**tries).minutes
end
def too_many_tries?

View File

@@ -49,4 +49,5 @@ class Notification < ActiveRecord::Base
def linkable_resource
notifiable.is_a?(ProposalNotification) ? notifiable.proposal : notifiable
end
end

View File

@@ -14,11 +14,11 @@ class Organization < ActiveRecord::Base
scope :rejected, -> { where.not(rejected_at: nil).where("(organizations.verified_at IS NULL or organizations.verified_at < rejected_at)") }
def verify
update(verified_at: Time.now)
update(verified_at: Time.current)
end
def reject
update(rejected_at: Time.now)
update(rejected_at: Time.current)
end
def verified?

View File

@@ -44,9 +44,13 @@ class Proposal < ActiveRecord::Base
scope :sort_by_random, -> { reorder("RANDOM()") }
scope :sort_by_relevance, -> { all }
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
scope :sort_by_archival_date, -> { archived.sort_by_confidence_score }
scope :archived, -> { where("proposals.created_at <= ?", Setting["months_to_archive_proposals"].to_i.months.ago)}
scope :not_archived, -> { where("proposals.created_at > ?", Setting["months_to_archive_proposals"].to_i.months.ago)}
scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago)}
scope :retired, -> { where.not(retired_at: nil) }
scope :not_retired, -> { where(retired_at: nil) }
scope :successfull, -> { where("cached_votes_up + physical_votes >= ?", Proposal.votes_needed_for_success)}
def to_param
"#{id}-#{title}".parameterize
@@ -115,7 +119,7 @@ class Proposal < ActiveRecord::Base
end
def register_vote(user, vote_value)
if votable_by?(user)
if votable_by?(user) && !archived?
vote_by(voter: user, vote: vote_value)
end
end
@@ -151,6 +155,14 @@ class Proposal < ActiveRecord::Base
Setting['votes_for_proposal_success'].to_i
end
def successfull?
total_votes >= Proposal.votes_needed_for_success
end
def archived?
self.created_at <= Setting["months_to_archive_proposals"].to_i.months.ago
end
def notifications
proposal_notifications
end

View File

@@ -9,9 +9,9 @@ class ProposalNotification < ActiveRecord::Base
def minimum_interval
return true if proposal.try(:notifications).blank?
if proposal.notifications.last.created_at > (Time.now - Setting[:proposal_notification_minimum_interval_in_days].to_i.days).to_datetime
if proposal.notifications.last.created_at > (Time.current - Setting[:proposal_notification_minimum_interval_in_days].to_i.days).to_datetime
errors.add(:title, I18n.t('activerecord.errors.models.proposal_notification.attributes.minimum_interval.invalid', interval: Setting[:proposal_notification_minimum_interval_in_days]))
end
end
end
end

View File

@@ -114,7 +114,7 @@ class SpendingProposal < ActiveRecord::Base
def send_unfeasible_email
Mailer.unfeasible_spending_proposal(self).deliver_later
update(unfeasible_email_sent_at: Time.now)
update(unfeasible_email_sent_at: Time.current)
end
def reason_for_not_being_votable_by(user)

View File

@@ -2,8 +2,8 @@ class User < ActiveRecord::Base
include Verification
devise :database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable, :omniauthable, :async
devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable,
:trackable, :validatable, :omniauthable, :async, :password_expirable, :secure_validatable
acts_as_voter
acts_as_paranoid column: :hidden_at
@@ -70,7 +70,7 @@ class User < ActiveRecord::Base
oauth_email: oauth_email,
password: Devise.friendly_token[0,20],
terms_of_service: '1',
confirmed_at: oauth_email_confirmed ? DateTime.now : nil
confirmed_at: oauth_email_confirmed ? DateTime.current : nil
)
end
@@ -164,7 +164,7 @@ class User < ActiveRecord::Base
def erase(erase_reason = nil)
self.update(
erased_at: Time.now,
erased_at: Time.current,
erase_reason: erase_reason,
username: nil,
email: nil,
@@ -252,6 +252,7 @@ class User < ActiveRecord::Base
delegate :can?, :cannot?, to: :ability
private
def clean_document_number
self.document_number = self.document_number.gsub(/[^a-z0-9]+/i, "").upcase unless self.document_number.blank?
end

View File

@@ -17,7 +17,7 @@ class Verification::Letter
end
def letter_requested!
user.update(letter_requested_at: Time.now, letter_verification_code: generate_verification_code)
user.update(letter_requested_at: Time.current, letter_verification_code: generate_verification_code)
end
def validate_existing_user

View File

@@ -40,7 +40,7 @@ class Verification::Management::Document
end
def verify
user.update(verified_at: Time.now) if user?
user.update(verified_at: Time.current) if user?
end
end

View File

@@ -27,8 +27,8 @@ class Verification::Management::Email
user.update(document_type: document_type,
document_number: document_number,
residence_verified_at: Time.now,
level_two_verified_at: Time.now,
residence_verified_at: Time.current,
level_two_verified_at: Time.current,
email_verification_token: plain_token)
Mailer.email_verification(user, email, encrypted_token, document_type, document_number).deliver_later

View File

@@ -31,7 +31,7 @@ class Verification::Residence
geozone: self.geozone,
date_of_birth: date_of_birth.to_datetime,
gender: gender,
residence_verified_at: Time.now)
residence_verified_at: Time.current)
end
def allowed_age

View File

@@ -6,13 +6,17 @@
<span class="in_favor">
<% if can?(:vote, comment) %>
<%= link_to vote_comment_path(comment, value: 'yes'),
method: "post", remote: true do %>
<span class="icon-angle-up">
method: "post", remote: true, title: t('votes.agree') do %>
<span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span>
</span>
<% end %>
<% else %>
<span class="icon-angle-up"></span>
<%= link_to new_user_session_path do %>
<span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span>
</span>
<% end %>
<% end %>
<%= comment.total_likes %>
</span>
@@ -20,47 +24,63 @@
<span class="against">
<% if can?(:vote, comment) %>
<%= link_to vote_comment_path(comment, value: 'no'),
method: "post", remote: true do %>
<span class="icon-angle-down">
method: "post", remote: true, title: t('votes.disagree') do %>
<span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span>
</span>
<% end %>
<% else %>
<span class="icon-angle-down"></span>
<span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span>
</span>
<% end %>
<%= comment.total_dislikes %>
</span>
<% elsif !user_signed_in? %>
<div class="logged" >
<div class="participation-allowed">
<%= t('comments.comment.votes', count: comment.total_votes) %>
&nbsp;|&nbsp;
<span class="in_favor">
<% if can?(:vote, comment) %>
<%= link_to vote_comment_path(comment, value: 'yes'),
method: "post", remote: true do %>
<span class="icon-angle-up"></span>
method: "post", remote: true, title: t('votes.agree') do %>
<span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span>
</span>
<% end %>
<% else %>
<span class="icon-angle-up"></span>
<%= link_to new_user_session_path do %>
<span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span>
</span>
<% end %>
<% end %>
<%= comment.total_likes %>
</span>
<span class="against">
<% if can?(:vote, comment) %>
<%= link_to vote_comment_path(comment, value: 'no'),
method: "post", remote: true do %>
<span class="icon-angle-down"></span>
method: "post", remote: true, title: t('votes.disagree') do %>
<span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span>
</span>
<% end %>
<% else %>
<span class="icon-angle-down"></span>
<%= link_to new_user_session_path do %>
<span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span>
</span>
<% end %>
<% end %>
<%= comment.total_dislikes %>
</span>
</div>
<div class="not-logged" style='display:none'>
</div>
<div class="participation-not-allowed" style='display:none' aria-hidden="false">
<%= t("votes.comment_unauthenticated",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>

View File

@@ -48,7 +48,7 @@
</div>
</div>
<div id="<%= dom_id(debate) %>_votes" class="small-12 medium-3 column text-center">
<div id="<%= dom_id(debate) %>_votes" class="small-12 medium-3 column">
<%= render 'debates/votes', debate: debate %>
</div>

View File

@@ -26,23 +26,23 @@
</span>
<% if user_signed_in? && current_user.organization? %>
<div class="organizations-votes" style='display:none' aria-hidden="false">
<p>
<%= t("votes.organizations") %>
</p>
</div>
<div class="participation-not-allowed" style='display:none' aria-hidden="false">
<p>
<%= t("votes.organizations") %>
</p>
</div>
<% elsif user_signed_in? && !debate.votable_by?(current_user)%>
<div class="anonymous-votes" style='display:none' aria-hidden="false">
<p>
<%= t("votes.anonymous",
verify_account: link_to(t("votes.verify_account"), verification_path )).html_safe %>
</p>
</div>
<div class="participation-not-allowed" style='display:none' aria-hidden="false">
<p>
<%= t("votes.anonymous",
verify_account: link_to(t("votes.verify_account"), verification_path )).html_safe %>
</p>
</div>
<% elsif !user_signed_in? %>
<div class="not-logged" style='display:none' aria-hidden="false">
<%= t("votes.unauthenticated",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
</div>
<div class="participation-not-allowed" style='display:none' aria-hidden="false">
<%= t("votes.unauthenticated",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
</div>
<% end %>
</div>

View File

@@ -1,4 +1,4 @@
<div class="debate-edit row">
<div class="debate-form row">
<div class="small-12 column">
<%= render "shared/back_link" %>

View File

@@ -6,7 +6,9 @@
<% end %>
<main>
<div class="wrap row">
<h1 class="sr-only"><%= t("shared.outline.debates") %></h1>
<div class="row">
<div id="debates" class="debates-list small-12 medium-9 column">
<div class="small-12 search-results">
@@ -29,7 +31,11 @@
<%= render "shared/banner" %>
<% end %>
<% unless @tag_filter || @search_terms || !has_featured? %>
<% if @proposal_successfull_exists %>
<%= render "proposals/proposal_ballots_banner" %>
<% end %>
<% unless @tag_filter || @search_terms || !has_featured? || @proposal_ballots.present? || @proposal_successfull_exists %>
<%= render "featured_debates" %>
<% end %>

View File

@@ -1,4 +1,4 @@
<div class="debate-new row">
<div class="debate-form row">
<div class="small-12 medium-9 column">
<%= render "shared/back_link" %>

View File

@@ -45,10 +45,8 @@
<aside class="small-12 medium-3 column">
<div class="sidebar-divider"></div>
<h3><%= t("votes.supports") %></h3>
<div class="text-center">
<div id="<%= dom_id(@debate) %>_votes">
<%= render 'debates/votes', debate: @debate %>
</div>
<div id="<%= dom_id(@debate) %>_votes">
<%= render 'debates/votes', debate: @debate %>
</div>
<div class="sidebar-divider"></div>
<h3><%= t("debates.show.share") %></h3>

View File

@@ -0,0 +1,13 @@
<h2><%= t("devise.password_expired.expire_password") %></h2>
<%= form_for(resource, :as => resource_name, :url => [resource_name, :password_expired], :html => { :method => :put }) do |f| %>
<%= f.password_field :current_password %></p>
<%= f.label t("devise.password_expired.new_password") %>
<%= f.password_field :password, label: false %></p>
<%= f.password_field :password_confirmation %></p>
<p><%= f.submit t("devise.password_expired.change_password") %></p>
<% end %>

View File

@@ -13,6 +13,6 @@
</div>
<h1><%= @direct_message.title %></h1>
<p><%= @direct_message.body %></p>
<p><%= simple_format text_with_links(@direct_message.body), {}, sanitize: false %></p>
</div>
</div>

View File

@@ -1,6 +1,7 @@
<%= paginator.render do -%>
<div class="pagination-centered">
<nav>
<h1 class="sr-only"><%= t("shared.outline.pagination") %></h1>
<ul class="pagination text-center margin-top" aria-label="Pagination">
<%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %>

View File

@@ -1,10 +1,12 @@
<% flash.each do |flash_key, flash_message| %>
<div id="<%= flash_key %>" data-alert class="row" data-closable>
<div class="callout <%= flash_key %>">
<div id="<%= flash_key %>" data-alert class="notice-container callout-slide" data-closable>
<div class="callout notice <%= flash_key %>">
<button class="close-button" aria-label="<%= t("application.close") %>" type="button" data-close>
<span aria-hidden="true">&times;</span>
</button>
<%= flash_message %>
<div class="notice-text">
<%= flash_message %>
</div>
</div>
</div>
<% end %>

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