AutoCommit Sam Aug 1 22:03:01 CEST 2015

This commit is contained in:
Andreas Stephanides
2015-08-01 22:03:01 +02:00
parent 2a7ae7c2bf
commit 2b01a87d15
9 changed files with 25 additions and 10 deletions

View File

@@ -7,7 +7,7 @@ if current_user.nil?
else
value=(current_user.id.nil?)? false : choice.answers.where(user_id: current_user.id).count>0
cstyle=(value) ? "true" :"false"
t= link_to(raw("" + choice.html+ (( choice.picture.nil? || choice.picture.to_s.empty?) ? "":image_tag(choice.picture.thumb.url))), answer_survey_question_path(choice.question, params: {survey_question: {selected: [choice.id]}}),class: "choice-"+cstyle )
t= link_to(raw("" + choice.html+ (( choice.picture.nil? || choice.picture.to_s.empty?) ? "":image_tag(choice.picture.thumb.url))), answer_survey_question_path(choice.question, params: {survey_question: {selected: [choice.id]}}),class: "choice-"+cstyle,remote: true )
end
%>

View File

@@ -1,10 +1,11 @@
<%= semantic_form_for @choice do |f| %>
<%= div_tag_for(@choice) do %>
<%= semantic_form_for @choice, remote: true do |f| %>
<%= f.inputs do %>
<%= f.input :text %>
<i id="icon" style="font-size:2em" class="<%= @choice.icon %>"></i><a href="#" id="openselect" onclick=""> Choose Icon</a>
<%= f.input :icon, :input_html=>{:id=>"iconfield"},:as=>:hidden %>
<%= f.input :question %>
<%= f.input :picture, as: :uploader %>
<%= f.hidden_field :picture_cache %>
@@ -45,3 +46,4 @@ $("#openselect").on('click', function(){$('#dialog').dialog('open')});
</p>
</div>
<% end %>

View File

@@ -0,0 +1 @@
$('#<%= @divid %>').replaceWith("<%= escape_javascript(render @survey_choice) %>")

View File

@@ -1 +1 @@
$('#<%= %>').find('ul.choice-list').append("<li><%= escape_javascript(render partial: "form", object:@choice) %></li>")
$('#<%= divid_for @question %>').find('ul.choice-list').append("<li><%= escape_javascript(render partial: "form", object:@choice) %></li>")

View File

@@ -0,0 +1 @@
$('#<%= divid_for(@survey_choice) %>').replaceWith("<%= escape_javascript(render @survey_choice) %>")

View File

@@ -3,15 +3,16 @@
<%= render partial: "survey/questions/answeredquestion", object: question %>
<% end %>
<% else %>
<div class="contentbox" id="<%= divid_for(question)%>" style="">
<div class="contentbox" id ="<%= divid_for(question) %>" style="">
<div class="contentbox">
<b><%= question.title%></b> <%=question.text%></div>
<b><%= question.title%></b> <%=question.text%><%= link_to fa_icon("pencil"), edit_survey_question_path(question) , class: "btn btn-link navbar-btn" , remote: true%></div>
<div class="contentbox">
<ul class="choice-list">
<% question.choices.each do |c| %>
<li><%= render c %></li>
<% end %>
</ul>
<%= link_to "+" , new_survey_choice_path(params:{question_id: question.id}), remote: true%>
</div>
<%= render partial: "survey/questions/answeredquestion", object: question if question.answers.where(user_id: current_user.id).count>0%>