diff --git a/app/assets/stylesheets/themengruppen.css.scss b/app/assets/stylesheets/themengruppen.css.scss
index 5ea80bc..5aa1f26 100644
--- a/app/assets/stylesheets/themengruppen.css.scss
+++ b/app/assets/stylesheets/themengruppen.css.scss
@@ -4,8 +4,8 @@
div.themengruppe
{padding:10px;
margin:2px;
-border-radius:10px;
+border-radius: 10px;
min-width:13em;
-border: #91B4FF solid 2px;
+border: #91B4FF solid 0px;
height: 90%
}
diff --git a/app/controllers/fragen_controller.rb b/app/controllers/fragen_controller.rb
index 7f3ac25..d30d79f 100644
--- a/app/controllers/fragen_controller.rb
+++ b/app/controllers/fragen_controller.rb
@@ -27,7 +27,7 @@ class FragenController < ApplicationController
@frage = Frage.new
respond_to do |format|
- format.html # new.html.erb
+ format.html
format.json { render json: @frage }
end
end
@@ -44,7 +44,7 @@ class FragenController < ApplicationController
respond_to do |format|
if @frage.save
- format.html { redirect_to @frage, notice: 'Frage was successfully created.' }
+ format.html { redirect_to @frage.thema, notice: 'Frage was successfully created.' }
format.json { render json: @frage, status: :created, location: @frage }
else
format.html { render action: "new" }
@@ -76,7 +76,7 @@ class FragenController < ApplicationController
@frage.destroy
respond_to do |format|
- format.html { redirect_to fragen_url }
+ format.html { redirect_to @frage.thema }
format.json { head :no_content }
end
end
diff --git a/app/models/frage.rb b/app/models/frage.rb
index 0d26178..0508fc2 100644
--- a/app/models/frage.rb
+++ b/app/models/frage.rb
@@ -1,5 +1,5 @@
class Frage < ActiveRecord::Base
- attr_accessible :text, :title
+ attr_accessible :text, :title, :thema_id
belongs_to :thema
validates :thema, :presence => true
diff --git a/app/models/themengruppe.rb b/app/models/themengruppe.rb
index 034558f..0966914 100644
--- a/app/models/themengruppe.rb
+++ b/app/models/themengruppe.rb
@@ -1,4 +1,5 @@
class Themengruppe < ActiveRecord::Base
+ WORD_COUNT = 50
attr_accessible :text, :title
has_many :themen, class_name: 'Thema'
has_many :fragen, through: :themen
diff --git a/app/views/fragen/_form.html.erb b/app/views/fragen/_form.html.erb
index bd59b87..ce19bc5 100644
--- a/app/views/fragen/_form.html.erb
+++ b/app/views/fragen/_form.html.erb
@@ -1,7 +1,9 @@
+<%= tinymce_assets %>
<%= semantic_form_for @frage do |f| %>
<%= f.inputs do %>
<%= f.input :title %>
- <%= f.input :text %>
+ <%= f.input :thema %>
+ <%= f.input :text, :as=>:tinymce_text%>
<% end %>
<%= f.actions do %>
diff --git a/app/views/fragen/show.html.erb b/app/views/fragen/show.html.erb
index 64cd962..6ba933b 100644
--- a/app/views/fragen/show.html.erb
+++ b/app/views/fragen/show.html.erb
@@ -10,4 +10,4 @@
<%= link_to 'Edit', edit_frage_path(@frage) %> |
-<%= link_to 'Back', fragen_path %>
+<%= link_to 'Back', @frage.thema %>
diff --git a/app/views/themen/_small.html.erb b/app/views/themen/_small.html.erb
index 49205ad..1884d43 100644
--- a/app/views/themen/_small.html.erb
+++ b/app/views/themen/_small.html.erb
@@ -1,3 +1,16 @@
<%= raw(small.text) %>
-<%= link_to 'Edit', edit_thema_path(small) %>
+<%= raw("FAQs:") unless small.fragen.empty? %>
+
+
+<% small.fragen.each do |frage| %>
+
+ <%= frage.title %>
+<%= raw(frage.text) %>
+
+ <%= frage.title %>
+<%= raw(frage.text) %>
+
+<%= link_to 'Edit', edit_frage_path(frage) %> |
+<%= link_to 'Destroy',frage, method: :delete, data: { confirm: 'Are you sure?' } %>
+
+
- <%=themengruppe.text %> + <%= if themengruppe.text.split.size > Themengruppe::WORD_COUNT + themengruppe.text.split[0..Themengruppe::WORD_COUNT].join(" ") + " ..." + else + themengruppe.text + end%>
+- <%= link_to 'Edit', edit_themengruppe_path(themengruppe) %> -
-+ <%= link_to 'Edit', edit_themengruppe_path(themengruppe) %> +
+