From f64079415ab329ad943c6275f495343b1333f877 Mon Sep 17 00:00:00 2001 From: HausdorffHimself Date: Fri, 23 Aug 2013 12:04:24 +0200 Subject: [PATCH 1/3] ressourcify attachment --- config/routes.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/routes.rb b/config/routes.rb index de975f3..1f84141 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -60,6 +60,7 @@ get 'home/dev', :controller=>:home, :action=>:dev, :as=>'home_dev' get 'home/startdev', :controller=>:home, :action=>:startdev, :as=>'home_startdev' resources :beispiele + resources :attachment resources :themen resources :themengruppen do resources :themen, :only=>[:new, :show] From 7a18a53cc816640067a29cdd9cc9d70ba3fedb1f Mon Sep 17 00:00:00 2001 From: HausdorffHimself Date: Fri, 23 Aug 2013 13:40:42 +0200 Subject: [PATCH 2/3] ADD: picture to themengruppe --- app/models/themengruppe.rb | 3 ++- app/views/themen/_form.html.erb | 1 + app/views/themengruppen/_form.html.erb | 2 ++ db/migrate/20130823105422_add_picture_to_themengruppe.rb | 5 +++++ 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20130823105422_add_picture_to_themengruppe.rb diff --git a/app/models/themengruppe.rb b/app/models/themengruppe.rb index 7cee6f8..ef59efd 100644 --- a/app/models/themengruppe.rb +++ b/app/models/themengruppe.rb @@ -11,9 +11,10 @@ class Themengruppe < ActiveRecord::Base WORD_COUNT = 50 - attr_accessible :text, :title + attr_accessible :text, :title, :picture has_many :themen, class_name: 'Thema' has_many :fragen, through: :themen + mount_uploader :picture, PictureUploader validates :title, :presence => true diff --git a/app/views/themen/_form.html.erb b/app/views/themen/_form.html.erb index 0444d68..53e9944 100644 --- a/app/views/themen/_form.html.erb +++ b/app/views/themen/_form.html.erb @@ -2,6 +2,7 @@ <%= semantic_form_for @thema do |f| %> <%= f.inputs do %> <%= f.input :title %> + <%= f.input :picture, :as => :file %> <%= f.input :themengruppe %> <%= f.input :text, :as=>:tinymce_text%> <% end %> diff --git a/app/views/themengruppen/_form.html.erb b/app/views/themengruppen/_form.html.erb index c81d3ff..783961e 100644 --- a/app/views/themengruppen/_form.html.erb +++ b/app/views/themengruppen/_form.html.erb @@ -1,7 +1,9 @@ <%= semantic_form_for @themengruppe do |f| %> <%= f.inputs do %> <%= f.input :title %> + <%= f.input :picture, :as => :file %> <%= f.input :text %> + <% end %> <%= f.actions do %> diff --git a/db/migrate/20130823105422_add_picture_to_themengruppe.rb b/db/migrate/20130823105422_add_picture_to_themengruppe.rb new file mode 100644 index 0000000..392c8b3 --- /dev/null +++ b/db/migrate/20130823105422_add_picture_to_themengruppe.rb @@ -0,0 +1,5 @@ +class AddPictureToThemengruppe < ActiveRecord::Migration + def change + add_column :themengruppen, :picture, :string + end +end From adbbce5fc810cfc8875241c4da5c0b0b5a07b334 Mon Sep 17 00:00:00 2001 From: HausdorffHimself Date: Fri, 23 Aug 2013 13:41:09 +0200 Subject: [PATCH 3/3] CHANGE: Layout auf CSS umgestellt --- .../themengruppen/_themengruppe.html.erb | 50 ++++++++++++------- app/views/themengruppen/index.html.erb | 34 +++++++------ 2 files changed, 51 insertions(+), 33 deletions(-) diff --git a/app/views/themengruppen/_themengruppe.html.erb b/app/views/themengruppen/_themengruppe.html.erb index 450e18e..717b3ab 100644 --- a/app/views/themengruppen/_themengruppe.html.erb +++ b/app/views/themengruppen/_themengruppe.html.erb @@ -1,18 +1,34 @@ - -

<%= link_to themengruppe.title, themengruppe %>

-

- <%= if themengruppe.text.split.size > Themengruppe::WORD_COUNT - themengruppe.text.split[0..Themengruppe::WORD_COUNT].join(" ") + " ..." - else - themengruppe.text - end%> -

+
+
+ <%= image_tag themengruppe.picture.thumb.url,{:class=>"img-circle"} %> +
+
+

<%= link_to themengruppe.title, themengruppe %>

+
+

-<%= I18n.t("themengruppe.themen") %> -
    - <% themengruppe.themen.each do |t| %> -
  • - <%= render t %> -
  • - <% end %> -
+
+
+

+ <%= if themengruppe.text.split.size > Themengruppe::WORD_COUNT + themengruppe.text.split[0..Themengruppe::WORD_COUNT].join(" ") + " ..." + else + themengruppe.text + end%> +

+
+
+ +
+
+ <%= I18n.t("themengruppe.themen") %> +
    + <% themengruppe.themen.each do |t| %> +
  • + <%= render t %> +
  • + <% end %> +
+
+
+ diff --git a/app/views/themengruppen/index.html.erb b/app/views/themengruppen/index.html.erb index b1ae6d9..6c33445 100644 --- a/app/views/themengruppen/index.html.erb +++ b/app/views/themengruppen/index.html.erb @@ -1,21 +1,23 @@
- - <% @themengruppen.each_slice(2) do |row| %> -
- <% row.each do |themengruppe| %> -
-
- <%= render themengruppe %> -

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

-
-
- <% end %> -
- <% end %> + <% @themengruppen.each_slice(2) do |row| %> +
+ <% row.each do |themengruppe| %> +
+
+ <%= render themengruppe %> +
+
+ <%= link_to 'Edit', edit_themengruppe_path(themengruppe) %> +
+
+
+
+ <% end %> +
+ <% end %>
-
+ +