forked from refinery/refinerycms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
insert.html.erb
47 lines (44 loc) · 2.06 KB
/
insert.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<% user_can_modify_images = ::Refinery::Plugins.active.names.include?("refinery_images") %>
<div id='dialog_menu_left'>
<% if (any_images = @images.any?) or searching? %>
<span id="existing_image_radio" class="radio<%= " selected_radio" if (no_errors = @image.errors.empty?) %>">
<input type='radio' name='image_type' value='existing_image' id='image_type_existing'<%= " checked='true'" if no_errors or searching? %> />
<label for='image_type_existing' class='stripped'><%= t('.existing_image') %></label>
</span>
<% end %>
<% if user_can_modify_images %>
<span id="upload_image_radio" class="radio<%= " selected_radio" if !no_errors and !any_images %>">
<input type='radio' name='image_type' value='upload_image' id='image_type_upload'<%= " checked='true'" if (!any_images or !no_errors) and !searching? %> />
<label for='image_type_upload' class='stripped'><%= t('.new_image') %></label>
</span>
<% end %>
</div>
<div id='dialog_main'>
<% if any_images or user_can_modify_images %>
<%= render 'existing_image' if any_images or searching? %>
<% if user_can_modify_images %>
<div id='upload_image_area' class='dialog_area'<%= " style='display:none;'" if any_images and (no_errors or searching?) %>>
<%= render 'form', :insert => true %>
</div>
<% end %>
<% else %>
<% flash.now[:error] = t('no_images_yet', :scope => 'refinery.admin.images.records').split('.').first.html_safe + "." %>
<%= render '/refinery/admin/form_actions', :f => nil,
:cancel_url => '',
:hide_cancel => false,
:hide_delete => true,
:hide_submit => true,
:cancel_button_text => t('close', :scope => 'refinery.admin.form_actions'),
:cancel_title => nil %>
<% end %>
</div>
<% content_for :javascripts do %>
<script>
$(document).ready(function(){
new ImageDialog({
callback: <%= @callback.present? ? "self.parent.#{@callback}" : "null" %>,
multiple: <%= @multiple == true %>
}).create();
});
</script>
<% end %>