code style and cleanup

This commit is contained in:
Maikel Linke
2015-02-19 10:48:39 +11:00
parent bbac5aa803
commit 718a5911a3
6 changed files with 12 additions and 16 deletions

View File

@@ -2,7 +2,7 @@ Darkswarm.controller "GroupEnterpriseNodeCtrl", ($scope, CurrentHub) ->
$scope.active = false
$scope.toggle = () ->
$scope.toggle = ->
$scope.active = !$scope.active
$scope.open = ->

View File

@@ -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.

View File

@@ -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

View File

@@ -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'

View File

@@ -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 &nbsp;
.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"

View File

@@ -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