From 5380c722ce344d712cab307d41e0f7a654a4070c Mon Sep 17 00:00:00 2001 From: Radhika Chippada Date: Thu, 26 Mar 2015 14:55:37 -0400 Subject: [PATCH 1/1] 5493: wiring for 'getting started' popup --- .../app/controllers/actions_controller.rb | 8 +++++- .../app/controllers/application_controller.rb | 9 +++++++ .../_getting_started_popup.html.erb | 26 +++++++++++++++++++ .../application/getting_started_popup.js.erb | 2 ++ .../workbench/app/views/layouts/body.html.erb | 20 +++++++++++++- apps/workbench/config/application.default.yml | 1 + apps/workbench/config/routes.rb | 1 + 7 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 apps/workbench/app/views/application/_getting_started_popup.html.erb create mode 100644 apps/workbench/app/views/application/getting_started_popup.js.erb diff --git a/apps/workbench/app/controllers/actions_controller.rb b/apps/workbench/app/controllers/actions_controller.rb index 7737a3cfe4..9db8827c16 100644 --- a/apps/workbench/app/controllers/actions_controller.rb +++ b/apps/workbench/app/controllers/actions_controller.rb @@ -1,6 +1,6 @@ class ActionsController < ApplicationController - skip_filter :require_thread_api_token, only: [:report_issue_popup, :report_issue] + skip_filter :require_thread_api_token, only: [:report_issue_popup, :report_issue, :getting_started_popup] skip_filter :check_user_agreements, only: [:report_issue_popup, :report_issue] @@exposed_actions = {} @@ -253,6 +253,12 @@ class ActionsController < ApplicationController end end + def getting_started_popup + respond_to do |format| + format.js + end + end + protected def derive_unique_filename filename, manifest_files diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index 1b59c574b7..f81e095fae 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -700,6 +700,15 @@ class ApplicationController < ActionController::Base missing_required end + helper_method :update_getting_started_shown_user_pref + def update_getting_started_shown_user_pref + prefs = current_user.prefs + if !prefs[:getting_started_shown] + prefs[:getting_started_shown] = Time.now + current_user.update_attributes prefs: prefs + end + end + def select_theme return Rails.configuration.arvados_theme end diff --git a/apps/workbench/app/views/application/_getting_started_popup.html.erb b/apps/workbench/app/views/application/_getting_started_popup.html.erb new file mode 100644 index 0000000000..eb161bcd3e --- /dev/null +++ b/apps/workbench/app/views/application/_getting_started_popup.html.erb @@ -0,0 +1,26 @@ +<% + update_getting_started_shown_user_pref() if current_user +%> + + diff --git a/apps/workbench/app/views/application/getting_started_popup.js.erb b/apps/workbench/app/views/application/getting_started_popup.js.erb new file mode 100644 index 0000000000..d9c4fa8a20 --- /dev/null +++ b/apps/workbench/app/views/application/getting_started_popup.js.erb @@ -0,0 +1,2 @@ +$("#getting-started-modal-window").html("<%= escape_javascript(render partial: 'getting_started_popup') %>"); +$("#getting-started-modal-window .modal").modal('show'); diff --git a/apps/workbench/app/views/layouts/body.html.erb b/apps/workbench/app/views/layouts/body.html.erb index fbbd0fac26..67e50bd306 100644 --- a/apps/workbench/app/views/layouts/body.html.erb +++ b/apps/workbench/app/views/layouts/body.html.erb @@ -118,6 +118,12 @@