diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 000000000..be2d522a4 --- /dev/null +++ b/.rubocop.yml @@ -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 diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 000000000..443782795 --- /dev/null +++ b/.rubocop_todo.yml @@ -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' diff --git a/.ruby-version b/.ruby-version index a6254504e..e7034819f 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.1 \ No newline at end of file +2.3.2 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index a45f36990..54460ab58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 \ No newline at end of file diff --git a/CONTRIBUTING_EN.md b/CONTRIBUTING_EN.md index 0c322d506..17f93bc63 100644 --- a/CONTRIBUTING_EN.md +++ b/CONTRIBUTING_EN.md @@ -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). diff --git a/CONTRIBUTING_ES.md b/CONTRIBUTING_ES.md index 7a8d10877..aaee9ec92 100644 --- a/CONTRIBUTING_ES.md +++ b/CONTRIBUTING_ES.md @@ -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 diff --git a/CUSTOMIZE_ES.md b/CUSTOMIZE_ES.md index 71c3701e4..f7af01649 100644 --- a/CUSTOMIZE_ES.md +++ b/CUSTOMIZE_ES.md @@ -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 diff --git a/Capfile b/Capfile index 0f53b8e9a..1a33b63f0 100644 --- a/Capfile +++ b/Capfile @@ -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 } diff --git a/Gemfile b/Gemfile index 1819992d3..1ce218638 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock index 121d7b86e..50ab5bb9d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 diff --git a/README.md b/README.md index 27162bfd7..8c95f3648 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/README_ES.md b/README_ES.md index d8c394680..a18b7d241 100644 --- a/README_ES.md +++ b/README_ES.md @@ -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 diff --git a/Rakefile b/Rakefile index ba6b733dd..ef2c381ff 100644 --- a/Rakefile +++ b/Rakefile @@ -4,3 +4,4 @@ require File.expand_path('../config/application', __FILE__) Rails.application.load_tasks +Knapsack.load_tasks if defined?(Knapsack) \ No newline at end of file diff --git a/app/assets/images/ballot.gif b/app/assets/images/ballot.gif new file mode 100644 index 000000000..18cf0717f Binary files /dev/null and b/app/assets/images/ballot.gif differ diff --git a/app/assets/images/ballot_tiny.gif b/app/assets/images/ballot_tiny.gif new file mode 100644 index 000000000..976d37591 Binary files /dev/null and b/app/assets/images/ballot_tiny.gif differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index b9a3ec9dc..2eb3a93a6 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -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(){ diff --git a/app/assets/javascripts/social_share.js.coffee b/app/assets/javascripts/social_share.js.coffee new file mode 100644 index 000000000..a61f2d8f4 --- /dev/null +++ b/app/assets/javascripts/social_share.js.coffee @@ -0,0 +1,7 @@ +App.SocialShare = + + initialize: -> + $(".social-share-button a").each -> + element = $(this) + site = element.data('site') + element.append("#{site}") \ No newline at end of file diff --git a/app/assets/javascripts/votes.js.coffee b/app/assets/javascripts/votes.js.coffee index 030b9cf46..b842c3ffc 100644 --- a/app/assets/javascripts/votes.js.coffee +++ b/app/assets/javascripts/votes.js.coffee @@ -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: -> diff --git a/app/assets/stylesheets/_settings.scss b/app/assets/stylesheets/_settings.scss index 44433938b..4149020fa 100644 --- a/app/assets/stylesheets/_settings.scss +++ b/app/assets/stylesheets/_settings.scss @@ -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; diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index 7eab8c070..90dee613a 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -91,7 +91,7 @@ body.admin { .admin-content { - .proposal-new, .proposal-edit { + .proposal-form { padding-top: 0; } diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 215f2453d..2d0de02e3 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -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 { diff --git a/app/assets/stylesheets/mixins.scss b/app/assets/stylesheets/mixins.scss index d772b8ace..5ffc534cb 100644 --- a/app/assets/stylesheets/mixins.scss +++ b/app/assets/stylesheets/mixins.scss @@ -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; diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 3743d89bc..3e3e13323 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -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); + } + } +} diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index c3d814b38..c46b6e42f 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -29,4 +29,4 @@ class AccountController < ApplicationController end end -end +end \ No newline at end of file diff --git a/app/controllers/admin/banners_controller.rb b/app/controllers/admin/banners_controller.rb index dbf683b9a..c96c7c72b 100644 --- a/app/controllers/admin/banners_controller.rb +++ b/app/controllers/admin/banners_controller.rb @@ -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 \ No newline at end of file diff --git a/app/controllers/admin/comments_controller.rb b/app/controllers/admin/comments_controller.rb index a0272f367..1f3d8e837 100644 --- a/app/controllers/admin/comments_controller.rb +++ b/app/controllers/admin/comments_controller.rb @@ -20,8 +20,9 @@ class Admin::CommentsController < Admin::BaseController end private + def load_comment @comment = Comment.with_hidden.find(params[:id]) end -end +end \ No newline at end of file diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index f7aa5c440..5fb5e3c13 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -3,4 +3,4 @@ class Admin::DashboardController < Admin::BaseController def index end -end +end \ No newline at end of file diff --git a/app/controllers/admin/debates_controller.rb b/app/controllers/admin/debates_controller.rb index 0b0b31b8b..bbe4a06d7 100644 --- a/app/controllers/admin/debates_controller.rb +++ b/app/controllers/admin/debates_controller.rb @@ -29,4 +29,4 @@ class Admin::DebatesController < Admin::BaseController @debate = Debate.with_hidden.find(params[:id]) end -end +end \ No newline at end of file diff --git a/app/controllers/admin/officials_controller.rb b/app/controllers/admin/officials_controller.rb index 2d570c2dc..e0a0a86ca 100644 --- a/app/controllers/admin/officials_controller.rb +++ b/app/controllers/admin/officials_controller.rb @@ -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 \ No newline at end of file diff --git a/app/controllers/admin/organizations_controller.rb b/app/controllers/admin/organizations_controller.rb index 77f71ed65..b85460459 100644 --- a/app/controllers/admin/organizations_controller.rb +++ b/app/controllers/admin/organizations_controller.rb @@ -27,4 +27,4 @@ class Admin::OrganizationsController < Admin::BaseController redirect_to request.query_parameters.merge(action: :index) end -end +end \ No newline at end of file diff --git a/app/controllers/admin/proposals_controller.rb b/app/controllers/admin/proposals_controller.rb index e7c4934fa..2a6dfd718 100644 --- a/app/controllers/admin/proposals_controller.rb +++ b/app/controllers/admin/proposals_controller.rb @@ -25,4 +25,4 @@ class Admin::ProposalsController < Admin::BaseController @proposal = Proposal.with_hidden.find(params[:id]) end -end +end \ No newline at end of file diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb index 17bd364f3..f17afff4c 100644 --- a/app/controllers/admin/settings_controller.rb +++ b/app/controllers/admin/settings_controller.rb @@ -15,7 +15,9 @@ class Admin::SettingsController < Admin::BaseController end private + def settings_params params.require(:setting).permit(:value) end + end \ No newline at end of file diff --git a/app/controllers/admin/spending_proposals_controller.rb b/app/controllers/admin/spending_proposals_controller.rb index e4c13e612..b5923f2f6 100644 --- a/app/controllers/admin/spending_proposals_controller.rb +++ b/app/controllers/admin/spending_proposals_controller.rb @@ -54,4 +54,4 @@ class Admin::SpendingProposalsController < Admin::BaseController @tags = ActsAsTaggableOn::Tag.spending_proposal_tags end -end +end \ No newline at end of file diff --git a/app/controllers/admin/stats_controller.rb b/app/controllers/admin/stats_controller.rb index 7e5b902e9..3624174a5 100644 --- a/app/controllers/admin/stats_controller.rb +++ b/app/controllers/admin/stats_controller.rb @@ -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 \ No newline at end of file diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index eed1c4fea..1e17e1c2d 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -30,4 +30,4 @@ class Admin::UsersController < Admin::BaseController @user = User.with_hidden.find(params[:id]) end -end +end \ No newline at end of file diff --git a/app/controllers/admin/valuators_controller.rb b/app/controllers/admin/valuators_controller.rb index 3e403c9fc..4b52a753e 100644 --- a/app/controllers/admin/valuators_controller.rb +++ b/app/controllers/admin/valuators_controller.rb @@ -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 \ No newline at end of file diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index df928aa02..0a0018c9f 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -77,4 +77,4 @@ class CommentsController < ApplicationController Notification.add(notifiable.author_id, notifiable) unless comment.author_id == notifiable.author_id end -end +end \ No newline at end of file diff --git a/app/controllers/concerns/commentable_actions.rb b/app/controllers/concerns/commentable_actions.rb index 3a79238ea..ef5e60dcb 100644 --- a/app/controllers/concerns/commentable_actions.rb +++ b/app/controllers/concerns/commentable_actions.rb @@ -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 \ No newline at end of file diff --git a/app/controllers/concerns/moderate_actions.rb b/app/controllers/concerns/moderate_actions.rb index 792dacde0..05aa0e97f 100644 --- a/app/controllers/concerns/moderate_actions.rb +++ b/app/controllers/concerns/moderate_actions.rb @@ -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 diff --git a/app/controllers/concerns/polymorphic.rb b/app/controllers/concerns/polymorphic.rb index 51c5768c9..10d64698d 100644 --- a/app/controllers/concerns/polymorphic.rb +++ b/app/controllers/concerns/polymorphic.rb @@ -1,6 +1,7 @@ module Polymorphic private + def resource @resource ||= instance_variable_get("@#{resource_name}") end diff --git a/app/controllers/debates_controller.rb b/app/controllers/debates_controller.rb index e077e5e8a..8262f014a 100644 --- a/app/controllers/debates_controller.rb +++ b/app/controllers/debates_controller.rb @@ -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 diff --git a/app/controllers/management/account_controller.rb b/app/controllers/management/account_controller.rb index 85b9feea4..64e0ddf4d 100644 --- a/app/controllers/management/account_controller.rb +++ b/app/controllers/management/account_controller.rb @@ -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 diff --git a/app/controllers/management/dashboard_controller.rb b/app/controllers/management/dashboard_controller.rb index abb605341..87b134270 100644 --- a/app/controllers/management/dashboard_controller.rb +++ b/app/controllers/management/dashboard_controller.rb @@ -3,4 +3,4 @@ class Management::DashboardController < Management::BaseController def index end -end +end \ No newline at end of file diff --git a/app/controllers/management/document_verifications_controller.rb b/app/controllers/management/document_verifications_controller.rb index 1b8fabcc2..510e4fa93 100644 --- a/app/controllers/management/document_verifications_controller.rb +++ b/app/controllers/management/document_verifications_controller.rb @@ -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 \ No newline at end of file diff --git a/app/controllers/management/email_verifications_controller.rb b/app/controllers/management/email_verifications_controller.rb index 3558e6fbf..7d511fe4b 100644 --- a/app/controllers/management/email_verifications_controller.rb +++ b/app/controllers/management/email_verifications_controller.rb @@ -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 \ No newline at end of file diff --git a/app/controllers/management/proposals_controller.rb b/app/controllers/management/proposals_controller.rb index 2ce74d6d5..1a30526f5 100644 --- a/app/controllers/management/proposals_controller.rb +++ b/app/controllers/management/proposals_controller.rb @@ -53,4 +53,4 @@ class Management::ProposalsController < Management::BaseController @comment_flags = managed_user ? managed_user.comment_flags(comments) : {} end -end +end \ No newline at end of file diff --git a/app/controllers/management/sessions_controller.rb b/app/controllers/management/sessions_controller.rb index bca17bf4c..5d0587ae5 100644 --- a/app/controllers/management/sessions_controller.rb +++ b/app/controllers/management/sessions_controller.rb @@ -42,4 +42,4 @@ class Management::SessionsController < ActionController::Base end end -end +end \ No newline at end of file diff --git a/app/controllers/management/user_invites_controller.rb b/app/controllers/management/user_invites_controller.rb index cbe3d1914..4d9b4909f 100644 --- a/app/controllers/management/user_invites_controller.rb +++ b/app/controllers/management/user_invites_controller.rb @@ -10,4 +10,4 @@ class Management::UserInvitesController < Management::BaseController end end -end +end \ No newline at end of file diff --git a/app/controllers/management/users_controller.rb b/app/controllers/management/users_controller.rb index 8ee04cfdf..53004a838 100644 --- a/app/controllers/management/users_controller.rb +++ b/app/controllers/management/users_controller.rb @@ -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 diff --git a/app/controllers/moderation/users_controller.rb b/app/controllers/moderation/users_controller.rb index 3255bb6cc..cd1fff9a5 100644 --- a/app/controllers/moderation/users_controller.rb +++ b/app/controllers/moderation/users_controller.rb @@ -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 \ No newline at end of file diff --git a/app/controllers/organizations/registrations_controller.rb b/app/controllers/organizations/registrations_controller.rb index 503c26bc0..a77534d8c 100644 --- a/app/controllers/organizations/registrations_controller.rb +++ b/app/controllers/organizations/registrations_controller.rb @@ -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 diff --git a/app/controllers/proposal_ballots_controller.rb b/app/controllers/proposal_ballots_controller.rb new file mode 100644 index 000000000..4171fcda8 --- /dev/null +++ b/app/controllers/proposal_ballots_controller.rb @@ -0,0 +1,8 @@ +class ProposalBallotsController < ApplicationController + skip_authorization_check + + def index + @proposal_ballots = Proposal.successfull.sort_by_confidence_score + end + +end \ No newline at end of file diff --git a/app/controllers/proposal_notifications_controller.rb b/app/controllers/proposal_notifications_controller.rb index fc9cdf3d8..36e265e38 100644 --- a/app/controllers/proposal_notifications_controller.rb +++ b/app/controllers/proposal_notifications_controller.rb @@ -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 \ No newline at end of file diff --git a/app/controllers/proposals_controller.rb b/app/controllers/proposals_controller.rb index 578395ab3..d0ff9551e 100644 --- a/app/controllers/proposals_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -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 diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index d600e2e9c..ab6bedd6e 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -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 diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 81eaa08cb..cbe43390b 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -44,4 +44,4 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController @user.save || @user.save_requiring_finish_signup end -end +end \ No newline at end of file diff --git a/app/controllers/valuation/spending_proposals_controller.rb b/app/controllers/valuation/spending_proposals_controller.rb index f130baec4..623c9ac46 100644 --- a/app/controllers/valuation/spending_proposals_controller.rb +++ b/app/controllers/valuation/spending_proposals_controller.rb @@ -77,4 +77,4 @@ class Valuation::SpendingProposalsController < Valuation::BaseController @spending_proposal.errors.empty? end -end +end \ No newline at end of file diff --git a/app/controllers/verification/email_controller.rb b/app/controllers/verification/email_controller.rb index 9f8fd9f8a..1774197d9 100644 --- a/app/controllers/verification/email_controller.rb +++ b/app/controllers/verification/email_controller.rb @@ -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') diff --git a/app/controllers/verification/letter_controller.rb b/app/controllers/verification/letter_controller.rb index bf5033b32..0e726a683 100644 --- a/app/controllers/verification/letter_controller.rb +++ b/app/controllers/verification/letter_controller.rb @@ -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 diff --git a/app/controllers/verification/sms_controller.rb b/app/controllers/verification/sms_controller.rb index 1cb5b2d8e..f06af5e6a 100644 --- a/app/controllers/verification/sms_controller.rb +++ b/app/controllers/verification/sms_controller.rb @@ -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 \ No newline at end of file +end diff --git a/app/controllers/verification/verified_user_controller.rb b/app/controllers/verification/verified_user_controller.rb index 23045e451..e637bb232 100644 --- a/app/controllers/verification/verified_user_controller.rb +++ b/app/controllers/verification/verified_user_controller.rb @@ -9,6 +9,7 @@ class Verification::VerifiedUserController < ApplicationController end private + def user_data_present? return false if @verified_users.blank? diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index fc43f5357..d0c650fa3 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -16,5 +16,4 @@ class WelcomeController < ApplicationController redirect_to verification_path if signed_in? end - end diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 515a54deb..62d31cd05 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -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 diff --git a/app/helpers/banners_helper.rb b/app/helpers/banners_helper.rb index 548513c7d..a1505a39e 100644 --- a/app/helpers/banners_helper.rb +++ b/app/helpers/banners_helper.rb @@ -1,5 +1,7 @@ module BannersHelper + def has_banners @banners.count > 0 end + end \ No newline at end of file diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb index 9d9d08075..13884237b 100644 --- a/app/helpers/comments_helper.rb +++ b/app/helpers/comments_helper.rb @@ -39,4 +39,5 @@ module CommentsHelper "" # Default not author class end end -end + +end \ No newline at end of file diff --git a/app/helpers/debates_helper.rb b/app/helpers/debates_helper.rb index 3c1aa02a7..8db989f61 100644 --- a/app/helpers/debates_helper.rb +++ b/app/helpers/debates_helper.rb @@ -1,6 +1,7 @@ module DebatesHelper - def has_featured? + def has_featured? Debate.all.featured.count > 0 end + end \ No newline at end of file diff --git a/app/helpers/embed_videos_helper.rb b/app/helpers/embed_videos_helper.rb index b48799bf5..8633549f4 100644 --- a/app/helpers/embed_videos_helper.rb +++ b/app/helpers/embed_videos_helper.rb @@ -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] diff --git a/app/helpers/flags_helper.rb b/app/helpers/flags_helper.rb index b5ba67f41..715937c0f 100644 --- a/app/helpers/flags_helper.rb +++ b/app/helpers/flags_helper.rb @@ -26,4 +26,4 @@ module FlagsHelper end end -end +end \ No newline at end of file diff --git a/app/helpers/locales_helper.rb b/app/helpers/locales_helper.rb new file mode 100644 index 000000000..717be9e9b --- /dev/null +++ b/app/helpers/locales_helper.rb @@ -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 \ No newline at end of file diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index 2b907535f..7342393a7 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -1,4 +1,2 @@ module NotificationsHelper - - end diff --git a/app/helpers/proposals_helper.rb b/app/helpers/proposals_helper.rb index 9eaa88549..578cd1d8e 100644 --- a/app/helpers/proposals_helper.rb +++ b/app/helpers/proposals_helper.rb @@ -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 diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb index cd90a8a39..ad844e29f 100644 --- a/app/helpers/settings_helper.rb +++ b/app/helpers/settings_helper.rb @@ -8,4 +8,4 @@ module SettingsHelper @all_settings ||= Hash[ Setting.all.map{|s| [s.key, s.value.presence]} ] end -end +end \ No newline at end of file diff --git a/app/helpers/stats_helper.rb b/app/helpers/stats_helper.rb index 097711b88..e481ef7e1 100644 --- a/app/helpers/stats_helper.rb +++ b/app/helpers/stats_helper.rb @@ -20,4 +20,5 @@ module StatsHelper opt[:data][:graph] = admin_api_stats_path(spending_proposals: true) content_tag :div, "", opt end + end diff --git a/app/helpers/tracks_helper.rb b/app/helpers/tracks_helper.rb index 53c110d49..557d71802 100644 --- a/app/helpers/tracks_helper.rb +++ b/app/helpers/tracks_helper.rb @@ -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 \ No newline at end of file diff --git a/app/models/banner.rb b/app/models/banner.rb index db8f10635..c4f2295e6 100644 --- a/app/models/banner.rb +++ b/app/models/banner.rb @@ -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 \ No newline at end of file +end diff --git a/app/models/comment.rb b/app/models/comment.rb index 47beb5050..0bfb6a320 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -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 diff --git a/app/models/concerns/flaggable.rb b/app/models/concerns/flaggable.rb index a111562b3..c3125c440 100644 --- a/app/models/concerns/flaggable.rb +++ b/app/models/concerns/flaggable.rb @@ -13,7 +13,7 @@ module Flaggable end def ignore_flag - update(ignored_flag_at: Time.now) + update(ignored_flag_at: Time.current) end end diff --git a/app/models/debate.rb b/app/models/debate.rb index 41b270444..de29c5864 100644 --- a/app/models/debate.rb +++ b/app/models/debate.rb @@ -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) } diff --git a/app/models/lock.rb b/app/models/lock.rb index 3c043de79..c0d5fae39 100644 --- a/app/models/lock.rb +++ b/app/models/lock.rb @@ -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? diff --git a/app/models/notification.rb b/app/models/notification.rb index c6c32eb8d..e993e55f8 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -49,4 +49,5 @@ class Notification < ActiveRecord::Base def linkable_resource notifiable.is_a?(ProposalNotification) ? notifiable.proposal : notifiable end + end \ No newline at end of file diff --git a/app/models/organization.rb b/app/models/organization.rb index 069afc27f..74fd16111 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -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? diff --git a/app/models/proposal.rb b/app/models/proposal.rb index 7ccf8995f..ebc62e364 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -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 diff --git a/app/models/proposal_notification.rb b/app/models/proposal_notification.rb index f73264318..60912d887 100644 --- a/app/models/proposal_notification.rb +++ b/app/models/proposal_notification.rb @@ -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 \ No newline at end of file +end diff --git a/app/models/spending_proposal.rb b/app/models/spending_proposal.rb index a2c143336..223e9adfe 100644 --- a/app/models/spending_proposal.rb +++ b/app/models/spending_proposal.rb @@ -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) diff --git a/app/models/user.rb b/app/models/user.rb index 5c69b25b1..8214b8309 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/app/models/verification/letter.rb b/app/models/verification/letter.rb index 0beb7c8d8..c746e73e4 100644 --- a/app/models/verification/letter.rb +++ b/app/models/verification/letter.rb @@ -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 diff --git a/app/models/verification/management/document.rb b/app/models/verification/management/document.rb index fcbc19ca4..f01c132bb 100644 --- a/app/models/verification/management/document.rb +++ b/app/models/verification/management/document.rb @@ -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 diff --git a/app/models/verification/management/email.rb b/app/models/verification/management/email.rb index 33282b569..de13d1ab4 100644 --- a/app/models/verification/management/email.rb +++ b/app/models/verification/management/email.rb @@ -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 diff --git a/app/models/verification/residence.rb b/app/models/verification/residence.rb index cc24bb7c8..96a36e5cd 100644 --- a/app/models/verification/residence.rb +++ b/app/models/verification/residence.rb @@ -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 diff --git a/app/views/comments/_votes.html.erb b/app/views/comments/_votes.html.erb index 8ee315e35..93af5b2dd 100644 --- a/app/views/comments/_votes.html.erb +++ b/app/views/comments/_votes.html.erb @@ -6,13 +6,17 @@ <% if can?(:vote, comment) %> <%= link_to vote_comment_path(comment, value: 'yes'), - method: "post", remote: true do %> - + method: "post", remote: true, title: t('votes.agree') do %> + <%= t('votes.agree') %> <% end %> <% else %> - + <%= link_to new_user_session_path do %> + + <%= t('votes.agree') %> + + <% end %> <% end %> <%= comment.total_likes %> @@ -20,47 +24,63 @@ <% if can?(:vote, comment) %> <%= link_to vote_comment_path(comment, value: 'no'), - method: "post", remote: true do %> - + method: "post", remote: true, title: t('votes.disagree') do %> + <%= t('votes.disagree') %> <% end %> <% else %> - + + <%= t('votes.disagree') %> + <% end %> <%= comment.total_dislikes %> <% elsif !user_signed_in? %> -
+
<%= t('comments.comment.votes', count: comment.total_votes) %>  |  <% if can?(:vote, comment) %> <%= link_to vote_comment_path(comment, value: 'yes'), - method: "post", remote: true do %> - + method: "post", remote: true, title: t('votes.agree') do %> + + <%= t('votes.agree') %> + <% end %> <% else %> - + <%= link_to new_user_session_path do %> + + <%= t('votes.agree') %> + + <% end %> <% end %> <%= comment.total_likes %> + <% if can?(:vote, comment) %> <%= link_to vote_comment_path(comment, value: 'no'), - method: "post", remote: true do %> - + method: "post", remote: true, title: t('votes.disagree') do %> + + <%= t('votes.disagree') %> + <% end %> <% else %> - + <%= link_to new_user_session_path do %> + + <%= t('votes.disagree') %> + + <% end %> <% end %> <%= comment.total_dislikes %> -
- + +
-
+
<%= render 'debates/votes', debate: debate %>
diff --git a/app/views/debates/_votes.html.erb b/app/views/debates/_votes.html.erb index 4c5f5a9b7..cc59a3f3a 100644 --- a/app/views/debates/_votes.html.erb +++ b/app/views/debates/_votes.html.erb @@ -26,23 +26,23 @@ <% if user_signed_in? && current_user.organization? %> - + <% elsif user_signed_in? && !debate.votable_by?(current_user)%> - + <% elsif !user_signed_in? %> - + <% end %>
diff --git a/app/views/debates/edit.html.erb b/app/views/debates/edit.html.erb index eea353438..13a2aa625 100644 --- a/app/views/debates/edit.html.erb +++ b/app/views/debates/edit.html.erb @@ -1,4 +1,4 @@ -
+
<%= render "shared/back_link" %> diff --git a/app/views/debates/index.html.erb b/app/views/debates/index.html.erb index 6809782b1..45d27bd56 100644 --- a/app/views/debates/index.html.erb +++ b/app/views/debates/index.html.erb @@ -6,7 +6,9 @@ <% end %>
-
+

<%= t("shared.outline.debates") %>

+ +
@@ -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 %> diff --git a/app/views/debates/new.html.erb b/app/views/debates/new.html.erb index 65d47bbcd..cd4a92cc6 100644 --- a/app/views/debates/new.html.erb +++ b/app/views/debates/new.html.erb @@ -1,4 +1,4 @@ -
+
<%= render "shared/back_link" %> diff --git a/app/views/debates/show.html.erb b/app/views/debates/show.html.erb index 9625ab42d..dca39677e 100644 --- a/app/views/debates/show.html.erb +++ b/app/views/debates/show.html.erb @@ -45,10 +45,8 @@
diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb index f129b1b9d..3a1495a1c 100644 --- a/app/views/kaminari/_paginator.html.erb +++ b/app/views/kaminari/_paginator.html.erb @@ -1,6 +1,7 @@ <%= paginator.render do -%>