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

This commit is contained in:
Harry Bomrah 2013-08-16 13:42:22 +08:00 committed by saurabhbhatia
parent a12e538932
commit 6577885761
57 changed files with 63 additions and 18 deletions

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 885 B

After

Width:  |  Height:  |  Size: 885 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 800 B

After

Width:  |  Height:  |  Size: 800 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 225 KiB

After

Width:  |  Height:  |  Size: 225 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 847 B

After

Width:  |  Height:  |  Size: 847 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 765 B

After

Width:  |  Height:  |  Size: 765 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 220 KiB

After

Width:  |  Height:  |  Size: 220 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 875 B

After

Width:  |  Height:  |  Size: 875 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 781 B

After

Width:  |  Height:  |  Size: 781 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 224 KiB

After

Width:  |  Height:  |  Size: 224 KiB

View File

@ -71,13 +71,21 @@
</li> </li>
<li class="s_grid_row"> <li class="s_grid_row">
<%= label_tag("", t("personal_book.author_type"), class: "s_grid_4 s_grid") %> <%= 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 -%> <div class="s_select_g s_grid s_grid_8 s_grid_h_1">
<%= 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 %> <ul>
<%= hidden_field_tag 'writing_book[book_author_type_ids][]', '' %> <% @author_types.each_with_index do |author_type, i| %>
<% end %> <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>
<!-- <li class="s_grid_row"> <!-- <li class="s_grid_row">

View File

@ -4,6 +4,11 @@
<% if form_file.new_record? %> <% 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;" %> <%= 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> <label></label>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %> <% end %>
</div> </div>
</td> </td>

View File

@ -4,6 +4,11 @@
<% if form_file.new_record? %> <% 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;" %> <%= 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> <label></label>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %> <% end %>
</div> </div>
</td> </td>

View File

@ -76,7 +76,9 @@ module Panel::PersonalJournal::Desktop::JournalPagesHelper
def check_file_type file def check_file_type file
if not file.nil? 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" file_type = "/assets/ft-icons/#{file_type}/#{file_type}-sm-32_32.png"
else else
file_type = "" file_type = ""

View File

@ -4,6 +4,11 @@
<% if form_file.new_record? %> <% 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;" %> <%= 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> <label></label>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %> <% end %>
</div> </div>
</td> </td>

View File

@ -4,6 +4,11 @@
<% if form_file.new_record? %> <% 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;" %> <%= 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> <label></label>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %> <% end %>
</div> </div>
</td> </td>

View File

@ -2,8 +2,13 @@
<td> <td>
<div> <div>
<% if form_file.new_record? %> <% 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> <label></label>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %> <% end %>
</div> </div>
</td> </td>
@ -13,7 +18,7 @@
<td <%= style %> <%= data %>> <td <%= style %> <%= data %>>
<%= f.fields_for :file_title_translations do |f| %> <%= f.fields_for :file_title_translations do |f| %>
<%= f.text_field locale, <%= f.text_field locale,
class: 's_grid_4', class: 's_grid_4 title_field',
placeholder: I18nVariable.from_locale(locale), placeholder: I18nVariable.from_locale(locale),
value: (form_file.file_title_translations[locale] rescue nil) %> value: (form_file.file_title_translations[locale] rescue nil) %>
<% end %> <% end %>
@ -31,10 +36,10 @@
<td> <td>
<span class="action"> <span class="action">
<% if form_file.new_record? %> <% 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 %> <% else %>
<%= f.hidden_field :id %> <%= 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' %> <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %> <% end %>
<%= form_file.file.file ? ( link_to '', form_file.file.url, {:class => 'icon-eye-open', :target => '_blank', :title => t(:view)} ) : '' %> <%= form_file.file.file ? ( link_to '', form_file.file.url, {:class => 'icon-eye-open', :target => '_blank', :title => t(:view)} ) : '' %>

View File

@ -4,6 +4,11 @@
<% if form_file.new_record? %> <% 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;" %> <%= 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> <label></label>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %> <% end %>
</div> </div>
</td> </td>

View File

@ -4,6 +4,11 @@
<% if form_file.new_record? %> <% 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;" %> <%= 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> <label></label>
<% else %>
<%= link_to(image_tag(check_file_type(form_file.file.url)),
:class => "file",
"target" => "_blank",
"title" => form_file.title) %>
<% end %> <% end %>
</div> </div>
</td> </td>