Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hide collapse questions #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/assets/javascripts/surveyor/jquery.surveyor.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jQuery(document).ready(function(){
}

if ( detail_info ){
$(detail_info).collapse('hide');
$(detail_info).hide;
}
$this.hideElement(this)
}
Expand Down
4 changes: 4 additions & 0 deletions lib/generators/surveyor/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ class InstallGenerator < Rails::Generators::Base
add_input_mask_attributes_to_answer
)

def create_initializer_file
create_file "config/initializers/surveyor.rb", "Surveyor.user_class = 'User'"
end

def readme
copy_file "../../../../README.md", "surveys/README.md"
end
Expand Down
10 changes: 10 additions & 0 deletions lib/surveyor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ module Surveyor
require 'surveyor/engine' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
autoload :VERSION, 'surveyor/version'
autoload :ParserError, 'surveyor/parser'

mattr_accessor :user_class

def self.user_class
if @@user_class.is_a?(Class)
raise "Surveyor.user_class MUST be a String or Symbol object, not a Class object."
elsif @@user_class.is_a?(String) || @@user_class.is_a?(Symbol)
@@user_class.to_s.constantize
end
end
end
require 'surveyor/common'
require 'surveyor/acts_as_response'
Expand Down
2 changes: 1 addition & 1 deletion lib/surveyor/models/response_set_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module ResponseSetMethods
included do
# Associations
belongs_to :survey
belongs_to :user
belongs_to :user, class_name: Surveyor.user_class
has_many :responses, :dependent => :destroy
accepts_nested_attributes_for :responses, :allow_destroy => true
attr_accessible *PermittedParams.new.response_set_attributes if defined? ActiveModel::MassAssignmentSecurity
Expand Down