diff --git a/.gitignore b/.gitignore index 899ad73..7637110 100644 --- a/.gitignore +++ b/.gitignore @@ -41,4 +41,5 @@ bower.json # Ignore Byebug command history file. .byebug_history -.idea/ \ No newline at end of file +.idea/ +/test/dummy/tmp/ diff --git a/.ruby-version b/.ruby-version index 2bf1c1c..f90b1af 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.1 +2.3.2 diff --git a/Gemfile.lock b/Gemfile.lock index a3f7e6f..81e1349 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,8 +2,10 @@ PATH remote: . specs: abraham (0.1.0) + jquery-rails rails (~> 5.0.0, >= 5.0.0.1) rails-assets-shepherd.js (~> 1.8) + sass-rails (~> 5.0) GEM remote: http://rubygems.org/ @@ -53,6 +55,10 @@ GEM globalid (0.3.7) activesupport (>= 4.1.0) i18n (0.7.0) + jquery-rails (4.2.1) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) loofah (2.0.3) nokogiri (>= 1.5.9) mail (2.6.4) @@ -96,6 +102,13 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (11.3.0) + sass (3.4.22) + sass-rails (5.0.6) + railties (>= 4.0.0, < 6) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (>= 1.1, < 3) sprockets (3.7.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -106,6 +119,7 @@ GEM sqlite3 (1.3.12) thor (0.19.1) thread_safe (0.3.5) + tilt (2.0.5) tzinfo (1.2.2) thread_safe (~> 0.1) websocket-driver (0.6.4) diff --git a/abraham.gemspec b/abraham.gemspec index b831f79..54fc96c 100644 --- a/abraham.gemspec +++ b/abraham.gemspec @@ -17,8 +17,10 @@ Gem::Specification.new do |s| s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] s.add_dependency "rails", "~> 5.0.0", ">= 5.0.0.1" + s.add_dependency 'sass-rails', '~> 5.0' + s.add_dependency "rails-assets-shepherd.js", "~> 1.8" s.add_development_dependency "sqlite3" - s.add_runtime_dependency "rails-assets-shepherd.js", "~> 1.8" + s.add_runtime_dependency 'jquery-rails' end diff --git a/app/controllers/abraham_histories_controller.rb b/app/controllers/abraham_histories_controller.rb index 720ba8f..c90162d 100644 --- a/app/controllers/abraham_histories_controller.rb +++ b/app/controllers/abraham_histories_controller.rb @@ -1,9 +1,10 @@ class AbrahamHistoriesController < ApplicationController def create @abraham_history = AbrahamHistory.new(abraham_history_params) + @abraham_history.creator_id = current_user respond_to do |format| if @abraham_history.save - format.json { render :show, status: :created, location: @abraham_history } + format.json { render json: @abraham_history, status: :created } else format.json { render json: @abraham_history.errors, status: :unprocessable_entity } end diff --git a/app/helpers/abraham_helper.rb b/app/helpers/abraham_helper.rb index 27f9ae6..7319a5b 100644 --- a/app/helpers/abraham_helper.rb +++ b/app/helpers/abraham_helper.rb @@ -1,22 +1,22 @@ module AbrahamHelper def abraham_tour # Do we have tours for this controller/action in the user's locale? - tours = Rails.configuration.abraham["#{controller_name}.#{action_name}.#{I18n.locale}"] + tours = Rails.configuration.abraham.tours["#{controller_name}.#{action_name}.#{I18n.locale}"] unless tours # How about the default locale? - tours = Rails.configuration.abraham["#{controller_name}.#{action_name}.#{I18n.default_locale}"] + tours = Rails.configuration.abraham.tours["#{controller_name}.#{action_name}.#{I18n.default_locale}"] end if tours completed = AbrahamHistory.where( - creator: @current_person, controller_name: controller_name, + creator_id: current_user, controller_name: controller_name, action_name: action_name) remaining = tours.keys - completed.map(&:tour_name) if remaining.any? # Generate the javascript snippet for the next remaining tour - render(:partial => 'application/tour', + render(:partial => 'application/abraham', :locals => {:tour_name => remaining.first, :steps => tours[remaining.first]['steps']}) end diff --git a/app/views/application/_abraham.html.erb b/app/views/application/_abraham.html.erb index b2504cb..cb6df8c 100644 --- a/app/views/application/_abraham.html.erb +++ b/app/views/application/_abraham.html.erb @@ -1,8 +1,7 @@