html - Meteor:如何设置用户帐户的样式

标签 html css twitter-bootstrap meteor user-accounts

我正在使用 meteor-useraccounts用于处理用户帐户 - 包括 useraccounts:bootstrap。我的boilerplate直接来自 repo 协议(protocol)。

我的问题: 我不明白要放我自己的 HTML/CSS。

我的 config.js:

// Options
AccountsTemplates.configure({
    defaultLayout: 'emptyLayout',
    showForgotPasswordLink: true,
    overrideLoginErrors: true,
    enablePasswordChange: true,

    showLabels: false,
    showPlaceholders: true,

    negativeValidation: true,
    positiveValidation: true,
    negativeFeedback: true,
    positiveFeedback: true,
});

AccountsTemplates.addFields([
    {
        _id: 'firstName',
        type: 'text',
        placeholder: "First Name",
        required: true,
        re: /^[^\d]{2,}$/i,
        errStr: "Please enter your first name.",
    },
    {
        _id: 'surName',
        type: 'text',
        placeholder: "Sur Name",
        required: true,
        re: /^[^\d]{2,}$/i,
        errStr: "Please enter your first name.",
    },
    {
        _id: 'institution',
        type: 'text',
        placeholder: "Institution/Company",
        required: true,
        re: /^[^\d]{2,}$/i,
        errStr: "Please enter the institution or company you work for.",
    },
    {
        _id: 'position',
        type: 'text',
        placeholder: "Position",
        required: true,
        re: /^[^\d]{2,}$/i,
        errStr: "Please enter the your position in the institution/company.",
    },
]);

我在文档中读到您应该用自己的模板替换原始模板,这就是我对 Template.myAtForm.replaces("atForm"); 和以下模板所做的:

<template name="myAtForm">
  {{#unless hide}}
    <div class="at-form">
      {{#if showTitle}}
        {{> atTitle}}
      {{/if}}
      {{#if showError}}
        {{> atError}}
      {{/if}}
      {{#if showResult}}
        {{> atResult}}
      {{/if}}
      {{#if showOauthServices}}
        {{> atOauth}}
      {{/if}}
      {{#if showServicesSeparator}}
        {{> atSep}}
      {{/if}}
      {{#if showPwdForm}}
        {{> atPwdForm}}
      {{/if}}
      {{#if showTermsLink}}
        {{> atTermsLink}}
      {{/if}}
      {{#if showSignInLink}}
        {{> atSigninLink}}
      {{/if}}
      {{#if showSignUpLink}}
        {{> atSignupLink}}
      {{/if}}
    </div> <!-- end main div -->
  {{/unless}}
</template>

这是给定的线框: enter image description here

例如,我必须在哪里添加 Bootstrap 类,以便我在一行中有两个输入字段(但不是在 WF 中看到的每一行)?或者,我如何设计自己的上传按钮(据我所知甚至没有 type:file)?

带有useraccounts:unstyled 包的事件,我不知道把 HTML/CSS 放在哪里。

非常感谢任何帮助。

最佳答案

回答:最好自己写模板

我确信 useraccounts 做得很好。但它的目标是更简单的用户界面。我想大多数应用程序都对此感到满意。

但是,您可以使用 CSS 设置所有字段的样式。有类添加到您的字段模板(_id 字段)。查看生成的 html 和useraccounts:unstyled 包的源代码。然后你就会清楚它的渲染算法是如何工作的。

但是正如您在原始帖子中提到的,例如没有文件字段。这意味着您必须自己添加模板,并管理文件上传逻辑/验证。

关于html - Meteor:如何设置用户帐户的样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35116329/

相关文章:

html - 如何在 Bootstrap 工具提示中将文本放到换行符上?

html - 强制两个页脚到页面底部

jquery - HTML 高级搜索 - 标题部分

html - 行高小于 1 的标题拦截元素边界外的点击

css - 为工具提示设置不同的属性

javascript - chrome 中的复选框很小且不可点击

html - 使用 Bootstrap 侧导航栏

html - 奇怪的 5px 边距

html - lm_more div为什么越多一个label

html - 悬停时转换 div 时导航弹跳