mirror of
https://github.com/Threnklyn/Klaus.git
synced 2026-05-18 12:13:28 +02:00
Klaus V2.0
This commit is contained in:
@@ -15,4 +15,6 @@
|
||||
/log/*.log
|
||||
/tmp
|
||||
|
||||
/public/uploads
|
||||
/public/assets
|
||||
.rvmrc
|
||||
@@ -47,3 +47,12 @@ gem 'bootstrap_form', github: 'bootstrap-ruby/rails-bootstrap-forms'
|
||||
|
||||
# Table generation
|
||||
gem "wice_grid"
|
||||
|
||||
# File Upload
|
||||
gem 'carrierwave'
|
||||
|
||||
# User Verwaltung
|
||||
gem 'devise'
|
||||
|
||||
# Autostrip whitespaces
|
||||
gem "auto_strip_attributes", "~> 2.0"
|
||||
|
||||
@@ -34,7 +34,15 @@ GEM
|
||||
thread_safe (~> 0.1)
|
||||
tzinfo (~> 1.1)
|
||||
arel (5.0.1.20140414130214)
|
||||
auto_strip_attributes (2.0.6)
|
||||
activerecord (>= 3.0)
|
||||
bcrypt (3.1.7)
|
||||
builder (3.2.2)
|
||||
carrierwave (0.10.0)
|
||||
activemodel (>= 3.2.0)
|
||||
activesupport (>= 3.2.0)
|
||||
json (>= 1.7)
|
||||
mime-types (>= 1.16)
|
||||
coffee-rails (4.0.1)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
@@ -43,6 +51,12 @@ GEM
|
||||
execjs
|
||||
coffee-script-source (1.7.1)
|
||||
commonjs (0.2.7)
|
||||
devise (3.2.4)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 3.2.6, < 5)
|
||||
thread_safe (~> 0.1)
|
||||
warden (~> 1.2.3)
|
||||
erubis (2.7.0)
|
||||
execjs (2.2.1)
|
||||
hike (1.2.3)
|
||||
@@ -71,6 +85,7 @@ GEM
|
||||
mime-types (1.25.1)
|
||||
minitest (5.4.0)
|
||||
multi_json (1.10.1)
|
||||
orm_adapter (0.5.0)
|
||||
polyglot (0.3.5)
|
||||
rack (1.5.2)
|
||||
rack-test (0.6.2)
|
||||
@@ -134,6 +149,8 @@ GEM
|
||||
uglifier (2.5.3)
|
||||
execjs (>= 0.3.0)
|
||||
json (>= 1.8.0)
|
||||
warden (1.2.3)
|
||||
rack (>= 1.0)
|
||||
wice_grid (3.4.9)
|
||||
coffee-rails
|
||||
kaminari (>= 0.13.0)
|
||||
@@ -142,8 +159,11 @@ PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
auto_strip_attributes (~> 2.0)
|
||||
bootstrap_form!
|
||||
carrierwave
|
||||
coffee-rails (~> 4.0.0)
|
||||
devise
|
||||
jbuilder (~> 2.0)
|
||||
jquery-rails
|
||||
less-rails-bootstrap
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
@@ -15,3 +15,11 @@
|
||||
*= require rails_bootstrap_forms
|
||||
*= require_self
|
||||
*/
|
||||
|
||||
.navbar {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
.page-header{
|
||||
margin-top: 0px;
|
||||
padding-top: 0px;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
class DocTypesController < ApplicationController
|
||||
before_filter :authenticate_user!, :only => [:destroy, :edit, :update ]
|
||||
|
||||
def index
|
||||
@doc_types_grid = initialize_grid(DocType)
|
||||
end
|
||||
|
||||
def new
|
||||
@doc_type = DocType.new
|
||||
end
|
||||
|
||||
def create
|
||||
@doc_type = DocType.new(doc_type_param)
|
||||
|
||||
if @doc_type.save
|
||||
redirect_to documents_path, notice: 'DocType was successfully created.'
|
||||
else
|
||||
flash.now[:alert] = 'DocType creation failed.'
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@doc_type = DocType.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@doc_type = DocType.find(params[:id])
|
||||
if @doc_type.update(doc_type_param)
|
||||
redirect_to doc_types_path, notice: 'DocType was successfully updated.'
|
||||
else
|
||||
flash.now[:alert] = 'DocType update failed.'
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@doc_type = DocType.find(params[:id])
|
||||
@doc_type.destroy
|
||||
|
||||
redirect_to doc_types_path, notice: 'DocType was successfully destroyed.'
|
||||
end
|
||||
private
|
||||
def doc_type_param
|
||||
params.require(:doc_type).permit(:name)
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,8 @@
|
||||
class DocumentsController < ApplicationController
|
||||
before_filter :authenticate_user!, :only => [:destroy, :edit, :update ]
|
||||
|
||||
def index
|
||||
@documents_grid = initialize_grid(Document)
|
||||
@documents_grid = initialize_grid(Document, include: [:lesson, :doc_type, :semester, :professor])
|
||||
end
|
||||
|
||||
def new
|
||||
@@ -13,13 +15,39 @@ class DocumentsController < ApplicationController
|
||||
if @document.save
|
||||
redirect_to documents_path, notice: 'Document was successfully created.'
|
||||
else
|
||||
lash.now[:alert] = 'Document creation failed.'
|
||||
flash.now[:alert] = 'Document creation failed.'
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@document = Document.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@document = Document.find(params[:id])
|
||||
|
||||
if @document.update(document_update_params)
|
||||
redirect_to documents_path, notice: 'Document was successfully updated.'
|
||||
else
|
||||
flash.now[:alert] = 'Document update failed.'
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@document = Document.find(params[:id])
|
||||
@document.destroy
|
||||
|
||||
redirect_to documents_path, notice: 'Document was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
def document_params
|
||||
params.require(:document).permit(:name)
|
||||
params.require(:document).permit(:doc_type_id, :semester_id, :professor_id, :file, :file_cache, :lesson_id)
|
||||
end
|
||||
|
||||
def document_update_params
|
||||
params.require(:document).permit(:doc_type_id, :semester_id, :professor_id, :lesson_id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
class LessonsController < ApplicationController
|
||||
before_filter :authenticate_user!, :only => [:destroy, :edit, :update ]
|
||||
|
||||
def index
|
||||
@lessons_grid = initialize_grid(Lesson)
|
||||
end
|
||||
|
||||
def new
|
||||
@lesson = Lesson.new
|
||||
end
|
||||
|
||||
def create
|
||||
@lesson = Lesson.new(lesson_params)
|
||||
|
||||
if @lesson.save
|
||||
redirect_to documents_path, notice: 'Lesson was successfully created.'
|
||||
else
|
||||
flash.now[:alert] = 'Lesson creation failed.'
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@lesson = Lesson.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@lesson = Lesson.find(params[:id])
|
||||
if @lesson.update(lesson_params)
|
||||
redirect_to lessons_path, notice: 'Lesson was successfully updated.'
|
||||
else
|
||||
flash.now[:alert] = 'Lesson update failed.'
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@lesson = Lesson.find(params[:id])
|
||||
@lesson.destroy
|
||||
|
||||
redirect_to lessons_path, notice: 'Lesson was successfully destroyed.'
|
||||
end
|
||||
private
|
||||
def lesson_params
|
||||
params.require(:lesson).permit(:name, :short_name)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,46 @@
|
||||
class ProfessorsController < ApplicationController
|
||||
before_filter :authenticate_user!, :only => [:destroy, :edit, :update ]
|
||||
|
||||
def index
|
||||
@professors_grid = initialize_grid(Professor)
|
||||
end
|
||||
|
||||
def new
|
||||
@professor = Professor.new
|
||||
end
|
||||
|
||||
def create
|
||||
@professor = Professor.new(professor_params)
|
||||
|
||||
if @professor.save
|
||||
redirect_to documents_path, notice: 'Professor was successfully created.'
|
||||
else
|
||||
flash.now[:alert] = 'Professor creation failed.'
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
def edit
|
||||
@professor = Professor.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@professor = Professor.find(params[:id])
|
||||
if @professor.update(professor_params)
|
||||
redirect_to professors_path, notice: 'Professor was successfully updated.'
|
||||
else
|
||||
flash.now[:alert] = 'Professor update failed.'
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@professor = Professor.find(params[:id])
|
||||
@professor.destroy
|
||||
|
||||
redirect_to professors_path, notice: 'Professor was successfully destroyed.'
|
||||
end
|
||||
private
|
||||
def professor_params
|
||||
params.require(:professor).permit(:first_name, :last_name)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,47 @@
|
||||
class SemestersController < ApplicationController
|
||||
before_filter :authenticate_user!, :only => [:destroy, :edit, :update ]
|
||||
|
||||
def index
|
||||
@semesters_grid = initialize_grid(Semester)
|
||||
end
|
||||
|
||||
def new
|
||||
@semester = Semester.new
|
||||
end
|
||||
|
||||
def create
|
||||
@semester = Semester.new(semester_params)
|
||||
|
||||
if @semester.save
|
||||
redirect_to documents_path, notice: 'Semester was successfully created.'
|
||||
else
|
||||
flash.now[:alert] = 'Semester creation failed.'
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@semester = Semester.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@semester = Semester.find(params[:id])
|
||||
if @semester.update(semester_params)
|
||||
redirect_to semesters_path, notice: 'Semester was successfully updated.'
|
||||
else
|
||||
flash.now[:alert] = 'Semester update failed.'
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@semester = Semester.find(params[:id])
|
||||
@semester.destroy
|
||||
|
||||
redirect_to semesters_path, notice: 'Semester was successfully destroyed.'
|
||||
end
|
||||
private
|
||||
def semester_params
|
||||
params.require(:semester).permit(:name)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
module ToDropdown
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def to_option
|
||||
[name, id]
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
def to_dropdown
|
||||
all.order(:name).map(&:to_option)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
class DocType < ActiveRecord::Base
|
||||
include ToDropdown
|
||||
has_many :documents
|
||||
|
||||
auto_strip_attributes :name, squish: true
|
||||
auto_strip_attributes :name, nullify: true
|
||||
|
||||
validates :name, presence: true
|
||||
validates :name, uniqueness: true
|
||||
end
|
||||
+21
-1
@@ -1,3 +1,23 @@
|
||||
class Document < ActiveRecord::Base
|
||||
validates :name, presence: true
|
||||
belongs_to :doc_type
|
||||
belongs_to :professor
|
||||
belongs_to :semester
|
||||
belongs_to :lesson
|
||||
|
||||
mount_uploader :file, DocumentUploader
|
||||
|
||||
validates :doc_type_id, presence: true
|
||||
validates :professor_id, presence: true
|
||||
validates :semester_id, presence: true
|
||||
validates :lesson_id, presence: true
|
||||
validates_presence_of :file
|
||||
validates_integrity_of :file
|
||||
validates_processing_of :file
|
||||
|
||||
before_validation :set_position
|
||||
|
||||
private
|
||||
def set_position
|
||||
self.position = (Document.where(doc_type: self.doc_type, professor: self.professor, semester: self.semester, lesson: self.lesson).maximum(:position) || 0) + 1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
class Lesson < ActiveRecord::Base
|
||||
include ToDropdown
|
||||
has_many :documents
|
||||
|
||||
auto_strip_attributes :name, squish: true
|
||||
auto_strip_attributes :name, nullify: true
|
||||
|
||||
auto_strip_attributes :short_name, squish: true
|
||||
auto_strip_attributes :short_name, nullify: true
|
||||
|
||||
validates :name, presence: true
|
||||
validates :name, uniqueness: true
|
||||
end
|
||||
@@ -0,0 +1,28 @@
|
||||
class Professor < ActiveRecord::Base
|
||||
include ToDropdown
|
||||
has_many :documents
|
||||
|
||||
auto_strip_attributes :first_name, squish: true
|
||||
auto_strip_attributes :first_name, nullify: true
|
||||
auto_strip_attributes :last_name, squish: true
|
||||
auto_strip_attributes :last_name, nullify: true
|
||||
|
||||
validates :first_name, presence: true
|
||||
validates :last_name, presence: true
|
||||
|
||||
def name_last_first
|
||||
"#{self.last_name}, #{self.first_name}"
|
||||
end
|
||||
|
||||
def name_first_name
|
||||
"#{self.first_name} #{self.last_name}"
|
||||
end
|
||||
|
||||
def to_option
|
||||
[name_last_first, id]
|
||||
end
|
||||
|
||||
def self.to_dropdown
|
||||
all.order(:last_name, :first_name).map(&:to_option)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
class Semester < ActiveRecord::Base
|
||||
include ToDropdown
|
||||
has_many :documents
|
||||
|
||||
auto_strip_attributes :name, squish: true
|
||||
auto_strip_attributes :name, nullify: true
|
||||
|
||||
validates :name, presence: true
|
||||
validates :name, uniqueness: true
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class User < ActiveRecord::Base
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||
devise :database_authenticatable, :trackable, :validatable
|
||||
end
|
||||
@@ -0,0 +1,51 @@
|
||||
# encoding: utf-8
|
||||
|
||||
class DocumentUploader < CarrierWave::Uploader::Base
|
||||
|
||||
# Include RMagick or MiniMagick support:
|
||||
# include CarrierWave::RMagick
|
||||
# include CarrierWave::MiniMagick
|
||||
|
||||
# Choose what kind of storage to use for this uploader:
|
||||
storage :file
|
||||
# storage :fog
|
||||
|
||||
# Override the directory where uploaded files will be stored.
|
||||
# This is a sensible default for uploaders that are meant to be mounted:
|
||||
def store_dir
|
||||
"uploads/document"
|
||||
end
|
||||
|
||||
# Provide a default URL as a default if there hasn't been a file uploaded:
|
||||
# def default_url
|
||||
# # For Rails 3.1+ asset pipeline compatibility:
|
||||
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
||||
#
|
||||
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
||||
# end
|
||||
|
||||
# Process files as they are uploaded:
|
||||
# process :scale => [200, 300]
|
||||
#
|
||||
# def scale(width, height)
|
||||
# # do something
|
||||
# end
|
||||
|
||||
# Create different versions of your uploaded files:
|
||||
# version :thumb do
|
||||
# process :resize_to_fit => [50, 50]
|
||||
# end
|
||||
|
||||
# Add a white list of extensions which are allowed to be uploaded.
|
||||
# For images you might use something like this:
|
||||
# def extension_white_list
|
||||
# %w(jpg jpeg gif png)
|
||||
# end
|
||||
|
||||
# Override the filename of the uploaded files:
|
||||
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
||||
def filename
|
||||
return unless original_filename
|
||||
"#{model.lesson.name}_#{model.professor.name_first_name}_#{model.semester.name}_#{model.position}.#{model.file.file.extension}".gsub(/[^a-zA-Z0-9ÄÖÜäöüß\.\-\+_]/, '')
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
h2 Sign in
|
||||
|
||||
= bootstrap_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
|
||||
= f.email_field :email, autofocus: true
|
||||
= f.password_field :password, autocomplete: "off"
|
||||
|
||||
- if devise_mapping.rememberable?
|
||||
= f.check_box :remember_me
|
||||
= f.submit
|
||||
@@ -0,0 +1,5 @@
|
||||
div.well
|
||||
= bootstrap_form_for(@doc_type) do |f|
|
||||
= f.text_field :name
|
||||
|
||||
= f.submit
|
||||
@@ -0,0 +1,4 @@
|
||||
- content_for :page_header
|
||||
| Typ - #{@doc_type.name}
|
||||
|
||||
= render 'form'
|
||||
@@ -0,0 +1,18 @@
|
||||
<% content_for :page_header do %>
|
||||
Typ - Index
|
||||
<% end %>
|
||||
<%= grid(@doc_types_grid, upper_pagination_panel: true) do |g|
|
||||
g.blank_slate content_tag(:div, "No records found", class: 'well')
|
||||
g.column name: 'ID', attribute: 'id'
|
||||
g.column name: 'Name', attribute: 'name'
|
||||
|
||||
g.column do |doc_type|
|
||||
contant = content_tag(:div, class: 'btn-group') do
|
||||
link = ''.html_safe
|
||||
link.concat btn_link_to('Edit', edit_doc_type_path(doc_type), class: 'btn-xs btn-warning') if user_signed_in?
|
||||
link.concat btn_link_to('Delete', doc_type_path(doc_type), method: "delete", :data => { confirm: 'Are you sure?' }, class: 'btn-xs btn-danger') if user_signed_in?
|
||||
link
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
@@ -0,0 +1,4 @@
|
||||
- content_for :page_header
|
||||
| Neuer Typ
|
||||
|
||||
= render 'form'
|
||||
@@ -1,4 +1,16 @@
|
||||
= bootstrap_form_for(@document) do |f|
|
||||
= f.text_field :name
|
||||
|
||||
div.well
|
||||
= bootstrap_form_for(@document, html: {multipart: true}) do |f|
|
||||
= f.collection_select :doc_type_id, DocType.order(:name).all, :id, :name, prompt: true
|
||||
= f.collection_select :semester_id, Semester.order(name: :desc).all, :id, :name, prompt: true
|
||||
= f.collection_select :lesson_id, Lesson.order(:name).all, :id, :name, prompt: true
|
||||
= f.collection_select :professor_id, Professor.order(:last_name).all, :id, :last_name, prompt: true
|
||||
- if @document.new_record?
|
||||
div.row
|
||||
div.col-lg-6
|
||||
= f.file_field :file
|
||||
div.col-lg-6
|
||||
- if @document.file_cache
|
||||
= f.static_control label: 'Uploaded file'
|
||||
= link_to @document.file.filename, @document.file_url
|
||||
= f.hidden_field :file_cache, readonly: true
|
||||
= f.submit
|
||||
@@ -1,5 +1,33 @@
|
||||
<%= grid(@documents_grid, upper_pagination_panel: true) do |g|
|
||||
g.column name: 'ID', attribute: 'id'
|
||||
g.column name: 'Name', attribute: 'name'
|
||||
<%
|
||||
define_grid(@documents_grid, upper_pagination_panel: true) do |g|
|
||||
g.blank_slate content_tag(:div, "No records found", class: 'well')
|
||||
|
||||
g.column name: 'Position', attribute: 'position'
|
||||
|
||||
g.column name: 'Semester', attribute: 'id', detach_with_id: 'semester_filter', model: 'Semester', custom_filter: Semester.to_dropdown do |document|
|
||||
document.semester.name if document.semester
|
||||
end
|
||||
|
||||
g.column name: 'Typ', attribute: 'id', detach_with_id: 'doc_type_filter', model: 'DocType', html:{class: 'text-center'}, custom_filter: DocType.to_dropdown do |document|
|
||||
document.doc_type.name if document.doc_type
|
||||
end
|
||||
|
||||
g.column name: 'Fach', attribute: 'id', detach_with_id: 'lesson_filter', model: 'Lesson', custom_filter: Lesson.to_dropdown do |document|
|
||||
document.lesson.name if document.lesson
|
||||
end
|
||||
|
||||
g.column name: 'Professor', attribute: 'id', detach_with_id: 'professor_filter', model: 'Professor', custom_filter: Professor.to_dropdown do |document|
|
||||
document.professor.name_last_first if document.professor
|
||||
end
|
||||
|
||||
g.column html:{class: 'text-center'} do |document|
|
||||
contant = content_tag(:div, class: 'btn-group') do
|
||||
link = ''.html_safe
|
||||
link.concat btn_link_to('Download', document.file_url, class: 'btn-xs btn-primary')
|
||||
link.concat btn_link_to('Edit', edit_document_path(document), class: 'btn-xs btn-warning') if user_signed_in?
|
||||
link.concat btn_link_to('Delete', document_path(document), method: "delete", :data => { confirm: 'Are you sure?' }, class: 'btn-xs btn-danger') if user_signed_in?
|
||||
link
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
@@ -0,0 +1,4 @@
|
||||
- content_for :page_header
|
||||
| Dokument - #{@document.semester.name} / #{@document.professor.name} / #{@document.lesson.name} / #{@document.doc_type.name}
|
||||
|
||||
= render 'form'
|
||||
@@ -1,6 +1,40 @@
|
||||
h1 Index
|
||||
- content_for :page_header
|
||||
| Dokumente - Index
|
||||
- render 'grid'
|
||||
|
||||
p
|
||||
= btn_link_to 'New', new_document_path, class: 'btn-primary'
|
||||
|
||||
= render 'grid'
|
||||
div.col-lg-2.col-md-2.text-center
|
||||
= image_tag 'QR-FS-Logo_-_fsmni.thm.de.png'
|
||||
div.col-lg-10.col-md-10
|
||||
div.panel.panel-default
|
||||
div.panel-heading
|
||||
h3.panel-title
|
||||
| Filter
|
||||
div
|
||||
div.panel-body
|
||||
div.form-horizontal
|
||||
div.col-lg-6.col-md-11
|
||||
div.form-group
|
||||
label for="last_name_filter" class="col-sm-2 control-label" Professor
|
||||
div class="col-sm-10"
|
||||
= grid_filter @documents_grid, :professor_filter
|
||||
div class="form-group"
|
||||
label for="first_name_filter" class="col-sm-2 control-label" Fach
|
||||
div class="col-sm-10"
|
||||
= grid_filter @documents_grid, :lesson_filter
|
||||
div class="col-lg-5 col-md-11"
|
||||
div class="form-group"
|
||||
label for="middle_name_filter" class="col-sm-2 control-label" Semester
|
||||
div class="col-sm-10"
|
||||
= grid_filter @documents_grid, :semester_filter
|
||||
div class="form-group"
|
||||
label for="id_filter" class="col-sm-2 control-label" Type
|
||||
div class="col-sm-10"
|
||||
= grid_filter @documents_grid, :doc_type_filter
|
||||
div class="col-lg-1 col-md-1"
|
||||
div class="form-group"
|
||||
button class="btn btn-primary wg-external-submit-button" data-grid-name='grid' Submit
|
||||
div class="col-lg-1 col-md-1"
|
||||
div class="form-group"
|
||||
button class="btn btn-default wg-external-reset-button" data-grid-name='grid' Reset
|
||||
div.col-lg-12.col-md-12
|
||||
== render_grid(@documents_grid)
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
- content_for :page_header
|
||||
| Neues Dokument
|
||||
== render 'form'
|
||||
@@ -10,14 +10,23 @@ html
|
||||
nav.navbar.navbar-default role="navigation"
|
||||
div.container-fluid
|
||||
div.navbar-header
|
||||
button.navbar-toggle type="button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"
|
||||
button.navbar-toggle type="button" data-toggle="collapse" data-target="#navbar"
|
||||
spansr-only Toggle navigation
|
||||
spanicon-bar
|
||||
spanicon-bar
|
||||
spanicon-bar
|
||||
= link_to 'Klaus', root_path, class: 'navbar-brand'
|
||||
div.collapse.navbar-collapse#bs-example-navbar-collapse-1
|
||||
div.collapse.navbar-collapse#navbar
|
||||
ul.nav.navbar-nav
|
||||
li = link_to 'Übersicht', documents_path
|
||||
li = link_to 'Neues Dokument', new_document_path
|
||||
li = link_to 'Neuer Dokument Typ', new_doc_type_path
|
||||
li = link_to 'Neuer Professor', new_professor_path
|
||||
li = link_to 'Neues Semester', new_semester_path
|
||||
li = link_to 'Neues Fach', new_lesson_path
|
||||
div.container
|
||||
div.page-header
|
||||
h1 = content_for :page_header
|
||||
- if notice
|
||||
div.alert.alert-success.alert-dismissable
|
||||
button type="button" class="close" data-dismiss="alert" aria-hidden="true"
|
||||
@@ -29,3 +38,13 @@ html
|
||||
| ×
|
||||
= alert
|
||||
= yield
|
||||
footer.text-center
|
||||
p
|
||||
| CC BY-NC-SA - Fachschaft MNI - Technische Hochschule Mittelhessen
|
||||
br
|
||||
== "Index: #{link_to 'Type', doc_types_path} | #{link_to 'Fach', lessons_path} | #{link_to 'Professor', professors_path} | #{link_to 'Semester', semesters_path}"
|
||||
br
|
||||
- if user_signed_in?
|
||||
= link_to 'Logout', destroy_user_session_path, method: :delete
|
||||
- else
|
||||
= link_to 'Login', new_user_session_path
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
div.well
|
||||
= bootstrap_form_for(@lesson) do |f|
|
||||
= f.text_field :name
|
||||
= f.text_field :short_name
|
||||
|
||||
= f.submit
|
||||
@@ -0,0 +1,4 @@
|
||||
- content_for :page_header
|
||||
| Fach - #{@lesson.name}
|
||||
|
||||
= render 'form'
|
||||
@@ -0,0 +1,19 @@
|
||||
<% content_for :page_header do %>
|
||||
Fach - Index
|
||||
<% end %>
|
||||
<%= grid(@lessons_grid, upper_pagination_panel: true) do |g|
|
||||
g.blank_slate content_tag(:div, "No records found", class: 'well')
|
||||
g.column name: 'ID', attribute: 'id'
|
||||
g.column name: 'Name', attribute: 'short_name'
|
||||
g.column name: 'Name', attribute: 'name'
|
||||
|
||||
g.column do |lesson|
|
||||
contant = content_tag(:div, class: 'btn-group') do
|
||||
link = ''.html_safe
|
||||
link.concat btn_link_to('Edit', edit_lesson_path(lesson), class: 'btn-xs btn-warning') if user_signed_in?
|
||||
link.concat btn_link_to('Delete', lesson_path(lesson), method: "delete", :data => { confirm: 'Are you sure?' }, class: 'btn-xs btn-danger') if user_signed_in?
|
||||
link
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
@@ -0,0 +1,4 @@
|
||||
- content_for :page_header
|
||||
| Neues Fach
|
||||
|
||||
= render 'form'
|
||||
@@ -0,0 +1,6 @@
|
||||
div.well
|
||||
= bootstrap_form_for(@professor) do |f|
|
||||
= f.text_field :first_name
|
||||
= f.text_field :last_name
|
||||
|
||||
= f.submit
|
||||
@@ -0,0 +1,4 @@
|
||||
- content_for :page_header
|
||||
| Professor - #{@professor.name}
|
||||
|
||||
= render 'form'
|
||||
@@ -0,0 +1,19 @@
|
||||
<% content_for :page_header do %>
|
||||
Professor - Index
|
||||
<% end %>
|
||||
<%= grid(@professors_grid, upper_pagination_panel: true) do |g|
|
||||
g.blank_slate content_tag(:div, "No records found", class: 'well')
|
||||
g.column name: 'ID', attribute: 'id'
|
||||
g.column name: 'First Name', attribute: 'first_name'
|
||||
g.column name: 'Last Name', attribute: 'last_name'
|
||||
|
||||
g.column do |professor|
|
||||
contant = content_tag(:div, class: 'btn-group') do
|
||||
link = ''.html_safe
|
||||
link.concat btn_link_to('Edit', edit_professor_path(professor), class: 'btn-xs btn-warning') if user_signed_in?
|
||||
link.concat btn_link_to('Delete', professor_path(professor), method: "delete", :data => { confirm: 'Are you sure?' }, class: 'btn-xs btn-danger') if user_signed_in?
|
||||
link
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
@@ -0,0 +1,4 @@
|
||||
- content_for :page_header
|
||||
| Neuer Professor
|
||||
|
||||
= render 'form'
|
||||
@@ -0,0 +1,5 @@
|
||||
div.well
|
||||
= bootstrap_form_for(@semester) do |f|
|
||||
= f.text_field :name
|
||||
|
||||
= f.submit
|
||||
@@ -0,0 +1,4 @@
|
||||
- content_for :page_header
|
||||
| Semester - #{@semester.name}
|
||||
|
||||
= render 'form'
|
||||
@@ -0,0 +1,18 @@
|
||||
<% content_for :page_header do %>
|
||||
Semester - Index
|
||||
<% end %>
|
||||
<%= grid(@semesters_grid, upper_pagination_panel: true) do |g|
|
||||
g.blank_slate content_tag(:div, "No records found", class: 'well')
|
||||
g.column name: 'ID', attribute: 'id'
|
||||
g.column name: 'Name', attribute: 'name'
|
||||
|
||||
g.column do |semester|
|
||||
contant = content_tag(:div, class: 'btn-group') do
|
||||
link = ''.html_safe
|
||||
link.concat btn_link_to('Edit', edit_semester_path(semester), class: 'btn-xs btn-warning') if user_signed_in?
|
||||
link.concat btn_link_to('Delete', semester_path(semester), method: "delete", :data => { confirm: 'Are you sure?' }, class: 'btn-xs btn-danger') if user_signed_in?
|
||||
link
|
||||
end
|
||||
end
|
||||
end
|
||||
%>
|
||||
@@ -0,0 +1,4 @@
|
||||
- content_for :page_header
|
||||
| Neues Semester
|
||||
|
||||
= render 'form'
|
||||
@@ -0,0 +1,256 @@
|
||||
# Use this hook to configure devise mailer, warden hooks and so forth.
|
||||
# Many of these configuration options can be set straight in your model.
|
||||
Devise.setup do |config|
|
||||
# The secret key used by Devise. Devise uses this key to generate
|
||||
# random tokens. Changing this key will render invalid all existing
|
||||
# confirmation, reset password and unlock tokens in the database.
|
||||
config.secret_key = 'db489d16f7598f9e12ff53a44b87d995031a53c4f37002610f4486f82a7bdcac130f6f66a33645f5bc9d9b1980864eb4cec3f5806270f4ce30c0e5615c4cf374'
|
||||
|
||||
# ==> Mailer Configuration
|
||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||
# note that it will be overwritten if you use your own mailer class
|
||||
# with default "from" parameter.
|
||||
config.mailer_sender = 'klaus@example.com'
|
||||
|
||||
# Configure the class responsible to send e-mails.
|
||||
# config.mailer = 'Devise::Mailer'
|
||||
|
||||
# ==> ORM configuration
|
||||
# Load and configure the ORM. Supports :active_record (default) and
|
||||
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
||||
# available as additional gems.
|
||||
require 'devise/orm/active_record'
|
||||
|
||||
# ==> Configuration for any authentication mechanism
|
||||
# Configure which keys are used when authenticating a user. The default is
|
||||
# just :email. You can configure it to use [:username, :subdomain], so for
|
||||
# authenticating a user, both parameters are required. Remember that those
|
||||
# parameters are used only when authenticating and not when retrieving from
|
||||
# session. If you need permissions, you should implement that in a before filter.
|
||||
# You can also supply a hash where the value is a boolean determining whether
|
||||
# or not authentication should be aborted when the value is not present.
|
||||
# config.authentication_keys = [ :email ]
|
||||
|
||||
# Configure parameters from the request object used for authentication. Each entry
|
||||
# given should be a request method and it will automatically be passed to the
|
||||
# find_for_authentication method and considered in your model lookup. For instance,
|
||||
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
||||
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
||||
# config.request_keys = []
|
||||
|
||||
# Configure which authentication keys should be case-insensitive.
|
||||
# These keys will be downcased upon creating or modifying a user and when used
|
||||
# to authenticate or find a user. Default is :email.
|
||||
config.case_insensitive_keys = [ :email ]
|
||||
|
||||
# Configure which authentication keys should have whitespace stripped.
|
||||
# These keys will have whitespace before and after removed upon creating or
|
||||
# modifying a user and when used to authenticate or find a user. Default is :email.
|
||||
config.strip_whitespace_keys = [ :email ]
|
||||
|
||||
# Tell if authentication through request.params is enabled. True by default.
|
||||
# It can be set to an array that will enable params authentication only for the
|
||||
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
||||
# enable it only for database (email + password) authentication.
|
||||
# config.params_authenticatable = true
|
||||
|
||||
# Tell if authentication through HTTP Auth is enabled. False by default.
|
||||
# It can be set to an array that will enable http authentication only for the
|
||||
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
||||
# enable it only for database authentication. The supported strategies are:
|
||||
# :database = Support basic authentication with authentication key + password
|
||||
# config.http_authenticatable = false
|
||||
|
||||
# If http headers should be returned for AJAX requests. True by default.
|
||||
# config.http_authenticatable_on_xhr = true
|
||||
|
||||
# The realm used in Http Basic Authentication. 'Application' by default.
|
||||
# config.http_authentication_realm = 'Application'
|
||||
|
||||
# It will change confirmation, password recovery and other workflows
|
||||
# to behave the same regardless if the e-mail provided was right or wrong.
|
||||
# Does not affect registerable.
|
||||
# config.paranoid = true
|
||||
|
||||
# By default Devise will store the user in session. You can skip storage for
|
||||
# particular strategies by setting this option.
|
||||
# Notice that if you are skipping storage for all authentication paths, you
|
||||
# may want to disable generating routes to Devise's sessions controller by
|
||||
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
||||
config.skip_session_storage = [:http_auth]
|
||||
|
||||
# By default, Devise cleans up the CSRF token on authentication to
|
||||
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
||||
# requests for sign in and sign up, you need to get a new CSRF token
|
||||
# from the server. You can disable this option at your own risk.
|
||||
# config.clean_up_csrf_token_on_authentication = true
|
||||
|
||||
# ==> Configuration for :database_authenticatable
|
||||
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
||||
# using other encryptors, it sets how many times you want the password re-encrypted.
|
||||
#
|
||||
# Limiting the stretches to just one in testing will increase the performance of
|
||||
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
||||
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
||||
# encryptor), the cost increases exponentially with the number of stretches (e.g.
|
||||
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
||||
config.stretches = Rails.env.test? ? 1 : 10
|
||||
|
||||
# Setup a pepper to generate the encrypted password.
|
||||
# config.pepper = '10c8a55898610e446bc5e5a9184fe3e22034cad7c8d6db27f4711f50a066d1b53f0d9ad95730185a20c92f17131bb84fb24b2bc280200cf7d1575699b48ba4ed'
|
||||
|
||||
# ==> Configuration for :confirmable
|
||||
# A period that the user is allowed to access the website even without
|
||||
# confirming their account. For instance, if set to 2.days, the user will be
|
||||
# able to access the website for two days without confirming their account,
|
||||
# access will be blocked just in the third day. Default is 0.days, meaning
|
||||
# the user cannot access the website without confirming their account.
|
||||
# config.allow_unconfirmed_access_for = 2.days
|
||||
|
||||
# A period that the user is allowed to confirm their account before their
|
||||
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
||||
# their account within 3 days after the mail was sent, but on the fourth day
|
||||
# their account can't be confirmed with the token any more.
|
||||
# Default is nil, meaning there is no restriction on how long a user can take
|
||||
# before confirming their account.
|
||||
# config.confirm_within = 3.days
|
||||
|
||||
# If true, requires any email changes to be confirmed (exactly the same way as
|
||||
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
||||
# db field (see migrations). Until confirmed, new email is stored in
|
||||
# unconfirmed_email column, and copied to email column on successful confirmation.
|
||||
config.reconfirmable = true
|
||||
|
||||
# Defines which key will be used when confirming an account
|
||||
# config.confirmation_keys = [ :email ]
|
||||
|
||||
# ==> Configuration for :rememberable
|
||||
# The time the user will be remembered without asking for credentials again.
|
||||
# config.remember_for = 2.weeks
|
||||
|
||||
# If true, extends the user's remember period when remembered via cookie.
|
||||
# config.extend_remember_period = false
|
||||
|
||||
# Options to be passed to the created cookie. For instance, you can set
|
||||
# secure: true in order to force SSL only cookies.
|
||||
# config.rememberable_options = {}
|
||||
|
||||
# ==> Configuration for :validatable
|
||||
# Range for password length.
|
||||
config.password_length = 8..128
|
||||
|
||||
# Email regex used to validate email formats. It simply asserts that
|
||||
# one (and only one) @ exists in the given string. This is mainly
|
||||
# to give user feedback and not to assert the e-mail validity.
|
||||
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
||||
|
||||
# ==> Configuration for :timeoutable
|
||||
# The time you want to timeout the user session without activity. After this
|
||||
# time the user will be asked for credentials again. Default is 30 minutes.
|
||||
# config.timeout_in = 30.minutes
|
||||
|
||||
# If true, expires auth token on session timeout.
|
||||
# config.expire_auth_token_on_timeout = false
|
||||
|
||||
# ==> Configuration for :lockable
|
||||
# Defines which strategy will be used to lock an account.
|
||||
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
||||
# :none = No lock strategy. You should handle locking by yourself.
|
||||
# config.lock_strategy = :failed_attempts
|
||||
|
||||
# Defines which key will be used when locking and unlocking an account
|
||||
# config.unlock_keys = [ :email ]
|
||||
|
||||
# Defines which strategy will be used to unlock an account.
|
||||
# :email = Sends an unlock link to the user email
|
||||
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
||||
# :both = Enables both strategies
|
||||
# :none = No unlock strategy. You should handle unlocking by yourself.
|
||||
# config.unlock_strategy = :both
|
||||
|
||||
# Number of authentication tries before locking an account if lock_strategy
|
||||
# is failed attempts.
|
||||
# config.maximum_attempts = 20
|
||||
|
||||
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
||||
# config.unlock_in = 1.hour
|
||||
|
||||
# Warn on the last attempt before the account is locked.
|
||||
# config.last_attempt_warning = false
|
||||
|
||||
# ==> Configuration for :recoverable
|
||||
#
|
||||
# Defines which key will be used when recovering the password for an account
|
||||
# config.reset_password_keys = [ :email ]
|
||||
|
||||
# Time interval you can reset your password with a reset password key.
|
||||
# Don't put a too small interval or your users won't have the time to
|
||||
# change their passwords.
|
||||
config.reset_password_within = 6.hours
|
||||
|
||||
# ==> Configuration for :encryptable
|
||||
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
||||
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
||||
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
||||
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
||||
# REST_AUTH_SITE_KEY to pepper).
|
||||
#
|
||||
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
||||
# config.encryptor = :sha512
|
||||
|
||||
# ==> Scopes configuration
|
||||
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
||||
# "users/sessions/new". It's turned off by default because it's slower if you
|
||||
# are using only default views.
|
||||
# config.scoped_views = false
|
||||
|
||||
# Configure the default scope given to Warden. By default it's the first
|
||||
# devise role declared in your routes (usually :user).
|
||||
# config.default_scope = :user
|
||||
|
||||
# Set this configuration to false if you want /users/sign_out to sign out
|
||||
# only the current scope. By default, Devise signs out all scopes.
|
||||
# config.sign_out_all_scopes = true
|
||||
|
||||
# ==> Navigation configuration
|
||||
# Lists the formats that should be treated as navigational. Formats like
|
||||
# :html, should redirect to the sign in page when the user does not have
|
||||
# access, but formats like :xml or :json, should return 401.
|
||||
#
|
||||
# If you have any extra navigational formats, like :iphone or :mobile, you
|
||||
# should add them to the navigational formats lists.
|
||||
#
|
||||
# The "*/*" below is required to match Internet Explorer requests.
|
||||
# config.navigational_formats = ['*/*', :html]
|
||||
|
||||
# The default HTTP method used to sign out a resource. Default is :delete.
|
||||
config.sign_out_via = :delete
|
||||
|
||||
# ==> OmniAuth
|
||||
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
||||
# up on your models and hooks.
|
||||
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
||||
|
||||
# ==> Warden configuration
|
||||
# If you want to use other strategies, that are not supported by Devise, or
|
||||
# change the failure app, you can configure them inside the config.warden block.
|
||||
#
|
||||
# config.warden do |manager|
|
||||
# manager.intercept_401 = false
|
||||
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
||||
# end
|
||||
|
||||
# ==> Mountable engine configurations
|
||||
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
||||
# is mountable, there are some extra configurations to be taken into account.
|
||||
# The following options are available, assuming the engine is mounted as:
|
||||
#
|
||||
# mount MyEngine, at: '/my_engine'
|
||||
#
|
||||
# The router that invoked `devise_for`, in the example above, would be:
|
||||
# config.router_name = :my_engine
|
||||
#
|
||||
# When using omniauth, Devise cannot automatically set Omniauth path,
|
||||
# so you need to do it manually. For the users scope, it would be:
|
||||
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
||||
end
|
||||
@@ -22,7 +22,7 @@ if defined?(Wice::Defaults)
|
||||
Wice::Defaults::DEFAULT_TABLE_CLASSES = ['table', 'table-bordered', 'table-striped']
|
||||
|
||||
# Allow switching between a single and multiple selection modes in custom filters (dropdown boxes)
|
||||
Wice::Defaults::ALLOW_MULTIPLE_SELECTION = true
|
||||
Wice::Defaults::ALLOW_MULTIPLE_SELECTION = false
|
||||
|
||||
# Show the upper pagination panel by default or not
|
||||
Wice::Defaults::SHOW_UPPER_PAGINATION_PANEL = false
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
|
||||
|
||||
en:
|
||||
devise:
|
||||
confirmations:
|
||||
confirmed: "Your account was successfully confirmed."
|
||||
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
|
||||
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
|
||||
failure:
|
||||
already_authenticated: "You are already signed in."
|
||||
inactive: "Your account is not activated yet."
|
||||
invalid: "Invalid email or password."
|
||||
locked: "Your account is locked."
|
||||
last_attempt: "You have one more attempt before your account will be locked."
|
||||
not_found_in_database: "Invalid email or password."
|
||||
timeout: "Your session expired. Please sign in again to continue."
|
||||
unauthenticated: "You need to sign in or sign up before continuing."
|
||||
unconfirmed: "You have to confirm your account before continuing."
|
||||
mailer:
|
||||
confirmation_instructions:
|
||||
subject: "Confirmation instructions"
|
||||
reset_password_instructions:
|
||||
subject: "Reset password instructions"
|
||||
unlock_instructions:
|
||||
subject: "Unlock Instructions"
|
||||
omniauth_callbacks:
|
||||
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
|
||||
success: "Successfully authenticated from %{kind} account."
|
||||
passwords:
|
||||
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
|
||||
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
|
||||
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
||||
updated: "Your password was changed successfully. You are now signed in."
|
||||
updated_not_active: "Your password was changed successfully."
|
||||
registrations:
|
||||
destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
|
||||
signed_up: "Welcome! You have signed up successfully."
|
||||
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
|
||||
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
|
||||
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
|
||||
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
|
||||
updated: "You updated your account successfully."
|
||||
sessions:
|
||||
signed_in: "Signed in successfully."
|
||||
signed_out: "Signed out successfully."
|
||||
unlocks:
|
||||
send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
|
||||
send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
|
||||
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
|
||||
errors:
|
||||
messages:
|
||||
already_confirmed: "was already confirmed, please try signing in"
|
||||
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
|
||||
expired: "has expired, please request a new one"
|
||||
not_found: "not found"
|
||||
not_locked: "was not locked"
|
||||
not_saved:
|
||||
one: "1 error prohibited this %{resource} from being saved:"
|
||||
other: "%{count} errors prohibited this %{resource} from being saved:"
|
||||
@@ -1,5 +1,10 @@
|
||||
Rails.application.routes.draw do
|
||||
devise_for :users
|
||||
resources :documents
|
||||
resources :doc_types
|
||||
resources :semesters
|
||||
resources :professors
|
||||
resources :lessons
|
||||
|
||||
root 'documents#index'
|
||||
# The priority is based upon order of creation: first created -> highest priority.
|
||||
|
||||
+1
-1
@@ -19,4 +19,4 @@ test:
|
||||
# Do not keep production secrets in the repository,
|
||||
# instead read values from the environment.
|
||||
production:
|
||||
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
||||
secret_key_base: 6842c9d852660229b08d440334f1b5ec4c4e83294nvlwo98un32c4elo9wunce9zl3e9run4w87rc8n5y8xeo4oucnorhgx7n6fygoi7xrete0rt9809b9ad3a4c6e9 %>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class CreateDocTypes < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :doc_types do |t|
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,9 +0,0 @@
|
||||
class CreateDocuments < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :documents do |t|
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class CreateSemesters < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :semesters do |t|
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
class CreateProfessors < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :professors do |t|
|
||||
t.string :first_name
|
||||
t.string :last_name
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
class CreateLessons < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :lessons do |t|
|
||||
t.string :short_name
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
class CreateDocuments < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :documents do |t|
|
||||
t.references :doc_type
|
||||
t.references :professor
|
||||
t.references :semester
|
||||
t.references :lesson
|
||||
|
||||
t.string :file
|
||||
t.integer :position
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,42 @@
|
||||
class DeviseCreateUsers < ActiveRecord::Migration
|
||||
def change
|
||||
create_table(:users) do |t|
|
||||
## Database authenticatable
|
||||
t.string :email, null: false, default: ""
|
||||
t.string :encrypted_password, null: false, default: ""
|
||||
|
||||
## Recoverable
|
||||
t.string :reset_password_token
|
||||
t.datetime :reset_password_sent_at
|
||||
|
||||
## Rememberable
|
||||
t.datetime :remember_created_at
|
||||
|
||||
## Trackable
|
||||
t.integer :sign_in_count, default: 0, null: false
|
||||
t.datetime :current_sign_in_at
|
||||
t.datetime :last_sign_in_at
|
||||
t.string :current_sign_in_ip
|
||||
t.string :last_sign_in_ip
|
||||
|
||||
## Confirmable
|
||||
# t.string :confirmation_token
|
||||
# t.datetime :confirmed_at
|
||||
# t.datetime :confirmation_sent_at
|
||||
# t.string :unconfirmed_email # Only if using reconfirmable
|
||||
|
||||
## Lockable
|
||||
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
||||
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
||||
# t.datetime :locked_at
|
||||
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :users, :email, unique: true
|
||||
add_index :users, :reset_password_token, unique: true
|
||||
# add_index :users, :confirmation_token, unique: true
|
||||
# add_index :users, :unlock_token, unique: true
|
||||
end
|
||||
end
|
||||
+44
-1
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20140808200903) do
|
||||
ActiveRecord::Schema.define(version: 20140809164331) do
|
||||
|
||||
create_table "doc_types", force: true do |t|
|
||||
t.string "name"
|
||||
@@ -20,9 +20,52 @@ ActiveRecord::Schema.define(version: 20140808200903) do
|
||||
end
|
||||
|
||||
create_table "documents", force: true do |t|
|
||||
t.integer "doc_type_id"
|
||||
t.integer "professor_id"
|
||||
t.integer "semester_id"
|
||||
t.integer "lesson_id"
|
||||
t.string "file"
|
||||
t.integer "position"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "lessons", force: true do |t|
|
||||
t.string "short_name"
|
||||
t.string "name"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "professors", force: true do |t|
|
||||
t.string "first_name"
|
||||
t.string "last_name"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "semesters", force: true do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "users", force: true do |t|
|
||||
t.string "email", default: "", null: false
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.datetime "remember_created_at"
|
||||
t.integer "sign_in_count", default: 0, null: false
|
||||
t.datetime "current_sign_in_at"
|
||||
t.datetime "last_sign_in_at"
|
||||
t.string "current_sign_in_ip"
|
||||
t.string "last_sign_in_ip"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
||||
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||
|
||||
end
|
||||
|
||||
+146
-7
@@ -1,7 +1,146 @@
|
||||
# This file should contain all the record creation needed to seed the database with its default values.
|
||||
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
||||
# Mayor.create(name: 'Emanuel', city: cities.first)
|
||||
User.create! :email => "admin@FSMNI.THM.de", :password => "imbaimba123", :password_confirmation => "imbaimba123"
|
||||
|
||||
usem = Semester.create!(name: "Unbekant")
|
||||
(5..15).each do |i|
|
||||
Semester.create!(name: "#{"%02d" % i} SoSe")
|
||||
Semester.create!(name: "#{"%02d" % i}/#{"%02d" % (i+1)} WiSe")
|
||||
end
|
||||
punbekant = Professor.create!(first_name: 'Unbekant', last_name: 'Unbekant')
|
||||
geisse = Professor.create!(first_name: 'Hellwig', last_name: 'Geisse')
|
||||
wuest = Professor.create!(first_name: 'Klaus', last_name: 'Wuest')
|
||||
ulbrich = Professor.create!(first_name: 'Norman', last_name: 'Ulbrich')
|
||||
dominik = Professor.create!(first_name: 'Andreas', last_name: 'Dominik')
|
||||
fmueller = Professor.create!(first_name: 'Fabian', last_name: 'Müller')
|
||||
christidis = Professor.create!(first_name: 'Aris', last_name: 'Christidis')
|
||||
dworschak = Professor.create!(first_name: 'Alexander', last_name: 'Dworschak')
|
||||
franzen = Professor.create!(first_name: 'Berthold', last_name: 'Franzen')
|
||||
eichner = Professor.create!(first_name: 'Lutz', last_name: 'Eichner')
|
||||
just = Professor.create!(first_name: 'Bettina', last_name: 'Just')
|
||||
jäger = Professor.create!(first_name: 'Michael', last_name: 'Jäger')
|
||||
kaufmann = Professor.create!(first_name: 'Achim', last_name: 'Kaufmann')
|
||||
kneisel = Professor.create!(first_name: 'Peter', last_name: 'Kneisel')
|
||||
letschert = Professor.create!(first_name: 'Thomas Karl', last_name: 'Letschert')
|
||||
löffler = Professor.create!(first_name: 'Peter', last_name: 'Löffler')
|
||||
metz = Professor.create!(first_name: 'Hans-Rudolf', last_name: 'Metz')
|
||||
bmüller = Professor.create!(first_name: 'Bernd', last_name: 'Müller')
|
||||
kqc = Professor.create!(first_name: 'Klaus', last_name: 'Quibeldey-Cirkel ')
|
||||
renz = Professor.create!(first_name: 'Burkhardt', last_name: 'Renz')
|
||||
schmitt = Professor.create!(first_name: 'Wolfgang', last_name: 'Schmitt')
|
||||
martin = Professor.create!(first_name: 'Wolfgang', last_name: 'Martin')
|
||||
oop_team = Professor.create!(first_name: 'Team', last_name: 'OOP')
|
||||
henrich = Professor.create!(first_name: 'Wolfgang', last_name: 'Henrich')
|
||||
|
||||
dm = Lesson.create!(name: 'Diskrete Mathematik',short_name: 'DM')
|
||||
gdi = Lesson.create!(name: 'Grundlagen der Informatik',short_name: 'GDI')
|
||||
ntg = Lesson.create!(name: 'Naturwissenschaftliche und technische Grundlagen',short_name: 'NTG')
|
||||
oop = Lesson.create!(name: 'Objektorientierte Programmierung',short_name: 'OOP')
|
||||
rnua = Lesson.create!(name: 'Rechnernetze und ihre Anwendung',short_name: 'RnuA')
|
||||
ad = Lesson.create!(name: 'Algorithmen und Datenstrukturen',short_name: 'AD')
|
||||
bwl = Lesson.create!(name: 'DV-orientierte Betriebswirtschaftslehre',short_name: 'DV-BWL')
|
||||
ibs = Lesson.create!(name: 'Internetbasierte Systeme',short_name: 'IBS')
|
||||
la = Lesson.create!(name: 'Lineare Algebra',short_name: 'LA')
|
||||
pis = Lesson.create!(name: 'Programmierung interaktiver Systeme',short_name: 'PIS')
|
||||
recht = Lesson.create!(name: 'Recht für Informatiker',short_name: 'Recht')
|
||||
cb = Lesson.create!(name: 'Compilerbau',short_name: 'CB')
|
||||
dbs = Lesson.create!(name: 'Datenbanksysteme',short_name: 'DBS')
|
||||
ksp = Lesson.create!(name: 'Konzepte systemnaher Programmierung',short_name: 'KSP')
|
||||
swt = Lesson.create!(name: 'Softwaretechnik',short_name: 'SWT')
|
||||
stochastik = Lesson.create!(name: 'Stochastik')
|
||||
bs = Lesson.create!(name: 'Betriebssysteme',short_name: 'BS')
|
||||
mpt = Lesson.create!(name: 'Mikroprozessortechnik',short_name: 'MPT')
|
||||
ospw = Lesson.create!(name: 'Open-Source-Programmierwerkzeuge',short_name: 'OSPW')
|
||||
cg = Lesson.create!(name: 'Computer Grafiken',short_name: 'CG')
|
||||
npp = Lesson.create!(name: 'Nichtprozedurale Programmierung',short_name: 'NPP')
|
||||
fp = Lesson.create!(name: 'Funktionale Programmierung',short_name: 'FP')
|
||||
nvp = Lesson.create!(name: 'Nebenläufige und verteilte Programme',short_name: 'NVP')
|
||||
c = Lesson.create!(name: 'C#',short_name: 'C#')
|
||||
kuf = Lesson.create!(name: 'Komponenten & Frameworks', short_name: 'KuF')
|
||||
|
||||
k = DocType.create!(name: 'Klausur')
|
||||
kl = DocType.create!(name: 'Klausur + Lösung')
|
||||
m = DocType.create!(name: 'Mitschrift')
|
||||
ü = DocType.create!(name: 'Übung')
|
||||
s = DocType.create!(name: 'Sonstiges')
|
||||
|
||||
path = '/home/murao/Documents/altklausuren/fin'
|
||||
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '07/08 WiSe'),
|
||||
professor: christidis, lesson: cg, doc_type: k,
|
||||
file: File.open("#{path}/A. Christidis - CG - S0708 - Teile.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '07/08 WiSe'),
|
||||
professor: punbekant, lesson: bwl, doc_type: k,
|
||||
file: File.open("#{path}/? - DV-orientierte Betriebswirtschaft - WiSe0708.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '13 SoSe'),
|
||||
professor: geisse, lesson: bs, doc_type: k,
|
||||
file: File.open("#{path}/H. Geisse - Betriebssysteme - SoSe13.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '13/14 WiSe'),
|
||||
professor: geisse, lesson: bs, doc_type: k,
|
||||
file: File.open("#{path}/H. Geisse - Betriebssysteme - WiSe1314.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '06/07 WiSe'),
|
||||
professor: geisse, lesson: gdi, doc_type: k,
|
||||
file: File.open("#{path}/H. Geisse - Grundlagen der Informatik - WiSe0607.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '07 SoSe'),
|
||||
professor: geisse, lesson: npp, doc_type: k,
|
||||
file: File.open("#{path}/H . Geisse - Nichtprozedurale Programmierung - SoSe07.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '07 SoSe'),
|
||||
professor: metz, lesson: la, doc_type: k,
|
||||
file: File.open("#{path}/H.-R. Metz - Lineare Algebra - SoSe07.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '07/08 WiSe'),
|
||||
professor: wuest, lesson: mpt, doc_type: k,
|
||||
file: File.open("#{path}/K. Wuest - Mikroprozessortechnik - WiSe0708.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '11/12 WiSe'),
|
||||
professor: letschert, lesson: oop, doc_type: k,
|
||||
file: File.open("#{path}/Letschert - OOP - WiSe1112.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '12/13 WiSe'),
|
||||
professor: ulbrich, lesson: fp, doc_type: k,
|
||||
file: File.open("#{path}/N. Ulbrich - Funktionale Programmierung - WiSe1213.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '09 SoSe'),
|
||||
professor: ulbrich, lesson: ospw, doc_type: k,
|
||||
file: File.open("#{path}/N. Ulbrich - Open-Source-Programmierwerkzeuge - SoSe09.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '10 SoSe'),
|
||||
professor: ulbrich, lesson: ospw, doc_type: k,
|
||||
file: File.open("#{path}/N. Ulbrich - Open-Source-Programmierwerkzeuge - SoSe10.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '12 SoSe'),
|
||||
professor: ulbrich, lesson: ospw, doc_type: k,
|
||||
file: File.open("#{path}/N. Ulbrich - Open-Source-Programmierwerkzeuge - SoSe12.PDF"))
|
||||
Document.create!(
|
||||
semester: usem,
|
||||
professor: punbekant, lesson: oop, doc_type: s,
|
||||
file: File.open("#{path}/OOP - allgemeine Fragen&diverses.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '13 SoSe'),
|
||||
professor: oop_team, lesson: oop, doc_type: k,
|
||||
file: File.open("#{path}/OOP_Team - OOP - SoSe13.PDF"))
|
||||
Document.create!(
|
||||
semester: usem,
|
||||
professor: punbekant, lesson: oop, doc_type: ü,
|
||||
file: File.open("#{path}/OOP-Uebungen.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '07/08 WiSe'),
|
||||
professor: letschert, lesson: nvp, doc_type: k,
|
||||
file: File.open("#{path}/T. Letschert - NVP - WiSe0708.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '06/07 WiSe'),
|
||||
professor: henrich, lesson: c, doc_type: k,
|
||||
file: File.open("#{path}/W. Henrich - C# - WiSe0607.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '07 SoSe'),
|
||||
professor: henrich, lesson: kuf, doc_type: k,
|
||||
file: File.open("#{path}/W. Henrich - KuF - SoSe07.PDF"))
|
||||
Document.create!(
|
||||
semester: Semester.find_by(name: '07/08 WiSe'),
|
||||
professor: henrich, lesson: kuf, doc_type: k,
|
||||
file: File.open("#{path}/W. Henrich - KuF - WiSe0708.PDF"))
|
||||
Reference in New Issue
Block a user