Đi tới nội dung
Trình đơn
Ngôn ngữ, hiện là Tiếng Việt
EnglishGaeilge简体中文Españolहिन्दीPortuguêsবাংলাРусский日本語廣東話Tiếng Việtالعربية

hệ thống thiết kế rastrillo

Tổng quan mọi thứ hệ thống thiết kế cung cấp. Chủ đề: day. Ngôn ngữ: Tiếng Việt.

Biểu mẫu

Mọi điều khiển, ở những trạng thái mà một biểu mẫu thật đặt chúng vào. Mỗi cái nằm trong một rst-box có đệm, vì đó là quy tắc mà các mảnh này mặc định.

Các phần tử giao diện dựng sẵn, nhất quán với nhau, được kết xuất ở phía máy chủ.

Từ vựng của chính framework gọi chúng là partial: ui.Templates() trả về partial, và docs/site/templates.md ghi chúng dưới tên đó. Chữ trên trang này đã đổi; chữ trong mã thì không.

Các liên kết ở đây không hoạt động

Liên kết không hoạt động, mã nguồn mẫu được cung cấp kèm.

Mỗi mẫu bên dưới nằm trong khung riêng của nó.

Nội dung mẫu để tiếng Anh. Phần vỏ mẫu thì được dịch.

field

Nhãn, ô nhập, gợi ý tuỳ chọn, trợ giúp và lỗi. Điều khiển dạng chữ thông thường, có ID rõ ràng.

Trơn

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field><label rst-field-label for="f_bare">Title</label>
<input rst-input type="text" id="f_bare" name="f_bare">
</div></form></section>

Kèm một gợi ý

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field><label rst-field-label for="f_hint">Slug <span rst-field-hint>(lowercase, no spaces)</span></label>
<input rst-input type="text" id="f_hint" name="f_hint">
</div></form></section>

Kèm trợ giúp bên dưới điều khiển

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field><label rst-field-label for="f_help">Email</label>
<input rst-input type="email" id="f_help" name="f_help" autocomplete="email" aria-describedby="f_help-help">
<p rst-field-help id="f_help-help">We only use this to send you replies.</p>
</div></form></section>

Bắt buộc

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field><label rst-field-label for="f_required">Full name</label>
<input rst-input type="text" id="f_required" name="f_required" required>
</div></form></section>

Kèm một lỗi

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field><label rst-field-label for="f_error">Email</label>
<input rst-input type="email" id="f_error" name="f_error" value="grace@" aria-invalid="true" aria-describedby="f_error-error">
<p rst-field-error id="f_error-error" role="alert">That does not look like an email address.</p>
</div></form></section>

Ngắn

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field><label rst-field-label for="f_short">Postcode</label>
<input rst-input="short" type="text" id="f_short" name="f_short" value="D02 XY45">
</div></form></section>

Trường chính

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field><label rst-field-label for="f_primary">Title</label>
<input rst-input="primary" type="text" id="f_primary" name="f_primary" value="Quarterly board meeting">
</div></form></section>

field-text

Một ô nhập chữ có nhãn, id suy ra từ Name. Dấu sao của chỉ báo bắt buộc là aria-hidden; tín hiệu cho máy đọc là thuộc tính required của ô nhập.

Trơn

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field>
  <label rst-field-label for="ft_bare">Title</label>
  <input rst-input id="ft_bare" name="ft_bare" type="text">
</div></form></section>

Kèm một gợi ý

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field>
  <label rst-field-label for="ft_hint">Headline</label>
  <input rst-input id="ft_hint" name="ft_hint" type="text" aria-describedby="ft_hint-hint">
  <small rst-field-hint id="ft_hint-hint">Shown in the list.</small>
</div></form></section>

Bắt buộc

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field>
  <label rst-field-label for="ft_required">Display name <span rst-field-required aria-hidden="true">*</span></label>
  <input rst-input id="ft_required" name="ft_required" type="text" autocomplete="nickname" required>
</div></form></section>

Kèm một lỗi

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field>
  <label rst-field-label for="ft_error">Title</label>
  <input rst-input id="ft_error" name="ft_error" type="text" value="Release notes" aria-invalid="true" aria-describedby="ft_error-error">
  <small rst-field-error id="ft_error-error">A post with that title already exists.</small>
</div></form></section>

Trường chính

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field>
  <label rst-field-label for="ft_primary">What is it?</label>
  <input rst-input="primary" id="ft_primary" name="ft_primary" type="text" value="Quarterly board meeting">
</div></form></section>

Thêm Primary vào trường chính của biểu mẫu, ví dụ tiêu đề hoặc tên, để ô nhập trông nổi bật hơn.

field-textarea

Lớp vỏ của field-text bọc quanh một textarea.

Trơn

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field>
  <label rst-field-label for="ta_bare">Notes</label>
  <textarea rst-textarea id="ta_bare" name="ta_bare" rows="3"></textarea>
</div></form></section>

Kèm một gợi ý

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field>
  <label rst-field-label for="ta_hint">Bio</label>
  <textarea rst-textarea id="ta_hint" name="ta_hint" rows="3" aria-describedby="ta_hint-hint"></textarea>
  <small rst-field-hint id="ta_hint-hint">Shown on your profile.</small>
</div></form></section>

Kèm một lỗi

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field>
  <label rst-field-label for="ta_error">Summary</label>
  <textarea rst-textarea id="ta_error" name="ta_error" rows="3" aria-invalid="true" aria-describedby="ta_error-error">…</textarea>
  <small rst-field-error id="ta_error-error">A summary needs at least twenty characters.</small>
</div></form></section>

Bắt buộc

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field>
  <label rst-field-label for="ta_required">Reason for refund <span rst-field-required aria-hidden="true">*</span></label>
  <textarea rst-textarea id="ta_required" name="ta_required" rows="3" required></textarea>
</div></form></section>

field-select

Lớp vỏ của field bọc quanh một select gốc. Quá mười lựa chọn thì select bật hộp kết hợp có lọc trong select.js; thứ biểu mẫu gửi đi vẫn là select gốc.

Ba lựa chọn: select gốc

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field><label rst-field-label for="sel_few">Role</label>
<select rst-input id="sel_few" name="sel_few"><option value="Admin" selected>Admin</option><option value="Editor">Editor</option><option value="Member">Member</option></select>
</div></form></section>

Mười hai lựa chọn: hộp chọn có lọc

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field><label rst-field-label for="sel_many">City</label>
<select rst-input id="sel_many" name="sel_many" data-rst-select data-rst-select-filter="Nhập để lọc" data-rst-select-results="{n} kết quả" data-rst-select-result-one="1 kết quả" aria-describedby="sel_many-help"><option value="Dublin" selected>Dublin</option><option value="Lisbon">Lisbon</option><option value="Madrid">Madrid</option><option value="Berlin">Berlin</option><option value="Rome">Rome</option><option value="Athens">Athens</option><option value="Helsinki">Helsinki</option><option value="Reykjavík">Reykjavík</option><option value="Warsaw">Warsaw</option><option value="Zagreb">Zagreb</option><option value="Tallinn">Tallinn</option><option value="Valletta">Valletta</option></select>
<p rst-field-help id="sel_many-help">Start typing to filter.</p>
</div></form></section>

Quá mười lựa chọn thì mảnh này bật select.js. Dưới mười thì không: tìm kiếm trong dăm ba mục là đồ trang trí, không phải trợ giúp.

Mười hai lựa chọn, Plain — đã từ chối phần tăng cường

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field><label rst-field-label for="sel_plain">City</label>
<select rst-input id="sel_plain" name="sel_plain"><option value="Dublin" selected>Dublin</option><option value="Lisbon">Lisbon</option><option value="Madrid">Madrid</option><option value="Berlin">Berlin</option><option value="Rome">Rome</option><option value="Athens">Athens</option><option value="Helsinki">Helsinki</option><option value="Reykjavík">Reykjavík</option><option value="Warsaw">Warsaw</option><option value="Zagreb">Zagreb</option><option value="Tallinn">Tallinn</option><option value="Valletta">Valletta</option></select>
</div></form></section>

Bắt buộc, kèm lỗi

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field><label rst-field-label for="sel_error">Role</label>
<select rst-input id="sel_error" name="sel_error" required aria-invalid="true" aria-describedby="sel_error-error"><option value="Admin" selected>Admin</option><option value="Editor">Editor</option><option value="Member">Member</option></select>
<p rst-field-error id="sel_error-error" role="alert">Pick a role for this person.</p>
</div></form></section>

Viết tay, có optgroup

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-field><label rst-field-label for="sel_grouped">Region</label>
<select rst-input id="sel_grouped" name="sel_grouped" data-rst-select data-rst-select-filter="Nhập để lọc" data-rst-select-results="{n} kết quả" data-rst-select-result-one="1 kết quả">
<optgroup label="Europe"><option value="dublin" selected>Dublin</option><option value="lisbon">Lisbon</option><option value="warsaw">Warsaw</option></optgroup>
<optgroup label="Americas"><option value="montreal">Montréal</option><option value="lima">Lima</option><option value="austin">Austin</option></optgroup>
<optgroup label="Asia"><option value="osaka">Osaka</option><option value="hanoi">Hanoi</option><option value="dhaka">Dhaka</option></optgroup>
<optgroup label="Africa"><option value="accra">Accra</option><option value="nairobi">Nairobi</option><option value="tunis">Tunis</option></optgroup>
</select>
</div></form></section>

Options ở đây là một danh sách phẳng, nên các lựa chọn theo nhóm là phần mã do ứng dụng tự viết. select.js dựng các nhóm chứ không bỏ đi; một select viết tay cũng có thể từ chối hẳn phần tăng cường bằng data-rst-select="false".

field-check

Cơ chế bật tắt duy nhất: một hộp kiểm thật khoác vẻ ngoài công tắc, bàn phím và trình đọc màn hình vẫn nguyên vẹn.

Bật

Xem trước
<section rst-box><form rst-form method="post" action="#"><label rst-switch><input type="checkbox" name="notify_on" checked><span rst-switch-track aria-hidden="true"></span> Email me about replies</label></form></section>

Tắt

Xem trước
<section rst-box><form rst-form method="post" action="#"><label rst-switch><input type="checkbox" name="notify_off"><span rst-switch-track aria-hidden="true"></span> Email me about mentions</label></form></section>

Bị vô hiệu

Xem trước
<section rst-box><form rst-form method="post" action="#"><label rst-switch><input type="checkbox" name="notify_disabled" disabled><span rst-switch-track aria-hidden="true"></span> Email me a weekly digest</label></form></section>

choice-field

Thẻ lựa chọn — dạng nhóm nút chọn hoặc hộp kiểm được ưa dùng. Title giữ ngắn; phần giải thích để cho Desc.

Chọn một

Xem trước
<section rst-box><form rst-form method="post" action="#"><fieldset rst-choice><legend>Plan</legend><div rst-choice-cards><label><input type="radio" name="plan" value="free"><span><span rst-choice-title>Free</span><span rst-choice-desc>One project, community support.</span></span></label><label><input type="radio" name="plan" value="pro" checked><span><span rst-choice-title>Pro</span><span rst-choice-desc>Unlimited projects and a support inbox.</span></span></label></div></fieldset></form></section>

Chọn bao nhiêu tùy ý

Xem trước
<section rst-box><form rst-form method="post" action="#"><fieldset rst-choice><legend>Send me</legend><div rst-choice-cards><label><input type="checkbox" name="digest" value="replies" checked><span><span rst-choice-title>Replies</span><span rst-choice-desc>As they happen.</span></span></label><label><input type="checkbox" name="digest" value="weekly"><span><span rst-choice-title>Weekly digest</span><span rst-choice-desc>Monday mornings.</span></span></label></div></fieldset></form></section>

form-foot

Hàng kết thúc của biểu mẫu: một nút gửi chính và một liên kết hủy tùy chọn. Hủy là một liên kết, vì rời khỏi biểu mẫu là chuyển trang.

Lưu và hủy

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-form-foot>
  <button rst-btn="primary" type="submit">Save post</button>
  <a rst-btn href="/posts">Back to posts</a>
</div></form></section>

Chỉ có nút gửi

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-form-foot>
  <button rst-btn="primary" type="submit">Send invitation</button>
</div></form></section>

Nghỉ — nút trước khi có chuyện gì xảy ra

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-form-foot>
  <button rst-btn="primary" type="submit">Publish</button>
  <a rst-btn href="/posts">Back to posts</a>
</div></form></section>

Nút LÀM THAY ĐỔI điều gì đó sẽ có trạng thái đang tải; nút chỉ mở ra điều gì đó — một khối bung, một menu thả xuống, một tab — thì không. rastrillo.js áp dụng quy tắc đó cho mọi nút gửi trong mọi biểu mẫu, không có gì phải bật lên.

Đang xử lý — thứ rastrillo.js viết ra khi biểu mẫu rời đi

Xem trước
<section rst-box><form rst-form method="post" action="#"><div rst-form-foot>
<button rst-btn="primary" type="submit" aria-busy="true" data-idle-label="Publish" disabled><span rst-spin aria-hidden="true"></span>Publishing…</button>
<a rst-btn href="/posts">Back to posts</a>
</div></form></section>

Chỉ nút đã được bấm: mọi nút gửi khác trong biểu mẫu vẫn giữ nguyên name và value của mình, còn bản thân biểu mẫu được chặn khỏi lần gửi thứ hai. data-busy="false" để bỏ quy tắc, đặt trên biểu mẫu hoặc trên một nút; data-busy-label thay phần chữ. Tắt script thì không có gì trong số này xảy ra và biểu mẫu vẫn gửi đúng như trước, nên tính lũy đẳng vẫn là việc của máy chủ.

confirm-form

Hàng hành động của trang xác nhận. Hành động phá hủy có tuyến riêng chứ không phải một hộp thoại, nên chẳng có gì để viết kịch bản.

Hành động phá hủy

Xem trước
<section rst-box><form rst-form-actions method="post" action="/posts/1/delete"><input type="hidden" name="csrf" value="tok-123"><input type="hidden" name="id" value="1"><a rst-btn="ghost" href="/posts/1">Hủy</a><button type="submit" rst-btn="danger">Delete this post</button></form></section>

Trường hợp thường, chữ hủy theo mặc định

Xem trước
<section rst-box><form rst-form-actions method="post" action="/posts/1/publish"><a rst-btn="ghost" href="/posts/1">Hủy</a><button type="submit" rst-btn="primary">Publish</button></form></section>

Không có CancelLabel, nên chữ trên liên kết hủy lấy từ danh mục.