profile form fixed, themen isdraft
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
require 'uri'
|
require 'uri'
|
||||||
class Thema < ActiveRecord::Base
|
class Thema < ActiveRecord::Base
|
||||||
include Rails.application.routes.url_helpers
|
include Rails.application.routes.url_helpers
|
||||||
attr_accessible :text, :title, :themengruppe_id
|
attr_accessible :text, :title, :themengruppe_id,:isdraft, :hidelink, :hideattachment
|
||||||
has_many :fragen
|
has_many :fragen
|
||||||
has_many :attachments
|
has_many :attachments
|
||||||
belongs_to :themengruppe, :foreign_key => "themengruppe_id"
|
belongs_to :themengruppe, :foreign_key => "themengruppe_id"
|
||||||
@@ -22,7 +22,11 @@ include Rails.application.routes.url_helpers
|
|||||||
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)}
|
||||||
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
|
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
|
||||||
|
def is_outdated?
|
||||||
|
updated_at < 1.week.ago
|
||||||
|
end
|
||||||
def is_wiki?
|
def is_wiki?
|
||||||
!(wikiname.nil? || wikiname.empty?)
|
!(wikiname.nil? || wikiname.empty?)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
<div class="span12">
|
<div class="span12">
|
||||||
<%= f.actions do %>
|
<%= f.actions do %>
|
||||||
<%= f.action :submit, :as => :input , :label=>I18n.t("common.save") %>
|
<%= f.action :submit, :as => :input , :label=>I18n.t("common.save") %>
|
||||||
<%= f.action :submit, :as => :input, :button_html=>{value: "continue"} , :label=>I18n.t("common.savecont") %>
|
<%= f.action :submit, :as => :input , :label=>I18n.t("common.savecont"), :button_html=>{value: "continue"} %>
|
||||||
<%= f.action :cancel, :as=> :link , :label=>I18n.t("common.cancel") %>
|
<%= f.action :cancel, :as=> :link , :label=>I18n.t("common.cancel") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
<%= semantic_form_for [@membership.fetprofile,@membership] do |f| %>
|
|
||||||
<%= f.inputs do %>
|
|
||||||
<%= f.input :gremium, :as=>:radio %>
|
|
||||||
<%= f.input :start %>
|
|
||||||
<%= f.input :stop %>
|
|
||||||
<%= f.input :typ ,:as=>:radio,:collection=>Membership::TYPEN.invert %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= f.actions do %>
|
|
||||||
<%= f.action :submit, :as => :input %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<h1>Editing membership</h1>
|
|
||||||
|
|
||||||
<%= render 'form' %>
|
|
||||||
|
|
||||||
<%= link_to 'Show', @membership %> |
|
|
||||||
<%= link_to 'Back', memberships_path %>
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
<h1>Listing memberships</h1>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>Fetprofile</th>
|
|
||||||
<th>Gremium</th>
|
|
||||||
<th>Start</th>
|
|
||||||
<th>Stop</th>
|
|
||||||
<th>Typ</th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% @memberships.each do |membership| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= membership.fetprofile_id %></td>
|
|
||||||
<td><%= membership.gremium_id %></td>
|
|
||||||
<td><%= membership.start %></td>
|
|
||||||
<td><%= membership.stop %></td>
|
|
||||||
<td><%= membership.typ %></td>
|
|
||||||
<td><%= link_to 'Show', membership %></td>
|
|
||||||
<td><%= link_to 'Edit', edit_membership_path(membership) %></td>
|
|
||||||
<td><%= link_to 'Destroy', membership, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<%= link_to 'New Membership', new_membership_path %>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<h1>New membership</h1>
|
|
||||||
|
|
||||||
<%= render 'form' %>
|
|
||||||
|
|
||||||
<%= link_to 'Back', @membership.fetprofile %>
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
<p id="notice"><%= notice %></p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<b>Fetprofile:</b>
|
|
||||||
<%= @membership.fetprofile_id %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<b>Gremium:</b>
|
|
||||||
<%= @membership.gremium_id %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<b>Start:</b>
|
|
||||||
<%= @membership.start %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<b>Stop:</b>
|
|
||||||
<%= @membership.stop %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<b>Typ:</b>
|
|
||||||
<%= @membership.typ %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
|
||||||
<%= link_to 'Edit', edit_membership_path(@membership) %> |
|
|
||||||
<%= link_to 'Back', memberships_path %>
|
|
||||||
@@ -10,13 +10,31 @@
|
|||||||
<div class="span6">
|
<div class="span6">
|
||||||
<%= f.input :themengruppe %>
|
<%= f.input :themengruppe %>
|
||||||
</div>
|
</div>
|
||||||
<div class="row-fluid">
|
</div>
|
||||||
<div class="span12">
|
<div class="row-fluid">
|
||||||
<%= f.input :text, :as=>:tinymce_text,:label=>false, :input_html=>{:rows=>20} %>
|
<div class="span4">
|
||||||
</div>
|
<%= f.input :isdraft %>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="span4">
|
||||||
|
<%= f.input :hidelink, :as=>:boolean %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="span4">
|
||||||
|
<%= f.input :hideattachment %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<%= f.input :text, :as=>:tinymce_text,:label=>false, :input_html=>{:rows=>20} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% unless I18n.locale == :de %>
|
||||||
|
@thema.text
|
||||||
|
<% 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"} %>
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
<a name="thema_<%=small.id%>" href="#<%=small.id%>">
|
<a name="thema_<%=small.id%>" href="#<%=small.id%>">
|
||||||
<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? %>
|
||||||
|
<div style="background:red; width:100%"> Outdated </div>
|
||||||
|
<% end %>
|
||||||
|
<% if small.isdraft %>
|
||||||
|
<div style="background:yellow; width:100%"> isdraft </div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
<%= raw(small.text) %>
|
<%= raw(small.text) %>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user