profile form fixed, themen isdraft

This commit is contained in:
2014-06-24 16:32:00 +05:30
parent a86d7482f1
commit 2ba920331a
9 changed files with 36 additions and 91 deletions

View File

@@ -12,7 +12,7 @@
require 'uri'
class Thema < ActiveRecord::Base
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 :attachments
belongs_to :themengruppe, :foreign_key => "themengruppe_id"
@@ -22,7 +22,11 @@ include Rails.application.routes.url_helpers
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)}
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
def is_outdated?
updated_at < 1.week.ago
end
def is_wiki?
!(wikiname.nil? || wikiname.empty?)
end

View File

@@ -68,7 +68,7 @@
<div class="span12">
<%= f.actions do %>
<%= 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") %>
<% end %>
</div>

View File

@@ -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 %>

View File

@@ -1,6 +0,0 @@
<h1>Editing membership</h1>
<%= render 'form' %>
<%= link_to 'Show', @membership %> |
<%= link_to 'Back', memberships_path %>

View File

@@ -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 %>

View File

@@ -1,5 +0,0 @@
<h1>New membership</h1>
<%= render 'form' %>
<%= link_to 'Back', @membership.fetprofile %>

View File

@@ -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 %>

View File

@@ -10,13 +10,31 @@
<div class="span6">
<%= f.input :themengruppe %>
</div>
</div>
<div class="row-fluid">
<div class="span4">
<%= f.input :isdraft %>
</div>
<div class="span4">
<%= f.input :hidelink, :as=>:boolean %>
</div>
<div class="span4">
<%= f.input :hideattachment %>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<%= f.input :text, :as=>:tinymce_text,:label=>false, :input_html=>{:rows=>20} %>
</div>
</div>
</div>
</div>
<% unless I18n.locale == :de %>
@thema.text
<% 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

@@ -1,6 +1,13 @@
<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>
</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) %>
<br/>