diff --git a/app/assets/stylesheets/constants.scss b/app/assets/stylesheets/constants.scss
index 00661294f..e22b9cccd 100644
--- a/app/assets/stylesheets/constants.scss
+++ b/app/assets/stylesheets/constants.scss
@@ -1,5 +1,3 @@
-@import url(https://fonts.googleapis.com/css?family=Lato:400,400i,700&subset=latin-ext);
-
//==============================================================================
// Colors
//==============================================================================
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index a926fae52..db89d7e6f 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -37,7 +37,7 @@ class ApplicationController < ActionController::Base
# Sets current team for all controllers
def current_team
- @current_team ||= Team.find_by(id: current_user.current_team_id)
+ @current_team ||= current_user.teams.find_by(id: current_user.current_team_id)
end
def to_user_date_format
@@ -83,13 +83,12 @@ class ApplicationController < ActionController::Base
private
def update_current_team
- @current_team = Team.find_by_id(current_user.current_team_id)
- if (current_team.nil? || !current_user.is_member_of_team?(current_team)) &&
- current_user.teams.count.positive?
+ return if current_team.present? && current_team.id == current_user.current_team_id
- current_user.update(
- current_team_id: current_user.teams.first.id
- )
+ if current_user.current_team_id
+ @current_team = current_user.teams.find_by(id: current_user.current_team_id)
+ elsif current_user.teams.any?
+ current_user.update(current_team_id: current_user.teams.first.id)
end
end
diff --git a/app/helpers/teams_helper.rb b/app/helpers/teams_helper.rb
index 87c8d0ffe..c5e69bfb1 100644
--- a/app/helpers/teams_helper.rb
+++ b/app/helpers/teams_helper.rb
@@ -1,7 +1,7 @@
module TeamsHelper
# resets the current team if needed
def current_team_switch(team)
- if team != current_team
+ if team != current_team && current_user.is_member_of_team?(team)
current_user.current_team_id = team.id
current_user.save
update_current_team
@@ -18,11 +18,7 @@ module TeamsHelper
end
end
- def team_created_by(team)
- User.find_by_id(team.created_by_id)
- end
-
def switch_team_with_param
- current_team_switch(Team.find_by(id: params[:team])) if params[:team]
+ current_team_switch(current_user.teams.find_by(id: params[:team])) if params[:team]
end
end
diff --git a/app/javascript/packs/fonts.js b/app/javascript/packs/fonts.js
new file mode 100644
index 000000000..9147247fb
--- /dev/null
+++ b/app/javascript/packs/fonts.js
@@ -0,0 +1 @@
+require('typeface-lato');
diff --git a/app/views/dashboards/show.html.erb b/app/views/dashboards/show.html.erb
index a4632c1d2..2c4a62741 100644
--- a/app/views/dashboards/show.html.erb
+++ b/app/views/dashboards/show.html.erb
@@ -1,8 +1,10 @@
<% provide :head_title, t('nav.label.dashboard') %>
-
- <%= render "calendar" %>
- <%= render "current_tasks" %>
- <%= render "recent_work" %>
- <%= render "quick_start" %>
-
+<% if current_team %>
+
+ <%= render "calendar" %>
+ <%= render "current_tasks" %>
+ <%= render "recent_work" %>
+ <%= render "quick_start" %>
+
+<% end %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 94e1ccacf..f83f49d62 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -17,6 +17,7 @@
<%= favicon_link_tag "favicon-16.png", type: "image/png", size: "16x16" %>
<%= favicon_link_tag "favicon-32.png", type: "image/png", size: "32x32" %>
<%= favicon_link_tag "favicon-48.png", type: "image/png", size: "48x48" %>
+ <%= stylesheet_pack_tag 'fonts' %>
<%= stylesheet_pack_tag 'fontawesome' %>
<%= csrf_meta_tags %>
diff --git a/app/views/users/settings/teams/show.html.erb b/app/views/users/settings/teams/show.html.erb
index 9b3e4cb10..4893123ed 100644
--- a/app/views/users/settings/teams/show.html.erb
+++ b/app/views/users/settings/teams/show.html.erb
@@ -44,7 +44,9 @@
<%= t("users.settings.teams.edit.header_created_by") %>
- <%= t("users.settings.teams.edit.header_created_by_name_email", name: team_created_by(@team).name, email: team_created_by(@team).email) %>
+
+ <%= t('users.settings.teams.edit.header_created_by_name_email', name: @team.created_by.full_name, email: @team.created_by.email) if @team.created_by %>
+
diff --git a/package.json b/package.json
index 29c6a78c9..f6156a50d 100644
--- a/package.json
+++ b/package.json
@@ -51,6 +51,7 @@
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@fortawesome/fontawesome-free": "^5.2.0",
+ "@joeattardi/emoji-button": "^2.5.4",
"@rails/webpacker": "^4.0.7",
"autoprefixer": "^7.2.6",
"axios": "0.18.1",
@@ -62,7 +63,6 @@
"compression-webpack-plugin": "^1.1.11",
"croppie": "^2.6.4",
"css-loader": "2.1.1",
- "@joeattardi/emoji-button": "^2.5.4",
"extract-text-webpack-plugin": "^3.0.2",
"fabric": "1.6.7",
"file-loader": "^4.0.0",
@@ -110,6 +110,7 @@
"tui-color-picker": "^2.2.0",
"tui-image-editor": "git://github.com/biosistemika/tui.image-editor",
"twemoji": "^12.1.4",
+ "typeface-lato": "^0.0.75",
"webpack": "^4.35.2",
"webpack-cli": "^3.3.5",
"webpack-manifest-plugin": "^1.3.2",
diff --git a/yarn.lock b/yarn.lock
index 7a880be43..efcafef82 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -9766,6 +9766,11 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
+typeface-lato@^0.0.75:
+ version "0.0.75"
+ resolved "https://registry.yarnpkg.com/typeface-lato/-/typeface-lato-0.0.75.tgz#8aa11c5611dc38416837c089b265a2abd1f7dd31"
+ integrity sha512-iA5uJD4PSTyIE4BDiSOexQeXkDkiJuX4Hu3wh3saJ06EB2TvJayab1Lbbmqq2je/LQv7KCQZHZmC0k4hedd8sw==
+
typescript-eslint-parser@^16.0.0:
version "16.0.1"
resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-16.0.1.tgz#b40681c7043b222b9772748b700a000b241c031b"