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/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) %> +

+
+<% end %> + + + +<%= link_to 'Edit', small %> diff --git a/app/views/themen/show.html.erb b/app/views/themen/show.html.erb index 31c2c49..936995f 100644 --- a/app/views/themen/show.html.erb +++ b/app/views/themen/show.html.erb @@ -8,3 +8,18 @@ <%= link_to 'Edit', edit_thema_path(@thema) %> | <%= link_to 'Back', themengruppe_path(@thema.themengruppe) %> + +

FAQs:

+<% @thema.fragen.each do |frage| %> +

+ <%= frage.title %>
+<%= raw(frage.text) %> +
+<%= link_to 'Edit', edit_frage_path(frage) %> | +<%= link_to 'Destroy',frage, method: :delete, data: { confirm: 'Are you sure?' } %> + +

+<% end %> +
+ +<%= link_to 'Neue Frage', new_frage_path %> diff --git a/app/views/themengruppen/show.html.erb b/app/views/themengruppen/show.html.erb index d4041ca..8b7258c 100644 --- a/app/views/themengruppen/show.html.erb +++ b/app/views/themengruppen/show.html.erb @@ -25,5 +25,6 @@

+ <%= link_to 'Edit', edit_themengruppe_path(@themengruppe) %> | <%= link_to 'Back', themengruppen_path %>