ADD: Informationsseite:
Models für Themengruppen/Themen/FAQs/Attachments Views für Themengruppen/Themen
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
# Place all the behaviors and hooks related to the matching controller here.
|
|
||||||
# All this logic will automatically be available in application.js.
|
|
||||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
||||||
@@ -1,3 +1,11 @@
|
|||||||
// Place all the styles related to the themengruppen controller here.
|
// Place all the styles related to the themengruppen controller here.
|
||||||
// They will automatically be included in application.css.
|
// They will automatically be included in application.css.
|
||||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
|
div.themengruppe
|
||||||
|
{padding:10px;
|
||||||
|
margin:2px;
|
||||||
|
border-radius:10px;
|
||||||
|
min-width:13em;
|
||||||
|
border: #91B4FF solid 2px;
|
||||||
|
height: 90%
|
||||||
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class ThemenController < ApplicationController
|
|||||||
# GET /themen/new.json
|
# GET /themen/new.json
|
||||||
def new
|
def new
|
||||||
@thema = Thema.new
|
@thema = Thema.new
|
||||||
|
@thema.themengruppe = Themengruppe.find(params[:themengruppe_id]) unless params[:themengruppe_id].nil?
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # new.html.erb
|
format.html # new.html.erb
|
||||||
format.json { render json: @thema }
|
format.json { render json: @thema }
|
||||||
|
|||||||
@@ -13,42 +13,42 @@ class ThemengruppenController < ApplicationController
|
|||||||
# GET /themengruppen/1
|
# GET /themengruppen/1
|
||||||
# GET /themengruppen/1.json
|
# GET /themengruppen/1.json
|
||||||
def show
|
def show
|
||||||
@themagruppen = Themengruppe.find(params[:id])
|
@themengruppe = Themengruppe.find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # show.html.erb
|
format.html # show.html.erb
|
||||||
format.json { render json: @themagruppen }
|
format.json { render json: @themengruppe }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /themengruppen/new
|
# GET /themengruppen/new
|
||||||
# GET /themengruppen/new.json
|
# GET /themengruppen/new.json
|
||||||
def new
|
def new
|
||||||
@themagruppen = Themengruppe.new
|
@themengruppe = Themengruppe.new
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # new.html.erb
|
format.html # new.html.erb
|
||||||
format.json { render json: @themagruppen }
|
format.json { render json: @themengruppe }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /themengruppen/1/edit
|
# GET /themengruppen/1/edit
|
||||||
def edit
|
def edit
|
||||||
@themagruppen = Themengruppe.find(params[:id])
|
@themengruppe = Themengruppe.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /themengruppen
|
# POST /themengruppen
|
||||||
# POST /themengruppen.json
|
# POST /themengruppen.json
|
||||||
def create
|
def create
|
||||||
@themagruppen = Themengruppe.new(params[:themagruppen])
|
@themengruppe = Themengruppe.new(params[:themengruppe])
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @themagruppen.save
|
if @themengruppe.save
|
||||||
format.html { redirect_to @themagruppen, notice: 'Themengruppe was successfully created.' }
|
format.html { redirect_to @themengruppe, notice: 'Themengruppe was successfully created.' }
|
||||||
format.json { render json: @themagruppen, status: :created, location: @themagruppen }
|
format.json { render json: @themengruppe, status: :created, location: @themengruppe }
|
||||||
else
|
else
|
||||||
format.html { render action: "new" }
|
format.html { render action: "new" }
|
||||||
format.json { render json: @themagruppen.errors, status: :unprocessable_entity }
|
format.json { render json: @themengruppe.errors, status: :unprocessable_entity }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -56,15 +56,15 @@ class ThemengruppenController < ApplicationController
|
|||||||
# PUT /themengruppen/1
|
# PUT /themengruppen/1
|
||||||
# PUT /themengruppen/1.json
|
# PUT /themengruppen/1.json
|
||||||
def update
|
def update
|
||||||
@themagruppen = Themengruppe.find(params[:id])
|
@themengruppe = Themengruppe.find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @themagruppen.update_attributes(params[:themagruppen])
|
if @themengruppe.update_attributes(params[:themengruppe])
|
||||||
format.html { redirect_to @themagruppen, notice: 'Themengruppe was successfully updated.' }
|
format.html { redirect_to @themengruppe, notice: 'Themengruppe was successfully updated.' }
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
else
|
else
|
||||||
format.html { render action: "edit" }
|
format.html { render action: "edit" }
|
||||||
format.json { render json: @themagruppen.errors, status: :unprocessable_entity }
|
format.json { render json: @themengruppe.errors, status: :unprocessable_entity }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -72,8 +72,8 @@ class ThemengruppenController < ApplicationController
|
|||||||
# DELETE /themengruppen/1
|
# DELETE /themengruppen/1
|
||||||
# DELETE /themengruppen/1.json
|
# DELETE /themengruppen/1.json
|
||||||
def destroy
|
def destroy
|
||||||
@themagruppen = Themengruppe.find(params[:id])
|
@themengruppe = Themengruppe.find(params[:id])
|
||||||
@themagruppen.destroy
|
@themengruppe.destroy
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to themengruppen_url }
|
format.html { redirect_to themengruppen_url }
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Thema < ActiveRecord::Base
|
class Thema < ActiveRecord::Base
|
||||||
attr_accessible :text, :title
|
attr_accessible :text, :title, :themengruppe_id
|
||||||
has_many :fragen
|
has_many :fragen
|
||||||
has_many :attachments
|
has_many :attachments
|
||||||
belongs_to :themengruppe, :foreign_key => "themengruppe_id"
|
belongs_to :themengruppe, :foreign_key => "themengruppe_id"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Themengruppe < ActiveRecord::Base
|
class Themengruppe < ActiveRecord::Base
|
||||||
attr_accessible :text, :title
|
attr_accessible :text, :title
|
||||||
has_many :themen
|
has_many :themen, class_name: 'Thema'
|
||||||
has_many :fragen, through: :themen
|
has_many :fragen, through: :themen
|
||||||
|
|
||||||
validates :title, :presence => true
|
validates :title, :presence => true
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
|
<%= tinymce_assets %>
|
||||||
<%= semantic_form_for @thema do |f| %>
|
<%= semantic_form_for @thema do |f| %>
|
||||||
<%= f.inputs do %>
|
<%= f.inputs do %>
|
||||||
<%= f.input :title %>
|
<%= f.input :title %>
|
||||||
<%= f.input :text %>
|
<%= f.input :themengruppe %>
|
||||||
|
<%= f.input :text, :as=>:tinymce_text%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= tinymce %>
|
||||||
|
|
||||||
<%= f.actions do %>
|
<%= f.actions do %>
|
||||||
<%= f.action :submit, :as => :input %>
|
<%= f.action :submit, :as => :input %>
|
||||||
|
|||||||
3
app/views/themen/_small.html.erb
Normal file
3
app/views/themen/_small.html.erb
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<%= raw(small.text) %>
|
||||||
|
<br/>
|
||||||
|
<%= link_to 'Edit', edit_thema_path(small) %>
|
||||||
2
app/views/themen/_thema.html.erb
Normal file
2
app/views/themen/_thema.html.erb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<%= link_to thema.title,themengruppe_thema_path(thema.themengruppe,thema)%>
|
||||||
|
|
||||||
@@ -1,15 +1,10 @@
|
|||||||
<p id="notice"><%= notice %></p>
|
<p id="notice"><%= notice %></p>
|
||||||
|
|
||||||
|
<h1><%= @thema.title %></h1>
|
||||||
<p>
|
<p>
|
||||||
<b>Title:</b>
|
<%= raw(@thema.text) %>
|
||||||
<%= @thema.title %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<b>Text:</b>
|
|
||||||
<%= @thema.text %>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<%= link_to 'Edit', edit_thema_path(@thema) %> |
|
<%= link_to 'Edit', edit_thema_path(@thema) %> |
|
||||||
<%= link_to 'Back', themen_path %>
|
<%= link_to 'Back', themengruppe_path(@thema.themengruppe) %>
|
||||||
|
|||||||
12
app/views/themengruppen/_themengruppe.html.erb
Normal file
12
app/views/themengruppen/_themengruppe.html.erb
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
<h3> <%= link_to themengruppe.title, themengruppe %> </h3>
|
||||||
|
<p>
|
||||||
|
<%=themengruppe.text %>
|
||||||
|
</p>
|
||||||
|
<ul>
|
||||||
|
<% themengruppe.themen.each do |t| %>
|
||||||
|
<li>
|
||||||
|
<%= render t %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<h1>Editing themagruppen</h1>
|
<h1>Editing themengruppen</h1>
|
||||||
|
|
||||||
<%= render 'form' %>
|
<%= render 'form' %>
|
||||||
|
|
||||||
<%= link_to 'Show', @themagruppen %> |
|
<%= link_to 'Show', @themengruppe %> |
|
||||||
<%= link_to 'Back', themengruppen_path %>
|
<%= link_to 'Back', themengruppen_path %>
|
||||||
|
|||||||
@@ -1,25 +1,24 @@
|
|||||||
<h1>Listing themengruppen</h1>
|
<div class="container-fluid">
|
||||||
|
|
||||||
<table>
|
<% @themengruppen.each_slice(2) do |row| %>
|
||||||
<tr>
|
<div class="row-fluid">
|
||||||
<th>Title</th>
|
<% row.each do |themengruppe| %>
|
||||||
<th>Text</th>
|
<div class="span6 equalheight">
|
||||||
<th></th>
|
<div class="themengruppe">
|
||||||
<th></th>
|
<%= render themengruppe %>
|
||||||
<th></th>
|
<p>
|
||||||
</tr>
|
<%= link_to 'Edit', edit_themengruppe_path(themengruppe) %>
|
||||||
|
</p>
|
||||||
<% @themengruppen.each do |themengruppe| %>
|
</div>
|
||||||
<tr>
|
</div>
|
||||||
<td><%= themengruppe.title %></td>
|
|
||||||
<td><%= themengruppe.text %></td>
|
|
||||||
<td><%= link_to 'Show', themengruppe %></td>
|
|
||||||
<td><%= link_to 'Edit', edit_themengruppe_path(themengruppe) %></td>
|
|
||||||
<td><%= link_to 'Destroy', themengruppe, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
<script>
|
||||||
|
make_equal_height();
|
||||||
|
</script>
|
||||||
|
|
||||||
<%= link_to 'New Themengruppe', new_themengruppe_path %>
|
<%= link_to 'New Themengruppe', new_themengruppe_path %>
|
||||||
|
|||||||
@@ -1,15 +1,29 @@
|
|||||||
<p id="notice"><%= notice %></p>
|
<h1><%= @themengruppe.title %></h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b>Title:</b>
|
<%= @themengruppe.text %>
|
||||||
<%= @themagruppen.title %>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<div class="accordion" id="accordion1">
|
||||||
<b>Text:</b>
|
<% @themengruppe.themen.each do |thema| %>
|
||||||
<%= @themagruppen.text %>
|
<div class="accordion-group">
|
||||||
</p>
|
<div class="accordion-heading">
|
||||||
|
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#collapse<%=thema.id%>">
|
||||||
|
<%= thema.title %>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div id="collapse<%=thema.id%>" class="accordion-body collapse">
|
||||||
|
<div class="accordion-inner">
|
||||||
|
<%= render partial: "themen/small", object: thema %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= link_to 'Add Thema', new_themengruppe_thema_path(@themengruppe) %>
|
||||||
|
|
||||||
<%= link_to 'Edit', edit_themagruppen_path(@themagruppen) %> |
|
<br/><br/>
|
||||||
|
|
||||||
|
<%= link_to 'Edit', edit_themengruppe_path(@themengruppe) %> |
|
||||||
<%= link_to 'Back', themengruppen_path %>
|
<%= link_to 'Back', themengruppen_path %>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class TranslateThemen < ActiveRecord::Migration
|
|||||||
}, {
|
}, {
|
||||||
#:migrate_data => true
|
#:migrate_data => true
|
||||||
})
|
})
|
||||||
add_column :thema_translations, :themen_id, :integer
|
add_column :thema_translations, :theman_id, :integer
|
||||||
remove_column :thema_translations, :thema_id
|
remove_column :thema_translations, :thema_id
|
||||||
|
|
||||||
Themengruppe.create_translation_table!({
|
Themengruppe.create_translation_table!({
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
class AddThemaidToThemaTranslations < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :thema_translations, :theman_id, :integer
|
||||||
|
remove_column :thema_translations, :themen_id, :integer
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user