From f8d62ab8dbcaf5032679a53a42bdef4794e1d971 Mon Sep 17 00:00:00 2001 From: ZEROM22 Date: Mon, 20 Nov 2023 00:06:41 +0300 Subject: [PATCH] ruby: Naming/AccessorMethodName correct --- .../ruby/app/models/file_model.rb | 14 +++++++------- .../ruby/app/models/users.rb | 2 +- .../ruby/app/views/home/editor.html.erb | 12 ++++++------ .../ruby/app/views/home/index.html.erb | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/web/documentserver-example/ruby/app/models/file_model.rb b/web/documentserver-example/ruby/app/models/file_model.rb index ea6d7745..0630b41c 100755 --- a/web/documentserver-example/ruby/app/models/file_model.rb +++ b/web/documentserver-example/ruby/app/models/file_model.rb @@ -89,7 +89,7 @@ class FileModel end # get config parameters - def get_config + def config editors_mode = @mode || 'edit' # mode: view/edit/review/comment/fillForms/embedded can_edit = DocumentHelper.edited_exts.include?(file_ext) # check if the document can be edited if (!can_edit && editors_mode.eql?('edit') || editors_mode.eql?('fillForms')) && @@ -201,7 +201,7 @@ class FileModel end # get document history - def get_history + def history file_name = @file_name file_ext = File.extname(file_name).downcase doc_key = key @@ -317,7 +317,7 @@ class FileModel end # get image information - def get_insert_image + def insert_image # image file type # server url to the image # direct url to the image @@ -401,15 +401,15 @@ class FileModel end # get users data for mentions - def get_users_mentions + def users_mentions !@user.id.eql?('uid-0') ? Users.get_users_for_mentions(@user.id) : nil end - def get_users_info + def users_info users_info = [] return if @user.id.eql?('uid-0') - Users.get_all_users.each do |user_info| + Users.all_users.each do |user_info| u = { id: user_info.id, name: user_info.name, @@ -431,7 +431,7 @@ class FileModel end # get users data for protect - def get_users_protect + def users_protect !@user.id.eql?('uid-0') ? Users.get_users_for_protect(@user.id) : nil end diff --git a/web/documentserver-example/ruby/app/models/users.rb b/web/documentserver-example/ruby/app/models/users.rb index d2e782e7..c72d3677 100644 --- a/web/documentserver-example/ruby/app/models/users.rb +++ b/web/documentserver-example/ruby/app/models/users.rb @@ -115,7 +115,7 @@ class Users ] class << self - def get_all_users + def all_users @users end diff --git a/web/documentserver-example/ruby/app/views/home/editor.html.erb b/web/documentserver-example/ruby/app/views/home/editor.html.erb index 323c959b..97c88e28 100755 --- a/web/documentserver-example/ruby/app/views/home/editor.html.erb +++ b/web/documentserver-example/ruby/app/views/home/editor.html.erb @@ -102,7 +102,7 @@ var onRequestInsertImage = function(event) { docEditor.insertImage({ // insert an image into the file "c": event.data.c, - <%= raw @file.get_insert_image %> + <%= raw @file.insert_image %> }) }; @@ -216,7 +216,7 @@ var сonnectEditor = function () { - config = <%= raw @file.get_config.to_json %>; + config = <%= raw @file.config.to_json %>; config.width = "100%"; config.height = "100%"; @@ -234,8 +234,8 @@ }; <% - history = @file.get_history - usersMentions = @file.get_users_mentions %> + history = @file.history + usersMentions = @file.users_mentions %> if (config.editorConfig.user.id) { <% if history %> @@ -262,7 +262,7 @@ switch (c) { case "info": users = []; - var allUsers = <%= raw @file.get_users_info.to_json %>; + var allUsers = <%= raw @file.users_info.to_json %>; for (var i = 0; i < event.data.id.length; i++) { for (var j = 0; j < allUsers.length; j++) { if (allUsers[j].id == event.data.id[i]) { @@ -276,7 +276,7 @@ var users = <%= raw @file.get_users_protect.to_json %>; break; default: - users = <%= raw @file.get_users_mentions.to_json %>; + users = <%= raw @file.users_mentions.to_json %>; } docEditor.setUsers({ "c": c, diff --git a/web/documentserver-example/ruby/app/views/home/index.html.erb b/web/documentserver-example/ruby/app/views/home/index.html.erb index b9018e38..9da594a4 100755 --- a/web/documentserver-example/ruby/app/views/home/index.html.erb +++ b/web/documentserver-example/ruby/app/views/home/index.html.erb @@ -62,7 +62,7 @@ Username @@ -110,7 +110,7 @@ Please do NOT use this integration example on your own server without proper code modifications, it is intended for testing purposes only. In case you enabled this test example, disable it before going for production. You can open the same document using different users in different Web browser sessions, so you can check out multi-user editing functions. - <% for user in Users.get_all_users() do %> + <% for user in Users.all_users() do %>
<%= user.name ? user.name : "Anonymous" %>