Skip to content

Commit

Permalink
Merge branch 'release-0.4.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacug committed Sep 9, 2020
2 parents ac9c1a1 + 803d8a4 commit 8b2e805
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 57 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
### 0.4.6 (2020-09-09)

**Bug fixes**

* Make users editable even without questionnaire associated (spurious db data)
* Add download PDF text next to the relative icon
* Fix redirect of admin failed submissions on behalf of respondent

### 0.4.5 (2020-06-09)

**Bug fixes**

* Fix documents upload modal not opening up in looping questions
* Fix documents upload modal not opening up in looping questions

### 0.4.4 (2020-05-12)

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/questionnaires_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def submit
redirect_to user_path(current_user)
else
flash[:error] = t('s_details.submission_failure')
redirect_to submission_questionnaire_path(@questionnaire)
redirect_to submission_questionnaire_path(@questionnaire, respondent_id: params[:respondent_id])
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/views/home/_submission.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<td id="pdf_for_<%= questionnaire.id %>">
<% link_text = File.directory?("#{Rails.root}/private/questionnaires/#{questionnaire.id.to_s}/users/#{@user.id}/generating_long_pdf") ? t("user_dashboard.pdf_generating") : nil %>
<% if pdf_file.present? && File.file?(pdf_file.location) -%>
<%= link_to image_tag('icons/page_white_acrobat.png', :alt => t('user_dashboard.pdf_download'), :title => t('user_dashboard.pdf_download')), questionnaire_download_user_pdf_path(questionnaire, current_user) %>
<%= link_to "#{image_tag('icons/page_white_acrobat.png', :alt => t('user_dashboard.pdf_download'), :title => t('user_dashboard.pdf_download'))} Download PDF".html_safe, questionnaire_download_user_pdf_path(questionnaire, current_user) %>
(<%= t("user_dashboard.pdf_last_g")%>: <%= l(File.mtime(pdf_file.location), :format => :with_time).html_safe %>)
&nbsp;
<%= link_to "<span id='link_text_#{questionnaire.id}_'>#{(link_text||t("user_dashboard.pdf_regenerate"))}</span>".html_safe, to_pdf_questionnaire_path(questionnaire), :class => "get" %>
Expand All @@ -46,7 +46,7 @@
<td id="short_pdf_for_<%= questionnaire.id %>">
<% link_text = File.directory?("#{Rails.root}/private/questionnaires/#{questionnaire.id.to_s}/users/#{@user.id}/generating_short_pdf") ? t("user_dashboard.pdf_generating") : nil %>
<% if short_pdf_file.present? && File.file?(short_pdf_file.location) -%>
<%= link_to image_tag('icons/page_white_acrobat.png', :alt => t('user_dashboard.pdf_download'), :title => t('user_dashboard.pdf_download')), questionnaire_download_user_pdf_path(questionnaire, current_user, :params => {:is_short => true}) %>
<%= link_to "#{image_tag('icons/page_white_acrobat.png', :alt => t('user_dashboard.pdf_download'), :title => t('user_dashboard.pdf_download'))} Download PDF".html_safe, questionnaire_download_user_pdf_path(questionnaire, current_user, :params => {:is_short => true}) %>
(<%= t("user_dashboard.pdf_last_g")%>: <%= l(File.mtime(short_pdf_file.location), :format => :with_time) %>)
&nbsp;
<%= link_to "<span id='link_text_#{questionnaire.id}_true'>#{(link_text||t("user_dashboard.pdf_regenerate"))}</span>".html_safe, to_pdf_questionnaire_path(questionnaire, :params => {:is_short => true}), :class => "get" %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/questionnaires/respondents.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<td width="10%">
<% pdf_file = @questionnaire.pdf_files.find_by_user_id_and_is_long(submitter.id, true) -%>
<% if pdf_file.present? && File.file?(pdf_file.location) -%>
<%= link_to image_tag('icons/page_white_acrobat.png', :alt => t('user_dashboard.pdf_download'), :title => t('user_dashboard.pdf_download')), questionnaire_download_user_pdf_path(@questionnaire, submitter) %>
<%= link_to "#{image_tag('icons/page_white_acrobat.png', :alt => t('user_dashboard.pdf_download'), :title => t('user_dashboard.pdf_download'))} Download PDF".html_safe, questionnaire_download_user_pdf_path(@questionnaire, submitter) %>
(<%= t("user_dashboard.pdf_last_g")%>: <%= l(File.mtime(pdf_file.location), :format => :with_time) %>)
&nbsp;
<%= link_to t("user_dashboard.pdf_regenerate"), to_pdf_questionnaire_path(@questionnaire, :params => {:preview => false, :user => submitter}), :class => "get" %>
Expand All @@ -141,7 +141,7 @@
<td width="10%">
<% short_pdf_file = @questionnaire.pdf_files.find_by_user_id_and_is_long(submitter.id, false) -%>
<% if short_pdf_file.present? && File.file?(short_pdf_file.location) -%>
<%= link_to image_tag('icons/page_white_acrobat.png', :alt => t('user_dashboard.pdf_download'), :title => t('user_dashboard.pdf_download')), questionnaire_download_user_pdf_path(@questionnaire, submitter, :params => {:is_short => true}) %>
<%= link_to "#{image_tag('icons/page_white_acrobat.png', :alt => t('user_dashboard.pdf_download'), :title => t('user_dashboard.pdf_download'))} Download PDF".html_safe, questionnaire_download_user_pdf_path(@questionnaire, submitter, :params => {:is_short => true}) %>
(<%= t("user_dashboard.pdf_last_g")%>: <%= l(File.mtime(short_pdf_file.location), :format => :with_time) %>)
&nbsp;
<%= link_to t("user_dashboard.pdf_regenerate"), to_pdf_questionnaire_path(@questionnaire, :params => {:preview => false, :user => submitter, :is_short => true}), :class => "get" %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/user_delegates/_delegated_tasks_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<tbody>
<% @user_delegate.delegations.each do |delegation| %>
<tr>
<td><%= link_to h(delegation.questionnaire.title), submission_questionnaire_path(delegation.questionnaire, user_delegate: @user_delegate.id) %></td>
<td><%= link_to h(delegation.questionnaire.title), submission_questionnaire_path(delegation.questionnaire, user_delegate: @user_delegate.id) if delegation.questionnaire.try(:title).present? %></td>
<td><%=h delegation.remarks %></td>
<td>
<%= link_to "Edit", edit_delegation_path(delegation) %> | <%= link_to t('generic.manage'), delegation_path(delegation) %> | <%= link_to t('generic.remove'), delegation, :method => :delete, :confirm => t('generic.are_you_sure') %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/_existing_delegations.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<% @user.delegated_tasks.each do |delegation| %>
<tr id="row_<%=delegation.id.to_s%>">
<td><%= link_to h(delegation.user.full_name), user_path(delegation.user) %></td>
<td><%= delegation.questionnaire.title %></td>
<td><%= delegation.questionnaire.try(:title) %></td>
<td><%= link_to t('manage'), user_delegate_path(delegation.user_delegate) %></td>
</tr>
<% end %>
Expand Down
84 changes: 38 additions & 46 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -47,61 +47,53 @@
<% end %>
</tbody>
</table>
<!--
<%# @user.available_questionnaires.each do |questionnaire| -%>
<%# questionnaire.filtering_fields.each do |field| -%>
<p><strong><%#= "#{h(field.name)} #{info_tip "Questionnaire", questionnaire.title}"%>: </strong> <%#= @user.get_filtering_field_value(field) %></p>
<%# end -%>
<%# end -%>

-->
<div class="mt-1">
<a style="font-weight:600; font-size:14px" id="toggle_help" href="#">
Filtering fields
</a>
<div id="help_div" style="display: none" class="mt-1">
<table class="user_table">
<thead>
<tr>
<th><%= t("generic.questionnaire") %></th>
<th><%= t("generic.filtering_fields") %></th>
<th><%= t("generic.value") %></th>
</tr>
</thead>
<tbody>
<% @user.available_questionnaires.each do |questionnaire| -%>
<% questionnaire.filtering_fields.each do |field| -%>
<tr>
<td><%= questionnaire.title%></td>
<td><%= h(field.name)%></td>
<td><%= @user.get_filtering_field_value(field) %></td>
</tr>
<% end -%>
<% end -%>
</tbody>
</table>
<div class="respondents-list-delegations">
<div class="page-header">
<h2> Filtering fields </h2>
</div>
<div id="help_div" >
<table class="user_table">
<% unless @user.available_questionnaires.empty? %>
<thead>
<tr>
<th><%= t("generic.questionnaire") %></th>
<th><%= t("generic.filtering_fields") %></th>
<th><%= t("generic.value") %></th>
</tr>
</thead>
<tbody>
<% @user.available_questionnaires.each do |questionnaire| -%>
<% questionnaire.filtering_fields.each do |field| -%>
<tr>
<td><%= questionnaire.title%></td>
<td><%= h(field.name)%></td>
<td><%= @user.get_filtering_field_value(field) %></td>
</tr>
<% end -%>
<% end -%>
<% else %>
<tr><%= "No available questionnaires" %></tr>
</tbody>
<% end %>
</table>
</div>
</div>

<% unless @user.available_questionnaires.empty? %>
<hr />
<div class="span-24 last" id="questionnaires">
<%= render :partial => "home/submission", :locals => {
:questionnaires => @user.available_questionnaires } %>
</div><!-- /questionnaires -->
<% end %>
</div>
<% end %>

<% if @user.is_delegate? %>
<div class='respondents-list-delegations'>
<div class="page-header">
<h2>Delegations</h2>
<% if @user.is_delegate? %>
<div class='respondents-list-delegations'>
<div class="page-header">
<h2>Delegations</h2>
</div>
<%= render 'existing_delegations' %>
</div>
<%= render 'existing_delegations' %>
</div>
<% end %>
<% end %>

</div>



</div><!-- /content -->
6 changes: 3 additions & 3 deletions app/views/users/update_submission_page.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ $(function(){
<%# Check if the long pdf is done or underway%>
<% pdf_file = questionnaire.pdf_files.find_by_user_id_and_is_long(current_user.id, true) %>
<% if pdf_file.present? && File.file?(pdf_file.location) && !File.directory?(base_dir +"generating_long_pdf") -%>
$("#pdf_for_<%= questionnaire.id %>").html("<%= raw(escape_javascript( "#{link_to image_tag('icons/page_white_acrobat.png', :alt => "Download pdf", :title => "Download pdf"), questionnaire_download_user_pdf_path(questionnaire, current_user)}" + "(#{t("user_dashboard.pdf_last_g")}: #{l(File.mtime(pdf_file.location), :format => :with_time) }) #{link_to "<span id='link_text_#{questionnaire.id}_'>#{t("user_dashboard.pdf_regenerate")}</span>".html_safe, to_pdf_questionnaire_path(questionnaire), :class => "get"}"))%>");
$("#pdf_for_<%= questionnaire.id %>").html("<%= raw(escape_javascript( "#{link_to image_tag('icons/page_white_acrobat.png', :alt => "Download pdf", :title => "Download pdf") + 'Download PDF', questionnaire_download_user_pdf_path(questionnaire, current_user)}" + "(#{t("user_dashboard.pdf_last_g")}: #{l(File.mtime(pdf_file.location), :format => :with_time) }) #{link_to "<span id='link_text_#{questionnaire.id}_'>#{t("user_dashboard.pdf_regenerate")}</span>".html_safe, to_pdf_questionnaire_path(questionnaire), :class => "get"}"))%>");
<% end %>
<%# Check if the short pdf is done or underway %>
<% short_pdf_file = questionnaire.pdf_files.find_by_user_id_and_is_long(current_user.id, false) -%>
<% if short_pdf_file.present? && File.file?(short_pdf_file.location) && !File.directory?(base_dir + "generating_short_pdf") -%>
$("#short_pdf_for_<%= questionnaire.id %>")
.html("<%= raw(escape_javascript( "#{link_to image_tag('icons/page_white_acrobat.png', :alt => "Download pdf", :title => "Download pdf"), questionnaire_download_user_pdf_path(questionnaire, current_user, :params => {:is_short => true})}" + "(#{t("user_dashboard.pdf_last_g")}: #{l(File.mtime(short_pdf_file.location), :format => :with_time) }) #{link_to "<span id='link_text_#{questionnaire.id}_true'>#{t("user_dashboard.pdf_regenerate")}</span>".html_safe, to_pdf_questionnaire_path(questionnaire, :params => {:is_short => true }), :class => "get"}"))%>");
.html("<%= raw(escape_javascript( "#{link_to image_tag('icons/page_white_acrobat.png', :alt => "Download pdf", :title => "Download pdf") + 'Download PDF', questionnaire_download_user_pdf_path(questionnaire, current_user, :params => {:is_short => true})}" + "(#{t("user_dashboard.pdf_last_g")}: #{l(File.mtime(short_pdf_file.location), :format => :with_time) }) #{link_to "<span id='link_text_#{questionnaire.id}_true'>#{t("user_dashboard.pdf_regenerate")}</span>".html_safe, to_pdf_questionnaire_path(questionnaire, :params => {:is_short => true }), :class => "get"}"))%>");
<% end %>
<% if File.directory?(base_dir +"generating_short_pdf") || File.directory?(base_dir +"generating_long_pdf") %>
<% set_update_page = true %>
Expand All @@ -21,6 +21,6 @@ $(function(){
<% end -%>

<% if !set_update_page -%>
$("#questionnaires_for_submission").removeClass("set_update_page");
$("#questionnaires_for_submission").removeClass("set_update_page");
<% end -%>
});

0 comments on commit 8b2e805

Please sign in to comment.