docbrown/app/views/articles/_v2_form.html.erb
ludwiczakpawel 877bdba176
Typography fix & Optimization (#9650)
* flare tag line height

* .

* dropdown fix + actions bar fix

* actions bar on mob

* fixing typography and improving font handling

* cleanup

* variables naming

* fonts swapping

* Makes user's default font render as SiteConfig.default_font

* Trigger checks

* Fixes missing user model specs

* Fixes storybook CI error import & logged out user font set with default

* Limits default_font config to serif, sans-serif & open-dyslexic

* Default font description text

Co-authored-by: Fernando Valverde <fdov88@gmail.com>
2020-08-18 08:05:51 -04:00

102 lines
4.9 KiB
Text

<style>
body {
padding-top: 0;
}
body > footer,
#top-bar {
display: none
}
.universal-page-content-wrapper {
overflow: unset;
}
</style>
<div id="js-article-form"
data-article="<%= article.to_json(only: %i[id title cached_tag_list published body_markdown main_image organization_id canonical_url updated_at], methods: %i[series all_series]) %>"
data-organizations="<%= organizations&.to_json(only: %i[id name bg_color_hex text_color_hex], methods: [:profile_image_90]) %>"
data-version="<%= version %>"
data-logo-svg='<%= logo_svg %>'>
<form class="crayons-article-form crayons-article-form--<%= version %>">
<div class="crayons-article-form__header">
<a href="/" class="crayons-article-form__logo" aria-label="<%= community_name %> Home"><%= logo_svg %></a>
<div class="crayons-field__label">
<span class="hidden s:inline-block mr-2">Write a new post</span>
<% if organizations && organizations.size > 0 %>
<select name="article[organization_id]" id="article_publish_under_org" class="crayons-select w-auto mt-0">
<%= options_for_select({ "Personal" => "" }.merge(organizations.pluck(:name, :id).to_h), article.organization_id || "") %>
</select>
<% end %>
</div>
<div class="crayons-article-form__tabs crayons-tabs ml-auto">
<button class="crayons-tabs__item crayons-tabs__item--current" type="button">Edit</button><button class="crayons-tabs__item " type="button">Preview</button>
</div>
<div class="crayons-article-form__close">
<a href="/" class="crayons-btn crayons-btn--ghost-dimmed crayons-btn--icon" title="Close the editor">
<%= inline_svg_tag("x.svg", aria: true, class: "crayons-icon", title: "Close") %>
</a>
</div>
</div>
<div class="crayons-card crayons-article-form__content">
<% if version == "v2" %>
<div class="text-padding">
<div class="crayons-article-form__cover" role="presentation">
<% if article.main_image.present? %>
<img src="<%= article.main_image %>" width="250" height="105" alt="Post cover" class="crayons-article-form__cover__image">
<% end %>
<button class="crayons-btn crayons-btn--outlined mr-2">
<label for="cover-image-input">
<% if article.main_image.present? %>Change<% else %>Add a cover image<% end %>
</label>
<input id="cover-image-input" type="file" accept="image/*" class="w-100 h-100 absolute left-0 right-0 top-0 bottom-0 overflow-hidden opacity-0 cursor-pointer" data-max-file-size-mb="25">
</button>
</div>
<div class="crayons-article-form__title">
<textarea class="crayons-textfield crayons-textfield--ghost fs-3xl s:fs-4xl l:fs-5xl fw-bold s:fw-heavy lh-tight" type="text" id="article-form-title" placeholder="New post title here..." autocomplete="off" style="height: 60px; "><%= article.title %></textarea>
</div>
<div class="crayons-article-form__tagsfield">
<input type="text" class="crayons-textfield crayons-textfield--ghost ff-monospace" placeholder="Add up to 4 tags..." name="tags" value="<%= article.cached_tag_list %>" />
</div>
</div>
<% end %>
<div class="crayons-article-form__body text-padding">
<div class="crayons-article-form__toolbar">
<button class="crayons-btn crayons-btn--ghost-dimmed crayons-btn--icon-left fw-normal" type="button">
<%= (inline_svg_tag("image.svg", aria: true, class: "crayons-icon", title: "Image") + "Upload image").delete!("\n").html_safe %>
<input type="file" id="image-upload-field" class="w-100 h-100 absolute left-0 right-0 top-0 bottom-0 overflow-hidden opacity-0 cursor-pointer" multiple accept="image/*" data-max-file-size-mb="25" />
</button>
</div>
<textarea class="crayons-article-form__body__field crayons-textfield crayons-textfield--ghost" id="article_body_markdown" placeholder="Write your post content here..." name="body_markdown"><%= article.body_markdown %></textarea>
</div>
</div>
<div class="crayons-article-form__aside"></div>
<div class="crayons-article-form__aside"></div>
<div class="crayons-article-form__footer">
<button class="crayons-btn mr-2" type="button">Publish</button>
<button class="crayons-btn crayons-btn--secondary mr-2" type="button">Save draft</button>
<div class="relative">
<button class="crayons-btn crayons-btn--ghost crayons-btn--icon" type="button" title="Post options">
<%= inline_svg_tag("cog.svg", aria: true, class: "crayons-icon", title: "Options") %>
</button>
</div>
</div>
</form>
</div>
<div class="hidden">
<%= render "pages/editor_markdown_help" %>
<%= render "pages/editor_liquid_help" %>
<%= render "pages/editor_frontmatter_help" %>
</div>
<script async>
<%== RunkitTag.script %>
</script>