From 093c2c6a01fe2cfaff72b2624b65896fed339ab5 Mon Sep 17 00:00:00 2001 From: Robert Schilling Date: Wed, 1 Oct 2014 09:10:13 +0200 Subject: [PATCH] Apply ZEN mode to all GFM forms --- CHANGELOG | 1 + app/assets/javascripts/dispatcher.js.coffee | 3 +++ app/assets/stylesheets/generic/gfm.scss | 20 +++++++++++++++++++ app/assets/stylesheets/generic/issuable.scss | 9 --------- app/views/projects/milestones/_form.html.haml | 4 ++-- app/views/projects/wikis/_form.html.haml | 4 ++-- 6 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 app/assets/stylesheets/generic/gfm.scss delete mode 100644 app/assets/stylesheets/generic/issuable.scss diff --git a/CHANGELOG b/CHANGELOG index 2f71891a7ba..996a5bf8697 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -11,6 +11,7 @@ v 7.4.0 - Prevent notes polling when there are not notes - API: Add support for forking a project via the API (Bernhard Kaindl) - API: filter project issues by milestone (Julien Bianchi) + - Zen mode for wiki and milestones (Robert Schilling) v 7.3.2 - Fix creating new file via web editor diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee index 086c09f196e..00b52758fa8 100644 --- a/app/assets/javascripts/dispatcher.js.coffee +++ b/app/assets/javascripts/dispatcher.js.coffee @@ -27,6 +27,8 @@ class Dispatcher new ZenMode() when 'projects:milestones:show' new Milestone() + when 'projects:milestones:new' + new ZenMode() when 'projects:issues:new','projects:issues:edit' GitLab.GfmAutoComplete.setup() shortcut_handler = new ShortcutsNavigation() @@ -87,6 +89,7 @@ class Dispatcher when 'wikis' new Wikis() shortcut_handler = new ShortcutsNavigation() + new ZenMode() when 'snippets', 'labels', 'graphs' shortcut_handler = new ShortcutsNavigation() when 'team_members', 'deploy_keys', 'hooks', 'services', 'protected_branches' diff --git a/app/assets/stylesheets/generic/gfm.scss b/app/assets/stylesheets/generic/gfm.scss new file mode 100644 index 00000000000..e257f053618 --- /dev/null +++ b/app/assets/stylesheets/generic/gfm.scss @@ -0,0 +1,20 @@ +/** + * Styles that apply to all GFM related forms. + */ +.issue-form, .merge-request-form, .wiki-form { + .description { + height: 20em; + } +} + +.wiki-form { + .description { + height: 26em; + } +} + +.milestone-form { + .description { + height: 14em; + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/generic/issuable.scss b/app/assets/stylesheets/generic/issuable.scss deleted file mode 100644 index f456b3ace1a..00000000000 --- a/app/assets/stylesheets/generic/issuable.scss +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Styles that apply to both issues and merge requests. - */ - -.issue-form, .merge-request-form { - .description { - height: 20em; - } -} diff --git a/app/views/projects/milestones/_form.html.haml b/app/views/projects/milestones/_form.html.haml index 27069802d5a..5fb01a11cc5 100644 --- a/app/views/projects/milestones/_form.html.haml +++ b/app/views/projects/milestones/_form.html.haml @@ -5,7 +5,7 @@ %hr -= form_for [@project, @milestone], html: {class: "new_milestone form-horizontal gfm-form"} do |f| += form_for [@project, @milestone], html: {class: 'form-horizontal milestone-form gfm-form'} do |f| -if @milestone.errors.any? .alert.alert-danger %ul @@ -21,7 +21,7 @@ .form-group = f.label :description, "Description", class: "control-label" .col-sm-10 - = f.text_area :description, maxlength: 65535, class: "form-control markdown-area", rows: 10 + = render 'projects/zen', f: f, attr: :description, classes: 'description form-control' .hint .pull-left Milestones are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}. .pull-left Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }. diff --git a/app/views/projects/wikis/_form.html.haml b/app/views/projects/wikis/_form.html.haml index 1e39e4dd774..f37c086716d 100644 --- a/app/views/projects/wikis/_form.html.haml +++ b/app/views/projects/wikis/_form.html.haml @@ -1,4 +1,4 @@ -= form_for [@project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal gfm-form' } do |f| += form_for [@project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal wiki-form gfm-form' } do |f| -if @page.errors.any? #error_explanation .alert.alert-danger @@ -22,7 +22,7 @@ .form-group = f.label :content, class: 'control-label' .col-sm-10 - = f.text_area :content, class: 'form-control js-gfm-input markdown-area', rows: 18 + = render 'projects/zen', f: f, attr: :content, classes: 'description form-control' .col-sm-12.hint .pull-left Wiki content 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' }.