AutoCommit Fre Jul 31 18:03:05 CEST 2015

This commit is contained in:
Andreas Stephanides
2015-07-31 18:03:05 +02:00
parent 02b3a651ca
commit 8a867b72a3
11 changed files with 221 additions and 31 deletions

View File

@@ -4,9 +4,11 @@ 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 ((value)? fa_icon("arrow-right"): "")+choice.text, answer_survey_question_path(choice.question, class: "choice-"+cstyle, params: {survey_question: {selected: [choice.id]}})
t= link_to raw("" + choice.html), answer_survey_question_path(choice.question, params: {survey_question: {selected: [choice.id]}}),class: "choice-"+cstyle
end
%>
<%= t %>
<%= ff_icon("ffi2-boy12") %>
<%= t %> <%= link_to fa_icon("pencil"), edit_survey_choice_path(choice) , class: "btn btn-link navbar-btn"
%>

View File

@@ -1,12 +1,44 @@
<%= semantic_form_for @choice do |f| %>
<%= f.inputs do %>
<%= f.input :text %>
<%= f.input :question %>
<%= f.input :sort %>
<%= f.input :picture %>
<%= f.input :picture, :input_html=>{:id=>"iconfield"} %>
<% end %>
<i id="icon" style="font-size:2em" class="<%= @choice.picture %>"></i><a href="#" id="openselect" onclick=""> Choose Icon</a>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>
<script>
$(
function()
{$('#iconfield').on('change', function(){$('#icon').attr("class",$(this).val())});
$("#dialog").dialog({width:'100%', position:'center top', at:'left top',autoOpen: false,closeOnEscape: false});
$("#openselect").on('click', function(){$('#dialog').dialog('open')});
});
</script>
<div style="font-size:2em; line-height:1.2em" id ="dialog" title="Icon">
<p>
<% ffi1_list.each do |i| %>
<a onclick="$('#iconfield').val('ffi1-<%= i %>');$('#icon').attr('class','ffi1-<%= i %>'); $('#dialog').dialog('close')" href="#"><%=ffi1_icon(i)%>
</a>
<% end %>
</p>
<p>
<% ffi2_list.each do |i| %>
<a onclick="$('#iconfield').val('ffi2-<%= i %>');$('#icon').attr('class','ffi2-<%= i %>'); $('#dialog').dialog('close')" href="#"><%=ffi2_icon(i)%>
</a>
<% end %>
</p>
<p>
<% fa_list.each do |i| %>
<a onclick="$('#iconfield').val('fa <%= i %>');$('#icon').attr('class','fa <%= i %>'); $('#dialog').dialog('close')" href="#"><%=ff_icon('fa '+i)%>
</a>
<% end %>
</p>
</div>

View File

@@ -24,7 +24,7 @@ $(function () {
text: '<%= answeredquestion.text %>'
},
xAxis: {
categories: [<%= raw(answeredquestion.choices.map{|c| "'"+escape_javascript(ff_icon("ffi1-good2"))+c.text+"'"}.join(",")) %>],
categories: [<%= raw(answeredquestion.choices.map{|c| "'"+escape_javascript(c.html)+"'"}.join(",")) %>],
title: {
text: null
},

View File

@@ -3,9 +3,10 @@
<% else %>
<div class="contentbox" style="background: grey">
<div class="contentbox">
<b><%= question.title%></b></div>
<div class="contentbox">
<ul>
<b><%= question.title%></b> <%=question.text%></div>
<div class="contentbox">
<ul class="choice-list">
<% question.choices.each do |c| %>
<li><%= render c %></li>
<% end %>

View File

@@ -1,24 +1,11 @@
<p id="notice"><%= notice %></p>
<p>
<b>Title:</b>
<%= @survey_question.title %>
</p>
<p>
<b>Text:</b>
<%= @survey_question.text %>
</p><p>
<%= params.to_yaml %>
</p>
<p>
<b>Typ:</b>
<%= @survey_question.typ %>
</p>
<%= render @survey_question %>
<% render partial: "answeredquestion", object: @survey_question %>
<%= link_to 'Edit', edit_survey_question_path(@survey_question) %> |
<%= link_to 'Back', survey_questions_path %>