Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date question format #92

Merged
merged 5 commits into from
Jan 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ gem 'devise'
gem 'devise_invitable'
gem 'omniauth'
gem 'omniauth-shibboleth'
gem 'cancan'
#rolify for roles
gem 'rolify'
# Gems for repository integration
Expand All @@ -60,6 +61,7 @@ gem 'ledermann-rails-settings'
gem 'sass-rails'
gem 'less-rails' # WE SHOULD PROBABLY USE SASS OR LESS NOT BOTH
gem 'jquery-rails'
gem 'jquery-ui-rails' # USED FOR THE DATEPICKER
gem 'twitter-bootstrap-rails', '2.2.8'
gem 'tinymce-rails' # WYSIWYG EDITOR
gem 'contact_us', '>= 1.2.0' # COULD BE EASILY REPLACED WITH OUR OWN CODE
Expand Down Expand Up @@ -125,4 +127,3 @@ end
# gem 'email_validator' # UNUSED ACTIVERECORD VALIDATOR
# gem 'validate_url' # UNUSED ACTIVERECORD VALIDATOR
# gem 'turbolinks' # IS NOW A CORE PART OF RAILS >= 4.0

5 changes: 4 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ GEM
thor (~> 0.19)
builder (3.2.2)
byebug (9.0.5)
cancan (1.6.10)
capybara (2.9.1)
addressable
mime-types (>= 1.16)
Expand Down Expand Up @@ -334,6 +335,7 @@ DEPENDENCIES
better_errors
binding_of_caller
byebug
cancan
caracal
caracal-rails
contact_us (>= 1.2.0)
Expand All @@ -346,6 +348,7 @@ DEPENDENCIES
i18n-js (>= 3.0.0.rc11)
jbuilder
jquery-rails
jquery-ui-rails
ledermann-rails-settings
less-rails
libv8
Expand Down Expand Up @@ -382,4 +385,4 @@ RUBY VERSION
ruby 2.2.2p95

BUNDLED WITH
1.13.2
1.13.6
53 changes: 28 additions & 25 deletions app/views/plans/_answer_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
<!--
**Project: DMPRoadmap
**Description: This block sets up the type of question, its guidance.
**Arguments transferred: an instance of "question"
**Arguments transferred: an instance of "question"
**Copyright: Digital Curation Centre and University of California Curation Center
-->
<% answer = @plan.answer(question.id) %>
Expand All @@ -17,16 +17,16 @@
<%= f.input :plan_id, :as => :hidden %>
<%= f.input :user_id, :as => :hidden, :input_html => { :value => current_user.id } %>
<%= f.input :question_id, :as => :hidden, :input_html => { :class => "question_id" } %>

<!-- Question text -->
<!--
<!--
this puts the question inside a label generated by formtastic which does
not display the internal formatting in the question properly
if we just add as 'raw' then it seems ok
<%= label_tag("answer-text-#{question.id}".to_sym, question.text) %>
-->
<%= raw question.text %>

<!--Suggested answer area-->
<% suggested_answer = question.suggested_answers.find_by_organisation_id(@plan.project.organisation_id) %>
<% if !suggested_answer.nil? && suggested_answer.text != "" then %>
Expand All @@ -45,7 +45,7 @@
</div>
</div>
<% end %>

<!-- verify if the question has multiple choice -->
<% if q_format.title == t("helpers.checkbox") || q_format.title == t("helpers.multi_select_box") || q_format.title == t("helpers.radio_buttons") || q_format.title == t("helpers.dropdown") then%>
<% options = question.options.order("number") %>
Expand All @@ -72,13 +72,13 @@
<% if readonly then %>
<%= f.radio_button :option_ids, op.id, :checked => true, disabled: true, id: "answer_option_ids_#{op.id}"%>
<% else %>
<%= f.radio_button :option_ids, op.id, :checked => true, id: "answer_option_ids_#{op.id}"%>
<%= f.radio_button :option_ids, op.id, :checked => true, id: "answer_option_ids_#{op.id}"%>
<% end %>
<%else%>
<% if readonly then %>
<%= f.radio_button :option_ids, op.id, :checked => false, disabled: true, id: "answer_option_ids_#{op.id}"%>
<%= f.radio_button :option_ids, op.id, :checked => false, disabled: true, id: "answer_option_ids_#{op.id}"%>
<% else %>
<%= f.radio_button :option_ids, op.id, :checked => false, id: "answer_option_ids_#{op.id}"%>
<%= f.radio_button :option_ids, op.id, :checked => false, id: "answer_option_ids_#{op.id}"%>
<% end %>
<%end%>
<%= op.text %> </li>
Expand All @@ -100,16 +100,19 @@
<p id="<%#= option.id %>-warning" data-option="<%#= option.id %>"><%#= warning %></p>
<%# end %>
<%# end %> -->

<!-- Comment text area for the multiple choice answers-->
<% if question.option_comment_display == true then%>
<%= label_tag("answer-text-#{question.id}".to_sym, t("helpers.comment")) %>
<%= text_area_tag("answer-text-#{question.id}".to_sym, answer.text, class: "tinymce") %>
<%end%>

<!--text field display-->
<% elsif q_format.title == t("helpers.text_field") then %>
<%= text_field_tag("answer-text-#{question.id}".to_sym, strip_tags(answer.text), class: "question_text_field") %>
<!--date field display-->
<% elsif q_format.title == t("helpers.date") then%>
<%= text_field_tag("answer-text-#{question.id}".to_sym, strip_tags(answer.text), class: "question_date_field") %>
<!--text area display-->
<% elsif q_format.title == t("helpers.text_area") then%>
<%= text_area_tag("answer-text-#{question.id}".to_sym, answer.text, class: "tinymce") %>
Expand All @@ -128,9 +131,9 @@
<% end %>
<% end %>
</div>
<% end %>
<% end %>


<div id="question-readonly-<%= question.id %>" class="question-readonly" <%= if readonly == nil then "style='display:none;'" end %>>
<h4><%= question.text %></h4>
<div class="answer-readonly">
Expand All @@ -150,20 +153,20 @@
</div>
</div>
</div>

<% if answer.created_at.nil? then %>
<span id="<%= question.id %>-status" class="label label-warning answer-status"><%= t("helpers.notanswered") %></span>
<% else %>
<span id="<%= question.id %>-status" class="label label-info answer-status"><%= t("helpers.answered_by")%><abbr class="timeago" data-time="<%= answer.created_at.iso8601 %>" title="<%= answer.created_at.iso8601 %>"><%= answer.created_at %></abbr><%= t("helpers.answered_by_part2")%><%= answer.user.name %></span>
<% end %>
<span id="<%= question.id %>-unsaved" class="label label-inverse answer-unsaved" style="display:none;"><%= t("helpers.unsaved") %></span>

</div>


<!-- Question right column -->
<div class="question-area-right-column">

<div id="right-area-tabs-<%= question.id %>" class="question_right_column_nav">
<% @comments = Comment.where("question_id = ? AND plan_id = ?", question.id, answer.plan_id ) %>
<%= hidden_field_tag :question_id, question.id, :class => "question_id" %>
Expand Down Expand Up @@ -210,12 +213,12 @@
<div class="accordion-heading">
<a class="accordion-guidance-link" data-toggle="collapse" data-parent="#<%= question.id %>-guidance" href="#collapse-guidance-<%= question.id%>">
<div class="accordion_heading_text">
<%= question.section.organisation.abbreviation %>
<%= question.section.organisation.abbreviation %>
<%if question.section.organisation.abbreviation == "EPSRC" then %>
<%= t("helpers.policy_expectations")%>
<%else%>
<%= t("helpers.guidance")%>
<%end%>
<%end%>
</div>
<span class="plus-laranja"> </span></a>
</div>
Expand Down Expand Up @@ -247,19 +250,19 @@
<% end %>
<% end %>
<% end %>


</div>
</div>

<!--comment area -->
<div class="comment-area" id="comment-question-area-<%= question.id %>" style="<%= css_style_comment_div%>">
<%= render :partial => "comments", locals: {questionId: question.id, plan_id: answer.plan_id }%>

</div>



</div>
<!--display or not the break line between questions-->
<% if last_question_id == question.id then %>
Expand Down
Loading