From 40f7181c3f731ad0f4fe0e4c5c0939c6d131e334 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 1 Oct 2019 11:34:20 +0100 Subject: [PATCH 001/128] folder slug protection (for hkfx) and authentiable user call (for yearbook) --- app/controllers/droom/api/users_controller.rb | 8 ++++++++ app/models/droom/folder.rb | 17 +++++++++++++++-- app/serializers/droom/user_auth_serializer.rb | 1 - app/serializers/droom/user_serializer.rb | 8 +++++++- config/initializers/devise.rb | 2 +- config/routes.rb | 1 + 6 files changed, 32 insertions(+), 5 deletions(-) diff --git a/app/controllers/droom/api/users_controller.rb b/app/controllers/droom/api/users_controller.rb index 181f10cfb..001f50a3a 100644 --- a/app/controllers/droom/api/users_controller.rb +++ b/app/controllers/droom/api/users_controller.rb @@ -19,6 +19,14 @@ def whoami render json: current_user end + # This is a background call to get user information necessary for session creation. + # It usually happens on acceptable of an invitation, or some other situation where + # a remote object is triggering user confirmation or automatic login. + # + def authenticable + render json: @user, serializer: UserAuthSerializer + end + def update @user.update_attributes(user_params) render json: @user diff --git a/app/models/droom/folder.rb b/app/models/droom/folder.rb index f746190db..d9daeecc8 100644 --- a/app/models/droom/folder.rb +++ b/app/models/droom/folder.rb @@ -134,7 +134,7 @@ def distribute_confidentiality children.each {|folder| folder.set_confidentiality!(confidential?) } end - protected + protected def set_properties if holder @@ -143,7 +143,7 @@ def set_properties else self.name ||= holder.name end - self.slug ||= holder.slug + self.slug ||= unique_slug(holder.slug) end # folders originally only had slugs, so this happens from time to time self.name ||= self.slug @@ -151,5 +151,18 @@ def set_properties true end + # Precaution against slug-collision within parent folder scope. + # + def unique_slug(base) + slug = base + addendum = 0 + skope = parent ? parent.children : Folder.loose + while skope.find_by(slug: slug) + addendum += 1 + slug = "#{base}_#{addendum}" + end + slug + end + end end diff --git a/app/serializers/droom/user_auth_serializer.rb b/app/serializers/droom/user_auth_serializer.rb index 9b91dcd3a..b74a25377 100644 --- a/app/serializers/droom/user_auth_serializer.rb +++ b/app/serializers/droom/user_auth_serializer.rb @@ -17,7 +17,6 @@ class Droom::UserAuthSerializer < ActiveModel::Serializer :password_set, :images - def name object.colloquial_name end diff --git a/app/serializers/droom/user_serializer.rb b/app/serializers/droom/user_serializer.rb index 5c7130d1d..d2cf7933c 100644 --- a/app/serializers/droom/user_serializer.rb +++ b/app/serializers/droom/user_serializer.rb @@ -1,6 +1,12 @@ +# This is user as data object: all the fields we need to manage or present the user. +# It does not include authentication information. +# +# Also note btw that the address book is squashed down to one email, one phone and one mobile. +# We don't yet support remote management of all that detail, but users can update their listing, +# which has the effect of adding a new preferred address but not deleting the old. +# class Droom::UserSerializer < ActiveModel::Serializer attributes :uid, - :authentication_token, :status, :title, :given_name, diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 731623ae8..34294e61f 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -256,7 +256,7 @@ def user_deserialize(key) end # We used to set shared domain cookie on sign in here - # but it proved impossible, or anyway very unreliable, to try and do that after session_limitable had set its unique_session_id. + # but it proved impossible, or anyway very unreliable, to make sure that happened after session_limitable had set its unique_session_id. # so now the cookie is set or updated on every request, in an after_action. # Unset session id and shared domain cookie on sign out. diff --git a/config/routes.rb b/config/routes.rb index e77adc8ab..7105a812a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,6 +13,7 @@ resources :users do post 'reindex', on: :member, as: :reindex get "whoami" , on: :collection, as: :whoami + get "authenticable", on: :member, as: :authenticable end resources :events resources :venues From 3215b66ca8602a84f0142937ee045aba4dd6af98 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 1 Oct 2019 11:44:04 +0100 Subject: [PATCH 002/128] acts_as_list --- droom.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/droom.gemspec b/droom.gemspec index f66db296d..695c7fa64 100644 --- a/droom.gemspec +++ b/droom.gemspec @@ -20,6 +20,7 @@ Gem::Specification.new do |s| s.add_dependency "rails", "~> 5.2" s.add_dependency "responders" s.add_dependency "acts_as_tree" + s.add_dependency "acts_as_list" s.add_dependency "active_model_serializers" s.add_dependency "api-pagination" From dd63576b419b8dd18590051df46e6b40f6490b26 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 1 Oct 2019 12:12:13 +0100 Subject: [PATCH 003/128] routing authenticable --- config/routes.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/routes.rb b/config/routes.rb index 7105a812a..2737aa220 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -52,6 +52,7 @@ delete '/api/users/sign_out' => 'api/sessions#destroy', as: :api_sign_out get '/api/authenticate/:tok' => 'api/sessions#authenticate', as: 'authenticate' get '/api/deauthenticate/:tok' => 'api/sessions#deauthenticate', as: 'deauthenticate' + get '/api/users/authenticable/:id' => 'api/users#authenticable', as: 'authenticable' end resources :helps From 57623bd77fc49d308edb47c5a8b725e077054189 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 8 Oct 2019 10:23:39 +0100 Subject: [PATCH 004/128] Droom::UserAuthSerializer --- app/controllers/droom/api/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/droom/api/users_controller.rb b/app/controllers/droom/api/users_controller.rb index 001f50a3a..0ccdff189 100644 --- a/app/controllers/droom/api/users_controller.rb +++ b/app/controllers/droom/api/users_controller.rb @@ -24,7 +24,7 @@ def whoami # a remote object is triggering user confirmation or automatic login. # def authenticable - render json: @user, serializer: UserAuthSerializer + render json: @user, serializer: Droom::UserAuthSerializer end def update From ec2bb15ce0ed8cb07688ee1b59f5849707a549ce Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 8 Oct 2019 10:34:46 +0100 Subject: [PATCH 005/128] more ensure_unique_session_id! --- app/models/droom/user.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/droom/user.rb b/app/models/droom/user.rb index 26db3400e..6d46a7541 100644 --- a/app/models/droom/user.rb +++ b/app/models/droom/user.rb @@ -30,7 +30,8 @@ class User < Droom::DroomRecord accepts_nested_attributes_for :organisation before_validation :ensure_uid! - before_save :ensure_authentication_token + before_save :ensure_unique_session_id! + before_save :ensure_authentication_token! before_save :org_admin_if_alone after_save :send_confirmation_if_directed @@ -175,7 +176,7 @@ def authenticate_safely(attribute, token) Devise.secure_compare(send(attribute), token) end - def ensure_authentication_token + def ensure_authentication_token! if authentication_token.blank? self.authentication_token = generate_authentication_token end From 067e7b2d7cbed0856ad1029ceb383031d037d982 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 8 Oct 2019 10:42:08 +0100 Subject: [PATCH 006/128] cannot set_unique_session_id on creation so we do it before serialising for authentication --- app/controllers/droom/api/users_controller.rb | 1 + app/models/droom/user.rb | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/droom/api/users_controller.rb b/app/controllers/droom/api/users_controller.rb index 0ccdff189..2c92a7d14 100644 --- a/app/controllers/droom/api/users_controller.rb +++ b/app/controllers/droom/api/users_controller.rb @@ -24,6 +24,7 @@ def whoami # a remote object is triggering user confirmation or automatic login. # def authenticable + @user.ensure_unique_session_id! render json: @user, serializer: Droom::UserAuthSerializer end diff --git a/app/models/droom/user.rb b/app/models/droom/user.rb index 6d46a7541..2a006a1ee 100644 --- a/app/models/droom/user.rb +++ b/app/models/droom/user.rb @@ -30,7 +30,6 @@ class User < Droom::DroomRecord accepts_nested_attributes_for :organisation before_validation :ensure_uid! - before_save :ensure_unique_session_id! before_save :ensure_authentication_token! before_save :org_admin_if_alone after_save :send_confirmation_if_directed From 3d375d5c51f041a906f28681ac920bfeaaecea70 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 8 Oct 2019 11:41:59 +0100 Subject: [PATCH 007/128] more steps to avoid authentication requirement on authentication step --- app/controllers/droom/api/sessions_controller.rb | 9 ++++++--- app/controllers/droom/concerns/controller_helpers.rb | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/droom/api/sessions_controller.rb b/app/controllers/droom/api/sessions_controller.rb index 1f1770007..96090afc3 100644 --- a/app/controllers/droom/api/sessions_controller.rb +++ b/app/controllers/droom/api/sessions_controller.rb @@ -3,6 +3,7 @@ class SessionsController < Devise::SessionsController include Droom::Concerns::LocalApi respond_to :json + skip_before_action :authenticate_user!, raise: false skip_before_action :verify_authenticity_token, raise: false before_action :set_access_control_headers @@ -22,9 +23,9 @@ def create end # This is called on every request by a remote service. - # Lots of care has to be taken here, to respond quickly but lapse correctly, + # Care has to be taken here, to respond quickly but lapse correctly, # and never to set up a cascade of mutual enquiry. - # also must make sure that we check, not sign in. Signing in will create a new session id... + # also must make sure that we check, *not sign in*, as signing in would create a new session id. # def authenticate token = params[:tok] @@ -62,10 +63,12 @@ def deauthenticate end end - def api_controller? true end + def devise_controller? + true + end end end \ No newline at end of file diff --git a/app/controllers/droom/concerns/controller_helpers.rb b/app/controllers/droom/concerns/controller_helpers.rb index b3a0f36e7..8f23dd8bc 100644 --- a/app/controllers/droom/concerns/controller_helpers.rb +++ b/app/controllers/droom/concerns/controller_helpers.rb @@ -20,7 +20,7 @@ module Droom::Concerns::ControllerHelpers before_action :check_user_is_confirmed, except: [:cors_check, :setup], unless: :devise_controller? before_action :check_user_setup, except: [:cors_check, :setup], unless: :devise_controller? before_action :check_user_has_organisation, except: [:cors_check, :setup_organisation], unless: :devise_controller? - before_action :check_data_room_permission, except: [:cors_check, :set_password] + before_action :check_data_room_permission, except: [:cors_check, :set_password], unless: :devise_controller? before_action :note_current_user, except: [:cors_check] before_action :set_section, except: [:cors_check] From d16754777924d97ce5aa99067c37a07286fa8642 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 8 Oct 2019 13:07:19 +0100 Subject: [PATCH 008/128] more debugging lines --- app/controllers/droom/api/sessions_controller.rb | 2 +- app/controllers/droom/concerns/controller_helpers.rb | 2 ++ app/models/droom/user.rb | 2 ++ config/initializers/devise.rb | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/droom/api/sessions_controller.rb b/app/controllers/droom/api/sessions_controller.rb index 96090afc3..3ddec5bfa 100644 --- a/app/controllers/droom/api/sessions_controller.rb +++ b/app/controllers/droom/api/sessions_controller.rb @@ -3,7 +3,7 @@ class SessionsController < Devise::SessionsController include Droom::Concerns::LocalApi respond_to :json - skip_before_action :authenticate_user!, raise: false + # skip_before_action :authenticate_user!, raise: false skip_before_action :verify_authenticity_token, raise: false before_action :set_access_control_headers diff --git a/app/controllers/droom/concerns/controller_helpers.rb b/app/controllers/droom/concerns/controller_helpers.rb index 8f23dd8bc..d1494c4ec 100644 --- a/app/controllers/droom/concerns/controller_helpers.rb +++ b/app/controllers/droom/concerns/controller_helpers.rb @@ -121,8 +121,10 @@ def check_data_room_permission # def update_auth_cookie if user_signed_in? && current_user.unique_session_id? + Rails.logger.warn "✅ update_auth_cookie" Droom::AuthCookie.new(warden.cookies).set(current_user) else + Rails.logger.warn "⚠️ update_auth_cookie unsetting" Droom::AuthCookie.new(warden.cookies).unset end end diff --git a/app/models/droom/user.rb b/app/models/droom/user.rb index 2a006a1ee..941e8e5c5 100644 --- a/app/models/droom/user.rb +++ b/app/models/droom/user.rb @@ -152,6 +152,7 @@ def reset_session_ids! end def clear_session_ids! + Rails.logger.warn "⚠️ clear_session_ids!" self.update_columns({ session_id: "", unique_session_id: "" @@ -184,6 +185,7 @@ def ensure_authentication_token! def ensure_unique_session_id! unless unique_session_id.present? + Rails.logger.warn "✅ calling update_unique_session_id!" update_unique_session_id!(Devise.friendly_token) end unique_session_id diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 34294e61f..158378f7b 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -262,6 +262,7 @@ def user_deserialize(key) # Unset session id and shared domain cookie on sign out. # Warden::Manager.before_logout do |user, warden, options| + Rails.logger.warn "⚠️ Warden logout is unsetting" user.clear_session_ids! if user Droom::AuthCookie.new(warden.cookies).unset end From ac2b46bb273264f18d7e8afc9a95dd78b12cbf35 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 8 Oct 2019 13:32:39 +0100 Subject: [PATCH 009/128] more debugging lines --- app/controllers/droom/concerns/controller_helpers.rb | 4 ++-- config/initializers/devise.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/droom/concerns/controller_helpers.rb b/app/controllers/droom/concerns/controller_helpers.rb index d1494c4ec..a38b239ea 100644 --- a/app/controllers/droom/concerns/controller_helpers.rb +++ b/app/controllers/droom/concerns/controller_helpers.rb @@ -121,10 +121,10 @@ def check_data_room_permission # def update_auth_cookie if user_signed_in? && current_user.unique_session_id? - Rails.logger.warn "✅ update_auth_cookie" + Rails.logger.warn "✅ setting auth_cookie after #{request.fullpath}" Droom::AuthCookie.new(warden.cookies).set(current_user) else - Rails.logger.warn "⚠️ update_auth_cookie unsetting" + Rails.logger.warn "⚠️ unsetting auth_cookie after #{request.fullpath}" Droom::AuthCookie.new(warden.cookies).unset end end diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 158378f7b..29397ff56 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -262,7 +262,7 @@ def user_deserialize(key) # Unset session id and shared domain cookie on sign out. # Warden::Manager.before_logout do |user, warden, options| - Rails.logger.warn "⚠️ Warden logout is unsetting" + Rails.logger.warn "⚠️ Warden logout is unsetting after #{warden.request.fullpath}" user.clear_session_ids! if user Droom::AuthCookie.new(warden.cookies).unset end From 01d62db38af22b7e3344c2b00973611817a376e9 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 8 Oct 2019 13:42:10 +0100 Subject: [PATCH 010/128] don't do auth_cooking on cors check. d'oh --- app/controllers/droom/concerns/controller_helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/droom/concerns/controller_helpers.rb b/app/controllers/droom/concerns/controller_helpers.rb index a38b239ea..39f1bdd91 100644 --- a/app/controllers/droom/concerns/controller_helpers.rb +++ b/app/controllers/droom/concerns/controller_helpers.rb @@ -27,7 +27,7 @@ module Droom::Concerns::ControllerHelpers before_action :set_access_control_headers skip_before_action :verify_authenticity_token, only: [:cors_check], raise: false - after_action :update_auth_cookie, unless: :api_controller? + after_action :update_auth_cookie, except: [:cors_check], unless: :api_controller? layout :no_layout_if_pjax end From 0617dcb02da59397ea0ca237fe0f3a0b69d21348 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 8 Oct 2019 14:01:55 +0100 Subject: [PATCH 011/128] more debugging lines --- app/controllers/droom/concerns/controller_helpers.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/controllers/droom/concerns/controller_helpers.rb b/app/controllers/droom/concerns/controller_helpers.rb index 39f1bdd91..4f7c26d85 100644 --- a/app/controllers/droom/concerns/controller_helpers.rb +++ b/app/controllers/droom/concerns/controller_helpers.rb @@ -32,6 +32,7 @@ module Droom::Concerns::ControllerHelpers layout :no_layout_if_pjax end + # Usually overridden in a base ApiController # def api_controller? @@ -148,6 +149,7 @@ def set_exception_context ## Error responses # def not_authorized(exception) + Rails.logger.warn "⚠️ not_authorized" respond_to do |format| format.html { render :file => "#{Rails.root}/public/401.html", :status => :forbidden, :layout => false } format.js { head :unauthorized } @@ -156,6 +158,7 @@ def not_authorized(exception) end def not_allowed(exception) + Rails.logger.warn "⚠️ not_allowed" respond_to do |format| format.html { render :file => "#{Rails.root}/public/403.html", :status => :forbidden, :layout => false } format.js { head :forbidden } @@ -164,6 +167,7 @@ def not_allowed(exception) end def not_found(exception) + Rails.logger.warn "⚠️ not_found" @error = exception.message Honeybadger.notify(exception) respond_to do |format| @@ -185,6 +189,7 @@ def check_user_is_confirmed end def prompt_for_confirmation + Rails.logger.warn "⚠️ prompt_for_confirmation" render template: "/devise/registrations/confirm", locals: {resource: current_user} end @@ -196,6 +201,7 @@ def check_user_setup end def prompt_for_setup + Rails.logger.warn "⚠️ prompt_for_setup" render template: "/droom/users/setup", locals: {user: current_user} end @@ -212,11 +218,13 @@ def check_user_has_organisation end def prompt_for_organisation + Rails.logger.warn "⚠️ prompt_for_organisation" @organisations = Droom::Organisation.matching_email(current_user.email) render template: "/droom/users/setup_organisation" end def await_organisation_approval + Rails.logger.warn "⚠️ await_organisation_approval" @organisations = Droom::Organisation.matching_email(current_user.email) render template: "/droom/users/await_organisation_approval" end From dd2ecce51ae5602f19bddd1d8cdaf70a9d5806b4 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 8 Oct 2019 14:39:11 +0100 Subject: [PATCH 012/128] still looking for rogue logout in fragments controller --- config/initializers/devise.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 29397ff56..594f0de08 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -263,6 +263,7 @@ def user_deserialize(key) # Warden::Manager.before_logout do |user, warden, options| Rails.logger.warn "⚠️ Warden logout is unsetting after #{warden.request.fullpath}" + byebug user.clear_session_ids! if user Droom::AuthCookie.new(warden.cookies).unset end From 53edd66fab232168d2df04ce5cd83b82c55e6215 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 8 Oct 2019 16:08:37 +0100 Subject: [PATCH 013/128] debug a little less, then --- config/initializers/devise.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 594f0de08..34294e61f 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -262,8 +262,6 @@ def user_deserialize(key) # Unset session id and shared domain cookie on sign out. # Warden::Manager.before_logout do |user, warden, options| - Rails.logger.warn "⚠️ Warden logout is unsetting after #{warden.request.fullpath}" - byebug user.clear_session_ids! if user Droom::AuthCookie.new(warden.cookies).unset end From 8484c3dd64f91c3b4af5887d547f7bd03d83b8fa Mon Sep 17 00:00:00 2001 From: will-r Date: Wed, 9 Oct 2019 15:25:40 +0100 Subject: [PATCH 014/128] confirmation not absolute requirement for users outside data room, eg applicants who haven't confirmed yet --- app/models/droom/user.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/droom/user.rb b/app/models/droom/user.rb index 941e8e5c5..023e1fd2e 100644 --- a/app/models/droom/user.rb +++ b/app/models/droom/user.rb @@ -79,6 +79,12 @@ def defer_confirmation? defer_confirmation && defer_confirmation != "false" end + # For users of peripheral services we can leave it up to them to require or offer confirmation. + # + def confirmation_required? + !confirmed? && data_room_user? + end + # send_confirmation? is called after save by our own later confirmation mechanism. # If the send_confirmation flag has been set, we confirm. # From 4046a1de01f3e8a1efe7315816ab13a7c39f1c66 Mon Sep 17 00:00:00 2001 From: will-r Date: Thu, 10 Oct 2019 10:32:25 +0100 Subject: [PATCH 015/128] folder should not use Slugged concern because slug has runtime scope requirements --- app/models/droom/calendar.rb | 2 +- app/models/droom/folder.rb | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/models/droom/calendar.rb b/app/models/droom/calendar.rb index 6a7c0d706..be774d10c 100644 --- a/app/models/droom/calendar.rb +++ b/app/models/droom/calendar.rb @@ -1,7 +1,7 @@ module Droom class Calendar < Droom::DroomRecord include Droom::Concerns::Slugged - + belongs_to :created_by, :class_name => "Droom::User" has_many :events diff --git a/app/models/droom/folder.rb b/app/models/droom/folder.rb index d9daeecc8..16ec663ae 100644 --- a/app/models/droom/folder.rb +++ b/app/models/droom/folder.rb @@ -1,7 +1,7 @@ module Droom class Folder < Droom::DroomRecord include ActsAsTree - include Droom::Concerns::Slugged + # don't use Slugged: we need to apply a dynamic parent scope. belongs_to :created_by, :class_name => "Droom::User" belongs_to :holder, :polymorphic => true @@ -9,11 +9,9 @@ class Folder < Droom::DroomRecord has_many :personal_folders, :dependent => :destroy acts_as_tree :order => "droom_folders.name ASC" + before_validation :set_properties validates :slug, :presence => true, :uniqueness => { :scope => :parent_id } - before_validation :set_properties - before_validation :slug_from_name - default_scope -> { includes(:documents) } scope :all_private, -> { where("#{table_name}.private = 1") } @@ -21,7 +19,10 @@ class Folder < Droom::DroomRecord scope :all_public, -> { where("#{table_name}.public = 1 AND #{table_name}.private <> 1 OR #{table_name}.private IS NULL") } scope :not_public, -> { where("#{table_name}.public <> 1 OR #{table_name}.private = 1)") } scope :by_name, -> { order("#{table_name}.name ASC") } - scope :other_than, -> folders {where.not(id: folders.map(&:id))} + scope :other_than, -> folders { + folders = [folders].flatten + where.not(id: folders.map(&:id)) + } scope :visible_to, -> user { if user select('droom_folders.*') @@ -143,21 +144,24 @@ def set_properties else self.name ||= holder.name end - self.slug ||= unique_slug(holder.slug) + self.slug ||= holder.slug end - # folders originally only had slugs, so this happens from time to time + + # pass new or existing slug through uniqueness check as it may have come from user or holder + base = slug.presence || name || "Folder" + self.slug = unique_slug(base) + + # folders originally only had slugs, so this could happen too self.name ||= self.slug - self.public = !holder && (!parent || parent.public?) - true end - # Precaution against slug-collision within parent folder scope. + # Protect against slug-collision within parent folder scope. # def unique_slug(base) slug = base addendum = 0 skope = parent ? parent.children : Folder.loose - while skope.find_by(slug: slug) + while skope.other_than(self).find_by(slug: slug) addendum += 1 slug = "#{base}_#{addendum}" end From 16702de280ed52647cf75ffe19d33d716fe6167a Mon Sep 17 00:00:00 2001 From: will-r Date: Fri, 11 Oct 2019 11:33:34 +0100 Subject: [PATCH 016/128] restore past-events and events-by-year links to main calendar view --- app/models/droom/user.rb | 2 +- app/views/droom/dashboard/_past_events.haml | 2 +- app/views/droom/events/_shortcuts.html.haml | 9 +++++++++ app/views/droom/events/index.html.haml | 8 +++++--- 4 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 app/views/droom/events/_shortcuts.html.haml diff --git a/app/models/droom/user.rb b/app/models/droom/user.rb index 023e1fd2e..d16e14faa 100644 --- a/app/models/droom/user.rb +++ b/app/models/droom/user.rb @@ -862,7 +862,7 @@ def subsume(other_user) def subsume!(other_user) Droom::User.transaction do - %w{emails phones addresses memberships organisations scraps documents invitations memberships user_permissions dropbox_tokens dropbox_documents personal_folders}.each do |association| + %w{emails phones addresses memberships scraps documents invitations memberships user_permissions dropbox_tokens dropbox_documents personal_folders}.each do |association| self.send(association.to_sym) << other_user.send(association.to_sym) end %w{encrypted_password password_salt family_name given_name chinese_name title gender organisation_id description image}.each do |property| diff --git a/app/views/droom/dashboard/_past_events.haml b/app/views/droom/dashboard/_past_events.haml index 29c0a30b1..2d612a2ce 100644 --- a/app/views/droom/dashboard/_past_events.haml +++ b/app/views/droom/dashboard/_past_events.haml @@ -6,7 +6,7 @@ %section #past_events %h2.section - = link_to main_app.calendar_url do + = link_to droom.past_events_url do = t(:recent_events) - if calendar.events.past.count > 5 %span.addendum diff --git a/app/views/droom/events/_shortcuts.html.haml b/app/views/droom/events/_shortcuts.html.haml new file mode 100644 index 000000000..30f0bd024 --- /dev/null +++ b/app/views/droom/events/_shortcuts.html.haml @@ -0,0 +1,9 @@ +- years = Droom::Event.pluck(:start).compact.map(&:year).uniq.sort.reverse + +%p.navigation + = link_to_unless_current "Future events", droom.events_url + \| + = link_to_unless_current "Past events", droom.past_events_url + - years.each do |y| + \| + = link_to_unless_current y, events_url(year: y) diff --git a/app/views/droom/events/index.html.haml b/app/views/droom/events/index.html.haml index 545164d20..7bc21556c 100644 --- a/app/views/droom/events/index.html.haml +++ b/app/views/droom/events/index.html.haml @@ -1,6 +1,3 @@ -#calendar - = render :partial => 'events' - - content_for :title do - if @year = t(:events_in, period: @year) @@ -13,3 +10,8 @@ = render :partial => "droom/shared/calendar_holder" = render :partial => "droom/invitations/invitations" = render :partial => "droom/events/scrap_events" + + +#calendar + = render :partial => 'shortcuts' + = render :partial => 'events' From 53442cb51d4bb8e1a1ffd01c5dea768809ecf220 Mon Sep 17 00:00:00 2001 From: will-r Date: Thu, 17 Oct 2019 06:56:59 +0100 Subject: [PATCH 017/128] logic fix in user.internal? --- app/models/droom/ability.rb | 2 +- app/models/droom/document.rb | 2 ++ app/models/droom/user.rb | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/droom/ability.rb b/app/models/droom/ability.rb index 0d2d26c6d..eb4c12eae 100644 --- a/app/models/droom/ability.rb +++ b/app/models/droom/ability.rb @@ -25,7 +25,7 @@ def initialize(user) if !Droom.require_internal_organisation? || user.internal? - if !Droom.require_login_permission? || user.permitted?('droom.login') + if user.data_room_user? can :read, :dashboard can :read, Droom::Event can :read, Droom::Scrap diff --git a/app/models/droom/document.rb b/app/models/droom/document.rb index d18ed352e..602f6959e 100644 --- a/app/models/droom/document.rb +++ b/app/models/droom/document.rb @@ -45,6 +45,8 @@ class Document < Droom::DroomRecord scope :latest, -> limit { order("droom_documents.updated_at DESC, droom_documents.created_at DESC").limit(limit) } + scope :unindexed, -> { where(indexed_at: nil) } + def attach_to(holder) self.folder = holder.folder end diff --git a/app/models/droom/user.rb b/app/models/droom/user.rb index d16e14faa..b4ac45f08 100644 --- a/app/models/droom/user.rb +++ b/app/models/droom/user.rb @@ -237,7 +237,7 @@ def external? end def internal? - !organisation && !organisation.external? + organisation && !organisation.external? end From 47c513d206b69ee09993f53baf69fac694fb2c5c Mon Sep 17 00:00:00 2001 From: will-r Date: Fri, 8 Nov 2019 10:30:56 +0000 Subject: [PATCH 018/128] noticeboard fixes --- app/assets/javascripts/droom.js.coffee | 6 +++++- app/assets/javascripts/droom/grid.js.coffee | 15 +++++++++++---- app/models/droom/document.rb | 1 + app/views/droom/scraps/index.html.haml | 5 ++++- app/views/droom/scraps/notices/_image.html.haml | 11 +++++------ node_modules/.yarn-integrity | 6 +++--- package.json | 2 +- yarn.lock | 2 +- 8 files changed, 31 insertions(+), 17 deletions(-) diff --git a/app/assets/javascripts/droom.js.coffee b/app/assets/javascripts/droom.js.coffee index 01c52f921..2ba063631 100644 --- a/app/assets/javascripts/droom.js.coffee +++ b/app/assets/javascripts/droom.js.coffee @@ -8,6 +8,7 @@ #= require sortablejs/Sortable #= require jquery.cookie/jquery.cookie #= require ep-jquery-tokeninput/src/jquery.tokeninput +#= require imagesloaded/imagesloaded.pkgd #= require droom/lib/jquery.datepicker #= require droom/lib/jquery.animate-colors @@ -116,8 +117,11 @@ jQuery ($) -> @find_including_self('.sortable_files').sortable_files() @find_including_self('[data-draggable]').draggable() @find_including_self('.gridbox:not(.notice)').gridBox() - @find_including_self('.notice').notice() @find_including_self('.tagger').tagger() @find_including_self('form.search.quick').quick_search_form() + @find_including_self('#noticeboard').imagesLoaded => + console.log "imagesLoaded ", @ + $('.notice').notice() + @ diff --git a/app/assets/javascripts/droom/grid.js.coffee b/app/assets/javascripts/droom/grid.js.coffee index e6feecc9d..0dc918109 100644 --- a/app/assets/javascripts/droom/grid.js.coffee +++ b/app/assets/javascripts/droom/grid.js.coffee @@ -5,12 +5,19 @@ $.fn.autoGrid = -> $.fn.gridBox = -> @each -> $el = $(@) - contents = $el.find('.content') row = 20 space = 20 - rows_touched = Math.ceil(contents.outerHeight() / (row + space)) - $el.css "grid-row-end", "span #{rows_touched}" - $el.addClass('ready') + sizer = -> + contents = $el.find('.content') + console.log "sizer!", contents, contents.outerHeight() + rows_touched = Math.ceil(contents.outerHeight() / (row + space)) + 2 + $el.css "grid-row-end", "span #{rows_touched}" + $el.addClass('ready') + sizer() + $el.find('img').on 'load', => + console.log "resizer!" + sizer() + $.fn.highlight = -> if @offset() diff --git a/app/models/droom/document.rb b/app/models/droom/document.rb index 602f6959e..08b7e05a1 100644 --- a/app/models/droom/document.rb +++ b/app/models/droom/document.rb @@ -178,6 +178,7 @@ def update_index! self.update_column(:indexed_at, Time.now) self.updating_index = false end + true end def updating_index? diff --git a/app/views/droom/scraps/index.html.haml b/app/views/droom/scraps/index.html.haml index 595db1f6f..49cc14ccd 100644 --- a/app/views/droom/scraps/index.html.haml +++ b/app/views/droom/scraps/index.html.haml @@ -4,5 +4,8 @@ - content_for :standfirst do = render :partial => "noticeboard_introduction" -= render :partial => "noticeboard" + - if can? :create, Droom::Scrap + %p.admin + = link_to t(:add_notice), droom.new_scrap_url, :class => "add", :remote => true, :data => {:action => "popup", :type => "html", :affected => "#noticeboard"} += render :partial => "noticeboard" diff --git a/app/views/droom/scraps/notices/_image.html.haml b/app/views/droom/scraps/notices/_image.html.haml index e16048e8f..1a527a9bf 100644 --- a/app/views/droom/scraps/notices/_image.html.haml +++ b/app/views/droom/scraps/notices/_image.html.haml @@ -1,8 +1,7 @@ -- if notice.url? - = link_to notice.url_with_protocol do - %img{src: notice.image.url(:notice)} -- else - %img{src: notice.image.url(:notice)} - .content + - if notice.url? + = link_to notice.url_with_protocol do + %img{src: notice.image.url(:notice)} + - else + %img{src: notice.image.url(:notice)} = render "droom/scraps/notices/body", notice: notice, caption_limit: 300 \ No newline at end of file diff --git a/node_modules/.yarn-integrity b/node_modules/.yarn-integrity index 8901bd844..fac457aa4 100644 --- a/node_modules/.yarn-integrity +++ b/node_modules/.yarn-integrity @@ -1,5 +1,5 @@ { - "systemParams": "darwin-x64-72", + "systemParams": "darwin-x64-64", "modulesFolders": [ "node_modules" ], @@ -13,7 +13,7 @@ "clipboard@^2.0.0", "ep-jquery-tokeninput@^1.8.10", "honeybadger@^1.3.0", - "imagesloaded@^4.1.3", + "imagesloaded@^4.1.4", "jquery-circle-progress@^1.2.2", "jquery-deserialize@^2.0.0-rc1", "jquery.cookie@^1.4.1", @@ -68,7 +68,7 @@ "har-validator@~5.0.3": "https://registry.yarnpkg.com/har-validator/-/har-validator-5.0.3.tgz#ba402c266194f15956ef15e0fcf242993f6a7dfd", "honeybadger@^1.3.0": "https://registry.yarnpkg.com/honeybadger/-/honeybadger-1.3.0.tgz#e9f01314d52a26a6d615d65485a0a4d4e50ec8f8", "http-signature@~1.2.0": "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1", - "imagesloaded@^4.1.3": "https://registry.yarnpkg.com/imagesloaded/-/imagesloaded-4.1.4.tgz#1376efcd162bb768c34c3727ac89cc04051f3cc7", + "imagesloaded@^4.1.4": "https://registry.yarnpkg.com/imagesloaded/-/imagesloaded-4.1.4.tgz#1376efcd162bb768c34c3727ac89cc04051f3cc7", "is-typedarray@~1.0.0": "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a", "isstream@~0.1.2": "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a", "jquery-circle-progress@^1.2.2": "https://registry.yarnpkg.com/jquery-circle-progress/-/jquery-circle-progress-1.2.2.tgz#260e9130ac8e2b5572eaa7a93b9e8a6b27bc8eea", diff --git a/package.json b/package.json index ea422b054..ca250355c 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "clipboard": "^2.0.0", "ep-jquery-tokeninput": "^1.8.10", "honeybadger": "^1.3.0", - "imagesloaded": "^4.1.3", + "imagesloaded": "^4.1.4", "jquery": "^3.2.1", "jquery-circle-progress": "^1.2.2", "jquery-deserialize": "^2.0.0-rc1", diff --git a/yarn.lock b/yarn.lock index 080f21d3d..851e6d47e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -227,7 +227,7 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" -imagesloaded@^4.1.3: +imagesloaded@^4.1.4: version "4.1.4" resolved "https://registry.yarnpkg.com/imagesloaded/-/imagesloaded-4.1.4.tgz#1376efcd162bb768c34c3727ac89cc04051f3cc7" integrity sha512-ltiBVcYpc/TYTF5nolkMNsnREHW+ICvfQ3Yla2Sgr71YFwQ86bDwV9hgpFhFtrGPuwEx5+LqOHIrdXBdoWwwsA== From f8d45ed1d6159f8e6d631f0f4b7d37ddd82437b7 Mon Sep 17 00:00:00 2001 From: Kiru Karki Date: Thu, 9 Jan 2020 11:55:29 +0630 Subject: [PATCH 019/128] Use 403 as the unauthorized template --- app/controllers/droom/concerns/controller_helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/droom/concerns/controller_helpers.rb b/app/controllers/droom/concerns/controller_helpers.rb index 4f7c26d85..3939075a5 100644 --- a/app/controllers/droom/concerns/controller_helpers.rb +++ b/app/controllers/droom/concerns/controller_helpers.rb @@ -151,7 +151,7 @@ def set_exception_context def not_authorized(exception) Rails.logger.warn "⚠️ not_authorized" respond_to do |format| - format.html { render :file => "#{Rails.root}/public/401.html", :status => :forbidden, :layout => false } + format.html { render :file => "#{Rails.root}/public/403.html", :status => :forbidden, :layout => false } format.js { head :unauthorized } format.json { head :unauthorized } end From be3ca09de29a554bf3ac2aa79c3ab7cd128d757c Mon Sep 17 00:00:00 2001 From: Kiru Karki Date: Fri, 10 Jan 2020 20:17:31 +0630 Subject: [PATCH 020/128] Do not check mail-man db --- app/models/droom/mailing_list_membership.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/models/droom/mailing_list_membership.rb b/app/models/droom/mailing_list_membership.rb index 5bb736193..dbdc13bd0 100644 --- a/app/models/droom/mailing_list_membership.rb +++ b/app/models/droom/mailing_list_membership.rb @@ -71,12 +71,12 @@ class MailingListMembership < Droom::DroomRecord # # If no such connection is defined, we will use the local `droom_mailing_list_memberships` table. # - begin - establish_connection :"mailman_#{Rails.env}" - set_table_name Droom.mailman_table_name - rescue ActiveRecord::AdapterNotSpecified - Rails.logger.warn "Droom: No mailman connection configured. Using #{Rails.env} database." - end + # begin + # establish_connection :"mailman_#{Rails.env}" + # set_table_name Droom.mailman_table_name + # rescue ActiveRecord::AdapterNotSpecified + # Rails.logger.warn "Droom: No mailman connection configured. Using #{Rails.env} database." + # end ## Associations # @@ -111,8 +111,8 @@ class MailingListMembership < Droom::DroomRecord private def set_defaults - self.bi_lastnotice = 0 - self.bi_date = 0 + self.bi_lastnotice = '0000-00-00' + self.bi_date = '0000-00-00' self.ack = true self.nomail = !Droom.mailing_lists_active_by_default? self.digest = Droom.mailing_lists_digest_by_default? From 2209e688370966abe0da5f2137f4550b56faae3d Mon Sep 17 00:00:00 2001 From: will-r Date: Wed, 15 Jan 2020 12:19:23 +0000 Subject: [PATCH 021/128] touch user request_at on remote authentication: usual mechanism doesn't work here as it's a devise controller --- app/controllers/droom/api/sessions_controller.rb | 1 + app/controllers/droom/api/users_controller.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/droom/api/sessions_controller.rb b/app/controllers/droom/api/sessions_controller.rb index 3ddec5bfa..f2223f8e3 100644 --- a/app/controllers/droom/api/sessions_controller.rb +++ b/app/controllers/droom/api/sessions_controller.rb @@ -39,6 +39,7 @@ def authenticate render json: { errors: "Session timed out" }, status: :unauthorized else bypass_sign_in @user + @user.set_last_request_at! render json: @user, serializer: Droom::UserAuthSerializer end else diff --git a/app/controllers/droom/api/users_controller.rb b/app/controllers/droom/api/users_controller.rb index 2c92a7d14..5cc335e51 100644 --- a/app/controllers/droom/api/users_controller.rb +++ b/app/controllers/droom/api/users_controller.rb @@ -19,7 +19,7 @@ def whoami render json: current_user end - # This is a background call to get user information necessary for session creation. + # This is a background call to request the user information necessary for session creation. # It usually happens on acceptable of an invitation, or some other situation where # a remote object is triggering user confirmation or automatic login. # From 82754d1e780585088ca69334fe117bc8288043ee Mon Sep 17 00:00:00 2001 From: will-r Date: Wed, 15 Jan 2020 15:01:51 +0000 Subject: [PATCH 022/128] form widget updates from CDR --- .../javascripts/droom/widgets.js.coffee | 58 +++++++++++-------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/app/assets/javascripts/droom/widgets.js.coffee b/app/assets/javascripts/droom/widgets.js.coffee index c0ef0b8e2..a7b368252 100644 --- a/app/assets/javascripts/droom/widgets.js.coffee +++ b/app/assets/javascripts/droom/widgets.js.coffee @@ -4,20 +4,32 @@ jQuery ($) -> + # The date_picker uses a lightly customised version of jquery.datepicker to present a nice year/month/day interface + # below a date field that can also be filled in manually. The format is always dd-mm-yyyy. + # $.fn.date_picker = ()-> @each -> new DatePicker(@) class DatePicker @month_names: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + constructor: (element) -> @_container = $(element) + view = @_container.attr("data-view") ? 'days' if @_container.is("input") @_field = @_container - event = 'focus' + @_container = @_field.clone().attr('name', 'display-date').insertAfter(@_field) + if iso_date = @_field.val() + [y,m,d] = iso_date.split('-') + @_container.val [d, DatePicker.month_names[m-1], y].join(' ') + @_field.hide() + @_event = 'focus' + @_simple = true else @_field = @_container.find('input') - event = 'click' + @_event = 'click' + @_simple = false @_mon = @_container.find('span.mon') @_dom = @_container.find('span.dom') @_year = @_container.find('span.year') @@ -26,9 +38,9 @@ jQuery ($) -> calendars: 1 date: initial_date current: initial_date - view: 'days' + view: view position: 'bottom' - showOn: event + showOn: @_event onChange: @setDate getDate: () => @@ -36,16 +48,19 @@ jQuery ($) -> new Date(Date.parse(value)) setDate: (date) => + $('.datepicker').hide() if date - $('.datepicker').hide() d = $.zeroPad(date.getDate()) - m = DatePicker.month_names[date.getMonth()] + m = date.getMonth() y = date.getFullYear() - dateString = [y, m, d].join('-') - @_field.val(dateString) - @_dom?.text(d) - @_mon?.text(m) - @_year?.text(y) + realDateString = [y, $.zeroPad(m+1), $.zeroPad(d)].join('-') + @_field.val(realDateString) + if @_simple + @_container.val [d, DatePicker.month_names[m], y].join(' ') + else + @_dom.text(d) + @_mon.text(DatePicker.month_names[m]) + @_year.text(y) class TimePicker @@ -63,8 +78,8 @@ jQuery ($) -> @field.focus @show @field.blur @hide - select: (value) => - @field.val(value) + select: (item) => + @field.val(item.value) @field.trigger('change') change: (e) => @@ -83,7 +98,6 @@ jQuery ($) -> - $.fn.file_picker = () -> @each -> new FilePicker @ @@ -320,17 +334,17 @@ jQuery ($) -> new PasswordMeter(@) @ - class PasswordMeter constructor: (element) -> @_container = $(element) @_warnings = @_container.find('[data-role="warnings"]') + @_suggestions = @_container.find('[data-role="suggestions"]') @_gauge = @_container.find('[data-role="gauge"]') @_score = @_container.find('[data-role="score"]') @_notes = @_container.find('[data-role="notes"]') @_original_warning = @_warnings.html() @_original_notes = @_notes.html() - @_ready = false + @_zxcvbn_ready = false $.withZxcbvn => @_ready = true @@ -343,7 +357,7 @@ jQuery ($) -> tooShort: () => @clear() @_container.addClass('s0') - @_warnings.text("Password too short. Please continue.") + @_warnings.text("Password too short.") check: (value) => if @_ready @@ -352,13 +366,11 @@ jQuery ($) -> result.score display: (result) => - @_container.removeClass('s0 s1 s2 s3 s4 acceptable').addClass('s' + result.score) - @_warnings.text("") - if result.score < 3 - @_warnings.text("Warning: " + result.feedback.warning) if result.feedback?.warning + if result.score < 2 + @_warnings.text(result.feedback.warning) if result.feedback?.warning + @_suggestions.text(result.feedback?.suggestions) else - @_container.addClass('acceptable') - + @_container.removeClass('s0 s1 s2 s3 s4 acceptable') From d082078144e9b4ca8c71e524f3a5a1c08541124e Mon Sep 17 00:00:00 2001 From: will-r Date: Fri, 31 Jan 2020 12:47:39 +0000 Subject: [PATCH 023/128] css and symbol fixes --- app/assets/stylesheets/droom/_forms.css.sass | 51 +++++++++++++++++-- app/assets/stylesheets/droom/_popups.css.sass | 13 +++-- app/views/droom/shared/_symbols.html.haml | 3 +- .../users/edit/_password_fields.html.haml | 11 ++-- 4 files changed, 61 insertions(+), 17 deletions(-) diff --git a/app/assets/stylesheets/droom/_forms.css.sass b/app/assets/stylesheets/droom/_forms.css.sass index b92af2a91..81fa2e809 100644 --- a/app/assets/stylesheets/droom/_forms.css.sass +++ b/app/assets/stylesheets/droom/_forms.css.sass @@ -1,5 +1,4 @@ div.popup - input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="url"], input[type="date"], input[type="time"], textarea, [contenteditable]:not([contenteditable=false]), padding: 8px border: 1px solid $pale @@ -30,6 +29,7 @@ input[type="text"], input[type="password"], input[type="email"], input[type="tel &[disabled] color: $pale background-color: #fff + background-image: none border-color: $verypale opacity: 0.75 &.valid, &.invalid @@ -40,6 +40,11 @@ input[type="text"], input[type="password"], input[type="email"], input[type="tel background-position: right 3px &.invalid background-position: right -97px + &.waiting + background: + image: image-url('droom/spinner.gif') + position: right 3px top 3px + repeat: no-repeat &::-webkit-input-placeholder color: $pale font-weight: lighter @@ -76,6 +81,8 @@ input[type="text"], input[type="password"], input[type="email"], input[type="tel select position: relative -webkit-appearance: none + -webkit-border-radius: 0 + -webkit-padding: 8px -webkit-padding-end: 24px font-size: 1.2em border: 1px solid $pale @@ -90,13 +97,11 @@ select image: image-url('droom/symbols/select.svg') size: 10px repeat: no-repeat - &:hover - color: $hover &.small font-size: 0.9em -webkit-padding-end: 16px -input[type="submit"] +input[type="submit"], button.confirm +button($green) display: inline-block transition: width 0.5s ease-out, height 0.5s ease-out, font-size 0.5s ease-out, padding 0.5s ease-out @@ -114,10 +119,28 @@ input[type="submit"] image: image-url('droom/spinner.gif') &.positive +button($green, white) - &.negative + &.negative, &.dangerous +button($red, white) + &.edit + +button($blue, white) + &.publish + +button($purple, white) + &.reset + +button($pale, white) + padding: 9px 14px + &.new + +button($green, white) + &.back + +button($mid, white) + &.shortcut + +button($reddish, white) + &.minor + +button($pale, white) + &.cancel + +button($pale, white) &.large font-size: 1.5em + padding: 20px &.next float: right &.disabled @@ -125,6 +148,9 @@ input[type="submit"] color: $mid box-shadow: none +input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, textarea:-webkit-autofill, textarea:-webkit-autofill:hover, textarea:-webkit-autofill:focus, select:-webkit-autofill, select:-webkit-autofill:hover, select:-webkit-autofill:focus + transition: background-color 5000s ease-in-out 0s + #margin input[type="text"], input[type="email"], input[type="password"] box-sizing: border-box @@ -144,9 +170,15 @@ input[type="submit"] min-height: 4em fieldset.disabled + label + color: $pale input[type="submit"] +button(white, $pale) +span.disabled, p.disabled + label + color: $pale + label &.required font-weight: bold @@ -158,6 +190,8 @@ label display: inline-block vertical-align: top white-space: nowrap + margin-right: 6px + overflow: hidden .error color: $error @@ -206,6 +240,13 @@ form.waiting textarea line-height: 1.5 + &.small + font-size: 85% + &.medium + height: 142px + &.long + height: 360px + // checkbox cosmetics diff --git a/app/assets/stylesheets/droom/_popups.css.sass b/app/assets/stylesheets/droom/_popups.css.sass index 3fc661ad1..87d7827b6 100644 --- a/app/assets/stylesheets/droom/_popups.css.sass +++ b/app/assets/stylesheets/droom/_popups.css.sass @@ -29,7 +29,6 @@ div.popup +pale margin-top: 0 -div.popup #event, #document, #user, #group, #event_type, #membership, #folder max-width: 580px > p @@ -38,6 +37,7 @@ div.popup div.popup position: absolute overflow-x: hidden + overflow-y: auto top: 10px left: 55px min-height: 100px @@ -45,6 +45,7 @@ div.popup max-width: 80vw width: 580px height: auto + padding: 0 z-index: 6000 background-color: $coolgrey00 box-shadow: 1px 3px 8px $shadow @@ -55,6 +56,7 @@ div.popup opacity: 0.8 &.help width: 360px + .header position: relative box-sizing: border-box @@ -64,16 +66,21 @@ div.popup background-color: $text padding: 8px 10px 4px 20px cursor: move + z-index: 6010 h2 position: relative height: 24px line-height: 27px + box-sizing: border-box margin: 0 margin-right: 40px font-weight: normal font-size: 0.9em color: white white-space: nowrap + span.context + font-weight: normal + color: $verypale a.closer display: block float: right @@ -114,10 +121,6 @@ div.popup margin-top: 0.5em .header - position: relative - top: 0 - left: 0 - width: 100% a.next, a.prev, span.next, span.prev position: relative display: inline-block diff --git a/app/views/droom/shared/_symbols.html.haml b/app/views/droom/shared/_symbols.html.haml index c2b79fcb2..4e532070b 100644 --- a/app/views/droom/shared/_symbols.html.haml +++ b/app/views/droom/shared/_symbols.html.haml @@ -39,8 +39,7 @@ %path{d: "M24.1,1.9c-12.3,0-22.2,9.9-22.2,22.2c0,12.3,9.9,22.2,22.2,22.2c12.3,0,22.2-9.9,22.2-22.2C46.3,11.8,36.3,1.9,24.1,1.9z M35,19.3L21.2,33.1c-0.3,0.3-0.7,0.4-1.1,0.4c-0.4,0-0.8-0.1-1.1-0.4l-5.9-5.9c-0.1-0.2-0.4-0.6-0.4-1.1c0-0.6,0.4-1.1,0.9-1.3 c0.6-0.2,1.3,0,1.7,0.4l4.9,4.9L33,17.2c0.4-0.4,1-0.6,1.6-0.4c0.6,0.2,0.9,0.7,0.9,1.4C35.5,18.7,35.1,19.1,35,19.3z"} %symbol#cross_symbol{viewBox: "0 0 48 48"} - %path{d: "M24.1,44.8c-11.4,0-20.7-9.3-20.7-20.7S12.7,3.4,24.1,3.4s20.7,9.3,20.7,20.7S35.5,44.8,24.1,44.8z M24.1,1.9 c-12.3,0-22.2,9.9-22.2,22.2s9.9,22.2,22.2,22.2s22.2-9.9,22.2-22.2S36.3,1.9,24.1,1.9z"} - %path{d: "M32.2,16c-0.3-0.3-0.8-0.3-1.1,0L24.1,23l-7-7.1c-0.3-0.3-0.8-0.3-1.1,0c-0.3,0.3-0.3,0.8,0,1.1l7,7.1l-7.1,7 c-0.3,0.3-0.3,0.8,0,1.1c0.2,0.2,0.4,0.2,0.6,0.2s0.4,0,0.6-0.2l7-7l7,7c0.2,0.2,0.4,0.2,0.6,0.2s0.4,0,0.6-0.2 c0.3-0.3,0.3-0.8,0-1.1l-7.1-7l7-7C32.5,16.8,32.5,16.3,32.2,16z"} + %path{d: "M7.5,7C16.8-2,31.8-1.9,41,7.5c9,9.3,9,24.1-0.2,33.3c-0.1,0.1-0.1,0.1-0.2,0.2 c-9.1,9-24.1,9-33.3-0.2c-0.1-0.1-0.1-0.1-0.3-0.3C-1.9,31.3-1.9,16.2,7.5,7z M43.7,18.3c-1-3.5-2.8-6.6-5.5-9.2 C30.3,1.7,18,1.6,10.1,8.9c-7.8,7.3-8.8,19.5-1.9,27.9c3.2,3.9,7.2,6.4,12.2,7.2c6.9,1.1,12.9-0.8,18.1-5.5c0,0,0,0,0.1-0.1 c0,0,0,0,0.1-0.1c2.7-2.7,4.4-5.8,5.3-9.4C44.7,25.5,44.6,21.9,43.7,18.3z M34.1,14c0.5,0.6,0.4,1.5-0.1,2.1 c-0.2,0.2-0.5,0.5-0.7,0.7c-2.3,2.3-4.6,4.6-6.9,6.9c-0.1,0-0.1,0.1-0.2,0.1c0.1,0.1,0.2,0.2,0.2,0.2c2.5,2.5,5,5,7.5,7.5 c0.6,0.6,0.7,1.6,0.1,2.2c-0.6,0.7-1.6,0.7-2.3,0.1c-0.1-0.1-0.1-0.1-0.2-0.2c-2.5-2.5-4.9-4.9-7.4-7.4c-0.1-0.1-0.1-0.1-0.2-0.2 c-0.1,0.1-0.1,0.1-0.2,0.2c-2.5,2.5-5,5-7.5,7.5c-0.7,0.7-1.8,0.7-2.4-0.1c-0.5-0.6-0.4-1.5,0.1-2.1c0.4-0.4,0.9-0.9,1.3-1.3 c2.1-2.1,4.2-4.2,6.3-6.3c0-0.1,0.1-0.1,0.2-0.1c-0.1-0.1-0.1-0.2-0.2-0.2c-2.5-2.5-5-5-7.5-7.5c-0.6-0.6-0.7-1.6-0.1-2.2 c0.6-0.7,1.6-0.7,2.3-0.1c0.1,0.1,0.1,0.1,0.2,0.2c2.5,2.5,4.9,4.9,7.4,7.4c0.1,0.1,0.1,0.1,0.2,0.4c0.1-0.1,0.1-0.2,0.2-0.2 c2.5-2.5,5-5,7.5-7.5C32.3,13.3,33.5,13.4,34.1,14z"} %symbol#cross_button_symbol{viewBox: "0 0 48 48"} %path{d: "M24.1,1.9c-12.3,0-22.2,9.9-22.2,22.2c0,12.3,9.9,22.2,22.2,22.2c12.3,0,22.2-9.9,22.2-22.2C46.3,11.8,36.3,1.9,24.1,1.9z M32.5,32.4c-0.3,0.3-0.6,0.3-0.8,0.3c-0.2,0-0.5,0-0.8-0.3l-6.8-6.8l-6.8,6.8c-0.3,0.3-0.6,0.3-0.8,0.3s-0.5,0-0.8-0.3 c-0.4-0.4-0.4-1.1,0-1.5l6.9-6.8l-6.8-6.9c-0.4-0.4-0.4-1.1,0-1.5c0.4-0.4,1.1-0.4,1.5,0l6.8,6.9l6.8-6.8c0.4-0.4,1.1-0.4,1.5,0 s0.4,1.1,0,1.5l-6.8,6.8l6.9,6.8C32.9,31.3,32.9,32,32.5,32.4z"} diff --git a/app/views/droom/users/edit/_password_fields.html.haml b/app/views/droom/users/edit/_password_fields.html.haml index 1b5226d94..ef0b23828 100644 --- a/app/views/droom/users/edit/_password_fields.html.haml +++ b/app/views/droom/users/edit/_password_fields.html.haml @@ -5,11 +5,6 @@ - fclass << " required" unless user.password_set? %fieldset{data: {role: 'password'}} - %p.password_quality.floating{data: {role: "meter"}} - %span.instructions{data: {role: "warnings"}} - %span.meter{data: {role: "gauge"}} - %svg - %use{"xlink:href" => "#warning_symbol"} %p.manage_password %span.col.password> @@ -21,6 +16,12 @@ %br = f.password_field :password_confirmation, placeholder: "", required: true + %p.password_quality.floating{data: {role: "meter"}} + %span.instructions{data: {role: "warnings"}} + %span.meter{data: {role: "gauge"}} + %svg + %use{"xlink:href" => "#warning_symbol"} + - if with_submit %p.buttons{:data => {:role => "confirmation"}}> = f.submit t(:set_password) From c4959741935e3787bfb66b0e6568a5c6ad20fbd2 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 4 Feb 2020 11:00:34 +0000 Subject: [PATCH 024/128] changes channel --- app/channels/droom/changes_channel.rb | 12 ++++++ app/channels/droom/channel.rb | 5 +++ app/channels/droom/connection.rb | 20 ++++++++++ app/controllers/droom/api/api_controller.rb | 13 ------- app/models/droom/concerns/changes_notified.rb | 37 +++++++++++++++++++ app/models/droom/droom_record.rb | 3 +- config/routes.rb | 2 + lib/droom/engine.rb | 15 ++++++++ lib/droom/version.rb | 2 +- 9 files changed, 94 insertions(+), 15 deletions(-) create mode 100644 app/channels/droom/changes_channel.rb create mode 100644 app/channels/droom/channel.rb create mode 100644 app/channels/droom/connection.rb create mode 100644 app/models/droom/concerns/changes_notified.rb diff --git a/app/channels/droom/changes_channel.rb b/app/channels/droom/changes_channel.rb new file mode 100644 index 000000000..3c3ab3929 --- /dev/null +++ b/app/channels/droom/changes_channel.rb @@ -0,0 +1,12 @@ +module Droom + class ChangesChannel < Channel + def subscribed + stream_from "changes" + end + + def unsubscribed + # No cleanup + end + + end +end \ No newline at end of file diff --git a/app/channels/droom/channel.rb b/app/channels/droom/channel.rb new file mode 100644 index 000000000..b60d74e15 --- /dev/null +++ b/app/channels/droom/channel.rb @@ -0,0 +1,5 @@ +module Droom + class Channel < ActionCable::Channel::Base + + end +end diff --git a/app/channels/droom/connection.rb b/app/channels/droom/connection.rb new file mode 100644 index 000000000..adeb99085 --- /dev/null +++ b/app/channels/droom/connection.rb @@ -0,0 +1,20 @@ +module Droom + class Connection < ActionCable::Connection::Base + identified_by :current_user + + def connect + self.current_user = find_verified_user + end + + protected + + def find_verified_user + if user = env['warden'].user + user + else + reject_unauthorized_connection + end + end + + end +end diff --git a/app/controllers/droom/api/api_controller.rb b/app/controllers/droom/api/api_controller.rb index ad54340a4..9d1a8f07e 100644 --- a/app/controllers/droom/api/api_controller.rb +++ b/app/controllers/droom/api/api_controller.rb @@ -27,19 +27,6 @@ def blew_up(exception) render json: { errors: exception.message }.to_json, status: :internal_server_error end - def echo_auth - Rails.logger.warn "??? token_and_options: #{ActionController::HttpAuthentication::Token.token_and_options(request).inspect}" - Rails.logger.warn " token auth header is #{request.headers["HTTP_AUTHORIZATION"]}" - end - - def echo_user_status - Rails.logger.warn ">>> user_signed_in? is #{user_signed_in?.inspect}" - if user_signed_in? - Rails.logger.warn " current_user is #{current_user.inspect}" - Rails.logger.warn " permissions: is #{current_user.permission_codes.inspect}" - end - end - def name_from_controller params[:controller].sub("Controller", "").underscore.split('/').last end diff --git a/app/models/droom/concerns/changes_notified.rb b/app/models/droom/concerns/changes_notified.rb new file mode 100644 index 000000000..c523008ff --- /dev/null +++ b/app/models/droom/concerns/changes_notified.rb @@ -0,0 +1,37 @@ +module Droom::Concerns::ChangesNotified + extend ActiveSupport::Concern + + included do + after_create :notify_of_creation + after_update :notify_of_update + after_destroy :notify_of_destruction + end + + def timestamp + (updated_at || created_at || Time.now).to_f + end + + def notify_of_change(event, additional_data={}) + time = event == 'destroyed' ? Time.now.to_i : timestamp + change_data = { + event: event, + timestamp: time, + object_class: self.class.to_s.underscore, + object_id: id, + } + Droom::Engine.cable.broadcast 'changes', change_data.merge(additional_data) + end + + def notify_of_creation(additional_data={}) + notify_of_change "created", additional_data + end + + def notify_of_update(additional_data={}) + notify_of_change "updated", additional_data + end + + def notify_of_destruction(additional_data={}) + notify_of_change "destroyed", additional_data + end + +end \ No newline at end of file diff --git a/app/models/droom/droom_record.rb b/app/models/droom/droom_record.rb index 2622190ea..23fd73250 100644 --- a/app/models/droom/droom_record.rb +++ b/app/models/droom/droom_record.rb @@ -1,6 +1,7 @@ module Droom class DroomRecord < ActiveRecord::Base - include Droom::Folders + include Droom::Concerns::ChangesNotified + include Droom::Folders # TODO please can we get rid of this now? self.abstract_class = true end end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 2737aa220..e7ea345bf 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,6 +6,8 @@ match '/suggestions' => 'suggestions#index', as: "suggestions", via: [:get, :options] match '/suggestions/:type' => 'suggestions#index', via: [:get, :options] + mount Droom::Engine.server => Droom.cable.mount_path + namespace :api, defaults: {format: 'json'}, constraints: {format: /(json|xml)/} do #post '/reindex_user' => 'users#reindex_user', as: 'reindex' diff --git a/lib/droom/engine.rb b/lib/droom/engine.rb index 8bed07e8e..6322958c5 100644 --- a/lib/droom/engine.rb +++ b/lib/droom/engine.rb @@ -26,10 +26,25 @@ module Droom + class << self + def cable + @cable ||= ActionCable::Server::Configuration.new + end + end + class Engine < ::Rails::Engine isolate_namespace Droom + def cable + cable ||= ActionCable::Server::Base.new(config: Droom.cable) + end + + config.droom_cable = Droom.cable + config.droom_cable.mount_path = "/cable" + config.droom_cable.connection_class = -> { Droom::Connection } + initializer "droom.integration" do + Droom.cable.logger ||= ::Rails.logger Devise.parent_controller = "Droom::DroomController" end diff --git a/lib/droom/version.rb b/lib/droom/version.rb index a332e5aa5..97dde8131 100644 --- a/lib/droom/version.rb +++ b/lib/droom/version.rb @@ -1,3 +1,3 @@ module Droom - VERSION = "0.12.3" + VERSION = "0.12.4" end From bfea5c945c906ffe0170949f246da3c93044cabd Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 4 Feb 2020 11:36:41 +0000 Subject: [PATCH 025/128] simplify cable mounting a little --- config/routes.rb | 2 +- droom.gemspec | 2 +- lib/droom/engine.rb | 28 +++++++++++++++------------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index e7ea345bf..5b77fd20d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,7 @@ match '/suggestions' => 'suggestions#index', as: "suggestions", via: [:get, :options] match '/suggestions/:type' => 'suggestions#index', via: [:get, :options] - mount Droom::Engine.server => Droom.cable.mount_path + mount Droom::Engine.cable => "/cable" namespace :api, defaults: {format: 'json'}, constraints: {format: /(json|xml)/} do diff --git a/droom.gemspec b/droom.gemspec index 695c7fa64..e0c202f41 100644 --- a/droom.gemspec +++ b/droom.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |s| s.test_files = Dir["spec/**/*"] - s.add_dependency "rails", "~> 5.2" + s.add_dependency "rails", "~> 6.0" s.add_dependency "responders" s.add_dependency "acts_as_tree" s.add_dependency "acts_as_list" diff --git a/lib/droom/engine.rb b/lib/droom/engine.rb index 6322958c5..99223bb0b 100644 --- a/lib/droom/engine.rb +++ b/lib/droom/engine.rb @@ -26,25 +26,16 @@ module Droom - class << self - def cable - @cable ||= ActionCable::Server::Configuration.new - end - end - class Engine < ::Rails::Engine isolate_namespace Droom - def cable - cable ||= ActionCable::Server::Base.new(config: Droom.cable) + class << self + def cable + @cable ||= ActionCable::Server::Base.new(config: Droom.cable_config) + end end - config.droom_cable = Droom.cable - config.droom_cable.mount_path = "/cable" - config.droom_cable.connection_class = -> { Droom::Connection } - initializer "droom.integration" do - Droom.cable.logger ||= ::Rails.logger Devise.parent_controller = "Droom::DroomController" end @@ -59,4 +50,15 @@ def cable end end + + class << self + def cable_config + unless @cable_config + @cable_config = ActionCable::Server::Configuration.new + @cable_config.connection_class = -> { Droom::Connection } + @cable_config.logger = ::Rails.logger + end + @cable_config + end + end end From 594f3008b305b5be2b8ece996a486f04a9048154 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 4 Feb 2020 11:50:33 +0000 Subject: [PATCH 026/128] not ready for 6.0: must fully webpackify first --- droom.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/droom.gemspec b/droom.gemspec index e0c202f41..695c7fa64 100644 --- a/droom.gemspec +++ b/droom.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |s| s.test_files = Dir["spec/**/*"] - s.add_dependency "rails", "~> 6.0" + s.add_dependency "rails", "~> 5.2" s.add_dependency "responders" s.add_dependency "acts_as_tree" s.add_dependency "acts_as_list" From d7f09f13c936cbdd59af005665d75505bbea8db3 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 4 Feb 2020 12:56:42 +0000 Subject: [PATCH 027/128] provide cable machinery but allow application to implement --- app/models/droom/concerns/changes_notified.rb | 2 +- config/routes.rb | 2 -- lib/droom/engine.rb | 17 ----------------- 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/app/models/droom/concerns/changes_notified.rb b/app/models/droom/concerns/changes_notified.rb index c523008ff..05823ac92 100644 --- a/app/models/droom/concerns/changes_notified.rb +++ b/app/models/droom/concerns/changes_notified.rb @@ -19,7 +19,7 @@ def notify_of_change(event, additional_data={}) object_class: self.class.to_s.underscore, object_id: id, } - Droom::Engine.cable.broadcast 'changes', change_data.merge(additional_data) + Droom::ChangesChannel.broadcast 'changes', change_data.merge(additional_data) end def notify_of_creation(additional_data={}) diff --git a/config/routes.rb b/config/routes.rb index 5b77fd20d..2737aa220 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,8 +6,6 @@ match '/suggestions' => 'suggestions#index', as: "suggestions", via: [:get, :options] match '/suggestions/:type' => 'suggestions#index', via: [:get, :options] - mount Droom::Engine.cable => "/cable" - namespace :api, defaults: {format: 'json'}, constraints: {format: /(json|xml)/} do #post '/reindex_user' => 'users#reindex_user', as: 'reindex' diff --git a/lib/droom/engine.rb b/lib/droom/engine.rb index 99223bb0b..8bed07e8e 100644 --- a/lib/droom/engine.rb +++ b/lib/droom/engine.rb @@ -29,12 +29,6 @@ module Droom class Engine < ::Rails::Engine isolate_namespace Droom - class << self - def cable - @cable ||= ActionCable::Server::Base.new(config: Droom.cable_config) - end - end - initializer "droom.integration" do Devise.parent_controller = "Droom::DroomController" end @@ -50,15 +44,4 @@ def cable end end - - class << self - def cable_config - unless @cable_config - @cable_config = ActionCable::Server::Configuration.new - @cable_config.connection_class = -> { Droom::Connection } - @cable_config.logger = ::Rails.logger - end - @cable_config - end - end end From 5db37d0bf16f9029d8bde7493198ed384099c538 Mon Sep 17 00:00:00 2001 From: will-r Date: Tue, 4 Feb 2020 13:50:27 +0000 Subject: [PATCH 028/128] broadcast_to... --- app/channels/droom/changes_channel.rb | 1 + app/channels/droom/connection.rb | 20 ------------------- app/models/droom/concerns/changes_notified.rb | 2 +- 3 files changed, 2 insertions(+), 21 deletions(-) delete mode 100644 app/channels/droom/connection.rb diff --git a/app/channels/droom/changes_channel.rb b/app/channels/droom/changes_channel.rb index 3c3ab3929..491184740 100644 --- a/app/channels/droom/changes_channel.rb +++ b/app/channels/droom/changes_channel.rb @@ -1,5 +1,6 @@ module Droom class ChangesChannel < Channel + def subscribed stream_from "changes" end diff --git a/app/channels/droom/connection.rb b/app/channels/droom/connection.rb deleted file mode 100644 index adeb99085..000000000 --- a/app/channels/droom/connection.rb +++ /dev/null @@ -1,20 +0,0 @@ -module Droom - class Connection < ActionCable::Connection::Base - identified_by :current_user - - def connect - self.current_user = find_verified_user - end - - protected - - def find_verified_user - if user = env['warden'].user - user - else - reject_unauthorized_connection - end - end - - end -end diff --git a/app/models/droom/concerns/changes_notified.rb b/app/models/droom/concerns/changes_notified.rb index 05823ac92..65b6b890b 100644 --- a/app/models/droom/concerns/changes_notified.rb +++ b/app/models/droom/concerns/changes_notified.rb @@ -19,7 +19,7 @@ def notify_of_change(event, additional_data={}) object_class: self.class.to_s.underscore, object_id: id, } - Droom::ChangesChannel.broadcast 'changes', change_data.merge(additional_data) + Droom::ChangesChannel.broadcast_to 'changes', change_data.merge(additional_data) end def notify_of_creation(additional_data={}) From f43cb29f205488f540829be427d79f2414445099 Mon Sep 17 00:00:00 2001 From: will-r Date: Wed, 5 Feb 2020 11:50:29 +0000 Subject: [PATCH 029/128] more experimentation with engine channels, ed symbols not needed most of the time --- app/channels/droom/connection.rb | 20 +++ app/views/droom/pages/edit/_form.html.haml | 3 + app/views/droom/shared/_ed_symbols.html.haml | 125 +++++++++++++++++++ app/views/droom/shared/_symbols.html.haml | 125 +------------------ 4 files changed, 149 insertions(+), 124 deletions(-) create mode 100644 app/channels/droom/connection.rb create mode 100644 app/views/droom/shared/_ed_symbols.html.haml diff --git a/app/channels/droom/connection.rb b/app/channels/droom/connection.rb new file mode 100644 index 000000000..adeb99085 --- /dev/null +++ b/app/channels/droom/connection.rb @@ -0,0 +1,20 @@ +module Droom + class Connection < ActionCable::Connection::Base + identified_by :current_user + + def connect + self.current_user = find_verified_user + end + + protected + + def find_verified_user + if user = env['warden'].user + user + else + reject_unauthorized_connection + end + end + + end +end diff --git a/app/views/droom/pages/edit/_form.html.haml b/app/views/droom/pages/edit/_form.html.haml index 84874f975..80c274503 100644 --- a/app/views/droom/pages/edit/_form.html.haml +++ b/app/views/droom/pages/edit/_form.html.haml @@ -86,3 +86,6 @@ %svg.prefix %use{"xlink:href" => "#reuse_symbol"} recycle button to choose a previously uploaded asset. + + += render "droom/shared/ed_symbols" diff --git a/app/views/droom/shared/_ed_symbols.html.haml b/app/views/droom/shared/_ed_symbols.html.haml new file mode 100644 index 000000000..8dea34107 --- /dev/null +++ b/app/views/droom/shared/_ed_symbols.html.haml @@ -0,0 +1,125 @@ +#svg_holder + %svg{xmlns: "http://www.w3.org/2000/svg", style: "display: none;"} + // Ed + %symbol#save_symbol{viewBox: "0 0 48 48"} + %path{d: "M13,28.4c-0.6-0.6-0.6-1.6,0-2.2l9.9-9.9c0.5-0.6,1.6-0.6,2.2,0l10.1,9.9c0.6,0.6,0.6,1.6,0,2.2c-0.3,0.3-0.8,0.4-1.2,0.4 c-0.5,0-0.9-0.1-1.2-0.4l-7.2-7.2l0,14.8c0,0.9-0.7,1.6-1.6,1.6c-0.9,0-1.6-0.7-1.6-1.6l0-14.8l-7.2,7.2C14.6,29,13.6,29,13,28.4z M0.3,23.9c0-6.3,2.5-12.3,7-16.8c4.5-4.3,10.5-6.8,16.8-6.8c6.5,0,12.5,2.4,17,7c4.3,4.5,6.8,10.5,6.8,16.9 c-0.2,6.3-2.6,12.3-7.2,16.8c-4.4,4.3-10.4,6.8-16.7,6.8c-6.4,0-12.4-2.5-16.9-7C2.7,36.2,0.3,30.2,0.3,23.9z M10.6,8.5l26.9,0 c-3.8-3.2-8.5-5-13.5-5S14.3,5.3,10.6,8.5z M3.4,24.1c0,5.5,2.2,10.7,6,14.6c3.8,4,9,6.1,14.6,6.1c5.4,0,10.6-2.2,14.4-6 c7.5-7.4,8.1-19,1.9-27.1c-0.1,0.1-0.3,0.1-0.5,0.1l-31.6,0c-0.2,0-0.4-0.1-0.5-0.1C5,15.2,3.5,19.5,3.4,24.1z"} + %symbol#save_button_symbol{viewBox: "0 0 48 48"} + %path{d: "M3.6,11.8c-2.2,3.6-3.3,7.8-3.3,12.1c0,6.3,2.4,12.3,6.8,16.9c4.5,4.5,10.5,7,16.9,7c6.3,0,12.3-2.5,16.7-6.8 c4.6-4.5,7-10.5,7.2-16.8c0-4.5-1.2-8.7-3.4-12.4L3.6,11.8z M35.2,28.4c-0.3,0.3-0.8,0.4-1.2,0.4c-0.5,0-0.9-0.1-1.2-0.4l-7.2-7.2 l0,14.8c0,0.9-0.7,1.6-1.6,1.6c-0.9,0-1.6-0.7-1.6-1.6l0-14.8l-7.2,7.2c-0.6,0.6-1.6,0.6-2.2,0c-0.6-0.6-0.6-1.6,0-2.2l9.9-9.9 c0.5-0.6,1.6-0.6,2.2,0l10.1,9.9C35.8,26.8,35.8,27.8,35.2,28.4z M6,8.5C6.4,8,6.8,7.6,7.3,7.1c4.5-4.3,10.5-6.8,16.8-6.8 c6.5,0,12.5,2.4,17,7c0.4,0.4,0.7,0.8,1.1,1.2L6,8.5z"} + %symbol#revert_symbol{viewBox: "0 0 48 48"} + %path{d: "M39.9,8.5C35.6,4.3,30,1.9,24,1.9c-5.9,0-11.5,2.3-15.6,6.4C4.1,12.5,1.8,18.1,1.7,24c0,6,2.3,11.6,6.5,15.8 c4.2,4.3,9.8,6.6,15.9,6.6c5.9,0,11.5-2.3,15.6-6.4C48.4,31.4,48.5,17.3,39.9,8.5z M37.5,37.9c-3.6,3.6-8.4,5.6-13.5,5.6 c-5.2,0-10.1-2-13.7-5.7c-3.6-3.7-5.6-8.5-5.6-13.7c0-5.1,2.1-10,5.7-13.6c3.6-3.6,8.4-5.6,13.5-5.6c5.2,0,10.1,2,13.7,5.7 C45.2,18.2,45.1,30.4,37.5,37.9z M37.4,24.2c0,0.8-0.7,1.5-1.5,1.5H12.2c-0.8,0-1.5-0.7-1.5-1.5s0.7-1.5,1.5-1.5h23.6 C36.7,22.7,37.3,23.3,37.4,24.2z"} + %symbol#revert_button_symbol{viewBox: "0 0 48 48"} + %path{d: "M39.9,8.5C35.6,4.3,30,1.9,24,1.9c-5.9,0-11.5,2.3-15.6,6.4C4.1,12.5,1.8,18.1,1.7,24c0,6,2.3,11.6,6.5,15.8 c4.2,4.3,9.8,6.6,15.9,6.6c5.9,0,11.5-2.3,15.6-6.4C48.4,31.4,48.5,17.3,39.9,8.5z M37.4,24.2c0,0.8-0.7,1.5-1.5,1.5H12.2 c-0.8,0-1.5-0.7-1.5-1.5s0.7-1.5,1.5-1.5h23.6C36.7,22.7,37.3,23.3,37.4,24.2z"} + + %symbol#download_symbol{viewBox: "0 0 48 48"} + %path{d: "M35.2,19.7c0.6,0.6,0.6,1.6,0,2.2l-9.9,9.9c-0.5,0.6-1.6,0.6-2.2,0L13,21.9c-0.6-0.6-0.6-1.6,0-2.2c0.3-0.3,0.8-0.4,1.2-0.4 c0.5,0,0.9,0.1,1.2,0.4l7.2,7.2V12.1c0-0.9,0.7-1.6,1.6-1.6c0.9,0,1.6,0.7,1.6,1.6v14.8l7.2-7.2C33.6,19.1,34.6,19.1,35.2,19.7z M47.9,24.2c0,6.3-2.5,12.3-7,16.8c-4.5,4.3-10.5,6.8-16.8,6.8c-6.5,0-12.5-2.4-17-7c-4.3-4.5-6.8-10.5-6.8-16.9 c0.2-6.3,2.6-12.3,7.2-16.8c4.4-4.3,10.4-6.8,16.7-6.8c6.4,0,12.4,2.5,16.9,7C45.5,11.9,47.9,17.9,47.9,24.2z M37.6,39.6H10.7 c3.8,3.2,8.5,5,13.5,5S33.9,42.8,37.6,39.6z M44.8,24c0-5.5-2.2-10.7-6-14.6c-3.8-4-9-6.1-14.6-6.1c-5.4,0-10.6,2.2-14.4,6 c-7.5,7.4-8.1,19-1.9,27.1c0.1-0.1,0.3-0.1,0.5-0.1H40c0.2,0,0.4,0.1,0.5,0.1C43.2,32.9,44.7,28.6,44.8,24z"} + %symbol#download_button_symbol{viewBox: "0 0 48 48"} + %path{d: "M44.6,36.3c2.2-3.6,3.3-7.8,3.3-12.1c0-6.3-2.4-12.3-6.8-16.9c-4.5-4.5-10.5-7-16.9-7c-6.3,0-12.3,2.5-16.7,6.8 c-4.6,4.5-7,10.5-7.2,16.8c0,4.5,1.2,8.7,3.4,12.4H44.6z M13,19.7c0.3-0.3,0.8-0.4,1.2-0.4c0.5,0,0.9,0.1,1.2,0.4l7.2,7.2V12.1 c0-0.9,0.7-1.6,1.6-1.6c0.9,0,1.6,0.7,1.6,1.6v14.8l7.2-7.2c0.6-0.6,1.6-0.6,2.2,0c0.6,0.6,0.6,1.6,0,2.2l-9.9,9.9 c-0.5,0.6-1.6,0.6-2.2,0L13,21.9C12.4,21.3,12.4,20.3,13,19.7z M42.2,39.6c-0.4,0.5-0.8,0.9-1.3,1.4c-4.5,4.3-10.5,6.8-16.8,6.8 c-6.5,0-12.5-2.4-17-7C6.7,40.4,6.4,40,6,39.6H42.2z"} + + %symbol#insert_symbol{viewBox: "0 0 48 48"} + %polygon.fg{points: "39.7,22.7 25.5,22.7 25.5,8.5 22.9,8.5 22.9,22.7 8.7,22.7 8.7,25.3 22.9,25.3 22.9,39.5 25.5,39.5 25.5,25.3 39.7,25.3"} + + %symbol#image_symbol{viewBox: "0 0 100 100"} + %path{d: "M50,0.8C22.5,1,0.6,23.2,0.8,50.3c0,5,0.9,10,2.3,14.5c0,0.7,0.2,1.3,0.7,1.9c6.9,18.9,25,32.5,46.3,32.5h0.3 C63.5,99.1,75.8,94,85,84.6s14.3-21.8,14.2-34.9C99,22.8,77,0.8,50,0.8z M69.6,16c0,2.8-2.3,5.1-5.1,5.1c-2.8,0-5.1-2.3-5.1-5.1 s2.3-5.1,5.1-5.1C67.3,10.8,69.6,13.1,69.6,16z M50.2,92.6H50c-17.9,0-33.4-11.3-39.6-27l26.1-22.6l31.7,45.6 C62.7,91.1,56.6,92.6,50.2,92.6z M80.3,80c-2.1,2.1-4.3,3.8-6.6,5.5l-15.2-22l14.1-12.1l14.1,20.3C84.9,74.6,82.8,77.3,80.3,80z M89.8,65.1l-14-20.3c-0.5-0.8-1.3-1.2-2.2-1.3c-0.9-0.1-1.8,0.1-2.5,0.8l-16.3,14L39.7,36.3c-0.5-0.8-1.3-1.2-2.2-1.3 c-0.9-0.1-1.8,0.1-2.5,0.8L8.3,58.9c-0.5-2.7-0.9-5.7-1-8.6C7.2,26.7,26.2,7.6,49.7,7.3c2.3,0,4.5,0.2,6.6,0.5 C54.2,10,53,12.8,53,16c0,6.3,5.1,11.5,11.5,11.5c6.2,0,11.3-4.9,11.5-11C86,24.2,92.4,36.2,92.6,49.8C92.7,55,91.7,60.2,89.8,65.1z"} + %symbol#image_button_symbol{viewBox: "0 0 100 100"} + %path.fg{d: "M93.9,71.8c3.4-6.7,5.3-14.2,5.3-22.1C99,23.3,76.5,0.8,49.9,0.8c-7.3,0-14.2,1.6-20.5,4.5c-0.8,0.3-1.4,0.7-2.2,1.1 c-15.9,8.2-26.7,24.8-26.6,44c0,5.4,1,10.5,2.5,15.3c0,0.2,0.1,0.4,0.2,0.7c0.1,0.4,0.3,0.8,0.4,1.2C11,86,28.9,99.2,49.8,99.2h0.3 C69.1,99.2,85.8,87.8,93.9,71.8z M64.4,8.5c4.1,0,7.4,3.3,7.4,7.4s-3.3,7.4-7.4,7.4c-4.1,0-7.4-3.3-7.4-7.4S60.3,8.5,64.4,8.5z M10.1,65.9l25.8-22.3c0.2-0.2,0.5-0.2,0.7-0.2c0.1,0,0.4,0.1,0.7,0.3l31.2,45c-5.6,2.7-11.8,4.2-18.3,4.2h-0.2 C32,92.9,16.5,81.7,10.1,65.9z M80.5,80.1c-2,2-4.2,3.8-6.5,5.4L58.6,63.3l13.2-11.5c0.2-0.2,0.5-0.2,0.7-0.2c0.1,0,0.4,0.1,0.7,0.3 l14,19.3C85.4,74.5,83.1,77.5,80.5,80.1z"} + + %symbol#video_symbol{viewBox: "0 0 48 48"} + %path.fg{d: "M40.9,7.5c-4.6-4.5-10.5-7-16.9-7c-6.3,0-12.2,2.4-16.6,6.8c-4.6,4.5-7,10.4-7.1,16.7c0,6.4,2.4,12.3,6.9,16.8 c4.5,4.6,10.4,7,16.9,7c6.3,0,12.2-2.4,16.6-6.8C50,31.9,50.1,16.9,40.9,7.5z M38.4,38.8c-3.8,3.8-8.9,6-14.4,6 c-5.5,0-10.7-2.1-14.6-6.1s-6-9-6-14.6c0-5.4,2.2-10.6,6.1-14.5s8.9-6,14.4-6c5.5,0,10.7,2.1,14.6,6.1 C46.6,17.8,46.5,30.8,38.4,38.8z M38.1,16.4c0-0.7-0.6-1.3-1.3-1.3c-8.6-0.6-17-0.6-25.6,0c-0.7,0-1.3,0.6-1.3,1.3 c-0.3,5.2-0.3,10.5,0,15.7c0,0.7,0.6,1.3,1.3,1.3c8.6,0.6,17,0.6,25.6,0c0.7,0,1.3-0.6,1.3-1.3C38.4,26.8,38.4,21.6,38.1,16.4z M29,24.6L21.3,29c-0.3,0.2-0.6,0-0.6-0.4v-8.9c0-0.3,0.3-0.6,0.6-0.4l7.7,4.4C29.3,24,29.3,24.4,29,24.6z"} + %symbol#video_button_symbol{viewBox: "0 0 48 48"} + %path.fg{d: "M41,7.4c-4.6-4.5-10.6-7-17-7c-6.3,0-12.3,2.5-16.7,6.8c-4.6,4.5-7,10.5-7.2,16.8c0,6.4,2.5,12.4,6.9,16.9 c4.5,4.6,10.5,7,17,7c6.3,0,12.3-2.5,16.7-6.8C50.1,31.9,50.2,16.8,41,7.4z M38.1,32.1c0,0.7-0.6,1.3-1.3,1.3 c-8.6,0.6-17.1,0.6-25.7,0c-0.7,0-1.3-0.6-1.3-1.3c-0.3-5.2-0.3-10.5,0-15.8c0-0.7,0.6-1.3,1.3-1.3c8.6-0.6,17.1-0.6,25.7,0 c0.7,0,1.3,0.6,1.3,1.3C38.5,21.6,38.5,26.8,38.1,32.1z M29,24.6L21.3,29c-0.3,0.2-0.6,0-0.6-0.4v-8.9c0-0.3,0.3-0.6,0.6-0.4 l7.7,4.4C29.3,24,29.3,24.4,29,24.6z"} + + %symbol#document_symbol{viewBox: "0 0 48 48"} + %path.fg{d: "M40.9,7.5c-4.6-4.5-10.5-7-16.9-7c-6.3,0-12.2,2.4-16.6,6.8c-4.6,4.5-7,10.4-7.1,16.7c0,6.4,2.4,12.3,6.9,16.8 c4.5,4.6,10.4,7,16.9,7c6.3,0,12.2-2.4,16.6-6.8C50,31.9,50.1,16.9,40.9,7.5z M38.4,38.8c-3.8,3.8-8.9,6-14.4,6s-10.7-2.1-14.6-6.1 c-3.9-4-6-9-6-14.6c0-5.4,2.2-10.6,6.1-14.5c3.9-3.9,8.9-6,14.4-6s10.7,2.1,14.6,6.1C46.6,17.8,46.5,30.8,38.4,38.8z M36.8,26.7 c-0.8-1.5-3.3-2.3-7.1-2.3H29c-1-1.2-2.1-2.4-2.8-3.3L26,20.8c-0.3-0.4-0.6-0.7-0.8-1.1c0.5-1.5,0.8-2.8,0.9-3.7 c0.2-2.5-0.1-4.1-0.9-4.9c-0.6-0.6-1.4-0.8-2.2-0.6c-0.5,0.1-1.3,0.6-1.7,1.9c-0.6,1.7-0.4,4.8,1.3,7.6c-0.7,1.8-1.7,3.9-2.8,5.9 c-2.1,0.8-3.8,1.7-5.1,2.9c-1.7,1.6-2.3,3.3-1.8,4.5c0.3,0.8,1.1,1.3,2,1.3c0.6,0,1.3-0.2,1.9-0.6c1.4-0.9,3.3-3.8,4.6-6.2 c1.5-0.5,3.3-0.8,5.3-1l1.4-0.1c1.9,2,3.5,3.1,5,3.4l0.1,0c0.3,0,0.5,0.1,0.8,0.1c1.3,0,2.3-0.5,2.8-1.4 C37.1,28.1,37.1,27.4,36.8,26.7z M34.7,27.7c-0.1,0.1-0.3,0.1-0.7,0.1c-0.1,0-0.3,0-0.5,0c-0.6-0.1-1.2-0.5-2-1 C33.5,27,34.4,27.5,34.7,27.7z M15.1,32.3c0.1-0.3,0.4-0.9,1.2-1.8c0.4-0.4,0.9-0.7,1.3-1c-0.9,1.4-1.7,2.3-2.1,2.6 C15.3,32.2,15.2,32.3,15.1,32.3z M24.2,22.2c0.1,0.1,0.2,0.2,0.3,0.3c0.5,0.6,1.1,1.3,1.7,2c-0.9,0.1-2.1,0.3-3.3,0.5 C23.3,24,23.8,23.1,24.2,22.2z M23.7,15.8c0,0.2-0.1,0.5-0.1,0.8c-0.4-1.3-0.4-2.6-0.1-3.5c0-0.1,0.1-0.2,0.1-0.3 C23.7,13.3,23.9,14.1,23.7,15.8z"} + %symbol#document_button_symbol{viewBox: "0 0 48 48"} + %path.fg{d: "M24.6,22.3c0.7,0.9,1.5,1.9,2.4,2.9h-0.1c-1.2,0.1-2.9,0.4-4.9,0.8c0.8-1.5,1.5-3.1,2.1-4.5C24.2,21.8,24.3,22.1,24.6,22.3z M23.8,14.5c0.2-3.1-0.3-3.9-0.4-4c-0.1,0-0.3,0.3-0.5,0.8c-0.5,1.4-0.2,3.4,0.5,5.3C23.6,15.7,23.8,15,23.8,14.5z M12.8,34.6 C12.8,34.6,12.8,34.6,12.8,34.6c0.4,0,0.7-0.1,1-0.4c0.7-0.5,2-2,3.3-4.2c-1.1,0.5-2,1.2-2.7,1.9C12.9,33.5,12.7,34.4,12.8,34.6z M40.7,41c-4.4,4.4-10.3,6.8-16.6,6.8c-6.5,0-12.4-2.4-16.9-7C2.7,36.3,0.3,30.4,0.3,24c0.1-6.3,2.5-12.2,7.1-16.7 C11.8,2.9,17.7,0.5,24,0.5c6.4,0,12.3,2.5,16.9,7C50.1,16.9,50,31.9,40.7,41z M38.9,27.7c-1-1.7-3.9-2.6-8.2-2.6c-0.3,0-0.6,0-1,0 c-1.2-1.3-2.4-2.8-3.4-4.1c-0.5-0.6-1-1.2-1.4-1.8v0c0.6-1.9,1-3.4,1.1-4.5c0.2-2.9-0.1-4.8-1-5.7c-0.6-0.6-1.5-0.9-2.3-0.6 c-0.6,0.2-1.4,0.7-1.9,2.1c-0.7,2.1-0.4,5.9,1.6,8.9c-0.9,2.3-2.1,4.9-3.4,7.4c-2.5,0.9-4.6,2.1-6.1,3.5c-1.9,1.9-2.7,3.7-2.1,5.1 c0.4,0.9,1.1,1.4,2.1,1.4c0.7,0,1.4-0.2,2.1-0.7c1.8-1.2,4.2-5.1,5.4-7.4c2.6-0.8,5.2-1.1,6.5-1.3c0.6,0,1.2-0.1,1.8-0.1 c2.3,2.4,4.2,3.7,5.9,4c0.4,0,0.7,0.1,1,0.1c1.4,0,2.6-0.5,3.1-1.5C39.3,29.2,39.3,28.4,38.9,27.7z M31.9,27.3 c1.3,1.1,2.3,1.7,3.2,1.9c0.2,0,0.5,0,0.6,0c0.7,0,1.1-0.2,1.2-0.4c0,0,0,0,0-0.1C36.7,28.2,35.3,27.4,31.9,27.3z"} + + %symbol#quote_symbol{viewBox: "0 0 48 48"} + %path.fg{d: "M40.9,7.5c-4.6-4.5-10.5-7-16.9-7c-6.3,0-12.2,2.4-16.6,6.8c-4.6,4.5-7,10.4-7.1,16.7c0,6.4,2.4,12.3,6.9,16.8 c4.5,4.6,10.4,7,16.9,7c6.3,0,12.2-2.4,16.6-6.8C50,31.9,50.1,16.9,40.9,7.5z M38.4,38.8c-3.8,3.8-8.9,6-14.4,6 c-5.5,0-10.7-2.1-14.6-6.1s-6-9-6-14.6c0-5.4,2.2-10.6,6.1-14.5s8.9-6,14.4-6c5.5,0,10.7,2.1,14.6,6.1 C46.6,17.8,46.5,30.8,38.4,38.8z M17.8,15.5c3.2,0,5.7,3,5.7,7c0,5.2-4.8,10.4-9.8,10.4c-0.7,0-1.4-0.6-1.4-1.2 c0-2.6,3.7-0.8,4.6-6.5c-2.7-0.7-4.3-2.4-4.3-4.6C12.7,17.9,15,15.5,17.8,15.5z M30.3,15.5c3.2,0,5.7,3,5.7,7 c0,5.2-4.8,10.4-9.8,10.4c-0.7,0-1.4-0.6-1.4-1.2c0-2.6,3.7-0.8,4.6-6.5c-2.7-0.7-4.3-2.4-4.3-4.6C25.1,17.9,27.5,15.5,30.3,15.5z"} + %symbol#quote_button_symbol{viewBox: "0 0 48 48"} + %path.fg{d: "M40.9,7.5c-4.6-4.5-10.5-7-16.9-7c-6.3,0-12.2,2.4-16.6,6.8c-4.6,4.5-7,10.4-7.1,16.7c0,6.4,2.4,12.3,6.9,16.8 c4.5,4.6,10.4,7,16.9,7c6.3,0,12.2-2.4,16.6-6.8C50,31.9,50.1,16.9,40.9,7.5z M17.8,15.5c3.2,0,5.7,3,5.7,7c0,5.2-4.8,10.4-9.8,10.4 c-0.7,0-1.4-0.6-1.4-1.2c0-2.6,3.7-0.8,4.6-6.5c-2.7-0.7-4.3-2.4-4.3-4.6C12.7,17.9,15,15.5,17.8,15.5z M30.3,15.5 c3.2,0,5.7,3,5.7,7c0,5.2-4.8,10.4-9.8,10.4c-0.7,0-1.4-0.6-1.4-1.2c0-2.6,3.7-0.8,4.6-6.5c-2.7-0.7-4.3-2.4-4.3-4.6 C25.1,17.9,27.5,15.5,30.3,15.5z"} + + %symbol#close_symbol{viewBox: "0 0 48 48"} + %path{d: "M41.2,7.1c-0.6-0.6-1.7-0.6-2.3,0L24.1,21.9L9.3,6.9C8.7,6.3,7.7,6.3,7,6.9C6.4,7.5,6.4,8.6,7,9.2l14.8,15l-15,14.8 c-0.6,0.6-0.6,1.7,0,2.3c0.4,0.4,0.8,0.4,1.3,0.4c0.4,0,0.8,0,1.3-0.4l14.8-14.8l14.8,14.8c0.4,0.4,0.8,0.4,1.3,0.4s0.8,0,1.3-0.4 c0.6-0.6,0.6-1.7,0-2.3l-15-14.8L41.2,9.4C41.8,8.8,41.8,7.7,41.2,7.1z"} + + + %symbol#right_arrow_symbol{viewBox: "0 0 100 100"} + %path{d: "M76.7,47.6c1.2,1.2,1.2,3.6,0,4.8L55.9,73.1c-1.3,1.3-3.4,1.3-4.8,0c-0.7-0.6-1-1.4-1-2.3c0-0.8,0.3-1.7,1-2.3l15-15.1H25 c-1.8,0-3.3-1.6-3.3-3.3c0-1.8,1.4-3.3,3.3-3.3h41.1L51,31.6c-1.3-1.3-1.3-3.4,0-4.8s3.4-1.3,4.8,0L76.7,47.6z M100,49.7V50 c0,27.4-22.3,49.8-49.7,50C22.8,100.2,0.2,77.9,0,50C0,22.6,22.3,0.2,49.7,0c13.3-0.1,26,5,35.4,14.4l0,0 C94.7,23.8,99.9,36.3,100,49.7z M93.2,49.7c-0.1-11.6-4.7-22.3-12.9-30.6c-8.1-8-19-12.4-30.6-12.3c-23.7,0.1-43,19.6-43,43.6 c0.1,23.9,19.7,43.1,43.6,43C74,93.1,93.2,73.7,93.2,50L93.2,49.7z"} + %symbol#left_arrow_symbol{viewBox: "0 0 100 100"} + %path{d: "M23.3,52.4c-1.2-1.2-1.2-3.6,0-4.8l20.8-20.8c1.3-1.3,3.4-1.3,4.8,0c0.7,0.6,1,1.4,1,2.3c0,0.8-0.3,1.7-1,2.3l-15,15.1H75 c1.8,0,3.3,1.6,3.3,3.3c0,1.8-1.4,3.3-3.3,3.3H33.9L49,68.4c1.3,1.3,1.3,3.4,0,4.8s-3.4,1.3-4.8,0L23.3,52.4z M0,50.3V50 C0,22.6,22.3,0.2,49.7,0C77.2-0.2,99.8,22.1,100,50c0,27.4-22.3,49.8-49.7,50c-13.3,0.1-26-5-35.4-14.4l0,0 C5.3,76.2,0.1,63.7,0,50.3z M6.8,50.3c0.1,11.6,4.7,22.3,12.9,30.6c8.1,8,19,12.4,30.6,12.3c23.7-0.1,43-19.6,43-43.6 c-0.1-23.9-19.7-43.1-43.6-43C26,6.9,6.8,26.3,6.8,50L6.8,50.3z"} + %symbol#popout_symbol{viewBox: "0 0 100 100"} + %path{d: "M67.1,29.4c1.7,0,3.4,1.6,3.4,3.4l0,29.4c0,1.9-1.5,3.4-3.4,3.4c-0.9,0.1-1.7-0.3-2.4-0.9c-0.6-0.6-0.9-1.4-0.9-2.4L63.7,41 L34.7,70c-1.3,1.3-3.5,1.3-4.7,0c-1.3-1.3-1.3-3.4,0-4.7L59,36.3l-21.4,0c-1.9,0-3.4-1.5-3.4-3.4c0-1.9,1.5-3.4,3.4-3.4L67.1,29.4z M85.1,14.4l0.2,0.2c19.4,19.4,19.4,51,0.2,70.5c-19.3,19.6-51.1,19.8-70.9,0.2c-19.4-19.4-19.4-51-0.2-70.5C23.8,5.4,36.3,0,49.7,0 l0,0C63-0.1,75.6,5.1,85.1,14.4z M80.3,19.2C72.1,11.1,61.2,6.7,49.6,6.7c-11.4,0.1-22.2,4.6-30.3,12.9C2.6,36.4,2.7,63.8,19.7,80.8 c17,16.8,44.4,16.6,61.2-0.4c16.6-16.9,16.4-44.2-0.3-61L80.3,19.2z"} + + %symbol#first_symbol{viewBox: "0 0 48 64"} + %path{d: "M29.1,9.62a1.61,1.61,0,0,1,2.27,2.27L19.26,24,31.37,36.11a1.61,1.61,0,1,1-2.27,2.27L15.85,25.14a1.61,1.61,0,0,1,0-2.27Z"} + %symbol#last_symbol{viewBox: "0 0 48 64"} + %path{d: "M20.13,9.7A1.59,1.59,0,0,0,17.88,12l12,12-12,12a1.59,1.59,0,1,0,2.25,2.25L33.25,25.07a1.59,1.59,0,0,0,0-2.25Z"} + %symbol#prev_symbol{viewBox: "0 0 48 64"} + %path{d: "M27.91,9.62a1.61,1.61,0,1,1,2.27,2.27L18.07,24,30.18,36.11a1.61,1.61,0,1,1-2.27,2.27L14.66,25.14a1.61,1.61,0,0,1,0-2.27Z"} + %symbol#next_symbol{viewBox: "0 0 48 64"} + %path{d: "M20.13,9.7A1.59,1.59,0,0,0,17.88,12l12,12-12,12a1.59,1.59,0,1,0,2.25,2.25L33.25,25.07a1.59,1.59,0,0,0,0-2.25Z"} + + %symbol#edit_symbol{viewBox: "0 0 48 64"} + %path{d: "M11.5,32l4.4,4.4l-6.3,1.8L11.5,32z M33.4,9.1c0.1-0.1,0.2-0.1,0.3-0.1c0.1,0,0.2,0.1,0.3,0.1l4.9,4.9 c0.1,0.1,0.1,0.3,0.1,0.3c0,0.1,0,0.2-0.1,0.3l-3.6,3.6l-5.6-5.6L33.4,9.1z M27.7,14.7l5.6,5.6L18.6,35L13,29.4L27.7,14.7z M7.5,42 c0.1,0,0.3,0,0.4-0.1l10.3-3c0.5-0.1,1.1-0.4,1.5-0.9L41,16.8c0.6-0.6,1-1.5,1-2.5c0-0.9-0.3-1.8-1-2.4L36.1,7 c-1.3-1.3-3.6-1.3-4.9,0L10,28.3c-0.4,0.4-0.7,0.9-0.9,1.5l-3,10.3c-0.1,0.5,0,1.1,0.4,1.5C6.7,41.9,7.1,42,7.5,42L7.5,42z"} + + + // positioning controls for inserted assets + %symbol#left_symbol{viewBox: "0 0 48 48"} + %rect.fg{x:"13.3", y: "13.9", width: "26.6", height: "2.3"} + %rect.fg{x:"24.1", y: "18.4", width: "15.8", height: "2.3"} + %rect.fg{x:"24.1", y: "23", width: "15.8", height: "2.3"} + %rect.fg{x:"24.1", y: "27.6" , width: "15.8", height: "2.3"} + %rect.fg{x:"13.3", y: "32.2", width: "26.6", height: "2.3"} + %rect.fg{x:"8.9", y: "18.4", width: "13.4", height: "11.4"} + + %symbol#right_symbol{viewBox: "0 0 48 48"} + %rect.fg{x: "8.9", y: "13.9", width: "26.6", height: "2.3"} + %rect.fg{x: "8.9", y: "18.4", width: "15.8", height: "2.3"} + %rect.fg{x: "8.9", y: "23", width: "15.8", height: "2.3"} + %rect.fg{x: "8.9", y: "27.6", width: "15.8", height: "2.3"} + %rect.fg{x: "8.9", y: "32.2", width: "26.6", height: "2.3"} + %rect.fg{x: "26.5", y: "18.4", width: "13.4", height: "11.4"} + + %symbol#full_symbol{viewBox: "0 0 48 48"} + %rect.fg{x: "10.7", y: "13.7", width: "26.6", height: "2.3"} + %rect.fg{x: "10.7", y: "32", width: "26.6", height: "2.3"} + %rect.fg{x: "10.7", y: "18.2", width: "26.6", height: "11.4"} + + %symbol#wide_symbol{viewBox: "0 0 48 48"} + %rect.fg{x: "10.7", y: "13.7", width: "26.6", height: "2.3"} + %rect.fg{x: "10.7", y: "32", width: "26.6", height: "2.3"} + %rect.fg{x: "6.5", y: "18.2", width: "34.9", height: "11.4"} + + %symbol#hero_button{viewBox: "0 0 48 48"} + %path.bg{d: "M40.3,7.6c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.6,40.3,7.6z"} + %path.fg{d: "M4.7,36.5C8.8,42.7,15.9,46.9,24,46.9s15.2-4.2,19.3-10.4H4.7z" } + %path.fg{d: "M43.6,11.9c-4-6.6-11.3-11-19.6-11S8.4,5.3,4.4,11.9H43.6z" } + + // Toolbar buttons + %symbol#bold_button{viewBox: "0 0 48 48"} + %path.fg{d: "M26.5,18.4c0-1.6-1.3-2.4-2.8-2.4H21v5.1h2.7C25.4,21.1,26.5,20.1,26.5,18.4z"} + %path.fg{d: "M24.7,25.7H21v5.7h4c1.9,0,3.2-1.1,3.2-3C28.3,26.8,27.1,25.7,24.7,25.7z"} + %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M25.7,35.9h-7.1 c-1.6,0-2.7-1-2.7-2.6V14c0-1.6,1.1-2.6,2.7-2.6h6.6c3.6,0,6.5,2.4,6.5,6c0,2.4-1,4-3.2,5v0.1c2.9,0.4,5.2,2.8,5.2,5.8 C33.7,33.3,30.4,35.9,25.7,35.9z"} + + %symbol#italic_button{viewBox: "0 0 48 48"} + %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M32.1,13.9l-9.4,19.5 c-0.8,1.7-2.7,2.7-4.7,2.7c-1.9,0-2.9-1-2.1-2.7l9.4-19.5c0.8-1.7,2.7-2.7,4.7-2.7C31.9,11.2,32.9,12.2,32.1,13.9z"} + + %symbol#link_button{viewBox: "0 0 48 48"} + %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M32.1,13.9l-9.4,19.5 c-0.8,1.7-2.7,2.7-4.7,2.7c-1.9,0-2.9-1-2.1-2.7l9.4-19.5c0.8-1.7,2.7-2.7,4.7-2.7C31.9,11.2,32.9,12.2,32.1,13.9z"} + + %symbol#ol_button{viewBox: "0 0 48 48"} + %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M12.4,11.8h1.2c0.4,0,0.6,0.3,0.6,0.6v4.7 c0,0.4-0.3,0.6-0.6,0.6s-0.6-0.2-0.6-0.6v-4.2h-0.5c-0.4,0-0.6-0.3-0.6-0.6C11.8,12.1,12,11.8,12.4,11.8z M13.3,36.2 c-1.2,0-2-0.9-2-1.6c0-0.3,0.3-0.6,0.6-0.6c0.6,0,0.4,1,1.4,1c0.4,0,0.8-0.3,0.8-0.8c0-1.2-1.4-0.3-1.4-1.3c0-0.9,1.2-0.3,1.2-1.2 c0-0.3-0.2-0.6-0.6-0.6c-0.8,0-0.7,0.8-1.2,0.8c-0.3,0-0.5-0.3-0.5-0.6c0-0.6,0.9-1.3,1.8-1.3c1.2,0,1.8,0.9,1.8,1.5 c0,0.5-0.2,1-0.7,1.3c0.6,0.3,1,0.8,1,1.5C15.4,35.4,14.5,36.2,13.3,36.2z M14.9,26.9h-2.8c-0.4,0-0.6-0.2-0.6-0.5 c0-0.2,0.1-0.3,0.2-0.4c0.7-0.8,1.4-1.6,2.1-2.5c0.1-0.2,0.3-0.5,0.3-0.8c0-0.3-0.3-0.6-0.6-0.6c-1,0-0.5,1.3-1.3,1.3 c-0.4,0-0.6-0.3-0.6-0.6c0-1,0.9-1.9,1.9-1.9s1.8,0.7,1.8,1.7c0,1.2-1.3,2.3-2,3.2h1.5c0.4,0,0.6,0.2,0.6,0.5 C15.5,26.7,15.2,26.9,14.9,26.9z M33.9,36.1H21.8c-1.6,0-2.9-1.3-2.9-2.9s1.3-2.9,2.9-2.9h12.2c1.6,0,2.9,1.3,2.9,2.9 S35.5,36.1,33.9,36.1z M33.9,26.9H21.8c-1.6,0-2.9-1.3-2.9-2.9s1.3-2.9,2.9-2.9h12.2c1.6,0,2.9,1.3,2.9,2.9S35.5,26.9,33.9,26.9z M33.9,17.7H21.8c-1.6,0-2.9-1.3-2.9-2.9s1.3-2.9,2.9-2.9h12.2c1.6,0,2.9,1.3,2.9,2.9S35.5,17.7,33.9,17.7z"} + + %symbol#ul_button{viewBox: "0 0 48 48"} + %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M14.2,36.1c-1.6,0-2.9-1.3-2.9-2.9 c0-1.6,1.3-2.9,2.9-2.9c1.6,0,2.9,1.3,2.9,2.9C17.1,34.8,15.8,36.1,14.2,36.1z M14.2,26.9c-1.6,0-2.9-1.3-2.9-2.9s1.3-2.9,2.9-2.9 c1.6,0,2.9,1.3,2.9,2.9S15.8,26.9,14.2,26.9z M14.2,17.7c-1.6,0-2.9-1.3-2.9-2.9c0-1.6,1.3-2.9,2.9-2.9c1.6,0,2.9,1.3,2.9,2.9 C17.1,16.4,15.8,17.7,14.2,17.7z M33.9,36.1H21.8c-1.6,0-2.9-1.3-2.9-2.9c0-1.6,1.3-2.9,2.9-2.9h12.2c1.6,0,2.9,1.3,2.9,2.9 C36.8,34.8,35.5,36.1,33.9,36.1z M33.9,26.9H21.8c-1.6,0-2.9-1.3-2.9-2.9s1.3-2.9,2.9-2.9h12.2c1.6,0,2.9,1.3,2.9,2.9 S35.5,26.9,33.9,26.9z M33.9,17.7H21.8c-1.6,0-2.9-1.3-2.9-2.9c0-1.6,1.3-2.9,2.9-2.9h12.2c1.6,0,2.9,1.3,2.9,2.9 C36.8,16.4,35.5,17.7,33.9,17.7z"} + + %symbol#h1_button{viewBox: "0 0 48 48"} + %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M34.6,33.7 c0,1.7-1.1,2.7-2.6,2.7s-2.6-1-2.6-2.7v-7.5H18.7v7.5c0,1.7-1.1,2.7-2.6,2.7s-2.6-1-2.6-2.7V14.3c0-1.7,1.1-2.7,2.6-2.7 s2.6,1,2.6,2.7v7.3h10.8v-7.3c0-1.7,1.1-2.7,2.6-2.7s2.6,1,2.6,2.7V33.7z"} + + %symbol#h2_button{viewBox: "0 0 48 48"} + %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M33.2,33.3 c0,1.6-1,2.7-2.5,2.7s-2.5-1.1-2.5-2.7v-8.6c0-2.3-1.4-3.4-3.2-3.4c-2,0-3.2,1.5-3.2,3.4v8.6c0,1.6-1,2.7-2.5,2.7s-2.5-1.1-2.5-2.7 V12.2c0-1.6,1-2.7,2.5-2.7s2.5,1.1,2.5,2.7v6.7h0.1c1-1.3,3-1.7,4.5-1.7c3.9,0,6.8,2.5,6.8,6.7V33.3z"} + + %symbol#anchor_button{viewBox: "0 0 48 48"} + %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M23.2,36.1 c-1.6,1.6-3.7,2.6-6,2.5c-2.2-0.1-4.1-0.9-5.6-2.5c-3-3.2-2.8-8.2,0.3-11.3l4.9-4.9c0.1-0.1,0.2-0.2,0.3-0.2c0.4-0.4,1-0.8,1.6-1.1 c1.5-0.8,3.2-1.1,4.9-0.9c0.4,0,0.8,0.1,1.2,0.2c0.4,0.1,0.8,0.2,1.1,0.4c0.8,0.4,1.5,0.9,2.2,1.5c0.8,0.8,0.7,2.2-0.1,3l-1,1 c-0.1,0.2-0.3,0.3-0.5,0.4c-0.2-0.7-0.6-1.4-1.1-1.9c-0.6-0.6-1.4-1-2.2-1.2c-0.3-0.1-0.6-0.1-0.9-0.1h-0.2 c-0.4,0.1-0.7,0.1-1.1,0.2c-0.7,0.2-1.4,0.6-1.9,1.1l-4.9,4.9c-0.7,0.7-1.3,1.7-1.4,2.8c-0.1,1.2,0.3,2.5,1.2,3.4 c0.9,0.9,2.1,1.4,3.4,1.2c1.1-0.1,2-0.6,2.8-1.4l0.9-0.9c0.5-0.5,1.2-0.6,1.8-0.4c0.4,0.1,0.8,0.2,1.2,0.2c0.4,0.1,0.7,0.1,1.1,0.1 c0.4,0,0.8-0.1,1.2-0.1L23.2,36.1z M36.1,23.3l-4.9,4.9c-0.1,0.1-0.2,0.2-0.3,0.2c-0.4,0.4-1,0.9-1.6,1.2c-1.2,0.6-2.5,0.9-3.8,0.9 c-0.4,0-0.7,0-1.1-0.1c-0.4,0-0.8-0.1-1.2-0.2c-0.4-0.1-0.8-0.2-1.1-0.4c-0.8-0.4-1.5-0.9-2.2-1.5c-0.8-0.8-0.8-2.2,0.1-3l1-1 c0.2-0.2,0.4-0.3,0.6-0.4c0.2,0.7,0.6,1.4,1.1,1.9c0.6,0.6,1.4,1,2.2,1.2c0.3,0.1,0.6,0.1,0.9,0.1h0.1c0.4-0.1,0.7-0.1,1.1-0.2 c0.7-0.2,1.4-0.6,1.9-1.1l4.9-4.9c1.6-1.6,1.9-4.2,0.4-5.9c-0.9-1.1-2.2-1.7-3.7-1.5c-1.1,0.1-2.1,0.6-2.8,1.4l-1,1 c-0.4,0.4-0.9,0.5-1.4,0.3c-0.4-0.1-0.8-0.2-1.2-0.2c-0.9-0.1-1.8-0.1-2.7,0.1l3.7-3.7c1.6-1.6,3.7-2.6,6-2.5 c2.2,0.1,4.1,0.9,5.6,2.5C39.5,15,39.3,20.1,36.1,23.3z"} + + %symbol#clear_button{viewBox: "0 0 48 48"} + %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M26.8,24.1c2.8,2.8,5.7,5.7,8.5,8.5 c0.7,0.7,0.8,1.8,0.1,2.5c-0.7,0.8-1.8,0.8-2.6,0.1c-0.1-0.1-0.1-0.1-0.2-0.2c-2.8-2.8-5.5-5.5-8.4-8.4c-0.1-0.1-0.1-0.1-0.2-0.2 c-0.1,0.1-0.1,0.1-0.2,0.2c-2.8,2.8-5.7,5.7-8.5,8.5c-0.8,0.8-2,0.8-2.7-0.1c-0.6-0.7-0.5-1.7,0.1-2.4c0.5-0.5,1-1,1.5-1.5 c2.4-2.4,4.8-4.8,7.1-7.1c0-0.1,0.1-0.1,0.2-0.1c-0.1-0.1-0.1-0.2-0.2-0.2c-2.8-2.8-5.7-5.7-8.5-8.5c-0.7-0.7-0.8-1.8-0.1-2.5 c0.7-0.8,1.8-0.8,2.6-0.1c0.1,0.1,0.1,0.1,0.2,0.2c2.8,2.8,5.5,5.5,8.4,8.4c0.1,0.1,0.1,0.1,0.2,0.3c0.1-0.1,0.1-0.2,0.2-0.2 c2.8-2.8,5.7-5.7,8.5-8.5c0.7-0.9,2-0.8,2.7,0c0.6,0.7,0.5,1.7-0.1,2.4c-0.2,0.2-0.6,0.6-0.8,0.8c-2.6,2.6-5.2,5.2-7.8,7.8 c-0.1,0-0.1,0.1-0.2,0.1C26.7,24,26.8,24.1,26.8,24.1z"} diff --git a/app/views/droom/shared/_symbols.html.haml b/app/views/droom/shared/_symbols.html.haml index 4e532070b..eec81edd2 100644 --- a/app/views/droom/shared/_symbols.html.haml +++ b/app/views/droom/shared/_symbols.html.haml @@ -108,128 +108,5 @@ %symbol#email_symbol{viewBox: "0 0 100 100"} %path{d: "M50.5,6.2c24.8,0.4,44.7,20.6,44.7,45.4C95,76.1,74.7,96.3,49.9,96.3c-0.2,0-0.4,0-0.6,0c-24.6-0.2-44.5-20.2-44.5-45 c0-0.2,0-0.4,0-0.8C5,26.1,25.5,5.8,50.5,6.2z M85.4,67.5c4.8-10.9,4.8-21.8,0-32.6c-6.1,5.5-12,10.9-17.9,16.2 C73.4,56.8,79.3,62.1,85.4,67.5z M82.5,72.8c-6.5-5.9-13-11.6-19.3-17.6l-0.2,0.2c-3.6,3.2-7.3,6.5-10.9,9.9 c-1.3,1.1-2.9,1.1-4.2,0c-2.9-2.5-5.7-5.2-8.6-7.6c-1-0.8-1.7-1.5-2.7-2.3c-6.5,5.9-13,11.6-19.5,17.6c8.4,11.6,19.5,17.8,34,17.4 C64.4,89.8,74.7,83.5,82.5,72.8z M49.9,59.3c10.9-9.9,21.8-19.7,32.4-29.6C66.7,6.2,32.7,6.6,17.5,29.9 C28.1,39.6,39,49.5,49.9,59.3z M32.3,51.3C26.4,45.7,20.5,40.4,14.4,35c-4.8,10.1-4.8,22.9,0,32.4C20.5,62.1,26.4,56.6,32.3,51.3z"} - // Ed - %symbol#save_symbol{viewBox: "0 0 48 48"} - %path{d: "M13,28.4c-0.6-0.6-0.6-1.6,0-2.2l9.9-9.9c0.5-0.6,1.6-0.6,2.2,0l10.1,9.9c0.6,0.6,0.6,1.6,0,2.2c-0.3,0.3-0.8,0.4-1.2,0.4 c-0.5,0-0.9-0.1-1.2-0.4l-7.2-7.2l0,14.8c0,0.9-0.7,1.6-1.6,1.6c-0.9,0-1.6-0.7-1.6-1.6l0-14.8l-7.2,7.2C14.6,29,13.6,29,13,28.4z M0.3,23.9c0-6.3,2.5-12.3,7-16.8c4.5-4.3,10.5-6.8,16.8-6.8c6.5,0,12.5,2.4,17,7c4.3,4.5,6.8,10.5,6.8,16.9 c-0.2,6.3-2.6,12.3-7.2,16.8c-4.4,4.3-10.4,6.8-16.7,6.8c-6.4,0-12.4-2.5-16.9-7C2.7,36.2,0.3,30.2,0.3,23.9z M10.6,8.5l26.9,0 c-3.8-3.2-8.5-5-13.5-5S14.3,5.3,10.6,8.5z M3.4,24.1c0,5.5,2.2,10.7,6,14.6c3.8,4,9,6.1,14.6,6.1c5.4,0,10.6-2.2,14.4-6 c7.5-7.4,8.1-19,1.9-27.1c-0.1,0.1-0.3,0.1-0.5,0.1l-31.6,0c-0.2,0-0.4-0.1-0.5-0.1C5,15.2,3.5,19.5,3.4,24.1z"} - %symbol#save_button_symbol{viewBox: "0 0 48 48"} - %path{d: "M3.6,11.8c-2.2,3.6-3.3,7.8-3.3,12.1c0,6.3,2.4,12.3,6.8,16.9c4.5,4.5,10.5,7,16.9,7c6.3,0,12.3-2.5,16.7-6.8 c4.6-4.5,7-10.5,7.2-16.8c0-4.5-1.2-8.7-3.4-12.4L3.6,11.8z M35.2,28.4c-0.3,0.3-0.8,0.4-1.2,0.4c-0.5,0-0.9-0.1-1.2-0.4l-7.2-7.2 l0,14.8c0,0.9-0.7,1.6-1.6,1.6c-0.9,0-1.6-0.7-1.6-1.6l0-14.8l-7.2,7.2c-0.6,0.6-1.6,0.6-2.2,0c-0.6-0.6-0.6-1.6,0-2.2l9.9-9.9 c0.5-0.6,1.6-0.6,2.2,0l10.1,9.9C35.8,26.8,35.8,27.8,35.2,28.4z M6,8.5C6.4,8,6.8,7.6,7.3,7.1c4.5-4.3,10.5-6.8,16.8-6.8 c6.5,0,12.5,2.4,17,7c0.4,0.4,0.7,0.8,1.1,1.2L6,8.5z"} - %symbol#revert_symbol{viewBox: "0 0 48 48"} - %path{d: "M39.9,8.5C35.6,4.3,30,1.9,24,1.9c-5.9,0-11.5,2.3-15.6,6.4C4.1,12.5,1.8,18.1,1.7,24c0,6,2.3,11.6,6.5,15.8 c4.2,4.3,9.8,6.6,15.9,6.6c5.9,0,11.5-2.3,15.6-6.4C48.4,31.4,48.5,17.3,39.9,8.5z M37.5,37.9c-3.6,3.6-8.4,5.6-13.5,5.6 c-5.2,0-10.1-2-13.7-5.7c-3.6-3.7-5.6-8.5-5.6-13.7c0-5.1,2.1-10,5.7-13.6c3.6-3.6,8.4-5.6,13.5-5.6c5.2,0,10.1,2,13.7,5.7 C45.2,18.2,45.1,30.4,37.5,37.9z M37.4,24.2c0,0.8-0.7,1.5-1.5,1.5H12.2c-0.8,0-1.5-0.7-1.5-1.5s0.7-1.5,1.5-1.5h23.6 C36.7,22.7,37.3,23.3,37.4,24.2z"} - %symbol#revert_button_symbol{viewBox: "0 0 48 48"} - %path{d: "M39.9,8.5C35.6,4.3,30,1.9,24,1.9c-5.9,0-11.5,2.3-15.6,6.4C4.1,12.5,1.8,18.1,1.7,24c0,6,2.3,11.6,6.5,15.8 c4.2,4.3,9.8,6.6,15.9,6.6c5.9,0,11.5-2.3,15.6-6.4C48.4,31.4,48.5,17.3,39.9,8.5z M37.4,24.2c0,0.8-0.7,1.5-1.5,1.5H12.2 c-0.8,0-1.5-0.7-1.5-1.5s0.7-1.5,1.5-1.5h23.6C36.7,22.7,37.3,23.3,37.4,24.2z"} - - %symbol#download_symbol{viewBox: "0 0 48 48"} - %path{d: "M35.2,19.7c0.6,0.6,0.6,1.6,0,2.2l-9.9,9.9c-0.5,0.6-1.6,0.6-2.2,0L13,21.9c-0.6-0.6-0.6-1.6,0-2.2c0.3-0.3,0.8-0.4,1.2-0.4 c0.5,0,0.9,0.1,1.2,0.4l7.2,7.2V12.1c0-0.9,0.7-1.6,1.6-1.6c0.9,0,1.6,0.7,1.6,1.6v14.8l7.2-7.2C33.6,19.1,34.6,19.1,35.2,19.7z M47.9,24.2c0,6.3-2.5,12.3-7,16.8c-4.5,4.3-10.5,6.8-16.8,6.8c-6.5,0-12.5-2.4-17-7c-4.3-4.5-6.8-10.5-6.8-16.9 c0.2-6.3,2.6-12.3,7.2-16.8c4.4-4.3,10.4-6.8,16.7-6.8c6.4,0,12.4,2.5,16.9,7C45.5,11.9,47.9,17.9,47.9,24.2z M37.6,39.6H10.7 c3.8,3.2,8.5,5,13.5,5S33.9,42.8,37.6,39.6z M44.8,24c0-5.5-2.2-10.7-6-14.6c-3.8-4-9-6.1-14.6-6.1c-5.4,0-10.6,2.2-14.4,6 c-7.5,7.4-8.1,19-1.9,27.1c0.1-0.1,0.3-0.1,0.5-0.1H40c0.2,0,0.4,0.1,0.5,0.1C43.2,32.9,44.7,28.6,44.8,24z"} - %symbol#download_button_symbol{viewBox: "0 0 48 48"} - %path{d: "M44.6,36.3c2.2-3.6,3.3-7.8,3.3-12.1c0-6.3-2.4-12.3-6.8-16.9c-4.5-4.5-10.5-7-16.9-7c-6.3,0-12.3,2.5-16.7,6.8 c-4.6,4.5-7,10.5-7.2,16.8c0,4.5,1.2,8.7,3.4,12.4H44.6z M13,19.7c0.3-0.3,0.8-0.4,1.2-0.4c0.5,0,0.9,0.1,1.2,0.4l7.2,7.2V12.1 c0-0.9,0.7-1.6,1.6-1.6c0.9,0,1.6,0.7,1.6,1.6v14.8l7.2-7.2c0.6-0.6,1.6-0.6,2.2,0c0.6,0.6,0.6,1.6,0,2.2l-9.9,9.9 c-0.5,0.6-1.6,0.6-2.2,0L13,21.9C12.4,21.3,12.4,20.3,13,19.7z M42.2,39.6c-0.4,0.5-0.8,0.9-1.3,1.4c-4.5,4.3-10.5,6.8-16.8,6.8 c-6.5,0-12.5-2.4-17-7C6.7,40.4,6.4,40,6,39.6H42.2z"} - - %symbol#insert_symbol{viewBox: "0 0 48 48"} - %polygon.fg{points: "39.7,22.7 25.5,22.7 25.5,8.5 22.9,8.5 22.9,22.7 8.7,22.7 8.7,25.3 22.9,25.3 22.9,39.5 25.5,39.5 25.5,25.3 39.7,25.3"} - - %symbol#image_symbol{viewBox: "0 0 100 100"} - %path{d: "M50,0.8C22.5,1,0.6,23.2,0.8,50.3c0,5,0.9,10,2.3,14.5c0,0.7,0.2,1.3,0.7,1.9c6.9,18.9,25,32.5,46.3,32.5h0.3 C63.5,99.1,75.8,94,85,84.6s14.3-21.8,14.2-34.9C99,22.8,77,0.8,50,0.8z M69.6,16c0,2.8-2.3,5.1-5.1,5.1c-2.8,0-5.1-2.3-5.1-5.1 s2.3-5.1,5.1-5.1C67.3,10.8,69.6,13.1,69.6,16z M50.2,92.6H50c-17.9,0-33.4-11.3-39.6-27l26.1-22.6l31.7,45.6 C62.7,91.1,56.6,92.6,50.2,92.6z M80.3,80c-2.1,2.1-4.3,3.8-6.6,5.5l-15.2-22l14.1-12.1l14.1,20.3C84.9,74.6,82.8,77.3,80.3,80z M89.8,65.1l-14-20.3c-0.5-0.8-1.3-1.2-2.2-1.3c-0.9-0.1-1.8,0.1-2.5,0.8l-16.3,14L39.7,36.3c-0.5-0.8-1.3-1.2-2.2-1.3 c-0.9-0.1-1.8,0.1-2.5,0.8L8.3,58.9c-0.5-2.7-0.9-5.7-1-8.6C7.2,26.7,26.2,7.6,49.7,7.3c2.3,0,4.5,0.2,6.6,0.5 C54.2,10,53,12.8,53,16c0,6.3,5.1,11.5,11.5,11.5c6.2,0,11.3-4.9,11.5-11C86,24.2,92.4,36.2,92.6,49.8C92.7,55,91.7,60.2,89.8,65.1z"} - %symbol#image_button_symbol{viewBox: "0 0 100 100"} - %path.fg{d: "M93.9,71.8c3.4-6.7,5.3-14.2,5.3-22.1C99,23.3,76.5,0.8,49.9,0.8c-7.3,0-14.2,1.6-20.5,4.5c-0.8,0.3-1.4,0.7-2.2,1.1 c-15.9,8.2-26.7,24.8-26.6,44c0,5.4,1,10.5,2.5,15.3c0,0.2,0.1,0.4,0.2,0.7c0.1,0.4,0.3,0.8,0.4,1.2C11,86,28.9,99.2,49.8,99.2h0.3 C69.1,99.2,85.8,87.8,93.9,71.8z M64.4,8.5c4.1,0,7.4,3.3,7.4,7.4s-3.3,7.4-7.4,7.4c-4.1,0-7.4-3.3-7.4-7.4S60.3,8.5,64.4,8.5z M10.1,65.9l25.8-22.3c0.2-0.2,0.5-0.2,0.7-0.2c0.1,0,0.4,0.1,0.7,0.3l31.2,45c-5.6,2.7-11.8,4.2-18.3,4.2h-0.2 C32,92.9,16.5,81.7,10.1,65.9z M80.5,80.1c-2,2-4.2,3.8-6.5,5.4L58.6,63.3l13.2-11.5c0.2-0.2,0.5-0.2,0.7-0.2c0.1,0,0.4,0.1,0.7,0.3 l14,19.3C85.4,74.5,83.1,77.5,80.5,80.1z"} - - %symbol#video_symbol{viewBox: "0 0 48 48"} - %path.fg{d: "M40.9,7.5c-4.6-4.5-10.5-7-16.9-7c-6.3,0-12.2,2.4-16.6,6.8c-4.6,4.5-7,10.4-7.1,16.7c0,6.4,2.4,12.3,6.9,16.8 c4.5,4.6,10.4,7,16.9,7c6.3,0,12.2-2.4,16.6-6.8C50,31.9,50.1,16.9,40.9,7.5z M38.4,38.8c-3.8,3.8-8.9,6-14.4,6 c-5.5,0-10.7-2.1-14.6-6.1s-6-9-6-14.6c0-5.4,2.2-10.6,6.1-14.5s8.9-6,14.4-6c5.5,0,10.7,2.1,14.6,6.1 C46.6,17.8,46.5,30.8,38.4,38.8z M38.1,16.4c0-0.7-0.6-1.3-1.3-1.3c-8.6-0.6-17-0.6-25.6,0c-0.7,0-1.3,0.6-1.3,1.3 c-0.3,5.2-0.3,10.5,0,15.7c0,0.7,0.6,1.3,1.3,1.3c8.6,0.6,17,0.6,25.6,0c0.7,0,1.3-0.6,1.3-1.3C38.4,26.8,38.4,21.6,38.1,16.4z M29,24.6L21.3,29c-0.3,0.2-0.6,0-0.6-0.4v-8.9c0-0.3,0.3-0.6,0.6-0.4l7.7,4.4C29.3,24,29.3,24.4,29,24.6z"} - %symbol#video_button_symbol{viewBox: "0 0 48 48"} - %path.fg{d: "M41,7.4c-4.6-4.5-10.6-7-17-7c-6.3,0-12.3,2.5-16.7,6.8c-4.6,4.5-7,10.5-7.2,16.8c0,6.4,2.5,12.4,6.9,16.9 c4.5,4.6,10.5,7,17,7c6.3,0,12.3-2.5,16.7-6.8C50.1,31.9,50.2,16.8,41,7.4z M38.1,32.1c0,0.7-0.6,1.3-1.3,1.3 c-8.6,0.6-17.1,0.6-25.7,0c-0.7,0-1.3-0.6-1.3-1.3c-0.3-5.2-0.3-10.5,0-15.8c0-0.7,0.6-1.3,1.3-1.3c8.6-0.6,17.1-0.6,25.7,0 c0.7,0,1.3,0.6,1.3,1.3C38.5,21.6,38.5,26.8,38.1,32.1z M29,24.6L21.3,29c-0.3,0.2-0.6,0-0.6-0.4v-8.9c0-0.3,0.3-0.6,0.6-0.4 l7.7,4.4C29.3,24,29.3,24.4,29,24.6z"} - - %symbol#document_symbol{viewBox: "0 0 48 48"} - %path.fg{d: "M40.9,7.5c-4.6-4.5-10.5-7-16.9-7c-6.3,0-12.2,2.4-16.6,6.8c-4.6,4.5-7,10.4-7.1,16.7c0,6.4,2.4,12.3,6.9,16.8 c4.5,4.6,10.4,7,16.9,7c6.3,0,12.2-2.4,16.6-6.8C50,31.9,50.1,16.9,40.9,7.5z M38.4,38.8c-3.8,3.8-8.9,6-14.4,6s-10.7-2.1-14.6-6.1 c-3.9-4-6-9-6-14.6c0-5.4,2.2-10.6,6.1-14.5c3.9-3.9,8.9-6,14.4-6s10.7,2.1,14.6,6.1C46.6,17.8,46.5,30.8,38.4,38.8z M36.8,26.7 c-0.8-1.5-3.3-2.3-7.1-2.3H29c-1-1.2-2.1-2.4-2.8-3.3L26,20.8c-0.3-0.4-0.6-0.7-0.8-1.1c0.5-1.5,0.8-2.8,0.9-3.7 c0.2-2.5-0.1-4.1-0.9-4.9c-0.6-0.6-1.4-0.8-2.2-0.6c-0.5,0.1-1.3,0.6-1.7,1.9c-0.6,1.7-0.4,4.8,1.3,7.6c-0.7,1.8-1.7,3.9-2.8,5.9 c-2.1,0.8-3.8,1.7-5.1,2.9c-1.7,1.6-2.3,3.3-1.8,4.5c0.3,0.8,1.1,1.3,2,1.3c0.6,0,1.3-0.2,1.9-0.6c1.4-0.9,3.3-3.8,4.6-6.2 c1.5-0.5,3.3-0.8,5.3-1l1.4-0.1c1.9,2,3.5,3.1,5,3.4l0.1,0c0.3,0,0.5,0.1,0.8,0.1c1.3,0,2.3-0.5,2.8-1.4 C37.1,28.1,37.1,27.4,36.8,26.7z M34.7,27.7c-0.1,0.1-0.3,0.1-0.7,0.1c-0.1,0-0.3,0-0.5,0c-0.6-0.1-1.2-0.5-2-1 C33.5,27,34.4,27.5,34.7,27.7z M15.1,32.3c0.1-0.3,0.4-0.9,1.2-1.8c0.4-0.4,0.9-0.7,1.3-1c-0.9,1.4-1.7,2.3-2.1,2.6 C15.3,32.2,15.2,32.3,15.1,32.3z M24.2,22.2c0.1,0.1,0.2,0.2,0.3,0.3c0.5,0.6,1.1,1.3,1.7,2c-0.9,0.1-2.1,0.3-3.3,0.5 C23.3,24,23.8,23.1,24.2,22.2z M23.7,15.8c0,0.2-0.1,0.5-0.1,0.8c-0.4-1.3-0.4-2.6-0.1-3.5c0-0.1,0.1-0.2,0.1-0.3 C23.7,13.3,23.9,14.1,23.7,15.8z"} - %symbol#document_button_symbol{viewBox: "0 0 48 48"} - %path.fg{d: "M24.6,22.3c0.7,0.9,1.5,1.9,2.4,2.9h-0.1c-1.2,0.1-2.9,0.4-4.9,0.8c0.8-1.5,1.5-3.1,2.1-4.5C24.2,21.8,24.3,22.1,24.6,22.3z M23.8,14.5c0.2-3.1-0.3-3.9-0.4-4c-0.1,0-0.3,0.3-0.5,0.8c-0.5,1.4-0.2,3.4,0.5,5.3C23.6,15.7,23.8,15,23.8,14.5z M12.8,34.6 C12.8,34.6,12.8,34.6,12.8,34.6c0.4,0,0.7-0.1,1-0.4c0.7-0.5,2-2,3.3-4.2c-1.1,0.5-2,1.2-2.7,1.9C12.9,33.5,12.7,34.4,12.8,34.6z M40.7,41c-4.4,4.4-10.3,6.8-16.6,6.8c-6.5,0-12.4-2.4-16.9-7C2.7,36.3,0.3,30.4,0.3,24c0.1-6.3,2.5-12.2,7.1-16.7 C11.8,2.9,17.7,0.5,24,0.5c6.4,0,12.3,2.5,16.9,7C50.1,16.9,50,31.9,40.7,41z M38.9,27.7c-1-1.7-3.9-2.6-8.2-2.6c-0.3,0-0.6,0-1,0 c-1.2-1.3-2.4-2.8-3.4-4.1c-0.5-0.6-1-1.2-1.4-1.8v0c0.6-1.9,1-3.4,1.1-4.5c0.2-2.9-0.1-4.8-1-5.7c-0.6-0.6-1.5-0.9-2.3-0.6 c-0.6,0.2-1.4,0.7-1.9,2.1c-0.7,2.1-0.4,5.9,1.6,8.9c-0.9,2.3-2.1,4.9-3.4,7.4c-2.5,0.9-4.6,2.1-6.1,3.5c-1.9,1.9-2.7,3.7-2.1,5.1 c0.4,0.9,1.1,1.4,2.1,1.4c0.7,0,1.4-0.2,2.1-0.7c1.8-1.2,4.2-5.1,5.4-7.4c2.6-0.8,5.2-1.1,6.5-1.3c0.6,0,1.2-0.1,1.8-0.1 c2.3,2.4,4.2,3.7,5.9,4c0.4,0,0.7,0.1,1,0.1c1.4,0,2.6-0.5,3.1-1.5C39.3,29.2,39.3,28.4,38.9,27.7z M31.9,27.3 c1.3,1.1,2.3,1.7,3.2,1.9c0.2,0,0.5,0,0.6,0c0.7,0,1.1-0.2,1.2-0.4c0,0,0,0,0-0.1C36.7,28.2,35.3,27.4,31.9,27.3z"} - - %symbol#quote_symbol{viewBox: "0 0 48 48"} - %path.fg{d: "M40.9,7.5c-4.6-4.5-10.5-7-16.9-7c-6.3,0-12.2,2.4-16.6,6.8c-4.6,4.5-7,10.4-7.1,16.7c0,6.4,2.4,12.3,6.9,16.8 c4.5,4.6,10.4,7,16.9,7c6.3,0,12.2-2.4,16.6-6.8C50,31.9,50.1,16.9,40.9,7.5z M38.4,38.8c-3.8,3.8-8.9,6-14.4,6 c-5.5,0-10.7-2.1-14.6-6.1s-6-9-6-14.6c0-5.4,2.2-10.6,6.1-14.5s8.9-6,14.4-6c5.5,0,10.7,2.1,14.6,6.1 C46.6,17.8,46.5,30.8,38.4,38.8z M17.8,15.5c3.2,0,5.7,3,5.7,7c0,5.2-4.8,10.4-9.8,10.4c-0.7,0-1.4-0.6-1.4-1.2 c0-2.6,3.7-0.8,4.6-6.5c-2.7-0.7-4.3-2.4-4.3-4.6C12.7,17.9,15,15.5,17.8,15.5z M30.3,15.5c3.2,0,5.7,3,5.7,7 c0,5.2-4.8,10.4-9.8,10.4c-0.7,0-1.4-0.6-1.4-1.2c0-2.6,3.7-0.8,4.6-6.5c-2.7-0.7-4.3-2.4-4.3-4.6C25.1,17.9,27.5,15.5,30.3,15.5z"} - %symbol#quote_button_symbol{viewBox: "0 0 48 48"} - %path.fg{d: "M40.9,7.5c-4.6-4.5-10.5-7-16.9-7c-6.3,0-12.2,2.4-16.6,6.8c-4.6,4.5-7,10.4-7.1,16.7c0,6.4,2.4,12.3,6.9,16.8 c4.5,4.6,10.4,7,16.9,7c6.3,0,12.2-2.4,16.6-6.8C50,31.9,50.1,16.9,40.9,7.5z M17.8,15.5c3.2,0,5.7,3,5.7,7c0,5.2-4.8,10.4-9.8,10.4 c-0.7,0-1.4-0.6-1.4-1.2c0-2.6,3.7-0.8,4.6-6.5c-2.7-0.7-4.3-2.4-4.3-4.6C12.7,17.9,15,15.5,17.8,15.5z M30.3,15.5 c3.2,0,5.7,3,5.7,7c0,5.2-4.8,10.4-9.8,10.4c-0.7,0-1.4-0.6-1.4-1.2c0-2.6,3.7-0.8,4.6-6.5c-2.7-0.7-4.3-2.4-4.3-4.6 C25.1,17.9,27.5,15.5,30.3,15.5z"} - - %symbol#close_symbol{viewBox: "0 0 48 48"} - %path{d: "M41.2,7.1c-0.6-0.6-1.7-0.6-2.3,0L24.1,21.9L9.3,6.9C8.7,6.3,7.7,6.3,7,6.9C6.4,7.5,6.4,8.6,7,9.2l14.8,15l-15,14.8 c-0.6,0.6-0.6,1.7,0,2.3c0.4,0.4,0.8,0.4,1.3,0.4c0.4,0,0.8,0,1.3-0.4l14.8-14.8l14.8,14.8c0.4,0.4,0.8,0.4,1.3,0.4s0.8,0,1.3-0.4 c0.6-0.6,0.6-1.7,0-2.3l-15-14.8L41.2,9.4C41.8,8.8,41.8,7.7,41.2,7.1z"} - - - %symbol#right_arrow_symbol{viewBox: "0 0 100 100"} - %path{d: "M76.7,47.6c1.2,1.2,1.2,3.6,0,4.8L55.9,73.1c-1.3,1.3-3.4,1.3-4.8,0c-0.7-0.6-1-1.4-1-2.3c0-0.8,0.3-1.7,1-2.3l15-15.1H25 c-1.8,0-3.3-1.6-3.3-3.3c0-1.8,1.4-3.3,3.3-3.3h41.1L51,31.6c-1.3-1.3-1.3-3.4,0-4.8s3.4-1.3,4.8,0L76.7,47.6z M100,49.7V50 c0,27.4-22.3,49.8-49.7,50C22.8,100.2,0.2,77.9,0,50C0,22.6,22.3,0.2,49.7,0c13.3-0.1,26,5,35.4,14.4l0,0 C94.7,23.8,99.9,36.3,100,49.7z M93.2,49.7c-0.1-11.6-4.7-22.3-12.9-30.6c-8.1-8-19-12.4-30.6-12.3c-23.7,0.1-43,19.6-43,43.6 c0.1,23.9,19.7,43.1,43.6,43C74,93.1,93.2,73.7,93.2,50L93.2,49.7z"} - %symbol#left_arrow_symbol{viewBox: "0 0 100 100"} - %path{d: "M23.3,52.4c-1.2-1.2-1.2-3.6,0-4.8l20.8-20.8c1.3-1.3,3.4-1.3,4.8,0c0.7,0.6,1,1.4,1,2.3c0,0.8-0.3,1.7-1,2.3l-15,15.1H75 c1.8,0,3.3,1.6,3.3,3.3c0,1.8-1.4,3.3-3.3,3.3H33.9L49,68.4c1.3,1.3,1.3,3.4,0,4.8s-3.4,1.3-4.8,0L23.3,52.4z M0,50.3V50 C0,22.6,22.3,0.2,49.7,0C77.2-0.2,99.8,22.1,100,50c0,27.4-22.3,49.8-49.7,50c-13.3,0.1-26-5-35.4-14.4l0,0 C5.3,76.2,0.1,63.7,0,50.3z M6.8,50.3c0.1,11.6,4.7,22.3,12.9,30.6c8.1,8,19,12.4,30.6,12.3c23.7-0.1,43-19.6,43-43.6 c-0.1-23.9-19.7-43.1-43.6-43C26,6.9,6.8,26.3,6.8,50L6.8,50.3z"} - %symbol#popout_symbol{viewBox: "0 0 100 100"} - %path{d: "M67.1,29.4c1.7,0,3.4,1.6,3.4,3.4l0,29.4c0,1.9-1.5,3.4-3.4,3.4c-0.9,0.1-1.7-0.3-2.4-0.9c-0.6-0.6-0.9-1.4-0.9-2.4L63.7,41 L34.7,70c-1.3,1.3-3.5,1.3-4.7,0c-1.3-1.3-1.3-3.4,0-4.7L59,36.3l-21.4,0c-1.9,0-3.4-1.5-3.4-3.4c0-1.9,1.5-3.4,3.4-3.4L67.1,29.4z M85.1,14.4l0.2,0.2c19.4,19.4,19.4,51,0.2,70.5c-19.3,19.6-51.1,19.8-70.9,0.2c-19.4-19.4-19.4-51-0.2-70.5C23.8,5.4,36.3,0,49.7,0 l0,0C63-0.1,75.6,5.1,85.1,14.4z M80.3,19.2C72.1,11.1,61.2,6.7,49.6,6.7c-11.4,0.1-22.2,4.6-30.3,12.9C2.6,36.4,2.7,63.8,19.7,80.8 c17,16.8,44.4,16.6,61.2-0.4c16.6-16.9,16.4-44.2-0.3-61L80.3,19.2z"} - - %symbol#first_symbol{viewBox: "0 0 48 64"} - %path{d: "M29.1,9.62a1.61,1.61,0,0,1,2.27,2.27L19.26,24,31.37,36.11a1.61,1.61,0,1,1-2.27,2.27L15.85,25.14a1.61,1.61,0,0,1,0-2.27Z"} - %symbol#last_symbol{viewBox: "0 0 48 64"} - %path{d: "M20.13,9.7A1.59,1.59,0,0,0,17.88,12l12,12-12,12a1.59,1.59,0,1,0,2.25,2.25L33.25,25.07a1.59,1.59,0,0,0,0-2.25Z"} - %symbol#prev_symbol{viewBox: "0 0 48 64"} - %path{d: "M27.91,9.62a1.61,1.61,0,1,1,2.27,2.27L18.07,24,30.18,36.11a1.61,1.61,0,1,1-2.27,2.27L14.66,25.14a1.61,1.61,0,0,1,0-2.27Z"} - %symbol#next_symbol{viewBox: "0 0 48 64"} - %path{d: "M20.13,9.7A1.59,1.59,0,0,0,17.88,12l12,12-12,12a1.59,1.59,0,1,0,2.25,2.25L33.25,25.07a1.59,1.59,0,0,0,0-2.25Z"} - - %symbol#edit_symbol{viewBox: "0 0 48 64"} - %path{d: "M11.5,32l4.4,4.4l-6.3,1.8L11.5,32z M33.4,9.1c0.1-0.1,0.2-0.1,0.3-0.1c0.1,0,0.2,0.1,0.3,0.1l4.9,4.9 c0.1,0.1,0.1,0.3,0.1,0.3c0,0.1,0,0.2-0.1,0.3l-3.6,3.6l-5.6-5.6L33.4,9.1z M27.7,14.7l5.6,5.6L18.6,35L13,29.4L27.7,14.7z M7.5,42 c0.1,0,0.3,0,0.4-0.1l10.3-3c0.5-0.1,1.1-0.4,1.5-0.9L41,16.8c0.6-0.6,1-1.5,1-2.5c0-0.9-0.3-1.8-1-2.4L36.1,7 c-1.3-1.3-3.6-1.3-4.9,0L10,28.3c-0.4,0.4-0.7,0.9-0.9,1.5l-3,10.3c-0.1,0.5,0,1.1,0.4,1.5C6.7,41.9,7.1,42,7.5,42L7.5,42z"} - - - // positioning controls for inserted assets - %symbol#left_symbol{viewBox: "0 0 48 48"} - %rect.fg{x:"13.3", y: "13.9", width: "26.6", height: "2.3"} - %rect.fg{x:"24.1", y: "18.4", width: "15.8", height: "2.3"} - %rect.fg{x:"24.1", y: "23", width: "15.8", height: "2.3"} - %rect.fg{x:"24.1", y: "27.6" , width: "15.8", height: "2.3"} - %rect.fg{x:"13.3", y: "32.2", width: "26.6", height: "2.3"} - %rect.fg{x:"8.9", y: "18.4", width: "13.4", height: "11.4"} - - %symbol#right_symbol{viewBox: "0 0 48 48"} - %rect.fg{x: "8.9", y: "13.9", width: "26.6", height: "2.3"} - %rect.fg{x: "8.9", y: "18.4", width: "15.8", height: "2.3"} - %rect.fg{x: "8.9", y: "23", width: "15.8", height: "2.3"} - %rect.fg{x: "8.9", y: "27.6", width: "15.8", height: "2.3"} - %rect.fg{x: "8.9", y: "32.2", width: "26.6", height: "2.3"} - %rect.fg{x: "26.5", y: "18.4", width: "13.4", height: "11.4"} - - %symbol#full_symbol{viewBox: "0 0 48 48"} - %rect.fg{x: "10.7", y: "13.7", width: "26.6", height: "2.3"} - %rect.fg{x: "10.7", y: "32", width: "26.6", height: "2.3"} - %rect.fg{x: "10.7", y: "18.2", width: "26.6", height: "11.4"} - - %symbol#wide_symbol{viewBox: "0 0 48 48"} - %rect.fg{x: "10.7", y: "13.7", width: "26.6", height: "2.3"} - %rect.fg{x: "10.7", y: "32", width: "26.6", height: "2.3"} - %rect.fg{x: "6.5", y: "18.2", width: "34.9", height: "11.4"} - - %symbol#hero_button{viewBox: "0 0 48 48"} - %path.bg{d: "M40.3,7.6c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.6,40.3,7.6z"} - %path.fg{d: "M4.7,36.5C8.8,42.7,15.9,46.9,24,46.9s15.2-4.2,19.3-10.4H4.7z" } - %path.fg{d: "M43.6,11.9c-4-6.6-11.3-11-19.6-11S8.4,5.3,4.4,11.9H43.6z" } - - // Toolbar buttons - %symbol#bold_button{viewBox: "0 0 48 48"} - %path.fg{d: "M26.5,18.4c0-1.6-1.3-2.4-2.8-2.4H21v5.1h2.7C25.4,21.1,26.5,20.1,26.5,18.4z"} - %path.fg{d: "M24.7,25.7H21v5.7h4c1.9,0,3.2-1.1,3.2-3C28.3,26.8,27.1,25.7,24.7,25.7z"} - %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M25.7,35.9h-7.1 c-1.6,0-2.7-1-2.7-2.6V14c0-1.6,1.1-2.6,2.7-2.6h6.6c3.6,0,6.5,2.4,6.5,6c0,2.4-1,4-3.2,5v0.1c2.9,0.4,5.2,2.8,5.2,5.8 C33.7,33.3,30.4,35.9,25.7,35.9z"} - - %symbol#italic_button{viewBox: "0 0 48 48"} - %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M32.1,13.9l-9.4,19.5 c-0.8,1.7-2.7,2.7-4.7,2.7c-1.9,0-2.9-1-2.1-2.7l9.4-19.5c0.8-1.7,2.7-2.7,4.7-2.7C31.9,11.2,32.9,12.2,32.1,13.9z"} - - %symbol#link_button{viewBox: "0 0 48 48"} - %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M32.1,13.9l-9.4,19.5 c-0.8,1.7-2.7,2.7-4.7,2.7c-1.9,0-2.9-1-2.1-2.7l9.4-19.5c0.8-1.7,2.7-2.7,4.7-2.7C31.9,11.2,32.9,12.2,32.1,13.9z"} - - %symbol#ol_button{viewBox: "0 0 48 48"} - %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M12.4,11.8h1.2c0.4,0,0.6,0.3,0.6,0.6v4.7 c0,0.4-0.3,0.6-0.6,0.6s-0.6-0.2-0.6-0.6v-4.2h-0.5c-0.4,0-0.6-0.3-0.6-0.6C11.8,12.1,12,11.8,12.4,11.8z M13.3,36.2 c-1.2,0-2-0.9-2-1.6c0-0.3,0.3-0.6,0.6-0.6c0.6,0,0.4,1,1.4,1c0.4,0,0.8-0.3,0.8-0.8c0-1.2-1.4-0.3-1.4-1.3c0-0.9,1.2-0.3,1.2-1.2 c0-0.3-0.2-0.6-0.6-0.6c-0.8,0-0.7,0.8-1.2,0.8c-0.3,0-0.5-0.3-0.5-0.6c0-0.6,0.9-1.3,1.8-1.3c1.2,0,1.8,0.9,1.8,1.5 c0,0.5-0.2,1-0.7,1.3c0.6,0.3,1,0.8,1,1.5C15.4,35.4,14.5,36.2,13.3,36.2z M14.9,26.9h-2.8c-0.4,0-0.6-0.2-0.6-0.5 c0-0.2,0.1-0.3,0.2-0.4c0.7-0.8,1.4-1.6,2.1-2.5c0.1-0.2,0.3-0.5,0.3-0.8c0-0.3-0.3-0.6-0.6-0.6c-1,0-0.5,1.3-1.3,1.3 c-0.4,0-0.6-0.3-0.6-0.6c0-1,0.9-1.9,1.9-1.9s1.8,0.7,1.8,1.7c0,1.2-1.3,2.3-2,3.2h1.5c0.4,0,0.6,0.2,0.6,0.5 C15.5,26.7,15.2,26.9,14.9,26.9z M33.9,36.1H21.8c-1.6,0-2.9-1.3-2.9-2.9s1.3-2.9,2.9-2.9h12.2c1.6,0,2.9,1.3,2.9,2.9 S35.5,36.1,33.9,36.1z M33.9,26.9H21.8c-1.6,0-2.9-1.3-2.9-2.9s1.3-2.9,2.9-2.9h12.2c1.6,0,2.9,1.3,2.9,2.9S35.5,26.9,33.9,26.9z M33.9,17.7H21.8c-1.6,0-2.9-1.3-2.9-2.9s1.3-2.9,2.9-2.9h12.2c1.6,0,2.9,1.3,2.9,2.9S35.5,17.7,33.9,17.7z"} - - %symbol#ul_button{viewBox: "0 0 48 48"} - %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M14.2,36.1c-1.6,0-2.9-1.3-2.9-2.9 c0-1.6,1.3-2.9,2.9-2.9c1.6,0,2.9,1.3,2.9,2.9C17.1,34.8,15.8,36.1,14.2,36.1z M14.2,26.9c-1.6,0-2.9-1.3-2.9-2.9s1.3-2.9,2.9-2.9 c1.6,0,2.9,1.3,2.9,2.9S15.8,26.9,14.2,26.9z M14.2,17.7c-1.6,0-2.9-1.3-2.9-2.9c0-1.6,1.3-2.9,2.9-2.9c1.6,0,2.9,1.3,2.9,2.9 C17.1,16.4,15.8,17.7,14.2,17.7z M33.9,36.1H21.8c-1.6,0-2.9-1.3-2.9-2.9c0-1.6,1.3-2.9,2.9-2.9h12.2c1.6,0,2.9,1.3,2.9,2.9 C36.8,34.8,35.5,36.1,33.9,36.1z M33.9,26.9H21.8c-1.6,0-2.9-1.3-2.9-2.9s1.3-2.9,2.9-2.9h12.2c1.6,0,2.9,1.3,2.9,2.9 S35.5,26.9,33.9,26.9z M33.9,17.7H21.8c-1.6,0-2.9-1.3-2.9-2.9c0-1.6,1.3-2.9,2.9-2.9h12.2c1.6,0,2.9,1.3,2.9,2.9 C36.8,16.4,35.5,17.7,33.9,17.7z"} - - %symbol#h1_button{viewBox: "0 0 48 48"} - %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M34.6,33.7 c0,1.7-1.1,2.7-2.6,2.7s-2.6-1-2.6-2.7v-7.5H18.7v7.5c0,1.7-1.1,2.7-2.6,2.7s-2.6-1-2.6-2.7V14.3c0-1.7,1.1-2.7,2.6-2.7 s2.6,1,2.6,2.7v7.3h10.8v-7.3c0-1.7,1.1-2.7,2.6-2.7s2.6,1,2.6,2.7V33.7z"} - - %symbol#h2_button{viewBox: "0 0 48 48"} - %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M33.2,33.3 c0,1.6-1,2.7-2.5,2.7s-2.5-1.1-2.5-2.7v-8.6c0-2.3-1.4-3.4-3.2-3.4c-2,0-3.2,1.5-3.2,3.4v8.6c0,1.6-1,2.7-2.5,2.7s-2.5-1.1-2.5-2.7 V12.2c0-1.6,1-2.7,2.5-2.7s2.5,1.1,2.5,2.7v6.7h0.1c1-1.3,3-1.7,4.5-1.7c3.9,0,6.8,2.5,6.8,6.7V33.3z"} - - %symbol#anchor_button{viewBox: "0 0 48 48"} - %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M23.2,36.1 c-1.6,1.6-3.7,2.6-6,2.5c-2.2-0.1-4.1-0.9-5.6-2.5c-3-3.2-2.8-8.2,0.3-11.3l4.9-4.9c0.1-0.1,0.2-0.2,0.3-0.2c0.4-0.4,1-0.8,1.6-1.1 c1.5-0.8,3.2-1.1,4.9-0.9c0.4,0,0.8,0.1,1.2,0.2c0.4,0.1,0.8,0.2,1.1,0.4c0.8,0.4,1.5,0.9,2.2,1.5c0.8,0.8,0.7,2.2-0.1,3l-1,1 c-0.1,0.2-0.3,0.3-0.5,0.4c-0.2-0.7-0.6-1.4-1.1-1.9c-0.6-0.6-1.4-1-2.2-1.2c-0.3-0.1-0.6-0.1-0.9-0.1h-0.2 c-0.4,0.1-0.7,0.1-1.1,0.2c-0.7,0.2-1.4,0.6-1.9,1.1l-4.9,4.9c-0.7,0.7-1.3,1.7-1.4,2.8c-0.1,1.2,0.3,2.5,1.2,3.4 c0.9,0.9,2.1,1.4,3.4,1.2c1.1-0.1,2-0.6,2.8-1.4l0.9-0.9c0.5-0.5,1.2-0.6,1.8-0.4c0.4,0.1,0.8,0.2,1.2,0.2c0.4,0.1,0.7,0.1,1.1,0.1 c0.4,0,0.8-0.1,1.2-0.1L23.2,36.1z M36.1,23.3l-4.9,4.9c-0.1,0.1-0.2,0.2-0.3,0.2c-0.4,0.4-1,0.9-1.6,1.2c-1.2,0.6-2.5,0.9-3.8,0.9 c-0.4,0-0.7,0-1.1-0.1c-0.4,0-0.8-0.1-1.2-0.2c-0.4-0.1-0.8-0.2-1.1-0.4c-0.8-0.4-1.5-0.9-2.2-1.5c-0.8-0.8-0.8-2.2,0.1-3l1-1 c0.2-0.2,0.4-0.3,0.6-0.4c0.2,0.7,0.6,1.4,1.1,1.9c0.6,0.6,1.4,1,2.2,1.2c0.3,0.1,0.6,0.1,0.9,0.1h0.1c0.4-0.1,0.7-0.1,1.1-0.2 c0.7-0.2,1.4-0.6,1.9-1.1l4.9-4.9c1.6-1.6,1.9-4.2,0.4-5.9c-0.9-1.1-2.2-1.7-3.7-1.5c-1.1,0.1-2.1,0.6-2.8,1.4l-1,1 c-0.4,0.4-0.9,0.5-1.4,0.3c-0.4-0.1-0.8-0.2-1.2-0.2c-0.9-0.1-1.8-0.1-2.7,0.1l3.7-3.7c1.6-1.6,3.7-2.6,6-2.5 c2.2,0.1,4.1,0.9,5.6,2.5C39.5,15,39.3,20.1,36.1,23.3z"} - - %symbol#clear_button{viewBox: "0 0 48 48"} - %path.fg{d: "M40.3,7.8c-9-9-23.5-9-32.5,0s-9,23.5,0,32.5s23.5,9,32.5,0S49.2,16.8,40.3,7.8z M26.8,24.1c2.8,2.8,5.7,5.7,8.5,8.5 c0.7,0.7,0.8,1.8,0.1,2.5c-0.7,0.8-1.8,0.8-2.6,0.1c-0.1-0.1-0.1-0.1-0.2-0.2c-2.8-2.8-5.5-5.5-8.4-8.4c-0.1-0.1-0.1-0.1-0.2-0.2 c-0.1,0.1-0.1,0.1-0.2,0.2c-2.8,2.8-5.7,5.7-8.5,8.5c-0.8,0.8-2,0.8-2.7-0.1c-0.6-0.7-0.5-1.7,0.1-2.4c0.5-0.5,1-1,1.5-1.5 c2.4-2.4,4.8-4.8,7.1-7.1c0-0.1,0.1-0.1,0.2-0.1c-0.1-0.1-0.1-0.2-0.2-0.2c-2.8-2.8-5.7-5.7-8.5-8.5c-0.7-0.7-0.8-1.8-0.1-2.5 c0.7-0.8,1.8-0.8,2.6-0.1c0.1,0.1,0.1,0.1,0.2,0.2c2.8,2.8,5.5,5.5,8.4,8.4c0.1,0.1,0.1,0.1,0.2,0.3c0.1-0.1,0.1-0.2,0.2-0.2 c2.8-2.8,5.7-5.7,8.5-8.5c0.7-0.9,2-0.8,2.7,0c0.6,0.7,0.5,1.7-0.1,2.4c-0.2,0.2-0.6,0.6-0.8,0.8c-2.6,2.6-5.2,5.2-7.8,7.8 c-0.1,0-0.1,0.1-0.2,0.1C26.7,24,26.8,24.1,26.8,24.1z"} - + From e15a7146d41804314d161afc9caa36d9ff019026 Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Fri, 17 Apr 2020 10:12:00 +0630 Subject: [PATCH 030/128] Fix issue of time not able to select n change --- app/assets/javascripts/droom/widgets.js.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/droom/widgets.js.coffee b/app/assets/javascripts/droom/widgets.js.coffee index a7b368252..0ba0e8a39 100644 --- a/app/assets/javascripts/droom/widgets.js.coffee +++ b/app/assets/javascripts/droom/widgets.js.coffee @@ -78,8 +78,8 @@ jQuery ($) -> @field.focus @show @field.blur @hide - select: (item) => - @field.val(item.value) + select: (value) => + @field.val(value) @field.trigger('change') change: (e) => From 264bfc553a03a6b0a609a1862351f40514085be2 Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Mon, 18 May 2020 20:20:54 +0630 Subject: [PATCH 031/128] Load Preferences view to update password of account --- app/views/droom/users/show/_account_info.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/droom/users/show/_account_info.html.haml b/app/views/droom/users/show/_account_info.html.haml index bb4dd7987..10ca22a44 100644 --- a/app/views/droom/users/show/_account_info.html.haml +++ b/app/views/droom/users/show/_account_info.html.haml @@ -4,7 +4,7 @@ %section{class: cssclass, data: {refreshing: true, url: droom.user_url(@user, view: 'account_info', format: :js)}} - if @user && can?(:edit, @user) %span.user_controls - = link_to t(:edit_user_profile_symbol), droom.edit_user_url(@user, view: 'account_info'), class: "edit", data: {action: 'popup', affected: "section.account_info"} + = link_to t(:edit_user_profile_symbol), droom.edit_user_url(@user, view: 'preferences'), class: "edit", data: {action: 'popup', affected: "section.account_info"} %h2.section = t :user_profile_account From 26fd62c6f83676009ff61483d0e0ad9d7559923e Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Wed, 20 May 2020 09:53:56 +0630 Subject: [PATCH 032/128] Load proxy action in droom.js file --- app/assets/javascripts/droom.js.coffee | 1 + app/assets/javascripts/droom/widgets.js.coffee | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/droom.js.coffee b/app/assets/javascripts/droom.js.coffee index 2ba063631..70751d242 100644 --- a/app/assets/javascripts/droom.js.coffee +++ b/app/assets/javascripts/droom.js.coffee @@ -70,6 +70,7 @@ jQuery ($) -> @find_including_self('[data-action="replace"]').replace_with_remote_content() @find_including_self('[data-action="autofetch"]').replace_with_remote_content ".holder", {force: true} @find_including_self('[data-action="slide"]').sliding_link() + @find_including_self('[data-action="proxy"]').click_proxy() @find_including_self('[data-action="fit"]').self_sizes() @find_including_self('form[data-action="filter"]').filter_form() @find_including_self('form[data-action="quick_search"]').quick_search_form() diff --git a/app/assets/javascripts/droom/widgets.js.coffee b/app/assets/javascripts/droom/widgets.js.coffee index 0ba0e8a39..f90b56089 100644 --- a/app/assets/javascripts/droom/widgets.js.coffee +++ b/app/assets/javascripts/droom/widgets.js.coffee @@ -102,10 +102,12 @@ jQuery ($) -> @each -> new FilePicker @ - $.fn.click_proxy = (target_selector) -> - this.bind "click", (e) -> - e.preventDefault() - $(target_selector).click() + $.fn.click_proxy = () -> + @each -> + target = $(@).attr('data-affected') + $(@).bind "click", (e) -> + e.preventDefault() if e + $(target).trigger "click" class FilePicker constructor: (element) -> From 05f42651c27e1bb74b29520e9df7ed460e7ae9f6 Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Wed, 20 May 2020 09:54:39 +0630 Subject: [PATCH 033/128] Load domain address from ENV --- app/assets/javascripts/droom/lib/assets.js.coffee.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/droom/lib/assets.js.coffee.erb b/app/assets/javascripts/droom/lib/assets.js.coffee.erb index ee00b9855..f150aed9b 100644 --- a/app/assets/javascripts/droom/lib/assets.js.coffee.erb +++ b/app/assets/javascripts/droom/lib/assets.js.coffee.erb @@ -1,5 +1,5 @@ jQuery ($) -> $.withZxcbvn = (fn) -> - url = "<%= URI.join(Settings.url, asset_path('droom/zxcvbn.js')) %>" + url = "<%= URI.join((ENV['DROOM_URL'] || Settings.url), asset_path('droom/zxcvbn.js')) %>" $.getScript(url).done (response) => fn?(response) From 1e681514958bca42086007b02034d0e5f92e16e7 Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Wed, 20 May 2020 12:39:02 +0630 Subject: [PATCH 034/128] Get URL address from ENV only --- app/assets/javascripts/droom/lib/assets.js.coffee.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/droom/lib/assets.js.coffee.erb b/app/assets/javascripts/droom/lib/assets.js.coffee.erb index f150aed9b..1cd426374 100644 --- a/app/assets/javascripts/droom/lib/assets.js.coffee.erb +++ b/app/assets/javascripts/droom/lib/assets.js.coffee.erb @@ -1,5 +1,6 @@ jQuery ($) -> $.withZxcbvn = (fn) -> - url = "<%= URI.join((ENV['DROOM_URL'] || Settings.url), asset_path('droom/zxcvbn.js')) %>" + url = "<%= URI.join( ENV['DROOM_URL'], asset_path('droom/zxcvbn.js')) %>" + console.log "URL: #{url}" $.getScript(url).done (response) => fn?(response) From 2c6011b858b5f0e319275e03b0cfdd90cb1cc98c Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Wed, 20 May 2020 14:02:19 +0630 Subject: [PATCH 035/128] Load domain from Settings file --- app/assets/javascripts/droom/lib/assets.js.coffee.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/droom/lib/assets.js.coffee.erb b/app/assets/javascripts/droom/lib/assets.js.coffee.erb index 1cd426374..5b62b3f19 100644 --- a/app/assets/javascripts/droom/lib/assets.js.coffee.erb +++ b/app/assets/javascripts/droom/lib/assets.js.coffee.erb @@ -1,6 +1,6 @@ jQuery ($) -> $.withZxcbvn = (fn) -> - url = "<%= URI.join( ENV['DROOM_URL'], asset_path('droom/zxcvbn.js')) %>" + url = "<%= URI.join( Settings.url, asset_path('droom/zxcvbn.js')) %>" console.log "URL: #{url}" $.getScript(url).done (response) => fn?(response) From d2bdf648d901c2e6b088249b4a9869b8caed3d94 Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Wed, 20 May 2020 14:32:17 +0630 Subject: [PATCH 036/128] Ommit domain from url buidling --- app/assets/javascripts/droom/lib/assets.js.coffee.erb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/assets/javascripts/droom/lib/assets.js.coffee.erb b/app/assets/javascripts/droom/lib/assets.js.coffee.erb index 5b62b3f19..f9195b394 100644 --- a/app/assets/javascripts/droom/lib/assets.js.coffee.erb +++ b/app/assets/javascripts/droom/lib/assets.js.coffee.erb @@ -1,6 +1,5 @@ jQuery ($) -> $.withZxcbvn = (fn) -> - url = "<%= URI.join( Settings.url, asset_path('droom/zxcvbn.js')) %>" - console.log "URL: #{url}" + url = "<%= asset_path('droom/zxcvbn.js') %>" $.getScript(url).done (response) => fn?(response) From cdd7f8468aac91477d734b106eb4e9d8abd5a26d Mon Sep 17 00:00:00 2001 From: will-r Date: Fri, 22 May 2020 10:02:38 +0100 Subject: [PATCH 037/128] fixes to document indexing, chiefly to update the _changed? calls --- app/models/droom/document.rb | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/app/models/droom/document.rb b/app/models/droom/document.rb index 08b7e05a1..efa71d80f 100644 --- a/app/models/droom/document.rb +++ b/app/models/droom/document.rb @@ -108,9 +108,8 @@ def file_bucket ## Search # - searchkick _all: false, callbacks: false, default_fields: [:name, :content], highlight: [:name, :content] - attr_accessor :updating_index - after_save :enqueue_for_indexing, unless: :updating_index? + searchkick callbacks: false, default_fields: [:name, :content], highlight: [:name, :content] + after_save :enqueue_for_indexing def search_data { @@ -159,30 +158,29 @@ def inherit_confidentiality end def enqueue_for_indexing! + Rails.logger.debug "⚠️ enqueue_for_indexing Droom::Document #{id}" Droom::IndexDocumentJob.perform_later(id, Time.now.to_i) end def enqueue_for_indexing - if name_changed? || file_file_name_changed? || file_fingerprint_changed? - Droom::IndexDocumentJob.perform_later(id, Time.now.to_i) + if saved_change_to_name? || saved_change_to_file_file_name? || saved_change_to_file_fingerprint? + enqueue_for_indexing! end end def update_index! - unless self.updating_index - self.updating_index = true - with_local_file do |path| - @file_content = Yomu.new(path).text - self.reindex - end - self.update_column(:indexed_at, Time.now) - self.updating_index = false + with_local_file do |path| + @file_content = Yomu.new(path).text + self.reindex + self.secondary_reindex + end + self.update_column(:indexed_at, Time.now) end true end - def updating_index? - !!updating_index + def secondary_reindex + # noop here end # Pass block to perform operations with a local file, which will be From 7e0c87dd7984f23f2a2c959fcb5456c71ac72d27 Mon Sep 17 00:00:00 2001 From: will-r Date: Fri, 22 May 2020 10:13:30 +0100 Subject: [PATCH 038/128] typo --- app/models/droom/document.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/models/droom/document.rb b/app/models/droom/document.rb index efa71d80f..283301d11 100644 --- a/app/models/droom/document.rb +++ b/app/models/droom/document.rb @@ -175,7 +175,6 @@ def update_index! self.secondary_reindex end self.update_column(:indexed_at, Time.now) - end true end From d20f7133c7f63aa8d910b496438c9c07b86aa3bf Mon Sep 17 00:00:00 2001 From: will-r Date: Fri, 22 May 2020 10:26:29 +0100 Subject: [PATCH 039/128] working on namespace issues in sidekiq jobs --- app/jobs/droom/index_document_job.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/jobs/droom/index_document_job.rb b/app/jobs/droom/index_document_job.rb index 481e0f5f5..5ccfc0a9f 100644 --- a/app/jobs/droom/index_document_job.rb +++ b/app/jobs/droom/index_document_job.rb @@ -1,3 +1,5 @@ +require 'droom' + module Droom class IndexDocumentJob < ActiveJob::Base From 26e78f8d3b55e5c67fa33b2f9c5f2a1a4e945148 Mon Sep 17 00:00:00 2001 From: will-r Date: Mon, 25 May 2020 06:56:55 +0100 Subject: [PATCH 040/128] add respond_to line to OrganisationsController --- app/controllers/droom/concerns/searchable.rb | 2 ++ app/controllers/droom/organisations_controller.rb | 1 + 2 files changed, 3 insertions(+) diff --git a/app/controllers/droom/concerns/searchable.rb b/app/controllers/droom/concerns/searchable.rb index 1729e065a..a6c3ebcdb 100644 --- a/app/controllers/droom/concerns/searchable.rb +++ b/app/controllers/droom/concerns/searchable.rb @@ -1,3 +1,5 @@ +# This is used in the organisations controller and made available to non-droom classes. + module Droom::Concerns::Searchable extend ActiveSupport::Concern diff --git a/app/controllers/droom/organisations_controller.rb b/app/controllers/droom/organisations_controller.rb index 8f6d5dc92..aac0d605f 100644 --- a/app/controllers/droom/organisations_controller.rb +++ b/app/controllers/droom/organisations_controller.rb @@ -2,6 +2,7 @@ module Droom class OrganisationsController < Droom::DroomController include Droom::Concerns::Searchable helper Droom::DroomHelper + respond_to :html, :js load_and_authorize_resource before_action :set_view, only: [:show, :edit, :update, :create] From e603fb88e01d362935a0f245ff181ae122b834ac Mon Sep 17 00:00:00 2001 From: will-r Date: Mon, 25 May 2020 08:39:05 +0100 Subject: [PATCH 041/128] updated vcard generator --- .../droom/concerns/address_book_property.rb | 4 ++++ app/models/droom/user.rb | 22 ++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/app/models/droom/concerns/address_book_property.rb b/app/models/droom/concerns/address_book_property.rb index fb97bf4ed..40d1356b4 100644 --- a/app/models/droom/concerns/address_book_property.rb +++ b/app/models/droom/concerns/address_book_property.rb @@ -34,4 +34,8 @@ def undefault_others end end + def address_type_name + address_type.name if address_type? + end + end diff --git a/app/models/droom/user.rb b/app/models/droom/user.rb index b4ac45f08..a31a7aca7 100644 --- a/app/models/droom/user.rb +++ b/app/models/droom/user.rb @@ -1,3 +1,5 @@ +require 'vcard' + module Droom class User < Droom::DroomRecord include Droom::Concerns::Imaged @@ -592,7 +594,7 @@ def self.for_selection ## Names # def title_ordinary? - ['Mr', 'Ms', 'Mrs', '', nil].include?(title) + title.empty? || ['mr', 'ms', 'mrs', 'mr.', 'ms.', 'mrs.'].include?(title.downcase.strip) end def title_if_it_matters @@ -623,7 +625,9 @@ def full_name def to_vcf @vcard ||= Vcard::Vcard::Maker.make2 do |maker| maker.add_name do |n| - n.given = name || "" + n.family = family_name || "" + n.given = given_name || "" + n.prefix = title unless title_ordinary? end maker.add_addr {|a| a.location = 'home' # until we do this properly with multiple contact sets @@ -633,9 +637,17 @@ def to_vcf a.street = "#{post_line1}, #{post_line2}" a.postalcode = post_code || "" } - maker.add_tel phone { |t| t.location = 'home' } unless phone.blank? - maker.add_tel mobile { |t| t.location = 'cell' } unless mobile.blank? - maker.add_email email { |e| t.location = 'home' } + emails.each do |email| + if location = email.address_type_name + maker.add_email email { |e| t.location = location.downcase } + end + end + phones.each do |phone| + if location = phone.address_type_name + location = 'Cell' if location == 'Mobile' + maker.add_tel phone { |e| t.location = location.downcase } + end + end end @vcard.to_s end From 7a9326738476c0e0890f0e79bf85f53a45f5f9bf Mon Sep 17 00:00:00 2001 From: will-r Date: Mon, 25 May 2020 08:47:17 +0100 Subject: [PATCH 042/128] vcard can include multiple addresses --- app/models/droom/user.rb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/models/droom/user.rb b/app/models/droom/user.rb index a31a7aca7..edb8b7331 100644 --- a/app/models/droom/user.rb +++ b/app/models/droom/user.rb @@ -629,14 +629,6 @@ def to_vcf n.given = given_name || "" n.prefix = title unless title_ordinary? end - maker.add_addr {|a| - a.location = 'home' # until we do this properly with multiple contact sets - a.country = post_country || "" - a.region = post_region || "" - a.locality = post_city || "" - a.street = "#{post_line1}, #{post_line2}" - a.postalcode = post_code || "" - } emails.each do |email| if location = email.address_type_name maker.add_email email { |e| t.location = location.downcase } @@ -648,6 +640,18 @@ def to_vcf maker.add_tel phone { |e| t.location = location.downcase } end end + addresses.each do |address| + if location = address.address_type_name + maker.add_addr {|a| + a.location = location.downcase + a.country = country_code || "" + a.region = region || "" + a.locality = city || "" + a.street = "#{line1}, #{line2}" + a.postalcode = postal_code || "" + } + + end end @vcard.to_s end From 033fe9038906dd2c853ef92cb0e9a43f3ef642c4 Mon Sep 17 00:00:00 2001 From: will-r Date: Mon, 25 May 2020 08:48:22 +0100 Subject: [PATCH 043/128] vcard can include multiple addresses --- app/models/droom/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/droom/user.rb b/app/models/droom/user.rb index edb8b7331..1cedc88f2 100644 --- a/app/models/droom/user.rb +++ b/app/models/droom/user.rb @@ -650,7 +650,7 @@ def to_vcf a.street = "#{line1}, #{line2}" a.postalcode = postal_code || "" } - + end end end @vcard.to_s From 4a55df5852a64a53b39b850635a6d91c0ed37b2b Mon Sep 17 00:00:00 2001 From: will-r Date: Mon, 25 May 2020 08:50:12 +0100 Subject: [PATCH 044/128] no ? for association --- app/models/droom/concerns/address_book_property.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/droom/concerns/address_book_property.rb b/app/models/droom/concerns/address_book_property.rb index 40d1356b4..b710a1405 100644 --- a/app/models/droom/concerns/address_book_property.rb +++ b/app/models/droom/concerns/address_book_property.rb @@ -35,7 +35,7 @@ def undefault_others end def address_type_name - address_type.name if address_type? + address_type.name if address_type end end From deae3814ef90f53e377c29f585f821499e214e3e Mon Sep 17 00:00:00 2001 From: will-r Date: Mon, 25 May 2020 08:52:02 +0100 Subject: [PATCH 045/128] defaults for null address types --- app/models/droom/user.rb | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/app/models/droom/user.rb b/app/models/droom/user.rb index 1cedc88f2..bca566d9f 100644 --- a/app/models/droom/user.rb +++ b/app/models/droom/user.rb @@ -630,27 +630,24 @@ def to_vcf n.prefix = title unless title_ordinary? end emails.each do |email| - if location = email.address_type_name - maker.add_email email { |e| t.location = location.downcase } - end + location = email.address_type_name || 'home' + maker.add_email email { |e| t.location = location.downcase } end phones.each do |phone| - if location = phone.address_type_name - location = 'Cell' if location == 'Mobile' - maker.add_tel phone { |e| t.location = location.downcase } - end + location = phone.address_type_name || 'cell' + location = 'cell' if location == 'Mobile' + maker.add_tel phone { |e| t.location = location.downcase } end addresses.each do |address| - if location = address.address_type_name - maker.add_addr {|a| - a.location = location.downcase - a.country = country_code || "" - a.region = region || "" - a.locality = city || "" - a.street = "#{line1}, #{line2}" - a.postalcode = postal_code || "" - } - end + location = address.address_type_name || 'home' + maker.add_addr {|a| + a.location = location.downcase + a.country = country_code || "" + a.region = region || "" + a.locality = city || "" + a.street = "#{line1}, #{line2}" + a.postalcode = postal_code || "" + } end end @vcard.to_s From 9886760a4f3badfda44d27c37e0f841bb5a91e78 Mon Sep 17 00:00:00 2001 From: will-r Date: Mon, 25 May 2020 08:53:47 +0100 Subject: [PATCH 046/128] include address properties --- app/models/droom/user.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/droom/user.rb b/app/models/droom/user.rb index bca566d9f..7bb5b52aa 100644 --- a/app/models/droom/user.rb +++ b/app/models/droom/user.rb @@ -642,11 +642,11 @@ def to_vcf location = address.address_type_name || 'home' maker.add_addr {|a| a.location = location.downcase - a.country = country_code || "" - a.region = region || "" - a.locality = city || "" - a.street = "#{line1}, #{line2}" - a.postalcode = postal_code || "" + a.country = address.country_code || "" + a.region = address.region || "" + a.locality = address.city || "" + a.street = "#{address.line1}, #{address.line2}" + a.postalcode = address.postal_code || "" } end end From 412e4462a7cc56e52d6f05386b5c92d39312bbe0 Mon Sep 17 00:00:00 2001 From: will-r Date: Mon, 25 May 2020 08:54:42 +0100 Subject: [PATCH 047/128] ...with the right column names --- app/models/droom/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/droom/user.rb b/app/models/droom/user.rb index 7bb5b52aa..0088f0030 100644 --- a/app/models/droom/user.rb +++ b/app/models/droom/user.rb @@ -645,7 +645,7 @@ def to_vcf a.country = address.country_code || "" a.region = address.region || "" a.locality = address.city || "" - a.street = "#{address.line1}, #{address.line2}" + a.street = "#{address.line_1}, #{address.line_2}" a.postalcode = address.postal_code || "" } end From 2848cb08e941213b3dcb5142b5747f493ac57d5e Mon Sep 17 00:00:00 2001 From: will-r Date: Mon, 25 May 2020 09:00:27 +0100 Subject: [PATCH 048/128] endpoint to download all users as vcf --- app/controllers/droom/users_controller.rb | 7 ++++++- config/routes.rb | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/droom/users_controller.rb b/app/controllers/droom/users_controller.rb index db47385ad..4b6227048 100644 --- a/app/controllers/droom/users_controller.rb +++ b/app/controllers/droom/users_controller.rb @@ -18,10 +18,15 @@ def index @users = paginated(@users, params[:pp].presence || 24) respond_with @users do |format| format.js { render :partial => 'droom/users/users' } - format.vcf { render :vcf => @users.map(&:to_vcf) } end end + def download + @users = @users.matching(params[:q]) unless params[:q].blank? + @users = @users.in_name_order.includes(:emails, :phones, :addresses) + render :vcf => @users.map(&:to_vcf) + end + def show respond_with @user end diff --git a/config/routes.rb b/config/routes.rb index 2737aa220..50e0e7473 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -119,6 +119,7 @@ get "activity" => "users#activity", as: :activity get :preferences, on: :member, as: :preferences put :preference, on: :member, as: :set_preference + get :download, on: :collection get :admin, on: :collection put :setup, on: :collection put :reinvite, on: :member From 66c4625dab852c003b88930fa3956f14aafbbbb5 Mon Sep 17 00:00:00 2001 From: will-r Date: Mon, 25 May 2020 09:02:51 +0100 Subject: [PATCH 049/128] no nil.empty? --- app/models/droom/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/droom/user.rb b/app/models/droom/user.rb index 0088f0030..5553b9464 100644 --- a/app/models/droom/user.rb +++ b/app/models/droom/user.rb @@ -594,7 +594,7 @@ def self.for_selection ## Names # def title_ordinary? - title.empty? || ['mr', 'ms', 'mrs', 'mr.', 'ms.', 'mrs.'].include?(title.downcase.strip) + title.nil? || ['mr', 'ms', 'mrs', 'mr.', 'ms.', 'mrs.', ''].include?(title.downcase.strip) end def title_if_it_matters From 4d30557d7081cead9656846d894b8ba75a09e7f6 Mon Sep 17 00:00:00 2001 From: will-r Date: Mon, 25 May 2020 09:05:43 +0100 Subject: [PATCH 050/128] omit empty phone and email fields from vcf --- app/controllers/droom/users_controller.rb | 2 +- app/models/droom/user.rb | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/controllers/droom/users_controller.rb b/app/controllers/droom/users_controller.rb index 4b6227048..21f1ae1fc 100644 --- a/app/controllers/droom/users_controller.rb +++ b/app/controllers/droom/users_controller.rb @@ -22,8 +22,8 @@ def index end def download - @users = @users.matching(params[:q]) unless params[:q].blank? @users = @users.in_name_order.includes(:emails, :phones, :addresses) + @users = @users.matching(params[:q]) unless params[:q].blank? render :vcf => @users.map(&:to_vcf) end diff --git a/app/models/droom/user.rb b/app/models/droom/user.rb index 5553b9464..f1b589c09 100644 --- a/app/models/droom/user.rb +++ b/app/models/droom/user.rb @@ -630,13 +630,17 @@ def to_vcf n.prefix = title unless title_ordinary? end emails.each do |email| - location = email.address_type_name || 'home' - maker.add_email email { |e| t.location = location.downcase } + if email.email? + location = email.address_type_name || 'home' + maker.add_email email.email { |e| t.location = location.downcase } + end end phones.each do |phone| - location = phone.address_type_name || 'cell' - location = 'cell' if location == 'Mobile' - maker.add_tel phone { |e| t.location = location.downcase } + if phone.phone? + location = phone.address_type_name || 'cell' + location = 'cell' if location == 'Mobile' + maker.add_tel phone.phone { |e| t.location = location.downcase } + end end addresses.each do |address| location = address.address_type_name || 'home' From 4f83bab6f11c9956407f6e3d6d6aa2feba0f5ad3 Mon Sep 17 00:00:00 2001 From: will-r Date: Mon, 25 May 2020 09:07:42 +0100 Subject: [PATCH 051/128] only internal users in address book download --- app/controllers/droom/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/droom/users_controller.rb b/app/controllers/droom/users_controller.rb index 21f1ae1fc..d8f13ae5f 100644 --- a/app/controllers/droom/users_controller.rb +++ b/app/controllers/droom/users_controller.rb @@ -22,7 +22,7 @@ def index end def download - @users = @users.in_name_order.includes(:emails, :phones, :addresses) + @users = @users.internal.in_name_order.includes(:emails, :phones, :addresses) @users = @users.matching(params[:q]) unless params[:q].blank? render :vcf => @users.map(&:to_vcf) end From 18b0b4e6a5dc54a66f2e83e45e33a73de5052936 Mon Sep 17 00:00:00 2001 From: will-r Date: Mon, 25 May 2020 09:44:37 +0100 Subject: [PATCH 052/128] pubsub has to be enabled in droom config --- app/models/droom/concerns/changes_notified.rb | 18 ++++++++++-------- lib/droom.rb | 3 --- lib/droom/config.rb | 7 ++++++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/models/droom/concerns/changes_notified.rb b/app/models/droom/concerns/changes_notified.rb index 65b6b890b..ead33e319 100644 --- a/app/models/droom/concerns/changes_notified.rb +++ b/app/models/droom/concerns/changes_notified.rb @@ -12,14 +12,16 @@ def timestamp end def notify_of_change(event, additional_data={}) - time = event == 'destroyed' ? Time.now.to_i : timestamp - change_data = { - event: event, - timestamp: time, - object_class: self.class.to_s.underscore, - object_id: id, - } - Droom::ChangesChannel.broadcast_to 'changes', change_data.merge(additional_data) + if Droom.config.enable_pubsub? + time = event == 'destroyed' ? Time.now.to_i : timestamp + change_data = { + event: event, + timestamp: time, + object_class: self.class.to_s.underscore, + object_id: id, + } + Droom::ChangesChannel.broadcast_to 'changes', change_data.merge(additional_data) + end end def notify_of_creation(additional_data={}) diff --git a/lib/droom.rb b/lib/droom.rb index 9f10eb087..c8276f24e 100644 --- a/lib/droom.rb +++ b/lib/droom.rb @@ -10,9 +10,6 @@ module Droom - # Droom configuration is handled by accessors on the Droom base module. - # Boolean items also offer the interrogative form. - mattr_accessor :config @@config = Droom::Config.new diff --git a/lib/droom/config.rb b/lib/droom/config.rb index 4a3360d41..6ad1bdadb 100644 --- a/lib/droom/config.rb +++ b/lib/droom/config.rb @@ -57,7 +57,8 @@ class Config :mc_api_key, :mc_news_template, :mc_news_list, - :session_timeout + :session_timeout, + :enable_pubsub def home_url @home_url ||= "http://example.com" @@ -289,6 +290,10 @@ def default_permissions def session_timeout @@session_timeout ||= 15.minutes end + + def enable_pubsub? + !!@enable_pubsub + end ## Mailchimp integration From 58b412d19aed430d1fd68f92fc960317406d2b34 Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Mon, 25 May 2020 20:05:33 +0630 Subject: [PATCH 053/128] Check attribute exist or not first --- app/models/droom/concerns/changes_notified.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/droom/concerns/changes_notified.rb b/app/models/droom/concerns/changes_notified.rb index ead33e319..e35d45875 100644 --- a/app/models/droom/concerns/changes_notified.rb +++ b/app/models/droom/concerns/changes_notified.rb @@ -8,7 +8,7 @@ module Droom::Concerns::ChangesNotified end def timestamp - (updated_at || created_at || Time.now).to_f + (try(:updated_at) || try(:created_at) || Time.now).to_f end def notify_of_change(event, additional_data={}) From 73d5b696309081688dc0f29372d5a9341e8b0535 Mon Sep 17 00:00:00 2001 From: will-r Date: Thu, 28 May 2020 07:33:59 +0100 Subject: [PATCH 054/128] Organisation.for_selection_with_owner, subsume extendable --- .../droom/organisations_controller.rb | 1 + app/models/droom/organisation.rb | 20 ++++++++++++++++++- .../organisations/edit/_subsume.html.haml | 8 +++++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/controllers/droom/organisations_controller.rb b/app/controllers/droom/organisations_controller.rb index aac0d605f..1d8cf255b 100644 --- a/app/controllers/droom/organisations_controller.rb +++ b/app/controllers/droom/organisations_controller.rb @@ -43,6 +43,7 @@ def disapprove redirect_to organisation_url end + # always an ajax call so for now we only confirm. def merge @other_org = Droom::Organisation.find(params[:other_id]) @other_org.subsume(@organisation) diff --git a/app/models/droom/organisation.rb b/app/models/droom/organisation.rb index 11078b6a3..47d7bc674 100644 --- a/app/models/droom/organisation.rb +++ b/app/models/droom/organisation.rb @@ -40,6 +40,12 @@ def self.for_selection(with_external=false) organisations.map{|f| [f.name, f.id] }.unshift(['', '']) end + def self.for_selection_with_owner(with_external=false) + organisations = order("name asc") + organisations = organisations.where(external: false).includes(:owner) unless with_external + organisations.map{|o| ["#{o.name} (#{o.owner_name || 'No owner'})", f.id] }.unshift(['', '']) + end + def self.matching_email(email) domain = email.split('@').last where(joinable: true, email_domain: domain) @@ -216,11 +222,18 @@ def subsume(org) self.tags << org.tags self.chinese_name = org.chinese_name unless chinese_name? self.description = org.description unless description? + self.logo = org.logo unless logo? + self.owner = org.owner unless owner + subsume_other_resources(org) self.save - chinese_name.destroy + org.destroy end end + def subsume_other_resources(org) + # noop here + end + def capture_owner unless owner if user = users.first @@ -238,6 +251,7 @@ def search_data { name: name || "", chinese_name: chinese_name || "", + owner_name: owner_name, description: description, tags: tag_names, all_tags: tags_with_synonyms, @@ -248,5 +262,9 @@ def search_data } end + def owner_name + owner.name if owner + end + end end \ No newline at end of file diff --git a/app/views/droom/organisations/edit/_subsume.html.haml b/app/views/droom/organisations/edit/_subsume.html.haml index 9c9f1e42e..eb6ba740f 100644 --- a/app/views/droom/organisations/edit/_subsume.html.haml +++ b/app/views/droom/organisations/edit/_subsume.html.haml @@ -7,14 +7,16 @@ = form_for [droom, organisation], url: merge_organisation_url(organisation), :html => {:class => 'edit organisation'} do |f| %p - You are about to reassign all the users, assets and history of + You are about to transfer all the users, assets and history of %strong = organisation.name - to the organisation you choose below. Please be very careful: the subsumed organisation will vanish completely. + into the organisation you choose below. Please be careful: the + = organisation.name + organisation will vanish completely and its users will have a new affiliation. %p.organisation = f.label :other_id - = f.select :other_id, Droom::Organisation.for_selection(true) + = f.select :other_id, Droom::Organisation.for_selection_with_owner(true) .buttons = f.submit t(:subsume_organisation) From 7b2f363c17a87461add46c0114050d8a63fb320f Mon Sep 17 00:00:00 2001 From: will-r Date: Thu, 28 May 2020 07:53:46 +0100 Subject: [PATCH 055/128] missed one variable name :| --- app/models/droom/organisation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/droom/organisation.rb b/app/models/droom/organisation.rb index 47d7bc674..654334da7 100644 --- a/app/models/droom/organisation.rb +++ b/app/models/droom/organisation.rb @@ -43,7 +43,7 @@ def self.for_selection(with_external=false) def self.for_selection_with_owner(with_external=false) organisations = order("name asc") organisations = organisations.where(external: false).includes(:owner) unless with_external - organisations.map{|o| ["#{o.name} (#{o.owner_name || 'No owner'})", f.id] }.unshift(['', '']) + organisations.map{|o| ["#{o.name} (#{o.owner_name || 'No owner'})", o.id] }.unshift(['', '']) end def self.matching_email(email) From 562c356833949b684490c108f7b4374b2bb28c41 Mon Sep 17 00:00:00 2001 From: will-r Date: Thu, 28 May 2020 08:09:36 +0100 Subject: [PATCH 056/128] would subsume only into an approved organisation --- app/models/droom/organisation.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/droom/organisation.rb b/app/models/droom/organisation.rb index 654334da7..2bfd03edc 100644 --- a/app/models/droom/organisation.rb +++ b/app/models/droom/organisation.rb @@ -35,14 +35,14 @@ class Organisation < Droom::DroomRecord attr_accessor :other_id def self.for_selection(with_external=false) - organisations = order("name asc") + organisations = approved.order("name asc") organisations = organisations.where(external: false) unless with_external organisations.map{|f| [f.name, f.id] }.unshift(['', '']) end def self.for_selection_with_owner(with_external=false) - organisations = order("name asc") - organisations = organisations.where(external: false).includes(:owner) unless with_external + organisations = approved.order("name asc").includes(:owner) + organisations = organisations.where(external: false) unless with_external organisations.map{|o| ["#{o.name} (#{o.owner_name || 'No owner'})", o.id] }.unshift(['', '']) end From 1394ea43a8b12745396d78288a39274900075e37 Mon Sep 17 00:00:00 2001 From: will-r Date: Thu, 28 May 2020 08:18:25 +0100 Subject: [PATCH 057/128] specify method on merge call --- app/views/droom/organisations/edit/_subsume.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/droom/organisations/edit/_subsume.html.haml b/app/views/droom/organisations/edit/_subsume.html.haml index eb6ba740f..650804481 100644 --- a/app/views/droom/organisations/edit/_subsume.html.haml +++ b/app/views/droom/organisations/edit/_subsume.html.haml @@ -4,7 +4,7 @@ #edit_organisation = render 'droom/shared/popup_header', title: title - = form_for [droom, organisation], url: merge_organisation_url(organisation), :html => {:class => 'edit organisation'} do |f| + = form_for [droom, organisation], url: merge_organisation_url(organisation), method: 'put', html: {:class => 'edit organisation'} do |f| %p You are about to transfer all the users, assets and history of From 71e3f924e23631604478f4723fbbcebb6608d8f5 Mon Sep 17 00:00:00 2001 From: will-r Date: Thu, 28 May 2020 08:40:08 +0100 Subject: [PATCH 058/128] merge_params --- app/controllers/droom/organisations_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/droom/organisations_controller.rb b/app/controllers/droom/organisations_controller.rb index 1d8cf255b..84686020b 100644 --- a/app/controllers/droom/organisations_controller.rb +++ b/app/controllers/droom/organisations_controller.rb @@ -45,7 +45,7 @@ def disapprove # always an ajax call so for now we only confirm. def merge - @other_org = Droom::Organisation.find(params[:other_id]) + @other_org = Droom::Organisation.find(merge_params[:other_id]) @other_org.subsume(@organisation) head :no_content end @@ -65,6 +65,10 @@ def organisation_params end end + def merge_params + params.require(:organisation).permit(:other_id) + end + def set_view @view = params[:view] if %w{page listed gridded quick full status users pending subsume}.include?(params[:view]) end From 79666d1725eb2a22a7de513fc5ba673fa1752b14 Mon Sep 17 00:00:00 2001 From: will-r Date: Thu, 28 May 2020 09:29:03 +0100 Subject: [PATCH 059/128] popup success can remove element from page --- app/assets/javascripts/droom/popups.js.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/javascripts/droom/popups.js.coffee b/app/assets/javascripts/droom/popups.js.coffee index 02db7d93a..cf6c2d8da 100644 --- a/app/assets/javascripts/droom/popups.js.coffee +++ b/app/assets/javascripts/droom/popups.js.coffee @@ -26,6 +26,7 @@ jQuery ($) -> @_iteration = 0 @_affected = @_link.data('affected') @_replaced = @_link.data('replaced') + @_removed = @_link.data('removed') @_aftered = @_link.data('appended') @_befored = @_link.data('prepended') @_reporter = @_link.data('reporter') @@ -104,6 +105,9 @@ jQuery ($) -> addition = $(data) $(@_befored).before(addition) addition.activate().signal_confirmation() + if @_removed? + $(@_removed).remove() + addition.activate().signal_confirmation() if @_replaced? replacement = $(data) $(@_replaced).after(replacement) From c3dd826654cb587e181179302f60e9eb87f72866 Mon Sep 17 00:00:00 2001 From: will-r Date: Thu, 28 May 2020 09:45:15 +0100 Subject: [PATCH 060/128] learn to cut and paste --- app/assets/javascripts/droom/popups.js.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/app/assets/javascripts/droom/popups.js.coffee b/app/assets/javascripts/droom/popups.js.coffee index cf6c2d8da..901f6af30 100644 --- a/app/assets/javascripts/droom/popups.js.coffee +++ b/app/assets/javascripts/droom/popups.js.coffee @@ -107,7 +107,6 @@ jQuery ($) -> addition.activate().signal_confirmation() if @_removed? $(@_removed).remove() - addition.activate().signal_confirmation() if @_replaced? replacement = $(data) $(@_replaced).after(replacement) From 1744b09c24d57e33aa84c241085ad281f12cddab Mon Sep 17 00:00:00 2001 From: will-r Date: Thu, 28 May 2020 09:49:07 +0100 Subject: [PATCH 061/128] cheating horribly by sending down refresh id after subsuming --- app/assets/javascripts/droom/popups.js.coffee | 2 ++ app/controllers/droom/organisations_controller.rb | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/droom/popups.js.coffee b/app/assets/javascripts/droom/popups.js.coffee index 901f6af30..e1b942228 100644 --- a/app/assets/javascripts/droom/popups.js.coffee +++ b/app/assets/javascripts/droom/popups.js.coffee @@ -114,6 +114,8 @@ jQuery ($) -> replacement.activate().signal_confirmation() if @_reporter? $(@_reporter).html(data).show().signal_confirmation().delay(5000).slideUp() + if data.refresh + $(data.refresh).refresh() @reset() show: (e) => diff --git a/app/controllers/droom/organisations_controller.rb b/app/controllers/droom/organisations_controller.rb index 84686020b..fea39ea83 100644 --- a/app/controllers/droom/organisations_controller.rb +++ b/app/controllers/droom/organisations_controller.rb @@ -47,7 +47,9 @@ def disapprove def merge @other_org = Droom::Organisation.find(merge_params[:other_id]) @other_org.subsume(@organisation) - head :no_content + render json: { + refresh: "#organisation_#{@other_org.id}" # we shouldn't know this really + } end def destroy From c7f192eb6cf16f6df0b6e748f56d4ce288ed3dcf Mon Sep 17 00:00:00 2001 From: will-r Date: Thu, 28 May 2020 10:23:40 +0100 Subject: [PATCH 062/128] reload whole organisations page after merge --- app/assets/javascripts/droom/popups.js.coffee | 2 -- app/controllers/droom/organisations_controller.rb | 4 +--- app/views/droom/organisations/_action_menu.html.haml | 2 +- app/views/droom/organisations/_organisations.html.haml | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/droom/popups.js.coffee b/app/assets/javascripts/droom/popups.js.coffee index e1b942228..901f6af30 100644 --- a/app/assets/javascripts/droom/popups.js.coffee +++ b/app/assets/javascripts/droom/popups.js.coffee @@ -114,8 +114,6 @@ jQuery ($) -> replacement.activate().signal_confirmation() if @_reporter? $(@_reporter).html(data).show().signal_confirmation().delay(5000).slideUp() - if data.refresh - $(data.refresh).refresh() @reset() show: (e) => diff --git a/app/controllers/droom/organisations_controller.rb b/app/controllers/droom/organisations_controller.rb index fea39ea83..84686020b 100644 --- a/app/controllers/droom/organisations_controller.rb +++ b/app/controllers/droom/organisations_controller.rb @@ -47,9 +47,7 @@ def disapprove def merge @other_org = Droom::Organisation.find(merge_params[:other_id]) @other_org.subsume(@organisation) - render json: { - refresh: "#organisation_#{@other_org.id}" # we shouldn't know this really - } + head :no_content end def destroy diff --git a/app/views/droom/organisations/_action_menu.html.haml b/app/views/droom/organisations/_action_menu.html.haml index bf14b6a07..a7798c676 100644 --- a/app/views/droom/organisations/_action_menu.html.haml +++ b/app/views/droom/organisations/_action_menu.html.haml @@ -8,6 +8,6 @@ %li = link_to t(:add_user), droom.new_organisation_user_url(organisation), :class => 'add', :data => {:action => "popup", :affected => "#organisation_#{organisation.id}"} %li - = link_to t(:subsume_organisation), droom.edit_organisation_url(organisation, view: "subsume"), :class => 'delete', :data => {:action => "popup", :removed => "#organisation_#{organisation.id}"} + = link_to t(:subsume_organisation), droom.edit_organisation_url(organisation, view: "subsume"), :class => 'delete', :data => {:action => "popup", :affected => "#organisations"} %li = link_to t(:delete_organisation), droom.organisation_url(organisation), :method => 'delete', :class => 'delete', :data => {:action => "remove", :removed => "#organisation_#{organisation.id}", :confirm => t(:confirm_delete_organisation, :name => organisation.name)} diff --git a/app/views/droom/organisations/_organisations.html.haml b/app/views/droom/organisations/_organisations.html.haml index b84f12073..d50d78b2f 100644 --- a/app/views/droom/organisations/_organisations.html.haml +++ b/app/views/droom/organisations/_organisations.html.haml @@ -4,7 +4,7 @@ - if @organisations.any? - %div{class: cssclass, data: {refreshing: true, url: "#{droom.organisations_path}.js"}} + %div#organisations{class: cssclass, data: {refreshing: true, url: "#{droom.organisations_path(page: @page, per_page: @show)}.js"}} = render partial: "droom/organisations/show/#{view}", collection: @organisations .pagination.lower From fc22e45d4162e049bb6285822bc319f1efcdc755 Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Tue, 30 Jun 2020 17:15:37 +0630 Subject: [PATCH 063/128] Pass narrow variable to documents showing partial --- app/views/droom/folders/_contents.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/droom/folders/_contents.html.haml b/app/views/droom/folders/_contents.html.haml index 67fdfcece..1f08a1042 100644 --- a/app/views/droom/folders/_contents.html.haml +++ b/app/views/droom/folders/_contents.html.haml @@ -16,7 +16,7 @@ - if limit && document_count > 0 && limit < document_count %li.files{data: lidata} %ul - = render :partial => 'droom/documents/listing', :collection => folder.documents.limit(limit) + = render :partial => 'droom/documents/listing', :collection => folder.documents.limit(limit), locals: {narrow: narrow} - if for_more %li.more = link_to t(:more_documents_count, :count => document_count - limit), for_more From e773b24ec65c947649ae367b4d7f4f9172f09c4e Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Sun, 16 Aug 2020 11:51:49 +0630 Subject: [PATCH 064/128] Whitelist :last_request_at attribute of User model --- app/controllers/droom/api/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/droom/api/users_controller.rb b/app/controllers/droom/api/users_controller.rb index 5cc335e51..2313e27d0 100644 --- a/app/controllers/droom/api/users_controller.rb +++ b/app/controllers/droom/api/users_controller.rb @@ -80,7 +80,7 @@ def get_users end def user_params - params.require(:user).permit(:uid, :person_uid, :title, :family_name, :given_name, :chinese_name, :honours, :affiliation, :email, :phone, :mobile, :description, :address, :post_code, :correspondence_address, :country_code, :organisation_id, :female, :defer_confirmation, :send_confirmation, :password, :password_confirmation, :confirmed, :confirmed_at, :image_data, :image_name) + params.require(:user).permit(:uid, :person_uid, :title, :family_name, :given_name, :chinese_name, :honours, :affiliation, :email, :phone, :mobile, :description, :address, :post_code, :correspondence_address, :country_code, :organisation_id, :female, :defer_confirmation, :send_confirmation, :password, :password_confirmation, :confirmed, :confirmed_at, :image_data, :image_name, :last_request_at) end end From 252290852a1d36a0d47516a65e445103cb69193b Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Sat, 22 Aug 2020 18:49:21 +0630 Subject: [PATCH 065/128] Append DROOM_URL if the calling repo is not dataroom --- app/assets/javascripts/droom/lib/assets.js.coffee.erb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/droom/lib/assets.js.coffee.erb b/app/assets/javascripts/droom/lib/assets.js.coffee.erb index f9195b394..ddd0cb44a 100644 --- a/app/assets/javascripts/droom/lib/assets.js.coffee.erb +++ b/app/assets/javascripts/droom/lib/assets.js.coffee.erb @@ -1,5 +1,11 @@ jQuery ($) -> $.withZxcbvn = (fn) -> - url = "<%= asset_path('droom/zxcvbn.js') %>" - $.getScript(url).done (response) => fn?(response) + origin_url = window.location.origin + asset_path = "<%= asset_path('droom/zxcvbn.js') %>" + droom_url = "<%= ENV['DROOM_URL'] %>" + + if origin_url != droom_url + asset_path = droom_url + asset_path + + $.getScript(asset_path).done (response) => fn?(response) From 565df765ba6123436e50766c5d2b8bfbc123c72c Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Sun, 23 Aug 2020 11:47:09 +0630 Subject: [PATCH 066/128] Get url from Settings as first priority --- app/assets/javascripts/droom/lib/assets.js.coffee.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/droom/lib/assets.js.coffee.erb b/app/assets/javascripts/droom/lib/assets.js.coffee.erb index ddd0cb44a..60a4fab8f 100644 --- a/app/assets/javascripts/droom/lib/assets.js.coffee.erb +++ b/app/assets/javascripts/droom/lib/assets.js.coffee.erb @@ -3,7 +3,7 @@ jQuery ($) -> $.withZxcbvn = (fn) -> origin_url = window.location.origin asset_path = "<%= asset_path('droom/zxcvbn.js') %>" - droom_url = "<%= ENV['DROOM_URL'] %>" + droom_url = "<%= Settings.url || ENV['DROOM_URL'] %>" if origin_url != droom_url asset_path = droom_url + asset_path From fb6e0a6eed64edecee3ef0579e57cd0249c6f074 Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Sun, 23 Aug 2020 12:54:36 +0630 Subject: [PATCH 067/128] Static url to fetch asset --- app/assets/javascripts/droom/lib/assets.js.coffee.erb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/droom/lib/assets.js.coffee.erb b/app/assets/javascripts/droom/lib/assets.js.coffee.erb index 60a4fab8f..2fe9e0ba6 100644 --- a/app/assets/javascripts/droom/lib/assets.js.coffee.erb +++ b/app/assets/javascripts/droom/lib/assets.js.coffee.erb @@ -1,11 +1,7 @@ jQuery ($) -> $.withZxcbvn = (fn) -> - origin_url = window.location.origin - asset_path = "<%= asset_path('droom/zxcvbn.js') %>" - droom_url = "<%= Settings.url || ENV['DROOM_URL'] %>" - - if origin_url != droom_url - asset_path = droom_url + asset_path + asset_path = "<%=asset_path('droom/zxcvbn.js')%>" + asset_path = "https://data.croucher.org.hk/"+ asset_path $.getScript(asset_path).done (response) => fn?(response) From bb8aad8d80849b1293a152a6050338f514f2a65d Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Sun, 23 Aug 2020 13:24:25 +0630 Subject: [PATCH 068/128] Fetch based URL based on environemnt --- app/assets/javascripts/droom/lib/assets.js.coffee.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/droom/lib/assets.js.coffee.erb b/app/assets/javascripts/droom/lib/assets.js.coffee.erb index 2fe9e0ba6..27fca37af 100644 --- a/app/assets/javascripts/droom/lib/assets.js.coffee.erb +++ b/app/assets/javascripts/droom/lib/assets.js.coffee.erb @@ -1,7 +1,7 @@ jQuery ($) -> $.withZxcbvn = (fn) -> - asset_path = "<%=asset_path('droom/zxcvbn.js')%>" - asset_path = "https://data.croucher.org.hk/"+ asset_path + based_url = "<%= Rails.env == 'production' ? 'https://data.croucher.org.hk/' : ENV['DROOM_URL']%>" + asset_path = based_url + "<%=asset_path('droom/zxcvbn.js')%>" $.getScript(asset_path).done (response) => fn?(response) From 696b4641f5276b15d7b509b1fbf3e0cf2ba1220d Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Sun, 23 Aug 2020 13:58:12 +0630 Subject: [PATCH 069/128] Set static based url --- app/assets/javascripts/droom/lib/assets.js.coffee.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/droom/lib/assets.js.coffee.erb b/app/assets/javascripts/droom/lib/assets.js.coffee.erb index 27fca37af..189c946ed 100644 --- a/app/assets/javascripts/droom/lib/assets.js.coffee.erb +++ b/app/assets/javascripts/droom/lib/assets.js.coffee.erb @@ -1,7 +1,7 @@ jQuery ($) -> $.withZxcbvn = (fn) -> - based_url = "<%= Rails.env == 'production' ? 'https://data.croucher.org.hk/' : ENV['DROOM_URL']%>" + based_url = 'https://data.croucher.org.hk/' asset_path = based_url + "<%=asset_path('droom/zxcvbn.js')%>" $.getScript(asset_path).done (response) => fn?(response) From 87a3e5509ae74c56e7e5eace7d544b65690758c9 Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Thu, 19 Nov 2020 22:27:56 +0630 Subject: [PATCH 070/128] Add stream_events partial from Dataroom --- app/views/droom/dashboard/_stream_events.html.haml | 11 +++++++++++ app/views/droom/events/index.html.haml | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 app/views/droom/dashboard/_stream_events.html.haml diff --git a/app/views/droom/dashboard/_stream_events.html.haml b/app/views/droom/dashboard/_stream_events.html.haml new file mode 100644 index 000000000..394cc9b01 --- /dev/null +++ b/app/views/droom/dashboard/_stream_events.html.haml @@ -0,0 +1,11 @@ +#suggestion_box + +- if calendar = Droom::Calendar.where(name: 'stream').first + #other + %h2.section + = t(:external_events) + - if can?(:create, Droom::Event) + %span.action + = link_to t(:add_external_event), droom.new_event_url(event: {calendar_id: calendar.id}), :class => "add minimal", :data => {:action => "popup", :affected => "#minor_events"} + + = render "droom/calendars/event_list", calendar: calendar, events: calendar.events.by_date_descending.limit(10) diff --git a/app/views/droom/events/index.html.haml b/app/views/droom/events/index.html.haml index 7bc21556c..f85be31e6 100644 --- a/app/views/droom/events/index.html.haml +++ b/app/views/droom/events/index.html.haml @@ -9,7 +9,7 @@ - content_for :margin do = render :partial => "droom/shared/calendar_holder" = render :partial => "droom/invitations/invitations" - = render :partial => "droom/events/scrap_events" + = render :partial => "droom/dashboard/stream_events" #calendar From ed4d7d050eab1e517ad5ad98b55eea98f5355e22 Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Wed, 25 Nov 2020 19:13:31 +0630 Subject: [PATCH 071/128] Add owner_id to allowed params list --- app/controllers/droom/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/droom/users_controller.rb b/app/controllers/droom/users_controller.rb index d8f13ae5f..5e83a180a 100644 --- a/app/controllers/droom/users_controller.rb +++ b/app/controllers/droom/users_controller.rb @@ -210,7 +210,7 @@ def setup_params end def set_organisation_params - params.require(:user).permit(:organisation_id, organisation_attributes: [:name, :chinese_name, :url, :organisation_type_id, :description, :tags]) + params.require(:user).permit(:organisation_id, organisation_attributes: [:name, :chinese_name, :url, :organisation_type_id, :description, :tags, :owner_id]) end def set_view From 5bea6343444f56fee445863b1b838094240bc433 Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Wed, 24 Mar 2021 10:06:39 +0630 Subject: [PATCH 072/128] Set session lifespan as 1 day --- lib/droom/config.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/droom/config.rb b/lib/droom/config.rb index 6ad1bdadb..dcce5af8f 100644 --- a/lib/droom/config.rb +++ b/lib/droom/config.rb @@ -288,7 +288,8 @@ def default_permissions end def session_timeout - @@session_timeout ||= 15.minutes + #@@session_timeout ||= 15.minutes + 1.day end def enable_pubsub? From 26400d4b3a92b99c0c4d7679159c04000b90c897 Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Fri, 7 May 2021 11:08:39 +0630 Subject: [PATCH 073/128] Add google recaptcha3 in hkfx registration page --- .../droom/users/registrations_controller.rb | 20 ++++++++++++++++ app/helpers/droom/droom_helper.rb | 23 +++++++++++++++++++ app/views/devise/registrations/new.html.haml | 8 ++++++- 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/app/controllers/droom/users/registrations_controller.rb b/app/controllers/droom/users/registrations_controller.rb index f5874103f..87ade3ba0 100644 --- a/app/controllers/droom/users/registrations_controller.rb +++ b/app/controllers/droom/users/registrations_controller.rb @@ -1,3 +1,5 @@ +require 'net/https' + module Droom::Users class RegistrationsController < Devise::RegistrationsController before_action :set_access_control_headers @@ -16,6 +18,24 @@ def new end end + def create + if helpers.check_recaptcha? + min_score = 0.5 + secret_key = ENV['RECAPTCHA_SECRET_KEY'] + token = params[:recaptcha_token] + + uri = URI.parse("https://www.google.com/recaptcha/api/siteverify?secret=#{secret_key}&response=#{token}") + response = Net::HTTP.get_response(uri) + json = JSON.parse(response.body) + result = json['success'] && json['score'] > min_score && json['action'] == 'submit' + + unless result + return redirect_to signup_url + end + end + super + end + def after_sign_up_path_for(resource) root_url end diff --git a/app/helpers/droom/droom_helper.rb b/app/helpers/droom/droom_helper.rb index 4a31db162..ee5d1d939 100644 --- a/app/helpers/droom/droom_helper.rb +++ b/app/helpers/droom/droom_helper.rb @@ -210,5 +210,28 @@ def url_for_date(date) def day_names ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] end + + def check_recaptcha? + if ENV['RECAPTCHA_CHECK'] && ENV['RECAPTCHA_CHECK'] == 'true' + true + else + false + end + end + + def recaptcha_execute(action) + id = "recaptcha_token_#{SecureRandom.hex(10)}" + + raw %Q{ + + + } + end end end diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index 2787f3fd8..8935c6459 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -1,6 +1,12 @@ +- if check_recaptcha? + %script{src: "https://www.google.com/recaptcha/api.js?render=#{ENV['RECAPTCHA_SITE_KEY']}"} + = form_for(resource, as: resource_name, url: droom.register_path, method: "post") do |f| = render "devise/shared/error_messages", resource: resource = f.email_field :email, autofocus: true, autocomplete: "email", placeholder: t("placeholders.registration.email"), class: "half" - = f.submit t('registration.submit') + = f.submit t('registration.submit'), id: 'submitWithRecaptcha' + + - if check_recaptcha? + = recaptcha_execute('submit') From 6a46f4f8be42b4b2773a94df6fe8a446da25c06c Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Thu, 10 Jun 2021 22:41:13 +0630 Subject: [PATCH 074/128] Add condition for removing action menu of Applications system --- app/assets/javascripts/droom/actions.js.coffee | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/droom/actions.js.coffee b/app/assets/javascripts/droom/actions.js.coffee index 744817ecf..92b573071 100644 --- a/app/assets/javascripts/droom/actions.js.coffee +++ b/app/assets/javascripts/droom/actions.js.coffee @@ -99,9 +99,13 @@ jQuery ($) -> affected = $(@).attr('data-affected') $(@).remote on_success: (response) => - $(@).parents(removed).first().fadeOut 'fast', () -> - $(@).remove() - $(affected).trigger "refresh" + if $(@).parents('.menu').first().length == 1 + $(@).parents('.menu').first().fadeOut 'fast', () -> + $(removed).remove() + else + $(@).parents(removed).first().fadeOut 'fast', () -> + $(@).remove() + $(affected).trigger "refresh" # The 'remove_all' action takes out on success anything matching the given selector: From 69ea2eeb118a6687c5810c0e69059f9103e6252c Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Sat, 12 Jun 2021 11:06:12 +0630 Subject: [PATCH 075/128] Set 1 day as session life time --- lib/droom/config.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/droom/config.rb b/lib/droom/config.rb index dcce5af8f..3ab5e8d4f 100644 --- a/lib/droom/config.rb +++ b/lib/droom/config.rb @@ -288,8 +288,7 @@ def default_permissions end def session_timeout - #@@session_timeout ||= 15.minutes - 1.day + @@session_timeout ||= 1.day end def enable_pubsub? From 6330bd0ae99c4c44e57efff85eb3c6c4fd664286 Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Sat, 12 Jun 2021 12:09:50 +0630 Subject: [PATCH 076/128] Lock devise and devise-security version --- droom.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/droom.gemspec b/droom.gemspec index 695c7fa64..8be306a10 100644 --- a/droom.gemspec +++ b/droom.gemspec @@ -28,8 +28,8 @@ Gem::Specification.new do |s| s.add_dependency "settingslogic" s.add_dependency "request_store" - s.add_dependency "devise" - s.add_dependency "devise-security" + s.add_dependency "devise", "4.7.3" + s.add_dependency "devise-security", "0.15.0" s.add_dependency "devise_zxcvbn" s.add_dependency "cancancan" From 37e7a6b0dc5880e9e5b00ac040860692e7452a77 Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Fri, 9 Jul 2021 15:10:03 +0630 Subject: [PATCH 077/128] Set session_timeout as 1 hour --- lib/droom/config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/droom/config.rb b/lib/droom/config.rb index 3ab5e8d4f..726f5dc11 100644 --- a/lib/droom/config.rb +++ b/lib/droom/config.rb @@ -288,7 +288,7 @@ def default_permissions end def session_timeout - @@session_timeout ||= 1.day + @@session_timeout ||= 1.hour end def enable_pubsub? From 2d2173af60d6172d93dc9612099d80a516013f58 Mon Sep 17 00:00:00 2001 From: Aung Kyaw Phyo Date: Wed, 11 Aug 2021 12:40:44 +0630 Subject: [PATCH 078/128] Add function of moving folder to under another folder --- app/controllers/droom/folders_controller.rb | 30 +++++++- .../droom/folders/_action_menu.html.haml | 2 + .../droom/folders/_move_folder.html.haml | 72 +++++++++++++++++++ app/views/droom/folders/move_folder.html.haml | 3 + config/locales/en.yml | 1 + config/routes.rb | 4 ++ 6 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 app/views/droom/folders/_move_folder.html.haml create mode 100644 app/views/droom/folders/move_folder.html.haml diff --git a/app/controllers/droom/folders_controller.rb b/app/controllers/droom/folders_controller.rb index 1de47ff38..daeea3e8a 100644 --- a/app/controllers/droom/folders_controller.rb +++ b/app/controllers/droom/folders_controller.rb @@ -50,8 +50,34 @@ def destroy head :ok end - def with_parent - + def move_folder + respond_with @folder + end + + def moved + if params.include?('new_parent_id') && params.include?('id') + folder = Droom::Folder.find(params[:id]) + folder.parent_id = params[:new_parent_id] + folder.save + end + head :ok + end + + def child_folders + if params.include?('target_parent_id') + target_parent_id = params[:target_parent_id] + mapped_children = '' + if target_parent_id != '' && folder = Droom::Folder.find(target_parent_id) + child_folders = folder.children + if child_folders.any? + mapped_children = {} + child_folders.map{|child| + mapped_children[child.id] = child.name + } + end + end + end + render json: mapped_children end protected diff --git a/app/views/droom/folders/_action_menu.html.haml b/app/views/droom/folders/_action_menu.html.haml index 188cc68ed..e8f85a2c2 100644 --- a/app/views/droom/folders/_action_menu.html.haml +++ b/app/views/droom/folders/_action_menu.html.haml @@ -7,6 +7,8 @@ = link_to t(:add_document), '#', class: "add", id: "upload_to_folder_#{folder.id}", data: {role: "upload-file"} %li = link_to t(:add_subfolder), droom.new_folder_folder_url(folder), :class => "add", :data => {:action => "popup", :type => "html", :affected => "#folder_#{folder.id}"} + %li + = link_to t(:move_folder), droom.move_folder_folder_url(folder), :class => "edit", :id => "move_folder_#{folder.id}", :data => {:action => "popup", :type => "html", :affected => "#folders"} %li = link_to t(:delete_folder), droom.folder_url(folder), :method => 'delete', :class => 'delete', :data => {:action => "remove", :removed => "#folder_#{folder.id}", :confirm => t(:confirm_delete_folder, :path => folder.path)} - if folder.populated? diff --git a/app/views/droom/folders/_move_folder.html.haml b/app/views/droom/folders/_move_folder.html.haml new file mode 100644 index 000000000..94c6cf947 --- /dev/null +++ b/app/views/droom/folders/_move_folder.html.haml @@ -0,0 +1,72 @@ +%form.edit.folder{action: "/folders/#{@folder.id}/moved", :method => 'put'} + = hidden_field_tag :new_parent_id, '' + = select_tag 'folders', options_from_collection_for_select(Droom::Folder.roots, "id", "name"), id: 'folders_list_1', class: 'folders_list', prompt: "Please Select a Root Folder" + #child_folders + .buttons + %input{name: "submit", type: "submit", value: t(:save_folder)} + = t :or + = link_to t(:cancel), '#', :class => 'cancel' + +:javascript + $(document).ready( function() { + + var fetch_child_folder = function(current_element){ + current_element_id = current_element.attr('id'); + var new_parent_id = current_element.children("option:selected").val(); + var ids = $('.folders_list').map(function() { + return $(this).attr('id'); + }).get(); + + var current_element_index = $.inArray(current_element_id, ids); + var array_size = ids.size; + elements_to_remove = ids.slice(current_element_index+1,array_size); + + for ( var index = 0, length = elements_to_remove.length; index <= length; index++ ) { + remove = elements_to_remove[index]; + var id_to_remove = ids.indexOf(remove); + if (id_to_remove !== -1) { + ids.splice(id_to_remove, 1); + } + $('#'+remove).remove(); + if(index == length){ + elements_to_remove = []; + } + } + + $("#new_parent_id").val(new_parent_id); + + selected_parent_id = current_element.children("option:selected").val(); + $.ajax({url: "/child_folders?target_parent_id="+selected_parent_id, success: function(result){ + var $option = $("