themen interface cleanup1

This commit is contained in:
2014-06-21 14:53:16 +05:30
parent 6fdee8a7d6
commit 6c9a1b51c4
15 changed files with 102 additions and 91 deletions

View File

@@ -91,6 +91,7 @@ gem 'bootstrap-addons-rails'
gem "jquery-fileupload-rails" gem "jquery-fileupload-rails"
gem "jquery-ui-rails","~> 4.1.1" gem "jquery-ui-rails","~> 4.1.1"
gem "font-awesome-rails" gem "font-awesome-rails"
gem "jquery-datetimepicker-rails"
# gem "jquery-sortable-rails" # gem "jquery-sortable-rails"
gem "seed_dump", "~> 0.5.3" gem "seed_dump", "~> 0.5.3"
#gem "themes_for_rails" ,:git =>'git://github.com/tkriplean/themes_for_rails.git' #gem "themes_for_rails" ,:git =>'git://github.com/tkriplean/themes_for_rails.git'

View File

@@ -12,6 +12,7 @@
*= require_self *= require_self
* require_tree . * require_tree .
*= require jquery.fileupload-ui *= require jquery.fileupload-ui
*= require jquery.datetimepicker
* require 'bootstrap' * require 'bootstrap'
* require 'neuigkeiten' * require 'neuigkeiten'

View File

@@ -3,24 +3,12 @@ class ThemenController < ApplicationController
# GET /themen.json # GET /themen.json
load_and_authorize_resource load_and_authorize_resource
def index
@themen = Thema.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @themen }
end
end
# GET /themen/1
# GET /themen/1.json
def show def show
@thema = Thema.find(params[:id]) @thema = Thema.find(params[:id])
@fragen=@thema.fragen @fragen=@thema.fragen
@toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>"Verwalten", :path=>verwalten_thema_path(@thema)}]
@toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}] @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t("thema.manage"), :path=>verwalten_thema_path(@thema)}]
@toolbar_elements << [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}]
@toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('thema.remove'), :path=>thema_path(@thema), :method=>:delete, :confirm=>I18n.t('thema.sure')} @toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('thema.remove'), :path=>thema_path(@thema), :method=>:delete, :confirm=>I18n.t('thema.sure')}
respond_to do |format| respond_to do |format|
@@ -33,10 +21,7 @@ class ThemenController < ApplicationController
def verwalten def verwalten
@thema = Thema.find(params[:id]) @thema = Thema.find(params[:id])
@attachment=Attachment.new @attachment=Attachment.new
@fragen=@thema.fragen @fragen=@thema.fragen
@toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>"Verwalten", :path=>verwalten_thema_path(@thema)}]
@toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}] @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}]
@toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('thema.remove'), :path=>thema_path(@thema), :method=>:delete, :confirm=>I18n.t('thema.sure')} @toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('thema.remove'), :path=>thema_path(@thema), :method=>:delete, :confirm=>I18n.t('thema.sure')}
@@ -73,11 +58,10 @@ class ThemenController < ApplicationController
def create def create
@thema = Thema.new(params[:thema]) @thema = Thema.new(params[:thema])
respond_to do |format| respond_to do |format|
if @thema.save if @thema.save
@themen = @thema.themengruppe.themen.order(:priority).reverse @themen = @thema.themengruppe.themen.order(:priority).reverse
format.html { redirect_to @thema, notice: 'Thema was successfully created.' } format.html { redirect_to @thema, notice: I18n.t("thema.created") }
format.json { render json: @thema, status: :created, location: @thema } format.json { render json: @thema, status: :created, location: @thema }
format.js {render action: "update"} format.js {render action: "update"}
else else
@@ -110,9 +94,10 @@ class ThemenController < ApplicationController
@themen = @thema.themengruppe.themen.order(:priority).reverse @themen = @thema.themengruppe.themen.order(:priority).reverse
@thema.assign_attributes(params[:thema]) @thema.assign_attributes(params[:thema])
@thema.fix_links(request.host_with_port) @thema.fix_links(request.host_with_port)
respond_to do |format| respond_to do |format|
if @thema.save if @thema.save
format.html { redirect_to @thema, notice: 'Thema was successfully updated.' } format.html { redirect_to @thema, notice: I18n.t("thema.updated") }
format.json { head :no_content } format.json { head :no_content }
format.js format.js
else else

View File

@@ -5,7 +5,7 @@ class ThemengruppenController < ApplicationController
def index def index
@themengruppen = Themengruppe.where(:public=>true).order(:priority).reverse @themengruppen = Themengruppe.where(:public=>true).order(:priority).reverse
@toolbar_elements = [{:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.new'), :path=>new_themengruppe_path()}] @toolbar_elements = [{:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.new'), :path=>new_themengruppe_path()}]
@toolbar_elements = [{:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('common.verwalten'), :path=>verwalten_all_themengruppen_path()}] @toolbar_elements = [{:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.manage_all'), :path=>verwalten_all_themengruppen_path()}]
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb

View File

@@ -1,8 +1,8 @@
<p> <p>
<b> <%= frage.title %> </b> <br/> <b> <%= frage.title %>? </b> <br/>
<%= raw(frage.text) %> <%= raw(frage.text) %>
<br/> <br/>
<%= link_to 'Edit', edit_frage_path(frage),:remote=>true %> | <%= link_to 'Edit', edit_frage_path(frage),:remote=>true %>
<%= link_to 'Destroy',frage, method: :delete, :remote=> true , data: { confirm: 'Are you sure?' } %> <%= link_to 'Destroy',frage, method: :delete, :remote=> true , data: { confirm: I18n.t("frage.sure") } %>
</p> </p>

View File

@@ -33,5 +33,5 @@
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<script>$('.datepicker').datepicker()</script> <script>$('.datetimepicker').datetimepicker({format: 'd.m.Y H:i'})</script>
<%= tinymce %> <%= tinymce %>

View File

@@ -1,33 +1,29 @@
<%= tinymce_assets %> <%= tinymce_assets %>
<div class="container-fluid"> <div class="container-fluid">
<%= semantic_form_for @thema, :remote=>remote do |f| %>
<%= semantic_form_for @thema, :remote=>remote do |f| %>
<%= f.inputs do %> <%= f.inputs do %>
<div class="row-fluid"> <div class="row-fluid">
<div class="span6"> <div class="span6">
<%= f.input :title %> <%= f.input :title %>
</div> </div>
<div class="span6"> <div class="span6">
<%= f.input :themengruppe %> <%= f.input :themengruppe %>
</div> </div>
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <div class="span12">
<%= f.input :text, :as=>:tinymce_text,:label=>false, :input_html=>{:rows=>20} %> <%= f.input :text, :as=>:tinymce_text,:label=>false, :input_html=>{:rows=>20} %>
</div> </div>
</div> </div>
</div>
<%= f.actions do %>
</div> <%= f.action :submit, :as => :button %>
<%= f.action :submit, :as => :button, :label=> "&edit", :params=>{edit: true} %>
<%= f.actions do %> <%= f.action :cancel, :as => :link %>
<%= f.action :submit, :as => :button %> <% end %>
<% end %><% end %>
<%= f.action :cancel, :as => :link %>
<% end %>
<% end %><% end %>
<%= tinymce %> <%= tinymce %>
<h2>Attachments:</h2> <h2>Attachments:</h2>
<%= render :partial => "themen/select", :object => @thema,:locals =>{ :editor => :true} %> <%= render :partial => "themen/select", :object => @thema,:locals =>{ :editor => :true} %>

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(:title).each do |t| %> <% themengruppe.themen.order(:priority).reverse.each do |t| %>
<li> <li>
<%= render t %> <%= render t %>
</li> </li>

View File

@@ -1,3 +1,4 @@
<h1><%= I18n.t("themengruppe.faqs") %>
<div class="content-wrap content-column"> <div class="content-wrap content-column">
<% @themengruppen.each do |tg| %> <% @themengruppen.each do |tg| %>
<div class="contentbox"> <div class="contentbox">
@@ -8,7 +9,7 @@
<li> <%= t.title %> <li> <%= t.title %>
<ul> <% t.fragen.each do |f| %> <ul> <% t.fragen.each do |f| %>
<li> <li>
<b> <%= f.title %></b> <b> <%= f.title %>?</b>
<p> <%= f.text %></p> <p> <%= f.text %></p>
</li> </li>

View File

@@ -1,7 +1,7 @@
<div class="content-wrap content-column"> <div class="content-wrap content-column">
<%= render :partial=>'layouts/pretty_toolbar' %> <%= render :partial=>'layouts/pretty_toolbar' %>
<p> <p>
<%= link_to "FAQS", faqs_themengruppen_path,class: :btn %> <%= link_to I18n.t("themengruppe.faqs"), faqs_themengruppen_path,class: :btn %>
</p> </p>
<ul class="unstyled linkbox-list"> <ul class="unstyled linkbox-list">
<li> <li>

View File

@@ -1,6 +1,6 @@
<div class="content-wrap content-column" > <div class="content-wrap content-column" >
<%= link_to fa_icon("arrow-circle-left 2x")+" Alle Themengruppen", themengruppen_path, :class=>"linkbox" %> <%= link_to fa_icon("arrow-circle-left 2x")+I18n.t("themengruppe.showall"), themengruppen_path, :class=>"linkbox" %>
<%= link_to fa_icon("question 2x")+" Häufige Fragen", faqs_themengruppen_path(:anchor=>"themengruppe_"+@themengruppe.id.to_s), :class=>"linkbox" %> <%= link_to fa_icon("question 2x")+ I18n.t("themengruppe.faqs"), faqs_themengruppen_path(:anchor=>"themengruppe_"+@themengruppe.id.to_s), :class=>"linkbox" %>
<%= render :partial=>'layouts/pretty_toolbar' %> <%= render :partial=>'layouts/pretty_toolbar' %>
<h1><%= @themengruppe.title %></h1> <h1><%= @themengruppe.title %></h1>
@@ -13,11 +13,8 @@
<li> <li>
<div class="contentbox"> <div class="contentbox">
<%= render :partial => 'themen/small', :object => thema %> <%= render :partial => 'themen/small', :object => thema %>
<ul class="unstyled"> <ul class="unstyled">
<% unless thema.gremium.nil? %> <% unless thema.gremium.nil? %>
<li> <li>
<%= link_to fa_icon("users 2x")+thema.gremium.name , thema.gremium,:class=>"linkbox" %> <%= link_to fa_icon("users 2x")+thema.gremium.name , thema.gremium,:class=>"linkbox" %>
</li> </li>
@@ -26,9 +23,7 @@
<% thema.nlinks.each do |l| %> <% thema.nlinks.each do |l| %>
<li><%= render l.neuigkeit %></li> <li><%= render l.neuigkeit %></li>
<% end %> <% end %>
<% thema.nlinks.each do |l| %>
<li><%= render l.neuigkeit %></li>
<% end %>
</ul> </ul>
</div> </div>
</li> </li>

View File

@@ -9,7 +9,6 @@ de:
actions: "Aktionen" actions: "Aktionen"
delete: "Löschen" delete: "Löschen"
verwalten: "Verwalten" verwalten: "Verwalten"
back: "Zurück"
sure_del: "Sicher endgültig löschen?" sure_del: "Sicher endgültig löschen?"
home: home:
sprache: "Deutsch" sprache: "Deutsch"

View File

@@ -6,13 +6,21 @@ en:
common: common:
back: "Back" back: "Back"
edit: "Edit" edit: "Edit"
actions: "Actions"
delete: "Delete"
verwalten: "Manage"
sure_del: "Are you sure you want to delete this?"
home: home:
sprache: "English" sprache: "English"
kontakt: "Contact"
mtitle: "Menu" mtitle: "Menu"
hallobeiderfet: "This is the page of Fachschaft Elektrotechnik at TU Wien" hallobeiderfet: "This is the page of Fachschaft Elektrotechnik at TU Wien"
home: "Home" home: "Home"
studien: "Studies" studien: "Studies"
news: "News" news: "News"
info: "Information" info: "Information"
mitarbeiter: "Members"
fotos: "Fotos"
search: "Search"
willkommen: "Welcome at Fachschaft Elektrotechnik" willkommen: "Welcome at Fachschaft Elektrotechnik"

View File

@@ -6,10 +6,16 @@ de:
remove: "Themengruppe löschen" remove: "Themengruppe löschen"
sure: "Sicher, dass Sie diese Themengruppe löschen möchten?" sure: "Sicher, dass Sie diese Themengruppe löschen möchten?"
manage: "Themengruppe verwalten" manage: "Themengruppe verwalten"
manage_all: "Alle Themengruppen verwalten"
showall: "Alle Themengruppen anzeigen"
faqs: "Häufig gestellte Fragen"
thema: thema:
add: "Thema hinzufügen" add: "Thema hinzufügen"
edit: "Thema bearbeiten" edit: "Thema bearbeiten"
remove: "Thema löschen" remove: "Thema löschen"
manage: "Thema verwalten"
created: "Thema erfolgreich erstellt"
updated: "Thema erfolgreich gespeichert"
sure: "Sicher, dass Sie dieses Thema löschen möchten?" sure: "Sicher, dass Sie dieses Thema löschen möchten?"
frage: frage:
add: "Frage hinzufügen" add: "Frage hinzufügen"
@@ -22,8 +28,19 @@ de:
formtastic: formtastic:
labels: labels:
thema: thema:
title: "Themen Name" title: "Themen Überschrift"
text: "Text"
themengruppe: "Gruppe" themengruppe: "Gruppe"
themengruppe:
title: "Überschrift"
priority: "Sortierung"
public: "öffentlich"
picture: "Icon"
text: "Beschreibung"
frage:
title: "Frage"
text: "Antwort"
thema: "Thema"
hints: hints:
thema: thema:
title: "Überschrift" title: "Überschrift"
@@ -34,3 +51,5 @@ de:
attributes: attributes:
title: title:
blank: "Der Themen Name darf nicht leer sein!" blank: "Der Themen Name darf nicht leer sein!"
text:
blank: "Bitte Text hinzufügen"

View File

@@ -0,0 +1,6 @@
class AddDraftToThemen < ActiveRecord::Migration
def change
add_column :themen, :hideattachment, :boolean
add_column :themen, :isdraft, :boolean
end
end