docx xlsx and pptx file types fixed plus icon provided in edit form for files

This commit is contained in:
harrybomrah authored and saurabhbhatia committed 2013-08-16 15:49:04 +08:00
1 parent a12e538932
commit 6577885761
57 files changed
+63 -18

No files matched your search

@@ -71,13 +71,21 @@
</li>
<li class="s_grid_row">
<%= label_tag("", t("personal_book.author_type"), class: "s_grid_4 s_grid") %>
<% @author_types.each do |author_type| %>
<%= content_tag :label,:class => "s_grid_4 s_grid" do -%>
<%= check_box_tag 'writing_book[book_author_type_ids][]', author_type.id, @personal_book.book_author_type_ids.include?(author_type.id)%>
<%= author_type.title %>
<%= hidden_field_tag 'writing_book[book_author_type_ids][]', '' %>
<div class="s_select_g s_grid s_grid_8 s_grid_h_1">
<ul>
<% @author_types.each_with_index do |author_type, i| %>
<li>
<%= check_box_tag "writing_book[book_author_type_ids][]",
author_type.id,
@personal_book.book_author_type_ids.include?(author_type.id),
id: "field-#{i}"
%><%= label_tag("field-#{i}", author_type.title) %>
</li>
<% end %>
<% end %>
</ul>
</div>
</li>
<!-- <li class="s_grid_row">
@@ -4,7 +4,12 @@
<% if form_file.new_record? %>
<%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %>
<label></label>
<% end %>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %>
</div>
</td>
<% @site_valid_locales.each_with_index do |locale, i| %>
@@ -4,7 +4,12 @@
<% if form_file.new_record? %>
<%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %>
<label></label>
<% end %>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %>
</div>
</td>
<% @site_valid_locales.each_with_index do |locale, i| %>
@@ -76,7 +76,9 @@ module Panel::PersonalJournal::Desktop::JournalPagesHelper
def check_file_type file
if not file.nil?
file_type = MIME::Types.type_for(file).first.to_s.split("/")[1]
x = file.split(/[\s\.]/)
file_type = x[x.length - 1]
file_type = file_type.downcase
file_type = "/assets/ft-icons/#{file_type}/#{file_type}-sm-32_32.png"
else
file_type = ""
@@ -4,7 +4,12 @@
<% if form_file.new_record? %>
<%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %>
<label></label>
<% end %>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %>
</div>
</td>
<% @site_valid_locales.each_with_index do |locale, i| %>
@@ -4,7 +4,12 @@
<% if form_file.new_record? %>
<%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %>
<label></label>
<% end %>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %>
</div>
</td>
<% @site_valid_locales.each_with_index do |locale, i| %>
@@ -2,9 +2,14 @@
<td>
<div>
<% if form_file.new_record? %>
<%= f.file_field :file, class: "s_grid_2", onchange:"this.parentNode.getElementsByTagName('label')[0].innerHTML = this.value" %>
<%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %>
<label></label>
<% end %>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %>
</div>
</td>
<% @site_valid_locales.each_with_index do |locale, i| %>
@@ -13,7 +18,7 @@
<td <%= style %> <%= data %>>
<%= f.fields_for :file_title_translations do |f| %>
<%= f.text_field locale,
class: 's_grid_4',
class: 's_grid_4 title_field',
placeholder: I18nVariable.from_locale(locale),
value: (form_file.file_title_translations[locale] rescue nil) %>
<% end %>
@@ -31,10 +36,10 @@
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<a class="delete"><i class="icon-remove" style="cursor:pointer;"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<a class="remove_existing_record" style="cursor:pointer;"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
<%= form_file.file.file ? ( link_to '', form_file.file.url, {:class => 'icon-eye-open', :target => '_blank', :title => t(:view)} ) : '' %>
@@ -4,7 +4,12 @@
<% if form_file.new_record? %>
<%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %>
<label></label>
<% end %>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %>
</div>
</td>
<% @site_valid_locales.each_with_index do |locale, i| %>
@@ -4,7 +4,12 @@
<% if form_file.new_record? %>
<%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %>
<label></label>
<% end %>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %>
</div>
</td>
<% @site_valid_locales.each_with_index do |locale, i| %>