Merge branch 'master' into redux-polling

This commit is contained in:
Juanjo Bazán
2016-12-27 18:22:06 +01:00
235 changed files with 3445 additions and 1099 deletions

2
.gitignore vendored
View File

@@ -29,3 +29,5 @@
# Mac finder artifacts # Mac finder artifacts
.DS_Store .DS_Store
.ruby-gemset .ruby-gemset
public/sitemap.xml

56
.rubocop.yml Normal file
View File

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

838
.rubocop_todo.yml Normal file
View File

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

View File

@@ -1 +1 @@
2.3.1 2.3.2

View File

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

View File

@@ -34,6 +34,16 @@ If you want to contribute code to solve an issue:
* Follow these [best practices](https://github.com/styleguide/ruby) * Follow these [best practices](https://github.com/styleguide/ruby)
* Open a *pull request* to the main repository describing what issue you are addressing. * 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 ## 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). * If you think there's a feature missing, or find a bug, create an issue (make sure it has not already been reported).

View File

@@ -34,6 +34,16 @@ Cuando quieras resolver una incidencia mediante código:
* Sigue estas [buenas prácticas](https://github.com/styleguide/ruby) * 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 * 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 ## 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 * Si crees que hay una funcionalidad que hace falta, o descubres un problema, abre una incidencia (asegúrate de que

View File

@@ -1,6 +1,6 @@
# Personalización # 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](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.
@@ -8,31 +8,32 @@ Hemos creado una estructura específica donde puedes sobreescribir y personaliza
Para adaptarlo puedes hacerlo a través de los directorios que están en custom dentro de: Para adaptarlo puedes hacerlo a través de los directorios que están en custom dentro de:
* config/locales/custom/ * `config/locales/custom/`
* app/assets/images/custom/ * `app/assets/images/custom/`
* app/views/custom/ * `app/views/custom/`
* app/controllers/custom/ * `app/controllers/custom/`
* app/models/custom/ * `app/models/custom/`
Aparte de estos directorios también cuentas con ciertos ficheros para: Aparte de estos directorios también cuentas con ciertos ficheros para:
* app/assets/stylesheets/custom.css * `app/assets/stylesheets/custom.css`
* app/assets/javascripts/custom.js * `app/assets/javascripts/custom.js`
* Gemfile_custom * `Gemfile_custom`
* config/application.custom.rb * `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) %> ```ruby
<%= 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):
``` ```yml
es: es:
layouts: layouts:
footer: footer:
@@ -40,11 +41,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 ### 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 * apple-touch-icon-200.png
* icon_home.png * icon_home.png
@@ -55,13 +56,13 @@ Si quieres sobreescribir alguna imagen debes primero fijarte el nombre que tiene
### Vistas (HTML) ### Vistas (HTML)
Si quieres modificar el HTML de alguna página puedes hacerlo copiando el HTML de *app/views* y poniendolo en *app/views/custom* respetando los subdirectorios que encuentres ahí. Por ejemplo si quieres modificar *app/views/pages/conditions.html* debes copiarlo y modificarla en app/views/custom/pages/conditions.html.erb Si quieres modificar el HTML de alguna página puedes hacerlo copiando el HTML de `app/views` y poniendolo en `app/views/custom` respetando los subdirectorios que encuentres ahí. Por ejemplo si quieres modificar `app/views/pages/conditions.html` debes copiarlo y modificarla en `app/views/custom/pages/conditions.html.erb`
### CSS ### 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:
``` ```css
.top-links { .top-links {
background: red; background: red;
} }
@@ -71,9 +72,9 @@ Usamos un preprocesador de CSS, [SASS, con la sintaxis SCSS](http://sass-lang.co
### Javascript ### 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:
``` ```js
$(function(){ $(function(){
alert('foobar'); alert('foobar');
}); });
@@ -81,11 +82,11 @@ $(function(){
### Modelos ### 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`:
``` ```ruby
require_dependency Rails.root.join('app', 'models', 'verification', 'residence').to_s require_dependency Rails.root.join('app', 'models', 'verification', 'residence').to_s
class Verification::Residence class Verification::Residence
@@ -116,10 +117,10 @@ class Verification::Residence
end end
``` ```
No olvides poner los tests relevantes en *spec/models/custom*, siguiendo con el ejemplo pondriamos lo siguiente en *spec/models/custom/residence_spec.rb*: No olvides poner los tests relevantes en `spec/models/custom`, siguiendo con el ejemplo pondriamos lo siguiente en `spec/models/custom/residence_spec.rb`:
``` ```ruby
require 'rails_helper' require 'rails_helper'
describe Verification::Residence do describe Verification::Residence do
@@ -162,20 +163,20 @@ TODO
### Gemfile ### 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
``` ```ruby
gem 'rails-footnotes', '~> 4.0' 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) 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:
``` ```ruby
module Consul module Consul
class Application < Rails::Application class Application < Rails::Application
config.i18n.default_locale = :en config.i18n.default_locale = :en

View File

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

13
Gemfile
View File

@@ -7,7 +7,7 @@ gem 'pg', '~> 0.19.0'
# Use SCSS for stylesheets # Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0', '>= 5.0.4' gem 'sass-rails', '~> 5.0', '>= 5.0.4'
# Use Uglifier as compressor for JavaScript assets # Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 3.0.3' gem 'uglifier', '>= 3.0.4'
# Use CoffeeScript for .coffee assets and views # Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2.1' gem 'coffee-rails', '~> 4.2.1'
# See https://github.com/rails/execjs#readme for more supported runtimes # See https://github.com/rails/execjs#readme for more supported runtimes
@@ -32,7 +32,7 @@ gem 'omniauth-facebook', '~> 3.0.0'
gem 'omniauth-google-oauth2', '~> 0.4.0' gem 'omniauth-google-oauth2', '~> 0.4.0'
gem 'kaminari' gem 'kaminari'
gem 'ancestry', '~> 2.2.1' gem 'ancestry', '~> 2.2.2'
gem 'acts-as-taggable-on' gem 'acts-as-taggable-on'
gem 'responders', '~> 2.3.0' gem 'responders', '~> 2.3.0'
gem 'foundation-rails', '~> 6.2.4.0' gem 'foundation-rails', '~> 6.2.4.0'
@@ -52,9 +52,10 @@ gem 'rollbar', '~> 2.13.3'
gem 'delayed_job_active_record', '~> 4.1.0' gem 'delayed_job_active_record', '~> 4.1.0'
gem 'daemons' gem 'daemons'
gem 'devise-async' gem 'devise-async'
gem 'newrelic_rpm', '~> 3.17.0.325' gem 'newrelic_rpm', '~> 3.17.1.326'
gem 'whenever', require: false gem 'whenever', require: false
gem 'pg_search' gem 'pg_search'
gem 'sitemap_generator'
gem 'ahoy_matey', '~> 1.4.2' gem 'ahoy_matey', '~> 1.4.2'
gem 'groupdate', '~> 3.1.0' # group temporary data gem 'groupdate', '~> 3.1.0' # group temporary data
@@ -79,12 +80,14 @@ group :development, :test do
gem 'letter_opener_web', '~> 1.3.0' gem 'letter_opener_web', '~> 1.3.0'
gem 'i18n-tasks' gem 'i18n-tasks'
gem 'capistrano', '3.5.0', require: false gem 'capistrano', '3.5.0', require: false
gem "capistrano-bundler", '1.1.4', require: false gem 'capistrano-bundler', '~> 1.2', require: false
gem "capistrano-rails", '1.1.8', require: false gem "capistrano-rails", '1.1.8', require: false
gem "capistrano-rvm", require: false gem 'rvm1-capistrano3', require: false
gem 'capistrano3-delayed-job', '~> 1.0' gem 'capistrano3-delayed-job', '~> 1.0'
gem "bullet" gem "bullet"
gem "faker" gem "faker"
gem 'rubocop', '~> 0.45.0', require: false
gem 'knapsack'
end end
group :test do group :test do

View File

@@ -56,18 +56,18 @@ GEM
akami (1.3.1) akami (1.3.1)
gyoku (>= 0.4.0) gyoku (>= 0.4.0)
nokogiri nokogiri
ancestry (2.2.1) ancestry (2.2.2)
activerecord (>= 3.0.0) activerecord (>= 3.0.0)
arel (6.0.3) arel (6.0.3)
ast (2.2.0) ast (2.3.0)
babel-source (5.8.35) babel-source (5.8.35)
babel-transpiler (0.7.0) babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6) babel-source (>= 4.0, < 6)
execjs (~> 2.0) execjs (~> 2.0)
bcrypt (3.1.11) bcrypt (3.1.11)
browser (2.2.0) browser (2.3.0)
builder (3.2.2) builder (3.2.2)
bullet (5.2.0) bullet (5.4.2)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
uniform_notifier (~> 1.10.0) uniform_notifier (~> 1.10.0)
byebug (9.0.6) byebug (9.0.6)
@@ -78,16 +78,13 @@ GEM
i18n i18n
rake (>= 10.0.0) rake (>= 10.0.0)
sshkit (>= 1.9.0) sshkit (>= 1.9.0)
capistrano-bundler (1.1.4) capistrano-bundler (1.2.0)
capistrano (~> 3.1) capistrano (~> 3.1)
sshkit (~> 1.2) sshkit (~> 1.2)
capistrano-harrow (0.5.3) capistrano-harrow (0.5.3)
capistrano-rails (1.1.8) capistrano-rails (1.1.8)
capistrano (~> 3.1) capistrano (~> 3.1)
capistrano-bundler (~> 1.1) capistrano-bundler (~> 1.1)
capistrano-rvm (0.1.2)
capistrano (~> 3.0)
sshkit (~> 1.2)
capistrano3-delayed-job (1.7.2) capistrano3-delayed-job (1.7.2)
capistrano (~> 3.0, >= 3.0.0) capistrano (~> 3.0, >= 3.0.0)
capybara (2.7.1) capybara (2.7.1)
@@ -114,12 +111,12 @@ GEM
execjs execjs
coffee-script-source (1.10.0) coffee-script-source (1.10.0)
concurrent-ruby (1.0.2) concurrent-ruby (1.0.2)
coveralls (0.8.15) coveralls (0.8.17)
json (>= 1.8, < 3) json (>= 1.8, < 3)
simplecov (~> 0.12.0) simplecov (~> 0.12.0)
term-ansicolor (~> 1.3) term-ansicolor (~> 1.3)
thor (~> 0.19.1) thor (~> 0.19.1)
tins (>= 1.6.0, < 2) tins (~> 1.6)
daemons (1.2.4) daemons (1.2.4)
dalli (2.7.6) dalli (2.7.6)
database_cleaner (1.5.3) database_cleaner (1.5.3)
@@ -173,8 +170,8 @@ GEM
activesupport (>= 4.1) activesupport (>= 4.1)
railties (>= 4.1) railties (>= 4.1)
tzinfo (~> 1.2, >= 1.2.2) tzinfo (~> 1.2, >= 1.2.2)
fuubar (2.1.1) fuubar (2.2.0)
rspec (~> 3.0) rspec-core (~> 3.0)
ruby-progressbar (~> 1.4) ruby-progressbar (~> 1.4)
geocoder (1.4.0) geocoder (1.4.0)
globalid (0.3.7) globalid (0.3.7)
@@ -183,13 +180,13 @@ GEM
activesupport (>= 3) activesupport (>= 3)
gyoku (1.3.1) gyoku (1.3.1)
builder (>= 2.1.2) builder (>= 2.1.2)
hashie (3.4.3) hashie (3.4.6)
highline (1.7.8) highline (1.7.8)
htmlentities (4.3.4) htmlentities (4.3.4)
httpi (2.4.1) httpi (2.4.1)
rack rack
i18n (0.7.0) i18n (0.7.0)
i18n-tasks (0.9.5) i18n-tasks (0.9.6)
activesupport (>= 4.0.2) activesupport (>= 4.0.2)
ast (>= 2.1.0) ast (>= 2.1.0)
easy_translate (>= 0.5.0) easy_translate (>= 0.5.0)
@@ -215,6 +212,9 @@ GEM
actionpack (>= 3.0.0) actionpack (>= 3.0.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
kgio (2.10.0) kgio (2.10.0)
knapsack (1.13.1)
rake
timecop (>= 0.1.0)
launchy (2.4.3) launchy (2.4.3)
addressable (~> 2.3) addressable (~> 2.3)
letter_opener (1.4.1) letter_opener (1.4.1)
@@ -231,14 +231,14 @@ GEM
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521) mime-types-data (3.2016.0521)
mini_portile2 (2.1.0) mini_portile2 (2.1.0)
minitest (5.9.1) minitest (5.10.1)
multi_json (1.12.1) multi_json (1.12.1)
multi_xml (0.5.5) multi_xml (0.5.5)
multipart-post (2.0.0) multipart-post (2.0.0)
net-scp (1.2.1) net-scp (1.2.1)
net-ssh (>= 2.6.5) net-ssh (>= 2.6.5)
net-ssh (3.2.0) net-ssh (3.2.0)
newrelic_rpm (3.17.0.325) newrelic_rpm (3.17.1.326)
nokogiri (1.6.8.1) nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0) mini_portile2 (~> 2.1.0)
nori (2.6.0) nori (2.6.0)
@@ -271,7 +271,7 @@ GEM
orm_adapter (0.5.0) orm_adapter (0.5.0)
paranoia (2.2.0) paranoia (2.2.0)
activerecord (>= 4.0, < 5.1) activerecord (>= 4.0, < 5.1)
parser (2.3.0.6) parser (2.3.3.1)
ast (~> 2.2) ast (~> 2.2)
pg (0.19.0) pg (0.19.0)
pg_search (1.0.6) pg_search (1.0.6)
@@ -282,9 +282,10 @@ GEM
capybara (~> 2.1) capybara (~> 2.1)
cliver (~> 0.3.1) cliver (~> 0.3.1)
websocket-driver (>= 0.2.0) websocket-driver (>= 0.2.0)
powerpack (0.1.1)
quiet_assets (1.1.0) quiet_assets (1.1.0)
railties (>= 3.1, < 5.0) railties (>= 3.1, < 5.0)
rack (1.6.4) rack (1.6.5)
rack-accept (0.4.5) rack-accept (0.4.5)
rack (>= 0.4) rack (>= 0.4)
rack-attack (5.0.1) rack-attack (5.0.1)
@@ -315,8 +316,9 @@ GEM
activesupport (= 4.2.7.1) activesupport (= 4.2.7.1)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
raindrops (0.16.0) rainbow (2.1.0)
rake (11.3.0) raindrops (0.17.0)
rake (12.0.0)
redcarpet (3.3.4) redcarpet (3.3.4)
referer-parser (0.3.0) referer-parser (0.3.0)
request_store (1.3.1) request_store (1.3.1)
@@ -325,10 +327,6 @@ GEM
rinku (2.0.2) rinku (2.0.2)
rollbar (2.13.3) rollbar (2.13.3)
multi_json 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.4) rspec-core (3.5.4)
rspec-support (~> 3.5.0) rspec-support (~> 3.5.0)
rspec-expectations (3.5.0) rspec-expectations (3.5.0)
@@ -346,7 +344,16 @@ GEM
rspec-mocks (~> 3.5.0) rspec-mocks (~> 3.5.0)
rspec-support (~> 3.5.0) rspec-support (~> 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) ruby-progressbar (1.8.1)
rvm1-capistrano3 (1.4.0)
capistrano (~> 3.0)
sshkit (>= 1.2)
safe_yaml (1.0.4) safe_yaml (1.0.4)
safely_block (0.1.1) safely_block (0.1.1)
errbase errbase
@@ -370,6 +377,8 @@ GEM
json (>= 1.8, < 3) json (>= 1.8, < 3)
simplecov-html (~> 0.10.0) simplecov-html (~> 0.10.0)
simplecov-html (0.10.0) simplecov-html (0.10.0)
sitemap_generator (5.2.0)
builder (~> 3.0)
social-share-button (0.3.1) social-share-button (0.3.1)
coffee-rails coffee-rails
sass-rails sass-rails
@@ -387,17 +396,19 @@ GEM
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sshkit (1.11.3) sshkit (1.11.4)
net-scp (>= 1.1.2) net-scp (>= 1.1.2)
net-ssh (>= 2.8.0) net-ssh (>= 2.8.0)
term-ansicolor (1.3.2) term-ansicolor (1.4.0)
tins (~> 1.0) tins (~> 1.0)
terminal-table (1.5.2) terminal-table (1.7.3)
thor (0.19.1) unicode-display_width (~> 1.1.1)
thor (0.19.4)
thread (0.2.2) thread (0.2.2)
thread_safe (0.3.5) thread_safe (0.3.5)
tilt (2.0.5) tilt (2.0.5)
tins (1.11.0) timecop (0.8.1)
tins (1.13.0)
tolk (2.0.0) tolk (2.0.0)
rails (>= 4.0) rails (>= 4.0)
safe_yaml (>= 0.8.6) safe_yaml (>= 0.8.6)
@@ -410,8 +421,9 @@ GEM
tilt (>= 1.4, < 3) tilt (>= 1.4, < 3)
tzinfo (1.2.2) tzinfo (1.2.2)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (3.0.3) uglifier (3.0.4)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
unicode-display_width (1.1.1)
unicorn (5.1.0) unicorn (5.1.0)
kgio (~> 2.6) kgio (~> 2.6)
raindrops (~> 0.7) raindrops (~> 0.7)
@@ -442,15 +454,14 @@ DEPENDENCIES
acts-as-taggable-on acts-as-taggable-on
acts_as_votable acts_as_votable
ahoy_matey (~> 1.4.2) ahoy_matey (~> 1.4.2)
ancestry (~> 2.2.1) ancestry (~> 2.2.2)
browser browser
bullet bullet
byebug byebug
cancancan cancancan
capistrano (= 3.5.0) capistrano (= 3.5.0)
capistrano-bundler (= 1.1.4) capistrano-bundler (~> 1.2)
capistrano-rails (= 1.1.8) capistrano-rails (= 1.1.8)
capistrano-rvm
capistrano3-delayed-job (~> 1.0) capistrano3-delayed-job (~> 1.0)
capybara capybara
ckeditor (~> 4.2.0) ckeditor (~> 4.2.0)
@@ -476,9 +487,10 @@ DEPENDENCIES
jquery-rails (~> 4.2.1) jquery-rails (~> 4.2.1)
jquery-ui-rails jquery-ui-rails
kaminari kaminari
knapsack
launchy launchy
letter_opener_web (~> 1.3.0) letter_opener_web (~> 1.3.0)
newrelic_rpm (~> 3.17.0.325) newrelic_rpm (~> 3.17.1.326)
omniauth omniauth
omniauth-facebook (~> 3.0.0) omniauth-facebook (~> 3.0.0)
omniauth-google-oauth2 (~> 0.4.0) omniauth-google-oauth2 (~> 0.4.0)
@@ -494,8 +506,11 @@ DEPENDENCIES
rinku (~> 2.0.2) rinku (~> 2.0.2)
rollbar (~> 2.13.3) rollbar (~> 2.13.3)
rspec-rails (~> 3.5) rspec-rails (~> 3.5)
rubocop (~> 0.45.0)
rvm1-capistrano3
sass-rails (~> 5.0, >= 5.0.4) sass-rails (~> 5.0, >= 5.0.4)
savon savon
sitemap_generator
social-share-button social-share-button
spring spring
spring-commands-rspec spring-commands-rspec
@@ -503,10 +518,10 @@ DEPENDENCIES
tolk (~> 2.0.0) tolk (~> 2.0.0)
turbolinks turbolinks
turnout (~> 2.4.0) turnout (~> 2.4.0)
uglifier (>= 3.0.3) uglifier (>= 3.0.4)
unicorn (~> 5.1.0) unicorn (~> 5.1.0)
web-console (= 3.3.0) web-console (= 3.3.0)
whenever whenever
BUNDLED WITH BUNDLED WITH
1.13.1 1.13.6

View File

@@ -5,6 +5,7 @@
Citizen Participation and Open Government Application Citizen Participation and Open Government Application
[![Join the chat at https://gitter.im/consul/consul](https://badges.gitter.im/consul/consul.svg)](https://gitter.im/consul/consul?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/consul/consul.svg?branch=master)](https://travis-ci.org/consul/consul) [![Build Status](https://travis-ci.org/consul/consul.svg?branch=master)](https://travis-ci.org/consul/consul)
[![Code Climate](https://codeclimate.com/github/consul/consul/badges/gpa.svg)](https://codeclimate.com/github/consul/consul) [![Code Climate](https://codeclimate.com/github/consul/consul/badges/gpa.svg)](https://codeclimate.com/github/consul/consul)
[![Dependency Status](https://gemnasium.com/consul/consul.svg)](https://gemnasium.com/consul/consul) [![Dependency Status](https://gemnasium.com/consul/consul.svg)](https://gemnasium.com/consul/consul)
@@ -26,7 +27,7 @@ Frontend tools used include [SCSS](http://sass-lang.com/) over [Foundation](http
**NOTE**: For more detailed instructions check the [docs](https://github.com/consul/consul/tree/master/doc/en/dev_test_setup.md) **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.2.3, bundler gem, ghostscript and PostgreSQL (>=9.4). Prerequisites: install git, Ruby 2.3.2, bundler gem, ghostscript and PostgreSQL (>=9.4).
``` ```
git clone https://github.com/consul/consul.git git clone https://github.com/consul/consul.git

View File

@@ -5,6 +5,7 @@
Aplicación de Participación Ciudadana y Gobierno Abierto Aplicación de Participación Ciudadana y Gobierno Abierto
[![Join the chat at https://gitter.im/consul/consul](https://badges.gitter.im/consul/consul.svg)](https://gitter.im/consul/consul?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/consul/consul.svg?branch=master)](https://travis-ci.org/consul/consul) [![Build Status](https://travis-ci.org/consul/consul.svg?branch=master)](https://travis-ci.org/consul/consul)
[![Code Climate](https://codeclimate.com/github/consul/consul/badges/gpa.svg)](https://codeclimate.com/github/consul/consul) [![Code Climate](https://codeclimate.com/github/consul/consul/badges/gpa.svg)](https://codeclimate.com/github/consul/consul)
[![Dependency Status](https://gemnasium.com/consul/consul.svg)](https://gemnasium.com/consul/consul) [![Dependency Status](https://gemnasium.com/consul/consul.svg)](https://gemnasium.com/consul/consul)
@@ -25,7 +26,7 @@ Las herramientas utilizadas para el frontend no están cerradas aún. Los estilo
**NOTA**: para unas instrucciones más detalladas consulta la [documentación](https://github.com/consul/consul/tree/master/doc/es/dev_test_setup.md) **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.2.3, la gema `bundler`, ghostscript y PostgreSQL (9.4 o superior). Prerequisitos: tener instalado git, Ruby 2.3.2, la gema `bundler`, ghostscript y PostgreSQL (9.4 o superior).
``` ```

View File

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

View File

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

View File

@@ -52,5 +52,6 @@ App.Comments =
children_container_id = "#{$(this).data().id}_children" children_container_id = "#{$(this).data().id}_children"
$("##{children_container_id}").toggle('slow') $("##{children_container_id}").toggle('slow')
App.Comments.toggle_arrow(children_container_id) App.Comments.toggle_arrow(children_container_id)
$(this).children('.js-child-toggle').toggle()
false false
) )

View File

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

View File

@@ -51,22 +51,22 @@ $base-font-size: rem-calc(17);
$base-line: rem-calc(26); $base-line: rem-calc(26);
$small-font-size: rem-calc(14); $small-font-size: rem-calc(14);
$line-height: rem-calc(24); $line-height: rem-calc(24);
$tiny-font-size: rem-calc(12);
$brand: #004A83; $brand: #004A83;
$dark: darken($brand, 10%); $dark: darken($brand, 10%);
$text: #222222; $text: #222222;
$text-medium: #999999; $text-medium: #515151;
$text-light: #CCCCCC; $text-light: #BFBFBF;
$border: #DEE0E3; $border: #DEE0E3;
$link: #2895F1; $link: $brand;
$link-hover: darken($link, 20%); $link-hover: darken($link, 20%);
$debates: #008CCF; $debates: $brand;
$votes: #26AEEE;
$like: #7BD2A8; $like: #7BD2A8;
$unlike: #EF8585; $unlike: #EF8585;
@@ -74,13 +74,14 @@ $delete: #F04124;
$check: #46DB91; $check: #46DB91;
$proposals: #FFA42D; $proposals: #FFA42D;
$proposals-dark: #794500;
$budget: #454372; $budget: #454372;
$budget-hover: #7571BF; $budget-hover: #7571BF;
$highlight: #E7F2FC; $highlight: #E7F2FC;
$light: #F5F7FA; $light: #F5F7FA;
$featured: #FED900; $featured: #FFDC5C;
$footer-border: #BFC1C3; $footer-border: #BFC1C3;

View File

@@ -34,3 +34,4 @@
@include foundation-thumbnail; @include foundation-thumbnail;
@include foundation-title-bar; @include foundation-title-bar;
@include foundation-top-bar; @include foundation-top-bar;
@include foundation-menu-icon;

View File

@@ -56,6 +56,7 @@ a {
} }
&:focus { &:focus {
color: $link-hover;
outline: 3px solid #ffbf47; outline: 3px solid #ffbf47;
} }
} }
@@ -273,7 +274,7 @@ a {
} }
} }
h2 { h2, h3 {
font-size: $base-font-size; font-size: $base-font-size;
} }
} }
@@ -286,6 +287,10 @@ a {
margin: 0 $line-height/2; margin: 0 $line-height/2;
} }
.pagination .current {
background: $brand;
}
// 02. Header // 02. Header
// ---------- // ----------
@@ -394,6 +399,10 @@ header {
text-decoration: underline; text-decoration: underline;
} }
} }
ul {
margin-bottom: 0;
}
} }
.subnavigation { .subnavigation {
@@ -503,8 +512,16 @@ header {
&.active { &.active {
border-bottom: 2px solid $brand; border-bottom: 2px solid $brand;
color: $brand; color: $brand;
&:hover {
text-decoration: none;
} }
} }
}
h2 {
font-size: $base-font-size;
}
} }
.search-form-header input[type=text] { .search-form-header input[type=text] {
@@ -529,7 +546,7 @@ footer {
p { p {
font-size: $small-font-size; font-size: $small-font-size;
.info a { &.info a {
text-decoration: underline; text-decoration: underline;
} }
} }
@@ -566,6 +583,7 @@ footer {
.subfooter { .subfooter {
border-top: 1px solid $text-light; border-top: 1px solid $text-light;
font-size: $small-font-size;
padding-top: $line-height/2; padding-top: $line-height/2;
} }
@@ -598,7 +616,7 @@ footer {
} }
} }
h3.sidebar-title { h2.sidebar-title {
border-top: 2px solid $brand; border-top: 2px solid $brand;
display: inline-block; display: inline-block;
font-size: rem-calc(16); font-size: rem-calc(16);
@@ -912,16 +930,12 @@ img.avatar, img.admin-avatar, img.moderator-avatar, img.initialjs-avatar {
} }
.author-deleted, .user-deleted { .author-deleted, .user-deleted {
background-color: rgba(255,255,255,.5);
color: rgba(0,0,0,.4); color: rgba(0,0,0,.4);
font-size: rem-calc(40); display: inline-block;
left: 11px; font-size: rem-calc(32);
position: absolute; line-height: rem-calc(32);
top: 72px; height: rem-calc(32);
} vertical-align: top;
.user-deleted {
top: -4px;
} }
.user-permissions { .user-permissions {
@@ -1176,7 +1190,7 @@ table {
top: 0; top: 0;
} }
&:hover { &:hover, &:focus {
background: white; background: white;
color: #40A2D1; color: #40A2D1;
} }
@@ -1216,7 +1230,7 @@ table {
top: 0; top: 0;
} }
&:hover { &:hover, &:focus {
background: white; background: white;
color: #354F88; color: #354F88;
} }
@@ -1256,7 +1270,7 @@ table {
top: 0; top: 0;
} }
&:hover { &:hover, &:focus {
background: white; background: white;
color: #CE3E26; color: #CE3E26;
} }
@@ -1276,13 +1290,14 @@ table {
} }
.share-supported { .share-supported {
text-align: center;
.social-share-button { .social-share-button {
display: inline-block; display: inline-block;
} }
.ssb-twitter { .ssb-twitter {
background: none; background: #45B0E3;
color: white; color: white;
height: $line-height; height: $line-height;
position: relative; position: relative;
@@ -1299,13 +1314,14 @@ table {
top: 0; top: 0;
} }
&:hover { &:hover, &:focus {
background: white;
color: #40A2D1; color: #40A2D1;
} }
} }
.ssb-facebook { .ssb-facebook {
background: none; background: #3B5998;
color: white; color: white;
height: rem-calc(24); height: rem-calc(24);
position: relative; position: relative;
@@ -1322,13 +1338,14 @@ table {
top: 0; top: 0;
} }
&:hover { &:hover, &:focus {
background: white;
color: #354F88; color: #354F88;
} }
} }
.ssb-google_plus { .ssb-google_plus {
background: none; background: #DE4C34;
color: white; color: white;
height: rem-calc(24); height: rem-calc(24);
position: relative; position: relative;
@@ -1345,7 +1362,8 @@ table {
top: 0; top: 0;
} }
&:hover { &:hover, &:focus {
background: white;
color: #CE3E26; color: #CE3E26;
} }
} }
@@ -1579,7 +1597,7 @@ table {
.comment-votes { .comment-votes {
color: $text-medium; color: $text-medium;
font-size: rem-calc(14); font-size: $small-font-size;
line-height: $line-height; line-height: $line-height;
a { a {
@@ -1589,17 +1607,29 @@ table {
&:hover { &:hover {
color: $text-medium; color: $text-medium;
text-decoration: none;
.icon-like {
color: $like;
}
.icon-unlike {
color: $unlike;
}
} }
} }
[class^="icon-"] { [class^="icon-"] {
font-size: rem-calc(20); font-size: $base-font-size;
vertical-align: middle; vertical-align: sub;
} }
} }
.comment-body { .comment-body {
margin-left: rem-calc(42);
img {
margin-right: $line-height/2;
}
.reply { .reply {
background: white; background: white;
@@ -1607,20 +1637,28 @@ table {
border-left: 0; border-left: 0;
border-right: 0; border-right: 0;
font-size: $small-font-size; font-size: $small-font-size;
margin: rem-calc(6) 0; margin: $line-height/4 0;
padding: rem-calc(6); padding: $line-height/4;
position: relative; position: relative;
a.relative, [class^="icon-arrow"] {
padding-left: $line-height/2;
}
[class^="icon-arrow"] { [class^="icon-arrow"] {
font-size: rem-calc(18); font-size: $base-font-size;
left: -20px; left: -20px;
position: absolute; position: absolute;
top: 0; top: -1px;
} }
.divider { .divider {
color: $text-light; color: $text-light;
} }
form {
margin-top: $line-height/2;
}
} }
.comment-user { .comment-user {
@@ -1650,13 +1688,13 @@ table {
.is-deleted { .is-deleted {
background: #E7E7E7; background: #E7E7E7;
margin-left: rem-calc(42); margin-left: $line-height;
padding: $line-height/4 $line-height/2; padding: $line-height/2;
} }
.comment-children { .comment-children {
border-left: 1px dashed $border; border-left: 1px dashed $border;
margin-left: rem-calc(42); margin-left: $line-height;
padding-left: $line-height/4; padding-left: $line-height/4;
@media only screen and (max-width: 40em) { @media only screen and (max-width: 40em) {
@@ -1666,9 +1704,9 @@ table {
.comment-info { .comment-info {
color: $text-medium; color: $text-medium;
display: inline-block;
font-size: $small-font-size; font-size: $small-font-size;
margin-top: $line-height/4; line-height: rem-calc(32); // Same as avatar height
vertical-align: middle;
span.user-name { span.user-name {
color: $text; color: $text;
@@ -1714,7 +1752,8 @@ table {
} }
.flag-disable, .flag-active { .flag-disable, .flag-active {
vertical-align: middle; line-height: 0;
vertical-align: sub;
} }
.flag-disable { .flag-disable {

View File

@@ -13,14 +13,21 @@
// ---------------------- // ----------------------
@mixin votes { @mixin votes {
background: $votes; border-top: 1px solid $border;
margin: 0 rem-calc(-12); margin-top: $line-height;
padding: rem-calc(14) rem-calc(12); padding: $line-height 0;
position: relative; position: relative;
@include breakpoint(medium) {
border-left: 1px solid $border;
border-top: 0;
margin-top: 0;
padding-top: $line-height*2;
}
.icon-like, .icon-unlike { .icon-like, .icon-unlike {
background: white; background: white;
border: 2px solid $votes; border: 2px solid $text-light;
border-radius: rem-calc(3); border-radius: rem-calc(3);
color: $text-light; color: $text-light;
display: inline-block; display: inline-block;
@@ -30,7 +37,6 @@
position: relative; position: relative;
&:hover, &:active { &:hover, &:active {
border-color: white;
color: white; color: white;
cursor: pointer; cursor: pointer;
opacity: 1 !important; opacity: 1 !important;
@@ -41,6 +47,7 @@
&:hover, &:active { &:hover, &:active {
background: $like; background: $like;
border: 2px solid $like;
} }
} }
@@ -48,50 +55,64 @@
&:hover, &:active { &:hover, &:active {
background: $unlike; background: $unlike;
border: 2px solid $unlike;
} }
} }
.like, .unlike { .like, .unlike {
line-height: rem-calc(48); line-height: rem-calc(48);
vertical-align: super; vertical-align: super;
text-decoration: none;
span.percentage { span.percentage {
color: white; color: $text;
display: inline-block; display: inline-block;
font-size: rem-calc(16); font-size: $small-font-size;
line-height: $line-height*2; line-height: $line-height*2;
padding-left: rem-calc(8); padding-right: $line-height/2;
vertical-align: top; vertical-align: top;
@include breakpoint(medium) {
display: block;
line-height: $line-height;
padding-right: 0;
}
} }
} }
.voted { .voted {
.icon-like, .icon-unlike { .icon-like, .icon-unlike {
border-color: white;
color: white; color: white;
} }
.icon-like { .icon-like {
background: $like; background: $like;
border: 2px solid $like;
} }
.icon-unlike { .icon-unlike {
background: $unlike; background: $unlike;
border: 2px solid $unlike;
} }
} }
.no-voted { .no-voted {
.icon-like, .icon-unlike { .icon-like, .icon-unlike {
opacity: .5; opacity: .3;
} }
} }
.total-votes { .total-votes {
color: white; font-weight: bold;
float: right; float: right;
line-height: $line-height*2; line-height: $line-height*2;
@include breakpoint(medium) {
display: block;
float: none;
}
} }
.divider { .divider {
@@ -100,64 +121,65 @@
} }
@mixin supports { @mixin supports {
background: $proposals; padding: $line-height 0;
margin: 0 rem-calc(-12);
padding: rem-calc(14) rem-calc(12);
position: relative; position: relative;
.progress { .progress {
background-color: rgba(255,255,255,.8); background: lighten($proposals, 35%);
height: $line-height/2; border: 1px solid lighten($proposals, 35%);
height: rem-calc(14);
position: relative;
.meter { .meter {
background: $like; background: $proposals;
border-radius: 0;
border-bottom-right-radius: rem-calc(3);
border-top-right-radius: rem-calc(3);
display: block; display: block;
height: $line-height/2; height: $line-height/2;
} }
} }
.percentage { .percentage {
font-size: rem-calc(10); color: $text;
color: $brand; font-size: $tiny-font-size;
vertical-align: top;
position: absolute; position: absolute;
top: 13px; right: 6px;
right: 20px; top: -2px;
vertical-align: top;
} }
abbr { abbr {
color: white; color: $text-medium;
&[title] { &[title] {
border-bottom: 1px dotted white; border-bottom: 1px dotted $text-medium;
} }
} }
.button-support { .button-support {
background: white; background: $proposals;
color: $text; color: $text;
display: inline-block; display: inline-block;
font-size: $small-font-size; font-size: $small-font-size;
margin-top: rem-calc(12); margin-top: rem-calc(12);
&:hover { &:hover, &:active {
background: darken($proposals, 35%); background: lighten($proposals, 25%);
color: white;
cursor: pointer; cursor: pointer;
} }
&:active {
opacity: .75;
}
} }
.total-supports { .total-supports {
color: white; color: $text;
display: block;
font-weight: bold;
text-align: center; text-align: center;
font-size: $small-font-size;
span { span {
display: block; display: block;
font-size: $small-font-size;
font-weight: normal;
} }
} }
@@ -166,23 +188,17 @@
} }
.supported { .supported {
color: white; color: $text;
margin-top: rem-calc(12); margin-top: rem-calc(12);
} }
} }
.message { .supports-container {
@include supports; border-top: 1px solid $border;
background: none;
border-top: 0;
@include breakpoint(medium) { @include breakpoint(medium) {
border-left: 1px solid $border; border-left: 1px solid $border;
margin: $line-height rem-calc(-25) 0 rem-calc(12); border-top: 0;
}
p {
font-size: $small-font-size;
} }
} }
@@ -277,7 +293,9 @@
// 03. Show participation // 03. Show participation
// ---------------------- // ----------------------
.debate-show, .proposal-show, .investment-project-show { .debate-show,
.proposal-show,
.investment-project-show {
p { p {
word-wrap: break-word; word-wrap: break-word;
@@ -308,9 +326,13 @@
clear: both; clear: both;
color: $text-medium; color: $text-medium;
font-size: $small-font-size; font-size: $small-font-size;
min-height: $line-height*2; margin-bottom: $line-height/2;
position: relative; position: relative;
span {
line-height: rem-calc(32); // Same as avatar height
}
a { a {
color: $text-medium; color: $text-medium;
} }
@@ -320,15 +342,6 @@
line-height: $line-height; line-height: $line-height;
margin: 0; margin: 0;
} }
.author-deleted {
left: 0;
top: 4px;
}
.author.deleted {
margin-left: rem-calc(48);
}
} }
.debate-description, .proposal-description { .debate-description, .proposal-description {
@@ -343,12 +356,19 @@
font-size: rem-calc(15); font-size: rem-calc(15);
margin-bottom: rem-calc(15); margin-bottom: rem-calc(15);
} }
&.tags, &.geozone {
li {
margin-bottom: 0;
}
}
} }
.author-photo { .author-photo {
line-height: $line-height*2; line-height: rem-calc(32);
margin-right: rem-calc(6); margin-right: rem-calc(6);
vertical-align: middle; vertical-align: top;
width: 32px; width: 32px;
} }
@@ -366,7 +386,7 @@
aside { aside {
h3 { h2 {
border-top: 2px solid $brand; border-top: 2px solid $brand;
display: inline-block; display: inline-block;
font-size: rem-calc(16); font-size: rem-calc(16);
@@ -414,47 +434,8 @@
} }
} }
.votes {
@include votes;
border: 0;
border-radius: 0;
margin: 0;
.total-votes {
display: block;
float: none;
line-height: $line-height;
}
@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 { .supports {
@include supports; @include supports;
border: 0;
border-radius: 0;
margin: 0;
.total-supports {
display: block;
float: none;
line-height: $line-height;
}
} }
.leave-comment { .leave-comment {
@@ -479,6 +460,17 @@
word-break: break-word; word-break: break-word;
} }
.proposal-show, .investment-project-show {
.supports {
padding: $line-height/2 0 0;
}
.share-supported {
display: none;
}
}
// 04. List participation // 04. List participation
// ---------------------- // ----------------------
@@ -497,8 +489,7 @@
} }
.debate, .proposal, .investment-project { .debate, .proposal, .investment-project {
margin-bottom: 0; margin: $line-height/4 0;
margin-top: 0;
.panel { .panel {
background: white; background: white;
@@ -533,7 +524,7 @@
} }
.label-proposal { .label-proposal {
color: $proposals; color: $proposals-dark;
} }
.label-investment-project { .label-investment-project {
@@ -571,7 +562,7 @@
} }
.icon-proposals { .icon-proposals {
color: $proposals; color: $proposals-dark;
} }
.icon-budget { .icon-budget {
@@ -652,107 +643,30 @@
} }
} }
.debate { .debate, .debate-show {
.votes { .votes {
@include votes; @include votes;
border: 1px solid $votes;
margin: 0 rem-calc(-12);
@include breakpoint(medium) { .against {
border-top-left-radius: 3px; margin-left: $line-height/4;
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: #166387 transparent transparent transparent;
bottom: -14px;
border-left-width: 0;
border-right-color: transparent;
right: -1px;
border-width: 13px 13px 0 0;
@include breakpoint(medium) {
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(medium) {
display: block;
float: none;
line-height: $line-height*2;
margin-left: 0;
padding-top: 0;
}
} }
@include breakpoint(medium) { @include breakpoint(medium) {
.like, .unlike { text-align: center;
}
}
}
span.percentage { .debate-show .votes {
display: block; border: 0;
line-height: $line-height/2; padding: $line-height/2 0;
}
}
}
}
} }
.proposal { .proposal {
.supports { .supports {
@include supports; @include supports;
border: 1px solid $proposals;
margin: 0 rem-calc(-12);
@include breakpoint(medium) {
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(medium) {
content: "";
}
}
.total-supports {
display: inline-block;
line-height: $line-height;
padding-top: rem-calc(12);
vertical-align: top;
@include breakpoint(medium) {
display: block;
float: none;
margin-left: 0;
padding-top: 0;
}
}
} }
} }
@@ -760,20 +674,6 @@
.supports { .supports {
@include 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(medium) {
padding-top: $line-height*1.5;
}
&:after {
content: none;
}
.investment-project-amount { .investment-project-amount {
color: $budget; color: $budget;
@@ -803,31 +703,12 @@
font-weight: bold; font-weight: bold;
} }
.supported {
color: $budget;
margin-top: 0;
width: 100%;
}
.remove .icon-check-circle { .remove .icon-check-circle {
display: block; display: block;
font-size: rem-calc(70); font-size: rem-calc(70);
line-height: rem-calc(70); line-height: rem-calc(70);
} }
.share-supported {
.ssb-twitter,
.ssb-facebook,
.ssb-google_plus {
color: $budget;
} }
}
}
}
.investment-project-show .supports {
border: 0;
} }
.proposals-summary { .proposals-summary {
@@ -904,7 +785,14 @@
} }
.button-support { .button-support {
background: $text;
color: $featured;
margin-top: 0; margin-top: 0;
&:hover {
background: white;
color: $text;
}
} }
.participation-not-allowed { .participation-not-allowed {
@@ -925,6 +813,7 @@
.supported { .supported {
margin-top: 0; margin-top: 0;
font-size: $small-font-size;
} }
.share-supported { .share-supported {
@@ -932,7 +821,10 @@
.ssb-twitter, .ssb-twitter,
.ssb-facebook, .ssb-facebook,
.ssb-google_plus { .ssb-google_plus {
height: rem-calc(33); background: none;
color: $text;
height: rem-calc(33) !important;
&:before { &:before {
font-size: rem-calc(18); font-size: rem-calc(18);
@@ -946,7 +838,37 @@
// 06. Proposals successful // 06. Proposals successful
// ------------------------- // -------------------------
.sucessfull-proposals-banner { .dark-heading {
background: #2D3E50;
color: white;
@include breakpoint(medium) {
padding-bottom: $line-height;
}
p {
&.title {
color: #FFD200;
}
&.title-date {
font-size: rem-calc(24);
font-weight: bold;
}
}
.info {
background: #314253;
padding-top: $line-height;
@include breakpoint(medium) {
border-top: rem-calc(6) solid #FFD200;
}
}
}
.featured-proposals-ballot-banner, .sucessfull-proposals-banner {
background: #2D3E50 image-url("ballot_tiny.gif") no-repeat; background: #2D3E50 image-url("ballot_tiny.gif") no-repeat;
background-position: 75% 0; background-position: 75% 0;
position: relative; position: relative;

View File

@@ -2,7 +2,6 @@ class Admin::BannersController < Admin::BaseController
has_filters %w{all with_active with_inactive}, only: :index has_filters %w{all with_active with_inactive}, only: :index
before_action :find_banner, only: [:edit, :update, :destroy]
before_action :banner_styles, only: [:edit, :new, :create, :update] before_action :banner_styles, only: [:edit, :new, :create, :update]
before_action :banner_imgs, only: [:edit, :new, :create, :update] before_action :banner_imgs, only: [:edit, :new, :create, :update]
@@ -24,7 +23,6 @@ class Admin::BannersController < Admin::BaseController
end end
def update def update
@banner.assign_attributes(banner_params)
if @banner.update(banner_params) if @banner.update(banner_params)
redirect_to admin_banners_path redirect_to admin_banners_path
else else
@@ -38,14 +36,11 @@ class Admin::BannersController < Admin::BaseController
end end
private private
def banner_params def banner_params
params.require(:banner).permit(:title, :description, :target_url, :style, :image, :post_started_at, :post_ended_at) params.require(:banner).permit(:title, :description, :target_url, :style, :image, :post_started_at, :post_ended_at)
end end
def find_banner
@banner = Banner.find(params[:id])
end
def banner_styles def banner_styles
@banner_styles = Setting.all.banner_style.map { |banner_style| [banner_style.value, banner_style.key.split('.')[1]] } @banner_styles = Setting.all.banner_style.map { |banner_style| [banner_style.value, banner_style.key.split('.')[1]] }
end end
@@ -53,4 +48,5 @@ class Admin::BannersController < Admin::BaseController
def banner_imgs def banner_imgs
@banner_imgs = Setting.all.banner_img.map { |banner_img| [banner_img.value, banner_img.key.split('.')[1]] } @banner_imgs = Setting.all.banner_img.map { |banner_img| [banner_img.value, banner_img.key.split('.')[1]] }
end end
end end

View File

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

View File

@@ -0,0 +1,49 @@
class Admin::GeozonesController < Admin::BaseController
respond_to :html
load_and_authorize_resource
def index
@geozones = Geozone.all.order("LOWER(name)")
end
def new
end
def edit
end
def create
@geozone = Geozone.new(geozone_params)
if @geozone.save
redirect_to admin_geozones_path
else
render :new
end
end
def update
if @geozone.update(geozone_params)
redirect_to admin_geozones_path
else
render :edit
end
end
def destroy
if @geozone.safe_to_destroy?
@geozone.destroy
redirect_to admin_geozones_path, notice: t('admin.geozones.delete.success')
else
redirect_to admin_geozones_path, flash: { error: t('admin.geozones.delete.error') }
end
end
private
def geozone_params
params.require(:geozone).permit(:name, :external_code, :census_code, :html_map_coordinates)
end
end

View File

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

View File

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

View File

@@ -0,0 +1,32 @@
class Admin::SignatureSheetsController < Admin::BaseController
def index
@signature_sheets = SignatureSheet.all
end
def new
@signature_sheet = SignatureSheet.new
end
def create
@signature_sheet = SignatureSheet.new(signature_sheet_params)
@signature_sheet.author = current_user
if @signature_sheet.save
@signature_sheet.delay.verify_signatures
redirect_to [:admin, @signature_sheet], notice: I18n.t('flash.actions.create.signature_sheet')
else
render :new
end
end
def show
@signature_sheet = SignatureSheet.find(params[:id])
end
private
def signature_sheet_params
params.require(:signature_sheet).permit(:signable_type, :signable_id, :document_numbers)
end
end

View File

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

View File

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

View File

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

View File

@@ -22,7 +22,7 @@ class DebatesController < ApplicationController
def index_customization def index_customization
@featured_debates = @debates.featured @featured_debates = @debates.featured
@proposal_successful_exists = Proposal.successful.exists? @proposal_successfull_exists = Proposal.successfull.exists?
end end
def show def show
@@ -41,7 +41,7 @@ class DebatesController < ApplicationController
end end
def mark_featured 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) redirect_to request.query_parameters.merge(action: :index)
end end

View File

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

View File

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

View File

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

View File

@@ -38,7 +38,7 @@ class ProposalsController < ApplicationController
end end
def retire 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') redirect_to proposal_path(@proposal), notice: t('proposals.notice.retired')
else else
render action: :retire_form render action: :retire_form

View File

@@ -23,6 +23,6 @@ class StatsController < ApplicationController
private private
def daily_cache(key, &block) 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
end end

View File

@@ -6,7 +6,7 @@ class Verification::EmailController < ApplicationController
def show def show
if Verification::Email.find(current_user, params[:email_verification_token]) 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') redirect_to account_path, notice: t('verification.email.show.flash.success')
else else
redirect_to verified_user_path, alert: t('verification.email.show.alert.failure') redirect_to verified_user_path, alert: t('verification.email.show.alert.failure')

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,4 +3,5 @@ module DebatesHelper
def has_featured? def has_featured?
Debate.all.featured.count > 0 Debate.all.featured.count > 0
end end
end end

View File

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

View File

@@ -0,0 +1,12 @@
module LayoutsHelper
def layout_menu_link_to(text, path, is_active, options)
if is_active
content_tag(:span, t('shared.you_are_in'), class: 'sr-only') + ' ' +
link_to(text, path, options.merge(class: "active"))
else
link_to(text, path, options)
end
end
end

View File

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

View File

@@ -0,0 +1,8 @@
module SignatureSheetsHelper
def signable_options
[[t("activerecord.models.proposal", count: 1), Proposal],
[t("activerecord.models.spending_proposal", count: 1), SpendingProposal]]
end
end

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
class ApplicationMailer < ActionMailer::Base class ApplicationMailer < ActionMailer::Base
helper :settings helper :settings
default from: "Consul <no-reply@consul.es>" default from: "#{Setting['mailer_from_name']} <#{Setting['mailer_from_address']}>"
layout 'mailer' layout 'mailer'
end end

View File

@@ -45,6 +45,8 @@ module Abilities
can [:search, :edit, :update, :create, :index, :destroy], Banner can [:search, :edit, :update, :create, :index, :destroy], Banner
can [:index, :create, :edit, :update, :destroy], Geozone
can [:manage], Poll can [:manage], Poll
can [:manage], Poll::Booth can [:manage], Poll::Booth
can [:search, :create, :index, :destroy], ::Poll::Officer can [:search, :create, :index, :destroy], ::Poll::Officer

View File

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

View File

@@ -24,8 +24,8 @@ class Comment < ActiveRecord::Base
scope :not_as_admin_or_moderator, -> { where("administrator_id IS NULL").where("moderator_id IS NULL")} scope :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_flags, -> { order(flags_count: :desc, updated_at: :desc) }
scope :sort_by_most_voted , -> { order(confidence_score: :desc, created_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_descendants_by_most_voted, -> { order(confidence_score: :desc, created_at: :asc) }
scope :sort_by_newest, -> { order(created_at: :desc) } scope :sort_by_newest, -> { order(created_at: :desc) }
scope :sort_descendants_by_newest, -> { order(created_at: :desc) } scope :sort_descendants_by_newest, -> { order(created_at: :desc) }

View File

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

View File

@@ -28,7 +28,7 @@ class Debate < ActiveRecord::Base
before_save :calculate_hot_score, :calculate_confidence_score before_save :calculate_hot_score, :calculate_confidence_score
scope :for_render, -> { includes(:tags) } 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_confidence_score, -> { reorder(confidence_score: :desc) }
scope :sort_by_created_at, -> { reorder(created_at: :desc) } scope :sort_by_created_at, -> { reorder(created_at: :desc) }
scope :sort_by_most_commented, -> { reorder(comments_count: :desc) } scope :sort_by_most_commented, -> { reorder(comments_count: :desc) }

View File

@@ -1,5 +1,8 @@
class Geozone < ActiveRecord::Base class Geozone < ActiveRecord::Base
has_many :proposals
has_many :spending_proposals has_many :spending_proposals
has_many :debates
has_many :users
validates :name, presence: true validates :name, presence: true
def self.names def self.names
@@ -10,4 +13,9 @@ class Geozone < ActiveRecord::Base
where(name: 'city').first where(name: 'city').first
end end
def safe_to_destroy?
Geozone.reflect_on_all_associations(:has_many).all? do |association|
association.klass.where(geozone: self).empty?
end
end
end end

View File

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

View File

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

View File

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

View File

@@ -9,7 +9,7 @@ class ProposalNotification < ActiveRecord::Base
def minimum_interval def minimum_interval
return true if proposal.try(:notifications).blank? 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])) errors.add(:title, I18n.t('activerecord.errors.models.proposal_notification.attributes.minimum_interval.invalid', interval: Setting[:proposal_notification_minimum_interval_in_days]))
end end
end end

85
app/models/signature.rb Normal file
View File

@@ -0,0 +1,85 @@
class Signature < ActiveRecord::Base
belongs_to :signature_sheet
belongs_to :user
validates :document_number, presence: true
validates :signature_sheet, presence: true
scope :verified, -> { where(verified: true) }
scope :unverified, -> { where(verified: false) }
delegate :signable, to: :signature_sheet
def verified?
user_exists? || in_census?
end
def verify
if verified?
assign_vote
mark_as_verified
end
end
def assign_vote
if user_exists?
assign_vote_to_user
else
create_user
assign_vote_to_user
end
end
def assign_vote_to_user
set_user
signable.register_vote(user, "yes")
assign_signature_to_vote
end
def assign_signature_to_vote
vote = Vote.where(votable: signable, voter: user).first
vote.update(signature: self)
end
def user_exists?
User.where(document_number: document_number).any?
end
def create_user
user_params = {
document_number: document_number,
created_from_signature: true,
verified_at: Time.now,
erased_at: Time.now,
password: random_password,
terms_of_service: '1',
email: nil
}
User.create!(user_params)
end
def random_password
(0...20).map { ('a'..'z').to_a[rand(26)] }.join
end
def in_census?
response = document_types.detect do |document_type|
CensusApi.new.call(document_type, document_number).valid?
end
response.present?
end
def set_user
user = User.where(document_number: document_number).first
update(user: user)
end
def mark_as_verified
update(verified: true)
end
def document_types
%w(1 2 3 4)
end
end

View File

@@ -0,0 +1,38 @@
class SignatureSheet < ActiveRecord::Base
belongs_to :signable, polymorphic: true
belongs_to :author, class_name: 'User', foreign_key: 'author_id'
VALID_SIGNABLES = %w( Proposal SpendingProposal )
has_many :signatures
validates :author, presence: true
validates :signable_type, inclusion: {in: VALID_SIGNABLES}
validates :document_numbers, presence: true
validates :signable, presence: true
validate :signable_found
def name
"#{signable_name} #{signable_id}"
end
def signable_name
I18n.t("activerecord.models.#{signable_type.underscore}", count: 1)
end
def verify_signatures
parsed_document_numbers.each do |document_number|
signature = signatures.create(document_number: document_number)
signature.verify
end
update(processed: true)
end
def parsed_document_numbers
document_numbers.split(/\W+/)
end
def signable_found
errors.add(:signable_id, :not_found) if errors.messages[:signable].present?
end
end

View File

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

View File

@@ -70,7 +70,7 @@ class User < ActiveRecord::Base
oauth_email: oauth_email, oauth_email: oauth_email,
password: Devise.friendly_token[0,20], password: Devise.friendly_token[0,20],
terms_of_service: '1', terms_of_service: '1',
confirmed_at: oauth_email_confirmed ? DateTime.now : nil confirmed_at: oauth_email_confirmed ? DateTime.current : nil
) )
end end
@@ -159,12 +159,11 @@ class User < ActiveRecord::Base
def erase(erase_reason = nil) def erase(erase_reason = nil)
self.update( self.update(
erased_at: Time.now, erased_at: Time.current,
erase_reason: erase_reason, erase_reason: erase_reason,
username: nil, username: nil,
email: nil, email: nil,
unconfirmed_email: nil, unconfirmed_email: nil,
document_number: nil,
phone_number: nil, phone_number: nil,
encrypted_password: "", encrypted_password: "",
confirmation_token: nil, confirmation_token: nil,
@@ -247,6 +246,7 @@ class User < ActiveRecord::Base
delegate :can?, :cannot?, to: :ability delegate :can?, :cannot?, to: :ability
private private
def clean_document_number def clean_document_number
self.document_number = self.document_number.gsub(/[^a-z0-9]+/i, "").upcase unless self.document_number.blank? self.document_number = self.document_number.gsub(/[^a-z0-9]+/i, "").upcase unless self.document_number.blank?
end end

View File

@@ -17,7 +17,7 @@ class Verification::Letter
end end
def letter_requested! 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 end
def validate_existing_user def validate_existing_user

View File

@@ -10,7 +10,7 @@ class Verification::Management::Document
delegate :username, :email, to: :user, allow_nil: true delegate :username, :email, to: :user, allow_nil: true
def user def user
@user = User.by_document(document_type, document_number).first @user = User.active.by_document(document_type, document_number).first
end end
def user? def user?
@@ -40,7 +40,7 @@ class Verification::Management::Document
end end
def verify def verify
user.update(verified_at: Time.now) if user? user.update(verified_at: Time.current) if user?
end end
end end

View File

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

View File

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

View File

@@ -118,5 +118,13 @@
</li> </li>
</ul> </ul>
</li> </li>
<% if feature?(:signature_sheets) %>
<li <%= "class=active" if controller_name == "signature_sheets" %>>
<%= link_to admin_signature_sheets_path do %>
<span class="icon-budget"></span><%= t("admin.menu.signature_sheets") %>
<% end %>
</li>
<% end %>
</ul> </ul>
</div> </div>

View File

@@ -0,0 +1,15 @@
<% if @geozone.errors.any? %>
<div id="error_explanation" data-alert class="callout alert" data-closable>
<button class="close-button" aria-label="<%= t("application.close") %>" type="button" data-close>
<span aria-hidden="true">&times;</span>
</button>
<strong>
<%= @geozone.errors.count %>
<%= t("admin.geozones.errors.form.error", count: @geozone.errors.count) %>
</strong>
</div>
<% end %>

View File

@@ -0,0 +1,29 @@
<%= form_for [:admin, @geozone] do |f| %>
<%= render 'errors' %>
<div clas="row">
<div class="small-12 medium-6 large-4 column">
<%= f.label :name, t("admin.geozones.geozone.name") %>
<%= f.text_field :name, label: false %>
</div>
<div class="small-12 medium-6 large-4 column">
<%= f.label :html_map_coordinates, t("admin.geozones.geozone.coordinates") %>
<%= f.text_field :html_map_coordinates, label: false %>
</div>
<div class="small-12 medium-6 large-2 column">
<%= f.label :external_code, t("admin.geozones.geozone.external_code") %>
<%= f.text_field :external_code, label: false %>
</div>
<div class="small-12 medium-6 large-2 column">
<%= f.label :census_code, t("admin.geozones.geozone.census_code") %>
<%= f.text_field :census_code, label: false %>
</div>
</div>
<div class="row">
<div class="actions small-12 large-3 medium-3 column">
<%= f.submit(class: "button expanded", value: t("admin.geozones.edit.form.submit_button")) %>
</div>
</div>
<% end %>

View File

@@ -0,0 +1,13 @@
<div class="row">
<div class="small-12 column">
<%= link_to admin_geozones_path, class: "back" do %>
<span class="icon-angle-left"></span>
<%= t("admin.geozones.edit.back") %>
<% end %>
<h1><%= t("admin.geozones.edit.editing") %></h1>
<%= render "form" %>
</div>
</div>

View File

@@ -0,0 +1,33 @@
<%= link_to t("admin.geozones.index.create"),
new_admin_geozone_path, class: "button success float-right" %>
<h2 class="inline-block"><%= t("admin.geozones.index.title") %></h2>
<table>
<thead>
<tr>
<th><%= t("admin.geozones.geozone.name") %></th>
<th><%= t("admin.geozones.geozone.external_code") %></th>
<th><%= t("admin.geozones.geozone.census_code") %></th>
<th><%= t("admin.geozones.geozone.coordinates") %></th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
<% @geozones.each do |geozone| %>
<tr id="<%= dom_id(geozone) %>">
<td><%= geozone.name %></td>
<td><%= geozone.external_code %></td>
<td><%= geozone.census_code %></td>
<td><%= geozone.html_map_coordinates %></td>
<td>
<%= link_to t("admin.geozones.index.edit"), edit_admin_geozone_path(geozone), class: 'edit-banner button hollow' %>
</td>
<td>
<%= link_to t("admin.geozones.index.delete"), admin_geozone_path(geozone), method: :delete, class: 'button hollow alert' %>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -0,0 +1,13 @@
<div class="geozone-new row">
<div class="small-12 column">
<%= link_to admin_geozones_path, class: "back" do %>
<span class="icon-angle-left"></span>
<%= t("admin.geozones.new.back") %>
<% end %>
<h1><%= t("admin.geozones.new.creating") %></h1>
<%= render "form" %>
</div>
</div>

View File

@@ -0,0 +1,31 @@
<h2 class="inline-block"><%= t("admin.signature_sheets.index.title") %></h2>
<%= link_to t("admin.signature_sheets.index.new"), new_admin_signature_sheet_path,
class: "button success float-right" %>
<% if @signature_sheets.any? %>
<table>
<tr>
<th><%= t("admin.signature_sheets.name") %></th>
<th><%= t("admin.signature_sheets.author") %></th>
<th><%= t("admin.signature_sheets.created_at") %></th>
</tr>
<% @signature_sheets.each do |signature_sheet| %>
<tr id="<%= dom_id(signature_sheet) %>" class="signature_sheet">
<td>
<%= link_to signature_sheet.name, [:admin, signature_sheet] %>
</td>
<td>
<%= signature_sheet.author.name %>
</td>
<td>
<%= l(signature_sheet.created_at, format: :short) %>
</td>
</tr>
<% end %>
</table>
<% else %>
<div class="callout primary margin-top">
<%= t("admin.signature_sheets.no_signature_sheets") %>
</div>
<% end %>

View File

@@ -0,0 +1,22 @@
<%= render 'shared/back_link' %>
<h2><%= t("admin.signature_sheets.new.title") %></h2>
<%= form_for [:admin, @signature_sheet] do |f| %>
<%= render 'shared/errors',
resource: @signature_sheet %>
<div class="small-12 medium-6 large-4">
<%= f.select :signable_type, signable_options %>
</div>
<div class="small-12 medium-6 large-4">
<%= f.text_field :signable_id %>
</div>
<%= f.label :document_numbers %>
<p class="note"><%= t("admin.signature_sheets.new.document_numbers_note") %></p>
<%= f.text_area :document_numbers, rows: "6", label: false %>
<%= f.submit(class: "button", value: t("admin.signature_sheets.new.submit")) %>
<% end %>

View File

@@ -0,0 +1,39 @@
<h2 class="inline-block"><%= @signature_sheet.name %></h2>
<div class="callout secondary float-right">
<%= t("admin.signature_sheets.show.created_at") %>
<strong><%= l(@signature_sheet.created_at, format: :short) %></strong>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= t("admin.signature_sheets.show.author") %>
<strong><%= @signature_sheet.author.name %></strong>
</div>
<div class="callout margin-top">
<p><strong><%= t("admin.signature_sheets.show.documents") %></strong></p>
<%= simple_format @signature_sheet.document_numbers %>
</div>
<div id="verified_signatures" class="callout success">
<strong>
<%= t("admin.signature_sheets.show.verified",
count: @signature_sheet.signatures.verified.count ) %>
</strong>
</div>
<div id="unverified_signatures" class="callout alert">
<p>
<strong>
<%= t("admin.signature_sheets.show.unverified",
count: @signature_sheet.signatures.unverified.count ) %>
<%= t("admin.signature_sheets.show.unverified_error") %>
</strong>
</p>
<%= @signature_sheet.signatures.unverified.map(&:document_number).join(", ") %>
</div>
<% unless @signature_sheet.processed? %>
<div class="callout primary margin-top">
<%= t("admin.signature_sheets.show.loading") %>
</div>
<% end %>

View File

@@ -1,7 +1,7 @@
<% cache [locale_and_user_status(comment), comment, commentable_cache_key(comment.commentable), comment.author, (@comment_flags[comment.id] if @comment_flags)] do %> <% cache [locale_and_user_status(comment), comment, commentable_cache_key(comment.commentable), comment.author, (@comment_flags[comment.id] if @comment_flags)] do %>
<div class="row"> <div class="row">
<div id="<%= dom_id(comment) %>" class="comment small-12 column"> <ul id="<%= dom_id(comment) %>" class="comment no-bullet small-12 column">
<li class="comment-body">
<% if comment.hidden? || comment.user.hidden? %> <% if comment.hidden? || comment.user.hidden? %>
<% if comment.children.size > 0 %> <% if comment.children.size > 0 %>
<div class="is-deleted"> <div class="is-deleted">
@@ -23,7 +23,6 @@
<% end %> <% end %>
<% end %> <% end %>
<div class="comment-body">
<div class="comment-info"> <div class="comment-info">
<% if comment.as_administrator? %> <% if comment.as_administrator? %>
@@ -58,7 +57,7 @@
<% end %> <% end %>
&nbsp;&bull;&nbsp;<time><%= l comment.created_at.to_datetime, format: :datetime %></time> &nbsp;&bull;&nbsp;<span><%= l comment.created_at.to_datetime, format: :datetime %></span>
</div> </div>
<div class="comment-user <div class="comment-user
@@ -68,13 +67,14 @@
</div> </div>
<div id="<%= dom_id(comment) %>_reply" class="reply"> <div id="<%= dom_id(comment) %>_reply" class="reply">
<span id="<%= dom_id(comment) %>_votes" class="comment-votes float-right"> <div id="<%= dom_id(comment) %>_votes" class="comment-votes float-right">
<%= render 'comments/votes', comment: comment %> <%= render 'comments/votes', comment: comment %>
</span> </div>
<% if comment.children.size > 0 %> <% if comment.children.size > 0 %>
<%= link_to "", class: "js-toggle-children relative", data: {'id': "#{dom_id(comment)}"} do %> <%= link_to "#{dom_id(comment)}", class: "js-toggle-children relative", data: {'id': "#{dom_id(comment)}"} do %>
<span class="sr-only"><%= t("shared.show") %></span> <span class="sr-only js-child-toggle" style="display: none;"><%= t("shared.show") %></span>
<span class="sr-only js-child-toggle"><%= t("shared.hide") %></span>
<span id="<%= dom_id(comment) %>_children_arrow" class="icon-arrow-down"></span> <%= t("comments.comment.responses", count: comment.children.size) %> <span id="<%= dom_id(comment) %>_children_arrow" class="icon-arrow-down"></span> <%= t("comments.comment.responses", count: comment.children.size) %>
<% end %> <% end %>
<% else %> <% else %>
@@ -91,14 +91,15 @@
<%= render 'comments/form', {commentable: comment.commentable, parent_id: comment.id, toggeable: true} %> <%= render 'comments/form', {commentable: comment.commentable, parent_id: comment.id, toggeable: true} %>
<% end %> <% end %>
</div> </div>
</div>
<% end %> <% end %>
</li>
<div id="<%= dom_id(comment) %>_children" class="comment-children"> <li>
<ul id="<%= dom_id(comment) %>_children" class="no-bullet comment-children">
<% child_comments_of(comment).each do |child| %> <% child_comments_of(comment).each do |child| %>
<%= render 'comments/comment', comment: child %> <%= render 'comments/comment', comment: child %>
<% end %> <% end %>
</div> </ul>
</div> </li>
</ul>
</div> </div>
<% end %> <% end %>

View File

@@ -6,13 +6,17 @@
<span class="in_favor"> <span class="in_favor">
<% if can?(:vote, comment) %> <% if can?(:vote, comment) %>
<%= link_to vote_comment_path(comment, value: 'yes'), <%= link_to vote_comment_path(comment, value: 'yes'),
method: "post", remote: true do %> method: "post", remote: true, title: t('votes.agree') do %>
<span class="icon-angle-up"> <span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span> <span class="sr-only"><%= t('votes.agree') %></span>
</span> </span>
<% end %> <% end %>
<% else %> <% else %>
<span class="icon-angle-up"></span> <%= link_to new_user_session_path do %>
<span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span>
</span>
<% end %>
<% end %> <% end %>
<%= comment.total_likes %> <%= comment.total_likes %>
</span> </span>
@@ -20,13 +24,15 @@
<span class="against"> <span class="against">
<% if can?(:vote, comment) %> <% if can?(:vote, comment) %>
<%= link_to vote_comment_path(comment, value: 'no'), <%= link_to vote_comment_path(comment, value: 'no'),
method: "post", remote: true do %> method: "post", remote: true, title: t('votes.disagree') do %>
<span class="icon-angle-down"> <span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span> <span class="sr-only"><%= t('votes.disagree') %></span>
</span> </span>
<% end %> <% end %>
<% else %> <% else %>
<span class="icon-angle-down"></span> <span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span>
</span>
<% end %> <% end %>
<%= comment.total_dislikes %> <%= comment.total_dislikes %>
</span> </span>
@@ -40,26 +46,40 @@
<span class="in_favor"> <span class="in_favor">
<% if can?(:vote, comment) %> <% if can?(:vote, comment) %>
<%= link_to vote_comment_path(comment, value: 'yes'), <%= link_to vote_comment_path(comment, value: 'yes'),
method: "post", remote: true do %> method: "post", remote: true, title: t('votes.agree') do %>
<span class="icon-angle-up"></span> <span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span>
</span>
<% end %> <% end %>
<% else %> <% else %>
<span class="icon-angle-up"></span> <%= link_to new_user_session_path do %>
<span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span>
</span>
<% end %>
<% end %> <% end %>
<%= comment.total_likes %> <%= comment.total_likes %>
</span> </span>
<span class="against"> <span class="against">
<% if can?(:vote, comment) %> <% if can?(:vote, comment) %>
<%= link_to vote_comment_path(comment, value: 'no'), <%= link_to vote_comment_path(comment, value: 'no'),
method: "post", remote: true do %> method: "post", remote: true, title: t('votes.disagree') do %>
<span class="icon-angle-down"></span> <span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span>
</span>
<% end %> <% end %>
<% else %> <% else %>
<span class="icon-angle-down"></span> <%= link_to new_user_session_path do %>
<span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span>
</span>
<% end %>
<% end %> <% end %>
<%= comment.total_dislikes %> <%= comment.total_dislikes %>
</span> </span>
</div> </div>
<div class="participation-not-allowed" style='display:none' aria-hidden="false"> <div class="participation-not-allowed" style='display:none' aria-hidden="false">
<%= t("votes.comment_unauthenticated", <%= t("votes.comment_unauthenticated",
signin: link_to(t("votes.signin"), new_user_session_path), signin: link_to(t("votes.signin"), new_user_session_path),

View File

@@ -1,11 +1,10 @@
<% cache [locale_and_user_status, @current_order, commentable_cache_key(@debate), @comment_tree.comments, @comment_tree.comment_authors, @debate.comments_count, @comment_flags] do %> <% cache [locale_and_user_status, @current_order, commentable_cache_key(@debate), @comment_tree.comments, @comment_tree.comment_authors, @debate.comments_count, @comment_flags] do %>
<section class="row-full comments"> <div class="row comments">
<div class="row">
<div id="comments" class="small-12 column"> <div id="comments" class="small-12 column">
<h2> <h3>
<%= t("debates.show.comments_title") %> <%= t("debates.show.comments_title") %>
<span class="js-comments-count">(<%= @debate.comments_count %>)</span> <span class="js-comments-count">(<%= @debate.comments_count %>)</span>
</h2> </h3>
<%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %>
@@ -27,5 +26,4 @@
<%= paginate @comment_tree.root_comments %> <%= paginate @comment_tree.root_comments %>
</div> </div>
</div> </div>
</section>
<% end %> <% end %>

View File

@@ -41,14 +41,14 @@
</p> </p>
<div class="debate-description"> <div class="debate-description">
<%= link_to debate.description, debate %> <%= debate.description %>
<div class="truncate"></div> <div class="truncate"></div>
</div> </div>
<%= render "shared/tags", taggable: debate, limit: 5 %> <%= render "shared/tags", taggable: debate, limit: 5 %>
</div> </div>
</div> </div>
<div id="<%= dom_id(debate) %>_votes" class="small-12 medium-3 column text-center"> <div id="<%= dom_id(debate) %>_votes" class="small-12 medium-3 column">
<%= render 'debates/votes', debate: debate %> <%= render 'debates/votes', debate: debate %>
</div> </div>

View File

@@ -1,6 +1,5 @@
<%= form_for(@debate) do |f| %> <%= form_for(@debate) do |f| %>
<%= render 'shared/errors', resource: @debate %> <%= render 'shared/errors', resource: @debate %>
<div class="row"> <div class="row">

View File

@@ -1,6 +1,7 @@
<% voted_classes = css_classes_for_vote(@debate_votes, debate) %> <% voted_classes = css_classes_for_vote(@debate_votes, debate) %>
<div class="votes"> <div class="votes">
<div class="in-favor inline-block"> <div class="in-favor inline-block">
<% if user_signed_in? %>
<%= link_to vote_debate_path(debate, value: 'yes'), <%= link_to vote_debate_path(debate, value: 'yes'),
class: "like #{voted_classes[:in_favor]}", title: t('votes.agree'), method: "post", remote: true do %> class: "like #{voted_classes[:in_favor]}", title: t('votes.agree'), method: "post", remote: true do %>
<span class="icon-like"> <span class="icon-like">
@@ -8,17 +9,34 @@
</span> </span>
<span class="percentage"><%= votes_percentage('likes', debate) %></span> <span class="percentage"><%= votes_percentage('likes', debate) %></span>
<% end %> <% end %>
<% else %>
<div class="like">
<span class="icon-like">
<span class="sr-only"><%= t('votes.agree') %></span>
</span>
<span class="percentage"><%= votes_percentage('likes', debate) %></span>
</div>
<% end %>
</div> </div>
<span class="divider"></span> <span class="divider"></span>
<div class="against inline-block"> <div class="against inline-block">
<% if user_signed_in? %>
<%= link_to vote_debate_path(debate, value: 'no'), class: "unlike #{voted_classes[:against]}", title: t('votes.disagree'), method: "post", remote: true do %> <%= link_to vote_debate_path(debate, value: 'no'), class: "unlike #{voted_classes[:against]}", title: t('votes.disagree'), method: "post", remote: true do %>
<span class="icon-unlike"> <span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span> <span class="sr-only"><%= t('votes.disagree') %></span>
</span> </span>
<span class="percentage"><%= votes_percentage('dislikes', debate) %></span> <span class="percentage"><%= votes_percentage('dislikes', debate) %></span>
<% end %> <% end %>
<% else %>
<div class="unlike">
<span class="icon-unlike">
<span class="sr-only"><%= t('votes.disagree') %></span>
</span>
<span class="percentage"><%= votes_percentage('dislikes', debate) %></span>
</div>
<% end %>
</div> </div>
<span class="total-votes"> <span class="total-votes">
@@ -39,10 +57,12 @@
</p> </p>
</div> </div>
<% elsif !user_signed_in? %> <% elsif !user_signed_in? %>
<div tabindex="0">
<div class="participation-not-allowed" style='display:none' aria-hidden="false"> <div class="participation-not-allowed" style='display:none' aria-hidden="false">
<%= t("votes.unauthenticated", <%= t("votes.unauthenticated",
signin: link_to(t("votes.signin"), new_user_session_path), signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %> signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
</div> </div>
</div>
<% end %> <% end %>
</div> </div>

View File

@@ -6,6 +6,8 @@
<% end %> <% end %>
<main> <main>
<h1 class="sr-only"><%= t("shared.outline.debates") %></h1>
<div class="row"> <div class="row">
<div id="debates" class="debates-list small-12 medium-9 column"> <div id="debates" class="debates-list small-12 medium-9 column">

View File

@@ -1,6 +1,6 @@
<% provide :title do %><%= @debate.title %><% end %> <% provide :title do %><%= @debate.title %><% end %>
<% cache [locale_and_user_status(@debate), @debate, @debate.author, Flag.flagged?(current_user, @debate), @debate_votes] do %> <% cache [locale_and_user_status(@debate), @debate, @debate.author, Flag.flagged?(current_user, @debate), @debate_votes] do %>
<section class="debate-show"> <div class="debate-show">
<div id="<%= dom_id(@debate) %>" class="row"> <div id="<%= dom_id(@debate) %>" class="row">
<div class="small-12 medium-9 column"> <div class="small-12 medium-9 column">
<%= render "shared/back_link" %> <%= render "shared/back_link" %>
@@ -44,14 +44,12 @@
<aside class="small-12 medium-3 column"> <aside class="small-12 medium-3 column">
<div class="sidebar-divider"></div> <div class="sidebar-divider"></div>
<h3><%= t("votes.supports") %></h3> <h2><%= t("votes.supports") %></h2>
<div class="text-center">
<div id="<%= dom_id(@debate) %>_votes"> <div id="<%= dom_id(@debate) %>_votes">
<%= render 'debates/votes', debate: @debate %> <%= render 'debates/votes', debate: @debate %>
</div> </div>
</div>
<div class="sidebar-divider"></div> <div class="sidebar-divider"></div>
<h3><%= t("debates.show.share") %></h3> <h2><%= t("debates.show.share") %></h2>
<div class="social-share-full"> <div class="social-share-full">
<%= social_share_button_tag("#{@debate.title} #{setting['twitter_hashtag']}") %> <%= social_share_button_tag("#{@debate.title} #{setting['twitter_hashtag']}") %>
<% if browser.device.mobile? %> <% if browser.device.mobile? %>
@@ -60,8 +58,9 @@
</a> </a>
<% end %> <% end %>
</div> </div>
</aside>
</div>
</div> </div>
</section>
<% end %> <% end %>
<%= render "comments" %> <%= render "comments" %>

View File

@@ -1,6 +1,5 @@
<%= paginator.render do -%> <%= paginator.render do -%>
<div class="pagination-centered"> <div class="pagination-centered">
<nav>
<ul class="pagination text-center margin-top" aria-label="Pagination"> <ul class="pagination text-center margin-top" aria-label="Pagination">
<%= first_page_tag unless current_page.first? %> <%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %> <%= prev_page_tag unless current_page.first? %>
@@ -16,6 +15,5 @@
<%= next_page_tag unless current_page.last? %> <%= next_page_tag unless current_page.last? %>
<%= last_page_tag unless current_page.last? %> <%= last_page_tag unless current_page.last? %>
</ul> </ul>
</nav>
</div> </div>
<% end -%> <% end -%>

View File

@@ -41,13 +41,13 @@
<div class="subfooter row"> <div class="subfooter row">
<div class="small-12 medium-8 column"> <div class="small-12 medium-8 column">
<p> <%= t("layouts.footer.copyright", year: Time.current.year) %>&nbsp;|
<%= t("layouts.footer.copyright", year: Time.now.year) %>&nbsp;|&nbsp; <ul class="no-bullet inline-block">
<%= link_to t("layouts.footer.more_info"), page_path('more_information') %>&nbsp;|&nbsp; <li class="inline-block"><%= link_to t("layouts.footer.more_info"), page_path('more_information') %>&nbsp;|</li>
<%= link_to t("layouts.footer.privacy"), page_path('privacy') %>&nbsp;|&nbsp; <li class="inline-block"><%= link_to t("layouts.footer.privacy"), page_path('privacy') %>&nbsp;|</li>
<%= link_to t("layouts.footer.conditions"), page_path('conditions') %>&nbsp;|&nbsp; <li class="inline-block"><%= link_to t("layouts.footer.conditions"), page_path('conditions') %>&nbsp;|</li>
<%= link_to t("layouts.footer.accessibility"), page_path('accessibility') %> <li class="inline-block"><%= link_to t("layouts.footer.accessibility"), page_path('accessibility') %></li>
</p> </ul>
</div> </div>
<div class="small-12 medium-4 column social"> <div class="small-12 medium-4 column social">

View File

@@ -16,13 +16,8 @@
<div class="top-bar-title"> <div class="top-bar-title">
<%= link_to root_path, class: "hide-for-small-only", accesskey: "/" do %> <%= link_to root_path, class: "hide-for-small-only", accesskey: "/" do %>
<%= image_tag('logo_header.png', class: 'hide-for-small-only float-left', size: '80x80', alt: t("layouts.header.logo")) %> <%= image_tag('logo_header.png', class: 'hide-for-small-only float-left', size: '80x80', alt: t("layouts.header.logo")) %>
<% if opendata_page? %>
<%= t("layouts.header.open_gov", open: "#{t('layouts.header.open')}") %> <span>|</span>
<span class="logo-site"><%= t("layouts.header.open_data") %></span>
<% else %>
<%= setting['org_name'] %> <%= setting['org_name'] %>
<% end %> <% end %>
<% end %>
</div> </div>
<div class="top-bar-right"> <div class="top-bar-right">
@@ -34,9 +29,6 @@
<div class="show-for-small-only"> <div class="show-for-small-only">
<div class="subnavigation row"> <div class="subnavigation row">
<%= render "shared/subnavigation" %> <%= render "shared/subnavigation" %>
<div class="small-12 medium-3 column">
<%= yield :header_addon %>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -48,11 +40,11 @@
<div class="row"> <div class="row">
<div class="hide-for-small-only"> <div class="hide-for-small-only">
<%= render "shared/subnavigation" %> <%= render "shared/subnavigation" %>
</div>
<div class="small-12 medium-3 column"> <div class="small-12 medium-3 column">
<%= yield :header_addon %> <%= yield :header_addon %>
</div> </div>
</div> </div>
</div> </div>
</div>
</header> </header>

View File

@@ -14,7 +14,7 @@
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= favicon_link_tag "favicon.ico" %> <%= favicon_link_tag "favicon.ico" %>
<%= favicon_link_tag "apple-touch-icon-200.png", <%= favicon_link_tag "apple-touch-icon-200.png",
rel: "apple-touch-icon", rel: "icon apple-touch-icon",
sizes: "200x200", sizes: "200x200",
type: "image/png" %> type: "image/png" %>
<%= content_for :social_media_meta_tags %> <%= content_for :social_media_meta_tags %>
@@ -22,6 +22,8 @@
<%= setting['per_page_code'].try(:html_safe) %> <%= setting['per_page_code'].try(:html_safe) %>
</head> </head>
<body> <body>
<h1 class="sr-only"><%= setting['org_name'] %></h1>
<div class="wrapper <%= yield (:wrapper_class) %>"> <div class="wrapper <%= yield (:wrapper_class) %>">
<%= render 'layouts/header' %> <%= render 'layouts/header' %>

View File

@@ -40,7 +40,7 @@
</tr> </tr>
<tr> <tr>
<td class="text-center">S</td> <td class="text-center">S</td>
<td>Presupuestos ciudadanos</td> <td>Presupuestos participativos</td>
</tr> </tr>
<tr> <tr>
<td class="text-center">I</td> <td class="text-center">I</td>

View File

@@ -8,8 +8,8 @@
</div> </div>
<div class="small-12 medium-9 column"> <div class="small-12 medium-9 column">
<h1>¿Cómo funcionan los presupuestos ciudadanos?</h1> <h1>¿Cómo funcionan los Presupuestos participativos?</h1>
<h2 id="i">Explicación detallada del proceso</h2> <h2 id="i">Explicación detallada del proceso</h2>
<p>Próximamente se podrá encontrar aquí una descripción del proceso de participación ciudadana en los presupuestos.</p> <p>Descripción del proceso de participación ciudadana en los presupuestos.</p>
</div> </div>
</div> </div>

View File

@@ -1,9 +1,9 @@
<div class="sidebar-divider"></div> <div class="sidebar-divider"></div>
<h3 class="sidebar-title"><%= t("shared.tags_cloud.categories") %></h3> <h2 class="sidebar-title"><%= t("shared.tags_cloud.categories") %></h2>
<br> <br>
<div id="categories" class="categories"> <ul id="categories" class="no-bullet categories">
<% @categories.each do |category| %> <% @categories.each do |category| %>
<%= link_to category.name, proposals_path(search: category.name) %> <li class="inline-block"><%= link_to category.name, proposals_path(search: category.name) %></li>
<% end %> <% end %>
</div> </ul>

View File

@@ -1,6 +1,5 @@
<% cache [locale_and_user_status, @current_order, commentable_cache_key(@proposal), @comment_tree.comments, @comment_tree.comment_authors, @proposal.comments_count, @comment_flags] do %> <% cache [locale_and_user_status, @current_order, commentable_cache_key(@proposal), @comment_tree.comments, @comment_tree.comment_authors, @proposal.comments_count, @comment_flags] do %>
<section class="comments"> <div class="row comments">
<div class="row">
<div id="comments" class="small-12 column"> <div id="comments" class="small-12 column">
<%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %>
@@ -22,5 +21,4 @@
<%= paginate @comment_tree.root_comments %> <%= paginate @comment_tree.root_comments %>
</div> </div>
</div> </div>
</section>
<% end %> <% end %>

View File

@@ -1,4 +1,4 @@
<div class="supports"> <div class="supports text-center">
<div class="in-favor"> <div class="in-favor">
<% if voted_for?(@featured_proposals_votes, proposal) %> <% if voted_for?(@featured_proposals_votes, proposal) %>
<div class="supported"> <div class="supported">

View File

@@ -3,18 +3,18 @@
<ul class="tabs" data-tabs id="example-tabs"> <ul class="tabs" data-tabs id="example-tabs">
<li class="tabs-title is-active"> <li class="tabs-title is-active">
<%= link_to "#tab-comments" do %> <%= link_to "#tab-comments" do %>
<h2> <h3>
<%= t("proposals.show.comments_tab") %> <%= t("proposals.show.comments_tab") %>
<span class="js-comments-count">(<%= @proposal.comments_count %>)</span> <span class="js-comments-count">(<%= @proposal.comments_count %>)</span>
</h2> </h3>
<% end %> <% end %>
</li> </li>
<li class="tabs-title"> <li class="tabs-title">
<%= link_to "#tab-notifications" do %> <%= link_to "#tab-notifications" do %>
<h2> <h3>
<%= t("proposals.show.notifications_tab") %> <%= t("proposals.show.notifications_tab") %>
(<%= @notifications.count %>) (<%= @notifications.count %>)
</h2> </h3>
<% end %> <% end %>
</li> </li>
</ul> </ul>

View File

@@ -1,5 +1,5 @@
<div class="sidebar-divider"></div> <div class="sidebar-divider"></div>
<h3 class="sidebar-title"><%= t("shared.tags_cloud.districts") %></h3> <h2 class="sidebar-title"><%= t("shared.tags_cloud.districts") %></h2>
<br> <br>
<%= link_to map_proposals_path, id: 'map', title: t("shared.tags_cloud.districts_list") do %> <%= link_to map_proposals_path, id: 'map', title: t("shared.tags_cloud.districts_list") do %>
<%= image_tag("map.jpg", alt: t("shared.tags_cloud.districts_list")) %> <%= image_tag("map.jpg", alt: t("shared.tags_cloud.districts_list")) %>

View File

@@ -1,5 +1,5 @@
<div class="sidebar-divider"></div> <div class="sidebar-divider"></div>
<h3 class="sidebar-title"><%= t("proposals.index.top") %></h3> <h2 class="sidebar-title"><%= t("proposals.index.top") %></h2>
<p> <p>
<%= link_to t("proposals.index.top_link_proposals"), summary_proposals_path, class: "small" %><br> <%= link_to t("proposals.index.top_link_proposals"), summary_proposals_path, class: "small" %><br>

View File

@@ -44,7 +44,7 @@
<% end %> <% end %>
</p> </p>
<div class="proposal-description"> <div class="proposal-description">
<p><%= link_to proposal.summary, namespaced_proposal_path(proposal) %></p> <p><%= proposal.summary %></p>
<div class="truncate"></div> <div class="truncate"></div>
</div> </div>
<% end %> <% end %>
@@ -52,9 +52,10 @@
</div> </div>
</div> </div>
<div id="<%= dom_id(proposal) %>_votes" class="small-12 medium-3 column"> <div id="<%= dom_id(proposal) %>_votes" class="small-12 medium-3 column supports-container">
<% if proposal.successful? %> <% if proposal.successful? %>
<div class="message"> <div class="padding text-center">
<p> <p>
<%= t("proposals.proposal.successful", <%= t("proposals.proposal.successful",
voting: link_to(t("proposals.proposal.voting"), polls_path)).html_safe %> voting: link_to(t("proposals.proposal.voting"), polls_path)).html_safe %>
@@ -68,15 +69,13 @@
</p> </p>
<% end %> <% end %>
<% elsif proposal.archived? %> <% elsif proposal.archived? %>
<div class="message"> <div class="padding text-center">
<strong><%= t("proposals.proposal.supports", count: proposal.total_votes) %></strong> <strong><%= t("proposals.proposal.supports", count: proposal.total_votes) %></strong>
<p><%= t("proposals.proposal.archived") %></p> <p><%= t("proposals.proposal.archived") %></p>
</div> </div>
<% else %> <% else %>
<div class="text-center">
<%= render 'votes', <%= render 'votes',
{ proposal: proposal, vote_url: vote_proposal_path(proposal, value: 'yes') } %> { proposal: proposal, vote_url: vote_proposal_path(proposal, value: 'yes') } %>
</div>
<% end %> <% end %>
</div> </div>
</div> </div>

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