themessticker, cleanup routes

This commit is contained in:
2014-06-25 23:09:05 +05:30
parent 2ba920331a
commit ee8f2d0076
14 changed files with 208 additions and 263 deletions

View File

@@ -1,22 +1,17 @@
// Place all the styles related to the themengruppen controller here. // Place all the styles related to the themengruppen controller here.
// They will automatically be included in application.css. // They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/ // You can use Sass (SCSS) here: http://sass-lang.com/
div.themengruppe
{padding:10px;
margin:2px;
border-radius: 10px;
min-width:13em;
border: #91B4FF solid 0px;
height: 90%
}
a.themengruppe:hover
{
box-shadow: 1px 1px 2px 2px lightgray;
}
a.themengruppe div.sticker
{ {
padding: 5px; width: 90%;
display:block; text-align: center;
padding: 5px
}
div.sticker-red
{ background: red;
}
div.sticker-yellow
{ background: yellow;
} }

View File

@@ -59,7 +59,7 @@ $sansFontFamily: Helvetica, Arial;
@import 'bootstrap/image-gallery'; @import 'bootstrap/image-gallery';
@import 'font-awesome'; @import 'font-awesome';
@import 'neuigkeiten'; @import 'neuigkeiten';
@import 'themengruppen';
div.header { div.header {
display: block; display: block;

View File

@@ -91,9 +91,14 @@ class FetprofilesController < ApplicationController
if @fetprofile.update_attributes(params[:fetprofile]) if @fetprofile.update_attributes(params[:fetprofile])
format.html { format.html {
unless params[:button]=="continue" || params[:commit]=="continue" unless params[:button]=="continue" || params[:commit]=="continue"
redirect_to @fetprofile, notice: 'Fetprofile was successfully updated.'
redirect_to @fetprofile, notice: 'profile was successfully updated.'
else else
redirect_to edit_fetprofile_path(@fetprofile), notice: 'Fetprofile was successfully updated.' @memberships=@fetprofile.memberships.order(:typ)
@memberships<< Membership.new
@memberships<< Membership.new
@memberships<< Membership.new
render action: "edit", notice: 'profile was successfully updated.'
end end
} }
format.json { head :no_content } format.json { head :no_content }

View File

@@ -22,8 +22,11 @@ class ThemengruppenController < ApplicationController
# GET /themengruppen/1.json # GET /themengruppen/1.json
def show def show
@themengruppe = Themengruppe.find(params[:id]) @themengruppe = Themengruppe.find(params[:id])
if can? :showdraft , Thema
@themen = @themengruppe.themen.order(:priority).reverse @themen = @themengruppe.themen.order(:priority).reverse
else
@themen = @themengruppe.themen.where(:isdraft=>false).order(:priority).reverse
end
@toolbar_elements = [] @toolbar_elements = []
@toolbar_elements << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t("themengruppe.manage"), :path=>themengruppe_verwalten_path(@themengruppe)} if can? :edit, @themengruppe @toolbar_elements << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t("themengruppe.manage"), :path=>themengruppe_verwalten_path(@themengruppe)} if can? :edit, @themengruppe

View File

@@ -38,7 +38,7 @@ class Ability
can [:show, :index], Lva can [:show, :index], Lva
can [:show,:index], Gallery can [:show,:index], Gallery
can [:show, :index,:faqs], Themengruppe can [:show, :index,:faqs], Themengruppe
can [:show], Thema can [:show], Thema, :isdraft=>false
can [:create], Beispiel can [:create], Beispiel
can [:show, :index], Fetprofile can [:show, :index], Fetprofile
can [:show, :index],Gremium can [:show, :index],Gremium
@@ -53,7 +53,7 @@ class Ability
if( user.has_role?("fetuser") || user.has_role?("fetadmin")) if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
can :manage,:all can :manage,:all
can :manage, Modulgruppe can :manage, Modulgruppe
can :showdraft , Thema
can [:show,:index], Calendar can [:show,:index], Calendar
can [:edit, :update,:new,:create,:verwalten], Calendar can [:edit, :update,:new,:create,:verwalten], Calendar
can [:edit, :update,:new,:create,:verwalten], Calentry can [:edit, :update,:new,:create,:verwalten], Calentry

View File

@@ -21,11 +21,12 @@ include Rails.application.routes.url_helpers
validates :themengruppe, :presence => true validates :themengruppe, :presence => true
validates :title, :presence => true validates :title, :presence => true
validates :text, :presence => true validates :text, :presence => true
scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")} scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
scope :outdated, -> {where("updated_at < ?", 1.week.ago)} scope :outdated, -> {where("updated_at < ?", 2.month.ago)}
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
def is_outdated? def is_outdated?
updated_at < 1.week.ago updated_at < 1.month.ago
end end
def is_wiki? def is_wiki?
!(wikiname.nil? || wikiname.empty?) !(wikiname.nil? || wikiname.empty?)

View File

@@ -21,7 +21,7 @@ class Themengruppe < ActiveRecord::Base
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
scope :intern,-> {where(:public=>false)} scope :intern,-> {where("NOT public")}
scope :public,-> {where(:public=>true)} scope :public,-> {where(:public=>true)}
def self.find_wiki_default def self.find_wiki_default

View File

@@ -26,6 +26,12 @@ end
version :thumb_small do version :thumb_small do
process :resize_to_fill => [32, 32] process :resize_to_fill => [32, 32]
end end
version :thumb_big do
process :resize_to_fill => [200,200]
end
version :resized do
process :resize_to_fit => [1024,1024]
end
# Provide a default URL as a default if there hasn't been a file uploaded: # Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url # def default_url

View File

@@ -33,8 +33,10 @@
</div> </div>
</div> </div>
<% unless I18n.locale == :de %> <% unless I18n.locale == :de %>
@thema.text <% I18n.with_locale(:de) do %>
<% end %> <%= raw(@thema.text) %>
<% end %><% end %>
<%= f.actions do %> <%= f.actions do %>
<%= f.action :submit, :as => :button, :label=> I18n.t("thema.save" ) %> <%= f.action :submit, :as => :button, :label=> I18n.t("thema.save" ) %>
<%= f.action :submit, :as => :button, :label=> I18n.t("thema.savecont"), :button_html=>{:value=>"continue"} %> <%= f.action :submit, :as => :button, :label=> I18n.t("thema.savecont"), :button_html=>{:value=>"continue"} %>

View File

@@ -2,10 +2,10 @@
<h2><%= small.title %> <%= link_to fa_icon("pencil"), verwalten_thema_path(small) if can? :edit, small %></h2> <h2><%= small.title %> <%= link_to fa_icon("pencil"), verwalten_thema_path(small) if can? :edit, small %></h2>
</a> </a>
<% if small.is_outdated? %> <% if small.is_outdated? %>
<div style="background:red; width:100%"> Outdated </div> <div class="sticker sticker-red"> <%= I18n.t("thema.outdated") %> </div>
<% end %> <% end %>
<% if small.isdraft %> <% if small.isdraft %>
<div style="background:yellow; width:100%"> isdraft </div> <div class="sticker sticker-yellow"><%= I18n.t("thema.isdraft") %> </div>
<% end %> <% end %>
<%= raw(small.text) %> <%= raw(small.text) %>
@@ -19,8 +19,9 @@
<%= raw(frage.text) %> <%= raw(frage.text) %>
</p> </p>
<% end %> <% end %>
<% unless small.hideattachment %>
<%= render partial: "themen/attachment_list", object: small.attachments, locals:{editor: false} unless small.attachments.empty? %> <%= render partial: "themen/attachment_list", object: small.attachments, locals:{editor: false} unless small.attachments.empty? %>
<% end %>
<br/> <br/>

View File

@@ -26,7 +26,7 @@
<div class="span6"> <div class="span6">
<!--<b><%= I18n.t("themengruppe.themen") %></b> <!--<b><%= I18n.t("themengruppe.themen") %></b>
--><ul> --><ul>
<% themengruppe.themen.order(:priority).reverse.each do |t| %> <% themengruppe.themen.where(" (NOT hidelink) and ( NOT isdraft) ").order(:priority).reverse.each do |t| %>
<li> <li>
<%= render t %> <%= render t %>
</li> </li>

View File

@@ -21,7 +21,9 @@
<% end %> <% end %>
<% thema.nlinks.each do |l| %> <% thema.nlinks.each do |l| %>
<li><%= render l.neuigkeit %></li> <li>
<%= render l.neuigkeit %>
</li>
<% end %> <% end %>
</ul> </ul>

View File

@@ -19,6 +19,8 @@ de:
created: "Thema erfolgreich erstellt" created: "Thema erfolgreich erstellt"
updated: "Thema erfolgreich gespeichert" updated: "Thema erfolgreich gespeichert"
sure: "Sicher, dass Sie dieses Thema löschen möchten?" sure: "Sicher, dass Sie dieses Thema löschen möchten?"
isdraft: "Entwurf"
outdated: "Veraltete Information"
frage: frage:
add: "Frage hinzufügen" add: "Frage hinzufügen"
edit: "Frage bearbeiten" edit: "Frage bearbeiten"
@@ -33,6 +35,9 @@ de:
title: "Themen Überschrift" title: "Themen Überschrift"
text: "Text" text: "Text"
themengruppe: "Gruppe" themengruppe: "Gruppe"
isdraft: "Entwurf"
hideattachment: "Anhangtabelle ausblenden"
hidelink: "Thema in Überblick nicht anzeigen"
themengruppe: themengruppe:
title: "Überschrift" title: "Überschrift"
priority: "Sortierung" priority: "Sortierung"

View File

@@ -2,9 +2,8 @@
themes_for_rails themes_for_rails
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
resources :home, :only=>[:index] do resources :home, :only=>[:index] do
end end
#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
@@ -18,28 +17,18 @@
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'
get 'config',:controller=>:config,:action=>:index , :as => 'config' get 'config',:controller=>:config,:action=>:index , :as => 'config'
end 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 scope '(t/:theme)' do
get "wiki/:name", action: :wiki, controller: :wikis get "wiki/:name", action: :wiki, controller: :wikis
resources :wikis do resources :wikis
member do
end
end end
end end
end
# end
# end
scope '(:locale)' do scope '(:locale)' do
scope '(t/:theme)' do scope '(t/:theme)' do
# Studien
scope '(:ansicht)' do scope '(:ansicht)' do
resources :studien, :only=>[:new,:edit,:update,:destroy,:show] do resources :studien, :only=>[:new,:edit,:update,:destroy,:show] do
@@ -54,30 +43,9 @@
resources :studien,:except=>[:show,:new,:edit,:update,:destroy], :shallow=>true do resources :studien,:except=>[:show,:new,:edit,:update,:destroy], :shallow=>true do
resources :modulgruppen, :path => "(:locale)/modulgruppen" resources :modulgruppen, :path => "(:locale)/modulgruppen"
end end
get 'verwalten/studien', :controller=>:studien, :action=>:verwalten, :as=>'studien_verwalten' get 'verwalten/studien', :controller=>:studien, :action=>:verwalten, :as=>'studien_verwalten'
resources :fetzneditions
resources :galleries do
collection do
get 'verwalten'
end
resources :fotos
end
resources :gremien do
collection do
get 'verwalten'
end
end
resources :fetprofiles do
collection do
get 'verwalten'
get 'internlist'
end
resources :memberships, :only => [:new, :edit, :update,:destroy,:create]
end
resources :lecturers resources :lecturers
resources :semesters resources :semesters
resources :moduls do resources :moduls do
@@ -104,12 +72,29 @@
end end
resources :fragen resources :fetzneditions
# get 'rubriken/verwalten', :controller=>:rubriken, :action=>:alle_verwalten, :as=>'alle_verwalten_rubrik' resources :galleries do
#resources :neuigkeiten, :except => [:index] do collection do
get 'verwalten'
end
resources :fotos
end
resources :gremien do
collection do
get 'verwalten'
end
end
resources :fetprofiles do
collection do
get 'verwalten'
get 'internlist'
end
end
resources :fragen, :only =>[:new, :edit, :update, :destroy, :create]
#end
resources :neuigkeiten, :only =>[:show]
resources :rubriken do resources :rubriken do
collection do collection do
@@ -121,6 +106,7 @@
put 'addmoderator' put 'addmoderator'
get 'removemoderator' get 'removemoderator'
end end
resources :neuigkeiten, :except => [:index] do resources :neuigkeiten, :except => [:index] do
member do member do
get 'publish' get 'publish'
@@ -134,10 +120,6 @@
end end
end end
# put 'rubriken/(:id)/addmoderator',:controller=>:rubriken,:action=>:addmoderator
# get 'rubriken/:id/verwalten',:controller=>:rubriken,:action=>:verwalten, :as=>'verwalten_rubrik'
# get 'rubriken/verwalten',:controller=>:rubriken,:action=>:alle_verwalten, :as=>'rubriken_verwalten'
resources :home, :only=>[:index] do resources :home, :only=>[:index] do
get :search, :on => :collection get :search, :on => :collection
collection do collection do
@@ -150,15 +132,6 @@
end end
end end
resources :themen do
member do
get :attachments
get :fragen
get :verwalten
end
resources :attachments
end
resources :themengruppen do resources :themengruppen do
get :verwalten get :verwalten
get :verwalten_all,:on=>:collection get :verwalten_all,:on=>:collection
@@ -168,68 +141,20 @@
resources :themen, :only=>[:new, :show] resources :themen, :only=>[:new, :show]
end end
resources :themen do
member do
get :attachments
get :fragen
get :verwalten
end
resources :attachments
end
resources :calendars resources :calendars
get 'verwalten/calendars', :controller=>:calendars, :action=>:verwalten, :as=>'calendars_verwalten' get 'verwalten/calendars', :controller=>:calendars, :action=>:verwalten, :as=>'calendars_verwalten'
resources :calentries resources :calentries
end end
end end
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
root :to => 'home#index' root :to => 'home#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id))(.:format)'
end end