thema verwalten added

This commit is contained in:
Andreas Stephanides
2014-03-29 12:43:08 +01:00
parent a8401391a6
commit 07f53c59bc
8 changed files with 53 additions and 38 deletions

View File

@@ -33,7 +33,7 @@ gem 'jquery-rails'
# Use unicorn as the app server # Use unicorn as the app server
# gem 'unicorn' # gem 'unicorn'
# Deploy with Capistrano # Deploy with Capistran
# gem 'capistrano' # gem 'capistrano'
# To use debugger # To use debugger
@@ -87,7 +87,7 @@ gem 'rmagick'
gem 'bootstrap-addons-rails' gem 'bootstrap-addons-rails'
gem "jquery-fileupload-rails" gem "jquery-fileupload-rails"
gem "jquery-ui-rails","~> 4.1.1" gem "jquery-ui-rails","~> 4.1.1"
gem "font-awesome-rails"
# gem "jquery-sortable-rails" # gem "jquery-sortable-rails"
gem "seed_dump", "~> 0.5.3" gem "seed_dump", "~> 0.5.3"
#gem "themes_for_rails" ,:git =>'git://github.com/tkriplean/themes_for_rails.git' #gem "themes_for_rails" ,:git =>'git://github.com/tkriplean/themes_for_rails.git'

View File

@@ -16,16 +16,27 @@ class ThemenController < ApplicationController
# GET /themen/1.json # GET /themen/1.json
def show def show
@thema = Thema.find(params[:id]) @thema = Thema.find(params[:id])
redirect_to :controller=>'themengruppen', :id=>@thema.themengruppe.id, :action=>:show, :anchor=> params[:id].to_s
@fragen=@thema.fragen @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 = [{: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')} @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| # respond_to do |format|
format.html # show.html.erb # format.html # show.html.erb
format.json { render json: @thema } # format.json { render json: @thema }
end # end
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
# GET /themen/new.json # GET /themen/new.json
def new def new

View File

@@ -4,10 +4,12 @@
<div class="row-fluid"> <div class="row-fluid">
<div class="span8"> <div class="span8">
<h1><%=@lva.typ.to_s + ' ' + @lva.name %></h1> <h1><%=@lva.typ.to_s + ' ' + @lva.name %></h1>
<h2>Prüfungsinformation</h2> <h2>Prüfungsinformation</h2>
<div class=""> <div class="">
<%= @lva.pruefungsinformation.html_safe %> <%= @lva.pruefungsinformation.html_safe %>
</div> </div>
<h2>Lernaufwand</h2> <h2>Lernaufwand</h2>
<div class=""> <div class="">
<%= @lva.lernaufwand %> <%= @lva.lernaufwand %>
@@ -16,14 +18,19 @@
<div class=""> <div class="">
<%= @lva.desc.to_s.html_safe %> <%= @lva.desc.to_s.html_safe %>
</div> </div>
<div class="row-fluid">
<h2>Beispiele</h2> <h2>Beispiele</h2>
<% @lva.beispiele.each do |b| %> <% @lva.beispiele.each do |b| %>
<%= render b%> <%= render b%>
<% end %> <% end %>
</div> <% unless @lva.nlinks.empty? %>
<h2>Neuigkeiten</h2>
<% @lva.nlinks.each do |l| %>
<%= render l.neuigkeit %>
<% end %>
<% end %>
</div> </div>
<div class="span4"> <div class="span4">
<div class="contentbox"> <div class="contentbox">

View File

@@ -30,7 +30,7 @@
</div> </div>
Siehe auch: Siehe auch:
<ul> <ul class="unstyled">
<div id="nlink_list"> <div id="nlink_list">
<%= render partial: "nlink_list", collection: @neuigkeit.nlinks %> <%= render partial: "nlink_list", collection: @neuigkeit.nlinks %>
</div> </div>

View File

@@ -14,4 +14,4 @@
@small_elements = [] @small_elements = []
@small_elements << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>small} if can? :edit, small @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 %> @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? %>

View File

@@ -1,24 +1,9 @@
<p id="notice"><%= notice %></p> <p id="notice"><%= notice %></p>
<%= link_to "Zurück", @thema.themengruppe %>
<br>
<%= render :partial=>"themen/small", :object=>@thema %>
<h1><%= @thema.title %></h1>
<p>
<%= raw(@thema.text) %>
</p>
<!--
<%= link_to 'Edit', edit_thema_path(@thema) %> |
<%= link_to 'Back', themengruppe_path(@thema.themengruppe) %>
-->
<%= render :partial=>'layouts/pretty_toolbar' %> <%= render :partial=>'layouts/pretty_toolbar' %>
<%= render :partial=>'themen/fragen' %>
<!--
<%= link_to 'Neue Frage', new_frage_path %> <br/>
-->
<br/>
<h2><%= I18n.t('attachment.title')%>:</h2>
<div id="attachmentform">
</div>
<%= link_to new_thema_attachment_path(@thema) ,:remote=>true do %> new Attachment <% end %> <%= link_to new_thema_attachment_path(@thema) ,:remote=>true do %> new Attachment <% end %>
<%= render :partial => "themen/select", :object => @thema, :locals=>{:editor => :false} %> <%= render :partial => "themen/select", :object => @thema, :locals=>{:editor => :false} %>

View File

@@ -1,5 +1,5 @@
<div class="content-wrap content-column" > <div class="content-wrap content-column" >
<h2>sdffs</h2> <h2>sdffs2</h2>
<h1><%= @themengruppe.title %></h1> <h1><%= @themengruppe.title %></h1>
<p> <p>
<%= @themengruppe.text %> <%= @themengruppe.text %>
@@ -13,10 +13,19 @@
</a> </a>
<% unless thema.gremium.nil? %> <% unless thema.gremium.nil? %>
<p> <p>
<%= link_to "Zu dem Gremium ..." , thema.gremium %> <%= link_to fa_icon("users 2x")+" Zu dem Gremium ..." , thema.gremium %>
</p> </p>
<% end %> <% end %>
<%= render :partial => 'themen/small', :object => thema %> <%= 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| %> <% thema.nlinks.each do |l| %>
<%= render l.neuigkeit %> <%= render l.neuigkeit %>
<% end %> <% end %>

View File

@@ -112,7 +112,10 @@
end end
resources :themen do resources :themen do
member do
get :fragen get :fragen
get :verwalten
end
resources :attachments resources :attachments
end end