发表时间

使用 Koha,升级到 Ubuntu 22.04 后出现了这个错误:

Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

说明,Key 使用方法升级。

解决方案:

  1. 查看有问题的 Keyring: apt-key list
  2. 导出 keyring 至 etc/apt/trusted.gpg.d/xxx.gpg: sudo apt-key export A2E41F10 | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/koha-2013.gpg
  3. 删除原来的 Keyring: sudo apt-key --keyring /etc/apt/trusted.gpg del A99CEB6D

如果有多个 Keyring,重复以上步骤,直至没有提示。

作者

发表时间

本文中,我们将介绍我们将要学习什么、看一下我们将要完成作品样子,然后开始我们全新的 Rails 7 应用程序!

我们要构建什么样的程序?

本文中,我们将通过一行定制的 JavaScript 代码即可实现构建一个单页的、实时回馈式报价编辑器。您可以在网站的报价编辑器页面 查看完成的项目。赶紧试用一下吧,创建一个报价,点击添加日期和内容查看如何使用。

使用引文编辑器,您可以创建、修改和删除报价。当点击一个报价时,您可以访问创建、更新和删除日期的页面。每个日期之下,您可以添加项目。每次您添加、更新或删除一个项目,报价总数都会更新。

这个应用受我所做过的一个使用 React 的应用启发。当 2020 年 12 月 turbo-rails 发布的时候,README 的第一行就说 “Turbo 使得您不必写一点 JavaScript 而获得单页应用的速度”

我想看看这是不是事实,所以我阅读了 Turbo Rails 的源代码并且使用 Turbo 重构了报价编辑器。 我完全被其使用的简单震惊到了 。最好的那部分是?没有 React,没有 Redux,没有 Formik!相反,我只需要使用最喜欢和熟悉的工具:Ruby on Rails 和简单的表单。惊艳不?是的,如果我使用 React 获得同样的效果可能需要十倍的付出。

为什么要学习 Ruby on Rails 7 的 Turbo 功能?

随着 Ruby on Rails 7 在 2021 年 12 月的发布,Hotwire——联合了 Stimulus 和 Turbo 的软件,变成了 Rails 应用的默认前端框架。

Stimulus 发布已经有一段时间了,而且已经是 Rails 生态系统中的一个众所周知的库。另一方面,Turbo 和 Ruby on Rails 的集成是新的功能强大的工具。

  • 首先,所有在链接上的点击和表单提交都属于 AJAX 请求,得益于 Turbo Drive 的加持这些链接访问速度都会提高。 我们享受此项福利不需要任何付出,只需要导入库即可。
  • 其次,现在很轻松就可以利用 Turbo Frames 将页面分成不同的部分从而构建动态应用。我们开发 CRUD 控制器一如从前,只不过添加了几行代码, 就可以替换或者惰性加载依赖部分的页面
  • 最后,在 Turbo Streams 的帮助下添加实时功能变得非常容易。想要为您的应用程序添加实时通知,构建实时的多玩家游戏,或者实时问题监视系统?实时部分只不过需要使用 Turbo 添加几行代码而已!

Turbo 加速 Rails 应用程序,减少写 JavaScript 代码,使添加实时功能变得容易。最牛的是学习起来简单—— 读完这个教程,您就会知道有关 Turbo 三个特点的所有知识!

这个教程适合谁读?

在本教程中,我们会学到:

  • 创建 CRUD 控制器
  • 创建我们的设计系统
  • 基于 Devise Gem 建立用户验证
  • 学习 Turbo Drive、Turbo Frames 和 Turbo Streams

如果您已经熟悉了 1-3 部分内容,并且想要学习第 4 部分,这个教程就适合您!

建立应用程序

让我们构建新应用程序——使用 SASS 作为 CSS 预处理器创建我们的设计系统,

作者

发表时间

本文是翻译文章1

学习如何利用 Rails 7 内置turbo-rails 库在不输入一行定制 JavaScript 代码的情况下编写响应式单页应用。

第一章 Turbo Rails 教程概述

本章中,我们介绍我们将要学习什么以及预期结果,然后开始创建我们的新 Rails 7 程序!

第二章 利用 Rails 构建一个简单的 CRUD 控制器

本章中,我们将创建一个 Quote 模型以及于其关联的控制器。

第三章 在 Ruby on Rails 应用程序中组织 CSS 文件

本章中,我们将利用 BEM 方法编写一些 CSS 来美化我们的应用程序。

第四章 Turbo 驱动

本章中,我们将解释什么是 Turbo 驱动以及它是如何通过转化所有链接的点击为 AJAX 请求来为我们的 Ruby on Rails 应用程序提速的。

第五章 Turbo Frames 和 Turbo Stream 模板

本章中,我们将学习如何划分一个页面为多个独立的部分,这要归功于 Turbo Frames 和 Turbo Stream 格式。通过本章的学习,关于 Quote 所有 CRUD 操作都是在 Quote 的 index 页完成。

第六章 利用 Turbo Streams 实时更新

本章中,我们将学习如何利用 Action Cable 来实时推送 Turbo Stream 模板更新页面。

第七章 Turbo Streams 和安全

本章中,我们将学习如何利用 Turbo Stream 安全的避免发送信息给错误用户。

第八章 利用 Hotwire 的 Flash 消息

本章中,我们将学习如何利用 Turbo 添加 Flash 消息以及如何利用 Stimulus 制作一个漂亮的动画效果。

第九章 在 Hotwire 中有两种方法处理空状态

本章中,我们将学习使用 Turbo 处理空状态的两种方式。第一种使用 Turbo Frames 和 Turbo Streams,第二种就是使用 CSS 伪类的唯一子类。

第十章 使用 Turbo Rails 的另一个 CRUD 控制器

本章中,我们将构建 Quotes 的另一个日期(Date)的 CRUD 控制器。这是一个很好的实践我们前面学到知识的机会。

第十一章 嵌套的 Turbo Frame

本章中,我们将构建最后一个关于 Line Item 的 CRUD 控制器。由于 Line Item 是嵌套在 Line Item 日期之内,我们将使用 Turbo Frame 来解决这个有趣的问题!

第十二章 使用 Turbo Frame 添加一个 Quote 的总数

本章中,我们将添加一个包含 Quote 总数的固定按钮。这个总数会在每次增、改、删 Line Item 时实时更新。

1 原文在这里:Turbo Rails Tutorial

作者

发表时间
评论 1

What do you want to do next?

  • Write a new article? Let your creativity flow!
  • Change this site’s name, slogan or select a different article URL style? Check and modify your preferences.
  • Edit or delete this article? Your articles list is the place to start.
  • Upload images or files to accompany your articles?
  • Learn Textile, the markup generator included with Textpattern? You can try it in the Textile sandbox.
    • If you want to learn more, you can refer to an extensive Textile manual.
  • Be guided through your Textpattern first steps by completing some tasks?
  • Study the Textpattern Semantic Model?
  • Add one or more additional users, or extend Textpattern’s capabilities with plugins from the Textpattern plugin directory?
  • Dive in and learn by doing? Please note:
    • When you write an article you assign it to a section of your site.
    • Sections use a page template and a style to define how site content appears in a browser.
    • Page templates typically use HTML and Textpattern tags (like this: <txp:article />) to build the output code.
    • Some Textpattern tags use forms, reusable building blocks that provide extensive control and customization over your site construction.
    • Pages, styles and forms can be packaged into themes and assigned to one or more sections.

Textpattern tags, their attributes and values are explained within the Textpattern User Documentation, where you will also find valuable examples, advice and tutorials.

There’s also a group of friendly, helpful Textpattern users and administrators at the Textpattern support forum.

Additional language translations and corrections are welcomed. Please visit Textpattern language translations for further details.

This is an example article included with Textpattern to demonstrate some of the first steps you can undertake. An example comment is associated with this article. The article and comment can be safely deleted using the articles and comments lists.

作者
分类 图书馆学, 蒙古学