From 07f53c59bcb62297480ea967a4f7112fd41cf839 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sat, 29 Mar 2014 12:43:08 +0100 Subject: [PATCH] thema verwalten added --- Gemfile | 4 ++-- app/controllers/themen_controller.rb | 19 +++++++++++++++---- app/views/lvas/show.html.erb | 23 +++++++++++++++-------- app/views/neuigkeiten/show.html.erb | 2 +- app/views/themen/_small.html.erb | 2 +- app/views/themen/show.html.erb | 21 +++------------------ app/views/themengruppen/show.html.erb | 13 +++++++++++-- config/routes.rb | 7 +++++-- 8 files changed, 53 insertions(+), 38 deletions(-) diff --git a/Gemfile b/Gemfile index 8a0a201..9bde7ec 100755 --- a/Gemfile +++ b/Gemfile @@ -33,7 +33,7 @@ gem 'jquery-rails' # Use unicorn as the app server # gem 'unicorn' -# Deploy with Capistrano +# Deploy with Capistran # gem 'capistrano' # To use debugger @@ -87,7 +87,7 @@ gem 'rmagick' gem 'bootstrap-addons-rails' gem "jquery-fileupload-rails" gem "jquery-ui-rails","~> 4.1.1" - +gem "font-awesome-rails" # gem "jquery-sortable-rails" gem "seed_dump", "~> 0.5.3" #gem "themes_for_rails" ,:git =>'git://github.com/tkriplean/themes_for_rails.git' diff --git a/app/controllers/themen_controller.rb b/app/controllers/themen_controller.rb index 9b84e0a..4e63f18 100644 --- a/app/controllers/themen_controller.rb +++ b/app/controllers/themen_controller.rb @@ -16,16 +16,27 @@ class ThemenController < ApplicationController # GET /themen/1.json def show @thema = Thema.find(params[:id]) + redirect_to :controller=>'themengruppen', :id=>@thema.themengruppe.id, :action=>:show, :anchor=> params[:id].to_s @fragen=@thema.fragen + @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>"Verwalten", :path=>verwalten_thema_path(@thema)}] + @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}] @toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('thema.remove'), :path=>thema_path(@thema), :method=>:delete, :confirm=>I18n.t('thema.sure')} - respond_to do |format| - format.html # show.html.erb - format.json { render json: @thema } - end + # respond_to do |format| + # format.html # show.html.erb + # format.json { render json: @thema } + # end end + def verwalten + @thema = Thema.find(params[:id]) + @fragen=@thema.fragen + @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>"Verwalten", :path=>verwalten_thema_path(@thema)}] + @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}] + @toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('thema.remove'), :path=>thema_path(@thema), :method=>:delete, :confirm=>I18n.t('thema.sure')} + + end # GET /themen/new # GET /themen/new.json def new diff --git a/app/views/lvas/show.html.erb b/app/views/lvas/show.html.erb index 69667d5..5735a58 100755 --- a/app/views/lvas/show.html.erb +++ b/app/views/lvas/show.html.erb @@ -4,10 +4,12 @@

<%=@lva.typ.to_s + ' ' + @lva.name %>

+

Prüfungsinformation

<%= @lva.pruefungsinformation.html_safe %>
+

Lernaufwand

<%= @lva.lernaufwand %> @@ -16,14 +18,19 @@
<%= @lva.desc.to_s.html_safe %>
-
-

Beispiele

- <% @lva.beispiele.each do |b| %> - <%= render b%> - - <% end %> - -
+ +

Beispiele

+ <% @lva.beispiele.each do |b| %> + <%= render b%> + <% end %> + + <% unless @lva.nlinks.empty? %> +

Neuigkeiten

+ <% @lva.nlinks.each do |l| %> + <%= render l.neuigkeit %> + <% end %> + <% end %> +
diff --git a/app/views/neuigkeiten/show.html.erb b/app/views/neuigkeiten/show.html.erb index a2b040c..2dcb846 100755 --- a/app/views/neuigkeiten/show.html.erb +++ b/app/views/neuigkeiten/show.html.erb @@ -30,7 +30,7 @@
Siehe auch: -
    +
      diff --git a/app/views/themen/_small.html.erb b/app/views/themen/_small.html.erb index 58c03bd..e6b9d4a 100644 --- a/app/views/themen/_small.html.erb +++ b/app/views/themen/_small.html.erb @@ -14,4 +14,4 @@ @small_elements = [] @small_elements << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>small} if can? :edit, small @small_elements << {:hicon=>'icon-remove-circle',:text=>I18n.t('thema.remove'), :path=>small, :method=>:delete,:confirm=>I18n.t('thema.sure')} if can? :delete, small %> -<%= render :partial=>'layouts/pretty_toolbar', :object=>@small_elements unless @small_elements.empty? %> +<% render :partial=>'layouts/pretty_toolbar', :object=>@small_elements unless @small_elements.empty? %> diff --git a/app/views/themen/show.html.erb b/app/views/themen/show.html.erb index 041efab..aa8912a 100644 --- a/app/views/themen/show.html.erb +++ b/app/views/themen/show.html.erb @@ -1,24 +1,9 @@

      <%= notice %>

      +<%= link_to "Zurück", @thema.themengruppe %> +
      +<%= render :partial=>"themen/small", :object=>@thema %> -

      <%= @thema.title %>

      -

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

      - - <%= render :partial=>'layouts/pretty_toolbar' %> -<%= render :partial=>'themen/fragen' %> - -
      - -

      <%= I18n.t('attachment.title')%>:

      -
      -
      <%= link_to new_thema_attachment_path(@thema) ,:remote=>true do %> new Attachment <% end %> <%= render :partial => "themen/select", :object => @thema, :locals=>{:editor => :false} %> diff --git a/app/views/themengruppen/show.html.erb b/app/views/themengruppen/show.html.erb index cf9f599..1268b61 100644 --- a/app/views/themengruppen/show.html.erb +++ b/app/views/themengruppen/show.html.erb @@ -1,5 +1,5 @@
      -

      sdffs

      +

      sdffs2

      <%= @themengruppe.title %>

      <%= @themengruppe.text %> @@ -13,10 +13,19 @@ <% unless thema.gremium.nil? %>

      - <%= link_to "Zu dem Gremium ..." , thema.gremium %> + <%= link_to fa_icon("users 2x")+" Zu dem Gremium ..." , thema.gremium %>

      <% end %> <%= render :partial => 'themen/small', :object => thema %> +tools: + <% + @small_elements2 = [] + @small_elements2 << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('common.verwalten'), :path=>verwalten_thema_path(thema)} if can? :edit, thema + + %> + <%= render :partial=>'layouts/pretty_toolbar', :object=>@small_elements2 unless @small_elements2.empty? %> + + <% thema.nlinks.each do |l| %> <%= render l.neuigkeit %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index b3af66c..69cc67e 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -112,8 +112,11 @@ end resources :themen do - get :fragen - resources :attachments + member do + get :fragen + get :verwalten + end + resources :attachments end resources :themengruppen do