diverse fixed

This commit is contained in:
Andreas Stephanides
2014-03-23 21:02:47 +01:00
parent 8f4528f994
commit c235619e31
10 changed files with 46 additions and 32 deletions

View File

@@ -22,6 +22,6 @@ else
end
end
def default_url_options
{locale: I18n.locale, theme: theme_name}
{locale: I18n.locale, theme: theme_name, ansicht: nil}
end
end

View File

@@ -11,13 +11,12 @@ class RubrikenController < ApplicationController
@rubrik = Rubrik.find(params[:id])
@moderatoren=User.with_role(:newsmoderator,@rubrik)
if can?(:showunpublished, Neuigkeit)
@neuigkeiten = @rubrik.neuigkeiten
else
@neuigkeiten = @rubrik.neuigkeiten.published
end
@toolbar_elements << {:text=>I18n.t('neuigkeit.new.title'),:path=> new_rubrik_neuigkeit_path(@rubrik),:hicon=>'icon-plus-sign'} if can? :verwalten, @rubrik
@toolbar_elements << {:text=>I18n.t('common.verwalten'),:path=>verwalten_rubrik_path(@rubrik),:icon=>:pencil} if can? :verwalten, @rubrik
@neuigkeiten = @rubrik.neuigkeiten
else
@neuigkeiten = @rubrik.neuigkeiten.published
end
@toolbar_elements << {:text=>I18n.t('neuigkeit.new.title'), :path=> new_rubrik_neuigkeit_path(@rubrik),:hicon=>'icon-plus-sign'} if can? :verwalten, @rubrik
@toolbar_elements << {:text=>I18n.t('common.verwalten'), :path=>verwalten_rubrik_path(@rubrik),:icon=>:pencil} if can? :verwalten, @rubrik

View File

@@ -52,6 +52,7 @@ class ThemenController < ApplicationController
def create
@thema = Thema.new(params[:thema])
@themen = @thema.themengruppe.themen.order(:priority).reverse
respond_to do |format|
if @thema.save
format.html { redirect_to @thema, notice: 'Thema was successfully created.' }
@@ -75,7 +76,7 @@ class ThemenController < ApplicationController
# PUT /themen/1.json
def update
@thema = Thema.find(params[:id])
@themen = @thema.themengruppe.themen.order(:priority).reverse
respond_to do |format|
if @thema.update_attributes(params[:thema])
format.html { redirect_to @thema, notice: 'Thema was successfully updated.' }

View File

@@ -1,9 +1,11 @@
module ApplicationHelper
def current_url(overwrite={})
url_for :params => params.merge(overwrite).except(:controller,:action)
end
def current_url1(overwrite={})
url_for :params => params.merge(overwrite).except(:controller,:action,:ansicht)
end
def switch_locale_url(target_locale)
current_url({:locale=>target_locale}) .sub "/"+I18n.locale.to_s+"/", "/"+target_locale.to_s+"/"
current_url1({:locale=>target_locale}) .sub "/"+I18n.locale.to_s+"/", "/"+target_locale.to_s+"/"
end
def toolbar_html(elemente)

View File

@@ -21,6 +21,7 @@ class Calentry < ActiveRecord::Base
validates :typ, :presence => true
before_save :get_public
belongs_to :object, polymorphic: true # Objekt zu dem der Calentry gehört (derzeit ein Newsartikel)
scope :upcoming, ->{ where("start >= ?", Time.now).order(:start)}
scope :recent,-> { where("start <= ?", Time.now).order(:start).reverse_order}
validate do |entry|
@@ -31,8 +32,8 @@ class Calentry < ActiveRecord::Base
resourcify
def get_public
self.public = (self.try(:object).nil?)? (self.calendar.try(:public)) : object.try(:public)
true
self.public = (self.try(:object).nil?)? (self.calendar.try(:public)) : object.try(:public)
true
end
def start_time
start

View File

@@ -36,21 +36,27 @@
</div>
</div>
</div>
<div class="span1 "></div>
</div>
<div class="row-fluid">
<div class="span1">
</div>
<div class="span10" id="contentdiv">
<%= yield %>
<span class="pull-right"> <%= render 'layouts/login' %></span>
</div>
<div class="span1">
</div>
</div>
<div class="row-fluid">
<div class="span1">
</div>
<div class="span10" id="contentdiv">
<span class="pull-right"> <%= render 'layouts/login' %></span> Version 0.0.3
</div>
<div class="span1">
</div>
</div>
</div>
</body>

View File

@@ -0,0 +1,3 @@
<% verw_liste.each do |thema| %>
<li id="themen_<%= thema.id %>" class="sort" ><div class="contentbox handle" ><h2><%= thema.title %></h2> </div> <%= link_to edit_thema_path(thema),:remote=>true do %> Edit <% end %> <%= link_to thema_fragen_path(thema),:remote=>true do %> Fragen <% end %></li>
<% end %>

View File

@@ -1,2 +1,4 @@
alert('t');
$("#themaview").html("<%= escape_javascript(raw("<h2>Bearbeiten</h2>")+render(:partial=>"themen/small", :object=>@thema) )%>");
$("#themen").html("<%= escape_javascript(render(:partial=>"themen/verw_liste", :object=>@themen) )%>");

View File

@@ -7,9 +7,7 @@
<div class="span4">
<ul id="themen" class="sort" >
<% @themen.each do |thema| %>
<li id="themen_<%= thema.id %>" class="sort" ><div class="contentbox handle" ><h2><%= thema.title %></h2> </div> <%= link_to edit_thema_path(thema),:remote=>true do %> Edit <% end %> <%= link_to thema_fragen_path(thema),:remote=>true do %> Fragen <% end %></li>
<% end %>
<%= render partial:"themen/verw_liste", object: @themen %>
</ul>
<%= link_to new_themengruppe_thema_path(@themengruppe),:remote=>true do %> New Thema <% end %>
</div>

View File

@@ -7,10 +7,10 @@
#get 'home',:controller=>home,:action=>:index,:as=>"home_index"
scope '(:locale)/admin' do
resources :users, :only=>[] do
collection do
get :index
post :all_update
end
collection do
get :index
post :all_update
end
end
get 'users/:id/add_role/:role', :controller=>:users, :action=>:add_role, :as=>'user_add_role'
get 'users/:id/do_confirm', :controller=>:users, :action=>:do_confirm, :as=>'user_do_confirm'
@@ -20,10 +20,12 @@ end
devise_for :users , :controllers=>{:omniauth_callbacks=> "users/omniauth_callbacks"}
scope '(:locale)' do
scope ':locale' do
scope '(t/:theme)' do
# Studien
resources :studien, :only=>[:new,:edit,:update,:destroy]
scope '(:ansicht)' do
resources :studien, :only=>[:new,:edit,:update,:destroy]
resources :studien, :only=>[:show]
end
@@ -126,7 +128,7 @@ end
resources :calentries
end
end
# The priority is based upon order of creation:
# first created -> highest priority.