Files
grecia/app/views/admin/site_customization/pages/_form.html.erb
Javi Martín 6f96265a0b Bring back CKEditor images button
It was accidentally deleted in commit 914bfa6.

Note the following spec passes on my machine if we add a `sleep 0.1`
call in the `:wait_readable` part of ruby's `Net::Protocol#rbuf_fill`.
Otherwise, it hangs forever after clicking the `.fileupload-file` div,
which closes its window. It might be solved when upgrading rails,
capybara, selenium or chromedriver.

scenario "Allows images in CKEditor", :js do
  visit edit_admin_site_customization_page_path(custom_page)

  within(".ckeditor") do
    within_frame(0) { expect(page).not_to have_css("img") }

    expect(page).to have_css(".cke_toolbar .cke_button__image_icon")
    find(".cke_toolbar .cke_button__image_icon").click
  end

  within_window(window_opened_by { click_link "Browse Server" }) do
    attach_file :file,
                Rails.root.join('spec/fixtures/files/clippy.jpg'),
                visible: false
    find(".fileupload-file").click
  end

  click_link "OK"

  within(".ckeditor") do
    within_frame(0) { expect(page).to have_css("img") }
  end
end
2018-10-17 19:39:37 +02:00

52 lines
1.8 KiB
Plaintext

<%= render "admin/shared/globalize_locales", resource: @page %>
<%= translatable_form_for [:admin, @page], html: {class: "edit_page", data: {watch_changes: true}} do |f| %>
<% if @page.errors.any? %>
<div id="error_explanation" data-alert class="callout alert" data-closable>
<button class="close-button" aria-label="<%= t("application.close") %>" type="button" data-close>
<span aria-hidden="true">&times;</span>
</button>
<strong>
<%= @page.errors.count %>
<%= t("admin.site_customization.pages.errors.form.error", count: @page.errors.count) %>
</strong>
</div>
<% end %>
<div class="small-12 column">
<hr>
</div>
<div class="small-12 medium-5 column">
<h3><%= t("admin.site_customization.pages.form.options") %></h3>
<%= f.check_box :more_info_flag, class: "small" %>
<%= f.check_box :print_content_flag %>
</div>
<div class="small-12 medium-3 column">
<%= f.label :status %>
<% ::SiteCustomization::Page::VALID_STATUSES.each do |status| %>
<%= f.radio_button :status, status, label: false %>
<%= f.label "status_#{status}", t("admin.site_customization.pages.page.status_#{status}") %>
<br>
<% end %>
</div>
<div class="small-12 medium-4 column">
<%= f.label :slug %>
<%= f.text_field :slug, label: false, size: 80, maxlength: 80 %>
</div>
<div class="small-12 column">
<hr>
<%= f.translatable_text_field :title %>
<%= f.translatable_text_field :subtitle %>
<div class="ckeditor">
<%= f.translatable_cktext_area :content,
ckeditor: { language: I18n.locale, toolbar: "admin" } %>
</div>
<div class="small-12 medium-6 large-3 margin-top">
<%= f.submit class: "button success expanded" %>
</div>
</div>
<% end %>