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.
// They will automatically be included in application.css.
// 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;
display:block;
width: 90%;
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 'font-awesome';
@import 'neuigkeiten';
@import 'themengruppen';
div.header {
display: block;

View File

@@ -91,9 +91,14 @@ class FetprofilesController < ApplicationController
if @fetprofile.update_attributes(params[:fetprofile])
format.html {
unless params[:button]=="continue" || params[:commit]=="continue"
redirect_to @fetprofile, notice: 'Fetprofile was successfully updated.'
redirect_to @fetprofile, notice: 'profile was successfully updated.'
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
}
format.json { head :no_content }

View File

@@ -22,8 +22,11 @@ class ThemengruppenController < ApplicationController
# GET /themengruppen/1.json
def show
@themengruppe = Themengruppe.find(params[:id])
if can? :showdraft , Thema
@themen = @themengruppe.themen.order(:priority).reverse
else
@themen = @themengruppe.themen.where(:isdraft=>false).order(:priority).reverse
end
@toolbar_elements = []
@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], Gallery
can [:show, :index,:faqs], Themengruppe
can [:show], Thema
can [:show], Thema, :isdraft=>false
can [:create], Beispiel
can [:show, :index], Fetprofile
can [:show, :index],Gremium
@@ -53,7 +53,7 @@ class Ability
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
can :manage,:all
can :manage, Modulgruppe
can :showdraft , Thema
can [:show,:index], Calendar
can [:edit, :update,:new,:create,:verwalten], Calendar
can [:edit, :update,:new,:create,:verwalten], Calentry

View File

@@ -21,11 +21,12 @@ include Rails.application.routes.url_helpers
validates :themengruppe, :presence => true
validates :title, :presence => true
validates :text, :presence => true
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
def is_outdated?
updated_at < 1.week.ago
updated_at < 1.month.ago
end
def is_wiki?
!(wikiname.nil? || wikiname.empty?)

View File

@@ -21,7 +21,7 @@ class Themengruppe < ActiveRecord::Base
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)}
def self.find_wiki_default

View File

@@ -26,6 +26,12 @@ end
version :thumb_small do
process :resize_to_fill => [32, 32]
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:
# def default_url

View File

@@ -33,8 +33,10 @@
</div>
</div>
<% unless I18n.locale == :de %>
@thema.text
<% end %>
<% I18n.with_locale(:de) do %>
<%= raw(@thema.text) %>
<% end %><% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :button, :label=> I18n.t("thema.save" ) %>
<%= 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>
</a>
<% if small.is_outdated? %>
<div style="background:red; width:100%"> Outdated </div>
<div class="sticker sticker-red"> <%= I18n.t("thema.outdated") %> </div>
<% end %>
<% if small.isdraft %>
<div style="background:yellow; width:100%"> isdraft </div>
<div class="sticker sticker-yellow"><%= I18n.t("thema.isdraft") %> </div>
<% end %>
<%= raw(small.text) %>
@@ -19,8 +19,9 @@
<%= raw(frage.text) %>
</p>
<% end %>
<% unless small.hideattachment %>
<%= render partial: "themen/attachment_list", object: small.attachments, locals:{editor: false} unless small.attachments.empty? %>
<% end %>
<br/>

View File

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

View File

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