From d86a4dd3117437b2f40242e43998f6565f907f27 Mon Sep 17 00:00:00 2001
From: zmagod
Date: Tue, 11 Oct 2016 11:40:14 +0200
Subject: [PATCH 01/17] setup global team switch view and controller action
---
app/assets/javascripts/navigation.js | 15 +++++
app/controllers/users/settings_controller.rb | 15 ++++-
app/views/shared/_navigation.html.erb | 17 ++++++
config/routes.rb | 3 +
...074804_add_current_organization_to_user.rb | 14 +++++
db/schema.rb | 56 +++++++++++++++++--
6 files changed, 113 insertions(+), 7 deletions(-)
create mode 100644 db/migrate/20161011074804_add_current_organization_to_user.rb
diff --git a/app/assets/javascripts/navigation.js b/app/assets/javascripts/navigation.js
index 8c7e77092..3f5180507 100644
--- a/app/assets/javascripts/navigation.js
+++ b/app/assets/javascripts/navigation.js
@@ -80,8 +80,23 @@
}
+ function initGlobalSwitchForm() {
+ var teamSwitch = $('#team-switch');
+ teamSwitch
+ .find('.dropdown-menu a')
+ .on('click', function(el){
+ $('#user_current_organization_id')
+ .val($(el.toElement).attr('data-id'));
+
+ teamSwitch
+ .find('form')
+ .submit();
+ });
+ }
+
// init
loadDropdownNotifications();
loadUnseenNotificationsNumber();
toggleNotificationBellPosition();
+ initGlobalSwitchForm();
})();
diff --git a/app/controllers/users/settings_controller.rb b/app/controllers/users/settings_controller.rb
index 57032dbc0..a1158a517 100644
--- a/app/controllers/users/settings_controller.rb
+++ b/app/controllers/users/settings_controller.rb
@@ -10,7 +10,8 @@ class Users::SettingsController < ApplicationController
:organization_users_datatable,
:tutorial,
:reset_tutorial,
- :notifications_settings
+ :notifications_settings,
+ :user_current_organization
]
before_action :check_organization_permission, only: [
@@ -491,6 +492,18 @@ class Users::SettingsController < ApplicationController
end
end
+ def user_current_organization
+ @user.current_organization_id = params[:user][:current_organization_id]
+
+ if @user.save
+ flash[:success] = 'Success!'
+ redirect_to :back
+ else
+ flash[:alert] = 'Something get terribly wrong'
+ redirect_to :back
+ end
+ end
+
private
def load_user
diff --git a/app/views/shared/_navigation.html.erb b/app/views/shared/_navigation.html.erb
index c5b2cf583..8167de818 100644
--- a/app/views/shared/_navigation.html.erb
+++ b/app/views/shared/_navigation.html.erb
@@ -100,6 +100,23 @@
+
+
+
+ Current Organisation
+
+
+
+
diff --git a/config/routes.rb b/config/routes.rb
index dabeaaef2..d1aca0457 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -19,6 +19,9 @@ Rails.application.routes.draw do
to: 'users/settings#notifications_settings',
as: 'notifications_settings',
defaults: { format: 'json' }
+ post 'users/settings/user_current_organization',
+ to: 'users/settings#user_current_organization',
+ as: 'user_current_organization'
get "users/settings/organizations", to: "users/settings#organizations", as: "organizations"
get "users/settings/organizations/new", to: "users/settings#new_organization", as: "new_organization"
post "users/settings/organizations/new", to: "users/settings#create_organization", as: "create_organization"
diff --git a/db/migrate/20161011074804_add_current_organization_to_user.rb b/db/migrate/20161011074804_add_current_organization_to_user.rb
new file mode 100644
index 000000000..0b97fbb6a
--- /dev/null
+++ b/db/migrate/20161011074804_add_current_organization_to_user.rb
@@ -0,0 +1,14 @@
+class AddCurrentOrganizationToUser < ActiveRecord::Migration
+ def up
+ add_column :users, :current_organization_id, :integer
+ add_foreign_key :users, :organizations, column: :current_organization_id
+
+ User.find_each do |user|
+ user.update(current_organization_id: user.organizations.first.id)
+ end
+ end
+
+ def down
+ remove_column :users, :current_organization_id
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 4b05fc448..5e00cef52 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,6 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
+
ActiveRecord::Schema.define(version: 20161012112900) do
# These are extensions that must be enabled in order to support this database
@@ -63,6 +64,41 @@ ActiveRecord::Schema.define(version: 20161012112900) do
add_index "assets", ["file_file_name"], name: "index_assets_on_file_file_name", using: :gist
add_index "assets", ["last_modified_by_id"], name: "index_assets_on_last_modified_by_id", using: :btree
+ create_table "billing_accounts", force: :cascade do |t|
+ t.string "braintree_customer_id"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ add_index "billing_accounts", ["braintree_customer_id"], name: "index_billing_accounts_on_braintree_customer_id", using: :btree
+
+ create_table "billing_plans", force: :cascade do |t|
+ t.string "braintree_plan_id", null: false
+ t.string "name", null: false
+ t.string "description"
+ t.integer "price_cents", default: 0, null: false
+ t.string "price_currency", default: "USD", null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.boolean "main", default: false, null: false
+ t.integer "max_storage", limit: 8, default: 0
+ t.integer "position", default: 0, null: false
+ t.boolean "free", default: false, null: false
+ end
+
+ add_index "billing_plans", ["braintree_plan_id"], name: "index_billing_plans_on_braintree_plan_id", using: :btree
+
+ create_table "billing_subscriptions", force: :cascade do |t|
+ t.string "braintree_subscription_id"
+ t.integer "billing_account_id", null: false
+ t.integer "billing_plan_id", null: false
+ t.boolean "active", default: false, null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ add_index "billing_subscriptions", ["braintree_subscription_id"], name: "index_billing_subscriptions_on_braintree_subscription_id", using: :btree
+
create_table "checklist_items", force: :cascade do |t|
t.string "text", null: false
t.boolean "checked", default: false, null: false
@@ -245,8 +281,11 @@ ActiveRecord::Schema.define(version: 20161012112900) do
t.integer "last_modified_by_id"
t.string "description"
t.integer "space_taken", limit: 8, default: 1048576, null: false
+ t.integer "billing_account_id"
+ t.integer "agile_crm_deal_id", limit: 8
end
+ add_index "organizations", ["billing_account_id"], name: "index_organizations_on_billing_account_id", using: :btree
add_index "organizations", ["created_by_id"], name: "index_organizations_on_created_by_id", using: :btree
add_index "organizations", ["last_modified_by_id"], name: "index_organizations_on_last_modified_by_id", using: :btree
add_index "organizations", ["name"], name: "index_organizations_on_name", using: :btree
@@ -658,12 +697,13 @@ ActiveRecord::Schema.define(version: 20161012112900) do
t.integer "invitation_limit"
t.integer "invited_by_id"
t.string "invited_by_type"
- t.integer "invitations_count", default: 0
- t.integer "tutorial_status", default: 0, null: false
- t.boolean "assignments_notification", default: true
- t.boolean "recent_notification", default: true
- t.boolean "assignments_notification_email", default: false
- t.boolean "recent_notification_email", default: false
+ t.integer "invitations_count", default: 0
+ t.integer "tutorial_status", default: 0, null: false
+ t.boolean "assignments_notification", default: true
+ t.boolean "recent_notification", default: true
+ t.boolean "assignments_notification_email", default: false
+ t.boolean "recent_notification_email", default: false
+ t.integer "current_organization_id"
t.boolean "system_message_notification_email", default: false
end
@@ -680,6 +720,8 @@ ActiveRecord::Schema.define(version: 20161012112900) do
add_foreign_key "asset_text_data", "assets"
add_foreign_key "assets", "users", column: "created_by_id"
add_foreign_key "assets", "users", column: "last_modified_by_id"
+ add_foreign_key "billing_subscriptions", "billing_accounts"
+ add_foreign_key "billing_subscriptions", "billing_plans"
add_foreign_key "checklist_items", "checklists"
add_foreign_key "checklist_items", "users", column: "created_by_id"
add_foreign_key "checklist_items", "users", column: "last_modified_by_id"
@@ -710,6 +752,7 @@ ActiveRecord::Schema.define(version: 20161012112900) do
add_foreign_key "my_modules", "users", column: "last_modified_by_id"
add_foreign_key "my_modules", "users", column: "restored_by_id"
add_foreign_key "notifications", "users", column: "generator_user_id"
+ add_foreign_key "organizations", "billing_accounts"
add_foreign_key "organizations", "users", column: "created_by_id"
add_foreign_key "organizations", "users", column: "last_modified_by_id"
add_foreign_key "project_comments", "comments"
@@ -795,4 +838,5 @@ ActiveRecord::Schema.define(version: 20161012112900) do
add_foreign_key "user_projects", "projects"
add_foreign_key "user_projects", "users"
add_foreign_key "user_projects", "users", column: "assigned_by_id"
+ add_foreign_key "users", "organizations", column: "current_organization_id"
end
From efe031d766e6e4f1d9344c6bf38121efe3d255d4 Mon Sep 17 00:00:00 2001
From: zmagod
Date: Tue, 11 Oct 2016 11:58:37 +0200
Subject: [PATCH 02/17] setup current_organization in all controllers
---
app/controllers/application_controller.rb | 6 ++++++
app/controllers/users/settings_controller.rb | 7 ++++---
app/views/shared/_navigation.html.erb | 3 ++-
config/locales/en.yml | 2 ++
4 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 0a5765e62..8331293b0 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -6,6 +6,7 @@ class ApplicationController < ActionController::Base
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :authenticate_user!
+ helper_method :current_organization
before_action :generate_intro_tutorial, if: :is_current_page_root?
around_action :set_time_zone, if: :current_user
layout "main"
@@ -22,6 +23,11 @@ class ApplicationController < ActionController::Base
controller_name == "projects" && action_name == "index"
end
+ # Sets current organization for all controllers
+ def current_organization
+ Organization.find_by_id(current_user.current_organization_id)
+ end
+
protected
def log(message)
diff --git a/app/controllers/users/settings_controller.rb b/app/controllers/users/settings_controller.rb
index a1158a517..eeaaaeba5 100644
--- a/app/controllers/users/settings_controller.rb
+++ b/app/controllers/users/settings_controller.rb
@@ -494,12 +494,13 @@ class Users::SettingsController < ApplicationController
def user_current_organization
@user.current_organization_id = params[:user][:current_organization_id]
-
+ @changed_org = Organization.find_by_id(@user.current_organization_id)
if @user.save
- flash[:success] = 'Success!'
+ flash[:success] = t('users.settings.changed_org_flash',
+ team: @changed_org.name)
redirect_to :back
else
- flash[:alert] = 'Something get terribly wrong'
+ flash[:alert] = t('users.settings.changed_org_error_flash')
redirect_to :back
end
end
diff --git a/app/views/shared/_navigation.html.erb b/app/views/shared/_navigation.html.erb
index 8167de818..541c0bad7 100644
--- a/app/views/shared/_navigation.html.erb
+++ b/app/views/shared/_navigation.html.erb
@@ -103,7 +103,7 @@
- Current Organisation
+ <%= current_organization.name %>
<% end %>
-
-
-
-
-
-
<% end %>
-<% if @projects_by_orgs.length > 0 %>
- <% @projects_by_orgs.each do |org, projects| %>
- <%= render partial: "projects/index/org_projects", locals: {org: org, projects: projects} %>
- <% end %>
+<%= render partial: 'projects/index/introductory_popup' %>
+<%= javascript_include_tag 'projects/introdutory_popup' %>
+
+<% if current_organization.projects.length> 0 %>
+ <%= render partial: "projects/index/org_projects",
+ locals: { org: current_organization,
+ projects: current_organization.projects } %>
+
<% end %>
<%= javascript_include_tag "projects/index", "data-turbolinks-track" => true %>
diff --git a/app/views/protocols/_breadcrumbs.html.erb b/app/views/protocols/_breadcrumbs.html.erb
index 99bff0afb..9891d4adc 100644
--- a/app/views/protocols/_breadcrumbs.html.erb
+++ b/app/views/protocols/_breadcrumbs.html.erb
@@ -1,20 +1,7 @@
<% if action_name == "index" %>
- <%= t("protocols.nav.breadcrumbs.manager") %>
- -
- <%= current_organization.name %>
-
-
+ - <%= current_organization.name %>
<% else %>
- <%= link_to t("protocols.nav.breadcrumbs.manager"), protocols_path(organization: current_organization, type: type) %>
- <%= current_organization.name %>
@@ -24,4 +11,4 @@
<%= t("protocols.nav.breadcrumbs.edit") %>
<% end %>
-
\ No newline at end of file
+
diff --git a/app/views/protocols/index.html.erb b/app/views/protocols/index.html.erb
index bbcbe57ab..ba14ede53 100644
--- a/app/views/protocols/index.html.erb
+++ b/app/views/protocols/index.html.erb
@@ -1,6 +1,6 @@
<% provide(:head_title, t("protocols.index.head_title")) %>
-<% if @organizations.count > 0 %>
+<% if current_organization %>
<%= render partial: "protocols/breadcrumbs.html.erb", locals: { organizations: @organizations, current_organization: @current_organization, type: @type } %>
diff --git a/app/views/search/results/partials/_asset_text.html.erb b/app/views/search/results/partials/_asset_text.html.erb
index 907e0d592..897e0f8bc 100644
--- a/app/views/search/results/partials/_asset_text.html.erb
+++ b/app/views/search/results/partials/_asset_text.html.erb
@@ -11,4 +11,4 @@
<% else %>
<%= text %>
-<% end %>
\ No newline at end of file
+<% end %>
diff --git a/app/views/search/results/partials/_experiment_text.html.erb b/app/views/search/results/partials/_experiment_text.html.erb
index 287ab39f5..51604d486 100644
--- a/app/views/search/results/partials/_experiment_text.html.erb
+++ b/app/views/search/results/partials/_experiment_text.html.erb
@@ -4,17 +4,15 @@
<% if experiment.archived? %>
<%=t "search.index.archived" %>
<% if can_view_experiment(experiment) and can_restore_experiment(experiment.project) %>
-
- <%= text %>
-
+ <%= route_to_other_org root_path, experiment.project.organization, text %>
<% else %>
<%= text %>
<% end %>
<% else %>
<% if can_view_experiment(experiment) %>
-
- <%= text %>
-
+ <%= route_to_other_org canvas_experiment_path(experiment),
+ experiment.project.organization,
+ text %>
<% else %>
<%= text %>
<% end %>
diff --git a/app/views/search/results/partials/_my_module_text.html.erb b/app/views/search/results/partials/_my_module_text.html.erb
index 335eabe1f..a654fb320 100644
--- a/app/views/search/results/partials/_my_module_text.html.erb
+++ b/app/views/search/results/partials/_my_module_text.html.erb
@@ -5,9 +5,9 @@
<% if my_module.archived? %>
<%=t "search.index.archived" %>
<% if can_view_experiment_archive(my_module.experiment) and can_restore_module(my_module) %>
-
- <%= text %>
-
+ <%= route_to_other_org module_archive_experiment_url(my_module.experiment),
+ my_module.experiment.project.organization,
+ text %>
<% else %>
<%= text %>
<% end %>
@@ -15,21 +15,21 @@
<% if can_view_module(my_module) %>
<% case link_to_page %>
<% when :samples %>
-
- <%= text %>
-
+ <%= route_to_other_org samples_my_module_path(my_module),
+ my_module.experiment.project.organization,
+ text %>
<% when :protocols %>
-
- <%= text %>
-
+ <%= route_to_other_org protocols_my_module_path(my_module),
+ my_module.experiment.project.organization,
+ text %>
<% when :canvas %>
-
- <%= text %>
-
+ <%= route_to_other_org canvas_experiment_path(my_module.experiment),
+ my_module.experiment.project.organization,
+ text %>
<% when :results %>
-
- <%= text %>
-
+ <%= route_to_other_org results_my_module_path(my_module),
+ my_module.experiment.project.organization,
+ text %>
<% else %>
<%= text %>
<% end %>
diff --git a/app/views/search/results/partials/_organization_text.html.erb b/app/views/search/results/partials/_organization_text.html.erb
index 9669942e9..06a98df4b 100644
--- a/app/views/search/results/partials/_organization_text.html.erb
+++ b/app/views/search/results/partials/_organization_text.html.erb
@@ -1,7 +1,7 @@
<% if can_view_projects(organization) %>
-
- <%= organization.name %>
-
+ <%= route_to_other_org projects_path(organization: organization.id),
+ organization,
+ organization.name %>
<% else %>
<%= organization.name %>
-<% end %>
\ No newline at end of file
+<% end %>
diff --git a/app/views/search/results/partials/_project_text.html.erb b/app/views/search/results/partials/_project_text.html.erb
index d4ab21de6..3956b71b2 100644
--- a/app/views/search/results/partials/_project_text.html.erb
+++ b/app/views/search/results/partials/_project_text.html.erb
@@ -5,24 +5,24 @@
<% if project.archived? %>
<%=t "search.index.archived" %>
<% if can_view_projects(project.organization) and can_restore_project(project) %>
-
- <%= text %>
-
+ <%= route_to_other_org projects_archive_path(organization: project.organization),
+ project.organization,
+ text %>
<% else %>
<%= text %>
<% end %>
<% else %>
<% if can_view_project(project) %>
<% if link_to_page == :show %>
-
- <%= text %>
-
+ <%= route_to_other_org project_path(project),
+ project.organization,
+ text %>
<% else %>
-
- <%= text %>
-
+ <%= route_to_other_org root_path,
+ nil,
+ text %>
<% end %>
<% else %>
<%= text %>
<% end %>
-<% end %>
\ No newline at end of file
+<% end %>
diff --git a/app/views/search/results/partials/_protocol_text.html.erb b/app/views/search/results/partials/_protocol_text.html.erb
index 35007c800..137f7a62d 100644
--- a/app/views/search/results/partials/_protocol_text.html.erb
+++ b/app/views/search/results/partials/_protocol_text.html.erb
@@ -7,9 +7,9 @@
<% if can_view_steps_in_protocol(protocol) %>
-
- <%= text %>
-
+ <%= route_to_other_org protocols_my_module_path(protocol.my_module),
+ protocol.organization,
+ text %>
<% else %>
<%= text %>
<% end %>
@@ -31,9 +31,9 @@
<% end %>
<% if can_edit_protocol(protocol) %>
-
- <%= text %>
-
+ <%= route_to_other_org edit_protocol_path(protocol),
+ protocol.organization,
+ text %>
<% else %>
<%= text %>
<% end %>
diff --git a/app/views/search/results/partials/_report_text.html.erb b/app/views/search/results/partials/_report_text.html.erb
index 2b7b81dec..2335b7920 100644
--- a/app/views/search/results/partials/_report_text.html.erb
+++ b/app/views/search/results/partials/_report_text.html.erb
@@ -5,6 +5,9 @@
<%= text %>
+ <%= route_to_other_org edit_project_report_path(report.project, report),
+ report.project.organization,
+ text %>
<% else %>
<%= text %>
-<% end %>
\ No newline at end of file
+<% end %>
diff --git a/app/views/search/results/partials/_result_text.html.erb b/app/views/search/results/partials/_result_text.html.erb
index 08719ea16..69a439459 100644
--- a/app/views/search/results/partials/_result_text.html.erb
+++ b/app/views/search/results/partials/_result_text.html.erb
@@ -6,13 +6,14 @@
<%=t "search.index.archived" %>
<% if can_view_module_archive(result.my_module) %>
<% if target == :comment %>
- <%= link_to archive_my_module_path(result.my_module, ctarget: "result-panel-#{result.id}") do %>
- <%= text %>
- <% end %>
+ <%= route_to_other_org archive_my_module_path(result.my_module, ctarget: "result-panel-#{result.id}"),
+ result.my_module.experiment.project.organization,
+ text %>
+
<% else %>
-
- <%= text %>
-
+ <%= route_to_other_org archive_my_module_path(result.my_module),
+ result.my_module.experiment.project.organization,
+ text %>
<% end %>
<% else %>
<%= text %>
@@ -20,13 +21,13 @@
<% else %>
<% if can_view_results_in_module(result.my_module) %>
<% if target == :comment %>
- <%= link_to results_my_module_path(result.my_module, ctarget: "result-panel-#{result.id}") do %>
- <%= text %>
- <% end %>
+ <%= route_to_other_org results_my_module_path(result.my_module, ctarget: "result-panel-#{result.id}"),
+ result.my_module.experiment.project.organization,
+ text %>
<% else %>
-
- <%= text %>
-
+ <%= route_to_other_org results_my_module_path(result.my_module),
+ result.my_module.experiment.project.organization,
+ text %>
<% end %>
<% else %>
<%= text %>
diff --git a/app/views/search/results/partials/_step_text.html.erb b/app/views/search/results/partials/_step_text.html.erb
index 871a79afa..cd486f9d6 100644
--- a/app/views/search/results/partials/_step_text.html.erb
+++ b/app/views/search/results/partials/_step_text.html.erb
@@ -5,18 +5,18 @@
<% if can_view_steps_in_protocol(step.protocol) %>
<% if step.protocol.in_module? %>
<% if target == :comment %>
- <%= link_to protocols_my_module_path(step.protocol.my_module, ctarget: "step-panel-#{step.id}") do %>
- <%= text %>
- <% end %>
+ <%= route_to_other_org protocols_my_module_path(step.protocol.my_module, ctarget: "step-panel-#{step.id}"),
+ step.protocol.organization,
+ text %>
<% else %>
-
- <%= text %>
-
+ <%= route_to_other_org protocols_my_module_path(step.protocol.my_module),
+ step.protocol.organization,
+ text %>
<% end %>
<% elsif can_edit_protocol(step.protocol) %>
-
- <%= text %>
-
+ <%= route_to_other_org edit_protocol_path(step.protocol),
+ step.protocol.organization,
+ text %>
<% else %>
<%= text %>
<% end %>
diff --git a/app/views/shared/_navigation.html.erb b/app/views/shared/_navigation.html.erb
index 541c0bad7..aa181136a 100644
--- a/app/views/shared/_navigation.html.erb
+++ b/app/views/shared/_navigation.html.erb
@@ -105,14 +105,14 @@
<%= current_organization.name %>
-
+<% else %>
+
<% end %>
<% if current_organization.projects.length > 0 %>
diff --git a/app/views/projects/index/_org_projects.html.erb b/app/views/projects/index/_org_projects.html.erb
index e5ddb0496..7aab961a9 100644
--- a/app/views/projects/index/_org_projects.html.erb
+++ b/app/views/projects/index/_org_projects.html.erb
@@ -1,5 +1,3 @@
-
-
<% projects.each_index do |i| project = projects[i] %>
From 557957c85754e5c73461efd0a1f2c968196778ff Mon Sep 17 00:00:00 2001
From: zmagod
Date: Mon, 17 Oct 2016 14:47:09 +0200
Subject: [PATCH 16/17] fixed issue with mozilla browsers
---
app/assets/javascripts/navigation.js | 4 ++--
app/controllers/users/settings_controller.rb | 4 ++--
db/schema.rb | 1 -
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/app/assets/javascripts/navigation.js b/app/assets/javascripts/navigation.js
index 3f5180507..ee335fdce 100644
--- a/app/assets/javascripts/navigation.js
+++ b/app/assets/javascripts/navigation.js
@@ -84,9 +84,9 @@
var teamSwitch = $('#team-switch');
teamSwitch
.find('.dropdown-menu a')
- .on('click', function(el){
+ .on('click', function(){
$('#user_current_organization_id')
- .val($(el.toElement).attr('data-id'));
+ .val($(this).attr('data-id'));
teamSwitch
.find('form')
diff --git a/app/controllers/users/settings_controller.rb b/app/controllers/users/settings_controller.rb
index 3194d4e89..2d301d3d9 100644
--- a/app/controllers/users/settings_controller.rb
+++ b/app/controllers/users/settings_controller.rb
@@ -446,7 +446,7 @@ class Users::SettingsController < ApplicationController
end
def reset_tutorial
- if @user.update(tutorial_status: 0) && params[:org][:id]
+ if @user.update(tutorial_status: 0) && params[:org][:id].present?
@user.update(current_organization_id: params[:org][:id])
cookies.delete :tutorial_data
cookies.delete :current_tutorial_step
@@ -496,7 +496,7 @@ class Users::SettingsController < ApplicationController
def user_current_organization
@user.current_organization_id = params[:user][:current_organization_id]
@changed_org = Organization.find_by_id(@user.current_organization_id)
- if @user.save
+ if params[:user][:current_organization_id].present? && @user.save
flash[:success] = t('users.settings.changed_org_flash',
team: @changed_org.name)
redirect_to root_path
diff --git a/db/schema.rb b/db/schema.rb
index ff7db4f13..9d3c132b9 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -664,7 +664,6 @@ ActiveRecord::Schema.define(version: 20161012112900) do
t.boolean "recent_notification", default: true
t.boolean "assignments_notification_email", default: false
t.boolean "recent_notification_email", default: false
- t.boolean "system_message_notification_email", default: false
t.integer "current_organization_id"
t.boolean "system_message_notification_email", default: false
end
From 76f6e30078e3f10bce470cfa0a9617210a1b156b Mon Sep 17 00:00:00 2001
From: zmagod
Date: Mon, 17 Oct 2016 15:36:33 +0200
Subject: [PATCH 17/17] fixes word-wrap on mozilla
---
app/assets/stylesheets/themes/scinote.scss | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss
index 962fa9598..fd4050810 100644
--- a/app/assets/stylesheets/themes/scinote.scss
+++ b/app/assets/stylesheets/themes/scinote.scss
@@ -565,6 +565,7 @@ a[data-toggle="tooltip"] {
li {
display: block;
text-align: left;
+ word-wrap: break-word;
&:hover {
background-color: $color-concrete;
@@ -572,8 +573,10 @@ a[data-toggle="tooltip"] {
a {
color: $color-emperor;
+ display: block;
line-height: 1.6em;
padding: 3px 20px;
+ text-align: left;
text-decoration: none;
word-wrap: break-word;
}