mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
code style and cleanup
This commit is contained in:
@@ -2,7 +2,7 @@ Darkswarm.controller "GroupEnterpriseNodeCtrl", ($scope, CurrentHub) ->
|
||||
|
||||
$scope.active = false
|
||||
|
||||
$scope.toggle = () ->
|
||||
$scope.toggle = ->
|
||||
$scope.active = !$scope.active
|
||||
|
||||
$scope.open = ->
|
||||
|
||||
@@ -4,7 +4,7 @@ Darkswarm.controller "TabsCtrl", ($scope, $rootScope, $location) ->
|
||||
$location.hash() == path
|
||||
|
||||
# Select tab by setting the url hash path.
|
||||
$scope.select= (path)->
|
||||
$scope.select = (path)->
|
||||
$location.hash path
|
||||
|
||||
# Toggle tab selected status by setting the url hash path.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module GroupsHelper
|
||||
|
||||
def link_to_service(baseurl, name, html_options = {})
|
||||
if name.blank? then return end
|
||||
return if name.blank?
|
||||
html_options = html_options.merge target: '_blank'
|
||||
link_to ext_url(baseurl, name), html_options do
|
||||
yield
|
||||
@@ -9,10 +9,10 @@ module GroupsHelper
|
||||
end
|
||||
|
||||
def ext_url(prefix, url)
|
||||
if (url =~ /^https?:\/\//i)
|
||||
return url
|
||||
if url =~ /^https?:\/\//i
|
||||
url
|
||||
else
|
||||
return prefix + url
|
||||
prefix + url
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class EnterpriseGroup < ActiveRecord::Base
|
||||
if user.has_spree_role?('admin')
|
||||
scoped
|
||||
else
|
||||
where('owner_id = ?', user.id);
|
||||
where('owner_id = ?', user.id)
|
||||
end
|
||||
}
|
||||
|
||||
@@ -52,9 +52,7 @@ class EnterpriseGroup < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def set_undefined_address_fields
|
||||
if !address.present?
|
||||
return
|
||||
end
|
||||
return unless address.present?
|
||||
address.phone.present? || address.phone = 'undefined'
|
||||
address.address1.present? || address.address1 = 'undefined'
|
||||
address.city.present? || address.city = 'undefined'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
= render :partial => 'spree/shared/error_messages', :locals => { :target => @enterprise }
|
||||
= render 'spree/shared/error_messages', target: @enterprise
|
||||
|
||||
= form_for [main_app, :admin, @enterprise_group] do |f|
|
||||
.row{ ng: {app: 'admin.enterprise_groups', controller: 'enterpriseGroupCtrl'} }
|
||||
@@ -7,5 +7,5 @@
|
||||
= render 'admin/shared/side_menu'
|
||||
.one.column
|
||||
.eleven.columns.omega.fullwidth_inputs
|
||||
= render :partial => 'inputs', :locals => { :f => f }
|
||||
= render partial: "spree/admin/shared/#{action}_resource_links"
|
||||
= render 'inputs', f: f
|
||||
= render "spree/admin/shared/#{action}_resource_links"
|
||||
|
||||
@@ -3,9 +3,7 @@ class AddAddressInstancesToExistingEnterpriseGroups < ActiveRecord::Migration
|
||||
country = Spree::Country.find_by_name(ENV['DEFAULT_COUNTRY'])
|
||||
state = country.states.first
|
||||
EnterpriseGroup.all.each do |g|
|
||||
if g.address.present? then
|
||||
next
|
||||
end
|
||||
next if g.address.present?
|
||||
address = Spree::Address.new(firstname: 'unused', lastname: 'unused', address1: 'undefined', city: 'undefined', zipcode: 'undefined', state: state, country: country, phone: 'undefined')
|
||||
g.address = address
|
||||
g.save
|
||||
|
||||
Reference in New Issue
Block a user