forked from bofh/fetsite
some changes
This commit is contained in:
9
Gemfile
9
Gemfile
@@ -89,11 +89,12 @@ gem 'factory_girl_rails',"~>4.5.0"
|
||||
gem 'minitest', "~>4.7.5"
|
||||
gem 'progress_bar'
|
||||
gem 'rspec-core', '~>3.3.0'
|
||||
gem 'rspec-support', '~>3.3.0'
|
||||
gem 'rspec-rails', '~>3.3.0'
|
||||
gem 'rspec-collection_matchers'
|
||||
gem 'rspec-activemodel-mocks'
|
||||
gem 'rspec-html-matchers'
|
||||
gem 'rspec-expectations'
|
||||
gem 'rspec-collection_matchers', '~>1.1.2'
|
||||
gem 'rspec-activemodel-mocks', '~>1.0.1'
|
||||
gem 'rspec-html-matchers', '~>0.7.0'
|
||||
gem 'rspec-expectations', '~>3.3.1'
|
||||
gem 'capybara', '~>2.5.0'
|
||||
end
|
||||
|
||||
|
||||
@@ -1,154 +1,123 @@
|
||||
|
||||
/*
|
||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||
* listed below.
|
||||
*
|
||||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
||||
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
||||
*
|
||||
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
||||
* compiled file, but it's generally better to create a new file per style scope.
|
||||
*= require_self
|
||||
* require_tree .
|
||||
*= require 'calendars'
|
||||
*= require jquery.fileupload-ui
|
||||
*= require jquery.ui.progressbar
|
||||
*= require jquery.datetimepicker
|
||||
*= require jquery.ui.dialog
|
||||
*= require jquery.ui.tabs
|
||||
* require 'bootstrap'
|
||||
*= require 'tinymce'
|
||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||
* listed below.
|
||||
*
|
||||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
||||
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
||||
*
|
||||
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
||||
* compiled file, but it's generally better to create a new file per style scope.
|
||||
*
|
||||
*= require_self
|
||||
* require_tree .
|
||||
*= require blueimp-gallery-all
|
||||
*= require jquery.fileupload-ui
|
||||
*= require jquery.datetimepicker
|
||||
*= require jquery.ui.dialog
|
||||
*= require jquery.ui.autocomplete
|
||||
*= require jquery.ui.progressbar
|
||||
*= require jquery.ui.tabs
|
||||
* require 'bootstrap'
|
||||
* require 'neuigkeiten'
|
||||
*/
|
||||
|
||||
*/
|
||||
// Colorshema #0A64A4
|
||||
$color_prim: #0A64A4;
|
||||
$color_prim_light: #0B65A5;
|
||||
$color_prim_vlight: #2B85C5;
|
||||
$color_cont: FFDB73;
|
||||
$color_cont_light:FFDB73;
|
||||
$linkColor: #03006E;
|
||||
$color_schema_1: #006599;
|
||||
$color_schema_2: #630CE8;
|
||||
$color_schema_3: #FF0021;
|
||||
$color_schema_4: #E8820C;
|
||||
$color_schema_5: #FFF30D;
|
||||
|
||||
$color_schema_1_dark: darken($color_schema_1, 10%);
|
||||
$color_schema_2_dark: darken($color_schema_2, 10%);
|
||||
$color_schema_3_dark: darken($color_schema_3, 10%);
|
||||
$color_schema_4_dark: darken($color_schema_4, 10%);
|
||||
$color_schema_5_dark: darken($color_schema_5, 10%);
|
||||
|
||||
$color_prim: $color_schema_1_dark; // #006599; //071672;
|
||||
|
||||
$color_prim_light: lighten($color_prim ,10%);
|
||||
$color_prim_vlight: lighten($color_prim ,30%);
|
||||
$color_prim_dark: darken($color_prim ,10%);
|
||||
$color_prim_vdark: darken($color_prim ,30%);
|
||||
|
||||
$color_cont: $color_schema_3;
|
||||
$color_cont_light:lighten($color_cont ,10%);
|
||||
$linkColor: $color_prim;
|
||||
$linkColorHover: $color_schema_1;
|
||||
$white: #FFFFFF;
|
||||
|
||||
$bodyBackground: $white;
|
||||
$navbarBackground: $color_cont;
|
||||
$navbarBackground: #FFFFFF;
|
||||
$bodyBackground: #EEE;
|
||||
|
||||
$navbarBackgroundHighlight:lighten($navbarBackground,30%);
|
||||
|
||||
|
||||
|
||||
$navbarBackground: #EEE;//$color_prim;
|
||||
$navbarText: $color_prim;
|
||||
$navbarLinkColor: $color_prim;
|
||||
$navbarLinkColorHover: $color_schema_1;
|
||||
$dropdownLinkColor: black;
|
||||
$navbar-default-brand-color: black;
|
||||
$navbarBrandColor:black;
|
||||
|
||||
|
||||
$navbarBackgroundHighlight: #EEE;
|
||||
//$navbarBackgroundHighlight:#FFFFFF;
|
||||
|
||||
$navbarLinkBackgroundHover:#FFBE00;
|
||||
$navbarLinkBackgroundHover: lighten(#cccccc,10%);
|
||||
|
||||
$navbarLinkBackgroundHover: darken($navbarBackground,10%);
|
||||
|
||||
|
||||
$infoBackground:#65A5D1;
|
||||
$infoText:#03406A;
|
||||
$sansFontFamily: Helvetica, Arial;
|
||||
|
||||
@import 'bootstrap';
|
||||
@import 'bootstrap-responsive';
|
||||
@import 'bootstrap/image-gallery';
|
||||
|
||||
@import 'font-awesome';
|
||||
|
||||
h1 {
|
||||
font-size: 23px
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 19px
|
||||
}
|
||||
|
||||
body,html {
|
||||
padding:0;
|
||||
margin:0;
|
||||
|
||||
}
|
||||
a:hover {
|
||||
text-decoration:none;
|
||||
}
|
||||
@import 'neuigkeiten';
|
||||
@import 'themengruppen';
|
||||
|
||||
div.header {
|
||||
display: block;
|
||||
// background: url('/header1.png') no-repeat;
|
||||
background-color: #FFF;
|
||||
background-position: right;
|
||||
border-bottom:1px solid black;
|
||||
height:41px;
|
||||
color:#000;
|
||||
padding-left:87px;
|
||||
padding-top:0px;
|
||||
overflow:hidden;
|
||||
margin-bottom: 20px
|
||||
display: block;
|
||||
// background: url('../../../../header1.png') no-repeat;
|
||||
// background-color:white;// $color_prim;
|
||||
// background-position: right;
|
||||
vertical-align:middle;
|
||||
float:left;
|
||||
color:#000;
|
||||
padding-top:0px;
|
||||
overflow:visible;
|
||||
height:45px;
|
||||
margin-bottom: 0 px
|
||||
}
|
||||
div.header h1 {
|
||||
padding:0;
|
||||
margin:4px;
|
||||
font-size:20px;
|
||||
line-height:32px;
|
||||
padding:0;
|
||||
margin:4px;
|
||||
font-size:20px;
|
||||
line-height:32px;
|
||||
}
|
||||
#menudiv {
|
||||
width:100%;
|
||||
div.header img {
|
||||
//top:2px;
|
||||
//position:relative;
|
||||
}
|
||||
div.navbar {
|
||||
border-bottom: $color_prim solid 3px;
|
||||
}
|
||||
div.headerrow {
|
||||
}
|
||||
|
||||
|
||||
.navbar .nav li {
|
||||
min-width:100%;
|
||||
}
|
||||
.navbar .nav .divider {
|
||||
border-style: solid;
|
||||
border-width: 1px 0px 0px 0px;
|
||||
border-color: grey;
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
.navbar .navbar-inner
|
||||
{
|
||||
border:none;
|
||||
box-shadow:none;
|
||||
}
|
||||
#contentdiv
|
||||
{
|
||||
background: #FFFFFF
|
||||
}
|
||||
#contentdiv .container-fluid
|
||||
{
|
||||
padding:0;
|
||||
}
|
||||
|
||||
a.linkbox, div.contentbox
|
||||
{
|
||||
display:block;
|
||||
padding:5px;
|
||||
border-radius: 10px;
|
||||
border: lightgray solid 1px;
|
||||
|
||||
}
|
||||
|
||||
a.linkbox:hover
|
||||
{
|
||||
box-shadow: 1px 1px 2px 2px lightgray;
|
||||
}
|
||||
|
||||
a.linkbox li
|
||||
{
|
||||
}
|
||||
ul.linkbox-list li
|
||||
{
|
||||
margin-bottom:10px;
|
||||
}
|
||||
ul.linkbox-list
|
||||
{
|
||||
max-width:70em;
|
||||
}
|
||||
|
||||
div.contentbox
|
||||
{
|
||||
margin: 5px;
|
||||
}
|
||||
$contentdiv-background:none;
|
||||
$navbar-li-minwidth: 0;
|
||||
|
||||
|
||||
.navbar .nav li {
|
||||
min-width:100%;
|
||||
background:44F;
|
||||
}
|
||||
|
||||
@import 'galleries';
|
||||
@import 'tinymce';
|
||||
@import 'linkboxes';
|
||||
$box-border: #ccc solid 1px;
|
||||
$box-border-radius:0px;
|
||||
$box-background: white;
|
||||
|
||||
@import 'layout';
|
||||
@import 'linkboxes';
|
||||
@import 'calendars';
|
||||
@import 'formtastic-bootstrap'
|
||||
61
app/assets/stylesheets/linkboxes.css.scss
Normal file
61
app/assets/stylesheets/linkboxes.css.scss
Normal file
@@ -0,0 +1,61 @@
|
||||
ul.linkbox-list
|
||||
{
|
||||
max-width:70em;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
}
|
||||
a.linkbox, div.contentbox
|
||||
{
|
||||
display:block;
|
||||
padding:5px;
|
||||
border-radius:$box-border-radius;
|
||||
border: $box-border;
|
||||
background: $box-background;
|
||||
}
|
||||
|
||||
a.linkbox:hover{ box-shadow: 1px 1px 2px 2px lightgray; }
|
||||
|
||||
a.linkbox.color-1 { color:$color_schema_1; }
|
||||
a.linkbox.color-2 { color:$color_schema_2; }
|
||||
a.linkbox.color-3 { color:$color_schema_3; }
|
||||
a.linkbox.color-4 { color:$color_schema_4;}
|
||||
a.linkbox.color-5 { color:$color_schema_5;}
|
||||
|
||||
a.color-1-dark { color:$color_schema_1_dark; }
|
||||
a.color-2-dark { color:$color_schema_2_dark; }
|
||||
a.color-3-dark { color:$color_schema_3_dark;}
|
||||
a.color-4-dark { color:$color_schema_4_dark;}
|
||||
a.color-5-dark { color:$color_schema_5_dark;}
|
||||
a.color-1-dark:hover { color:$color_schema_1; }
|
||||
a.color-2-dark:hover { color:$color_schema_2; }
|
||||
a.color-3-dark:hover { color:$color_schema_3; }
|
||||
a.color-4-dark:hover { color:$color_schema_4; }
|
||||
a.color-5-dark:hover { color:$color_schema_5; }
|
||||
|
||||
a.linkbox li { }
|
||||
ul.linkbox-list li {
|
||||
margin-bottom:10px;
|
||||
}
|
||||
ul.linklist {
|
||||
max-width:100%;
|
||||
padding:0;
|
||||
margin:5px;
|
||||
}
|
||||
ul.linklist li {
|
||||
list-style:none;
|
||||
margin-bottom:2px;
|
||||
}
|
||||
ul.linklist li a i{
|
||||
vertical-align:middle;
|
||||
margin-right:6px;
|
||||
font-size:2em;}
|
||||
span.linklist a {
|
||||
padding:5px;
|
||||
border-radius:$box-border-radius;
|
||||
border: $box-border;
|
||||
background: $box-background;
|
||||
display:block;
|
||||
float:left;
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ class BeispieleController < ApplicationController
|
||||
def new
|
||||
@beispiel = Beispiel.new
|
||||
@beispiel.lva = Lva.find_by_id(params[:lva_id])
|
||||
@beispiel.flag_delete=false
|
||||
@backlink = @beispiel.lva.nil? ? root_url : lva_path(@beispiel.lva)
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
@@ -43,6 +44,7 @@ class BeispieleController < ApplicationController
|
||||
@beispiel = Beispiel.find(params[:id])
|
||||
@beispiel.lecturer = Lecturer.find(params[:beispiel][:lecturer_id])
|
||||
@beispiel.save
|
||||
|
||||
if @beispiel.save
|
||||
format.html { redirect_to @backlink, notice: 'Beispiel was successfully updated.' }
|
||||
format.js {render text: "alert(\"updated\");"}
|
||||
@@ -66,8 +68,9 @@ class BeispieleController < ApplicationController
|
||||
logger.info "Creating Beispiel..."
|
||||
@lva = Lva.find_by_id(params[:lva_id])
|
||||
params.delete(:lva_id)
|
||||
params[:beispiel][:flag_delete]=false
|
||||
@beispiel = Beispiel.new(params[:beispiel])
|
||||
|
||||
@beispiel.flag_delete=false
|
||||
logger.info "New Beispiel: #{params.inspect}"
|
||||
|
||||
@beispiel.name=@beispiel.beispieldatei.filename
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
<% if neuigkeit_view.nil?
|
||||
neuigkeit_view=@neuigkeit
|
||||
end
|
||||
%>
|
||||
<div id="neuigkeit_<%= neuigkeit_view.id %>" class="contentbox" itemscope itemtype="http://schema.org/Article">
|
||||
<%= meta_itemprop("about", neuigkeit_view.text_first_words) %>
|
||||
<%= meta_itemprop("sameAs", neuigkeit_url(neuigkeit_view,:theme=>nil)) %>
|
||||
<%= meta_itemprop("url", neuigkeit_url(neuigkeit_view,:theme=>nil)) %>
|
||||
|
||||
<div>
|
||||
<% cache("menu_neuigkeit"+ neuigkeit_view.id.to_s + can?(:edit,neuigkeit_view).to_s + can?(:find_link, neuigkeit_view).to_s + can?(:new, Survey::Question).to_s + can?(:publish, neuigkeit_view).to_s + can?(:unpublish, neuigkeit_view).to_s + neuigkeit_view.published?.to_s ) do %>
|
||||
<%= render partial: "neuigkeiten/menu", object: neuigkeit_view %>
|
||||
<% cache("menu_neuigkeit"+ neuigkeit_view.id.to_s + can?(:edit,neuigkeit_view).to_s + can?(:find_link, neuigkeit_view).to_s + can?(:new, Survey::Question).to_s + can?(:publish, neuigkeit_view).to_s + can?(:unpublish, neuigkeit_view).to_s + neuigkeit_view.published?.to_s + neuigkeit_view.flag_important.to_s + neuigkeit_view.flag_infoscreen.to_s) do %>
|
||||
<%= render partial: "menu" , object: neuigkeit_view%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -31,7 +31,7 @@ Fetsite::Application.configure do
|
||||
# config.force_ssl = true
|
||||
|
||||
# See everything in the log (default is :info)
|
||||
config.log_level = :debug
|
||||
config.log_level = :info
|
||||
|
||||
# Prepend all log lines with the following tags
|
||||
config.log_tags = [ :remote_ip , :uuid ]
|
||||
|
||||
74
config/initializers/sunspot.rb
Normal file
74
config/initializers/sunspot.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
# config/initializers/sunspot.rb
|
||||
module Sunspot
|
||||
#
|
||||
# DataExtractors present an internal API for the indexer to use to extract
|
||||
# field values from models for indexing. They must implement the #value_for
|
||||
# method, which takes an object and returns the value extracted from it.
|
||||
#
|
||||
module DataExtractor #:nodoc: all
|
||||
#
|
||||
# AttributeExtractors extract data by simply calling a method on the block.
|
||||
#
|
||||
class AttributeExtractor
|
||||
def initialize(attribute_name)
|
||||
@attribute_name = attribute_name
|
||||
end
|
||||
|
||||
def value_for(object)
|
||||
Filter.new( object.send(@attribute_name) ).value
|
||||
end
|
||||
end
|
||||
#
|
||||
# BlockExtractors extract data by evaluating a block in the context of the
|
||||
# object instance, or if the block takes an argument, by passing the object
|
||||
# as the argument to the block. Either way, the return value of the block is
|
||||
# the value returned by the extractor.
|
||||
#
|
||||
class BlockExtractor
|
||||
def initialize(&block)
|
||||
@block = block
|
||||
end
|
||||
|
||||
def value_for(object)
|
||||
Filter.new( Util.instance_eval_or_call(object, &@block) ).value
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# Constant data extractors simply return the same value for every object.
|
||||
#
|
||||
class Constant
|
||||
def initialize(value)
|
||||
@value = value
|
||||
end
|
||||
|
||||
def value_for(object)
|
||||
Filter.new(@value).value
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# A Filter to allow easy value cleaning
|
||||
#
|
||||
class Filter
|
||||
def initialize(value)
|
||||
@value = value
|
||||
end
|
||||
def value
|
||||
strip_control_characters @value
|
||||
end
|
||||
def strip_control_characters(value)
|
||||
return value unless value.is_a? String
|
||||
|
||||
value.chars.inject("") do |str, char|
|
||||
unless char.ascii_only? and (char.ord < 32 or char.ord == 127)
|
||||
str << char
|
||||
end
|
||||
str
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
45
config/unicorn.rb
Normal file
45
config/unicorn.rb
Normal file
@@ -0,0 +1,45 @@
|
||||
# config/unicorn.rb
|
||||
|
||||
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 5)
|
||||
timeout 60
|
||||
preload_app true
|
||||
listen "/var/run/fetsite.sock"
|
||||
stderr_path "/var/log/unicorn.log"
|
||||
stdout_path "/var/log/unicorn.log"
|
||||
|
||||
before_fork do |server, worker|
|
||||
Signal.trap 'TERM' do
|
||||
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
|
||||
Process.kill 'QUIT', Process.pid
|
||||
end
|
||||
|
||||
defined?(ActiveRecord::Base) and
|
||||
ActiveRecord::Base.connection.disconnect!
|
||||
end
|
||||
|
||||
after_fork do |server, worker|
|
||||
Signal.trap 'TERM' do
|
||||
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
|
||||
end
|
||||
|
||||
defined?(ActiveRecord::Base) and
|
||||
ActiveRecord::Base.establish_connection
|
||||
begin
|
||||
uid, gid = Process.euid, Process.egid
|
||||
user, group = 'fetsite', 'nogroup'
|
||||
target_uid = Etc.getpwnam(user).uid
|
||||
target_gid = Etc.getgrnam(group).gid
|
||||
worker.tmp.chown(target_uid, target_gid)
|
||||
if uid != target_uid || gid != target_gid
|
||||
Process.initgroups(user, target_gid)
|
||||
Process::GID.change_privilege(target_gid)
|
||||
Process::UID.change_privilege(target_uid)
|
||||
end
|
||||
rescue => e
|
||||
if RAILS_ENV == 'development'
|
||||
STDERR.puts "couldn't change user, oh well"
|
||||
else
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user