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
end end
def default_url_options def default_url_options
{locale: I18n.locale, theme: theme_name} {locale: I18n.locale, theme: theme_name, ansicht: nil}
end end
end end

View File

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

View File

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

View File

@@ -1,9 +1,11 @@
module ApplicationHelper module ApplicationHelper
def current_url(overwrite={}) def current_url1(overwrite={})
url_for :params => params.merge(overwrite).except(:controller,:action) url_for :params => params.merge(overwrite).except(:controller,:action,:ansicht)
end end
def switch_locale_url(target_locale) 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 end
def toolbar_html(elemente) def toolbar_html(elemente)

View File

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

View File

@@ -36,21 +36,27 @@
</div> </div>
</div> </div>
</div> </div>
<div class="span1 "></div> <div class="span1 "></div>
</div> </div>
<div class="row-fluid"> <div class="row-fluid">
<div class="span1"> <div class="span1">
</div> </div>
<div class="span10" id="contentdiv"> <div class="span10" id="contentdiv">
<%= yield %> <%= 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>
<div class="span1"> <div class="span1">
</div> </div>
</div> </div>
</div> </div>
</body> </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) )%>"); $("#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"> <div class="span4">
<ul id="themen" class="sort" > <ul id="themen" class="sort" >
<% @themen.each do |thema| %> <%= render partial:"themen/verw_liste", object: @themen %>
<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 %>
</ul> </ul>
<%= link_to new_themengruppe_thema_path(@themengruppe),:remote=>true do %> New Thema <% end %> <%= link_to new_themengruppe_thema_path(@themengruppe),:remote=>true do %> New Thema <% end %>
</div> </div>

View File

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