Skip to content

Commit

Permalink
attempt fix refinery#1826 and refactoring quotes (as in image picker)
Browse files Browse the repository at this point in the history
  • Loading branch information
keram committed Sep 15, 2012
1 parent 0b071e6 commit 22f6cff
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 39 deletions.
@@ -1,11 +1,11 @@
<div id='existing_resource_area' class='dialog_area' <%= "style='display:none;'" if @resource.errors.any? %>>
<input type='hidden' name='linked_resource' id='linked_resource' />
<div id='existing_resource_area_content' class='clearfix'>
<div id='pages_list' class='pages_list'>
<ul class='link_list'>
<div id="existing_resource_area" class="dialog_area" <%= 'style="display:none;"'.html_safe if @resource.errors.any? %>>
<input type="hidden" name="linked_resource" id="linked_resource" />
<div id="existing_resource_area_content" class="clearfix">
<div id="pages_list" class="pages_list">
<ul class="link_list">
<% @resources.each do |resource| -%>
<% resource_linked = (resource.url == params[:current_link]) if params[:current_link].present? %>
<li<%= " class='linked'" if resource_linked %>>
<li<%= ' class="linked"'.html_safe if resource_linked %>>
<%= link_to "#{resource.title} (#{resource.file_name})", asset_paths.compute_public_path(resource.url, ''),
:title => t('.link_to_file'),
:rel => resource.title,
Expand Down
28 changes: 14 additions & 14 deletions resources/app/views/refinery/admin/resources/_form.html.erb
@@ -1,12 +1,12 @@
<%= form_for @resource, :url => (@url_override || @resource.new_record? ? refinery.admin_resources_path : refinery.admin_resource_path(@resource)),
:html => { :multipart => true },
:as => "resource" do |f| -%>
<%= form_for @resource, :url => (@url_override || (@resource.persisted? ? refinery.admin_resource_path(@resource) : refinery.admin_resources_path)),
:html => { :multipart => true },
:as => 'resource' do |f| %>
<%= render '/refinery/admin/error_messages',
:object => @resource,
:include_object_name => false %>

<div class='field'>
<div class="field">
<% if action_name =~ /(edit)|(update)/ %>
<%= link_to t('.download_current'), @resource.url,
:title => @resource.title %>
Expand All @@ -18,28 +18,28 @@
<% end %>
</div>
<div class='field' id='maximum_file_size'>
<div class="field" id="maximum_file_size">
<label>
<%= t('.maximum_file_size', :bytes => number_to_human_size(Refinery::Resources.max_file_size)) %>
</label>
</div>
<%= render '/refinery/admin/form_actions', :f => f,
:continue_editing => false,
:hide_cancel => (@app_dialog or action_name == "insert" or from_dialog?),
:hide_cancel => (@app_dialog or action_name == 'insert' or from_dialog?),
:delete_title => t('delete', :scope => 'refinery.admin.resources'),
:delete_confirmation => (t('message', :scope => 'refinery.admin.delete',
:title => @resource.title) if @resource.persisted?) %>
<% if @app_dialog -%>
<input type='hidden' name='app_dialog' value='<%= @app_dialog %>' />
<input type='hidden' name='field' value='<%= @field %>' />
<input type='hidden' name='update_resource' value='<%= @update_resource %>' />
<input type='hidden' name='update_text' value='<%= @update_text %>' />
<input type='hidden' name='thumbnail' value='<%= @thumbnail %>' />
<input type='hidden' name='callback' value='<%= @callback %>' />
<input type='hidden' name='conditions' value='<%= @conditions %>' />
<input type='hidden' name='current_link' value='<%= @current_link %>' />
<input type="hidden" name="app_dialog" value="<%= @app_dialog %>" />
<input type="hidden" name="field" value="<%= @field %>" />
<input type="hidden" name="update_resource" value="<%= @update_resource %>" />
<input type="hidden" name="update_text" value="<%= @update_text %>" />
<input type="hidden" name="thumbnail" value="<%= @thumbnail %>" />
<input type="hidden" name="callback" value="<%= @callback %>" />
<input type="hidden" name="conditions" value="<%= @conditions %>" />
<input type="hidden" name="current_link" value="<%= @current_link %>" />
<% end -%>
<% end -%>
<% content_for :javascripts do %>
Expand Down
@@ -1,8 +1,8 @@
<% if searching? %>
<%= link_to t('cancel_search', :scope => 'refinery.admin.search'), refinery.admin_resources_path, :class => "cancel-search" %>
<%= link_to t('cancel_search', :scope => 'refinery.admin.search'), refinery.admin_resources_path, :class => 'cancel-search' %>
<h2><%= t('results_for_html', :scope => 'refinery.admin.search', :query => h(params[:search])).html_safe %></h2>
<% end %>
<div class='pagination_container'>
<div class="pagination_container">
<% if @resources.any? %>
<%= render 'resources' %>
<% else %>
Expand Down
@@ -1,9 +1,9 @@
<li class='clearfix record <%= cycle("on", "on-hover") %>'>
<span class='title <%= resource.ext.try(:downcase) %>'>
<li class="clearfix record <%= cycle('on', 'on-hover') %>">
<span class="title <%= resource.ext.try(:downcase) %>">
<%= resource.title %><%= ".#{resource.ext}" if resource.ext %>
<span class="preview">- <%= number_to_human_size(resource.size) %></span>
</span>
<span class='actions'>
<span class="actions">
<%= link_to refinery_icon_tag('page_white_put.png'),
resource.url,
:title => t('.download', :size => number_to_human_size(resource.size)) %>
Expand Down
4 changes: 2 additions & 2 deletions resources/app/views/refinery/admin/resources/index.html.erb
@@ -1,6 +1,6 @@
<div id='records' class='files'>
<div id="records" class="files">
<%= render 'records' %>
</div>
<div id='actions'>
<div id="actions">
<%= render 'actions' %>
</div>
24 changes: 12 additions & 12 deletions resources/app/views/refinery/admin/resources/insert.html.erb
@@ -1,30 +1,30 @@
<% user_can_modify_resources = ::Refinery::Plugins.active.names.include?("refinery_files") %>
<div class='clearfix'>
<div id='dialog_menu_left'>
<div class="clearfix">
<div id="dialog_menu_left">
<% if (any_resources = @resources.any?) %>
<span id='existing_resource_radio' class='radio<%= " selected_radio" if @resource.errors.empty? %>'>
<input type='radio' name='resource_type' value='existing_resource' id='resource_type_existing' <%= "checked='true'" if @resource.errors.empty? %> />
<label for='resource_type_existing' class='stripped'>
<span id="existing_resource_radio" class="radio<%= ' selected_radio' if @resource.errors.empty? %>">
<input type="radio" name="resource_type" value="existing_resource" id="resource_type_existing" <%= 'checked="true"'.html_safe if @resource.errors.empty? %> />
<label for="resource_type_existing" class="stripped">
<%= t('.existing') %>
</label>
</span>
<% end %>
<% if user_can_modify_resources %>
<span id='upload_resource_radio' class='radio<%= " selected_radio" if @resource.errors.any? or @resources.empty? %>'>
<input type='radio' name='resource_type' value='upload_resource' id='resource_type_upload' <%= "checked='true'" if @resources.empty? or @resource.errors.any? %> />
<label for='resource_type_upload' class='stripped'>
<span id="upload_resource_radio" class="radio<%= ' selected_radio' if @resource.errors.any? or @resources.empty? %>">
<input type="radio" name="resource_type" value="upload_resource" id="resource_type_upload" <%= 'checked="true"'.html_safe if @resources.empty? or @resource.errors.any? %> />
<label for="resource_type_upload" class="stripped">
<%= t('.new') %>
</label>
</span>
<% end %>
</div>

<div id='dialog_main'>
<div id="dialog_main">
<% if any_resources or user_can_modify_resources %>
<%= render 'existing_resource' if any_resources %>
<% if user_can_modify_resources %>
<div id='upload_resource_area' class='dialog_area' <%= "style='display:none;'" if any_resources and @resource.errors.empty? %>>
<div id="upload_resource_area" class="dialog_area" <%= 'style="display:none;"'.html_safe if any_resources and @resource.errors.empty? %>>
<%= render 'form', :insert => true %>
</div>
<% end %>
Expand All @@ -47,7 +47,7 @@
<% unless user_can_modify_resources %>
link_dialog.init();
<% end %>
resource_picker.init(<%= @callback.present? ? "self.parent.#{@callback}" : "null" %>);
resource_picker.init(<%= @callback.present? ? "self.parent.#{@callback}" : 'null' %>);
});
</script>
<% end %>
<% end %>

0 comments on commit 22f6cff

Please sign in to comment.