diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 76bdfc234b..184336f6d2 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -363,27 +363,6 @@ Style/EmptyElse: Exclude: - 'app/models/polymorphic/task.rb' -# Offense count: 6 -# Cop supports --auto-correct. -# Configuration parameters: AllowAdjacentOneLineDefs. -Style/EmptyLineBetweenDefs: - Exclude: - - 'app/models/entities/contact.rb' - - 'app/models/entities/lead.rb' - - 'app/models/entities/opportunity.rb' - - 'app/models/polymorphic/task.rb' - - 'lib/fat_free_crm/callback.rb' - - 'spec/support/auth_macros.rb' - -# Offense count: 3 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles. -# SupportedStyles: empty_lines, no_empty_lines -Style/EmptyLinesAroundBlockBody: - Exclude: - - 'config/initializers/views.rb' - - 'db/schema.rb' - # Offense count: 10 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles. diff --git a/app/models/entities/contact.rb b/app/models/entities/contact.rb index cd22e72aff..6435f16f61 100644 --- a/app/models/entities/contact.rb +++ b/app/models/entities/contact.rb @@ -101,6 +101,7 @@ class Contact < ActiveRecord::Base def self.per_page 20 end + def self.first_name_position "before" end diff --git a/app/models/entities/lead.rb b/app/models/entities/lead.rb index 1968dab4bc..a0b0082114 100644 --- a/app/models/entities/lead.rb +++ b/app/models/entities/lead.rb @@ -85,6 +85,7 @@ class Lead < ActiveRecord::Base def self.per_page 20 end + def self.first_name_position "before" end diff --git a/app/models/entities/opportunity.rb b/app/models/entities/opportunity.rb index 8388fdd53c..4a0d24981f 100644 --- a/app/models/entities/opportunity.rb +++ b/app/models/entities/opportunity.rb @@ -91,6 +91,7 @@ class Opportunity < ActiveRecord::Base def self.per_page 20 end + def self.default_stage Setting[:opportunity_default_stage].try(:to_s) || 'prospecting' end diff --git a/app/models/polymorphic/task.rb b/app/models/polymorphic/task.rb index b21c99e3e0..96e1628829 100644 --- a/app/models/polymorphic/task.rb +++ b/app/models/polymorphic/task.rb @@ -166,6 +166,7 @@ def computed_bucket "due_later" end end + # Returns list of tasks grouping them by due date as required by tasks/index. #---------------------------------------------------------------------------- def self.find_all_grouped(user, view) diff --git a/config/initializers/views.rb b/config/initializers/views.rb index d347dad2fd..a5310fb89d 100644 --- a/config/initializers/views.rb +++ b/config/initializers/views.rb @@ -43,5 +43,4 @@ controllers: ['campaigns'], actions: ['index'], template: 'campaigns/index_long' }, { name: 'campaigns_show_normal', title: 'Normal format', icon: 'fa-list', controllers: ['campaigns'], actions: ['show'], template: nil }, # default show view - ].each { |view| FatFreeCRM::ViewFactory.new(view) } diff --git a/db/schema.rb b/db/schema.rb index 67d3f1bd33..bd6960f42b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,6 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20160511053730) do - # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -455,5 +454,4 @@ add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree add_index "versions", ["transaction_id"], name: "index_versions_on_transaction_id", using: :btree add_index "versions", ["whodunnit"], name: "index_versions_on_whodunnit", using: :btree - end diff --git a/lib/fat_free_crm/callback.rb b/lib/fat_free_crm/callback.rb index a6a67c1777..9392a4ca87 100644 --- a/lib/fat_free_crm/callback.rb +++ b/lib/fat_free_crm/callback.rb @@ -43,6 +43,7 @@ def self.hook(method, caller, context = {}) def self.view_responder(method) @@responder[method] ||= @@classes.map(&:instance).select { |instance| instance.class.view_hooks[method] } end + # Invokes the view hook Proc stored under :hook and captures its output. # => Instead of defining methods on the class, view hooks are # stored as Procs in a hash. This allows the same hook to be manipulated in diff --git a/spec/support/auth_macros.rb b/spec/support/auth_macros.rb index 47bb5b2931..b7c0b192f4 100755 --- a/spec/support/auth_macros.rb +++ b/spec/support/auth_macros.rb @@ -31,6 +31,7 @@ def login_and_assign(user_stubs = {}, session_stubs = {}) #set_timezone assigns[:current_user] = current_user end + def login_and_assign!(user_stubs = {}, session_stubs = {}) login assigns[:current_user] = current_user