Compare commits

..

38 Commits

Author SHA1 Message Date
Maikel Linke
3c3c3394a5 Add spanish translations manually
A change in the Transifex API made the automated commit fail. Hence
doing it manually here.
2017-07-12 11:30:47 +10:00
Transifex-Openfoodnetwork
5b3816fa9e Updating translations for config/locales/fr.yml [skip ci] 2017-07-01 16:17:12 +10:00
Transifex-Openfoodnetwork
3507bae002 Updating translations for config/locales/nb.yml [skip ci] 2017-06-30 17:54:18 +10:00
Maikel Linke
b7f99c3185 Merge branch 'transifex' 2017-06-30 16:28:08 +10:00
Rob Harrington
ce85027b79 Update rubocop_todo.yml using rubocop 0.49.1 2017-06-29 10:47:56 +10:00
Rob Harrington
94b6a61665 Bump rubocop to latest version (0.49.1) 2017-06-29 10:47:56 +10:00
Rob Harrington
f84acf44f3 Disable scss-lint for CodeClimate
Until we can tweak #1393 to work with CodeClimate
2017-06-28 18:09:03 +10:00
Diogo Matsubara
386d651678 Fix #1611 (Rephrase error message for people logging in with an existing user email)
update test to use new rspec syntax
2017-06-28 15:35:21 +10:00
Matt-Yorkley
23a6e2dd8f Changed modal redirect behaviour 2017-06-28 14:35:17 +10:00
Rob Harrington
d8a158c56d Rubocop: Update comment on Rails/DynamicFindBy, justifying Enabled: false 2017-06-24 13:37:47 +10:00
Rob Harrington
dfda30f4cb Rubocop: Regenerate rubocop_todo.yml using --exclude-limit 100 2017-06-24 13:33:57 +10:00
Rob Harrington
d26970d04c Rubocop: Move Style/ClassAndModuleChildren back to rubocop_todo.yml 2017-06-24 12:59:03 +10:00
Rob Harrington
c7ed27286a Rubocop: Correct Lint/ParenthesesAsGroupedExpression offences 2017-06-23 17:02:20 +10:00
Rob Harrington
e5340cb53a Rubocop: Correct Lint/UselessAssignment offences, disable for /spec in main config 2017-06-23 16:49:08 +10:00
Rob Harrington
7079952f6b Add rubocop to development group in gemfile 2017-06-23 16:49:08 +10:00
Rob Harrington
f79dcaba15 Rubocop: Add Rails cops to config and todo 2017-06-23 16:49:08 +10:00
Rob Harrington
33a1d97d5e Rubocop: Disable Style/ClassAndModuleChildren in main config 2017-06-23 16:49:08 +10:00
Rob Harrington
28ea23965b Rubocop: Correct Lint/AmbiguousOperator offences 2017-06-23 16:49:08 +10:00
Rob Harrington
fbdbbb980f Rubocop: Disable Lint/AmbiguousBlockAssociation in main config 2017-06-23 16:49:08 +10:00
Rob Harrington
fc5b339e2a Rubocop: Correct Lint/DuplicateMethods offences 2017-06-23 16:49:08 +10:00
Rob Harrington
4acb3f1962 Rubocop: Use Relaxed.Ruby.Style as starting point for settings
Updated .rubocop_todo.yml
2017-06-23 16:49:08 +10:00
Rob Harrington
7bb58342fc Rubocop: Auto-correct Style/EmptyLineBetweenDefs offences 2017-06-23 16:49:08 +10:00
Rob Harrington
b277ff03ea Rubocop: Auto-correct Style/TrailingBlankLines offences 2017-06-23 16:49:07 +10:00
Rob Harrington
5061d0c4cd Rubocop: Tweak config, and add todo file 2017-06-23 16:49:07 +10:00
Continuous Integration
931a5be162 Merge remote-tracking branch 'origin/master' into HEAD 2017-06-22 13:19:25 +10:00
Maikel Linke
e437cba155 Make style flexible for all sizes of logos
Trying to support logos that are big. But logos that are too small
should not be stretched either, better small than ugly.

Remove static size declaration from HTML template since it doesn't
reflect the logo size.

Unfortunately, there are other CSS files that are in conflict. The file
mail/email.css.scss defines this globally:

    img {
      max-width: 100%;
    }
2017-06-16 16:49:43 +10:00
Maikel Linke
3330e9b219 Init registration form with default country 2017-06-14 16:47:02 +10:00
Maikel Linke
884743ce97 Filter countries without states for registration 2017-06-14 16:47:01 +10:00
Maikel Linke
b482d1e57c Spec current behaviour of country selector
The enterprise sign-up form shows invalid countries without states and
does not choose the default country. See:

https://github.com/openfoodfoundation/openfoodnetwork/issues/1330
2017-06-14 16:47:01 +10:00
Maikel Linke
78f5002be5 Separate variant names by spaces
To enable the search for the beginning of a variant name, they need to
be separated.

See: https://github.com/openfoodfoundation/openfoodnetwork/pull/1545
2017-06-14 16:37:46 +10:00
Maikel Linke
a42799dff4 Initialise product.variant_names
Not initialising `product.variant_names` causes it to become the string
"undefinedVariant1Variant2" while it should just be "Variant1Variant2".

This mistake did not matter when `variant_names` was just used to search
for a sub-string. A recent change to search only for the beginning of a
word, caused this to fail.

See: https://github.com/openfoodfoundation/openfoodnetwork/pull/1545
2017-06-14 16:28:55 +10:00
Maikel Linke
1196cd7df4 Add style guide to the source locale
There has been a lack of rules how to structure our locale en.yml. This
is a start to document some guidelines which can evolve over time.

Rules can be discussed in the community forum or in pull requests. Once
there is a strong agreement, we should add it to this guide.
2017-06-14 15:20:01 +10:00
Enrico Stano
3c1eae1f47 Do not blindly clear the whole Rails cache 2017-06-09 10:32:57 +10:00
Matt-Yorkley
ba27d63f9c Fix logo sizing 2017-06-06 13:59:42 +01:00
Julius Pabrinkis
0083733c4c #1471 Do no let long producers' name go under icon 2017-06-02 16:29:43 +10:00
Julius Pabrinkis
a1ffc869f3 Refactor code by suggestion to use RegExp and add tests coverage 2017-06-02 15:42:35 +10:00
Rhodri Karim
7a07e8fa16 Issue 1233: product filter should only match if name begins withs search term 2017-06-02 15:42:35 +10:00
enricostano
699da16049 Remove unused spec support method 2017-05-31 15:22:30 +10:00
130 changed files with 2819 additions and 288 deletions

View File

@@ -1,11 +1,8 @@
engines:
rubocop:
enabled: true
exclude_fingerprints:
- ac41db8d4ec4cbf508c353d9b65a024f
- 8e3b6322aef5be9f38700b3fd0cd347e
scss-lint:
enabled: true
enabled: false
ratings:
paths:
- app/**

View File

@@ -1,4 +1,9 @@
inherit_from:
- .rubocop_todo.yml
AllCops:
TargetRubyVersion: 2.1
TargetRailsVersion: 3.2
Include:
- '**/Rakefile'
- '**/config.ru'
@@ -6,24 +11,163 @@ AllCops:
- 'db/**/*'
- 'config/**/*'
- 'script/**/*'
- 'spec/**/*'
- !ruby/regexp /old_and_unused\.rb$/
Documentation:
# OFN SETTINGS
# Cop settings that have been agreed upon by the OFN community
Rails:
Enabled: true
Style/Documentation:
Enabled: false
Style/EmptyLinesAroundClassBody:
Style/StringLiterals:
Enabled: false
Style/BracesAroundHashParameters:
# TEMPORARY/CONTESTED SETTINGS
# These are still to be decided upon, but recommended for inclusion by
# oeoeaio after scrutinising offenses the codebase
# Don't think this is a big issue, mostly picking up RPSEC scope definitions
# with lamdas and RSpec '.to change{}' blocks
Lint/AmbiguousBlockAssociation:
Enabled: false
# Heaps of offences (> 100) in specs, mostly in situations where two or more
# instances of a model are required, but only one is referenced. Difficult to
# fix without making the spec look messy or rewriting it.
# Should definitely fix at some point.
Lint/UselessAssignment:
Exclude:
- spec/**/*
# AFAIK, there is no good alternative to dynamic matchers until we upgrade
# to Rails 4 and can use #find_by. If there is a better approach, let's do it.
Rails/DynamicFindBy:
Enabled: false
# This should be the programmer's discretion, perhaps we should review all of
# the uses of it an make specific exceptions though.
Rails/SkipsModelValidations:
Enabled: false
# Relaxed.Ruby.Style SETTINGS
# These styles are a starting point for the conversation around conventions
# They should be removed or tweaked and moved above as decisions are made
# NOTE: Cops which did not fail at the time of writing were removed
Layout/DotPosition:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styledotposition
Layout/SpaceBeforeBlockBraces:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylespacebeforeblockbraces
Layout/SpaceInsideParens:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylespaceinsideparens
Style/Alias:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylealias
Style/BlockDelimiters:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleblockdelimiters
Style/CommentAnnotation:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylecommentannotation
Style/DoubleNegation:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styledoublenegation
Style/FormatString:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleformatstring
Style/IfUnlessModifier:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleifunlessmodifier
Style/Lambda:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylelambda
Style/MultilineBlockChain:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylemultilineblockchain
Style/NegatedIf:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylenegatedif
Style/NegatedWhile:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylenegatedwhile
Style/ParallelAssignment:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styleparallelassignment
Style/PercentLiteralDelimiters:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylepercentliteraldelimiters
Style/Semicolon:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylesemicolon
Style/SingleLineMethods:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylesinglelinemethods
Style/TrailingCommaInArguments:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styletrailingcommainarguments
Style/TrailingCommaInLiteral:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#styletrailingcommainliteral
Style/WordArray:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#stylewordarray
Lint/AmbiguousRegexpLiteral:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#lintambiguousregexpliteral
Lint/AssignmentInCondition:
Enabled: false
StyleGuide: http://relaxed.ruby.style/#lintassignmentincondition
Metrics/AbcSize:
Enabled: false
Metrics/BlockNesting:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/LineLength:
Enabled: false
Max: 120
MethodLength:
Metrics/MethodLength:
Enabled: false
StringLiterals:
Metrics/ParameterLists:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false

2187
.rubocop_todo.yml Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -129,4 +129,5 @@ group :development do
gem 'guard-zeus'
gem 'guard-rspec'
gem 'parallel_tests'
gem 'rubocop', '>= 0.49.1'
end

View File

@@ -165,6 +165,7 @@ GEM
angularjs-rails (1.5.5)
ansi (1.4.2)
arel (3.0.3)
ast (2.3.0)
atomic (1.1.99)
awesome_nested_set (2.1.5)
activerecord (>= 3.0.0)
@@ -477,9 +478,11 @@ GEM
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
parallel (1.4.1)
parallel_tests (1.3.7)
parallel (1.11.2)
parallel_tests (2.14.1)
parallel
parser (2.4.0.0)
ast (~> 2.2)
paypal-sdk-core (0.2.10)
multi_json (~> 1.0)
xml-simple
@@ -494,6 +497,7 @@ GEM
polyamorous (0.5.0)
activerecord (~> 3.0)
polyglot (0.3.5)
powerpack (0.1.1)
pry (0.9.12.2)
coderay (~> 1.0.5)
method_source (~> 0.8)
@@ -531,8 +535,10 @@ GEM
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rainbow (2.2.2)
rake
raindrops (0.13.0)
rake (11.1.2)
rake (11.3.0)
ransack (0.7.2)
actionpack (~> 3.0)
activerecord (~> 3.0)
@@ -578,7 +584,14 @@ GEM
rspec-mocks (~> 2.14.0)
rspec-retry (0.4.2)
rspec-core
ruby-progressbar (1.7.1)
rubocop (0.49.1)
parallel (~> 1.10)
parser (>= 2.3.3.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)
rubyzip (1.2.0)
safe_yaml (0.9.5)
sass (3.3.14)
@@ -620,6 +633,7 @@ GEM
uglifier (2.7.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
unicode-display_width (1.3.0)
unicorn (4.9.0)
kgio (~> 2.6)
rack
@@ -723,6 +737,7 @@ DEPENDENCIES
roo (~> 2.7.0)
rspec-rails
rspec-retry
rubocop (>= 0.49.1)
sass (~> 3.3)
sass-rails (~> 3.2.3)
shoulda-matchers
@@ -749,4 +764,4 @@ RUBY VERSION
ruby 2.1.5p273
BUNDLED WITH
1.14.3
1.15.1

View File

@@ -47,4 +47,3 @@ end
#watch(%r{^spec/acceptance/(.+)\.feature$})
#watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
#end

View File

@@ -5,7 +5,20 @@ Darkswarm.controller "RegistrationCtrl", ($scope, RegistrationService, Enterpris
$scope.steps = ['details', 'contact', 'type', 'about', 'images', 'social']
$scope.countries = availableCountries
# Filter countries without states since the form requires a state to be selected.
# Consider changing the form to require a state only if a country requires them (Spree option).
# Invalid countries still need to be filtered (better server-side).
$scope.countries = availableCountries.filter (country) ->
country.states.length > 0
$scope.countriesById = $scope.countries.reduce (obj, country) ->
obj[country.id] = country
obj
, {}
$scope.setDefaultCountry = (id) ->
country = $scope.countriesById[id]
$scope.enterprise.country = country if country
$scope.countryHasStates = ->
$scope.enterprise.country.states.length > 0

View File

@@ -5,4 +5,4 @@ Darkswarm.filter 'products', (Matcher) ->
return products if text == ""
products.filter (product) =>
propertiesToMatch = [product.name, product.variant_names, product.supplier.name, product.primary_taxon.name]
Matcher.match propertiesToMatch, text
Matcher.matchBeginning propertiesToMatch, text

View File

@@ -25,9 +25,7 @@ Darkswarm.factory "AuthenticationService", (Navigation, $modal, $location, Redir
isActive: Navigation.isActive
close: ->
if location.pathname in ["/", "/checkout"]
Navigation.navigate "/"
else
if location.pathname in ["/register", "/register/auth"]
Loading.message = t 'going_back_to_home_page'
location.hash = ""
location.pathname = "/"

View File

@@ -1,7 +1,14 @@
Darkswarm.factory "Matcher", ->
# Match text fragment in an array of strings.
new class Matcher
# Match text fragment in an array of strings.
match: (properties, text)->
properties.some (prop)->
prop ||= ""
prop.toLowerCase().indexOf(text.toLowerCase()) != -1
# Return true if text occurs at the beginning of any word present in an array of strings
matchBeginning: (properties, text) ->
text = text.trim()
regexp = new RegExp("(?:^|[\\s-])#{text}", "i")
properties.some (prop) -> (prop || "").search(regexp) >= 0

View File

@@ -42,9 +42,10 @@ Darkswarm.factory 'Products', ($resource, Enterprises, Dereferencer, Taxons, Pro
registerVariants: ->
for product in @products
if product.variants
product.variant_names = ""
product.variants = for variant in product.variants
variant = Variants.register variant
if product.name != variant.name_to_display
product.variant_names += variant.name_to_display
product.variant_names += variant.name_to_display + " "
variant.product = product
variant

View File

@@ -117,6 +117,13 @@ nav {
padding: 9px 0 0 9px;
}
.top-bar .ofn-logo img {
height: auto;
width: auto;
max-height: 51px;
max-width: 250px;
}
.left-off-canvas-menu {
background-color: white;
}

View File

@@ -32,6 +32,11 @@
color: $clr-turquoise;
}
.vertical-align-middle {
display: flex;
align-items: center;
}
a {
&:hover, &:active, &:focus {
color: $clr-turquoise-bright;

View File

@@ -52,7 +52,6 @@ module Admin
@owner_email = @enterprise_group.andand.owner.andand.email || ""
end
def collection
EnterpriseGroup.by_position
end

View File

@@ -115,7 +115,7 @@ module Admin
end
def collection_actions
[:index]
[:index, :bulk_update]
end
private
@@ -179,9 +179,5 @@ module Admin
def ams_prefix_whitelist
[:basic]
end
def collection_actions
[:index, :bulk_update]
end
end
end

View File

@@ -59,4 +59,4 @@ class Admin::ProductImportController < Spree::Admin::BaseController
def model_class
ProductImporter
end
end
end

View File

@@ -4,7 +4,6 @@ module Admin
"#{controller_name.classify}".constantize
end
# URL helpers
def new_object_url(options = {})
if parent_data.present?

View File

@@ -12,7 +12,6 @@ module Admin
def index
end
def bulk_update
# Ensure we're authorised to update all variant overrides
@vo_set.collection.each { |vo| authorize! :update, vo }

View File

@@ -24,7 +24,6 @@ class ApplicationController < ActionController::Base
params[:action].to_sym
end
def require_distributor_chosen
unless @distributor = current_distributor
redirect_to spree.root_path
@@ -62,7 +61,6 @@ class ApplicationController < ActionController::Base
end
end
# All render calls within the block will be performed with the specified format
# Useful for rendering html within a JSON response, particularly if the specified
# template or partial then goes on to render further partials without specifying

View File

@@ -123,7 +123,6 @@ class CheckoutController < Spree::CheckoutController
false
end
def update_failed
clear_ship_address
respond_to do |format|
@@ -168,8 +167,8 @@ class CheckoutController < Spree::CheckoutController
customer_preferred_bill_address, customer_preferred_ship_address = @order.customer.bill_address, @order.customer.ship_address if @order.customer
@order.bill_address ||= customer_preferred_bill_address ||= preferred_bill_address || last_used_bill_address || Spree::Address.default
@order.ship_address ||= customer_preferred_ship_address ||= preferred_ship_address || last_used_ship_address || Spree::Address.default
@order.bill_address ||= customer_preferred_bill_address || preferred_bill_address || last_used_bill_address || Spree::Address.default
@order.ship_address ||= customer_preferred_ship_address || preferred_ship_address || last_used_ship_address || Spree::Address.default
end
def after_payment

View File

@@ -30,7 +30,6 @@ class DiscourseSsoController < ApplicationController
def sso_url
secret = discourse_sso_secret!
discourse_url = discourse_url!
sso = Discourse::SingleSignOn.parse(request.query_string, secret)
sso.email = spree_current_user.email
sso.username = spree_current_user.login

View File

@@ -28,7 +28,6 @@ module Spree
end
end
def set_included_tax
if params[:tax_rate_id].present?
tax_rate = TaxRate.find params[:tax_rate_id]

View File

@@ -101,7 +101,6 @@ Spree::Admin::ReportsController.class_eval do
# -- Build Report with Order Grouper
@report = OpenFoodNetwork::OrderCycleManagementReport.new spree_current_user, params
@table = @report.table_items
csv_file_name = "#{params[:report_type]}_#{timestamp}.csv"
render_report(@report.header, @table, params[:csv], "order_cycle_management_#{timestamp}.csv")
end
@@ -126,7 +125,6 @@ Spree::Admin::ReportsController.class_eval do
@report = OpenFoodNetwork::PackingReport.new spree_current_user, params
order_grouper = OpenFoodNetwork::OrderGrouper.new @report.rules, @report.columns
@table = order_grouper.table(@report.table_items)
csv_file_name = "#{params[:report_type]}_#{timestamp}.csv"
render_report(@report.header, @table, params[:csv], "packing_#{timestamp}.csv")
end
@@ -273,7 +271,6 @@ Spree::Admin::ReportsController.class_eval do
render_report(@report.header, @report.table, params[:csv], "xero_invoices_#{timestamp}.csv")
end
def render_report(header, table, create_csv, csv_file_name)
unless create_csv
render :html => table

View File

@@ -31,7 +31,6 @@ Spree::OrdersController.class_eval do
end
end
def update
@insufficient_stock_lines = []
@order = order_to_update
@@ -71,7 +70,6 @@ Spree::OrdersController.class_eval do
end
end
def populate
# Without intervention, the Spree::Adjustment#update_adjustable callback is called many times
# during cart population, for both taxation and enterprise fees. This operation triggers a
@@ -99,7 +97,6 @@ Spree::OrdersController.class_eval do
end
end
# Report the stock levels in the order for all variant ids requested
def stock_levels(order, variant_ids)
stock_levels = li_stock_levels(order)

View File

@@ -5,12 +5,12 @@ module Admin
end
def admin_image_settings_geometry_from_style(style)
geometry, format = admin_image_settings_split_style style
geometry, _format = admin_image_settings_split_style style
geometry
end
def admin_image_settings_format_from_style(style)
geometry, format = admin_image_settings_split_style style
_geometry, format = admin_image_settings_split_style style
format
end

View File

@@ -11,7 +11,6 @@ module ApplicationHelper
form_for(name, *(args << options.merge(:builder => AngularFormBuilder)), &block)
end
# Pass URL helper calls on to spree where applicable so that we don't need to use
# spree.foo_path in any view rendered from non-spree-namespaced controllers.
def method_missing(method, *args, &block)

View File

@@ -80,7 +80,6 @@ module CheckoutHelper
available_countries.map { |c| [c.name, c.id] }
end
def validated_input(name, path, args = {})
attributes = {
required: true,

View File

@@ -43,7 +43,6 @@ module OrderCyclesHelper
end
end
def order_cycle_options
@order_cycles.
with_distributor(current_distributor).

View File

@@ -6,17 +6,14 @@ module Spree
"(#{Spree::Money.new(variant.price).to_s})"
end
def product_has_variant_unit_option_type?(product)
product.option_types.any? { |option_type| variant_unit_option_type? option_type }
end
def variant_unit_option_type?(option_type)
Spree::Product.all_variant_unit_option_types.include? option_type
end
def product_variant_unit_options
[['Weight', 'weight'],
['Volume', 'volume'],

View File

@@ -37,7 +37,7 @@ class UpdateAccountInvoices
if billable_periods.any?
oldest_enterprise = billable_periods.first.enterprise
address = oldest_enterprise.address.dup
first, space, last = (oldest_enterprise.contact || "").partition(' ')
first, _space, last = (oldest_enterprise.contact || "").partition(' ')
address.update_attributes(phone: oldest_enterprise.phone) if oldest_enterprise.phone.present?
address.update_attributes(firstname: first, lastname: last) if first.present? && last.present?
account_invoice.order.update_attributes(bill_address: address, ship_address: address)

View File

@@ -12,7 +12,6 @@ Spree::BaseMailer.class_eval do
'test@example.com'
end
def roadie_options
# This lets us specify assets using relative paths in email templates
super.merge(url_options: {host: URI(spree.root_url).host })

View File

@@ -3,8 +3,6 @@ class Cart < ActiveRecord::Base
belongs_to :user, :class_name => Spree.user_class
def add_variant variant_id, quantity, distributor, order_cycle, currency
variant = Spree::Variant.find(variant_id)
order = create_or_find_order_for_distributor distributor, order_cycle, currency
@populator = Spree::OrderPopulator.new(order, currency)

View File

@@ -61,7 +61,6 @@ class EnterpriseRelationship < ActiveRecord::Base
relatives
end
def permissions_list=(perms)
if perms.nil?
permissions.destroy_all

View File

@@ -36,8 +36,8 @@ class ModelSet
end
def save
collection_to_delete.each &:destroy
collection_to_keep.all? &:save
collection_to_delete.each(&:destroy)
collection_to_keep.all?(&:save)
end
def collection_to_delete

View File

@@ -115,7 +115,6 @@ class OrderCycle < ActiveRecord::Base
]
end
def clone!
oc = self.dup
oc.name = "COPY OF #{oc.name}"

View File

@@ -240,7 +240,6 @@ class AbilityDecorator
can [:admin, :index, :update, :destroy], Customer, enterprise_id: Enterprise.managed_by(user).pluck(:id)
end
def add_relationship_management_abilities(user)
can [:admin, :index, :create], EnterpriseRelationship
can [:destroy], EnterpriseRelationship do |enterprise_relationship|

View File

@@ -61,7 +61,6 @@ module Spree
[Spree::TaxRate.order("ABS(amount - #{approximation})").first]
end
def self.without_callbacks
skip_callback :save, :after, :update_adjustable
skip_callback :destroy, :after, :update_adjustable

View File

@@ -47,7 +47,6 @@ Spree::LineItem.class_eval do
update_attributes!(quantity: variant.on_hand) if quantity > variant.on_hand
end
def has_tax?
adjustments.included_tax.any?
end

View File

@@ -7,7 +7,7 @@ module Spree
private
def refresh_products_cache
products(:reload).each &:refresh_products_cache
products(:reload).each(&:refresh_products_cache)
end
end
end

View File

@@ -7,13 +7,13 @@ module Spree
private
def refresh_products_cache
variants(:reload).each &:refresh_products_cache
variants(:reload).each(&:refresh_products_cache)
end
def refresh_products_cache_from_destroy
vs = variants(:reload).to_a
yield
vs.each &:refresh_products_cache
vs.each(&:refresh_products_cache)
end
end

View File

@@ -161,10 +161,9 @@ Spree::Order.class_eval do
end
def cap_quantity_at_stock!
line_items.each &:cap_quantity_at_stock!
line_items.each(&:cap_quantity_at_stock!)
end
def set_distributor!(distributor)
self.distributor = distributor
self.order_cycle = nil unless self.order_cycle.andand.has_distributor? distributor

View File

@@ -82,7 +82,6 @@ Spree::OrderPopulator.class_eval do
[quantity_to_add, max_quantity_to_add]
end
def cart_remove(variant_id)
variant = Spree::Variant.find(variant_id)
@order.remove_variant(variant)

View File

@@ -21,7 +21,7 @@ module Spree
def enterprise
enterprise_id = key.match(product_selection_from_inventory_only_regex)[1]
enterprise = Enterprise.find enterprise_id
Enterprise.find(enterprise_id)
end
def product_selection_from_inventory_only_regex

View File

@@ -13,7 +13,6 @@ module Spree::Preferences
end
end
def get_preference(key)
if !has_preference?(key) && has_attachment?(key)
send key
@@ -32,7 +31,6 @@ module Spree::Preferences
end
end
# Spree's Configuration responds to preference methods via method_missing, but doesn't
# override respond_to?, which consequently reports those methods as unavailable. Paperclip
# errors if respond_to? isn't correct, so we override it here.
@@ -41,7 +39,6 @@ module Spree::Preferences
super(self.class.preference_getter_method(name), include_all) || super(method, include_all)
end
def has_attachment?(name)
self.class.respond_to?(:attachment_definitions) &&
self.class.attachment_definitions.keys.include?(name.to_sym)

View File

@@ -216,7 +216,7 @@ Spree::Product.class_eval do
if variant_unit_changed?
option_types.delete self.class.all_variant_unit_option_types
option_types << variant_unit_option_type if variant_unit.present?
variants_including_master.each &:update_units
variants_including_master.each(&:update_units)
end
end

View File

@@ -4,7 +4,7 @@ Spree::ProductOptionType.class_eval do
def remove_option_values
self.product.variants_including_master.each do |variant|
option_values = variant.option_values.where(option_type_id: self.option_type)
variant.option_values.destroy *option_values
variant.option_values.destroy(*option_values)
end
end
end

View File

@@ -30,7 +30,7 @@ module Spree
private
def refresh_products_cache
product_properties(:reload).each &:refresh_products_cache
product_properties(:reload).each(&:refresh_products_cache)
end
end
end

View File

@@ -42,7 +42,6 @@ Spree::ShippingMethod.class_eval do
]
end
def available_to_order_with_distributor_check?(order, display_on=nil)
available_to_order_without_distributor_check?(order, display_on) &&
self.distributors.include?(order.distributor)

View File

@@ -57,6 +57,6 @@ Spree::Taxon.class_eval do
private
def refresh_products_cache
products(:reload).each &:refresh_products_cache
products(:reload).each(&:refresh_products_cache)
end
end

View File

@@ -70,7 +70,6 @@ Spree::Variant.class_eval do
]
end
def price_with_fees(distributor, order_cycle)
price + fees_for(distributor, order_cycle)
end

View File

@@ -45,7 +45,6 @@ class VariantOverride < ActiveRecord::Base
end
end
def stock_overridden?
count_on_hand.present?
end

View File

@@ -2,4 +2,4 @@ Deface::Override.new(:virtual_path => "spree/products/show",
:insert_after => "[data-hook='product_show']",
:text => "<%= javascript_include_tag main_app.distributors_enterprises_path(:format => :js) %>",
:name => "add_distributor_details_js_to_product",
:original => 'b05ac497efeeebd4464f29891fd2c4a0f60c24d9')
:original => 'b05ac497efeeebd4464f29891fd2c4a0f60c24d9')

View File

@@ -2,4 +2,4 @@ Deface::Override.new(:virtual_path => "spree/admin/products/_form",
:insert_top => "[data-hook='admin_product_form_right']",
:partial => "spree/admin/products/group_buy_form",
:name => "add_group_buy_to_admin_product_edit",
:original => '0c0e8d714989e48ee246a8253fb2b362f108621a')
:original => '0c0e8d714989e48ee246a8253fb2b362f108621a')

View File

@@ -1,4 +1,4 @@
Deface::Override.new(:virtual_path => "spree/admin/orders/index",
:name => "add_orders_admin_sub_menu",
:insert_before => "code[erb-silent]:contains('content_for :table_filter_title do')",
:text => "<%= render :partial => 'spree/admin/shared/order_sub_menu' %>")
:text => "<%= render :partial => 'spree/admin/shared/order_sub_menu' %>")

View File

@@ -1,3 +1,3 @@
Deface::Override.new(:virtual_path => "spree/shared/_nav_bar",
:remove => "#search-bar",
:name => "search_removal")
:name => "search_removal")

View File

@@ -1,4 +1,3 @@
Deface::Override.new(:virtual_path => "spree/shared/_sidebar",
:remove => "#sidebar",
:name => "sidebar_removal")

View File

@@ -2,4 +2,4 @@ Deface::Override.new(:virtual_path => "spree/shared/_order_details",
:replace => "div.row.steps-data",
:partial => "spree/shared/order_details_steps_data",
:name => "replace_order_details_steps_data",
:original => '1a68aa5db3fee7f7bbb2b6b826749aeb69168cee')
:original => '1a68aa5db3fee7f7bbb2b6b826749aeb69168cee')

View File

@@ -2,4 +2,4 @@ Deface::Override.new(:virtual_path => "spree/payments/_payment",
:replace => "code[erb-loud]:contains('content_tag(:span, payment.payment_method.name)')",
:text => "<%= content_tag( :span, ( payment.payment_method.description || payment.payment_method.name ).html_safe ) %>",
:name => "replace_payment_name_with_description",
:original => 'dff62efcadc0f9e6513b0f81a51ebbda035f78f6')
:original => 'dff62efcadc0f9e6513b0f81a51ebbda035f78f6')

View File

@@ -2,4 +2,4 @@ Deface::Override.new(:virtual_path => "spree/layouts/admin",
:insert_bottom => "[data-hook='admin_inside_head']",
:partial => "layouts/auth_token_script",
:name => "set_auth_token_in_backend",
:original => '6bc2c5de1c8f7542d033548557437c9fe4b3ba02')
:original => '6bc2c5de1c8f7542d033548557437c9fe4b3ba02')

View File

@@ -2,4 +2,4 @@ Deface::Override.new(:virtual_path => "spree/layouts/spree_application",
:insert_bottom => "[data-hook='inside_head']",
:partial => "layouts/auth_token_script",
:name => "set_auth_token_in_frontend",
:original => '5659ac7dbf6ac6469907b005b85285b894677815')
:original => '5659ac7dbf6ac6469907b005b85285b894677815')

View File

@@ -1,3 +1,3 @@
class Api::Admin::IdNameSerializer < ActiveModel::Serializer
attributes :id, :name
end
end

View File

@@ -1,3 +1,3 @@
class Api::Admin::TaxonSerializer < ActiveModel::Serializer
attributes :id, :name, :pretty_name
end
end

View File

@@ -2,4 +2,4 @@ class Api::CountrySerializer < ActiveModel::Serializer
attributes :id, :name, :states
has_many :states, serializer: Api::StateSerializer
end
end

View File

@@ -1,3 +1,3 @@
class Api::IdSerializer < ActiveModel::Serializer
attributes :id
end
end

View File

@@ -56,7 +56,7 @@ class Api::CachedProductSerializer < ActiveModel::Serializer
#return a sanitized html description
def description_html
d = sanitize(object.description, options = {tags: "p, b, strong, em, i"})
d = sanitize(object.description, tags: "p, b, strong, em, i")
d.to_s.html_safe
end

View File

@@ -4,4 +4,4 @@ class Api::StateSerializer < ActiveModel::Serializer
def abbr
object.abbr.upcase
end
end
end

View File

@@ -1,3 +1,3 @@
object @enterprise
attributes :id, :name
attributes :id, :name

View File

@@ -10,4 +10,3 @@ if current_order
cart_count
end
end

View File

@@ -1,4 +1,3 @@
collection Enterprise.is_distributor.visible
extends 'json/partials/enterprise'
extends 'json/partials/hub'

View File

@@ -1,3 +1,3 @@
collection @line_items
extends "open_food_network/line_items/show"
extends "open_food_network/line_items/show"

View File

@@ -1,3 +1,3 @@
collection @orders
extends "open_food_network/orders/show"
extends "open_food_network/orders/show"

View File

@@ -4,4 +4,4 @@ attributes :id
node( :distributor ) { |p| p.distributor.blank? ? "" : p.distributor.name }
node( :line_items ) do |p|
partial '/open_food_network/line_items/index', object: p.line_items
end
end

View File

@@ -1,20 +1,24 @@
.row.active_table_row{"ng-click" => "toggle($event)", "ng-class" => "{'closed' : !open(), 'is_distributor' : producer.is_distributor}"}
.columns.small-12.medium-4.large-4.skinny-head
.columns.small-12.medium-8.large-8.skinny-head
%span{"ng-if" => "::producer.is_distributor" }
%a.is_distributor{"ng-href" => "{{::producer.path}}" }
%i{ng: {class: "::producer.producer_icon_font"}}
%span.margin-top
%strong{"ng-bind" => "::producer.name"}
%a.is_distributor{"ng-href" => "{{::producer.path}}"}
.row.vertical-align-middle
.columns.small-2.medium-2.large-2
%i{ng: {class: "::producer.producer_icon_font"}}
.columns.small-10.medium-10.large-10
%span.margin-top
%strong{"ng-bind" => "::producer.name"}
%span.producer-name{"ng-if" => "::!producer.is_distributor" }
%i{ng: {class: "::producer.producer_icon_font"}}
%span.margin-top
%strong{"ng-bind" => "::producer.name"}
.columns.small-6.medium-3.large-3
.row.vertical-align-middle
.columns.small-2.medium-2.large-2
%i{ng: {class: "::producer.producer_icon_font"}}
.columns.small-10.medium-10.large-10
%span.margin-top
%strong{"ng-bind" => "::producer.name"}
.columns.small-6.medium-2.large-2
%span.margin-top{"ng-bind" => "::producer.address.city"}
.columns.small-4.medium-3.large-4
.columns.small-4.medium-1.large-1
%span.margin-top{"ng-bind" => "::producer.address.state_name | uppercase"}
.columns.small-2.medium-2.large-1.text-right
.columns.small-2.medium-1.large-1.text-right
%span.margin-top
%i{"ng-class" => "{'ofn-i_005-caret-down' : !open(), 'ofn-i_006-caret-up' : open()}"}

View File

@@ -54,7 +54,7 @@
.small-12.medium-8.large-8.columns
.field
%label{ for: 'enterprise_country' } {{'registration_detail_country' | t}}
%select.chunky{ id: 'enterprise_country', name: 'country', required: true, ng: { model: 'enterprise.country', options: 'c as c.name for c in countries' } }
%select.chunky{ id: 'enterprise_country', name: 'country', required: true, ng: { init: "setDefaultCountry(#{Spree::Config[:default_country_id]})", model: 'enterprise.country', options: 'c as c.name for c in countries' } }
%span.error{ ng: { show: "details.country.$error.required && submitted" } }
{{'registration_detail_country_error' | t}}

View File

@@ -3,7 +3,7 @@
%ul.left
%li.ofn-logo
%a{href: root_path}
%img{src: ContentConfig.logo.url, width: "250", height: "51"}
%img{src: ContentConfig.logo.url}
%ul.center
%li
%a{href: main_app.shops_path}

View File

@@ -1,2 +1,2 @@
collection @products.order('id ASC')
extends "spree/api/products/bulk_show"
extends "spree/api/products/bulk_show"

View File

@@ -1,2 +1,2 @@
object false
node(:success) { "Use of API Authorised" }
node(:success) { "Use of API Authorised" }

View File

@@ -13,6 +13,45 @@
#
#
# See http://community.openfoodnetwork.org/t/localisation-ofn-in-your-language/397
#
# Changing this file
# ==================
#
# You are welcome to fix typos, add missing translations and remove unused ones.
# Here are some guidelines to make sure that this file is becoming more beautiful
# with every change we do.
#
# * Change text: No problem. Fix the typo. And please enclose the text in quotes
# to avoid any accidents.
#
# Example 1: "When you're using double quotes, they look like \"this\""
# Example 2: "When youre using double quotes, they look like “this”"
#
# The second example uses unicode to make it look prettier and avoid backslashes.
#
# * Add translations: Cool, every bit of text in the application should be here.
# If you add a translation for a view or mailer, please make use of the nested
# structure. Use the "lazy" lookup. See: http://guides.rubyonrails.org/i18n.html#looking-up-translations
#
# Avoid global keys. There are a lot already. And some are okay, for example
# "enterprises" should be the same everywhere on the page. But in doubt,
# create a new translation and give it a meaningful scope.
#
# Don't worry about duplication. We may use the same word in different contexts,
# but another language could use different words. So don't try to re-use
# translations between files.
#
# Don't move big parts around or rename scopes with a lot of entries without
# a really good reason. In some cases that causes a lot of translations in
# other languages to be lost. That causes more work for translators.
#
# * Remove translations: If you are sure that they are not used anywhere,
# please remove them. Be aware that some translations are looked up with
# variables. For example app/views/admin/contents/_fieldset.html.haml looks
# up labels for preferences. Unfortunately, they don't have a scope.
#
# * Participate in the community discussions:
# - https://community.openfoodnetwork.org/t/workflow-to-structure-translations/932
en:
activerecord:
@@ -21,6 +60,12 @@ en:
spree/order:
payment_state: Payment State
shipment_state: Shipment State
errors:
models:
spree/user:
attributes:
email:
taken: "There's already an account for this email. Please login or reset your password."
devise:
failure:
invalid: |

View File

@@ -2,8 +2,14 @@ es:
activerecord:
attributes:
spree/order:
payment_state: Estado de pago
payment_state: Estado del pago
shipment_state: Estado del envío
errors:
models:
spree/user:
attributes:
email:
taken: "Ya existe una cuenta con este email. Inicie sesión o restablezca tu contraseña."
devise:
failure:
invalid: |
@@ -24,7 +30,6 @@ es:
welcome_to: 'Bienvenido a '
site_meta_description: "Nosotros empezamos desde abajo. Con granjeros y productoras listas para contar sus historias con orgullo y autenticidad. Con distribuidoras listas para conectar gente con productos de forma justa y honesta. Con compradores que creen que mejores decisiones de compras semanales pueden..."
search_by_name: Buscar por nombre o barrio...
producers: 'Productoras Australianos'
producers_join: Las productoras australianas ahora son bienvenidas a unirse a Open Food Network.
charges_sales_tax: ¿Cargos de GST?
print_invoice: "Imprimir factura"
@@ -50,7 +55,7 @@ es:
say_no: "No"
say_yes: "Si"
then: Entonces
sort_order_cycles_on_shopfront_by: "Ciclos de Pedidos en Shopfront por"
sort_order_cycles_on_shopfront_by: "Ciclos de Pedidos en Tienda por"
required_fields: Los campos obligatorios se indican con un asterisco
select_continue: Selecciona y Continua
remove: Eliminar
@@ -62,6 +67,18 @@ es:
show_all: Mostrar todos
show_all_with_more: "Mostrar todo (%{num} Más)"
cancel: Cancelar
edit: Editar
distributors: Distribuidores
bulk_order_management: Gestión de pedidos en bloque
enterprise_groups: Grupos
reports: Informes
variant_overrides: Inventario
more: Más
spree_products: Productos Spree
all: Todos
current: Actual
available: Disponible
dashboard: Panel de inicio
admin:
date: Fecha
email: Email
@@ -79,11 +96,16 @@ es:
sku: número de referencia
tags: Etiquetas
variant: Variedad
weight: Peso
volume: Volumen
items: Artículos
quick_search: Búsqueda rápida
clear_all: Limpiar todo
start_date: "Fecha de inicio"
end_date: "Fecha de finalización"
form_invalid: "El formulario contiene campos vacíos o inválidos"
clear_filters: Limpiar filtros
clear: Limpiar
columns: Columnas
actions: Acciones
viewing: "Viendo: %{current_view_name}"
@@ -160,6 +182,7 @@ es:
edit: 'Editar'
update_address: 'Actualizar Dirección'
confirm_delete: '¿Confirmas que quieres borrar?'
search_by_email: "Buscar por email/código"
cache_settings:
show:
title: Almacenando
@@ -172,7 +195,7 @@ es:
title: Contenido
enterprise_fees:
index:
title: Comisiones de la Organicación
title: Comisiones de la Organización
enterprise: Organización
fee_type: Tipo de Comisión
name: Nombre
@@ -183,6 +206,7 @@ es:
index:
new_button: Nuevo Grupo de Organizaciones
products:
unit_name_placeholder: 'ej. manojos'
bulk_edit:
unit: Unidad
display_as: Mostrar como
@@ -246,7 +270,7 @@ es:
title: Organizaciones
new_enterprise: Nueva Organización
producer?: "Productora?"
package: Paquete
package: Perfil
status: Estado
manage: Gestionar
form:
@@ -260,6 +284,8 @@ es:
abn_placeholder: ej. 99 123 456 789
acn: ACN
acn_placeholder: ej. 123 456 789
display_invoice_logo: Mostrar logo en facturas
invoice_text: Añadir texto personalizado al final de las facturas
contact:
name: Nombre
name_placeholder: ej. Gustav Plum
@@ -333,19 +359,27 @@ es:
shopfront_requires_login_tip: "Elije si los clientes deben iniciar sesión para ver la tienda o si es visible para todos."
shopfront_requires_login_false: "Público"
shopfront_requires_login_true: "Visible solo para consumidores registrados"
recommend_require_login: "Recomendamos requerir a los usuarios que accedan cuando sus pedidos puedan cambiar."
allow_guest_orders: "Pedidos de invitados"
allow_guest_orders_tip: "Permitir la compra como invitado o solo permitir usuarios registrados."
allow_guest_orders_tip: "Permitir pedidos como invitado o solo como usuarios registrados."
allow_guest_orders_false: "Se necesita hacer login para realizar un pedido"
allow_guest_orders_true: "Permitir pedido de un invitado"
allow_guest_orders_true: "Permitir pedidos a invitados"
allow_order_changes: "Cambiar pedidos"
allow_order_changes_tip: "Permitir a los clientes cambiar sus pedidos mientras que el ciclo de pedido siga abierto."
allow_order_changes_false: "Los pedidos efectuados no pueden ser cambiados / cancelados"
allow_order_changes_true: "Los clientes pueden cambiar / cancelar pedidos mientras el ciclo de pedido está abierto"
shopfront_message: Mensaje de la Tienda
shopfront_message_placeholder: >
Una explicación opcional para los consumidores que detallan cómo funciona
su tienda, que se mostrará por encima de la lista de productos en su
página de tienda.
shopfront_closed_message: Mensaje de tienda cerrada
shopfront_closed_message_placeholder: >
Un mensaje que proporciona una explicación más detallada sobre por qué
tu tienda está cerrada y/o cuándo se abrirá de nuevo. Esto se muestra
en tu tienda sólo cuando no tienes ciclos de pedidos activos (p.e. la
tienda está cerrada).
shopfront_category_ordering: Orden de las categorías de la tienda
open_date: Fecha de Inicio
close_date: Fecha de Finalización
social:
@@ -485,12 +519,20 @@ es:
title: Configuración de Factura
invoice_style2?: Utiliza el modelo de factura alternativo que incluye el desglose fiscal total por tipo de interés y tasa de impuestos por artículo (todavía no es adecuado para países que muestran los precios sin impuestos)
enable_receipt_printing?: ¿Mostrar opciones para imprimir recibos usando impresoras térmicas en el desplegable del pedido?
checkout:
already_ordered:
cart: "carrito"
message_html: "Ya realizó un pedido para este ciclo de pedido. Compruebe el %{cart}para ver los artículos que pidió. También puede cancelar artículos mientras el ciclo de pedido siga abierto."
home:
hubs:
show_closed_shops: "Mostrar tiendas cerradas"
hide_closed_shops: "Ocultar tiendas cerradas"
show_on_map: "Mostrar todo en el mapa"
shared:
menu:
cart:
checkout: "Validar ahora"
already_ordered_products: "Ya realizó un pedido en este ciclo de pedido"
register_call:
selling_on_ofn: "¿Estás interesada en entrar en Open Food Network?"
register: "Regístrate aquí"
@@ -560,6 +602,7 @@ es:
terms_of_service: "Términos de servicio"
on_demand: Bajo demanda
none: Ninguno
not_allowed: No permitido
label_shops: "Tiendas"
label_map: "Mapa"
label_producers: "Productoras"
@@ -580,21 +623,12 @@ es:
items: "artículos"
cart_headline: "Su carrito de compras"
total: "Total"
checkout: "Revisar el carrito de compras"
cart_updating: "Actualizando el carrito..."
cart_empty: "Carrito vacío"
cart_edit: "Editar carrito"
card_number: Número de tarjeta
card_securitycode: "Código de seguridad"
card_expiry_date: Fecha de expiración
ofn_cart_headline: "Tarjeta actual para:"
ofn_cart_distributor: "Distribuidor:"
ofn_cart_oc: "Ciclo de pedido:"
ofn_cart_from: "De:"
ofn_cart_to: "Para:"
ofn_cart_product: "Producto:"
ofn_cart_quantitiy: "Cantidad:"
ofn_cart_send: "Comprar me"
ie_warning_headline: "Su navegador está desactualizado :-("
ie_warning_text: "Para la mejor esperiencia de Open Food Network, recomendamos actualizar su navegador:"
ie_warning_chrome: Descargar Chrome
@@ -649,13 +683,13 @@ es:
stats_shops: "tiendas"
stats_shoppers: "consumidoras"
stats_orders: "pedidos"
checkout_title: Revisar el carrito
checkout_now: Revisare el carrito ahora
checkout_title: Validar el carrito
checkout_now: Validar el carrito ahora
checkout_order_ready: Pedido preparado para
checkout_hide: Esconder
checkout_expand: Expandir
checkout_headline: "Esta bien, ¿listo para pagar?"
checkout_as_guest: "Pagar como invitado"
checkout_headline: "Esta bien, ¿listo para realizar el pedido?"
checkout_as_guest: "Hacer pedido como invitado"
checkout_details: "Sus detalles"
checkout_billing: "Información de cobro"
checkout_default_bill_address: "Guardar como dirección de facturación por defecto"
@@ -679,6 +713,7 @@ es:
order_billing_address: Dirección de cobro
order_delivery_on: Entregar en
order_delivery_address: Dirección de entrega
order_delivery_time: Tiempo de entrega
order_special_instructions: "Sus notas:"
order_pickup_time: Listo para la recolección
order_pickup_instructions: Instrucciones de recolección
@@ -687,6 +722,8 @@ es:
order_includes_tax: (incluye impuesto)
order_payment_paypal_successful: Su pago a través de PayPal ha sido procesado con éxito.
order_hub_info: Información del Grupo
order_back_to_store: Volver a la Tienda
order_back_to_cart: Volver al Carrito
bom_tip: "Usa esta página para alterar la cantidad del producto en varios pedidos a la vez. Los productos pueden ser eliminados de los pedidos si es necesario. "
unsaved_changes_warning: "Hay cambios no guardados, se perderán si continúas."
unsaved_changes_error: "Los campos con bordes rojos contienen errores."
@@ -778,6 +815,10 @@ es:
hubs_intro: Comprar en su área local
hubs_distance: Más cercano a
hubs_distance_filter: "Mustreme tiendas cerca de %{location}"
shop_changeable_orders_alert_html:
one: Su pedido con <a href='%{path}' target='_blank'> %{shop} / %{order} </a> está abierto para revisión. Puede realizar cambios hasta %{oc_close}.
other: 'Usted tiene <a href=''%{path}'' target=''_blank''> %{count} órdenes con %{shop} </a> actualmente abierto para revisión. Puede realizar cambios hasta %{oc_close}. '
orders_changeable_orders_alert_html: Este pedido ha sido confirmado, pero puede realizar cambios hasta <strong>%{oc_close}</strong>.
products_clear_all: Limpiar todo
products_showing: "Mostrando:"
products_with: con
@@ -793,7 +834,7 @@ es:
products_update_error_data: "Error al guardar datos no válidos:"
products_changes_saved: "Cambios guardados."
search_no_results_html: "Lo sentimos, no hay resultados para %{query}. ¿Intentar otra búsqueda?"
components_profiles_popover: "Los perfiles no tienen escaparate en Open Food Network, pero pueden tener su propia tienda física o en línea en otro lugar"
components_profiles_popover: "Los perfiles no tienen una tienda en Open Food Network, pero pueden tener su propia tienda física o en línea en otro lugar"
components_profiles_show: "Mostrar perfiles"
components_filters_nofilters: "Sin filtros"
components_filters_clearfilters: "Limpiar todos los filtros"
@@ -904,10 +945,10 @@ es:
orders_edit_headline: Su carrito de compras
orders_edit_time: Pedido listo para
orders_edit_continue: Continuar comprando
orders_edit_checkout: Revisar
orders_edit_checkout: Validar
orders_form_empty_cart: "Vaciar carrito"
orders_form_subtotal: Subtotal de productos
orders_form_admin: Administración y gestión
orders_form_admin: Administrar y Gestionar
orders_form_total: Total
orders_oc_expired_headline: Los pedidos están cerrados para este ciclo
orders_oc_expired_text: "Lo sentimos, ¡los pedidos para este ciclo cerraron hace %{time}! Contacta con tu grupo de consumo directamente para ver si pueden aceptar pedidos tardíos."
@@ -917,7 +958,18 @@ es:
orders_oc_expired_phone: "Teléfono:"
orders_show_title: Confirmación del pedido
orders_show_time: Pedido listo en
orders_show_number: Confirmación del pedido
orders_show_order_number: "Pedido #%{number}"
orders_show_cancelled: Cancelado
orders_show_confirmed: Confirmado
orders_your_order_has_been_cancelled: "Su pedido ha sido cancelado"
orders_could_not_cancel: "Lo sentimos, no se pudo cancelar el pedido"
orders_cannot_remove_the_final_item: "No se puede quitar el último artículo de un pedido, en su lugar, por favor cancele el pedido."
orders_bought_items_notice:
one: Un elemento adicional ya está confirmado para este ciclo de pedido
other: '%{count} artículos adicionales ya confirmados para este ciclo de pedido'
orders_bought_edit_button: Editar artículos confirmados
orders_bought_already_confirmed: "* ya confirmados"
orders_confirm_cancel: Seguro que desea cancelar este pedido?
products_cart_distributor_choice: "Distribuidora para tu pedido:"
products_cart_distributor_change: "Su distribuidora para este pedido se cambiará a %{name} si agregas este producto al carrito."
products_cart_distributor_is: "Tu distribuidora para este pedido es %{name}."
@@ -1018,6 +1070,7 @@ es:
enterprise_long_desc: "Descripción larga"
enterprise_long_desc_placeholder: "Esta es tu oportunidad de contar la historia de tu organización - ¿qué la hace diferente? Sugerimos mantener la descripción en menos de 600 caracteres o 150 palabras."
enterprise_long_desc_length: "%{num} caracteres / recomentdamos hasta 600"
enterprise_limit: Límite de la Organización
enterprise_abn: "ABN"
enterprise_abn_placeholder: "eg. 99 123 456 789"
enterprise_acn: "ACN"
@@ -1117,7 +1170,7 @@ es:
running_balance: "Saldo actual"
outstanding_balance: "Saldo extraordinario"
admin_entreprise_relationships: "Relaciones de la Organización"
admin_entreprise_relationships_everything: "Todo"
admin_entreprise_relationships_everything: "Marcar todos"
admin_entreprise_relationships_permits: "Permisos"
admin_entreprise_relationships_seach_placeholder: "Buscar"
admin_entreprise_relationships_button_create: "Crear"
@@ -1153,6 +1206,7 @@ es:
calculator_values: "Calculadora de valores"
flat_percent_per_item: "Porcentaje fijo (por artículo)"
new_order_cycles: "Nuevos Ciclos de Pedidos"
new_order_cycle: "Nuevo Ciclo de Pedido"
select_a_coordinator_for_your_order_cycle: "Selecciona un coordinador para vuestro ciclo de pedido"
edit_order_cycle: "Editar Ciclo de Pedido"
roles: "Roles"
@@ -1173,6 +1227,7 @@ es:
price: "Precio"
on_hand: "Disponibles"
save_changes: "Guardar Cambios"
order_saved: "Pedido Guardado"
spree_admin_overview_enterprises_header: "Mis Organizaciones"
spree_admin_overview_enterprises_footer: "GESTIONAR MIS ORGANIZACIONES"
spree_admin_enterprises_hubs_name: "Nombre"
@@ -1199,7 +1254,7 @@ es:
spree_admin_single_enterprise_alert_mail_sent: "Te hemos enviado un mail a"
spree_admin_overview_action_required: "Acción Requerida"
spree_admin_overview_check_your_inbox: "Revisa tu bandeja de entrada para las siguientes instrucciones. Gracias!"
change_package: "Cambiar paquete"
change_package: "Cambiar Perfil"
spree_admin_single_enterprise_hint: "Sugerencia: Para permitir que la gente te encuentre, activa tu visibilidad"
your_profil_live: "Tu perfil en directo"
on_ofn_map: "en el mapa Open Food Network"
@@ -1214,6 +1269,8 @@ es:
edit_profile_details: "Editar detalles del perfil"
edit_profile_details_etc: "Cambia tu descripción, imágenes, etc."
order_cycle: "Ciclo de Pedido"
order_cycles: "Ciclos de Pedidos"
enterprises: "Empresas"
remove_tax: "Eliminar impuesto"
enterprise_terms_of_service: "Términos del Servicio de la Organización"
enterprises_require_tos: "Las organizaciones deben aceptar los Términos del Servicio"
@@ -1314,7 +1371,7 @@ es:
js:
admin:
modals:
got_it: Lo tengo
got_it: Lo entiendo
tag_rule_help:
title: Reglas de las Etiquetas
overview: Visión general
@@ -1358,14 +1415,13 @@ es:
hub_shop_text3: >
Si también quieres vender tus propios productos, tendrás que cambiar
esta organización para ser una productora.
choose_package: Selecciona un Paquete
choose_package_text1: >+
Tu organización no se activará completamente hasta que selecciones un
paquete de las opciones de la izquierda.
choose_package: Seleccione un Perfil
choose_package_text1: >
Su organización no se activará completamente hasta que seleccione un
perfil de las opciones de la izquierda.
choose_package_text2: >
Haz click en una opción para ver información más detallada acerca de
cada paquete, y pulsa el botón rojo GUARDAR cuando hayas terminado.
Haga click en una opción para ver información más detallada acerca de
cada perfil, y pulse el botón rojo GUARDAR cuando hayas terminado.
profile_only: Solo perfil
profile_only_cost: "COSTE: GRATUITO PARA SIEMPRE"
profile_only_text1: >+
@@ -1438,6 +1494,9 @@ es:
de tu carrito se han reducido. Aquí está lo que ha cambiado:
now_out_of_stock: está ahora fuera de stock.
only_n_remainging: "Solo quedan %{num} ."
producers:
signup:
start_free_profile: "Empieze con un perfil gratuito, y amplíelo cuando esté preparado!"
spree:
admin:
products:
@@ -1454,24 +1513,7 @@ es:
date_picker:
format: '%Y-%m-%d'
js_format: 'aa-mm-dd'
zipcode: Código Postal
shipment_states:
backorder: orden pendiente
partial: parcial
pending: pendiente
ready: Listo
shipped: enviado
payment_states:
balance_due: saldo debido
completed: completado
checkout: revisar
credit_owed: crédito debido
failed: fallido
paid: pagado
pending: pendiente
processing: procesando
void: vacío
invalid: inválido
inventory: Inventario
order_mailer:
invoice_email:
hi: "Hola %{name}"
@@ -1492,6 +1534,23 @@ es:
orders:
invoice:
tax_invoice: "IMPUESTOS FACTURA:"
payment_states:
balance_due: saldo debido
completed: completado
checkout: validar
credit_owed: crédito debido
failed: fallido
paid: pagado
pending: pendiente
processing: procesando
void: vacío
invalid: inválido
shipment_states:
backorder: orden pendiente
partial: parcial
pending: pendiente
ready: Listo
shipped: enviado
user_mailer:
reset_password_instructions:
request_sent_text: |
@@ -1502,3 +1561,19 @@ es:
issue_text: |
Si el enlace no funciona prueba a copiarlo y pegarlo en tu navegador.
Si los problemas continúan no dudes en contactarnos.
weight: Peso (en kg)
zipcode: Código Postal
users:
show:
open_orders: Pedidos Abiertos
transaction_history: Historial de Transacciones
open_orders:
order: Pedido
shop: Tienda
changes_allowed_until: Se permiten cambios hasta
items: Artículos
total: Total
edit: Editar
cancel: Cancelar
closed: Cerrado
until: Hasta

View File

@@ -4,6 +4,12 @@ fr:
spree/order:
payment_state: Statut du paiement
shipment_state: Statut livraison
errors:
models:
spree/user:
attributes:
email:
taken: "Un compte existe déjà pour cet e-mail. Connectez-vous ou demandez un nouveau mot de passe."
devise:
failure:
invalid: |

View File

@@ -4,6 +4,12 @@ nb:
spree/order:
payment_state: Betalingsstatus
shipment_state: Sendingsstatus
errors:
models:
spree/user:
attributes:
email:
taken: "Det finnes allerede en konto for denne e-posten. Vennligst logg inn eller tilbakestill passordet ditt."
devise:
failure:
invalid: |

View File

@@ -70,12 +70,10 @@ module Discourse
@custom_fields ||= {}
end
def sign(payload)
OpenSSL::HMAC.hexdigest("sha256", sso_secret, payload)
end
def to_url(base_url=nil)
base = "#{base_url || sso_url}"
"#{base}#{base.include?('?') ? '&' : '?'}#{payload}"

View File

@@ -25,7 +25,6 @@ module OpenFoodNetwork
end.select { |fee_type, amount| amount > 0 }
end
def fees_for(variant)
per_item_enterprise_fee_applicators_for(variant).sum do |applicator|
calculate_fee_for variant, applicator.enterprise_fee
@@ -40,7 +39,6 @@ module OpenFoodNetwork
end.select { |fee_type, amount| amount > 0 }
end
def create_line_item_adjustments_for(line_item)
variant = line_item.variant
@distributor = line_item.order.distributor
@@ -100,7 +98,6 @@ module OpenFoodNetwork
@indexed_enterprise_fees[variant.id] || []
end
def calculate_fee_for(variant, enterprise_fee)
# Spree's Calculator interface accepts Orders or LineItems,
# so we meet that interface with a struct.

View File

@@ -42,15 +42,14 @@ module OpenFoodNetwork
tax_category = variant.product.tax_category
if tax_category && tax_category.tax_rates.present?
tax_rate = tax_category.tax_rates.first
line_item = mock_line_item(variant, tax_category)
line_item = mock_line_item(variant)
tax_rate.calculator.compute line_item
else
0
end
end
def mock_line_item(variant, tax_category)
product = OpenStruct.new tax_category: tax_category
def mock_line_item(variant)
line_item = Spree::LineItem.new quantity: 1
line_item.define_singleton_method(:product) { variant.product }
line_item.define_singleton_method(:price) { variant.price }

View File

@@ -5,4 +5,4 @@ module OpenFoodNetwork
self.class.to_s.sub("Controller", "").underscore.split('/').last.singularize.to_sym
end
end
end
end

View File

@@ -172,7 +172,7 @@ module OpenFoodNetwork
end
def incoming_variant_ids
@order_cycle.supplied_variants.map &:id
@order_cycle.supplied_variants.map(&:id)
end
def variants_to_a(variants)

View File

@@ -40,7 +40,6 @@ module OpenFoodNetwork
def payment_method_row(order)
ba = order.billing_address
da = order.distributor.andand.address
[ba.firstname,
ba.lastname,
order.distributor.andand.name,
@@ -56,7 +55,6 @@ module OpenFoodNetwork
def delivery_row(order)
sa = order.shipping_address
da = order.distributor.andand.address
[sa.firstname,
sa.lastname,
order.distributor.andand.name,

View File

@@ -25,7 +25,9 @@ module OpenFoodNetwork
end
def valid?() true end
def new_record?() true end
def destroyed?() true end
def save
@@ -37,7 +39,9 @@ module OpenFoodNetwork
def errors
obj = Object.new
def obj.[](key) [] end
def obj.full_messages() [] end
def obj.any?() false end
obj
end

View File

@@ -10,7 +10,6 @@ module OpenFoodNetwork
end
end
def self.variant_destroyed(variant, &block)
exchanges = exchanges_featuring_variants(variant).to_a
@@ -21,7 +20,6 @@ module OpenFoodNetwork
end
end
def self.product_changed(product)
exchanges_featuring_variants(product.variants).each do |exchange|
refresh_cache exchange.receiver, exchange.order_cycle
@@ -44,12 +42,10 @@ module OpenFoodNetwork
end
end
def self.variant_override_destroyed(variant_override)
variant_override_changed variant_override
end
def self.producer_property_changed(producer_property)
products = producer_property.producer.supplied_products
variants = Spree::Variant.
@@ -61,12 +57,10 @@ module OpenFoodNetwork
end
end
def self.producer_property_destroyed(producer_property)
producer_property_changed producer_property
end
def self.order_cycle_changed(order_cycle)
if order_cycle.dated? && !order_cycle.closed?
order_cycle.exchanges.outgoing.each do |exchange|
@@ -75,7 +69,6 @@ module OpenFoodNetwork
end
end
def self.exchange_changed(exchange)
if exchange.incoming
refresh_incoming_exchanges(Exchange.where(id: exchange))
@@ -84,26 +77,22 @@ module OpenFoodNetwork
end
end
def self.exchange_destroyed(exchange)
exchange_changed exchange
end
def self.enterprise_fee_changed(enterprise_fee)
refresh_supplier_fee enterprise_fee
refresh_coordinator_fee enterprise_fee
refresh_distributor_fee enterprise_fee
end
def self.distributor_changed(enterprise)
Exchange.cachable.where(receiver_id: enterprise).each do |exchange|
refresh_cache exchange.receiver, exchange.order_cycle
end
end
def self.inventory_item_changed(inventory_item)
exchanges_featuring_variants(inventory_item.variant, distributor: inventory_item.enterprise).each do |exchange|
refresh_cache exchange.receiver, exchange.order_cycle
@@ -126,7 +115,6 @@ module OpenFoodNetwork
exchanges
end
def self.refresh_incoming_exchanges(exchanges)
incoming_exchanges(exchanges).map do |exchange|
outgoing_exchanges_with_variants(exchange.order_cycle, exchange.variant_ids)
@@ -135,26 +123,22 @@ module OpenFoodNetwork
end
end
def self.refresh_outgoing_exchange(exchange)
if exchange.order_cycle.dated? && !exchange.order_cycle.closed?
refresh_cache exchange.receiver, exchange.order_cycle
end
end
def self.refresh_supplier_fee(enterprise_fee)
refresh_incoming_exchanges(enterprise_fee.exchanges)
end
def self.refresh_coordinator_fee(enterprise_fee)
enterprise_fee.order_cycles.each do |order_cycle|
order_cycle_changed order_cycle
end
end
def self.refresh_distributor_fee(enterprise_fee)
enterprise_fee.exchange_fees.
joins(:exchange => :order_cycle).
@@ -167,7 +151,6 @@ module OpenFoodNetwork
end
end
def self.incoming_exchanges(exchanges)
exchanges.
incoming.
@@ -176,14 +159,12 @@ module OpenFoodNetwork
merge(OrderCycle.not_closed)
end
def self.outgoing_exchanges_with_variants(order_cycle, variant_ids)
order_cycle.exchanges.outgoing.
joins(:exchange_variants).
where('exchange_variants.variant_id IN (?)', variant_ids)
end
def self.refresh_cache(distributor, order_cycle)
ProductsCacheRefreshment.refresh distributor, order_cycle
end

View File

@@ -6,7 +6,7 @@ module OpenFoodNetwork::Reports
organise do
group { |li| li.product }
sort &:name
sort(&:name)
summary_row do
column { |lis| "TOTAL" }

View File

@@ -6,11 +6,11 @@ module OpenFoodNetwork::Reports
organise do
group { |li| li.product.supplier }
sort &:name
sort(&:name)
organise do
group { |li| li.product }
sort &:name
sort(&:name)
summary_row do
column { |lis| supplier_name(lis) }

View File

@@ -24,10 +24,9 @@ module OpenFoodNetwork::Reports
rule = rule.next
end
rules.map &:to_h
rules.map(&:to_h)
end
# -- DSL
def self.header(*columns)
self._header = columns

View File

@@ -93,11 +93,11 @@ module OpenFoodNetwork
def shipping_cost_for(order)
shipping_cost = order.adjustments.find_by_label("Shipping").andand.amount
shipping_cost = shipping_cost.nil? ? 0.0 : shipping_cost
shipping_cost.nil? ? 0.0 : shipping_cost
end
def tax_included_in(line_item)
line_item.adjustments.sum &:included_tax
line_item.adjustments.sum(&:included_tax)
end
def shipment_inc_vat

View File

@@ -12,11 +12,11 @@ module OpenFoodNetwork
private
def completed_order_total
completed_orders.sum &:total
completed_orders.sum(&:total)
end
def payment_total
payments.sum &:amount
payments.sum(&:amount)
end
def completed_orders

View File

@@ -11,7 +11,7 @@ module OpenFoodNetwork
def options_text
values = self.option_values.joins(:option_type).order("#{Spree::OptionType.table_name}.position asc")
values.map! &:presentation # This line changed
values.map!(&:presentation) # This line changed
values.to_sentence({ :words_connector => ", ", :two_words_connector => ", " })
end
@@ -44,7 +44,6 @@ module OpenFoodNetwork
display_as
end
def update_units
delete_unit_option_values

View File

@@ -175,27 +175,27 @@ module OpenFoodNetwork
end
def total_untaxable_products(order)
order.line_items.without_tax.sum &:amount
order.line_items.without_tax.sum(&:amount)
end
def total_taxable_products(order)
order.line_items.with_tax.sum &:amount
order.line_items.with_tax.sum(&:amount)
end
def total_untaxable_fees(order)
order.adjustments.enterprise_fee.without_tax.sum &:amount
order.adjustments.enterprise_fee.without_tax.sum(&:amount)
end
def total_taxable_fees(order)
order.adjustments.enterprise_fee.with_tax.sum &:amount
order.adjustments.enterprise_fee.with_tax.sum(&:amount)
end
def total_shipping(order)
order.adjustments.shipping.sum &:amount
order.adjustments.shipping.sum(&:amount)
end
def total_transaction(order)
order.adjustments.payment_fee.sum &:amount
order.adjustments.payment_fee.sum(&:amount)
end
def tax_on_shipping_s(order)
@@ -204,11 +204,11 @@ module OpenFoodNetwork
end
def total_untaxable_admin_adjustments(order)
order.adjustments.admin.without_tax.sum &:amount
order.adjustments.admin.without_tax.sum(&:amount)
end
def total_taxable_admin_adjustments(order)
order.adjustments.admin.with_tax.sum &:amount
order.adjustments.admin.with_tax.sum(&:amount)
end
def detail?

View File

@@ -26,7 +26,6 @@ module Spree
end
end
def sign_in_as_admin!
let!(:current_api_user) do
user = stub_model(Spree::LegacyUser)

View File

@@ -28,5 +28,3 @@ namespace :openfoodnetwork do
end
end
end

View File

@@ -29,7 +29,7 @@ namespace :karma do
def application_spec_files
sprockets = Rails.application.assets
sprockets.append_path Rails.root.join("spec/javascripts")
files = Rails.application.assets.find_asset("application_spec.js").to_a.map {|e| e.pathname.to_s }
Rails.application.assets.find_asset("application_spec.js").to_a.map {|e| e.pathname.to_s }
end
def unit_js(files)

View File

@@ -33,7 +33,6 @@ namespace :openfoodnetwork do
Spree::User.all.reject { |u| u.email =~ /example.net/ }
end
def user_header
["encrypted_password", "password_salt", "email", "remember_token", "persistence_token", "reset_password_token", "perishable_token", "sign_in_count", "failed_attempts", "last_request_at", "current_sign_in_at", "last_sign_in_at", "current_sign_in_ip", "last_sign_in_ip", "login", "created_at", "updated_at", "authentication_token", "unlock_token", "locked_at", "remember_created_at", "reset_password_sent_at",
@@ -44,7 +43,6 @@ namespace :openfoodnetwork do
"bill_address_firstname", "bill_address_lastname", "bill_address_address1", "bill_address_address2", "bill_address_city", "bill_address_zipcode", "bill_address_phone", "bill_address_state", "bill_address_country", "bill_address_created_at", "bill_address_updated_at", "bill_address_company",]
end
def user_row(user)
sa = user.orders.last.andand.ship_address
ba = user.orders.last.andand.bill_address
@@ -58,7 +56,6 @@ namespace :openfoodnetwork do
ba.andand.firstname, ba.andand.lastname, ba.andand.address1, ba.andand.address2, ba.andand.city, ba.andand.zipcode, ba.andand.phone, ba.andand.state, ba.andand.country, ba.andand.created_at, ba.andand.updated_at, ba.andand.company,]
end
def create_user_from(row)
user = Spree::User.create!({password: 'changeme123', password_confirmation: 'changeme123', email: row[2], remember_token: row[3], persistence_token: row[4], reset_password_token: row[5], perishable_token: row[6], sign_in_count: row[7], failed_attempts: row[8], last_request_at: row[9], current_sign_in_at: row[10], last_sign_in_at: row[11], current_sign_in_ip: row[12], last_sign_in_ip: row[13], login: row[14], created_at: row[15], updated_at: row[16], authentication_token: row[17], unlock_token: row[18], locked_at: row[19], remember_created_at: row[20], reset_password_sent_at: row[21]}, without_protection: true)

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