#236 Documents tagging

This commit is contained in:
Karel Picman 2014-03-19 16:10:24 +01:00
parent bbbc21bf14
commit 7679d149dc
2 changed files with 13 additions and 25 deletions

View File

@ -74,20 +74,6 @@ module DmsfHelper
# of methods - however seems functional. Not sure if MySQL
return obj.to_s.to_time(ActiveRecord::Base.default_timezone) if obj.class.name == 'Mysql::Time'
return obj
end
# Return custom field html tag corresponding to its format
def custom_field_tag_ex(prefix, custom_value, data)
custom_value.custom_field.format.edit_tag self,
custom_field_tag_id(prefix, custom_value.custom_field),
custom_field_tag_name(prefix, custom_value.custom_field),
custom_value,
{:class => "#{custom_value.custom_field.field_format}_cf}"}.merge(data)
end
# Return custom field tag with its label tag
def custom_field_tag_with_label_ex(name, custom_value, options={}, data={})
custom_field_label_tag(name, custom_value, options) + custom_field_tag_ex(name, custom_value, data)
end
end
end

View File

@ -113,12 +113,10 @@
</div>
<% values = @folder ? @folder.custom_field_values : @parent ? @parent.custom_field_values : DmsfFolder.new(:project => @project).custom_field_values %>
<% unless values.empty? %>
<div class="controls" style="float: right">
<%= custom_field_tag_with_label_ex(
<div class="controls" style="float: right">
<%= custom_field_tag_with_label(
:dmsf_folder,
CustomValue.new(:custom_field_id => params[:custom_field_id].present? ? params[:custom_field_id] : values.first.custom_field_id, :value => params[:custom_value]),
{},
:onchange => 'this.form.submit(); return false;') %>
CustomValue.new(:custom_field_id => params[:custom_field_id].present? ? params[:custom_field_id] : values.first.custom_field_id, :value => params[:custom_value])) %>
</div>
<% end %>
<table class="display entries" id="browser">
@ -198,15 +196,19 @@
<% end %>
<script type="text/javascript">
jQuery('#entries_delete_button').click(function() {
$('#entries_delete_button').click(function() {
if(window.confirm("<%= l(:question_do_you_really_want_to_delete_entries) %>")) {
jQuery('#entries_form').attr('action', "<%= url_for(:action => :delete_entries, :id => @project, :folder_id => @folder) %>");
jQuery('#entries_form').submit();
$('#entries_form').attr('action', "<%= url_for(:action => :delete_entries, :id => @project, :folder_id => @folder) %>");
$('#entries_form').submit();
}
});
$('.list_cf').change(function() {
$('#entries_form').submit();
});
jQuery('#check_all_entries').click(function() {
jQuery('input[type=checkbox]', jQuery('#browser > tbody')).prop('checked', this.checked);
$('#check_all_entries').click(function() {
$('input[type=checkbox]', $('#browser > tbody')).prop('checked', this.checked);
});
</script>