Remediation Reference
查找与 3scale 安装相关的其他信息。
摘要
使开源包含更多
红帽承诺替换我们的代码、文档和网页属性中存在问题的语言。我们从这四个术语开始: master、slave、blacklist 和 whitelist。这些更改将在即将发行的几个发行本中逐渐实施。详情请查看我们的 CTO Chris Wright 信息。
第 1 章 Remediation Reference
1.1. 什么是弹性?
流动是一种简单的编程语言,用于显示和处理 3scale 系统中的大部分数据,供 API 提供商使用。流动最初由 Shopify 开发,并在整个网络的许多其他内容管理系统(CMS)引擎中使用。在 3scale 平台中,它用于向您的 API 开发人员公开服务器端数据,在维护高级别安全性的同时大幅扩展开发人员门户的实用性。
1.1.1. 优点和缺点
人员主要用于在开发人员门户页面上获取和显示服务器端数据。然而,只有比这更强大的力量。这些服务非常适合:
- 根据服务器端数据更改页面的 DOM 和内容
- 在页面、布局和部分中添加逻辑
- 操作发送给开发人员的电子邮件模板
有些用例中,攻击并不提供问题的最佳解决方案,大多数情况是您需要使用动态数据,如用户输入或页面 URL。
些一般建议是将它们用作向页面添加逻辑的主要方法,但是当您发现不可能或过于复杂时,切换到 JavaScript(或将其添加到其中,因为与 JS 非常适合)。
1.2. 如何使用移植
刻录标记分为两种类型:逻辑标签和输出标签。标记为 {% %} 的逻辑标签是条件语句,包括标准编程语言元素,如 if 子句、循环等。
{% if current_user %} <!-- if the user is logged in --> <a href="/logout">Logout</a> <!-- show the logout link --> {% else %} <!-- if the user is not logged in --> <a href="/login">Login</a> <!-- display the login link --> {% endif %}
输出标签标记为 {{ }},用于显示大括号之间的标签值。
{{ current_user.username }} <!-- display the logged-in user's username value -->
有关逻辑标签的文档,请参阅 Shopify 教程。3scale 变化的输出标签的完整引用可在 tags 部分和管理门户的 Help > Liquid Reference 下找到。
1.2.1. 可移动丢弃、标签和过滤器
在 3scale 开发人员门户中,您可以访问三种类型的制造标记:
-
流动丢弃 -
{{ current_account.name }}
-
精简标签 -
{% 内容 %}
-
liquid filters -
{{ form.errors.description | error_class }}
移动丢弃、标签和过滤器与如何使用手机中提到的逻辑和输出标签类似 。
流动下降是最基本的结构,你经常会使用它们。它们提供对系统中存储的某些值的访问权限,如用户名称和应用的标识符。解释器处理它们的方式与任何其他输出标签相同。
另一方面,流动标签是一种逻辑标签,可以呈现或访问系统的某些部分进行进一步自定义,例如,呈现布局中的内容或自定义电子邮件模板。
通过过滤器,可以选择从丢弃、转换值和按某些键分组的结果。有一组标准的移动过滤器,您可以在 Shopify 网站和 一组特殊的 3scale 内部过滤器中找到,它们列在许可 参考 部分。
1.2.2. 上下文
该上下文描述了可在当前页面中使用哪些变量(Drops)。基本集包括以下变量:
- provider
- URL
- current_user
- current_account
- 今天
除了电子邮件模板外,这些变量可在整个开发人员门户的每个页面上提供。但是,大多数内置页面都将具有一些额外的变量。例如,编辑用户表单将公开一个 user 变量(而不是当前用户 - 在编辑用户页面中,该用户的身份已经已知)。要检查当前页面中有哪些变量可用,有一个特殊的标签:{ % debug:help %}
。它将添加所有可用的顶级变量的列表,以用作页面源中的注释。
1.2.3. 层次结构
该上下文的直接结果是颠覆性下降被组织到层次结构中。可用的一组变量列出了可用的顶级丢弃。使用它们,您可以更深入地访问层次结构中的元素。例如,如果您想要显示已登录用户的用户名,则需要编写 {{ current_user.username }}
。
显示较低级别丢弃稍微复杂一些。假定您要为用户显示唯一的应用的名称。查看参考指南,您可以看到方法 应用 是帐户丢弃的一部分。这意味着应用是单一应用标签的数组。如果您的用户被允许有多个应用程序,则必须使用逻辑标签迭代应用程序。否则,您可以引用帐户上的第一个(和唯一的)应用程序。要显示的代码如下所示: {{ current_account.applications.first.name }}
。
1.3. Remediation templates
每个 Liquid 模板都包括以下变量:
- Provider - 您在一个树下的所有服务、计划和设置
- URL - Developer 门户内置页面的路由 - 登录、注册
- current_user - 当前已登录用户的用户名、地址和权限
- current_account - 当前已登录用户的消息、应用程序和计划
- 今天 - 当前日期
内置页面也可以有其他可用的变量,这些变量在 Developer Portal 中提到。例如,编辑用户表单编辑将分配或显示应用程序详细信息 的用户
变量,您可以预期变量 应用
可以访问。
变量的类型对使用这个引用非常重要,可以通过将 {% debug:help %}
标签放在页面中来为您列出所有可用变量及其类型。但是,从方法或变量名称通常会很容易地猜测它们。
1.4. drops
- 帐户丢弃
- AccountPlan drop
- 警报丢弃
- 应用程序丢弃
- ApplicationKey drop
- ApplicationPlan drop
- 基本丢弃
- 基本丢弃
- BillingAddressField drop
- 可以丢弃
- 可以丢弃
- cas drop
- 合同丢弃
- 国家/地区丢弃
- 国家防火墙丢弃
- CurrentUser drop
- 错误丢弃
- 错误丢弃
- 功能丢弃
- 字段丢弃
- 闪存丢弃
- 论坛丢弃
- I18n drop
- 邀请丢弃
- 发票丢弃
- LineItem drop
- 消息丢弃
- 消息丢弃
- 指标丢弃
- 页面丢弃
- 页面丢弃
- 分页丢弃
- part drop
- PaymentGateway drop
- 支付交易减少
- PlanFeature drop
- 后丢弃
- 后丢弃
- pricingRule drop
- provider drop
- RererFilter droprerFilter
- 请求丢弃
- 角色丢弃
- 搜索丢弃
- 服务丢弃
- ServiceContract drop
- ServicePlan drop
- timezone drop
- 现在丢弃
- 主题丢弃
- 主题丢弃
- URL drop
- URL drops drop
- 使用限值丢弃
- 用户丢弃
1.5. Tags
1.6. 过滤器
1.7. 丢弃(向上)
1.7.1. 帐户丢弃 (更新)
开发人员帐户.如果要查找电子邮件地址或类似信息,请参阅 用户
drop。
<h2>Account organization name {{ current_account.name }}</h2> Plan {{ current_account.bought_account_plan.name }} Telephone {{ current_account.telephone_number }} {{ current_account.fields_plain_text }} {{ current_account.extra_fields_plain_text }} {% if current_account.approval_required? %} <p>This account requires approval.</p> {% endif %} {% if current_account.credit_card_required? %} {% if current_account.credit_card_stored? %} <p>This account has credit card details stored in database.</p> {% else %} <p>Please enter your {{ 'credit card details' | link_to: urls.payment_details }}.</p> {% endif %} {% if current_account.credit_card_missing? %} <p>This account has no credit card details stored in database.</p> {% endif %} {% endif %}
1.7.1.1. 方法
1.7.1.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ account.errors.name | inline_errors }}
1.7.1.1.2. id
返回帐户的 ID
1.7.1.1.3. name
返回开发人员帐户的组织名称
1.7.1.1.4. vat_zero_text
返回有关 vat零的文本
1.7.1.1.5. vat_rate
返回 vat 速率
1.7.1.1.6. unread_messages
未读取消息
1.7.1.1.7. latest_messages
返回最新消息
1.7.1.1.8. bought_account_plan
返回帐户已合同的计划
1.7.1.1.9. bought_account_contract
返回合同帐户
1.7.1.1.10. credit_card_display_number
1.7.1.1.11. credit_card_expiration_date
1.7.1.1.12. credit_card_required?
返回帐户是否需要输入信用卡详情
1.7.1.1.13. credit_card_stored?
返回帐户是否存储了信用卡详情
1.7.1.1.14. credit_card_missing?
返回帐户没有存储信用卡详情
1.7.1.1.15. timezone
返回此帐户的时区
1.7.1.1.16. 已付费?
返回帐户是否至少具有付费合同
1.7.1.1.17. on_main?
返回帐户是否处于试用期,即其所有已支付合同都必须处于试用期
1.7.1.1.18. telephone_number
返回帐户的电话号码
1.7.1.1.19. approval_required?
返回帐户是否需要审批?
1.7.1.1.20. created_at
返回 UNIX 时间戳创建帐户(签名) 示例: 将时间戳转换为 JavaScript 日期
<script> var data = new Date({{ account.created_at }} * 1000); </script>
1.7.1.1.21. full_address
可通过法律地址、城市和州组成
1.7.1.1.22. 应用程序
返回帐户的应用
1.7.1.1.23. subscribed_services
返回带有 ServiceContract drops 的数组
1.7.1.1.24. admin
返回此帐户的 admin 用户
1.7.1.1.25. extra_fields_plain_text
返回为帐户定义的额外字段,格式为纯文本
1.7.1.1.26. fields_plain_text
返回为帐户定义的字段纯文本
1.7.1.1.27. extra_fields
仅返回带有此帐户 示例值的额外字段: 打印所有额外字段
{% for field in account.extra_fields %} {{ field.label }}: {{ field.value }} {% endfor %}
1.7.1.1.28. fields
返回所有带有此帐户 示例值的字段: 打印所有字段
{% for field in account.fields %} {{ field.label }}: {{ field.value }} {% endfor %}
1.7.1.1.29. builtin_fields
1.7.1.1.30. multiple_applications_allowed?
1.7.1.1.31. billing_address
返回此帐户的计费地址
1.7.1.1.32. has_billing_address?
返回此帐户是否有账单地址
1.7.1.1.33. can
授予权限方法访问权限
{% if account.can.be_deleted? %} <!-- do something --> {% endif %}
1.7.1.1.34. edit_url
1.7.1.1.35. edit_ogone_billing_address_url
1.7.1.1.36. edit_payment_express_billing_address_url
1.7.1.1.37. edit_braintree_blue_credit_card_details_url
1.7.1.1.38. domain
1.7.1.1.39. 升级?
1.7.1.1.40. requires_credit_card?
1.7.1.1.41. support_email
1.7.1.1.42. finance_support_email
1.7.2. AccountPlan drop (向上)
示例: 使用帐户计划丢弃
<p class="notice">The examples for plan drop apply here</p>
1.7.2.1. 方法
1.7.2.1.1. 已选定?
返回是否选择了计划
{% if plan.selected? %} <p>You will signup to {{ plan.name }}</p> {% endif %}
1.7.2.1.2. 购买?
返回计划是否购买
{% if plan.bought? %} <p>You are on this plan already!</p> {% endif %}
1.7.2.1.3. 功能
返回一组可用功能
1.7.2.1.4. setup_fee
返回设置费用
1.7.2.1.5. name
返回计划名称
<h2>We offer you a new {{ plan.name }} plan!</h2>
1.7.2.1.6. system_name
返回计划的系统名称
{% for plan in available_plans %} {% if plan.system_name == 'my_free_plan' %} <p>You will buy our only free plan!</p> {% endif %} {% endfor %}
1.7.2.1.7. id
返回计划 ID
1.7.2.1.8. 免费?
如果计划 未付款
,则为免费计划。请参见 付费的方法。
{% if plan.free? %} <p>This plan is free of charge.</p> {% else %} <p>Plan costs</p> Setup fee {{ plan.setup_fee }} Flat cost {{ plan.flat_cost }} {% endif %}
1.7.2.1.9. 已付费?
如果计划 具有
非零固定或设置费用或存在一些定价规则,则支付计划
{% if plan.paid? %} <p>this plan is a paid one.</p> {% else %} <p>this plan is a free one.</p> {% endif %}
1.7.2.1.10. approval_required?
返回计划是否需要审批?
{% if plan.approval_required? %} <p>This plan requires approval.</p> {% endif %}
1.7.2.1.11. flat_cost
返回计划的月度固定费用
1.7.3. 警报丢弃 (更新)
示例: 使用警报丢弃
<h2>Alert details</h2> Level {{ alert.level }} Message {{ alert.message }} Utilization {{ alert.utilization }}
1.7.3.1. 方法
1.7.3.1.1. level
警报级别可以是 50, 80, 90, 100, 120, 150, 200, 300。
1.7.3.1.2. message
描述警报的文本信息,例如 每分钟按键:5/5
1.7.3.1.3. 使用率
标记触发警报 1.0 的实际利用率的十进制数等于 100%。
Used by {{ alert.utilization | times: 100 }} percent.
1.7.4. 应用程序丢弃 (向上)
示例: 使用应用程序丢弃
<h2>Application {{ application.name }} ({{ application.application_id }})</h2> <p>{{ application.description }}</p>
1.7.4.1. 方法
1.7.4.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ application.errors.name | inline_errors }}
1.7.4.1.2. id
返回应用程序的 id
1.7.4.1.3. can_change_plan?
如果直接或通过请求允许更改应用,则返回 true
。
1.7.4.1.4. 试用?
如果合同仍在试用期间,返回真.
注 :如果您更改计划的试用周期长度,则不影响现有合同。
1.7.4.1.5. 生活?
1.7.4.1.6. 状态
有三种可能的状态:
- pending - live - suspended
1.7.4.1.7. remaining_trial_period_days
试用期间仍存在的天数.
1.7.4.1.8. 计划
使用应用计划返回计划 drop
1.7.4.1.9. plan_change_permission_name
返回允许操作的名称
1.7.4.1.10. plan_change_permission_warning
返回允许操作的警告消息
1.7.4.1.11. contract
1.7.4.1.12. admin_url
返回应用的 admin_url
1.7.4.1.13. name
返回应用程序的名称
1.7.4.1.14. can
1.7.4.1.15. OAuth
1.7.4.1.16. 待定?
如果应用程序状态为 pending,则返回 true
1.7.4.1.17. buyer_alerts_enabled?
1.7.4.1.18. description
返回应用程序的描述
1.7.4.1.19. redirect_url
返回应用程序 OAuth 的重定向 URL
1.7.4.1.20. filters_limit
返回此应用程序允许的引用器过滤器数量
1.7.4.1.21. keys_limit
返回此应用程序允许的应用程序密钥量
1.7.4.1.22. referrer_filters
返回与此应用程序关联的引用器过滤器
1.7.4.1.23. rejection_reason
返回拒绝应用程序的原因
1.7.4.1.24. user_key
返回应用程序的 user_key
1.7.4.1.25. application_id
返回应用程序的 application_id
1.7.4.1.26. key
返回应用程序 ID 或用户密钥
1.7.4.1.27. url
返回此应用的内置详情视图的 URL。
1.7.4.1.28. edit_url
返回此应用的内置编辑视图的 URL。
1.7.4.1.29. update_user_key_url
1.7.4.1.30. log_requests_url
1.7.4.1.31. alerts_url
1.7.4.1.32. application_keys_url
1.7.4.1.33. service
该应用所属的服务。
1.7.4.1.34. Keys
返回应用程序的密钥
{% case application.keys.size %} {% when 0 %} Generate your application key. {% when 1 %} <h4>Application key for {{ application.name }} {{ application.application_id }}</h4> <p>Key is: {{ application.keys.first }}</p> {% else %} <h4>Application keys for {{ application.name }} {{ application.application_id }}</h4> <ul> {% for key in application.keys %} <li>{{ key }}</li> {% endfor %} </ul> {% endcase %}
1.7.4.1.35. user_key_mode?
1.7.4.1.36. app_id_mode?
1.7.4.1.37. change_plan_url
1.7.4.1.38. log_requests?
1.7.4.1.39. application_keys
1.7.4.1.40. extra_fields
返回带有此应用程序 示例值的非隐藏额外字段:Pri nt all extra 字段
{% for field in application.extra_fields %} {{ field.label }}: {{ field.value }} {% endfor %}
1.7.4.1.41. fields
返回所有内置字段和附加字段以及此应用程序 示例的值: 打印所有字段
{% for field in application.fields %} {{ field.label }}: {{ field.value }} {% endfor %}
1.7.4.1.42. builtin_fields
仅返回应用程序的内置字段
1.7.4.1.43. cinstance
1.7.5. ApplicationKey drop (更新)
1.7.5.1. 方法
1.7.5.1.1. id
1.7.5.1.2. value
1.7.5.1.3. url
1.7.5.1.4. 应用
1.7.6. ApplicationPlan drop (启动)
1.7.6.1. 方法
1.7.6.1.1. 已选定?
返回是否选择了计划
{% if plan.selected? %} <p>You will signup to {{ plan.name }}</p> {% endif %}
1.7.6.1.2. 购买?
返回计划是否购买
{% if plan.bought? %} <p>You are on this plan already!</p> {% endif %}
1.7.6.1.3. 功能
返回计划可见的功能
{% if plan == my_free_plan %} <p>These plans are the same.</p> {% else %} <p>These plans are not the same.</p> {% endif %}
1.7.6.1.4. setup_fee
返回计划的设置费用
1.7.6.1.5. name
返回计划名称
<h2>We offer you a new {{ plan.name }} plan!</h2>
1.7.6.1.6. system_name
返回计划的系统名称
{% for plan in available_plans %} {% if plan.system_name == 'my_free_plan' %} <p>You will buy our only free plan!</p> {% endif %} {% endfor %}
1.7.6.1.7. id
返回计划 ID
1.7.6.1.8. 免费?
如果计划 未付款
,则为免费计划。请参见 付费方式。
{% if plan.free? %} <p>This plan is free of charge.</p> {% else %} <p>Plan costs</p> Setup fee {{ plan.setup_fee }} Flat cost {{ plan.flat_cost }} {% endif %}
1.7.6.1.9. 已付费?
如果计划 具有
非零固定或设置费用或存在一些定价规则,则支付计划
{% if plan.paid? %} <p>this plan is a paid one.</p> {% else %} <p>this plan is a free one.</p> {% endif %}
1.7.6.1.10. approval_required?
返回计划是否需要审批?
{% if plan.approval_required? %} <p>This plan requires approval.</p> {% endif %}
1.7.6.1.11. flat_cost
返回计划的月度固定费用
1.7.6.1.12. metrics
返回计划的指标
1.7.6.1.13. usage_limits
返回计划用量限制
1.7.6.1.14. service
返回计划服务
1.7.7. 基础丢弃 (向上)
1.7.7.1. 方法
1.7.7.1.1. login_url
1.7.7.1.2. user_identified?
1.7.8. 基础丢弃 (向上)
1.7.8.1. 方法
1.7.8.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ base.errors.name | inline_errors }}
1.7.8.1.2. title
返回标题结果
1.7.8.1.3. kind
返回结果类型,可以是 'topic' 或 'page'
1.7.8.1.4. url
返回结果的资源 url
1.7.8.1.5. description
为结果返回一个描述性字符串
1.7.9. BillingAddressField drop (更新)
1.7.9.1. 方法
1.7.9.1.1. input_name
1.7.9.1.2. label
1.7.9.1.3. 选项
1.7.9.1.4. 错误
1.7.9.1.5. html_id
1.7.9.1.6. 隐藏?
1.7.9.1.7. 可见?
1.7.9.1.8. 只读?
1.7.9.1.9. name
1.7.9.1.10. value
1.7.9.1.11. 必需
1.7.10. 可以丢弃 (向上)
1.7.10.1. 方法
1.7.10.1.1. be_updated?
1.7.10.1.2. add_referrer_filters?
1.7.10.1.3. add_application_keys?
1.7.10.1.4. regenerate_user_key?
1.7.10.1.5. regenerate_oauth_secret?
1.7.10.1.6. manage_keys?
1.7.10.1.7. delete_key?
1.7.11. 可以丢弃 (向上)
1.7.11.1. 方法
1.7.11.1.1. change_plan?
1.7.12. CAS drop (上线)
1.7.12.1. 方法
1.7.12.1.1. login_url
1.7.12.1.2. user_identified?
1.7.13. 合同丢弃 (升级)
Plan of the contract {{ contract.plan.name }}
1.7.13.1. 方法
1.7.13.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ contract.errors.name | inline_errors }}
1.7.13.1.2. id
返回 id
1.7.13.1.3. can_change_plan?
如果可能以任何形式更改,则返回 true
1.7.13.1.4. 试用?
如果合同仍在试用期间,返回真.
注 :如果您更改计划的试用周期长度,则不影响现有合同。
1.7.13.1.5. 生活?
1.7.13.1.6. 状态
有三种可能的状态:
- pending - live - suspended
1.7.13.1.7. remaining_trial_period_days
试用期间仍存在的天数.
1.7.13.1.8. 计划
返回合同计划
1.7.13.1.9. plan_change_permission_name
返回允许操作的名称
1.7.13.1.10. plan_change_permission_warning
返回允许操作的警告消息
1.7.13.1.11. contract
1.7.14. 国家/地区丢弃 (向上)
1.7.14.1. 方法
1.7.14.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ country.errors.name | inline_errors }}
1.7.14.1.2. to_str
1.7.14.1.3. Code
1.7.14.1.4. label
1.7.15. CountryField drop (更新)
1.7.15.1. 方法
1.7.15.1.1. value
返回国家 ID
{{ account.fields.country.value }} => 42 compare with: {{ account.fields.country }} => 'United States'
1.7.15.1.2. name
返回字段的系统名称
1.7.15.1.3. 必需
1.7.15.1.4. 隐藏?
1.7.15.1.5. 隐藏
1.7.15.1.6. 可见?
1.7.15.1.7. visible
1.7.15.1.8. read_only
1.7.15.1.9. 错误
1.7.15.1.10. input_name
1.7.15.1.11. html_id
1.7.15.1.12. label
返回字段的标签
{{ account.fields.country.label }} <!-- => 'Country' -->
1.7.15.1.13. to_str
国家返回名称
{{ account.fields.country }} => 'United States'
1.7.15.1.14. 选项
1.7.16. CurrentUser drop (向上)
1.7.16.1. 方法
1.7.16.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ current_user.errors.name | inline_errors }}
1.7.16.1.2. 管理员?
返回用户是否为 admin。
{% if user.admin? %} <p>You are an admin of your account.</p> {% endif %}
1.7.16.1.3. username
返回用户的用户名 html escaped。
1.7.16.1.4. 帐户
返回用户的帐户。
1.7.16.1.5. name
返回用户的第一个和姓氏.
1.7.16.1.6. email
返回用户的电子邮件。
1.7.16.1.7. password_required?
对于通过 Janrain、CAS 或其他单点登录方法进行身份验证的用户 ,
此方法将使用内置开发人员门户身份验证机制返回 真
。
{{ if user.password_required? }} {{ endif }}
1.7.16.1.8. 部分
返回用户有权访问的部分列表。
{% if user.sections.size > 0 %} <p>You can access following sections of our portal:</p> <ul> {% for section in user.sections %} <li>{{ section }}</li> {% endfor %} </ul> {% endif %}
1.7.16.1.9. role
返回用户的角色
1.7.16.1.10. roles_collection
重新调整用户的可用角色列表
{% for role in user.roles_collection %} <li> <label for="user_role_{{ role.key }}"> {{ role.text }} </label> </li> {% endfor %}
1.7.16.1.11. url
返回用户的资源 URL
{{ 'Delete' | delete_button: user.url }}
1.7.16.1.12. edit_url
返回 URL 以编辑用户
{{ 'Edit' | link_to: user.edit_url, title: 'Edit', class: 'action edit' }}
1.7.16.1.13. can
公开当前用户根据您的设置和用户角色的权利。您可以在返回的对象上调用这些方法:
- invite_user?
- create_application?
- see_log_requests?
{% if current_user.can.see_log_requests? and application.log_requests? %} (<a href="{{ application.log_requests_url }}" class="action edit">App Request Log</a>) {% endif %}
1.7.16.1.14. extra_fields
返回带有此用户 示例值的非隐藏额外字段:Pri nt all extra 字段
{% for field in user.extra_fields %} {{ field.label }}: {{ field.value }} {% endfor %}
1.7.16.1.15. fields
返回所有包含此用户 示例值的字段:Pri nt all 字段
{% for field in user.fields %} {{ field.label }}: {{ field.value }} {% endfor %}
1.7.16.1.16. builtin_fields
返回所有带有此用户值的内置字段
1.7.17. 错误丢弃 (向上)
当表单因为无效数据而无法提交时,错误
数组将位于相关模型中。
1.7.17.1. 方法
1.7.17.1.1. attribute
模型的返回属性到这个错误是相关的
{{ account.errors.org_name.first.attribute }} <!-- org_name -->
1.7.17.1.2. message
返回错误描述
{{ account.errors.first.message }} <!-- cannot be blank -->
1.7.17.1.3. value
返回与 错误
相关的属性值
{{ account.errors.org_name.first.value }} <!-- => "ACME Co." -->
1.7.17.1.4. to_str
返回错误的完整描述(包括属性名称)
{{ model.errors.first }} <!-- => "Attribute can't be blank" -->
1.7.18. 错误丢弃 (向上)
示例: 获取所有错误
{% for error in form.errors %} attribute: {{ error.attribute }} ... {% endfor %}
1.7.18.1. 方法
1.7.18.1.1. 空?
如果没有错误,返回 true
{% if form.errors == empty %} Congratulations! You have no errors! {% endif %}
1.7.18.1.2. 存在?
如果有错误,返回 true
{% if form.errors == present %} Sorry, there were some errors. {% endif %}
1.7.19. 功能丢弃 (更新)
1.7.19.1. 方法
1.7.19.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ feature.errors.name | inline_errors }}
1.7.19.1.2. name
返回功能名称
<h2>Feature {{ feature.name }}</h2>
1.7.19.1.3. description
返回该功能的描述
1.7.19.1.4. has_description?
返回功能是否有描述
{% if feature.has_description? %} {{ feature.description }} {% else %} This feature has no description. {% endif %}
1.7.20. 字段丢弃 (向上)
1.7.20.1. 方法
1.7.20.1.1. value
字段返回值
Name: {{ account.fields.first_name.value }}
1.7.20.1.2. name
返回字段的系统名称
1.7.20.1.3. 必需
1.7.20.1.4. 隐藏?
1.7.20.1.5. 隐藏
1.7.20.1.6. 可见?
1.7.20.1.7. visible
1.7.20.1.8. read_only
1.7.20.1.9. 错误
1.7.20.1.10. input_name
返回提交表单时预期的 HTML 输入的名称。
<!-- the 'name' attribute will be 'account[country]' -->
1.7.20.1.11. html_id
返回唯一字段标识符,该标识符通常用作 HTML ID 属性。
{{ account.fields.country.html_id }} <!-- => 'account_country' -->
1.7.20.1.12. label
返回字段的标签
{{ account.fields.country.label }} <!-- => 'Country' -->
1.7.20.1.13. to_str
如果用作变量,则返回字段的值
{{ account.fields.first_name }} => 'Tom'
1.7.20.1.14. 选项
返回可用于该字段的一组选项(若有)。例如,对于名为"强制"的字段 ,
它可以响应 ['apple', 'bannana', 'orange']
。
您可以在 3scale 管理门户中定义选择,在 Audience > Accounts > Settings > Fields Definitions 下。每个数组元素都响应 id
和 标签
,它们通常完全相同,除非字段是特殊的内置位置(如 国家/地区
)。建议使用这些方法,而不是输出 选择
"as"以保证将来的兼容性。
{% for choice in field.choices %} <select name="{{ field.input_name }}" id="{{ field.html_id }}_id" class="{{ field.errors | error_class }}"> <option {% if field.value == choice %} selected {% endif %} value="{{ choice.id }}"> {{ choice }} </option> {% endfor %}
1.7.21. 闪烁 (上线)
1.7.21.1. 方法
1.7.21.1.1. 消息
返回一组信息
{% for message in flash.messages %} <p id="flash-{{ message.type }}"> {{ message.text }} </p> {% endfor %}
1.7.22. 论坛丢弃 (上移)
1.7.22.1. 方法
1.7.22.1.1. 是否启用?
如果您启用了论坛功能,则返回 true
。
{% if forum.enabled? %} <a href="/forum">Check out our forum!</a> {% endif %}
1.7.22.1.2. latest_posts
1.7.23. I18n drop (上线)
为 i18n 支持提供有用的字符串。
{{ object.some_date | date: i18n.long_date }}
1.7.23.1. 方法
1.7.23.1.1. short_date
%b %d 的别名
Dec 11
1.7.23.1.2. long_date
%B %d 的别名, %Y
December 11, 2013
1.7.23.1.3. default_date
%Y-%m-%d 的别名
2013-12-11
1.7.24. 邀请丢弃 (向上)
Email: {{ invitation.email }} <tr id="invitation_{{ invitation.id }}"> <td> {{ invitation.email }} </td> <td> {{ invitation.sent_at | date: i18n.short_date }} </td> <td> {% if invitation.accepted? %} yes, on {{invitation.accepted_at | format: i18n.short_date }} {% else %} no {% endif %} </td> </tr>
1.7.24.1. 方法
1.7.24.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ invitation.errors.name | inline_errors }}
1.7.24.1.2. email
返回电子邮件地址
1.7.24.1.3. 已接受?
如果邀请被接受,返回 true
1.7.24.1.4. accepted_at
如果接受邀请,则返回日期
{{ invitation.accepted_at | date: i18n.short_date }}
1.7.24.1.5. sent_at
返回创建日期
{{ invitation.sent_at | date: i18n.short_date }}
1.7.24.1.6. resend_url
返回重新发送邀请的 url
{{ "Resend" | update_button: invitation.resend_url}}
1.7.24.1.7. url
返回资源 url
{{ "Delete" | delete_button: invitation.url }}
1.7.25. 发票丢弃 (升级)
1.7.25.1. 方法
1.7.25.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ invoice.errors.name | inline_errors }}
1.7.25.1.2. friendly_id
返回友好 ID
<td> {{ invoice.id }} </td> <td> {{ invoice.name }} </td> <td> {{ invoice.state }} </td> <td> {{ invoice.cost }} {{ invoice.currency }} </td>
1.7.25.1.3. name
由月份和年份组成的字符串
1.7.25.1.4. 状态
1.7.25.1.5. cost
返回带有两个十进制的数字
23.00
1.7.25.1.6. 货币
1.7.25.1.7. cost_without_vat
使用 VAT 返回成本
1.7.25.1.8. vat_amount
返回 vat ammount
1.7.25.1.9. exists_pdf?
如果生成了 pdf,则返回 true
1.7.25.1.10. period_begin
{{ invoice.period_begin | date: i18n.short_date }}
1.7.25.1.11. period_end
{{ invoice.period_end | date: i18n.long_date }}
1.7.25.1.12. issued_on
{{ invoice.issued_on | date: i18n.long_date }}
1.7.25.1.13. due_on
{{ invoice.due_on | date: i18n.long_date }}
1.7.25.1.14. paid_on
{{ invoice.paid_on | date: i18n.long_date }}
1.7.25.1.15. vat_code
1.7.25.1.16. fiscal_code
1.7.25.1.17. 帐户
返回 AccountDrop
1.7.25.1.18. buyer_account
1.7.25.1.19. line_items
返回 LineItemDrop 数组
{% for line_item in invoice.line_items %} <tr class="line_item {% cycle 'odd', 'even' %}"> <th>{{ line_item.name }}</th> <td>{{ line_item.description }}</td> <td>{{ line_item.quantity }}</td> <td>{{ line_item.cost }}</td> </tr> {% endfor %}
1.7.25.1.20. payment_transactions
返回 PaymentTransactionDrop 数组
{% for payment_transaction in invoice.payment_transactions %} <tr> <td> {% if payment_transaction.success? %} Success {% else %} Failure {% endif %} </td> <td> {{ payment_transaction.created_at }} </td> <td> {{ payment_transaction.reference }} </td> <td> {{ payment_transaction.message }} </td> <td> {{ payment_transaction.amount }} {{ payment_transaction.currency }} </td> </tr> {% endfor %}
1.7.25.1.21. url
返回发票的资源 URL
{{ "Show" | link_to: invoice.url }}
1.7.25.1.22. pdf_url
返回发票 pdf 的资源 URL
{{ "PDF" | link_to: invoice.pdf_url }}
1.7.26. Janrain drop (上线)
1.7.26.1. 方法
1.7.26.1.1. login_url
1.7.26.1.2. user_identified?
1.7.26.1.3. session_url
1.7.26.1.4. relying_party
1.7.27. LineItem drop (向上)
1.7.27.1. 方法
1.7.27.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ line_item.errors.name | inline_errors }}
1.7.27.1.2. name
{% for line_item in invoice.line_items %} <tr class="line_item {% cycle 'odd', 'even' %}"> <th>{{ line_item.name }}</th> <td>{{ line_item.description }}</td> <td>{{ line_item.quantity }}</td> <td>{{ line_item.cost }}</td> </tr> {% endfor %}
1.7.27.1.3. description
1.7.27.1.4. quantity
1.7.27.1.5. cost
1.7.28. 消息丢弃 (向上)
1.7.28.1. 方法
1.7.28.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ message.errors.name | inline_errors }}
1.7.28.1.2. id
返回消息的 id
1.7.28.1.3. 主题
如果没有 subject,则返回截断正文或 (无主题)
字符串。
1.7.28.1.4. 正文(body)
邮件正文
1.7.28.1.5. created_at
返回创建日期
{{ message.created_at | date: i18n.short_date }}
1.7.28.1.6. url
消息详细信息的 URL,指向 inbox 或 outbox。
1.7.28.1.7. 状态
'read' 或 'unread'
1.7.28.1.8. sender
返回发件人的名称
1.7.28.1.9. 为
返回接收方的名称
1.7.28.1.10. 接收者
1.7.29. 消息丢弃 (向上)
1.7.29.1. 方法
1.7.29.1.1. type
可能的信息类型有:
- 成功(目前尚未使用)
- info
- warning
- 危险
1.7.29.1.2. text
1.7.30. 指标丢弃 (上移)
1.7.30.1. 方法
1.7.30.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ metric.errors.name | inline_errors }}
1.7.30.1.2. unit
返回指标的单元
This metric is measured in {{ metric.unit | pluralize }}
1.7.30.1.3. description
返回指标的描述
1.7.30.1.4. name
返回指标的名称
<h4>Metric {{ metric.name }}</h4> <p>{{ metric.description }}</p>
1.7.30.1.5. system_name
返回此指标的系统名称
<h4>Metric {{ metric.name }}</h4> <p>{{ metric.system_name }}</p>
1.7.30.1.6. usage_limits
返回指标用量限值
{% if metric.usage_limits.size > 0 %} <p>Usage limits of the metric</p> <ul> {% for usage_limit in metric.usage_limits %} <li>{{ usage_limit.period }} : {{ usage_limit.value }}</li> {% endfor %} </ul> {% else %} <p>This metric has no usage limits</p> {% endif %}
1.7.30.1.7. pricing_rules
返回指标的定价规则
{% if metric.pricing_rules.size > 0 %} <p>Pricing rules of the metric</p> <ul> {% for pricing_rule in metric.pricing_rules %} <li>{{ pricing_rule.cost_per_unit }}</li> {% endfor %} </ul> {% else %} <p>This metric has no pricing rules</p> {% endif %}
1.7.30.1.8. has_parent
1.7.31. 页面丢弃 (向上)
1.7.31.1. 方法
1.7.31.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ page.errors.name | inline_errors }}
1.7.31.1.2. title
返回页面的标题
<title>{{ page.title }}</title>
1.7.31.1.3. system_name
返回页面的系统名称
{% if page.system_name == 'my_page' %} {% include 'custom_header' %} {% endif %}
1.7.32. 页面丢弃 (向上)
1.7.32.1. 方法
1.7.32.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ page.errors.name | inline_errors }}
1.7.32.1.2. title
1.7.32.1.3. kind
1.7.32.1.4. url
1.7.32.1.5. description
1.7.33. 分页丢弃 (上移)
1.7.33.1. 方法
1.7.33.1.1. page_size
个整页中的项目数.
{% for part in pagination.parts %} {% if part.is_link %} {% case part.rel %} {% when 'previous' %} {% assign css_class = 'previous_page' %} {% when 'next' %} {% assign css_class = 'next_page' %} {% else %} {% assign css_class = '' %} {% endcase %} <a class="{{ css_class }}" rel="{{ part.rel}}" href="{{ part.url }}">{{ part.title }}</a> {% else %} {% case part.rel %} {% when 'current' %} <em class="current">{{ part.title }}</em> {% when 'gap' %} … {% else %} {{ part.title }} {% endcase %} {% endif %} {% endfor %} <!-- Outputs: ============================================ <a class="previous_page" rel="prev" href="?page=7">← Previous</a> <a rel="start" href="?page=1">1</a> <a href="?page=2">2</a> <a href="?page=3">3</a> <a href="?page=4">4</a> <a href="?page=5">5</a> <a href="?page=6">6</a> <a rel="prev" href="?page=7">7</a> <em class="current">8</em> <a rel="next" href="?page=9">9</a> <a href="?page=10">10</a> <a href="?page=11">11</a> <a href="?page=12">12</a> … <a href="?page=267">267</a> <a href="?page=268">268</a> <a class="next_page" rel="next" href="?page=9">Next →</a> ======================================= -->
1.7.33.1.2. current_page
当前选定页面的编号.
1.7.33.1.3. current_offset
项目到目前为止跳过。
1.7.33.1.4. 页
页面总数.
1.7.33.1.5. 项
所有页面中项目总数.
1.7.33.1.6. 上一个
上一页或空页面的数量。
1.7.33.1.7. 下一步
下一页或空的数量。
1.7.33.1.8. 部分
有助于呈现用户友好的分页的元素.如需更多信息,请参阅 [[part-drop[part drop]。
1.7.34. part drop (向上)
1.7.34.1. 方法
1.7.34.1.1. url
1.7.34.1.2. rel
1.7.34.1.3. 当前情况?
1.7.34.1.4. is_link
1.7.34.1.5. title
1.7.34.1.6. to_s
1.7.35. 支付Gateway drop (向上)
1.7.35.1. 方法
1.7.35.1.1. braintree_blue?
返回当前支付网关是否为脑树支付.com
1.7.35.1.2. authorize_net?
返回当前支付网关是否授权。Net
1.7.35.1.3. type
返回此支付网关的类型。
1.7.36. 支付交易下降 (向上)
1.7.36.1. 方法
1.7.36.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ payment_transaction.errors.name | inline_errors }}
1.7.36.1.2. 货币
返回货币
{% for payment_transaction in invoice.payment_transactions %} <tr> <td> {% if payment_transaction.success? %} Success {% else %} Failure {% endif %} </td> <td> {{ payment_transaction.created_at }} </td> <td> {{ payment_transaction.reference }} </td> <td> {{ payment_transaction.message }} </td> <td> {{ payment_transaction.amount }} {{ payment_transaction.currency }} </td> </tr> {% endfor %}
1.7.36.1.3. 数量
返回数量
1.7.36.1.4. created_at
返回创建日期
1.7.36.1.5. 成功?
如果 成功,则返回 true
1.7.36.1.6. message
返回事务的消息
1.7.36.1.7. reference
返回引用
1.7.37. PlanFeature drop (上线)
1.7.37.1. 方法
1.7.37.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ plan_feature.errors.name | inline_errors }}
1.7.37.1.2. name
返回功能名称
<h2>Feature {{ feature.name }}</h2>
1.7.37.1.3. description
返回该功能的描述
1.7.37.1.4. has_description?
返回功能是否有描述
{% if feature.has_description? %} {{ feature.description }} {% else %} This feature has no description. {% endif %}
1.7.37.1.5. 是否启用?
1.7.38. 后丢弃 (向上)
1.7.38.1. 方法
1.7.38.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ post.errors.name | inline_errors }}
1.7.38.1.2. 正文(body)
后期的文本。
1.7.38.1.3. 主题
每个 post 属于 [[topic-drop[topic]
1.7.38.1.4. created_at
此后创建的日期
{{ post.created_at | date: i18n.short_date }}
1.7.38.1.5. url
此后期的 URL 位于其主题中
1.7.39. 后丢弃 (向上)
1.7.39.1. 方法
1.7.39.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ post.errors.name | inline_errors }}
1.7.39.1.2. title
1.7.39.1.3. kind
1.7.39.1.4. url
1.7.39.1.5. description
1.7.40. PricingRule drop (向上)
1.7.40.1. 方法
1.7.40.1.1. cost_per_unit
返回定价规则 示例的单位成本: 使用定价规则丢弃
<h2>Pricing rule</h2> Min value {{ pricing_rule.min }} Max value {{ pricing_rule.max }} Cost per unit {{ pricing_rule.cost_per_unit }}
1.7.40.1.2. Min
返回定价规则的最小值
1.7.40.1.3. Max
返回定价规则的最大值
1.7.40.1.4. 计划
返回定价规则计划
1.7.41. 供应商丢弃 (向上)
1.7.41.1. 方法
1.7.41.1.1. name
返回您的组织名称。
Domain {{ provider.domain }} {% if provider.multiple_applications_allowed? %} <p>Applications</p> <ul> {% for app in account.applications %} <li>{{ app.name }}</li> {% endfor %} </ul> {% else %} Application {{ account.applications.first.name }} {% endif %} For general questions contact us at {{ provider.support_email }}, for invoice or payment related questions contact us at {{ provider.finance_support_email }}
1.7.41.1.2. payment_gateway
返回与您的组织关联的支付网关
1.7.41.1.3. domain
Developer Portal 域
1.7.41.1.4. timezone
返回您使用的时区。您可以在管理门户中更改您的时区。选择 Dashboard > Account Settings。在 Overview 页面中,向下滚动到 Account Details,单击 Edit 并修改 Time Zone 字段。
1.7.41.1.5. support_email
帐户的支持电子邮件
1.7.41.1.6. finance_support_email
帐户的财务支持电子邮件
1.7.41.1.7. telephone_number
返回帐户的电话号码
1.7.41.1.8. multiple_applications_allowed?
如果开发人员可以使用自己的密钥、stats 等更多独立的应用程序,则为 true。这取决于您的 3scale 计划。
{% if provider.multiple_applications_allowed? %} <p>Applications</p> <ul> {% for app in account.applications %} <li>{{ app.name }}</li> {% endfor %} </ul> {% else %} Application {{ account.applications.first.name }} {% endif %}
1.7.41.1.9. logo_url
返回徽标 url
1.7.41.1.10. multiple_services_allowed?
如果您的 3scale 计划允许您将多个 API 作为单独的服务进行管理,则为 True。
{% if provider.multiple_services_allowed? %} {% for service in provider.services %} Service {{ service.name }} is available. {% endfor %} {% endif %}
1.7.41.1.11. finance_allowed?
1.7.41.1.12. multiple_users_allowed?
真(如果开发人员帐户可以关联多次登录)。这取决于您的 3scale 计划,且在管理门户的管理门户中是否在 Audience > Developer Portal > Feature Visibility 下打开了其可见性。
{% if provider.multiple_users_allowed? %} <ul id="subsubmenu"> <li> {{ 'Users' | link_to: urls.users }} </li> <li> {{ 'Sent invitations' | link_to: urls.invitations }} </li> </ul> {% endif %}
1.7.41.1.13. account_plans
返回所有公布的帐户计划。
<p>We offer following account plans:</p> <ul> {% for plan in model.account_plans %} <li>{{ plan.name }} </li> {% endfor %} </ul>
1.7.41.1.14. services
返回所有定义的服务。
<p>You can signup to any of our services!</p> <ul> {% for service in provider.services %} <li>{{ service.name }} <a href="/signup/service/{{ service.system_name }}">Signup!</a></li> {% endfor %}
1.7.41.1.15. signups_enabled?
您可以在 3scale 管理门户中启用或禁用 Audience > Accounts > Settings > Usage Rules> 中的签名。
1.7.41.1.16. account_management_enabled?
您可以在 3scale 管理门户中启用或禁用帐户管理,在 Audience > Accounts > Settings > Usage Rules& gt; 下。
1.7.42. RererFilter drop (更新)
1.7.42.1. 方法
1.7.42.1.1. id
1.7.42.1.2. value
1.7.42.1.3. delete_url
1.7.42.1.4. 应用
1.7.43. 请求丢弃 (向上)
示例: 使用请求丢弃(inrigger)
<h2>Request details</h2> URI {{ request.request_uri }} Host {{ request.host }} Host and port {{ request.host_with_port }}
1.7.43.1. 方法
1.7.43.1.1. request_uri
返回请求的 URI
1.7.43.1.2. host_with_port
使用请求的端口返回主机
1.7.43.1.3. 主机
返回请求 URL 的主机部分
1.7.43.1.4. 路径
返回请求 URL 的路径部分
{% if request.path == '/' %} Welcome on a landing page! {% else %} This just an ordinary page. {% endif %}
1.7.44. 角色丢弃 (升级)
1.7.44.1. 方法
1.7.44.1.1. name
返回角色的内部名称,对系统很重要
1.7.44.1.2. description
返回角色的描述符文本
1.7.45. 搜索丢弃 (向上)
1.7.45.1. 方法
1.7.45.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ search.errors.name | inline_errors }}
1.7.45.1.2. 查询
返回搜索的字符串
<h3>{{ search.token }}</h3> <p>found on {{ search.total_found }} {{ search.item | pluralize }} </p> <dl> {% for result in search.results %} <dt> [ {{ result.kind | capitalize}} ] {{ result.title | link_to: result.url }} </dt> <dd> {{ result.description }} </dd> {% endfor %} </dl>
1.7.45.1.3. total_found
返回匹配元素的数量
1.7.45.1.4. 结果
Returs 一系列用于 que 搜索的结果
1.7.46. 服务丢弃 (升级)
1.7.46.1. 方法
1.7.46.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ service.errors.name | inline_errors }}
1.7.46.1.2. name
返回服务名称
1.7.46.1.3. system_name
返回服务的系统名称
{% case service.system_name %} {% when 'api' %} API is our newest service! {% when 'old' %} Unfortunately we dont allow more signups to our old service. {% endcase %}
1.7.46.1.4. description
返回服务的描述
1.7.46.1.5. 已订阅?
返回服务是否订阅
{% if service.subscribed? %} <p>You already subscribed this service.</p> {% endif %}
1.7.46.1.6. Subscription
如果当前登录的用户订阅此服务,则返回订阅(ServiceContract drop
)。
{% if service.subscription %} Your applications for service {{ service.name }} are: {% for app in service.subscription.applications %} {{ app.name }}<br/> {% endfor %} {% else %} <p>You are not subscribed to this.</p> {% endif %}
1.7.46.1.7. 可订阅?
1.7.46.1.8. subscribe_url
1.7.46.1.9. application_plans
返回服务的 已发布 应用计划
{% for service in model.services %} <h4>{{ service.name }} application plans:</h4> <dl> {% for application_plan in service.application_plans %} <dt>{{ application_plan.name }}</dt> <dd>{{ application_plan.system_name }}</dd> {% endfor %} </dl> {% endfor %}
1.7.46.1.10. service_plans
返回服务的 已发布 服务计划
<p>We offer following service plans:</p> <dl> {% for service in model.services %} {% for service_plan in service.service_plans %} <dt>{{ service_plan.name }}</dt> <dd>{{ service_plan.system_name }}</dd> {% endfor %} {% endfor %} </dl>
1.7.46.1.11. 计划
返回服务的应用计划
1.7.46.1.12. 功能
返回服务的可见功能
{% if service.features.size > 0 %} <p>{{ service.name }} has following features:</p> <ul> {% for feature in service.features %} <li>{{ feature.name }}</li> {% endfor %} </ul> {% else %} <p>Unfortunately, {{ service.name }} currently has no features.</p> {% endif %}
1.7.46.1.13. apps_identifier
根据设置的身份验证模式,返回用于 OAuth 身份验证的 'ID'、'API 密钥' 或 'Client ID'。
{{ service.application_key_name }}
1.7.46.1.14. backend_version
1.7.46.1.15. referrer_filters_required?
1.7.46.1.16. metrics
返回服务指标
<p>On {{ service.name }} we measure following metrics:</p> <ul> {% for metric in service.metrics %} <li>{{ metric.name }}</li> {% endfor %} </ul>
1.7.46.1.17. support_email
支持服务电子邮件
1.7.47. ServiceContract drop (启动)
1.7.47.1. 方法
1.7.47.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ service_contract.errors.name | inline_errors }}
1.7.47.1.2. id
1.7.47.1.3. can_change_plan?
如果可能以任何形式更改,则返回 true
1.7.47.1.4. 试用?
如果合同仍在试用期间,返回真.
注 :如果您更改计划的试用周期长度,则不影响现有合同。
1.7.47.1.5. 生活?
1.7.47.1.6. 状态
有三种可能的状态:
- pending - live - suspended
1.7.47.1.7. remaining_trial_period_days
试用期间仍存在的天数.
1.7.47.1.8. 计划
返回合同计划
1.7.47.1.9. plan_change_permission_name
返回允许操作的名称
1.7.47.1.10. plan_change_permission_warning
返回允许操作的警告消息
1.7.47.1.11. contract
1.7.47.1.12. name
1.7.47.1.13. system_name
1.7.47.1.14. change_plan_url
1.7.47.1.15. service
1.7.47.1.16. 应用程序
1.7.47.1.17. can
公开当前用户对该订阅的特定权限。
{% if subscription.can.change_plan? %} ... {% endif %}
1.7.48. ServicePlan drop (up)
1.7.48.1. 方法
1.7.48.1.1. 已选定?
返回是否选择了计划
{% if plan.selected? %} <p>You will signup to {{ plan.name }}</p> {% endif %}
1.7.48.1.2. 购买?
返回计划是否购买
{% if plan.bought? %} <p>You are on this plan already!</p> {% endif %}
1.7.48.1.3. 功能
返回计划可见的功能
{% if plan == my_free_plan %} <p>These plans are the same.</p> {% else %} <p>These plans are not the same.</p> {% endif %}
1.7.48.1.4. setup_fee
返回计划的设置费用
1.7.48.1.5. name
返回计划名称
<h2>We offer you a new {{ plan.name }} plan!</h2>
1.7.48.1.6. system_name
返回计划的系统名称
{% for plan in available_plans %} {% if plan.system_name == 'my_free_plan' %} <p>You will buy our only free plan!</p> {% endif %} {% endfor %}
1.7.48.1.7. id
返回计划 ID
1.7.48.1.8. 免费?
如果计划 未付款
,则为免费计划。请参见 付费的方法。
{% if plan.free? %} <p>This plan is free of charge.</p> {% else %} <p>Plan costs</p> Setup fee {{ plan.setup_fee }} Flat cost {{ plan.flat_cost }} {% endif %}
1.7.48.1.9. 已付费?
如果计划 具有
非零固定或设置费用或存在一些定价规则,则支付计划
{% if plan.paid? %} <p>this plan is a paid one.</p> {% else %} <p>this plan is a free one.</p> {% endif %}
1.7.48.1.10. approval_required?
返回计划是否需要审批?
{% if plan.approval_required? %} <p>This plan requires approval.</p> {% endif %}
1.7.48.1.11. flat_cost
返回计划的月度固定费用
1.7.48.1.12. service
示例: 使用服务计划丢弃
<p class="notice">The examples for plan drop apply here</p> Service of this plan {{ plan.service.name }}
1.7.49. 时区丢弃 (上线)
1.7.49.1. 方法
1.7.49.1.1. full_name
1.7.49.1.2. to_str
1.7.50. 现在丢弃 (向上)
1.7.50.1. 方法
1.7.50.1.1. 月
返回当前月份(1-12)
1.7.50.1.2. day
返回当月的当前日期(1-31)
1.7.50.1.3. 年
返回当年 示例: 创建动态版权
©{{ today.year }}
1.7.50.1.4. beginning_of_month
当前月开始的返回日期
This month began on {{ today.beginning_of_month | date: '%A' }}
1.7.51. 主题丢弃 (上移)
1.7.51.1. 方法
1.7.51.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ topic.errors.name | inline_errors }}
1.7.51.1.2. title
1.7.51.1.3. kind
1.7.51.1.4. url
1.7.51.1.5. description
1.7.52. 主题丢弃 (上移)
1.7.52.1. 方法
1.7.52.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ topic.errors.name | inline_errors }}
1.7.52.1.2. title
主题的名称。首次发布到线程时提交.
1.7.52.1.3. url
1.7.53. URL drop (向上)
1.7.53.1. 方法
1.7.53.1.1. to_s
1.7.53.1.2. to_str
1.7.53.1.3. title
1.7.53.1.4. current_or_subpath?
如果当前页面的路径与 URL 的路径相同,则为 true,或者它是其 直接子路径 (即,通过 ID 扩展)。例如,对于 {{ urls.outbox }}
,这些设置将返回 true:
- /admin/sent/messages/received
- /admin/sent/messages/received/42
但不是这些:
- /admin/sent/messsages/new
- /admin/sent/messsages/longer/subpath
另请参阅 '#active?', '#current?'。
1.7.53.1.5. 当前情况?
真(如果 URL 路径与当前路径相同)。不考虑参数和其他组件。另请参阅 #active?'
{% assign url = urls.messages_inbox %} <!-- => http://awesome.3scale.net/admin/messages/sent --> <!-- Current page: http://awesome.3scale.net/admin/messages/sent?unread=1 --> {{ url.current? }} => true <!-- Current page: http://awesome.3scale.net/admin/messages --> {{ url.current? }} => false
1.7.53.1.6. 处于活动状态?
真(如果当前页面位于与这个 URL 相同的菜单结构中)。另请参阅 #current?
{% assign url = urls.messages_inbox %} <!-- => http://awesome.3scale.net/admin/messages/sent --> <!-- Current page: http://awesome.3scale.net/admin/messages --> {{ url.active? }} => true <!-- Current page: http://awesome.3scale.net/admin/messages/trash --> {{ url.active? }} => true <!-- Current page: http://awesome.3scale.net/admin/stats --> {{ url.active? }} => false
1.7.54. URL drop (上线)
1.7.54.1. 方法
1.7.54.1.1. provider
1.7.54.1.2. cas_login
<a href="{{ urls.signup }}">signup here</a> <a href="{{ urls.service_subscription }}">subscribe to a service here</a>
1.7.54.1.3. new_application
1.7.54.1.4. 注册
注册页面的 URL。所有用户均可访问.
<a href="{{ urls.signup }}?{{ service_plan | param_filter }}&{{ app_plan | param_filter }}" >Signup Now!</a>
1.7.54.1.5. search
所有搜索请求应发送到的 URL
<form action="{{ urls.search }}" method="get"> </form>
1.7.54.1.6. login
1.7.54.1.7. logout
1.7.54.1.8. forgot_password
1.7.54.1.9. service_subscription
服务订阅页面的 URL。仅针对已登录用户.
<a href="{{ urls.service_subscription }}?{{ service_plan | param_filter }}" > Subscribe to service {{ service.name }} </a>
1.7.54.1.10. compose_message
指向允许开发人员通过内部消息传递系统联系提供程序的页面的 URL。
1.7.54.1.11. messages_outbox
开发人员发送的消息列表的 URL。
1.7.54.1.12. messages_trash
1.7.54.1.13. empty_messages_trash
1.7.54.1.14. credit_card_terms
1.7.54.1.15. credit_card_privacy
1.7.54.1.16. credit_card_refunds
1.7.54.1.17. 用户
1.7.54.1.18. personal_details
如果禁用了用户帐户管理,则 URL 或 Nil。在 Audience & gt; Accounts > Settings > Usage Rules> 下检查 3scale 管理门户中的 Usage Rules。
1.7.54.1.19. access_details
包含 API 密钥和其他身份验证信息的页面。根据身份验证策略的不同而有所不同。
1.7.54.1.20. payment_details
1.7.54.1.21. new_invitation
邀请新用户的页面
1.7.54.1.22. 邀请
所有发送的邀请列表
1.7.54.1.23. Dashboard
1.7.54.1.24. 应用程序
1.7.54.1.25. api_access_details
1.7.54.1.26. services
1.7.54.1.27. messages_inbox
收到的邮件列表的 URL。
1.7.54.1.28. stats
1.7.54.1.29. account_overview
1.7.54.1.30. account_plans
1.7.54.1.31. 发票
1.7.55. 使用限值丢弃 (更新)
示例: 使用用法限制丢弃
You cannot do more than {{ limit.value }} {{ limit.metric.unit }}s per {{ limit.period }}
1.7.55.1. 方法
1.7.55.1.1. 周期
返回用量限制的期间
1.7.55.1.2. 指标
通常会 敲击
,但可以是任何自定义方法。
1.7.55.1.3. value
返回用量限制的值
1.7.56. 用户丢弃 (向上)
<h2>User {{ user.display_name }}</h2> Account {{ user.account.name }} Username {{ user.username }} Email {{ user.email }} Website {{ user.website }}
1.7.56.1. 方法
1.7.56.1.1. 错误
如果在提交失败后呈现此模型,这将返回发生的错误。
{{ user.errors.name | inline_errors }}
1.7.56.1.2. 管理员?
返回用户是否为 admin。
{% if user.admin? %} <p>You are an admin of your account.</p> {% endif %}
1.7.56.1.3. username
返回用户的用户名 html escaped。
1.7.56.1.4. 帐户
返回用户的帐户。
1.7.56.1.5. name
返回用户的第一个和姓氏.
1.7.56.1.6. email
返回用户的电子邮件。
1.7.56.1.7. password_required?
对于通过 Janrain、CAS 或其他单点登录方法进行身份验证的用户 ,
此方法将使用内置开发人员门户身份验证机制返回 真
。
{% if user.password_required? %} {% endif %}
1.7.56.1.8. 部分
返回用户有权访问的部分列表。
{% if user.sections.size > 0 %} <p>You can access following sections of our portal:</p> <ul> {% for section in user.sections %} <li>{{ section }}</li> {% endfor %} </ul> {% endif %}
1.7.56.1.9. role
返回用户的角色
1.7.56.1.10. roles_collection
重新调整用户的可用角色列表
{% for role in user.roles_collection %} <li> <label for="user_role_{{ role.key }}"> {{ role.text }} </label> </li> {% endfor %}
1.7.56.1.11. url
返回用户的资源 URL
{{ 'Delete' | delete_button: user.url }}
1.7.56.1.12. edit_url
返回 URL 以编辑用户
{{ 'Edit' | link_to: user.edit_url, title: 'Edit', class: 'action edit' }}
1.7.56.1.13. can
授予权限方法访问权限
{% if user.can.be_managed? %} <!-- do something --> {% endif %}
1.7.56.1.14. extra_fields
返回带有此用户 示例值的非隐藏额外字段:Pri nt all extra 字段
{% for field in user.extra_fields %} {{ field.label }}: {{ field.value }} {% endfor %}
1.7.56.1.15. fields
返回所有包含此用户 示例值的字段:Pri nt all 字段
{% for field in user.fields %} {{ field.label }}: {{ field.value }} {% endfor %}
1.7.56.1.16. builtin_fields
返回所有带有此用户值的内置字段
1.8. 标签(向上)
1.8.1. 标记 'braintree_customer_form' (向上)
呈现输入 Braintree Blue 支付网关所需数据的表单
1.8.2. 标记 'csrf' (up)
呈现跨站点请求伪造元标签。
示例: 使用 csrf 标签。
<head> {% csrf %} </head>
1.8.3. 标记 'content' (up)
呈现页面的正文.仅在布局内使用。
1.8.4. 标记 'content_for' (up)
1.8.5. 标记 'debug' (up)
将模板中所有可用的变量打印到 HTML 注释中。 我们建议从公共模板 中删除此标签。
`{% debug:help %}`
1.8.6. 标记 'email' (向上)
电子邮件
标签允许您自定义传出电子邮件的标头,且仅在电子邮件模板中可用。
有几个方便的子标签,如 cc
或 subject
(请参见下表),但您也可以使用 标题
子标签为邮件设置任意 SMTP 标头。
子标签 | 描述 | 示例 |
主题 | 动态主题 | {% 主题 = 'Greetings from Example company!' %} |
cc | 碳复制 | {% cc = 'boss@example.com' %} |
bcc | 它们的碳排放 | {% bcc = 'all@example.com' %} |
来自 | 实际发送者 | {% from = 'system@example.com' %} |
回复 | {% 回复 = 'support@example.com' %} | |
标头 | 自定义 SMTP 标头 | {% 标头 'X-SMTP-Group' = 'Important' %} |
do_not_send | 丢弃电子邮件 | {% do_not_send %} |
示例: 条件玻璃碳体复制
{% email %} {% if plan.system_name == 'enterprise' %} {% bcc 'marketing@world-domination.org' %} {% endif%} {% endemail %}
示例: 完全禁用电子邮件
{% email %} {% do_not_send %} {% endemail %}
示例: 注册电子邮件过滤器
{% email %} {% if plan.system == 'enterprise' %} {% subject = 'Greetings from Example company!' %} {% reply-to = 'support@example.com' %} {% else %} {% do_not_send %} {% endif %} {% endemail %}
1.8.7. 标记 'flash' (向上)
呈现系统的信息或错误消息.
DEPRECATED :此标签已弃用,改为使用 FlashDrop。
示例: 使用闪存标签。
{% flash %}
1.8.8. 标记"页脚" (向上)
呈现页脚 html 代码片段.
DEPRECATED :此标签已弃用。而是使用开发人员门户部分。
1.8.9. 标签"格式" (向上)
根据表单的名称,呈现带有指定操作和类属性的格式标签。支持的表单有:
表单 | 允许的字段名称 | 垃圾邮件保护 | 备注 |
application.create |
| 否 | |
application.update |
| 否 | |
注册 |
| 是 |
通过添加一个或多个带有名称 |
示例: 创建应用程序的表单
{% form 'application.create', application %} {{ application.errors.name | inline_errors }} {% endform %}
1.8.10. 标签 'latest_forum_posts' (up)
包含最新论坛文章的 HTML 表。
DEPRECATED :改为使用 论坛
丢弃.
示例: 使用 latest_forum_posts 标签。
{% latest_forum_posts %}
1.8.11. 标记 'latest_messages' (up)
呈现包含用户最新消息的 HTML 代码片段。
示例: 使用 latest_messages 标签组合
{% latest_messages %}
1.8.12. 标记 'logo' (向上)
呈现徽标.
DEPRECATED :此标签已弃用,改为使用 {{ provider.logo_url }}。
示例: 在移动中使用菜单标签
{% logo %}
1.8.13. 标记"菜单" (向上)
DEPRECATED :此标签已弃用,改为使用 '{% include "menu" %}'。
1.8.14. 标记"oldfooter" (向上)
呈现页脚 html 代码片段.
DEPRECATED :此标签已弃用。而是使用开发人员门户部分。
1.8.15. 标记 'plan_widget' (up)
包含一个用于检查或更改应用程序计划的小部件
{% if application.can_change_plan? %} <a href="#choose-plan-{{ application.id }}" id="choose-plan-{{application.id}}"> Review/Change </a> {% plan_widget application %} {% endif %}
1.8.16. 标记 'portlet' (向上)
此标签包含按系统名称的 portlet。
1.8.17. 标记"子菜单" (向上)
为登录的用户呈现子菜单 html 代码片段.
DEPRECATED :此标签已弃用,改为使用"子菜单"部分
示例: 在移动中使用子菜单标签
{% submenu %}
1.8.18. 标签 '3scale_essentials' (up)
1.8.19. 标记 'user_widget' (up)
呈现用户小部件 html 代码段.
DEPRECATED :此标签已弃用。而是使用开发人员门户部分。
示例: 在一组中使用 user_widget 标签
{% user_widget %} <p class="notice">If you are logged in you see profile related links above.</p> <p class="notice">If you are not login you are invited to login or signup.</p>
1.9. 过滤器(向上)
1.9.1. FormHelpers 过滤器 (上部)
1.9.1.1. error_class filter
如果参数不是空 的示例,则输出错误类: 使用 error_class 显示输出错误类
1.9.1.2. inline_errors filter
输出段落示例中的错误字段 : 使用 inline_errors 显示内联错误
{{ form.errors.description | inline_errors }}
1.9.2. ParamFilter 过滤器 (上线)
1.9.2.1. to_param filter
将提供的 drop(如果可能)转换为 URL 参数。示例: 使用 to_param 过滤器进行改变
<h2>Signup to a service</h2> <a href="{{ urls.signup }}?{{ service | to_param }}">Signup to {{ service.name }}</a>
1.9.3. 常用过滤器 (up)
1.9.3.1. group_by 过滤器
按一些关键 示例分组集合: 按服务分组应用程序
{% assign grouped = applications | group_by: 'service' %} {% for group in grouped %} Service: {{ group[0 }} {% for app in group[1] %} Application: {{ app.name }} {% endfor %} {% endfor %}
1.9.3.2. 任何过滤器
如果集合中的任何字符串等于参数 示例: 当前帐户是否有任何待处理应用程序?
{% assign has_pending_apps = current_account.applications | map: 'state' | any: 'live' %}
1.9.3.3. stylesheet_link_tag filter
样式表链接
1.9.3.4. javascript_include_tag filter
JavaScript 包含标签
1.9.3.5. image_tag filter
使用 参数输出标签作为其 src
属性。
{{ 'http://example.com/cool.gif' | image_tag }} ## =>
1.9.3.6. mail_to 过滤器
将电子邮件地址转换为"邮箱"链接.
{{ 'me@there.is' | mail_to }} ## => <a href="mailto:me@there.is">me@there.is</a>
1.9.3.7. html_safe filter
将内容标记为 HTML 安全,以免内容被转义。
1.9.3.8. 复数过滤器
将单词转换为复数形式
1.9.3.9. delete_button filter
生成按钮以删除 URL 上存在的资源。第一个参数是 URL,第二个是标题。您还可以添加更多 HTML 标签属性作为第三个参数。
{{ 'Delete Message' | delete_button: message.url, class: 'my-button' }}
1.9.3.10. delete_button_ajax filter
生成按钮,以使用 AJAX 删除 URL 上存在的资源。第一个参数是 URL,第二个是标题。
{{ 'Delete Message' | delete_button_ajax: message.url }}
1.9.3.11. update_button filter
生成一个按钮到"更新"(HTTP PUT 请求),某个资源存在于 URL 上。第一个参数是 URL,第二个是标题。您还可以添加更多 HTML 标签属性作为第三个参数。
{{ 'Resend' | update_button: message.url, class: 'my-button' }}
1.9.3.12. create_button filter
生成按钮以创建 URL 上存在的资源。第一个参数是 URL,第二个是标题。
{{ 'Create Message' | create_button: message.url }}
1.9.3.13. create_button_ajax filter
1.9.3.14. regenerate_oauth_secret_button filter
1.9.3.15. link_to filter
从给定文本创建链接
{{ "See your App keys" | link_to:'/my-app-keys' }}