diff --git a/app/assets/javascripts/themengruppen.js.coffee b/app/assets/javascripts/themengruppen.js.coffee deleted file mode 100644 index 7615679..0000000 --- a/app/assets/javascripts/themengruppen.js.coffee +++ /dev/null @@ -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/ diff --git a/app/assets/stylesheets/themengruppen.css.scss b/app/assets/stylesheets/themengruppen.css.scss index 074b60a..5ea80bc 100644 --- a/app/assets/stylesheets/themengruppen.css.scss +++ b/app/assets/stylesheets/themengruppen.css.scss @@ -1,3 +1,11 @@ // Place all the styles related to the themengruppen controller here. // They will automatically be included in application.css. // 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% +} diff --git a/app/controllers/themen_controller.rb b/app/controllers/themen_controller.rb index bb9235e..bc3bcb6 100644 --- a/app/controllers/themen_controller.rb +++ b/app/controllers/themen_controller.rb @@ -25,7 +25,7 @@ class ThemenController < ApplicationController # GET /themen/new.json def new @thema = Thema.new - + @thema.themengruppe = Themengruppe.find(params[:themengruppe_id]) unless params[:themengruppe_id].nil? respond_to do |format| format.html # new.html.erb format.json { render json: @thema } diff --git a/app/controllers/themengruppen_controller.rb b/app/controllers/themengruppen_controller.rb index 46fa1d4..a366078 100644 --- a/app/controllers/themengruppen_controller.rb +++ b/app/controllers/themengruppen_controller.rb @@ -13,42 +13,42 @@ class ThemengruppenController < ApplicationController # GET /themengruppen/1 # GET /themengruppen/1.json def show - @themagruppen = Themengruppe.find(params[:id]) + @themengruppe = Themengruppe.find(params[:id]) respond_to do |format| format.html # show.html.erb - format.json { render json: @themagruppen } + format.json { render json: @themengruppe } end end # GET /themengruppen/new # GET /themengruppen/new.json def new - @themagruppen = Themengruppe.new + @themengruppe = Themengruppe.new respond_to do |format| format.html # new.html.erb - format.json { render json: @themagruppen } + format.json { render json: @themengruppe } end end # GET /themengruppen/1/edit def edit - @themagruppen = Themengruppe.find(params[:id]) + @themengruppe = Themengruppe.find(params[:id]) end # POST /themengruppen # POST /themengruppen.json def create - @themagruppen = Themengruppe.new(params[:themagruppen]) + @themengruppe = Themengruppe.new(params[:themengruppe]) respond_to do |format| - if @themagruppen.save - format.html { redirect_to @themagruppen, notice: 'Themengruppe was successfully created.' } - format.json { render json: @themagruppen, status: :created, location: @themagruppen } + if @themengruppe.save + format.html { redirect_to @themengruppe, notice: 'Themengruppe was successfully created.' } + format.json { render json: @themengruppe, status: :created, location: @themengruppe } else 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 @@ -56,15 +56,15 @@ class ThemengruppenController < ApplicationController # PUT /themengruppen/1 # PUT /themengruppen/1.json def update - @themagruppen = Themengruppe.find(params[:id]) + @themengruppe = Themengruppe.find(params[:id]) respond_to do |format| - if @themagruppen.update_attributes(params[:themagruppen]) - format.html { redirect_to @themagruppen, notice: 'Themengruppe was successfully updated.' } + if @themengruppe.update_attributes(params[:themengruppe]) + format.html { redirect_to @themengruppe, notice: 'Themengruppe was successfully updated.' } format.json { head :no_content } else 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 @@ -72,8 +72,8 @@ class ThemengruppenController < ApplicationController # DELETE /themengruppen/1 # DELETE /themengruppen/1.json def destroy - @themagruppen = Themengruppe.find(params[:id]) - @themagruppen.destroy + @themengruppe = Themengruppe.find(params[:id]) + @themengruppe.destroy respond_to do |format| format.html { redirect_to themengruppen_url } diff --git a/app/models/thema.rb b/app/models/thema.rb index 44be678..64bdea9 100644 --- a/app/models/thema.rb +++ b/app/models/thema.rb @@ -1,5 +1,5 @@ class Thema < ActiveRecord::Base - attr_accessible :text, :title + attr_accessible :text, :title, :themengruppe_id has_many :fragen has_many :attachments belongs_to :themengruppe, :foreign_key => "themengruppe_id" diff --git a/app/models/themengruppe.rb b/app/models/themengruppe.rb index f73289d..034558f 100644 --- a/app/models/themengruppe.rb +++ b/app/models/themengruppe.rb @@ -1,6 +1,6 @@ class Themengruppe < ActiveRecord::Base attr_accessible :text, :title - has_many :themen + has_many :themen, class_name: 'Thema' has_many :fragen, through: :themen validates :title, :presence => true diff --git a/app/views/themen/_form.html.erb b/app/views/themen/_form.html.erb index 060b29b..0444d68 100644 --- a/app/views/themen/_form.html.erb +++ b/app/views/themen/_form.html.erb @@ -1,8 +1,11 @@ +<%= tinymce_assets %> <%= semantic_form_for @thema do |f| %> <%= f.inputs do %> <%= f.input :title %> - <%= f.input :text %> + <%= f.input :themengruppe %> + <%= f.input :text, :as=>:tinymce_text%> <% end %> +<%= tinymce %> <%= f.actions do %> <%= f.action :submit, :as => :input %> diff --git a/app/views/themen/_small.html.erb b/app/views/themen/_small.html.erb new file mode 100644 index 0000000..49205ad --- /dev/null +++ b/app/views/themen/_small.html.erb @@ -0,0 +1,3 @@ +<%= raw(small.text) %> +
+<%= link_to 'Edit', edit_thema_path(small) %> diff --git a/app/views/themen/_thema.html.erb b/app/views/themen/_thema.html.erb new file mode 100644 index 0000000..50cbe00 --- /dev/null +++ b/app/views/themen/_thema.html.erb @@ -0,0 +1,2 @@ + <%= link_to thema.title,themengruppe_thema_path(thema.themengruppe,thema)%> + diff --git a/app/views/themen/show.html.erb b/app/views/themen/show.html.erb index 8dd7605..31c2c49 100644 --- a/app/views/themen/show.html.erb +++ b/app/views/themen/show.html.erb @@ -1,15 +1,10 @@

<%= notice %>

+

<%= @thema.title %>

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

- -

- Text: - <%= @thema.text %> + <%= raw(@thema.text) %>

<%= link_to 'Edit', edit_thema_path(@thema) %> | -<%= link_to 'Back', themen_path %> +<%= link_to 'Back', themengruppe_path(@thema.themengruppe) %> diff --git a/app/views/themengruppen/_themengruppe.html.erb b/app/views/themengruppen/_themengruppe.html.erb new file mode 100644 index 0000000..9fe5849 --- /dev/null +++ b/app/views/themengruppen/_themengruppe.html.erb @@ -0,0 +1,12 @@ + +

<%= link_to themengruppe.title, themengruppe %>

+

+ <%=themengruppe.text %> +

+ diff --git a/app/views/themengruppen/edit.html.erb b/app/views/themengruppen/edit.html.erb index 8247722..68f8332 100644 --- a/app/views/themengruppen/edit.html.erb +++ b/app/views/themengruppen/edit.html.erb @@ -1,6 +1,6 @@ -

Editing themagruppen

+

Editing themengruppen

<%= render 'form' %> -<%= link_to 'Show', @themagruppen %> | +<%= link_to 'Show', @themengruppe %> | <%= link_to 'Back', themengruppen_path %> diff --git a/app/views/themengruppen/index.html.erb b/app/views/themengruppen/index.html.erb index 6cd7fe6..9976ad2 100644 --- a/app/views/themengruppen/index.html.erb +++ b/app/views/themengruppen/index.html.erb @@ -1,25 +1,24 @@ -

Listing themengruppen

+
- - - - - - - - - -<% @themengruppen.each do |themengruppe| %> - - - - - - - +<% @themengruppen.each_slice(2) do |row| %> +
+ <% row.each do |themengruppe| %> +
+
+ <%= render themengruppe %> +

+ <%= link_to 'Edit', edit_themengruppe_path(themengruppe) %> +

+
+
+ <% end %> +
<% end %> -
TitleText
<%= themengruppe.title %><%= themengruppe.text %><%= link_to 'Show', themengruppe %><%= link_to 'Edit', edit_themengruppe_path(themengruppe) %><%= link_to 'Destroy', themengruppe, method: :delete, data: { confirm: 'Are you sure?' } %>
- +

+ + <%= link_to 'New Themengruppe', new_themengruppe_path %> diff --git a/app/views/themengruppen/show.html.erb b/app/views/themengruppen/show.html.erb index 3bf3ae4..374958f 100644 --- a/app/views/themengruppen/show.html.erb +++ b/app/views/themengruppen/show.html.erb @@ -1,15 +1,29 @@ -

<%= notice %>

+

<%= @themengruppe.title %>

- Title: - <%= @themagruppen.title %> + <%= @themengruppe.text %>

-

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

+
+ <% @themengruppe.themen.each do |thema| %> +
+ +
+
+ <%= render partial: "themen/small", object: thema %> +
+
+
+ <% end %> +
+<%= link_to 'Add Thema', new_themengruppe_thema_path(@themengruppe) %> -<%= link_to 'Edit', edit_themagruppen_path(@themagruppen) %> | +

+ +<%= link_to 'Edit', edit_themengruppe_path(@themengruppe) %> | <%= link_to 'Back', themengruppen_path %> diff --git a/db/migrate/20130805171433_translate_themen.rb b/db/migrate/20130805171433_translate_themen.rb index 6f5db97..1c53d38 100644 --- a/db/migrate/20130805171433_translate_themen.rb +++ b/db/migrate/20130805171433_translate_themen.rb @@ -6,7 +6,7 @@ class TranslateThemen < ActiveRecord::Migration }, { #:migrate_data => true }) - add_column :thema_translations, :themen_id, :integer + add_column :thema_translations, :theman_id, :integer remove_column :thema_translations, :thema_id Themengruppe.create_translation_table!({ diff --git a/db/migrate/20130812170437_add_themaid_to_thema_translations.rb b/db/migrate/20130812170437_add_themaid_to_thema_translations.rb new file mode 100644 index 0000000..acd6173 --- /dev/null +++ b/db/migrate/20130812170437_add_themaid_to_thema_translations.rb @@ -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