diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..e0d29e1 Binary files /dev/null and b/.DS_Store differ diff --git a/Gemfile b/Gemfile old mode 100644 new mode 100755 diff --git a/Gemfile.lock b/Gemfile.lock old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/app/.DS_Store b/app/.DS_Store new file mode 100755 index 0000000..dc6d923 Binary files /dev/null and b/app/.DS_Store differ diff --git a/app/assets/.DS_Store b/app/assets/.DS_Store new file mode 100755 index 0000000..11a75f5 Binary files /dev/null and b/app/assets/.DS_Store differ diff --git a/app/assets/javascripts/.DS_Store b/app/assets/javascripts/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/app/assets/javascripts/.DS_Store differ diff --git a/app/assets/javascripts/collaborators.coffee b/app/assets/javascripts/collaborators.coffee old mode 100644 new mode 100755 diff --git a/app/assets/javascripts/table.js b/app/assets/javascripts/table.js new file mode 100755 index 0000000..294abea --- /dev/null +++ b/app/assets/javascripts/table.js @@ -0,0 +1,125 @@ +function tableDraw() + {this.span(); + + var props = ""; + var i = 0; + var dummyRows = this.content.length; + var dummyCols = this.content[0].length; + + var dummyCode = '
'+this.content[(i-1)][(k-1)][1]+' | \n';} + } + dummyCode = dummyCode+'
<%= t(".csv_info") %>
- <%= link_to(icon_tag(:file) + "Excelvorlage laden", "/templates/csv-import-template.xlsx", class: "btn") %> + <%= link_to(icon_tag(:file) + t(".csv_template_load"), "/templates/csv-import-template.csv", class: "btn") %>- | - | <%= t "name" %> | -- | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ | + | <%= t "name" %> | ++ | ||||||||||||||
<%= check_box_tag("question_ids[]", question.id, false, class: "questions-table__checkbox") %> | - <%= - if (question.public) - icon_tag("globe") - elsif (question.collaborators.size > 0) - icon_tag("share") - end - %> - | -<%= link_to (question.name||""), question_path(question), class: "questionLink" %> | + <%= + if (question.public) + icon_tag("globe") + elsif (question.collaborators.size > 0) + icon_tag("share") + end + %> + +<%= link_to (question.name||""), question_path(question), class: "questionLink" %> | <% if params[:public] %> - <% if question.user == current_user %> -<%= link_to icon_tag("pencil"), edit_question_path(question), title: t("edit") %> | -<%= link_to icon_tag("minus-sign"), question, - title: t(".delete_question"), confirm: t(".delete_sure"), method: :delete %> | - <% else %> -<%= link_to icon_tag("plus-sign"), add_to_own_question_path(question, format: :json), remote: true, method: :post, class: "add_to_own_link", title: t("questions.show.add_to_own") %> | -- <% end %> + <% if question.user == current_user %> + | <%= link_to icon_tag("pencil"), edit_question_path(question), title: t("edit") %> | +<%= link_to icon_tag("plus-sign"), {:action => 'clone', :id => question.id}, title: t("duplicate") %> | +<%= link_to icon_tag("minus-sign"), question, title: t(".delete_question"), confirm: t(".delete_sure"), method: :delete %> | + <% else %> +<%= link_to icon_tag("plus-sign"), add_to_own_question_path(question, format: :json), remote: true, method: :post, class: "add_to_own_link", title: t("questions.show.add_to_own") %> | ++ <% end %> <% else %> - | <%= link_to icon_tag("pencil"), edit_question_path(question), title: t("edit"), class: "question_edit_link" %> | -<%= link_to icon_tag("minus-sign"), question, - title: t(".delete_question"), confirm: t(".delete_sure"), method: :delete %> | +<%= link_to icon_tag("pencil"), edit_question_path(question), title: t("edit"), class: "question_edit_link" %> | +<%= link_to icon_tag("plus-sign"), {:action => 'clone', :id => question.id}, title: t("duplicate") %> | +<%= link_to icon_tag("minus-sign"), question, + title: t(".delete_question"), confirm: t(".delete_sure"), method: :delete %> | <% end %>
+ <% answer2s.shuffle! %> + <% answer2s.each do |answer2| %> + | <%= answer2 %> | + <% end %> +|
---|---|---|
<%= pair1.answer1 %> | + <% answer2s.each do |answer2| %> + <% percentage = "0%" %> + <% current_answer_pair = survey.answer_pairs.where(answer1: pair1.answer1, answer2: answer2).first %> + <% if survey.total_votes > 0 %> + <% percentage = number_to_percentage(current_answer_pair.votes.to_f / survey.total_votes.to_f * 100.to_f, :precision => 0) %> + <% end %> + <% rowHeightPercentage = number_to_percentage(1.to_f / (1 + answer2s.length).to_f * 100.to_f, :precision => 0) %> + <% if current_answer_pair.correct? %> +
+
+
+
+ <%= percentage %> + |
+ <% else %>
+
+
+
+
+ <%= percentage %> + |
+ <% end %>
+ <% end %>
+
+
|
+
+
|
+
+ <% survey.categories.each do |category| %> + | <%= category.name %> | + <% end %> +|
---|---|---|
<%= sub_word.name %> | + <% survey.categories.each do |category| %> + <% percentage = "0%" %> + <% currently_correct_category = sub_word.category %> + <% if survey.total_votes > 0 %> + <% percentage = number_to_percentage(sub_word.get_votes_for(category.name).to_f / survey.total_votes.to_f * 100.to_f, :precision => 0) %> + <% end %> + <% if category.name == currently_correct_category %> +
+
+
+
+ <%= percentage %> + |
+ <% else %>
+
+
+
+
+ <%= percentage %> + |
+ <% end %>
+ <% end %>
+
+
|
+
+
|
+
+ <%= t "surveys.participate.chosen-match" %>: +
+Position | + <% for index in 1..numberOfOptions %> +<%= index %> | + <% end %> +|
---|---|---|
<%= option.name %> | + <% currentPosition = 1 %> + <% if option.votes == "" %> + <% survey.order_options.each do |opt| %> + <% option.votes = option.votes + "0," %> + <% end %> + <% option.votes = option.votes[0..-2] %> + <% end %> + <% option.votes.split(",").each do |votesForPosition| %> + <% votesForPositionInteger = Integer(votesForPosition) %> + <% percentage = "0%" %> + <% if survey.total_votes > 0 %> + <% percentage = number_to_percentage(votesForPositionInteger.to_f / survey.total_votes.to_f * 100.to_f, :precision => 0) %> + <% end %> + <% rowHeightPercentage = number_to_percentage(1.to_f / (1 + survey.order_options.length).to_f * 100.to_f, :precision => 0) %> + <% if option.position == currentPosition %> +
+
+
+
+ <%= percentage %> + |
+ <% else %>
+
+
+
+
+ <%= percentage %> + |
+ <% end %>
+ <% currentPosition += 1 %>
+ <% end %>
+
<%= t("x_before_y") %> | + + <% if survey.total_votes > 0 %> + <% for position in 1..numberOfOptions %> +<%= survey.order_options.where(position: position).first.name %> | + <% end %> +|
---|---|---|
<%= survey.order_options.where(position: before_position).first.name %> | + <% for after_position in 1..numberOfOptions %> + <% rowHeightPercentage = number_to_percentage(1.to_f / (1 + numberOfOptions).to_f * 100.to_f, :precision => 0) %> + <% if before_position == after_position %> +
+
+
+
+ / + |
+ <% else %>
+ <% percentage = number_to_percentage(survey.relative_option_order_object.get_votes_for(survey.order_options.where(position: before_position).first.name, survey.order_options.where(position: after_position).first.name).to_f / survey.total_votes.to_f * 100.to_f, :precision => 0) %>
+
+
+
+
+ <%= percentage %> + |
+ <% end %>
+ <% end %>
+
<%= t("x_before_y") %> | + + <% if survey.total_votes > 0 %> + <% name_highest_voted_position_map = Hash.new %> + <% survey.order_options.each do |option| %> + <% current_high_score = 0 %> + <% most_voted_position = 0 %> + <% current_index = 0 %> + <% option.votes.split(',').each do |vote_number| %> + <% if current_high_score < vote_number.to_i %> + <% most_voted_position = current_index %> + <% end %> + <% current_index += 1 %> + <% end %> + <% name_highest_voted_position_map[option.name] = most_voted_position %> + <% end %> + <% name_highest_voted_position_map = name_highest_voted_position_map.sort {|a,b| a[1]<=>b[1]} %> + <% name_highest_voted_position_map.each do |name_position| %> +<%= name_position[0] %> | + <% end %> +|
---|---|---|
<%= name_highest_voted_position_map[before_index][0] %> | + <% for after_index in 0..(name_highest_voted_position_map.length-1) %> + <% rowHeightPercentage = number_to_percentage(1.to_f / (1 + survey.order_options.length).to_f * 100.to_f, :precision => 0) %> + <% if before_index == after_index %> +
+
+
+
+ / + |
+ <% else %>
+ <% percentage = number_to_percentage(survey.relative_option_order_object.get_votes_for(name_highest_voted_position_map[before_index][0], name_highest_voted_position_map[after_index][0]).to_f / survey.total_votes.to_f * 100.to_f, :precision => 0) %>
+
+
+
+
+ <%= percentage %> + |
+ <% end %>
+ <% end %>
+
<%= t ".is_text" %>
<% end %> + <% if survey.type == "match" %> +<%= t ".is_match" %>
+ <% end %> + <% if survey.type == "order" %> +<%= t ".is_order" %>
+ <% end %> + <% if survey.type == "category" %> +<%= t ".is_category" %>
+ <% end %> <% if survey.running?(true) %>@@ -54,11 +63,6 @@ <% end %>
<%= t ".options" %>:
@@ -72,42 +76,87 @@