From 8a867b72a3322002e1a4924250a6a657656c4bf6 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Fri, 31 Jul 2015 18:03:05 +0200 Subject: [PATCH] AutoCommit Fre Jul 31 18:03:05 CEST 2015 --- app/assets/stylesheets/flatfeticon2.css.scss | 8 +- app/assets/stylesheets/layout.css.scss | 23 ++- app/controllers/survey/choices_controller.rb | 4 +- app/helpers/application_helper.rb | 9 ++ app/models/survey/choice.rb | 6 +- app/views/survey/choices/_choice.html.erb | 8 +- app/views/survey/choices/_form.html.erb | 36 ++++- .../questions/_answeredquestion.html.erb | 2 +- app/views/survey/questions/_question.html.erb | 7 +- app/views/survey/questions/show.html.erb | 15 +- config/flatfeticon2.yml | 134 ++++++++++++++++++ 11 files changed, 221 insertions(+), 31 deletions(-) create mode 100644 config/flatfeticon2.yml diff --git a/app/assets/stylesheets/flatfeticon2.css.scss b/app/assets/stylesheets/flatfeticon2.css.scss index 9f9340e..d7f99ea 100644 --- a/app/assets/stylesheets/flatfeticon2.css.scss +++ b/app/assets/stylesheets/flatfeticon2.css.scss @@ -10,10 +10,10 @@ } [class^="ffi2-"]:before, [class*=" ffi2-"]:before, [class^="ffi2-"]:after, [class*=" ffi2-"]:after { - font-family: ffi2; - font-size: 20px; -font-style: normal; -margin-left: 20px; + font-family: ffi2; + font-size: normal; + font-style: normal; + margin-left: 4px; }.ffi2-accident3:before { content: "\e000"; } diff --git a/app/assets/stylesheets/layout.css.scss b/app/assets/stylesheets/layout.css.scss index ebf98cf..93c48a4 100755 --- a/app/assets/stylesheets/layout.css.scss +++ b/app/assets/stylesheets/layout.css.scss @@ -225,4 +225,25 @@ ul.ui-menu > li > a } a.choice-true -{text-width:bold} \ No newline at end of file +{font-weight: bold;} +a.choice-false +{color:grey} + +ul.choice-list +{list-style-type: none; +margin:0; + +} +ul.choice-list > li +{ +} +ul.choice-list > li > a { + +line-height:normal; +} +ul.choice-list > li > a > i { +font-size:3em; +} +ul.choice-list > li > a.btn > i { +font-size:1em; +} \ No newline at end of file diff --git a/app/controllers/survey/choices_controller.rb b/app/controllers/survey/choices_controller.rb index d43b5c5..52ca750 100644 --- a/app/controllers/survey/choices_controller.rb +++ b/app/controllers/survey/choices_controller.rb @@ -34,7 +34,7 @@ class Survey::ChoicesController < ApplicationController # GET /survey/choices/1/edit def edit - @survey_choice = Survey::Choice.find(params[:id]) + @choice = Survey::Choice.find(params[:id]) end # POST /survey/choices @@ -65,7 +65,7 @@ class Survey::ChoicesController < ApplicationController else format.html { render action: "edit" } format.json { render json: @survey_choice.errors, status: :unprocessable_entity } - end +5 end end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bf8855d..5575d6a 100755 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -45,6 +45,10 @@ m.save def ffi1_icon (name) content_tag("i","", class: "ffi1-"+name ) end + + def ffi2_icon (name) + content_tag("i","", class: "ffi2-"+name ) + end def ff_icon (name) content_tag("i","", class: name ) end @@ -53,6 +57,11 @@ m.save y=YAML.load_file("#{::Rails.root.to_s}/config/flatfeticon1.yml") y["ffi1"] end + def ffi2_list + y=YAML.load_file("#{::Rails.root.to_s}/config/flatfeticon2.yml") + y["ffi2"] + end + def fa_list y=YAML.load_file("#{::Rails.root.to_s}/config/fontawesome.yml") y["fa"] diff --git a/app/models/survey/choice.rb b/app/models/survey/choice.rb index 727cd0a..e27a842 100644 --- a/app/models/survey/choice.rb +++ b/app/models/survey/choice.rb @@ -2,7 +2,11 @@ class Survey::Choice < ActiveRecord::Base belongs_to :question, class_name: 'Survey::Question' attr_accessible :picture, :sort, :text has_many :answers, class_name: 'Survey::Answer' + include ActionView::Helpers::TagHelper def to_s - self.text + self.text + end + def html + content_tag("i","", class: self.picture ) + self.text end end diff --git a/app/views/survey/choices/_choice.html.erb b/app/views/survey/choices/_choice.html.erb index 4ca00cb..0954001 100644 --- a/app/views/survey/choices/_choice.html.erb +++ b/app/views/survey/choices/_choice.html.erb @@ -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" +%> diff --git a/app/views/survey/choices/_form.html.erb b/app/views/survey/choices/_form.html.erb index 865a002..e1abf93 100644 --- a/app/views/survey/choices/_form.html.erb +++ b/app/views/survey/choices/_form.html.erb @@ -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 %> + Choose Icon <%= f.actions do %> <%= f.action :submit, :as => :input %> <% end %> <% end %> + + +
+

+<% ffi1_list.each do |i| %> + <%=ffi1_icon(i)%> + +<% end %> +

+

+<% ffi2_list.each do |i| %> + <%=ffi2_icon(i)%> + +<% end %> +

+ +

+<% fa_list.each do |i| %> + <%=ff_icon('fa '+i)%> + +<% end %> + +

+
diff --git a/app/views/survey/questions/_answeredquestion.html.erb b/app/views/survey/questions/_answeredquestion.html.erb index 14dadc5..f281048 100644 --- a/app/views/survey/questions/_answeredquestion.html.erb +++ b/app/views/survey/questions/_answeredquestion.html.erb @@ -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 }, diff --git a/app/views/survey/questions/_question.html.erb b/app/views/survey/questions/_question.html.erb index 9c05a29..600d648 100644 --- a/app/views/survey/questions/_question.html.erb +++ b/app/views/survey/questions/_question.html.erb @@ -3,9 +3,10 @@ <% else %>
- <%= question.title%>
-
-
    + <%= question.title%> <%=question.text%>
+ +
+
    <% question.choices.each do |c| %>
  • <%= render c %>
  • <% end %> diff --git a/app/views/survey/questions/show.html.erb b/app/views/survey/questions/show.html.erb index c37cd0e..6189355 100644 --- a/app/views/survey/questions/show.html.erb +++ b/app/views/survey/questions/show.html.erb @@ -1,24 +1,11 @@

    <%= notice %>

    - -

    - Title: - <%= @survey_question.title %> -

    - -

    - Text: - <%= @survey_question.text %> -

    -<%= params.to_yaml %> -

    -

    Typ: <%= @survey_question.typ %>

    <%= render @survey_question %> -<% render partial: "answeredquestion", object: @survey_question %> + <%= link_to 'Edit', edit_survey_question_path(@survey_question) %> | <%= link_to 'Back', survey_questions_path %> diff --git a/config/flatfeticon2.yml b/config/flatfeticon2.yml new file mode 100644 index 0000000..4df4f8a --- /dev/null +++ b/config/flatfeticon2.yml @@ -0,0 +1,134 @@ +ffi2: + - accident3 + - alphabet3 + - angel + - angry + - angry2 + - angry23 + - angry40 + - angry41 + - animal203 + - annulled3 + - bandaid + - battery88 + - book97 + - boy11 + - boy12 + - business57 + - camouflage + - car65 + - certificate7 + - checklist4 + - circuit4 + - confused4 + - cpu + - cpu1 + - cry1 + - cry2 + - crying7 + - customerservice10 + - doubt3 + - doubts1 + - drinks48 + - education6 + - election3 + - electronic51 + - emoticon101 + - emoticon82 + - emoticon83 + - emoticon98 + - emoticons11 + - family4 + - fear3 + - first21 + - fright + - furious3 + - graduate2 + - group58 + - handshake3 + - hatchback + - help9 + - house77 + - illness1 + - inadequacy + - incompetence + - indifferent + - kiss3 + - laughing7 + - laughing8 + - lifesaver28 + - lively + - love2 + - mad1 + - man282 + - manager3 + - medical43 + - mobile26 + - moustaches1 + - mute24 + - mute3 + - navigation28 + - nerd6 + - nervous + - owl9 + - palmtrees1 + - panic1 + - pencil32 + - pirate5 + - plus13 + - protection24 + - robot30 + - robotic2 + - rough + - sad34 + - sad35 + - sad37 + - sad38 + - sad39 + - sad74 + - sad75 + - sad77 + - scary + - serious3 + - severe + - silhouette121 + - singing4 + - sleep1 + - sleepness + - sleepy6 + - smile31 + - smile32 + - smile33 + - smiley41 + - smiley42 + - smiling35 + - smiling36 + - solar12 + - spring13 + - square103 + - stars53 + - student12 + - study7 + - stupor + - surprise5 + - surprised + - surprised19 + - surprised21 + - surveillance1 + - suspicions + - sweat1 + - sweating3 + - tears + - telephone45 + - think7 + - timidity + - tongue1 + - tongue2 + - two128 + - two210 + - users53 + - very7 + - wink + - wink9 + - winking9 + - winners1 \ No newline at end of file