diff --git a/app/assets/stylesheets/components/LikeButton.scss b/app/assets/stylesheets/components/LikeButton.scss index b09e434e..025a0bfe 100644 --- a/app/assets/stylesheets/components/LikeButton.scss +++ b/app/assets/stylesheets/components/LikeButton.scss @@ -4,27 +4,15 @@ .flex-column, .mr-3; - $like_button_size: 11px; - - .likeButton { - @extend .mb-2; - - border-left: $like_button_size solid transparent; - border-right: $like_button_size solid transparent; - border-bottom: $like_button_size solid rgba(35,35,35,.2); - - &:hover { - border-bottom-color: var(--primary-color); - cursor: pointer; - } - } - - .likeButton.liked { - border-bottom-color: var(--primary-color); + .likeButton:hover { + cursor: pointer; + transform: scale(1.15); } .likeCountLabel { + @extend .mt-2; + text-align: center; - font-size: 17px; + font-size: 20px; } } \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 93e1aaa2..4ae46b93 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -19,6 +19,9 @@ class ApplicationController < ActionController::Base end def load_tenant_data + # Set default locale + I18n.locale = I18n.default_locale + current_tenant = get_tenant_from_request(request) return unless current_tenant @@ -38,7 +41,7 @@ class ApplicationController < ActionController::Base @tenant_billing = TenantBilling.first_or_create @boards = Board.select(:id, :name, :slug).order(order: :asc) - # Setup locale + # Set tenant locale I18n.locale = @tenant.locale end diff --git a/app/controllers/billing_controller.rb b/app/controllers/billing_controller.rb index 483b6867..bf2879bb 100644 --- a/app/controllers/billing_controller.rb +++ b/app/controllers/billing_controller.rb @@ -172,6 +172,7 @@ class BillingController < ApplicationController @tenant_setting = @tenant.tenant_setting @tenant_billing = @tenant.tenant_billing @boards = Board.select(:id, :name, :slug).order(order: :asc) + @header_full_urls = true I18n.locale = @tenant.locale # needed because signing out from 'billing' subdomain cause authenticity token error diff --git a/app/controllers/tenants_controller.rb b/app/controllers/tenants_controller.rb index 84084f6b..dbf97a5d 100644 --- a/app/controllers/tenants_controller.rb +++ b/app/controllers/tenants_controller.rb @@ -7,7 +7,7 @@ class TenantsController < ApplicationController def new @page_title = "Create your feedback space" - @o_auths = OAuth.unscoped.where(tenant_id: nil, is_enabled: true) + @o_auths = OAuth.unscoped.where(tenant_id: nil, is_enabled: true).order(created_at: :asc) end def show @@ -102,7 +102,7 @@ class TenantsController < ApplicationController # Given a new_subdomain # Returns true if it is available, false otherwise def is_available - subdomain = params[:new_subdomain] + subdomain = params[:new_subdomain].downcase return unless subdomain.present? return if RESERVED_SUBDOMAINS.include?(subdomain) diff --git a/app/javascript/components/Billing/Return.tsx b/app/javascript/components/Billing/Return.tsx index 109697ae..74ddcef8 100644 --- a/app/javascript/components/Billing/Return.tsx +++ b/app/javascript/components/Billing/Return.tsx @@ -44,7 +44,7 @@ const Return = ({ tenantBilling, homeUrl, billingUrl }: Props) => { if (status === 'complete') { return ( -

Success

+

Success!

Thank you for choosing Astuto! Your subscription will be activated shortly.

window.location.href = homeUrl} icon={}> diff --git a/app/javascript/components/LikeButton/LikeButtonP.tsx b/app/javascript/components/LikeButton/LikeButtonP.tsx index b5a6a344..1e3ab519 100644 --- a/app/javascript/components/LikeButton/LikeButtonP.tsx +++ b/app/javascript/components/LikeButton/LikeButtonP.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import { LikeIcon, SolidLikeIcon } from '../common/Icons'; interface Props { postId: number; @@ -35,6 +36,7 @@ const LikeButtonP = ({ className={`likeButton${liked ? ' liked' : ''}`} hidden={!showLikeButton} > + { liked ? : } { showLikeCount && {likeCount} } diff --git a/app/javascript/components/SiteSettings/Authentication/OAuthForm.tsx b/app/javascript/components/SiteSettings/Authentication/OAuthForm.tsx index 10e4d587..e2fd985a 100644 --- a/app/javascript/components/SiteSettings/Authentication/OAuthForm.tsx +++ b/app/javascript/components/SiteSettings/Authentication/OAuthForm.tsx @@ -119,6 +119,7 @@ const OAuthForm = ({ diff --git a/app/javascript/components/SiteSettings/General/GeneralSiteSettingsP.tsx b/app/javascript/components/SiteSettings/General/GeneralSiteSettingsP.tsx index 20aafa5f..bc436f1f 100644 --- a/app/javascript/components/SiteSettings/General/GeneralSiteSettingsP.tsx +++ b/app/javascript/components/SiteSettings/General/GeneralSiteSettingsP.tsx @@ -133,6 +133,7 @@ const GeneralSiteSettingsP = ({ diff --git a/app/javascript/components/TenantSignUp/TenantSignUpForm.tsx b/app/javascript/components/TenantSignUp/TenantSignUpForm.tsx index 78868509..7415619b 100644 --- a/app/javascript/components/TenantSignUp/TenantSignUpForm.tsx +++ b/app/javascript/components/TenantSignUp/TenantSignUpForm.tsx @@ -45,6 +45,9 @@ const TenantSignUpForm = ({
+
+
https://
+
diff --git a/app/javascript/components/common/Icons.tsx b/app/javascript/components/common/Icons.tsx index f0510978..8bb4dbef 100644 --- a/app/javascript/components/common/Icons.tsx +++ b/app/javascript/components/common/Icons.tsx @@ -9,6 +9,7 @@ import { MdContentCopy, MdDone, MdOutlineArrowBack } from 'react-icons/md'; import { GrTest, GrClearOption } from 'react-icons/gr'; import { MdOutlineLibraryBooks } from "react-icons/md"; import { MdVerified } from "react-icons/md"; +import { BiLike, BiSolidLike } from "react-icons/bi"; export const EditIcon = () => ; @@ -38,4 +39,8 @@ export const StaffIcon = () => ( ); -export const ClearIcon = () => ; \ No newline at end of file +export const ClearIcon = () => ; + +export const LikeIcon = ({size = 32}) => ; + +export const SolidLikeIcon = ({size = 32}) => ; \ No newline at end of file diff --git a/app/javascript/interfaces/IOAuth.ts b/app/javascript/interfaces/IOAuth.ts index 7eefdaf1..a97f45f9 100644 --- a/app/javascript/interfaces/IOAuth.ts +++ b/app/javascript/interfaces/IOAuth.ts @@ -14,7 +14,7 @@ export interface IOAuth { callbackUrl?: string; tenantId?: number; - defaultOAuthIsEnabled: boolean; + defaultOAuthIsEnabled?: boolean; } export interface IOAuthJSON { @@ -33,7 +33,7 @@ export interface IOAuthJSON { callback_url?: string; tenant_id?: string; - default_o_auth_is_enabled: boolean; + default_o_auth_is_enabled?: boolean; } export const oAuthJSON2JS = (oAuthJSON: IOAuthJSON): IOAuth => ({ diff --git a/app/javascript/translations/index.js.erb b/app/javascript/translations/index.js.erb index 30e94502..89b3aee1 100644 --- a/app/javascript/translations/index.js.erb +++ b/app/javascript/translations/index.js.erb @@ -2,6 +2,8 @@ import I18n from "i18n-js" I18n.translations = <%= I18n::JS.filtered_translations.to_json %> I18n.locale = LOCALE +I18n.defaultLocale = "en" +I18n.fallbacks = <%= Rails.env.production? ? true : false %> I18n.pluralization["zh-CN"] = function(count) { return ["other"] } I18n.pluralization["vi"] = function(count) { return ["other"] } diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 43e7e673..b129ce10 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -6,7 +6,13 @@ class ApplicationMailer < ActionMailer::Base def set_mail_from_for_multitenancy if Rails.application.multi_tenancy? - from = "#{Current.tenant_or_raise!.site_name} <#{ENV.fetch('EMAIL_MAIL_FROM', 'notifications@astuto.io')}>" + from = "#{Current.tenant.site_name} <#{ENV.fetch('EMAIL_MAIL_FROM', 'notifications@astuto.io')}>" + + # Set a specific 'from' for the Devise::Mailer#confirmation_instructions method on tenant signup + if self.class.name == "Devise::Mailer" && action_name == "confirmation_instructions" && Current.tenant.users.count == 1 + from = "Astuto <#{ENV.fetch('EMAIL_MAIL_FROM', 'notifications@astuto.io')}>" + end + mail.from = from end end diff --git a/app/mailers/tenant_mailer.rb b/app/mailers/tenant_mailer.rb index a297d5d1..b677b715 100644 --- a/app/mailers/tenant_mailer.rb +++ b/app/mailers/tenant_mailer.rb @@ -1,6 +1,7 @@ class TenantMailer < ApplicationMailer layout :choose_layout skip_after_action :set_mail_from_for_multitenancy + before_action :set_locale_to_english def trial_start(tenant:) @tenant = tenant @@ -20,7 +21,7 @@ class TenantMailer < ApplicationMailer @tenant = tenant Current.tenant = tenant - @trial_ends_at = tenant.tenant_billing.trial_ends_at + @trial_ends_at = tenant.tenant_billing.trial_ends_at.to_date mail( from: email_from_riccardo, @@ -62,7 +63,7 @@ class TenantMailer < ApplicationMailer @tenant = tenant Current.tenant = tenant - @subscription_ends_at = Current.tenant.tenant_billing.subscription_ends_at + @subscription_ends_at = Current.tenant.tenant_billing.subscription_ends_at.to_date mail( from: email_from_astuto, @@ -97,4 +98,8 @@ class TenantMailer < ApplicationMailer def choose_layout action_name == 'trial_mid' || action_name == 'trial_end' ? 'mailer_no_style' : 'mailer' end + + def set_locale_to_english + I18n.locale = :en + end end \ No newline at end of file diff --git a/app/models/user.rb b/app/models/user.rb index 70544ca7..8a0d05af 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -65,6 +65,14 @@ class User < ApplicationRecord "https://secure.gravatar.com/avatar/#{gravatar_id}" end + def full_name_or_email + if full_name.present? && full_name != I18n.t('defaults.user_full_name') && full_name != I18n.t('defaults.user_full_name', locale: 'en') + full_name + else + email + end + end + def owner? role == 'owner' end diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb index 0ff0fc36..9c0e09fa 100644 --- a/app/views/devise/mailer/confirmation_instructions.html.erb +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -1,6 +1,10 @@ -

<%= t('mailers.devise.welcome_greeting', email: @email, site_name: Current.tenant_or_raise!.site_name) %>

+

+ <%= t('mailers.devise.welcome_greeting', email: @email, site_name: Current.tenant.users.count == 1 ? "Astuto" : Current.tenant.site_name) %> +

-

<%= t('mailers.devise.confirmation_instructions.body') %>

+

+ <%= t('mailers.devise.confirmation_instructions.body') %> +

<%= link_to t('mailers.devise.confirmation_instructions.action'), diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 14f6ac35..79919931 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -66,3 +66,20 @@ method: :delete, class: "btn btn-danger btn-block" %>

+ +
+ +<% if Rails.application.multi_tenancy? && user_signed_in? && current_user.owner? %> +
+

Delete feedback space

+ +

+ Deleting the feedback space will also delete all the feedback and users associated with it. This action cannot be undone. +

+

+ If you want to delete the feedback space, please send an email to info@astuto.io from the email address associated with this feedback space. +

+
+<% end %> + +
\ No newline at end of file diff --git a/app/views/layouts/_boards_nav_section.html.erb b/app/views/layouts/_boards_nav_section.html.erb index a09c388b..db510c80 100644 --- a/app/views/layouts/_boards_nav_section.html.erb +++ b/app/views/layouts/_boards_nav_section.html.erb @@ -6,14 +6,14 @@ <% else %> <% boards.each do |board| %> <% end %> <% end %> \ No newline at end of file diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 1a03f680..5b06147e 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -1,7 +1,7 @@