1 Star 4 Fork 1

Jim / intro

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Intro

Gem Version Build Status

Intro 为 Rails 应用添加新功能介绍以及用户指引,她根据用户是否需要功能引导,动态注入了 Shepherd.js 脚本至应用中。Intro 包含以下功能:

  • 可在后台中管理用户引导
  • 引导内容支持多语言及图片上传
  • 更改引导样式简单
  • 支持 Turbolinks
  • 便于非开发者使用

示例

example

演示

Demo: Source

安装

添加 intro 到 Gemfile:

gem 'intro'

执行下面这行代码安装:

$ bundle install

生成迁移以及配置文件:

$ rails generate intro:install

然后执行迁移:

$ rails db:migrate

然后编译资源:

$ rails assets:precompile

使用

将资源文件添加至视图

添加 intro_tags 在共用的 layout 中, 在 body 标签关闭之前:

<%= intro_tags %>
</body>
</html>

intro_tags 引入了 intro 相关资源文件和添加了一个记录 intro 配置的全局变量 _intro

Note: 如果你正在使用 Turbolinks, 为了更新 _intro 变量, intro_tags 须插入在 body 关闭之前。

后台添加引导

运行 Rails 应用并访问 http://localhost:3000/intro/admin。在 config/initializers/intro.rb 文件中,你可以获取到默认的帐号以登录后台。

然后添加引导并填入相关内容,最后你需要发布它。

更改引导样式

如果默认样式不能满足你,你可以执行下面代码生成样式文件:

$ rails generate intro:assets

你将会得到下面的文件:

app/javascript/stylesheets/intro/_variables.scss
app/javascript/stylesheets/intro/custom.scss
app/javascript/packs/intro/custom.js

更改它们以满足你的需要。

最后,在 config/initializers/intro.rb 中启用 custom_assets 设置。

# config/initializers/intro.rb

# override intro tour styles
self.custom_assets = true # or 'intro/custom'

这将会在 intro_tags 中引用 intro/custom 资源。

配置 Intro

查看 config/initializers/intro.rb 获取详情的配置信息

致谢

贡献

欢迎报告 Bug 或提交 Pull Request。

  1. 分叉此仓库
  2. 创建你的功能分支 (git checkout -b my-new-feature)
  3. 提交你的改动 (git commit -am 'Add some feature')
  4. 推送到当前分支 (git push origin my-new-feature)

如有必要,请为你的代码编写单元测试。

许可

根据 MIT 许可的条款,此仓库可作为开放源代码使用。

Copyright 2019 jimcheung Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Intro 为 Rails 应用添加新功能介绍以及用户指引 展开 收起
Ruby 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Ruby
1
https://gitee.com/jimcheung/intro.git
git@gitee.com:jimcheung/intro.git
jimcheung
intro
intro
master

搜索帮助