diff --git a/app/assets/javascripts/markdown_editor.js.coffee b/app/assets/javascripts/markdown_editor.js.coffee index 121f74ce4..1a0510fea 100644 --- a/app/assets/javascripts/markdown_editor.js.coffee +++ b/app/assets/javascripts/markdown_editor.js.coffee @@ -22,9 +22,15 @@ App.MarkdownEditor = $(this).find('.fullscreen-toggle').on 'click', -> $('.markdown-editor').toggleClass('fullscreen') + $('.fullscreen-container').toggleClass('medium-8', 'medium-12') + span = $(this).find('span') + current_html = span.html() + if(current_html == span.data('open-text')) + span.html(span.data('closed-text')) + else + span.html(span.data('open-text')) if $('.markdown-editor').hasClass('fullscreen') $('.markdown-editor textarea').height($(window).height() - 100) else $('.markdown-editor textarea').height("10em") - diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index 8ab9f8e9b..28cd76208 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -411,6 +411,11 @@ table.investment-projects-summary { .markdown-editor { background-color: white; + + .markdown-area, + #markdown-preview { + display: none; + } } .markdown-editor #markdown-preview { @@ -437,7 +442,9 @@ table.investment-projects-summary { // 06. Legislation // -------------- - +.edit_legislation_draft_version .row { + margin-bottom: 2rem; +} .legislation-admin { .menu .active > a { background: none; @@ -595,6 +602,8 @@ table.investment-projects-summary { } .fullscreen-container { + text-align: center; + background: #ccdbe6; .markdown-editor-header, .markdown-editor-buttons { @@ -602,12 +611,7 @@ table.investment-projects-summary { } a { - - @include breakpoint(medium) { - float: right; - } - - line-height: 3rem; + line-height: 8rem; span { text-decoration: none; @@ -656,13 +660,28 @@ table.investment-projects-summary { .fullscreen { + .markdown-area, + #markdown-preview { + display: block; + } + .column { padding: 0; } .fullscreen-container { + text-align: left; background: $admin-color; padding: 0.5rem 1rem; + margin-bottom: 0; + + a { + line-height: 3rem; + + @include breakpoint(medium) { + float: right; + } + } .markdown-editor-header { vertical-align: top; diff --git a/app/views/admin/legislation/draft_versions/_form.html.erb b/app/views/admin/legislation/draft_versions/_form.html.erb index a29a93ea4..36a774f23 100644 --- a/app/views/admin/legislation/draft_versions/_form.html.erb +++ b/app/views/admin/legislation/draft_versions/_form.html.erb @@ -63,20 +63,22 @@ <%= f.label :body %> <%= t('admin.legislation.draft_versions.form.use_markdown') %> -
-
-
Consul | Editando Versión 3 del proceso Licencias urbanísticas, declaraciones
+
+
<%= t('admin.legislation.draft_versions.form.title_html', draft_version_title: @draft_version.title, process_title: @process.title ) %>
-
- <%= f.submit(class: "button", value: t("admin.legislation.draft_versions.#{admin_submit_action(@draft_version)}.submit_button")) %> -
+
+ <%= f.submit(class: "button", value: t("admin.legislation.draft_versions.#{admin_submit_action(@draft_version)}.submit_button")) %> +
<%= link_to "#", class: 'fullscreen-toggle' do %> - <%= t("admin.legislation.draft_versions.form.fullscreen_toggle")%> + " + data-open-text="<%= t("admin.legislation.draft_versions.form.close_text_editor")%>"> + <%= t("admin.legislation.draft_versions.form.launch_text_editor")%> + <% end %>
-
+
<%= f.text_area :body, label: false, placeholder: t('admin.legislation.draft_versions.form.body_placeholder') %>
diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index 1392aa75e..f73e9857e 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -245,7 +245,9 @@ en: form: error: Error form: - fullscreen_toggle: Toggle full screen + title_html: 'Editing %{draft_version_title} from the process %{process_title}' + launch_text_editor: Launch text editor + close_text_editor: Close text editor use_markdown: Use Markdown to format the text hints: final_version: This version will be published as Final Result for this process. Comments won't be allowed in this version. diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index 368b32c2a..cb1643149 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -245,7 +245,9 @@ es: form: error: Error form: - fullscreen_toggle: Pantalla completa + title_html: 'Editando %{draft_version_title} del proceso %{process_title}' + launch_text_editor: Lanzar editor de texto + close_text_editor: Cerrar editor de texto use_markdown: Usa Markdown para formatear el texto hints: final_version: Será la versión que se publique en Publicación de Resultados. Esta versión no se podrá comentar diff --git a/spec/features/admin/legislation/draft_versions_spec.rb b/spec/features/admin/legislation/draft_versions_spec.rb index e1088f24f..439d18d0c 100644 --- a/spec/features/admin/legislation/draft_versions_spec.rb +++ b/spec/features/admin/legislation/draft_versions_spec.rb @@ -86,10 +86,14 @@ feature 'Admin legislation draft versions' do click_link 'Version 1' + click_link 'Launch text editor' + fill_in 'legislation_draft_version_title', with: 'Version 1b' fill_in 'legislation_draft_version_body', with: '# Version 1 body\r\n\r\nParagraph\r\n\r\n>Quote' - click_button 'Save changes' + within('.fullscreen') do + click_button 'Save changes' + end expect(page).to have_content 'Version 1b' end