From adaec60a5014c0386fa5e9f859d39461e7f6e9fe Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Sat, 20 Sep 2014 15:26:14 +0200 Subject: [PATCH] Factor zen mode. --- app/assets/stylesheets/generic/issuable.scss | 9 +++++++++ app/views/projects/_issuable_form.html.haml | 8 ++------ app/views/projects/_zen.html.haml | 7 +++++++ app/views/projects/merge_requests/_new_submit.html.haml | 8 ++------ app/views/projects/notes/_form.html.haml | 9 ++------- 5 files changed, 22 insertions(+), 19 deletions(-) create mode 100644 app/assets/stylesheets/generic/issuable.scss create mode 100644 app/views/projects/_zen.html.haml diff --git a/app/assets/stylesheets/generic/issuable.scss b/app/assets/stylesheets/generic/issuable.scss new file mode 100644 index 00000000000..f456b3ace1a --- /dev/null +++ b/app/assets/stylesheets/generic/issuable.scss @@ -0,0 +1,9 @@ +/** + * Styles that apply to both issues and merge requests. + */ + +.issue-form, .merge-request-form { + .description { + height: 20em; + } +} diff --git a/app/views/projects/_issuable_form.html.haml b/app/views/projects/_issuable_form.html.haml index 402cdb44182..824460e7fed 100644 --- a/app/views/projects/_issuable_form.html.haml +++ b/app/views/projects/_issuable_form.html.haml @@ -7,12 +7,8 @@ .form-group.issuable-description = f.label :description, 'Description', class: 'control-label' .col-sm-10 - .zennable - %input#zen-toggle-comment{ tabindex: '-1', type: 'checkbox' } - .zen-backdrop - = f.text_area :description, rows: 14, class: 'form-control js-gfm-input markdown-area', placeholder: 'Leave a comment' - %label{ for: 'zen-toggle-comment', class: 'expand' } Edit in fullscreen - %label{ for: 'zen-toggle-comment', class: 'collapse' } + = render 'projects/zen', f: f, attr: :description, + classes: 'description form-control' .col-sm-12.hint .pull-left Parsed with diff --git a/app/views/projects/_zen.html.haml b/app/views/projects/_zen.html.haml new file mode 100644 index 00000000000..2bbc49e8eb5 --- /dev/null +++ b/app/views/projects/_zen.html.haml @@ -0,0 +1,7 @@ +.zennable + %input#zen-toggle-comment{ tabindex: '-1', type: 'checkbox' } + .zen-backdrop + - classes << ' js-gfm-input markdown-area' + = f.text_area attr, class: classes, placeholder: 'Leave a comment' + %label{ for: 'zen-toggle-comment', class: 'expand' } Edit in fullscreen + %label{ for: 'zen-toggle-comment', class: 'collapse' } diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml index 657a77eb758..64fc0160926 100644 --- a/app/views/projects/merge_requests/_new_submit.html.haml +++ b/app/views/projects/merge_requests/_new_submit.html.haml @@ -21,12 +21,8 @@ .form-group .light = f.label :description, "Description" - .zennable - %input#zen-toggle-comment{ tabindex: '-1', type: 'checkbox' } - .zen-backdrop - = f.text_area :description, class: 'form-control js-gfm-input markdown-area', rows: 10, placeholder: 'Leave a comment' - %label{ for: 'zen-toggle-comment', class: 'expand' } Edit in fullscreen - %label{ for: 'zen-toggle-comment', class: 'collapse' } + = render 'projects/zen', f: f, attr: :description, + classes: 'description form-control' .clearfix.hint .pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}. .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }. diff --git a/app/views/projects/notes/_form.html.haml b/app/views/projects/notes/_form.html.haml index 66b79e5026b..65d7f081545 100644 --- a/app/views/projects/notes/_form.html.haml +++ b/app/views/projects/notes/_form.html.haml @@ -14,13 +14,8 @@ Preview %div .note-write-holder - .zennable - %input#zen-toggle-comment{ tabindex: '-1', type: 'checkbox' } - .zen-backdrop - = f.text_area :note, size: 255, class: 'note_text js-note-text js-gfm-input markdown-area', placeholder: 'Leave a comment' - %label{ for: 'zen-toggle-comment', class: 'expand' } Edit in fullscreen - %label{ for: 'zen-toggle-comment', class: 'collapse' } - + = render 'projects/zen', f: f, attr: :note, + classes: 'note_text js-note-text' .light.clearfix .pull-left Comments are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"),{ target: '_blank', tabindex: -1 }} .pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector', tabindex: -1 }.