Merge /home/andis/fetsite
This commit is contained in:
0
Fetmailalias,
Normal file
0
Fetmailalias,
Normal file
33
Gemfile
33
Gemfile
@@ -13,8 +13,8 @@ gem 'webrick', '1.3.1'
|
|||||||
|
|
||||||
# Gems used only for assets and not required
|
# Gems used only for assets and not required
|
||||||
# in production environments by default.
|
# in production environments by default.
|
||||||
gem 'sass-rails', '~> 3.2'
|
gem 'sass-rails', '~> 3.0'
|
||||||
gem 'coffee-rails', '~> 3.2.1'
|
gem 'coffee-rails', '~> 3.0'
|
||||||
gem 'bootstrap-sass','~> 2.3.2.1'
|
gem 'bootstrap-sass','~> 2.3.2.1'
|
||||||
|
|
||||||
group :assets do
|
group :assets do
|
||||||
@@ -60,16 +60,17 @@ gem "paper_trail" , '~>3.0.5'#, :git=>'git://github.com/airblade/paper_trail.git
|
|||||||
|
|
||||||
# User management
|
# User management
|
||||||
gem "devise" ,'~>2.2.3'
|
gem "devise" ,'~>2.2.3'
|
||||||
gem "omniauth"
|
gem "omniauth", '~>1.2.2'
|
||||||
gem "omniauth-facebook"
|
gem "omniauth-facebook", '~>2.0.0'
|
||||||
gem "omniauth-ldap"
|
gem "omniauth-ldap", '~>1.0.4'
|
||||||
|
|
||||||
gem "fb_graph"
|
gem "fb_graph",'~>2.7.17'
|
||||||
gem "meta-tags"
|
gem "meta-tags"
|
||||||
# Roles for users
|
# Roles for users
|
||||||
gem "rolify"
|
gem "rolify", '~>4.0.0'
|
||||||
# Abilities
|
# Abilities
|
||||||
gem "cancan"
|
gem "cancan", '~>1.6.0'
|
||||||
|
|
||||||
|
|
||||||
# Fileupload
|
# Fileupload
|
||||||
|
|
||||||
@@ -84,8 +85,16 @@ gem 'awesome_nested_set'
|
|||||||
gem 'annotate', ">=2.5.0"
|
gem 'annotate', ">=2.5.0"
|
||||||
gem 'carrierwave', "~>0.9.0"
|
gem 'carrierwave', "~>0.9.0"
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
gem 'factory_girl_rails'
|
gem 'factory_girl_rails',"~>4.5.0"
|
||||||
gem 'rspec-rails'
|
gem 'minitest', "~>4.7.5"
|
||||||
|
gem 'progress_bar'
|
||||||
|
gem 'rspec-core', '~>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 'capybara', '~>2.5.0'
|
||||||
end
|
end
|
||||||
|
|
||||||
gem "simple_calendar", "~> 0.1.9"
|
gem "simple_calendar", "~> 0.1.9"
|
||||||
@@ -93,7 +102,7 @@ gem 'rmagick'
|
|||||||
|
|
||||||
gem 'bootstrap-addons-rails'
|
gem 'bootstrap-addons-rails'
|
||||||
gem "jquery-fileupload-rails", "0.4.1"
|
gem "jquery-fileupload-rails", "0.4.1"
|
||||||
gem "jquery-ui-rails","~> 4.1.1"
|
gem "jquery-ui-rails","~> 4.1.0"
|
||||||
gem "font-awesome-rails"
|
gem "font-awesome-rails"
|
||||||
gem "jquery-datetimepicker-rails"
|
gem "jquery-datetimepicker-rails"
|
||||||
# gem "jquery-sortable-rails"
|
# gem "jquery-sortable-rails"
|
||||||
@@ -125,3 +134,5 @@ gem 'blueimp-gallery'
|
|||||||
gem 'blueimp-gallery-rails'
|
gem 'blueimp-gallery-rails'
|
||||||
|
|
||||||
gem 'shareable'
|
gem 'shareable'
|
||||||
|
|
||||||
|
gem 'sunspot_test'
|
||||||
2659
app/assets/javascripts/jmpress.js
Normal file
2659
app/assets/javascripts/jmpress.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,10 @@
|
|||||||
* require_tree .
|
* require_tree .
|
||||||
*= require 'calendars'
|
*= require 'calendars'
|
||||||
*= require jquery.fileupload-ui
|
*= require jquery.fileupload-ui
|
||||||
|
*= require jquery.ui.progressbar
|
||||||
|
*= require jquery.datetimepicker
|
||||||
|
*= require jquery.ui.dialog
|
||||||
|
*= require jquery.ui.tabs
|
||||||
* require 'bootstrap'
|
* require 'bootstrap'
|
||||||
*= require 'tinymce'
|
*= require 'tinymce'
|
||||||
|
|
||||||
@@ -147,3 +151,4 @@ background:44F;
|
|||||||
|
|
||||||
@import 'galleries';
|
@import 'galleries';
|
||||||
@import 'tinymce';
|
@import 'tinymce';
|
||||||
|
@import 'linkboxes';
|
||||||
@@ -44,98 +44,6 @@ a:hover {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.contentbox
|
div.contentbox
|
||||||
{
|
{
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
@@ -175,28 +83,6 @@ div.smallspan {
|
|||||||
min-height:0;
|
min-height:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
form.inline div {
|
form.inline div {
|
||||||
float:left;}
|
float:left;}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
*= require jquery.datetimepicker
|
*= require jquery.datetimepicker
|
||||||
*= require jquery.ui.dialog
|
*= require jquery.ui.dialog
|
||||||
*= require jquery.ui.autocomplete
|
*= require jquery.ui.autocomplete
|
||||||
|
*= require jquery.ui.progressbar
|
||||||
*= require jquery.ui.tabs
|
*= require jquery.ui.tabs
|
||||||
* require 'bootstrap'
|
* require 'bootstrap'
|
||||||
* require 'neuigkeiten'
|
* require 'neuigkeiten'
|
||||||
@@ -117,5 +118,6 @@ $box-border-radius:0px;
|
|||||||
$box-background: white;
|
$box-background: white;
|
||||||
|
|
||||||
@import 'layout';
|
@import 'layout';
|
||||||
|
@import 'linkboxes';
|
||||||
@import 'calendars';
|
@import 'calendars';
|
||||||
@import 'formtastic-bootstrap'
|
@import 'formtastic-bootstrap'
|
||||||
61
app/assets/stylesheets/themes/blue1/linkboxes.css.scss
Normal file
61
app/assets/stylesheets/themes/blue1/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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
|
/* This is the main file for theme "blue2"
|
||||||
|
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||||
* listed below.
|
* listed below.
|
||||||
@@ -15,6 +17,8 @@
|
|||||||
*= require jquery.datetimepicker
|
*= require jquery.datetimepicker
|
||||||
*= require jquery.ui.dialog
|
*= require jquery.ui.dialog
|
||||||
*= require jquery.ui.tabs
|
*= require jquery.ui.tabs
|
||||||
|
*= require jquery.ui.progressbar
|
||||||
|
|
||||||
* require 'bootstrap'
|
* require 'bootstrap'
|
||||||
|
|
||||||
* require 'neuigkeiten'
|
* require 'neuigkeiten'
|
||||||
@@ -89,9 +93,11 @@ div.header {
|
|||||||
height:45px;
|
height:45px;
|
||||||
margin-bottom: 0 px
|
margin-bottom: 0 px
|
||||||
}
|
}
|
||||||
|
|
||||||
div.header_span {
|
div.header_span {
|
||||||
background:white
|
background:white
|
||||||
}
|
}
|
||||||
|
|
||||||
div.header h1 {
|
div.header h1 {
|
||||||
padding:0;
|
padding:0;
|
||||||
margin:4px;
|
margin:4px;
|
||||||
@@ -117,16 +123,16 @@ $navbar-li-minwidth: 0;
|
|||||||
|
|
||||||
|
|
||||||
$box-border: lightgray solid 1px;
|
$box-border: lightgray solid 1px;
|
||||||
$box-border-radius:4px;
|
$box-border-radius:6px;
|
||||||
$box-background: white;
|
$box-background: white;
|
||||||
|
|
||||||
@import 'layout';
|
@import 'layout';
|
||||||
@import 'calendars';
|
@import 'calendars';
|
||||||
@import 'formtastic-bootstrap';
|
@import 'formtastic-bootstrap';
|
||||||
|
@import 'linkboxes';
|
||||||
@import 'extra';
|
@import 'extra';
|
||||||
body {
|
body {
|
||||||
background: #FFF; //#EFEFEF;
|
background: #FCFCFC; //#EFEFEF;
|
||||||
background-size:100%;
|
background-size:100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
142
app/assets/stylesheets/themes/blue2/linkboxes.css.scss
Normal file
142
app/assets/stylesheets/themes/blue2/linkboxes.css.scss
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
ul.linkbox-list
|
||||||
|
{
|
||||||
|
max-width:70em;
|
||||||
|
margin-left:auto;
|
||||||
|
margin-right:auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.linkbox-list > li {
|
||||||
|
margin-bottom:0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.linkbox-list > li:first-child a.linkbox {
|
||||||
|
border-top-left-radius:$box-border-radius;
|
||||||
|
border-top-right-radius:$box-border-radius;
|
||||||
|
border: $box-border;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.linkbox-list > li:last-child a.linkbox {
|
||||||
|
border-bottom-left-radius:$box-border-radius;
|
||||||
|
border-bottom-right-radius:$box-border-radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.linkbox-list > li a.linkbox {
|
||||||
|
border-radius: 0;
|
||||||
|
border-top: none;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.linkbox-list > li a.linkbox:hover {
|
||||||
|
z-index:2000
|
||||||
|
}
|
||||||
|
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.linklist {
|
||||||
|
max-width:100%;
|
||||||
|
padding:0;
|
||||||
|
margin:5px;
|
||||||
|
}
|
||||||
|
ul.linklist li {
|
||||||
|
list-style:none;
|
||||||
|
|
||||||
|
}
|
||||||
|
ul.linklist li a i{
|
||||||
|
vertical-align:middle;
|
||||||
|
margin-right:6px;
|
||||||
|
font-size:2em;}
|
||||||
|
|
||||||
|
ul.linklist > li a.linkbox {
|
||||||
|
border-radius: 0;
|
||||||
|
border: $box-border;
|
||||||
|
/* border-color:white;*/
|
||||||
|
padding-top: 7px;
|
||||||
|
margin-bottom:0px;
|
||||||
|
margin-top:0px;
|
||||||
|
|
||||||
|
/* border-bottom: $box-border;
|
||||||
|
border-top: $box-border;
|
||||||
|
*/
|
||||||
|
border-color:white;
|
||||||
|
/* border-bottom-color:white; */
|
||||||
|
|
||||||
|
}
|
||||||
|
ul.linklist > li a.linkbox:hover {
|
||||||
|
|
||||||
|
border: $box-border;
|
||||||
|
border-top: $box-border;
|
||||||
|
box-shadow: none;
|
||||||
|
border-color: black;
|
||||||
|
background: #FCFCFC;
|
||||||
|
/* margin: 0;
|
||||||
|
margin-bottom:0px;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ul.linklist > li:first-child a.linkbox {}
|
||||||
|
|
||||||
|
ul.linklist > li:last-child a.linkbox {
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.linklist > li:first-child a.linkbox {
|
||||||
|
border-top-left-radius:$box-border-radius;
|
||||||
|
border-top-right-radius:$box-border-radius;
|
||||||
|
/* border-top:$box-border; */
|
||||||
|
margin-top:0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.linklist > li:last-child a.linkbox {
|
||||||
|
border-bottom-left-radius:$box-border-radius;
|
||||||
|
border-bottom-right-radius:$box-border-radius;
|
||||||
|
/* border-bottom:$box-border;*/
|
||||||
|
margin-bottom:0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.linklist {
|
||||||
|
border-radius: $box-border-radius;
|
||||||
|
border: $box-border;
|
||||||
|
/* box-shadow: 0px 0px 1px 1px lightgray;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
span.linklist li a {
|
||||||
|
padding:5px;
|
||||||
|
border: $box-border;
|
||||||
|
background: $box-background;
|
||||||
|
display:block;
|
||||||
|
float:left;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -16,7 +16,13 @@
|
|||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
I18n.locale = session[:locale] || request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^de|en/).first || I18n.default_locale
|
http_header=request.env['HTTP_ACCEPT_LANGUAGE']
|
||||||
|
unless http_header.nil?
|
||||||
|
ht= http_header.scan(/^de|en/).first
|
||||||
|
else
|
||||||
|
ht=nil
|
||||||
|
end
|
||||||
|
I18n.locale = session[:locale] || ht || I18n.default_locale
|
||||||
|
|
||||||
|
|
||||||
session[:locale] = I18n.locale
|
session[:locale] = I18n.locale
|
||||||
@@ -46,7 +52,8 @@
|
|||||||
else
|
else
|
||||||
flash[:error] = "You must first login to view this page"
|
flash[:error] = "You must first login to view this page"
|
||||||
session[:user_return_to] = request.url
|
session[:user_return_to] = request.url
|
||||||
redirect_to "/users/sign_in"
|
return redirect_to "/users/sign_in"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ class DocumentsController < ApplicationController
|
|||||||
@results = Document.search do
|
@results = Document.search do
|
||||||
fulltext params['query'] do
|
fulltext params['query'] do
|
||||||
fields :name, :text, :meeting
|
fields :name, :text, :meeting
|
||||||
highlight :text
|
highlight :text,:name,:meeting
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@res=[]
|
@res=[]
|
||||||
|
|||||||
22
app/controllers/emails_controller.rb
Normal file
22
app/controllers/emails_controller.rb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
class EmailsController < ApplicationController
|
||||||
|
before_filter :authorize
|
||||||
|
|
||||||
|
def index
|
||||||
|
|
||||||
|
end
|
||||||
|
def daily_reminder
|
||||||
|
ActionMailer::Base.default_url_options[:host] = request.host_with_port
|
||||||
|
@mail =NewsMailer.daily_reminder(current_user.id)
|
||||||
|
if params[:send]
|
||||||
|
usr=User.where(:flag_getemails => true)
|
||||||
|
usr.each do |u|
|
||||||
|
NewsMailer.daily_reminder(current_user.id).deliver
|
||||||
|
end
|
||||||
|
end
|
||||||
|
render layout: false
|
||||||
|
end
|
||||||
|
protected
|
||||||
|
def authorize
|
||||||
|
authorize! :emails, User
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -9,7 +9,6 @@ class FetprofilesController < ApplicationController
|
|||||||
@fetprofiles = Fetprofile.order(:vorname,:nachname) if params[:filter]== "all"
|
@fetprofiles = Fetprofile.order(:vorname,:nachname) if params[:filter]== "all"
|
||||||
@fetprofiles = Fetprofile.where(:active=>false).order(:nachname,:vorname) if params[:filter]== "notactive"
|
@fetprofiles = Fetprofile.where(:active=>false).order(:nachname,:vorname) if params[:filter]== "notactive"
|
||||||
|
|
||||||
|
|
||||||
@gremientabs = Gremium.tabs
|
@gremientabs = Gremium.tabs
|
||||||
@toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('profile.new_profile'),:path => new_fetprofile_path(@fetprofile) } if can? :new, @fetprofile
|
@toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('profile.new_profile'),:path => new_fetprofile_path(@fetprofile) } if can? :new, @fetprofile
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ class HomeController < ApplicationController
|
|||||||
end
|
end
|
||||||
def dev
|
def dev
|
||||||
|
|
||||||
|
end
|
||||||
|
def infoscreen
|
||||||
|
authorize! :doadmin, User
|
||||||
|
@neuigkeiten = Neuigkeit.accessible_by(current_ability, :show).where(flag_infoscreen: true)
|
||||||
|
render layout: false
|
||||||
end
|
end
|
||||||
def kontakt
|
def kontakt
|
||||||
t=YAML.load_file("#{::Rails.root.to_s}/config/contact_topic.yml")
|
t=YAML.load_file("#{::Rails.root.to_s}/config/contact_topic.yml")
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class NeuigkeitenController < ApplicationController
|
|||||||
|
|
||||||
before_filter :load_toolbar_elements, :only=>[:show,:find_link]
|
before_filter :load_toolbar_elements, :only=>[:show,:find_link]
|
||||||
before_filter :load_toolbar_elements_edit, :only=>[:edit]
|
before_filter :load_toolbar_elements_edit, :only=>[:edit]
|
||||||
|
acts_as_flagable
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -119,12 +120,15 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
def mail_preview
|
def mail_preview
|
||||||
|
ActionMailer::Base.default_url_options[:host] = request.host_with_port
|
||||||
|
|
||||||
@neuigkeit = Neuigkeit.find(params[:id])
|
@neuigkeit = Neuigkeit.find(params[:id])
|
||||||
@user=current_user
|
@user=current_user
|
||||||
@ability=Ability.new(@user)
|
@ability=Ability.new(@user)
|
||||||
|
@mail = NewsMailer.neuigkeit_mail("all@fet.at", params[:id])
|
||||||
|
|
||||||
authorize! :publish, @neuigkeit
|
authorize! :publish, @neuigkeit
|
||||||
render template: "news_mailer/neuigkeit_mail", layout: false
|
render layout: false
|
||||||
end
|
end
|
||||||
def newsletter_preview
|
def newsletter_preview
|
||||||
authorize! :publish, Neuigkeit
|
authorize! :publish, Neuigkeit
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class RubrikenController < ApplicationController
|
|||||||
@rubriken= Rubrik.accessible_by(current_ability, :show)
|
@rubriken= Rubrik.accessible_by(current_ability, :show)
|
||||||
@neuigkeiten = Neuigkeit.accessible_by(current_ability, :list).page(params[:page]).per(3)
|
@neuigkeiten = Neuigkeit.accessible_by(current_ability, :list).page(params[:page]).per(3)
|
||||||
|
|
||||||
@calentries= (@rubriken.map {|r| r.calendar}).collect(&:calentries).flatten.select {|c| c.object !=nil}
|
@calentries= (@rubriken.map {|r| r.calendar.calentries.of_month(Date.new(params[:year],params[:month],1))}).flatten.select {|c| c.object !=nil}
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.js {render action: :show}
|
format.js {render action: :show}
|
||||||
|
|||||||
@@ -1,8 +1,22 @@
|
|||||||
class UsersController < ApplicationController
|
class UsersController < ApplicationController
|
||||||
def index
|
def index
|
||||||
|
authorize!(:index,User)
|
||||||
@users = User.all
|
@users = User.all
|
||||||
end
|
end
|
||||||
|
def show
|
||||||
|
@user=User.find(params[:id])
|
||||||
|
authorize!(:show, @user)
|
||||||
|
|
||||||
|
end
|
||||||
|
def set_preferred_theme
|
||||||
|
@user=User.find(params[:id])
|
||||||
|
authorize!(:set_preferred_theme, @user)
|
||||||
|
@user.preferredtheme=params[:theme]
|
||||||
|
@user.save
|
||||||
|
redirect_to root_url
|
||||||
|
end
|
||||||
def add_role
|
def add_role
|
||||||
|
authorize!(:add_role, User)
|
||||||
@user= User.find(params[:id])
|
@user= User.find(params[:id])
|
||||||
if (params[:role]=="fetuser" && can?(:addfetuser,User))
|
if (params[:role]=="fetuser" && can?(:addfetuser,User))
|
||||||
@user.add_role(params[:role])
|
@user.add_role(params[:role])
|
||||||
@@ -13,6 +27,8 @@ class UsersController < ApplicationController
|
|||||||
redirect_to users_url
|
redirect_to users_url
|
||||||
end
|
end
|
||||||
def fb_set_default_publish_page
|
def fb_set_default_publish_page
|
||||||
|
authorize!(:doadmin, User)
|
||||||
|
|
||||||
if Fetsite::Application.config.facebookconfig_enabled
|
if Fetsite::Application.config.facebookconfig_enabled
|
||||||
if params["page"].nil? || !(current_user.provider=="facebook")
|
if params["page"].nil? || !(current_user.provider=="facebook")
|
||||||
redirect_to intern_home_index_path
|
redirect_to intern_home_index_path
|
||||||
@@ -27,6 +43,7 @@ class UsersController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def all_update
|
def all_update
|
||||||
|
authorize! :doadmin,User
|
||||||
params[:users].each do |id,u|
|
params[:users].each do |id,u|
|
||||||
user=User.find(id)
|
user=User.find(id)
|
||||||
user.fetprofile = Fetprofile.find(u[:fetprofile_id].to_i) if u[:fetprofile_id].to_i>0
|
user.fetprofile = Fetprofile.find(u[:fetprofile_id].to_i) if u[:fetprofile_id].to_i>0
|
||||||
|
|||||||
@@ -1,23 +1,44 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
class NewsMailer < ActionMailer::Base
|
class NewsMailer < ActionMailer::Base
|
||||||
default from: "salzamt@fet.at"
|
default from: "salzamt@fet.at"
|
||||||
helper :plugins
|
helper :plugins
|
||||||
def current_user
|
|
||||||
@user
|
|
||||||
end
|
|
||||||
def neuigkeit_mail(email, neuigkeit_id)
|
def neuigkeit_mail(email, neuigkeit_id)
|
||||||
@neuigkeit= Neuigkeit.find(neuigkeit_id)
|
@neuigkeit= Neuigkeit.find(neuigkeit_id)
|
||||||
@user=User.first
|
@user=User.first
|
||||||
@ability=Ability.new(@user)
|
@ability=Ability.new(@user)
|
||||||
subject = @neuigkeit.title
|
subject = @neuigkeit.title
|
||||||
subject = subject + " email: " + email if Rails.env=="development"
|
subject = subject.to_s + " email: " + email.to_s if Rails.env=="development"
|
||||||
email = "andis@fet.at" if Rails.env=="development"
|
email = "andis@fet.at" if Rails.env=="development"
|
||||||
email="andis@fet.at"
|
email="andis@fet.at"
|
||||||
mail(to: email, subject: subject)
|
mail(to: email, subject: subject)
|
||||||
render locals: {current_user: User.first}
|
render locals: {current_user: User.first}
|
||||||
end
|
end
|
||||||
def daily_newsletter(user_id)
|
def daily_newsletter(user_id)
|
||||||
user=User.find(user_id)
|
user=User.find(user_id)
|
||||||
|
self.message.perform_deliveries = false unless user.flag_getemails
|
||||||
ability= Ability.new(user)
|
ability= Ability.new(user)
|
||||||
|
|
||||||
@neuigkeiten=Neuigkeit.accessible_by(ability).published_scope.where("cache_order<2")
|
@neuigkeiten=Neuigkeit.accessible_by(ability).published_scope.where("cache_order<2")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def daily_reminder(user_id)
|
||||||
|
user=User.find(user_id)
|
||||||
|
@user=user
|
||||||
|
self.message.perform_deliveries = false unless user.flag_getemails
|
||||||
|
@ability = Ability.new(user)
|
||||||
|
@calentries = Calentry.of_month(Date.today).limit(100)
|
||||||
|
# @neuigkeiten=Neuigkeit.accessiblße_by(ability).published_scope.where("cache_order<2")
|
||||||
|
mail(to: user.email, content_type: "text/html", subject: "sdf")
|
||||||
|
render locals: {c_user: user}
|
||||||
|
end
|
||||||
|
private
|
||||||
|
include CanCan::ControllerAdditions
|
||||||
|
def current_user
|
||||||
|
@user
|
||||||
|
end
|
||||||
|
def current_ability
|
||||||
|
@ability
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ end
|
|||||||
can :show, Neuigkeit, :cache_is_published=>true, :rubrik=>{:public=>true}
|
can :show, Neuigkeit, :cache_is_published=>true, :rubrik=>{:public=>true}
|
||||||
|
|
||||||
if loggedin
|
if loggedin
|
||||||
|
can :show, :id => user.id
|
||||||
end
|
end
|
||||||
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
|
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
|
||||||
|
|
||||||
@@ -159,6 +160,7 @@ end
|
|||||||
can :showintern, Neuigkeit
|
can :showintern, Neuigkeit
|
||||||
can :showintern, Rubrik
|
can :showintern, Rubrik
|
||||||
can :seeintern, User
|
can :seeintern, User
|
||||||
|
can :set_preferred_theme, user
|
||||||
can :list, Neuigkeit
|
can :list, Neuigkeit
|
||||||
can :shownonpublic, Rubrik
|
can :shownonpublic, Rubrik
|
||||||
can :manage, Nlink
|
can :manage, Nlink
|
||||||
@@ -169,8 +171,12 @@ end
|
|||||||
if user.has_role?("fetadmin")
|
if user.has_role?("fetadmin")
|
||||||
can :addfetuser, User
|
can :addfetuser, User
|
||||||
can :addfetadmin, User
|
can :addfetadmin, User
|
||||||
|
can :add_role, User
|
||||||
|
can :show, User
|
||||||
|
can :index, User
|
||||||
can :edit, User
|
can :edit, User
|
||||||
can :manage, User
|
can :manage, User
|
||||||
|
can :set_preferred_theme, User
|
||||||
end
|
end
|
||||||
|
|
||||||
if user.has_role?("newsadmin") || user.has_role?( "fetadmin") || user.has_role?( "fetuser")
|
if user.has_role?("newsadmin") || user.has_role?( "fetadmin") || user.has_role?( "fetuser")
|
||||||
@@ -227,7 +233,8 @@ end
|
|||||||
can :doadmin, User
|
can :doadmin, User
|
||||||
end
|
end
|
||||||
|
|
||||||
unless user.has_role?("fetadmin")
|
if user.has_role?("fetadmin")
|
||||||
|
can :emails,User
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,14 +14,14 @@
|
|||||||
|
|
||||||
class Calentry < ActiveRecord::Base
|
class Calentry < ActiveRecord::Base
|
||||||
attr_accessible :ende, :start, :summary, :typ,:calendar_ids, :calendar, :dauer, :object_id, :object_type
|
attr_accessible :ende, :start, :summary, :typ,:calendar_ids, :calendar, :dauer, :object_id, :object_type
|
||||||
belongs_to :calendar
|
belongs_to :calendar, touch: true
|
||||||
#belongs_to :neuigkeit
|
#belongs_to :neuigkeit
|
||||||
validates :start, :presence => true
|
validates :start, :presence => true
|
||||||
validates :object, :presence => true
|
validates :object, :presence => true
|
||||||
validates :typ, :presence => true
|
validates :typ, :presence => true
|
||||||
before_save :get_public
|
before_save :get_public
|
||||||
belongs_to :object, polymorphic: true, touch: true # Objekt zu dem der Calentry gehört (derzeit ein Newsartikel)
|
belongs_to :object, polymorphic: true, touch: true # Objekt zu dem der Calentry gehört (derzeit ein Newsartikel)
|
||||||
|
scope :of_month, ->(d) {where("start >= ? AND start <= ?", d.beginning_of_month, d.end_of_month)}
|
||||||
scope :upcoming, ->{ where("start >= ?", Time.now).order(:start)}
|
scope :upcoming, ->{ where("start >= ?", Time.now).order(:start)}
|
||||||
scope :recent,-> { where("start <= ?", Time.now).order(:start).reverse_order}
|
scope :recent,-> { where("start <= ?", Time.now).order(:start).reverse_order}
|
||||||
validate do |entry|
|
validate do |entry|
|
||||||
@@ -31,7 +31,10 @@ class Calentry < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
resourcify
|
resourcify
|
||||||
|
def self.updated_at
|
||||||
|
#Calentry.select("MAX(updated_at) as m_updated_at").first.m_updated_at
|
||||||
|
Calentry.all.max_by(&:updated_at).updated_at
|
||||||
|
end
|
||||||
def is_upcomming?
|
def is_upcomming?
|
||||||
self.start > Time.now
|
self.start > Time.now
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class Document < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
text :name, :boost=>4.0, :stored=> true
|
text :name, :boost=>4.0, :stored=> true
|
||||||
text :meeting, stored: true do |d|
|
text :meeting, stored: true do |d|
|
||||||
(d.parent_type == "Meeting")? d.try(:parent).try(:text).to_s : ""
|
(d.parent.is_a?(Meeting))? d.try(:parent).try(:text).to_s : ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def maketoc
|
def maketoc
|
||||||
|
|||||||
@@ -78,3 +78,5 @@ class Fetprofile < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class Gremium < ActiveRecord::Base
|
|||||||
has_many :memberships, dependent: :destroy # Mitgliedschaften bei dem Gremium
|
has_many :memberships, dependent: :destroy # Mitgliedschaften bei dem Gremium
|
||||||
has_many :nlinks, as: :link, dependent: :destroy
|
has_many :nlinks, as: :link, dependent: :destroy
|
||||||
# scope :search, ->(query) {where("gremien.name like ? or gremien.desc like ?", "%#{query}%", "%#{query}%")}
|
# scope :search, ->(query) {where("gremien.name like ? or gremien.desc like ?", "%#{query}%", "%#{query}%")}
|
||||||
|
# has_many :members, through: :memberships
|
||||||
searchable do
|
searchable do
|
||||||
text :desc
|
text :desc
|
||||||
text :name, :boost=>4.0
|
text :name, :boost=>4.0
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class Neuigkeit < ActiveRecord::Base
|
|||||||
translates :title,:text, :versioning=>{:gem=>:paper_trail, :options=>{:fallbacks_for_empty_translations => true}}
|
translates :title,:text, :versioning=>{:gem=>:paper_trail, :options=>{:fallbacks_for_empty_translations => true}}
|
||||||
globalize_accessors :locales => [:de, :en], :attributes =>[:text,:title]
|
globalize_accessors :locales => [:de, :en], :attributes =>[:text,:title]
|
||||||
mount_uploader :picture, PictureUploader
|
mount_uploader :picture, PictureUploader
|
||||||
|
include IsCommentable
|
||||||
|
|
||||||
default_scope order(:cache_order).includes(:calentries).includes(:title_pic)
|
default_scope order(:cache_order).includes(:calentries).includes(:title_pic)
|
||||||
scope :recent, -> { published.limit(10)}
|
scope :recent, -> { published.limit(10)}
|
||||||
@@ -44,6 +45,12 @@ class Neuigkeit < ActiveRecord::Base
|
|||||||
before_validation :sanitize
|
before_validation :sanitize
|
||||||
after_save :update_cache
|
after_save :update_cache
|
||||||
attr_accessor :no_fallbacks
|
attr_accessor :no_fallbacks
|
||||||
|
|
||||||
|
acts_as_flagable
|
||||||
|
|
||||||
|
FLAG_ICONS={"infoscreen" => "fa fa-desktop", "important"=>"fa fa-exclamation"}
|
||||||
|
FLAG_CONFIRM={"infoscreen" => "Neuigkeit am Infoscreen anzeigen"}
|
||||||
|
|
||||||
def globalize_fallbacks(locale)
|
def globalize_fallbacks(locale)
|
||||||
if self.no_fallbacks
|
if self.no_fallbacks
|
||||||
[locale]
|
[locale]
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class Studium < ActiveRecord::Base
|
|||||||
has_many :lvas, :through=>:moduls
|
has_many :lvas, :through=>:moduls
|
||||||
has_many :semester, :dependent => :destroy
|
has_many :semester, :dependent => :destroy
|
||||||
has_many :attachments, :as=>:parent
|
has_many :attachments, :as=>:parent
|
||||||
validates :abkuerzung, :length=>{:maximum=>5}, :format=>{:with=>/^[a-zA-z]{0,5}$/}
|
validates :abkuerzung, :length=>{:maximum=>5}, :format=>{:with=>/^[a-zA-z]{0,5}$/}
|
||||||
validates :typ, :inclusion => {:in => ["Bachelor","Master"] }
|
validates :typ, :inclusion => {:in => ["Bachelor","Master"] }
|
||||||
validates :name, :uniqueness => true, :presence=>true
|
validates :name, :uniqueness => true, :presence=>true
|
||||||
validates :zahl, :presence=>true, :format=>{:with=>/^[0-9A-Z]{4,10}$/}, :uniqueness => true
|
validates :zahl, :presence=>true, :format=>{:with=>/^[0-9A-Z]{4,10}$/}, :uniqueness => true
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Survey::Answer < ActiveRecord::Base
|
class Survey::Answer < ActiveRecord::Base
|
||||||
belongs_to :choice, class_name: 'Survey::Choice'
|
belongs_to :choice, class_name: 'Survey::Choice', touch: true
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
# attr_accessible :title, :body
|
# attr_accessible :title, :body
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Survey::Choice < ActiveRecord::Base
|
class Survey::Choice < ActiveRecord::Base
|
||||||
belongs_to :question, class_name: 'Survey::Question'
|
belongs_to :question, class_name: 'Survey::Question', touch: true
|
||||||
attr_accessible :picture, :sort, :text, :icon, :picture_cache, :remove_picture, :question_id
|
attr_accessible :picture, :sort, :text, :icon, :picture_cache, :remove_picture, :question_id
|
||||||
has_many :answers, class_name: 'Survey::Answer', dependent: :destroy
|
has_many :answers, class_name: 'Survey::Answer', dependent: :destroy
|
||||||
include ActionView::Helpers::TagHelper
|
include ActionView::Helpers::TagHelper
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
class Survey::Question < ActiveRecord::Base
|
class Survey::Question < ActiveRecord::Base
|
||||||
attr_accessible :text, :title, :typ, :choice_ids, :parent_type, :parent_id
|
attr_accessible :text, :title, :typ, :choice_ids, :parent_type, :parent_id
|
||||||
belongs_to :parent, polymorphic: true
|
belongs_to :parent, polymorphic: true, touch: true
|
||||||
has_many :choices, dependent: :destroy, class_name: "Survey::Choice"
|
has_many :choices, dependent: :destroy, class_name: "Survey::Choice"
|
||||||
has_many :answers, through: :choices
|
has_many :answers, through: :choices
|
||||||
include IsCommentable
|
include IsCommentable
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
<% f.file_field :beispieldatei, :label => "Neue Datei hochladen:"%>
|
<%= f.file_field :beispieldatei, :label => "Neue Datei hochladen:" if @beispiel.beispieldatei.nil? || @beispiel.beispieldatei.blank? %>
|
||||||
</div>
|
</div>
|
||||||
<%=f.input :datum , :as => :datetimepicker %>
|
<%=f.input :datum , :as => :datetimepicker %>
|
||||||
|
|
||||||
@@ -20,11 +20,11 @@
|
|||||||
|
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<%= f.input :name %>
|
<%= f.input :name %>
|
||||||
|
<%= f.input :lva if @beispiel.lva.nil?%>
|
||||||
<%= f.input :desc %>
|
<%= f.input :desc %>
|
||||||
</div>
|
</div>
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<%= f.input :lecturer, :as=>:select, :collection => @beispiel.lva.lecturers %>
|
<%= f.input :lecturer, :as=>:select, :collection => ((@beispiel.lva.nil?|| @beispiel.lva.lecturers.empty?)? Lecturer.all : @beispiel.lva.lecturers) %>
|
||||||
</div>
|
</div>
|
||||||
<%= f.hidden_field :beispieldatei_cache %>
|
<%= f.hidden_field :beispieldatei_cache %>
|
||||||
<%= f.actions do %>
|
<%= f.actions do %>
|
||||||
|
|||||||
1
app/views/calentries/_mail.html.erb
Normal file
1
app/views/calentries/_mail.html.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<%= mail.icon_text %>
|
||||||
@@ -1,17 +1,19 @@
|
|||||||
<% unless search_results.nil? %>
|
<% unless search_results.nil? %>
|
||||||
<%= search_results %>
|
<%#= search_results %>
|
||||||
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<% search_results.each_hit_with_result do |hit,result| %>
|
<% search_results.each_hit_with_result do |hit,result| %>
|
||||||
<li> <%= link_to result.parent.title+": " + result.name, document_path(result) %>
|
<li> <%= link_to result.parent.title+": " + result.name, document_path(result) %>
|
||||||
<% hit.highlights(:name).each do |hlgt| %>
|
<% hit.highlights(:name).each do |hlgt| %>
|
||||||
<%= raw(hlgt.format{|word|"<b>#{word}</b>" } ) %>
|
<%= (hlgt.format{|word|"<b>#{word}</b>" } ).html_safe%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% %>
|
<% %>
|
||||||
<% hit.highlights(:text).each do |hlgt| %>
|
<% hit.highlights(:text).each do |hlgt| %>
|
||||||
<%= "text:" + raw(hlgt.format {|word| raw("<b>#{word}</b>") })%>
|
<%= ("<br>text: " + hlgt.format {|word| "<b>#{word}</b>" }).html_safe%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% hit.highlights(:meeting).each do |hlgt| %>
|
<% hit.highlights(:meeting).each do |hlgt| %>
|
||||||
<%= "text:" + raw(hlgt.format {|word| "*#{word}*" })%>
|
<%= "text:" + (hlgt.format {|word| "*#{word}*" }).html_safe%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
3
app/views/emails/daily_reminder.html.erb
Normal file
3
app/views/emails/daily_reminder.html.erb
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<%=link_to "reminder", daily_reminder_emails_path(params: {send: true}) %>
|
||||||
|
<hr>Subject: <b><%= @mail.subject %></b><br>
|
||||||
|
<%= raw(@mail.body) %>
|
||||||
1
app/views/emails/index.html.erb
Normal file
1
app/views/emails/index.html.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<%=link_to "reminder", daily_reminder_emails_path() %>
|
||||||
@@ -2,3 +2,4 @@
|
|||||||
<%= link_to fetprofile, {class: :linkbox} do %>
|
<%= link_to fetprofile, {class: :linkbox} do %>
|
||||||
<%= render :partial=>"fetprofiles/compact", :locals=>{:fetprofile=>fetprofile} %>
|
<%= render :partial=>"fetprofiles/compact", :locals=>{:fetprofile=>fetprofile} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= root_path() %>
|
||||||
|
|||||||
@@ -51,10 +51,11 @@ end
|
|||||||
<%= @fetprofile.desc %>
|
<%= @fetprofile.desc %>
|
||||||
</p>
|
</p>
|
||||||
<%= render partial: "interninfo", object: @fetprofile if can?(:seeintern, @fetprofile) %>
|
<%= render partial: "interninfo", object: @fetprofile if can?(:seeintern, @fetprofile) %>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<% @memberships.each do |m| %>
|
<% @memberships.each do |m| %>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to m.gremium do %> <%= render m %><% end %>
|
<%= link_to gremium_path(m.gremium) do %> <%= render m %><% end %>
|
||||||
<%= link_to I18n.t('common.edit'), edit_fetprofile_membership_path(@fetprofile,m) if params["verwalten"] && can?(:edit, m)%>
|
<%= link_to I18n.t('common.edit'), edit_fetprofile_membership_path(@fetprofile,m) if params["verwalten"] && can?(:edit, m)%>
|
||||||
<%= link_to I18n.t('common.delete'), [@fetprofile, m], method: :delete, data: {confirm: I18n.t('common.sure_del')} if params["verwalten"] && can?(:delete, m ) %>
|
<%= link_to I18n.t('common.delete'), [@fetprofile, m], method: :delete, data: {confirm: I18n.t('common.sure_del')} if params["verwalten"] && can?(:delete, m ) %>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
<p>
|
<p>
|
||||||
<%= link_to "user", users_path %>
|
<%= link_to "user", users_path %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p><%= link_to "emails", emails_path %></p>
|
||||||
<% if Fetsite::Application.config.facebookconfig_enabled %>
|
<% if Fetsite::Application.config.facebookconfig_enabled %>
|
||||||
<h2>Facebook Konfiguration</h2>
|
<h2>Facebook Konfiguration</h2>
|
||||||
<p><%= link_to "Grant extra FB privileges", user_omniauth_authorize_path(:facebook,:params=>{scope:"manage_pages,publish_actions,email"}), :confirm=>"Wirklich?" %>
|
<p><%= link_to "Grant extra FB privileges", user_omniauth_authorize_path(:facebook,:params=>{scope:"manage_pages,publish_actions,email"}), :confirm=>"Wirklich?" %>
|
||||||
|
|||||||
82
app/views/home/infoscreen.html.erb
Normal file
82
app/views/home/infoscreen.html.erb
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<%= stylesheet_link_tag "themes/"+theme_name+"/application", :media => "all" unless theme_name.empty? %>
|
||||||
|
<%= stylesheet_link_tag "application", :media=>"all" if theme_name.empty? %>
|
||||||
|
|
||||||
|
<%= javascript_include_tag "application" %>
|
||||||
|
<%= javascript_include_tag "jmpress" %>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id ="jmpress">
|
||||||
|
<% i=1 %>
|
||||||
|
<% @neuigkeiten.each do |n| %>
|
||||||
|
|
||||||
|
<div class="step contentbox" id="step-<%=i%>" data-x="<%= i *2000 %>" data-y="<%= Random.rand(0..5)*200 %>" data-rotate="<%= Random.rand(0..18)*10 %>" style="width:1000px; height:500px; padding: 50px; display:block" data-duration="10000"><% @toolbar_elements=[];@questions=[] %>
|
||||||
|
<div class="media" style="width: 500px; height:250px; transform: scale(1.5) translate(60px,0)" >
|
||||||
|
<% unless n.picture_robust.big_thumb.to_s.empty? %>
|
||||||
|
<div class="pull-left" href="#">
|
||||||
|
<p><br><%= link_to image_tag(n.picture_robust.big_thumb),n.picture_robust.try(:url) %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<div class="media-body">
|
||||||
|
<h1 itemprop="name">
|
||||||
|
<%= raw(n.title) %> <%#= link_to fa_icon("edit"), edit_rubrik_neuigkeit_path(n.rubrik, n), remote: true if can? :edit, n %>
|
||||||
|
</h1>
|
||||||
|
<div itemprop="articleBody" style="font-size:large">
|
||||||
|
<%= raw(n.text) %>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h1>
|
||||||
|
<% if n.has_calentries? %>
|
||||||
|
<div href="#">
|
||||||
|
<%= fa_icon("calendar 2x") %>
|
||||||
|
<%= n.relevant_calentry.text %>
|
||||||
|
</div>
|
||||||
|
<% elsif n.has_meeting? %>
|
||||||
|
<div href="#">
|
||||||
|
<%= fa_icon("calendar 2x") %>
|
||||||
|
<%= n.meeting.calentry.text unless n.meeting.calentry.nil? %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<% i = i+1 %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-progressbar ui-widget ui-widget-content ui-corner-all" style="height:10px; z-index: 2000; left: 5px; right: 5px; bottom: 5px; height: 10px; position:absolute">
|
||||||
|
<div id="" class="ui-progressbar-value ui-widget-header ui-corner-left" style=""></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
$('#jmpress').jmpress({
|
||||||
|
duration: {
|
||||||
|
barPropertyStart: '0',
|
||||||
|
barSelector: '.ui-progressbar-value'
|
||||||
|
},
|
||||||
|
initStep: function(element, eventData) {
|
||||||
|
console.log('We\'re changing to step: #' + $(element).attr('id') + '!');
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
setTimeout(function(){
|
||||||
|
|
||||||
|
window.location.reload();
|
||||||
|
/* or window.location = window.location.href; */
|
||||||
|
|
||||||
|
}, 100000);
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
@@ -7,7 +7,9 @@
|
|||||||
<%= link_to "Adressliste", internlist_fetprofiles_path ,class: :linkbox %></li>
|
<%= link_to "Adressliste", internlist_fetprofiles_path ,class: :linkbox %></li>
|
||||||
<li> <%= link_to "Admin" , admin_home_index_path, class: :linkbox if current_user.has_role?(:fetadmin) %>
|
<li> <%= link_to "Admin" , admin_home_index_path, class: :linkbox if current_user.has_role?(:fetadmin) %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
<li>
|
||||||
|
<%= link_to ff_icon("ffi1-setting")+"Neue Oberfläche" , set_preferred_theme_user_path(current_user, params: {theme: "blue2"}), class: :linkbox if can? :set_preferred_theme , current_user %>
|
||||||
|
</li></ul>
|
||||||
<ul class="unstyled linkbox-list">
|
<ul class="unstyled linkbox-list">
|
||||||
<li>
|
<li>
|
||||||
<% @themengruppen.each do |themengruppe| %>
|
<% @themengruppen.each do |themengruppe| %>
|
||||||
|
|||||||
@@ -7,11 +7,11 @@
|
|||||||
<%= current_user.email %> is logged in.
|
<%= current_user.email %> is logged in.
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li><%= link_to('Logout', destroy_user_session_path, :method => :delete) %> </li>
|
<li><%= link_to('Logout', destroy_user_session_path, :method => :delete,:id => "login_link") %> </li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<% else %>
|
<% else %>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to('Login', new_user_session_path) %>
|
<%= link_to('Login', new_user_session_path, id:"login_link") %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
10
app/views/neuigkeiten/_mail.html.erb
Normal file
10
app/views/neuigkeiten/_mail.html.erb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<h1>
|
||||||
|
<%= mail.title%>
|
||||||
|
</h1>
|
||||||
|
<%= content_tag(:img,"",src: "http://" + ActionMailer::Base.default_url_options[:host].to_s + mail.picture.big_thumb.url.to_s) %>
|
||||||
|
<%=url_for controller: "neuigkeiten",action: :show, :id=>mail.id, only_path: false %>
|
||||||
|
<%= raw(mail.text) %>
|
||||||
|
<% mail.questions.each do |q| %>
|
||||||
|
<%= render partial:"survey/questions/mail", object: q %>
|
||||||
|
<% end %>
|
||||||
|
<%= link_to "Auf Fet.at weiterlesen", rubrik_neuigkeit_url(mail.rubrik, mail,:locale=>:de, :theme=>nil) %>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% unless neuigkeit_view.published? %>
|
<% unless neuigkeit_view.published? %>
|
||||||
<div class="sticker sticker-red"> Not Published <%= link_to "Publish", publish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),remote:true, class: :btn if can? :publish, neuigkeit_view %></div>
|
<div class="sticker sticker-red"> Not Published <%= link_to "Publish", publish_rubrik_neuigkeit_path(neuigkeit_view.rubrik,neuigkeit_view),remote:true, class: :btn if can? :publish, neuigkeit_view %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% unless neuigkeit_view.origurl.nil? || neuigkeit_view.origurl.empty? %>
|
<% unless neuigkeit_view.origurl.nil? || neuigkeit_view.origurl.empty? %>
|
||||||
<div class="alert"><%= link_to "Zitiert von "+ neuigkeit_view.origurl, neuigkeit_view.origurl %>
|
<div class="alert"><%= link_to "Zitiert von "+ neuigkeit_view.origurl, neuigkeit_view.origurl %>
|
||||||
|
|||||||
5
app/views/neuigkeiten/mail_preview.html.erb
Normal file
5
app/views/neuigkeiten/mail_preview.html.erb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<%= link_to "send", mail_preview_rubrik_neuigkeit_path(@neuigkeit) %>
|
||||||
|
<%= raw(@mail.subject) %>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
<%= raw(@mail.body) %>
|
||||||
13
app/views/news_mailer/daily_reminder.html.erb
Normal file
13
app/views/news_mailer/daily_reminder.html.erb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<%= stylesheet_link_tag "http://"+ActionMailer::Base.default_url_options[:host].to_s + "/assets/themes/blue2/application.css", :media=>"all" %>
|
||||||
|
|
||||||
|
<% @calentries.each do |ce| %>
|
||||||
|
|
||||||
|
<% if can?(:show , ce.object) %>
|
||||||
|
<hr/>
|
||||||
|
<h1> <%= render partial: "calentries/mail", object: ce %>
|
||||||
|
</h1>
|
||||||
|
<%= render partial: "neuigkeiten/mail", object: ce.object if ce.object.kind_of?(Neuigkeit)%>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<hr/>
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
<h1>
|
<h1>
|
||||||
<%= @neuigkeit.title%>
|
<%= @neuigkeit.title%>
|
||||||
</h1>
|
</h1>
|
||||||
<%= content_tag(:img,"",src: "http://"+ActionMailer::Base.default_url_options[:host].to_s+@neuigkeit.picture.big_thumb.url) %>
|
<%= content_tag(:img,"",src: "http://"+ActionMailer::Base.default_url_options[:host].to_s+@neuigkeit.picture.big_thumb.url.to_s) %>
|
||||||
<%=url_for controller: "neuigkeiten",action: :show, :id=>@neuigkeit.id, only_path: false %>
|
<%=url_for controller: "neuigkeiten",action: :show, :id=>@neuigkeit.id, only_path: false %>
|
||||||
<%= raw(@neuigkeit.text) %>
|
<%= raw(@neuigkeit.text) %>
|
||||||
<% @neuigkeit.questions.each do |q| %>
|
<% @neuigkeit.questions.each do |q| %>
|
||||||
|
|||||||
77
app/views/themes/blue2/fetprofiles/show.html.erb
Normal file
77
app/views/themes/blue2/fetprofiles/show.html.erb
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<%= content_for :header do %>
|
||||||
|
<title>FET - <%= @fetprofile.name %></title>
|
||||||
|
<% unless @fetprofile.picture.url.nil?
|
||||||
|
picture_url=URI(root_url)
|
||||||
|
picture_url.path=@fetprofile.picture.portrait.url
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
|
||||||
|
<% set_meta_tags :og => {
|
||||||
|
:image => picture_url.to_s,
|
||||||
|
:title => @fetprofile.name.to_s ,
|
||||||
|
:type => "profile",
|
||||||
|
:url=>fetprofile_url(@fetprofile,:theme=>nil),
|
||||||
|
:profile=> {
|
||||||
|
:first_name=>@fetprofile.vorname,
|
||||||
|
:last_name=>@fetprofile.nachname
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
<% set_meta_tags :og=>{:article=> {:published_time=>I18n.l(@neuigkeit.try(:datum).try(:to_date)) }} unless @neuigkeit.try(:datum).try(:to_date).nil? %>
|
||||||
|
|
||||||
|
<%= display_meta_tags %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
<%= render 'fetprofiles/tabs' %>
|
||||||
|
|
||||||
|
<div class="content-wrap content-column">
|
||||||
|
|
||||||
|
<p id="notice"><%= notice %></p>
|
||||||
|
<div style="max-width:70em" itemtype="http://schema.org/Person" itemscope>
|
||||||
|
<meta itemprop="sameAs" content="<%= fetprofile_path(@fetprofile, theme: nil) %>"/>
|
||||||
|
<meta itemprop="url" content="<%= fetprofile_path(@fetprofile, theme: nil) %>"/>
|
||||||
|
<div class="media">
|
||||||
|
<span class="pull-left" itemprop="image" itemscope itemtype="http://schema.org/ImageObject">
|
||||||
|
<span itemprop="thumbnail" itemscope itemtype="http://schema.org/ImageObject">
|
||||||
|
<%= image_tag @fetprofile.picture.portrait.url %>
|
||||||
|
<meta itemprop="url" content="<%= @fetprofile.picture.portrait.url%>" />
|
||||||
|
</span>
|
||||||
|
<meta itemprop="url" content="<%= @fetprofile.picture.url%>" />
|
||||||
|
<meta itemprop="representativeOfPage" content="true" />
|
||||||
|
</span>
|
||||||
|
<div class="media-body">
|
||||||
|
<h2><span itemprop="givenName"><%= @fetprofile.vorname %></span><span itemprop="familyName"> <%= @fetprofile.nachname %></span><% unless @fetprofile.short.empty? %><span itemprop=""> <%= @fetprofile.short %> </span><% end %></h2>
|
||||||
|
<meta itemprop="name" content="<%= @fetprofile.name %>" />
|
||||||
|
|
||||||
|
<p itemprop="email">
|
||||||
|
<%= @fetprofile.fetmail %>
|
||||||
|
</p>
|
||||||
|
<p itemprop="description">
|
||||||
|
<%= @fetprofile.desc %>
|
||||||
|
</p>
|
||||||
|
<%= render partial: "interninfo", object: @fetprofile if can?(:seeintern, @fetprofile) %>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<% @memberships.each do |m| %>
|
||||||
|
<li>
|
||||||
|
<%= link_to gremium_path(m.gremium) do %> <%= render m %><% end %>
|
||||||
|
<%= link_to I18n.t('common.edit'), edit_fetprofile_membership_path(@fetprofile,m) if params["verwalten"] && can?(:edit, m)%>
|
||||||
|
<%= link_to I18n.t('common.delete'), [@fetprofile, m], method: :delete, data: {confirm: I18n.t('common.sure_del')} if params["verwalten"] && can?(:delete, m ) %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% if can?(:edit, @fetprofile) %>
|
||||||
|
<div>
|
||||||
|
<span>
|
||||||
|
<%= link_to ff_icon("icon-pencil")+I18n.t('common.edit'), edit_fetprofile_path(@fetprofile) if can?(:edit, @fetprofile) %>
|
||||||
|
<%= link_to fa_icon("trash")+I18n.t('common.delete'), fetprofile_path(@fetprofile),method: :delete, data: { confirm: "Are you sure?" } if can?(:delete, @fetprofile) %>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<%#= render 'layouts/pretty_toolbar' %>
|
||||||
|
</div>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="span5">
|
<div class="span5">
|
||||||
<ul class="unstyled linklist">
|
<ul class="unstyled linkbox-list">
|
||||||
<% @neuigkeiten.each do |n| %>
|
<% @neuigkeiten.each do |n| %>
|
||||||
<li><%= render n if can?(:show, n) %> </li>
|
<li><%= render n if can?(:show, n) %> </li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
<div>
|
<div>
|
||||||
<ul class="linklist_block">
|
<ul class="linklist">
|
||||||
<li>
|
<li>
|
||||||
<%= link_to fa_icon("list")+"Adressliste", internlist_fetprofiles_path ,class: :linkbox %>
|
<%= link_to fa_icon("list")+"Adressliste", internlist_fetprofiles_path ,class: :linkbox %>
|
||||||
</li>
|
</li>
|
||||||
@@ -19,6 +19,10 @@
|
|||||||
<li>
|
<li>
|
||||||
<%= link_to ff_icon("ffi1-setting")+"Meetings" , meetingtyps_path, class: :linkbox if current_user.has_role?(:fetadmin) %>
|
<%= link_to ff_icon("ffi1-setting")+"Meetings" , meetingtyps_path, class: :linkbox if current_user.has_role?(:fetadmin) %>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to ff_icon("ffi1-setting")+"Alte Oberfläche" , set_preferred_theme_user_path(current_user, params: {theme: "blue1"}), class: :linkbox if can? :set_preferred_theme, current_user %>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul><br>
|
</ul><br>
|
||||||
</div>
|
</div>
|
||||||
<div>Suche nach Protokollen
|
<div>Suche nach Protokollen
|
||||||
|
|||||||
@@ -1,40 +1,43 @@
|
|||||||
<div class="toolbar-inline">
|
<div class="toolbar-inline">
|
||||||
<%= link_to(fa_icon("edit"), edit_rubrik_neuigkeit_path( @neuigkeit.rubrik, @neuigkeit), remote: true , class: "btn", title: "Edit") if can? :edit, @neuigkeit
|
<%= link_to(fa_icon("edit"), edit_rubrik_neuigkeit_path( menu.rubrik, menu), remote: true , class: "btn", title: "Edit") if can? :edit, menu
|
||||||
%>
|
%>
|
||||||
<span class="btn-group">
|
<span class="btn-group">
|
||||||
<%= link_to(fa_icon("paperclip"), "#", class: "btn", id: "attachments-form-open", title: "Attachments") if can? :edit, @neuigkeit
|
<%= link_to(fa_icon("paperclip"), "#", class: "btn", id: "attachments-form-open", title: "Attachments") if can? :edit, menu
|
||||||
%>
|
%>
|
||||||
<%= link_to(fa_icon("calendar-o"), new_calentry_path(:object_id=>@neuigkeit.id, :object_type=>"Neuigkeit"), :remote=>true, class: :btn) if can? :edit, @neuigkeit
|
<%= link_to(fa_icon("calendar-o"), new_calentry_path(:object_id=>menu.id, :object_type=>"Neuigkeit"), :remote=>true, class: :btn) if can? :edit, menu
|
||||||
%>
|
%>
|
||||||
<%= link_to(fa_icon("link") , "#", id: "findlink-open",title: "Neue Verknüpfung" , class: "btn") if can? :find_link, @neuigkeit
|
<%= link_to(fa_icon("link") , "#", id: "findlink-open",title: "Neue Verknüpfung" , class: "btn") if can? :find_link, menu
|
||||||
%>
|
%>
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<%= new_question_for(@neuigkeit, fa_icon("question")) if can? :new, Survey::Question %>
|
<%= new_question_for(menu, fa_icon("question")) if can? :new, Survey::Question %>
|
||||||
|
|
||||||
<span class=" pull-right">
|
<span class=" pull-right">
|
||||||
<%= link_to(fa_icon("globe"), publish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit), title: I18n.t('neuigkeit.publish'), class: "btn") if can?(:publish, @neuigkeit) && !@neuigkeit.published?
|
<%= flag_link(menu, "important")%>
|
||||||
|
<%= flag_link(menu, "infoscreen")%>
|
||||||
|
|
||||||
|
<%= link_to(fa_icon("globe"), publish_rubrik_neuigkeit_path(menu.rubrik,menu), title: I18n.t('neuigkeit.publish'), class: "btn") if can?(:publish, menu) && !menu.published?
|
||||||
%>
|
%>
|
||||||
<%= link_to(fa_stack("globe","ban"), unpublish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit), :remote=>true, class: "btn stacked") if can?(:unpublish, @neuigkeit) && @neuigkeit.published?
|
<%= link_to(fa_stack("globe","ban"), unpublish_rubrik_neuigkeit_path(menu.rubrik,menu), :remote=>true, class: "btn stacked") if can?(:unpublish, menu) && menu.published?
|
||||||
%>
|
%>
|
||||||
<% if @neuigkeit.published? %>
|
<% if menu.published? %>
|
||||||
<div class="dropdown" style=" display:inline"">
|
<div class="dropdown" style=" display:inline"">
|
||||||
<a class="dropdown-toggle btn" data-toggle="dropdown" title="publish" href="#">
|
<a class="dropdown-toggle btn" data-toggle="dropdown" title="publish" href="#">
|
||||||
<%= fa_icon("mail-forward")%><span class="caret"></span>
|
<%= fa_icon("mail-forward")%><span class="caret"></span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<%= li_tag(link_to(fa_icon("facebook-square") + " post on facebook", publish_to_facebook_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit))) if can?(:publish, @neuigkeit) && @neuigkeit.published?
|
<%= li_tag(link_to(fa_icon("facebook-square") + " post on facebook", publish_to_facebook_rubrik_neuigkeit_path(menu.rubrik,menu))) if can?(:publish, menu) && menu.published?
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<%= li_tag(link_to(fa_icon("envelope-o") + " send mail", mail_to_fet_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit))) if can?(:publish, @neuigkeit) && @neuigkeit.published?
|
<%= li_tag(link_to(fa_icon("envelope-o") + " send mail", mail_preview_rubrik_neuigkeit_path(menu.rubrik,menu))) if can?(:publish, menu) && menu.published?
|
||||||
%>
|
%>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
<div class="ui-dialog" id="attachments-form">
|
<div class="ui-dialog" id="attachments-form">
|
||||||
<%= render_new_attachments_for(@neuigkeit, fa_icon("plus"), {class: "btn"}) %>
|
<%= render_new_attachments_for(menu, fa_icon("plus"), {class: "btn"}) %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
<%= meta_itemprop("url", neuigkeit_url(neuigkeit_view,:theme=>nil)) %>
|
<%= meta_itemprop("url", neuigkeit_url(neuigkeit_view,:theme=>nil)) %>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<% cache("menu_neuigkeit"+ @neuigkeit.id.to_s + can?(:edit,@neuigkeit).to_s + can?(:find_link, @neuigkeit).to_s + can?(:new, Survey::Question).to_s + can?(:publish, @neuigkeit).to_s + can?(:unpublish, @neuigkeit).to_s + @neuigkeit.published?.to_s ) do %>
|
<% 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: "menu" %>
|
<%= render partial: "neuigkeiten/menu", object: neuigkeit_view %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% unless neuigkeit_view.published? %>
|
<% unless neuigkeit_view.published? %>
|
||||||
<div class="sticker sticker-red"> Not Published <%= link_to "Publish", publish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),remote:true, class: :btn if can? :publish, neuigkeit_view %></div>
|
<div class="sticker sticker-red"> Not Published <%= link_to "Publish", publish_rubrik_neuigkeit_path(neuigkeit_view.rubrik,neuigkeit_view),remote:true, class: :btn if can? :publish, neuigkeit_view %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% unless neuigkeit_view.origurl.nil? || neuigkeit_view.origurl.empty? %>
|
<% unless neuigkeit_view.origurl.nil? || neuigkeit_view.origurl.empty? %>
|
||||||
<div class="alert"><%= link_to "Zitiert von "+ neuigkeit_view.origurl, neuigkeit_view.origurl %>
|
<div class="alert"><%= link_to "Zitiert von "+ neuigkeit_view.origurl, neuigkeit_view.origurl %>
|
||||||
|
|||||||
@@ -41,8 +41,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="fb-like" data-href"<%= rubrik_neuigkeit_url(@rubrik,@neuigkeit,{themes: nil, locale: nil})%>" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>
|
<div class="fb-like" data-href"<%= rubrik_neuigkeit_url(@rubrik,@neuigkeit,{themes: nil, locale: nil})%>" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>
|
||||||
|
|
||||||
|
<%= render_comments_for(@neuigkeit) %>
|
||||||
|
|
||||||
<%= link_to fa_icon("link") + "Neue Verknüpfung" , "#", id: "findlink-open" if can? :find_link, @neuigkeit %>
|
<%# link_to fa_icon("link") + "Neue Verknüpfung" , "#", id: "findlink-open" if can? :find_link, @neuigkeit %>
|
||||||
|
|
||||||
<% cache(cache_array_key(@neuigkeit.nlinks, "NLinks")) do %>
|
<% cache(cache_array_key(@neuigkeit.nlinks, "NLinks")) do %>
|
||||||
<%= render partial: 'neuigkeiten/nlink_list_whole', :object=>@neuigkeit.nlinks %>
|
<%= render partial: 'neuigkeiten/nlink_list_whole', :object=>@neuigkeit.nlinks %>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<%= semantic_fields_for "users[#{user.id}]", user do |f|%>
|
<%= semantic_fields_for "users[#{user.id}]", user do |f|%>
|
||||||
<%= f.input :fetprofile ,:label=>false , :as=>:select , :collection=>Fetprofile.all %>
|
<%= f.input :fetprofile ,:label=>false , :as=>:select , :collection=>Fetprofile.order(:vorname,:nachname) %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Fetsite::Application.configure do
|
|||||||
# Don't care if the mailer can't send
|
# Don't care if the mailer can't send
|
||||||
config.action_mailer.raise_delivery_errors = true
|
config.action_mailer.raise_delivery_errors = true
|
||||||
config.action_mailer.delivery_method =:sendmail
|
config.action_mailer.delivery_method =:sendmail
|
||||||
config.action_mailer.default_url_options = {}#{:host=> "localhost", :port=>3000} # :host => 'glonass.htu.tuwien.ac.at' }
|
config.action_mailer.default_url_options = {:host=> "localhost", :port=>3000} # :host => 'glonass.htu.tuwien.ac.at' }
|
||||||
# Print deprecation notices to the Rails logger
|
# Print deprecation notices to the Rails logger
|
||||||
config.active_support.deprecation = :log
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,20 @@
|
|||||||
resources :comments, contstraints: {id: /[0-9]+/}, only: :show
|
resources :comments, contstraints: {id: /[0-9]+/}, only: :show
|
||||||
|
|
||||||
|
|
||||||
|
## Inserted for testing tests
|
||||||
|
resources :members , controller: :fetprofiles , as: :fetprofiles do
|
||||||
|
collection do
|
||||||
|
get 'verwalten'
|
||||||
|
get 'internlist'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
resources :gremien do
|
||||||
|
collection do
|
||||||
|
get 'verwalten'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#
|
||||||
|
# #-------------------------
|
||||||
|
|
||||||
namespace :survey do
|
namespace :survey do
|
||||||
resources :questions do
|
resources :questions do
|
||||||
@@ -26,7 +39,12 @@
|
|||||||
themes_for_rails
|
themes_for_rails
|
||||||
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
|
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
|
||||||
resources :home, :only=>[:index] do
|
resources :home, :only=>[:index] do
|
||||||
|
end
|
||||||
|
resources :emails, :only=>[:index] do
|
||||||
|
collection do
|
||||||
|
get :daily_reminder
|
||||||
end
|
end
|
||||||
|
end
|
||||||
get ':locale', constraints: {locale: /en|de/}, action: :language,controller: :home, as: "language"
|
get ':locale', constraints: {locale: /en|de/}, action: :language,controller: :home, as: "language"
|
||||||
scope '(:locale)/admin' do
|
scope '(:locale)/admin' do
|
||||||
resources :users, :only=>[] do
|
resources :users, :only=>[] do
|
||||||
@@ -35,6 +53,7 @@
|
|||||||
post :all_update
|
post :all_update
|
||||||
end
|
end
|
||||||
member do
|
member do
|
||||||
|
get :set_preferred_theme
|
||||||
get :fb_set_default_publish_page
|
get :fb_set_default_publish_page
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -60,6 +79,7 @@
|
|||||||
scope '(t/:theme)' do
|
scope '(t/:theme)' do
|
||||||
get "" , controller: :home, action: :index
|
get "" , controller: :home, action: :index
|
||||||
get "intern" , controller: :home, action: :intern
|
get "intern" , controller: :home, action: :intern
|
||||||
|
get "infoscreen" , controller: :home, action: :infoscreen
|
||||||
get "beispielsammlung", to: redirect('/studien')
|
get "beispielsammlung", to: redirect('/studien')
|
||||||
scope '(:ansicht)' do
|
scope '(:ansicht)' do
|
||||||
resources :studien, :only=>[:new,:edit,:update,:destroy,:show] do
|
resources :studien, :only=>[:new,:edit,:update,:destroy,:show] do
|
||||||
@@ -125,12 +145,12 @@
|
|||||||
get 'verwalten'
|
get 'verwalten'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :fetprofiles, as: :fetprofiles_bak do
|
# resources :fetprofiles, as: :fetprofiles_bak do
|
||||||
collection do
|
# collection do
|
||||||
get 'verwalten'
|
# get 'verwalten'
|
||||||
get 'internlist'
|
# get 'internlist'
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
resources :members , controller: :fetprofiles , as: :fetprofiles do
|
resources :members , controller: :fetprofiles , as: :fetprofiles do
|
||||||
collection do
|
collection do
|
||||||
get 'verwalten'
|
get 'verwalten'
|
||||||
@@ -165,7 +185,7 @@
|
|||||||
get 'publish_to_facebook'
|
get 'publish_to_facebook'
|
||||||
get 'mail_to_fet'
|
get 'mail_to_fet'
|
||||||
get 'mail_preview'
|
get 'mail_preview'
|
||||||
|
get 'flag'
|
||||||
end
|
end
|
||||||
collection do
|
collection do
|
||||||
get 'newsletter_preview'
|
get 'newsletter_preview'
|
||||||
|
|||||||
7
db/migrate/20150913090628_add_infoscreen_to_neuigkeit.rb
Normal file
7
db/migrate/20150913090628_add_infoscreen_to_neuigkeit.rb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
class AddInfoscreenToNeuigkeit < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :neuigkeiten, :flag_infoscreen, :boolean, default: false
|
||||||
|
add_column :themen, :flag_infoscreen, :boolean, default: false
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -60,11 +60,17 @@
|
|||||||
<fieldType name="rand" class="solr.RandomSortField" omitNorms="true"/>
|
<fieldType name="rand" class="solr.RandomSortField" omitNorms="true"/>
|
||||||
<!-- *** This fieldType is used by Sunspot! *** -->
|
<!-- *** This fieldType is used by Sunspot! *** -->
|
||||||
<fieldType name="text" class="solr.TextField" omitNorms="false">
|
<fieldType name="text" class="solr.TextField" omitNorms="false">
|
||||||
<analyzer>
|
<analyzer type="index">
|
||||||
<tokenizer class="solr.StandardTokenizerFactory"/>
|
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
||||||
<filter class="solr.StandardFilterFactory"/>
|
|
||||||
<filter class="solr.LowerCaseFilterFactory"/>
|
<filter class="solr.LowerCaseFilterFactory"/>
|
||||||
<filter class="solr.PorterStemFilterFactory"/>
|
<filter class="solr.NGramFilterFactory" minGramSize="2" maxGramSize="30"/>
|
||||||
|
<filter class="solr.TrimFilterFactory" />
|
||||||
|
<filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="30"/>
|
||||||
|
</analyzer>
|
||||||
|
<analyzer type="query">
|
||||||
|
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
|
||||||
|
<filter class="solr.LowerCaseFilterFactory"/>
|
||||||
|
<filter class="solr.TrimFilterFactory" />
|
||||||
</analyzer>
|
</analyzer>
|
||||||
</fieldType>
|
</fieldType>
|
||||||
<!-- *** This fieldType is used by Sunspot! *** -->
|
<!-- *** This fieldType is used by Sunspot! *** -->
|
||||||
|
|||||||
@@ -1,160 +1,185 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
describe FetprofilesController, :type => :controller do
|
||||||
# It demonstrates how one might use RSpec to specify the controller code that
|
let(:valid_update_attributes) { {"vorname"=>"Neuer Vorname"} }
|
||||||
# was generated by Rails when you ran the scaffold generator.
|
# let(:valid_session) { {locale: :de} }
|
||||||
#
|
|
||||||
# It assumes that the implementation code is generated by the rails scaffold
|
|
||||||
# generator. If you are using any extension libraries to generate different
|
|
||||||
# controller code, this generated spec may or may not pass.
|
|
||||||
#
|
|
||||||
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
|
||||||
# of tools you can use to make these specs even more expressive, but we're
|
|
||||||
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
|
||||||
#
|
|
||||||
# Compared to earlier versions of this generator, there is very limited use of
|
|
||||||
# stubs and message expectations in this spec. Stubs are only used when there
|
|
||||||
# is no simpler way to get a handle on the object needed for the example.
|
|
||||||
# Message expectations are only used when there is no simpler way to specify
|
|
||||||
# that an instance is receiving a specific message.
|
|
||||||
|
|
||||||
describe FetprofilesController do
|
def self.create_fetprofile
|
||||||
|
before(:each) do
|
||||||
|
@fetprofile = FactoryGirl.create(:fetprofile)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
def self.create_active_fetprofile
|
||||||
|
before(:each) do
|
||||||
|
@fetprofile = FactoryGirl.create(:fetprofile, active: true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# This should return the minimal set of attributes required to create a valid
|
let(:object_variable) {:fetprofile}
|
||||||
# Fetprofile. As you add validations to Fetprofile, be sure to
|
let(:assigned_object_variable) {@fetprofile}
|
||||||
# adjust the attributes here as well.
|
let(:object_class) {Fetprofile}
|
||||||
let(:valid_attributes) { { "vorname" => "MyString" } }
|
|
||||||
|
|
||||||
# This should return the minimal set of values that should be in the session
|
|
||||||
# in order to pass any filters (e.g. authentication) defined in
|
|
||||||
# FetprofilesController. Be sure to keep this updated too.
|
|
||||||
let(:valid_session) { {} }
|
|
||||||
|
|
||||||
describe "GET index" do
|
describe "GET index" do
|
||||||
it "assigns all fetprofiles as @fetprofiles" do
|
create_active_fetprofile
|
||||||
fetprofile = Fetprofile.create! valid_attributes
|
subject(:action) { get :index, {} }
|
||||||
get :index, {}, valid_session
|
let(:object_variable) {:fetprofiles}
|
||||||
assigns(:fetprofiles).should eq([fetprofile])
|
let(:assigned_object_variable) {[@fetprofile]}
|
||||||
end
|
it_behaves_like "it is success"
|
||||||
|
it_behaves_like "it assigns object"
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET show" do
|
describe "GET show" do
|
||||||
it "assigns the requested fetprofile as @fetprofile" do
|
create_fetprofile
|
||||||
fetprofile = Fetprofile.create! valid_attributes
|
subject(:action) { get :show, {:id => @fetprofile.to_param}}
|
||||||
get :show, {:id => fetprofile.to_param}, valid_session
|
it_behaves_like "it is success"
|
||||||
assigns(:fetprofile).should eq(fetprofile)
|
it_behaves_like "it assigns object"
|
||||||
|
it "renders the 'show' template" do
|
||||||
|
expect(action).to render_template("show")
|
||||||
end
|
end
|
||||||
|
it "assigns memberships" do
|
||||||
|
action
|
||||||
|
expect(assigns(:memberships)).to be_a(ActiveRecord::Relation)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET new" do
|
describe "GET new" do
|
||||||
it "assigns a new fetprofile as @fetprofile" do
|
subject(:action) { get :new, {}}
|
||||||
get :new, {}, valid_session
|
describe "with fetuser" do
|
||||||
assigns(:fetprofile).should be_a_new(Fetprofile)
|
login_fet_user
|
||||||
|
it_behaves_like "it assigns new object"
|
||||||
|
it_behaves_like "it is success"
|
||||||
end
|
end
|
||||||
|
describe "without user" do
|
||||||
|
logout_user
|
||||||
|
it_behaves_like "it is restricted"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET edit" do
|
describe "GET edit" do
|
||||||
it "assigns the requested fetprofile as @fetprofile" do
|
|
||||||
fetprofile = Fetprofile.create! valid_attributes
|
subject(:action) {get :edit, :id=>@fetprofile.to_param}
|
||||||
get :edit, {:id => fetprofile.to_param}, valid_session
|
login_fet_user
|
||||||
assigns(:fetprofile).should eq(fetprofile)
|
create_fetprofile
|
||||||
|
it_behaves_like "it is success"
|
||||||
|
it_behaves_like "it assigns object"
|
||||||
|
it "assigns memberships" do
|
||||||
|
action
|
||||||
|
expect(assigns(:memberships)).to be_a(ActiveRecord::Relation)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "assigns the requested fetprofile as @fetprofile" do
|
||||||
|
expect{action}.to change {assigns(:fetprofile)}.to(@fetprofile)
|
||||||
|
# expect(assigns(:fetprofile)).to eq(@fetprofile)
|
||||||
|
end
|
||||||
|
describe "without user" do
|
||||||
|
logout_user
|
||||||
|
it_behaves_like "it is restricted"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST create" do
|
describe "POST create" do
|
||||||
|
subject(:action){post :create, {:fetprofile => FactoryGirl.attributes_for(:fetprofile),:format=>:html}}
|
||||||
|
|
||||||
|
login_fet_user
|
||||||
describe "with valid params" do
|
describe "with valid params" do
|
||||||
|
|
||||||
|
it "has a 302 status code" do
|
||||||
|
expect(action.status).to eq(302)
|
||||||
|
end
|
||||||
it "creates a new Fetprofile" do
|
it "creates a new Fetprofile" do
|
||||||
expect {
|
expect{action}.to change(Fetprofile, :count).by(1)
|
||||||
post :create, {:fetprofile => valid_attributes}, valid_session
|
|
||||||
}.to change(Fetprofile, :count).by(1)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "assigns a newly created fetprofile as @fetprofile" do
|
it_behaves_like "it assigns persisted object"
|
||||||
post :create, {:fetprofile => valid_attributes}, valid_session
|
|
||||||
assigns(:fetprofile).should be_a(Fetprofile)
|
it "assigns memberships" do
|
||||||
assigns(:fetprofile).should be_persisted
|
action
|
||||||
|
expect(assigns(:memberships)).to be_a(ActiveRecord::Relation)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "redirects to the created fetprofile" do
|
it "redirects to the created fetprofile" do
|
||||||
post :create, {:fetprofile => valid_attributes}, valid_session
|
expect(action).to redirect_to assigns(:fetprofile)
|
||||||
response.should redirect_to(Fetprofile.last)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "with invalid params" do
|
describe "with invalid params" do
|
||||||
it "assigns a newly created but unsaved fetprofile as @fetprofile" do
|
has_invalid_params
|
||||||
# Trigger the behavior that occurs when invalid params are submitted
|
it "assigns memberships" do
|
||||||
Fetprofile.any_instance.stub(:save).and_return(false)
|
action
|
||||||
post :create, {:fetprofile => { "vorname" => "invalid value" }}, valid_session
|
expect(assigns(:memberships)).to be_a(ActiveRecord::Relation)
|
||||||
assigns(:fetprofile).should be_a_new(Fetprofile)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "assigns a newly created but unsaved fetprofile as @fetprofile" do
|
||||||
|
action
|
||||||
|
assigns(:fetprofile).should be_a_new(Fetprofile)
|
||||||
|
expect(assigns(:fetprofile)).not_to be_persisted
|
||||||
|
end
|
||||||
it "re-renders the 'new' template" do
|
it "re-renders the 'new' template" do
|
||||||
# Trigger the behavior that occurs when invalid params are submitted
|
expect(action).to render_template("new")
|
||||||
Fetprofile.any_instance.stub(:save).and_return(false)
|
|
||||||
post :create, {:fetprofile => { "vorname" => "invalid value" }}, valid_session
|
|
||||||
response.should render_template("new")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
describe "without user" do
|
||||||
|
logout_user
|
||||||
|
it_behaves_like "it is restricted"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "PUT update" do
|
describe "PUT update" do
|
||||||
describe "with valid params" do
|
let(:action) { put :update, {:id => @fetprofile.to_param, :fetprofile => {"vorname"=>"neuerName"}} }
|
||||||
it "updates the requested fetprofile" do
|
|
||||||
fetprofile = Fetprofile.create! valid_attributes
|
|
||||||
# Assuming there are no other fetprofiles in the database, this
|
|
||||||
# specifies that the Fetprofile created on the previous line
|
|
||||||
# receives the :update_attributes message with whatever params are
|
|
||||||
# submitted in the request.
|
|
||||||
Fetprofile.any_instance.should_receive(:update_attributes).with({ "vorname" => "MyString" })
|
|
||||||
put :update, {:id => fetprofile.to_param, :fetprofile => { "vorname" => "MyString" }}, valid_session
|
|
||||||
end
|
|
||||||
|
|
||||||
it "assigns the requested fetprofile as @fetprofile" do
|
create_fetprofile
|
||||||
fetprofile = Fetprofile.create! valid_attributes
|
login_fet_user
|
||||||
put :update, {:id => fetprofile.to_param, :fetprofile => valid_attributes}, valid_session
|
|
||||||
assigns(:fetprofile).should eq(fetprofile)
|
describe "with valid params" do
|
||||||
|
it_behaves_like "it assigns object"
|
||||||
|
|
||||||
|
it "updates the requested fetprofile" do
|
||||||
|
expect { action }.to change{Fetprofile.find(@fetprofile.id).vorname}.to("neuerName")
|
||||||
end
|
end
|
||||||
|
it_behaves_like "it assigns persisted object"
|
||||||
|
|
||||||
it "redirects to the fetprofile" do
|
it "redirects to the fetprofile" do
|
||||||
fetprofile = Fetprofile.create! valid_attributes
|
expect(action).to redirect_to(@fetprofile)
|
||||||
put :update, {:id => fetprofile.to_param, :fetprofile => valid_attributes}, valid_session
|
|
||||||
response.should redirect_to(fetprofile)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "with invalid params" do
|
describe "with invalid params" do
|
||||||
it "assigns the fetprofile as @fetprofile" do
|
has_invalid_params
|
||||||
fetprofile = Fetprofile.create! valid_attributes
|
it_behaves_like "it assigns object"
|
||||||
# Trigger the behavior that occurs when invalid params are submitted
|
|
||||||
Fetprofile.any_instance.stub(:save).and_return(false)
|
|
||||||
put :update, {:id => fetprofile.to_param, :fetprofile => { "vorname" => "invalid value" }}, valid_session
|
|
||||||
assigns(:fetprofile).should eq(fetprofile)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "re-renders the 'edit' template" do
|
it "re-renders the 'edit' template" do
|
||||||
fetprofile = Fetprofile.create! valid_attributes
|
expect(action).to render_template("edit")
|
||||||
# Trigger the behavior that occurs when invalid params are submitted
|
|
||||||
Fetprofile.any_instance.stub(:save).and_return(false)
|
|
||||||
put :update, {:id => fetprofile.to_param, :fetprofile => { "vorname" => "invalid value" }}, valid_session
|
|
||||||
response.should render_template("edit")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
describe "without user" do
|
||||||
|
logout_user
|
||||||
|
it_behaves_like "it is restricted"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "DELETE destroy" do
|
describe "DELETE destroy" do
|
||||||
|
login_fet_user
|
||||||
|
create_fetprofile
|
||||||
|
subject(:action) { delete :destroy, {:id => @fetprofile.to_param}}
|
||||||
|
|
||||||
it "destroys the requested fetprofile" do
|
it "destroys the requested fetprofile" do
|
||||||
fetprofile = Fetprofile.create! valid_attributes
|
|
||||||
expect {
|
expect {
|
||||||
delete :destroy, {:id => fetprofile.to_param}, valid_session
|
action
|
||||||
}.to change(Fetprofile, :count).by(-1)
|
}.to change(Fetprofile, :count).by(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "redirects to the fetprofiles list" do
|
it "redirects to the fetprofiles list" do
|
||||||
fetprofile = Fetprofile.create! valid_attributes
|
action
|
||||||
delete :destroy, {:id => fetprofile.to_param}, valid_session
|
|
||||||
response.should redirect_to(fetprofiles_url)
|
response.should redirect_to(fetprofiles_url)
|
||||||
end
|
end
|
||||||
|
describe "without user" do
|
||||||
|
logout_user
|
||||||
|
it_behaves_like "it is restricted"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,160 +1,179 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
describe GremienController, :type => :controller do
|
||||||
# It demonstrates how one might use RSpec to specify the controller code that
|
let(:valid_update_attributes) { {"name"=>"NeuesGremium"} }
|
||||||
# was generated by Rails when you ran the scaffold generator.
|
# let(:valid_session) { {locale: :de} }
|
||||||
#
|
|
||||||
# It assumes that the implementation code is generated by the rails scaffold
|
|
||||||
# generator. If you are using any extension libraries to generate different
|
|
||||||
# controller code, this generated spec may or may not pass.
|
|
||||||
#
|
|
||||||
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
|
||||||
# of tools you can use to make these specs even more expressive, but we're
|
|
||||||
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
|
||||||
#
|
|
||||||
# Compared to earlier versions of this generator, there is very limited use of
|
|
||||||
# stubs and message expectations in this spec. Stubs are only used when there
|
|
||||||
# is no simpler way to get a handle on the object needed for the example.
|
|
||||||
# Message expectations are only used when there is no simpler way to specify
|
|
||||||
# that an instance is receiving a specific message.
|
|
||||||
|
|
||||||
describe GremienController do
|
def self.create_gremium
|
||||||
|
before(:each) do
|
||||||
|
@gremium = FactoryGirl.create(:gremium)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# def self.create_active_gremium
|
||||||
|
# before(:each) do
|
||||||
|
# @gremium = FactoryGirl.create(:gremium, active: true)
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
# This should return the minimal set of attributes required to create a valid
|
let(:object_variable) {:gremium}
|
||||||
# Gremium. As you add validations to Gremium, be sure to
|
let(:assigned_object_variable) {@gremium}
|
||||||
# adjust the attributes here as well.
|
let(:object_class) {Gremium}
|
||||||
let(:valid_attributes) { { "name" => "MyString" } }
|
|
||||||
|
|
||||||
# This should return the minimal set of values that should be in the session
|
|
||||||
# in order to pass any filters (e.g. authentication) defined in
|
|
||||||
# GremienController. Be sure to keep this updated too.
|
|
||||||
let(:valid_session) { {} }
|
|
||||||
|
|
||||||
describe "GET index" do
|
describe "GET index" do
|
||||||
it "assigns all gremien as @gremien" do
|
create_gremium
|
||||||
gremium = Gremium.create! valid_attributes
|
subject(:action) { get :index, {} }
|
||||||
get :index, {}, valid_session
|
let(:object_variable) {:gremien}
|
||||||
assigns(:gremien).should eq([gremium])
|
let(:assigned_object_variable) {[@gremium]}
|
||||||
end
|
it_behaves_like "it is success"
|
||||||
|
it_behaves_like "it assigns object"
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET show" do
|
describe "GET show" do
|
||||||
it "assigns the requested gremium as @gremium" do
|
create_gremium
|
||||||
gremium = Gremium.create! valid_attributes
|
subject(:action) { get :show, {:id => @gremium.to_param}}
|
||||||
get :show, {:id => gremium.to_param}, valid_session
|
it_behaves_like "it is success"
|
||||||
assigns(:gremium).should eq(gremium)
|
it_behaves_like "it assigns object"
|
||||||
|
it "renders the 'show' template" do
|
||||||
|
expect(action).to render_template("show")
|
||||||
end
|
end
|
||||||
|
it "assigns memberships" do
|
||||||
|
action
|
||||||
|
expect(assigns(:memberships)).to be_a(ActiveRecord::Relation)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET new" do
|
describe "GET new" do
|
||||||
it "assigns a new gremium as @gremium" do
|
subject(:action) { get :new, {}}
|
||||||
get :new, {}, valid_session
|
describe "with fetuser" do
|
||||||
assigns(:gremium).should be_a_new(Gremium)
|
login_fet_user
|
||||||
|
it_behaves_like "it assigns new object"
|
||||||
|
it_behaves_like "it is success"
|
||||||
end
|
end
|
||||||
|
describe "without user" do
|
||||||
|
logout_user
|
||||||
|
it_behaves_like "it is restricted"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET edit" do
|
describe "GET edit" do
|
||||||
it "assigns the requested gremium as @gremium" do
|
|
||||||
gremium = Gremium.create! valid_attributes
|
subject(:action) {get :edit, :id=>@gremium.to_param}
|
||||||
get :edit, {:id => gremium.to_param}, valid_session
|
login_fet_user
|
||||||
assigns(:gremium).should eq(gremium)
|
create_gremium
|
||||||
|
it_behaves_like "it is success"
|
||||||
|
it_behaves_like "it assigns object"
|
||||||
|
it "assigns memberships" do
|
||||||
|
action
|
||||||
|
expect(assigns(:memberships)).to be_a(ActiveRecord::Relation)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "assigns the requested gremium as @gremium" do
|
||||||
|
expect{action}.to change {assigns(:gremium)}.to(@gremium)
|
||||||
|
# expect(assigns(:gremium)).to eq(@gremium)
|
||||||
|
end
|
||||||
|
describe "without user" do
|
||||||
|
logout_user
|
||||||
|
it_behaves_like "it is restricted"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST create" do
|
describe "POST create" do
|
||||||
|
subject(:action){post :create, {:gremium => FactoryGirl.attributes_for(:gremium),:format=>:html}}
|
||||||
|
|
||||||
|
login_fet_user
|
||||||
describe "with valid params" do
|
describe "with valid params" do
|
||||||
|
|
||||||
|
it "has a 302 status code" do
|
||||||
|
expect(action.status).to eq(302)
|
||||||
|
end
|
||||||
it "creates a new Gremium" do
|
it "creates a new Gremium" do
|
||||||
expect {
|
expect{action}.to change(Gremium, :count).by(1)
|
||||||
post :create, {:gremium => valid_attributes}, valid_session
|
|
||||||
}.to change(Gremium, :count).by(1)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "assigns a newly created gremium as @gremium" do
|
it_behaves_like "it assigns persisted object"
|
||||||
post :create, {:gremium => valid_attributes}, valid_session
|
|
||||||
assigns(:gremium).should be_a(Gremium)
|
|
||||||
assigns(:gremium).should be_persisted
|
|
||||||
end
|
|
||||||
|
|
||||||
it "redirects to the created gremium" do
|
it "redirects to the created gremium" do
|
||||||
post :create, {:gremium => valid_attributes}, valid_session
|
expect(action).to redirect_to assigns(:gremium)
|
||||||
response.should redirect_to(Gremium.last)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "with invalid params" do
|
describe "with invalid params" do
|
||||||
|
has_invalid_params
|
||||||
|
|
||||||
|
|
||||||
it "assigns a newly created but unsaved gremium as @gremium" do
|
it "assigns a newly created but unsaved gremium as @gremium" do
|
||||||
# Trigger the behavior that occurs when invalid params are submitted
|
action
|
||||||
Gremium.any_instance.stub(:save).and_return(false)
|
|
||||||
post :create, {:gremium => { "name" => "invalid value" }}, valid_session
|
|
||||||
assigns(:gremium).should be_a_new(Gremium)
|
assigns(:gremium).should be_a_new(Gremium)
|
||||||
|
expect(assigns(:gremium)).not_to be_persisted
|
||||||
|
end
|
||||||
|
it "re-renders the 'new' template" do
|
||||||
|
expect(action).to render_template("new")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
describe "without user" do
|
||||||
|
logout_user
|
||||||
|
it_behaves_like "it is restricted"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "re-renders the 'new' template" do
|
|
||||||
# Trigger the behavior that occurs when invalid params are submitted
|
|
||||||
Gremium.any_instance.stub(:save).and_return(false)
|
|
||||||
post :create, {:gremium => { "name" => "invalid value" }}, valid_session
|
|
||||||
response.should render_template("new")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "PUT update" do
|
describe "PUT update" do
|
||||||
describe "with valid params" do
|
let(:action) { put :update, {:id => @gremium.to_param, :gremium => {"name"=>"neuerName"}} }
|
||||||
it "updates the requested gremium" do
|
|
||||||
gremium = Gremium.create! valid_attributes
|
|
||||||
# Assuming there are no other gremien in the database, this
|
|
||||||
# specifies that the Gremium created on the previous line
|
|
||||||
# receives the :update_attributes message with whatever params are
|
|
||||||
# submitted in the request.
|
|
||||||
Gremium.any_instance.should_receive(:update_attributes).with({ "name" => "MyString" })
|
|
||||||
put :update, {:id => gremium.to_param, :gremium => { "name" => "MyString" }}, valid_session
|
|
||||||
end
|
|
||||||
|
|
||||||
it "assigns the requested gremium as @gremium" do
|
create_gremium
|
||||||
gremium = Gremium.create! valid_attributes
|
login_fet_user
|
||||||
put :update, {:id => gremium.to_param, :gremium => valid_attributes}, valid_session
|
|
||||||
assigns(:gremium).should eq(gremium)
|
describe "with valid params" do
|
||||||
|
it_behaves_like "it assigns object"
|
||||||
|
|
||||||
|
it "updates the requested gremium" do
|
||||||
|
expect { action }.to change{Gremium.find(@gremium.id).name}.to("neuerName")
|
||||||
end
|
end
|
||||||
|
it_behaves_like "it assigns persisted object"
|
||||||
|
|
||||||
it "redirects to the gremium" do
|
it "redirects to the gremium" do
|
||||||
gremium = Gremium.create! valid_attributes
|
expect(action).to redirect_to(@gremium)
|
||||||
put :update, {:id => gremium.to_param, :gremium => valid_attributes}, valid_session
|
|
||||||
response.should redirect_to(gremium)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "with invalid params" do
|
describe "with invalid params" do
|
||||||
it "assigns the gremium as @gremium" do
|
has_invalid_params
|
||||||
gremium = Gremium.create! valid_attributes
|
it_behaves_like "it assigns object"
|
||||||
# Trigger the behavior that occurs when invalid params are submitted
|
|
||||||
Gremium.any_instance.stub(:save).and_return(false)
|
|
||||||
put :update, {:id => gremium.to_param, :gremium => { "name" => "invalid value" }}, valid_session
|
|
||||||
assigns(:gremium).should eq(gremium)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "re-renders the 'edit' template" do
|
it "re-renders the 'edit' template" do
|
||||||
gremium = Gremium.create! valid_attributes
|
expect(action).to render_template("edit")
|
||||||
# Trigger the behavior that occurs when invalid params are submitted
|
|
||||||
Gremium.any_instance.stub(:save).and_return(false)
|
|
||||||
put :update, {:id => gremium.to_param, :gremium => { "name" => "invalid value" }}, valid_session
|
|
||||||
response.should render_template("edit")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
describe "without user" do
|
||||||
|
logout_user
|
||||||
|
it_behaves_like "it is restricted"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "DELETE destroy" do
|
describe "DELETE destroy" do
|
||||||
|
login_fet_user
|
||||||
|
create_gremium
|
||||||
|
subject(:action) { delete :destroy, {:id => @gremium.to_param}}
|
||||||
|
|
||||||
it "destroys the requested gremium" do
|
it "destroys the requested gremium" do
|
||||||
gremium = Gremium.create! valid_attributes
|
|
||||||
expect {
|
expect {
|
||||||
delete :destroy, {:id => gremium.to_param}, valid_session
|
action
|
||||||
}.to change(Gremium, :count).by(-1)
|
}.to change(Gremium, :count).by(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "redirects to the gremien list" do
|
it "redirects to the gremien list" do
|
||||||
gremium = Gremium.create! valid_attributes
|
action
|
||||||
delete :destroy, {:id => gremium.to_param}, valid_session
|
|
||||||
response.should redirect_to(gremien_url)
|
response.should redirect_to(gremien_url)
|
||||||
end
|
end
|
||||||
|
describe "without user" do
|
||||||
|
logout_user
|
||||||
|
it_behaves_like "it is restricted"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
42
spec/controllers/shared_examples/basic.rb
Normal file
42
spec/controllers/shared_examples/basic.rb
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
shared_examples "it is success" do
|
||||||
|
it "has a 200 status code" do
|
||||||
|
action
|
||||||
|
expect(response.status).to eq(200)
|
||||||
|
end
|
||||||
|
it "is success" do
|
||||||
|
action
|
||||||
|
expect(response).to be_success
|
||||||
|
end
|
||||||
|
end
|
||||||
|
shared_examples "it assigns object" do
|
||||||
|
it "assigns object variable" do
|
||||||
|
action
|
||||||
|
expect(assigns(object_variable)).to eq(assigned_object_variable)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
shared_examples "it assigns new object" do
|
||||||
|
it "assigns new object" do
|
||||||
|
action
|
||||||
|
expect(assigns(object_variable)).to be_a_new(object_class)
|
||||||
|
expect(assigns(object_variable)).not_to be_persisted
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
shared_examples "it assigns persisted object" do
|
||||||
|
it "assigns new object" do
|
||||||
|
action
|
||||||
|
expect(assigns(object_variable)).to be_a(object_class)
|
||||||
|
expect(assigns(object_variable)).to be_persisted
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples "it is restricted" do
|
||||||
|
it "is expected to raise error" do
|
||||||
|
bypass_rescue
|
||||||
|
expect { action }.to raise_error(CanCan::AccessDenied)
|
||||||
|
end
|
||||||
|
it "is not success" do
|
||||||
|
action
|
||||||
|
expect(response).not_to be_success
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -3,5 +3,7 @@
|
|||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :attachment do
|
factory :attachment do
|
||||||
name "MyString"
|
name "MyString"
|
||||||
|
datei { Rack::Test::UploadedFile.new(File.join(Rails.root,'public','fetlogo.png'))}
|
||||||
|
flag_titlepic false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,5 +2,9 @@
|
|||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :beispiel do
|
factory :beispiel do
|
||||||
|
name "BSP1"
|
||||||
|
desc "sdf"
|
||||||
|
datum Date.today
|
||||||
|
beispieldatei { Rack::Test::UploadedFile.new(File.join(Rails.root,'public','fetlogo.png'))}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,5 +9,23 @@ FactoryGirl.define do
|
|||||||
desc "MyText"
|
desc "MyText"
|
||||||
picture "MyString"
|
picture "MyString"
|
||||||
active false
|
active false
|
||||||
|
birth_month 4
|
||||||
|
birth_day 2
|
||||||
|
factory :fetprofile2 do
|
||||||
|
vorname "Sarah"
|
||||||
|
nachname "Nachname2"
|
||||||
|
short "j"
|
||||||
|
end
|
||||||
|
factory :fetprofile3 do
|
||||||
|
vorname "Thomas"
|
||||||
|
nachname "Mustermann"
|
||||||
|
end
|
||||||
|
factory :fetprofile_withadress do
|
||||||
|
street "some street"
|
||||||
|
plz "1231"
|
||||||
|
city "vienna"
|
||||||
|
telnr "sdf tel nummer"
|
||||||
|
hdynr "sdf hdy nummer"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :gremium do
|
factory :gremium do
|
||||||
name "MyString"
|
name "Kommission"
|
||||||
desc "MyText"
|
desc "Das ist eine Kommission die sich mit irgendwas beschäftigt"
|
||||||
typ "MyString"
|
typ 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
BIN
spec/factories/logo2014_64.png
Normal file
BIN
spec/factories/logo2014_64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
@@ -2,5 +2,13 @@
|
|||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :lva do
|
factory :lva do
|
||||||
|
name "Vorlesung 1"
|
||||||
|
desc "Das ist eine Vorlesung"
|
||||||
|
lvanr "001.002"
|
||||||
|
ects 3
|
||||||
|
stunden 2
|
||||||
|
pruefungsinformation "sdf"
|
||||||
|
lernaufwand "sdf"
|
||||||
|
typ 'VO'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :membership do
|
factory :membership do
|
||||||
fetprofile_id "MyString"
|
gremium_id 1
|
||||||
gremium_id "MyString"
|
fetprofile_id 1
|
||||||
start "2013-08-19"
|
start "2013-08-19"
|
||||||
stop "2013-08-19"
|
stop "2013-08-23"
|
||||||
typ "MyString"
|
typ 1
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
|
|
||||||
factory :modul do
|
factory :modul do
|
||||||
name ""
|
name ""
|
||||||
factory :other_modul do
|
factory :other_modul do
|
||||||
|
|||||||
7
spec/factories/neuigkeit.rb
Normal file
7
spec/factories/neuigkeit.rb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory :neuigkeit do
|
||||||
|
title "WIChtige Neuigkeit"
|
||||||
|
text "<p> Das ist eine wichtige Information </p>"
|
||||||
|
datum 1.days.ago
|
||||||
|
end
|
||||||
|
end
|
||||||
6
spec/factories/rubrik.rb
Normal file
6
spec/factories/rubrik.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory :rubrik do
|
||||||
|
name "Allgemeine"
|
||||||
|
desc "Allgemeine Test News"
|
||||||
|
end
|
||||||
|
end
|
||||||
11
spec/factories/users.rb
Normal file
11
spec/factories/users.rb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory :user do
|
||||||
|
email "testuser@test.at"
|
||||||
|
password "password"
|
||||||
|
password_confirmation "password"
|
||||||
|
factory :other_user do
|
||||||
|
email "othertest@test.at"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
36
spec/features/admin_spec.rb
Normal file
36
spec/features/admin_spec.rb
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
require 'spec_helper'
|
||||||
|
Capybara.add_selector(:href) do
|
||||||
|
xpath {|href| XPath.descendant[XPath.attr(:href).contains(href)] }
|
||||||
|
end
|
||||||
|
|
||||||
|
feature 'Administration', :type=> :feature do
|
||||||
|
let!(:user) {FactoryGirl.create(:user)}
|
||||||
|
let!(:rubrik) {FactoryGirl.create(:rubrik)}
|
||||||
|
|
||||||
|
|
||||||
|
let!(:themengruppe){ FactoryGirl.create(:themengruppe) }
|
||||||
|
let!(:studium) {FactoryGirl.create(:studium,:visible=>true)}
|
||||||
|
before(:each) do
|
||||||
|
FactoryGirl.create(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id)
|
||||||
|
FactoryGirl.create(:thema, id: t=YAML.load_file("#{::Rails.root.to_s}/config/start_topic.yml").to_i, themengruppe_id: themengruppe.id)
|
||||||
|
studium.id
|
||||||
|
end
|
||||||
|
def sign_in
|
||||||
|
visit '/'
|
||||||
|
user.add_role(:fetadmin)
|
||||||
|
|
||||||
|
find(:href, "sign_in").click
|
||||||
|
fill_in 'user_email', with: user.email
|
||||||
|
fill_in 'user_password', with:"password"
|
||||||
|
click_button 'Sign in'
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'change preferred theme' do
|
||||||
|
sign_in
|
||||||
|
visit "/admin/users/#{user.id}/set_preferred_theme?theme=blue2"
|
||||||
|
expect(User.find(user.id).preferredtheme).to eq("blue2")
|
||||||
|
visit "/admin/users/#{user.id}/set_preferred_theme?theme=blue1"
|
||||||
|
expect(User.find(user.id).preferredtheme).to eq("blue1")
|
||||||
|
end
|
||||||
|
end
|
||||||
53
spec/features/beispielsammlung_spec.rb
Normal file
53
spec/features/beispielsammlung_spec.rb
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
require 'spec_helper'
|
||||||
|
Capybara.add_selector(:href) do
|
||||||
|
xpath {|href| XPath.descendant[XPath.attr(:href).contains(href)] }
|
||||||
|
end
|
||||||
|
feature 'Beispielsammlung', :type=>:feature do
|
||||||
|
let!(:rubrik) {FactoryGirl.create(:rubrik)}
|
||||||
|
let!(:user) {FactoryGirl.create(:user)}
|
||||||
|
let!(:themengruppe){ FactoryGirl.create(:themengruppe) }
|
||||||
|
let!(:studium) {FactoryGirl.create(:studium,:visible=>true)}
|
||||||
|
before(:each) do
|
||||||
|
FactoryGirl.create(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id)
|
||||||
|
FactoryGirl.create(:thema, id: t=YAML.load_file("#{::Rails.root.to_s}/config/start_topic.yml").to_i, themengruppe_id: themengruppe.id)
|
||||||
|
studium.id
|
||||||
|
end
|
||||||
|
scenario 'login' do
|
||||||
|
user.add_role(:fetuser)
|
||||||
|
visit '/'
|
||||||
|
find(:href, "sign_in").click
|
||||||
|
fill_in 'user_email', with: user.email
|
||||||
|
fill_in 'user_password', with:"password"
|
||||||
|
click_button 'Sign in'
|
||||||
|
click_link 'Startseite'
|
||||||
|
end
|
||||||
|
def sign_in
|
||||||
|
visit '/'
|
||||||
|
user.add_role(:fetadmin)
|
||||||
|
|
||||||
|
find(:href, "sign_in").click
|
||||||
|
fill_in 'user_email', with: user.email
|
||||||
|
fill_in 'user_password', with:"password"
|
||||||
|
click_button 'Sign in'
|
||||||
|
end
|
||||||
|
scenario 'anonym user visits beispielsammlung' do
|
||||||
|
# sign_in
|
||||||
|
visit "/"
|
||||||
|
click_link 'Beispielsammlung'
|
||||||
|
expect(page).to have_text(studium.title)
|
||||||
|
# expect(page).to have_tag("link to lva")
|
||||||
|
# click_link 'LVA1'
|
||||||
|
# expect(page).to have_text(beispiel.name)
|
||||||
|
end
|
||||||
|
scenario 'load something up' do
|
||||||
|
visit "/"
|
||||||
|
click_link 'Beispiel hinzufügen'
|
||||||
|
page.attach_file('beispiel[beispieldatei]', Rails.root + 'spec/factories/logo2014_64.png')
|
||||||
|
click_button "Create Beispiel"
|
||||||
|
|
||||||
|
# find(:href,"/beispiele/new").click
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@@ -1,5 +1,33 @@
|
|||||||
require "spec_helper"
|
require "spec_helper"
|
||||||
|
|
||||||
describe NewsMailer do
|
describe NewsMailer do
|
||||||
|
include Rails.application.routes.url_helpers
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
describe 'neuigkeit_mail' do
|
||||||
|
before(:each) do
|
||||||
|
|
||||||
|
rubrik = FactoryGirl.create(:rubrik)
|
||||||
|
@neuigkeit=FactoryGirl.create(:neuigkeit, author_id: user.id, rubrik_id: rubrik.id)
|
||||||
|
NewsMailer.stub(:default_url_options).and_return({host:"localhost", port: 3000})
|
||||||
|
end
|
||||||
|
let(:user) {User.first || FactoryGirl.create(:user)}
|
||||||
|
let(:email) {"test@mail.com"}
|
||||||
|
let(:neuigkeit) {@neuigkeit}
|
||||||
|
|
||||||
|
let(:mail) {NewsMailer.neuigkeit_mail(email.to_s, neuigkeit.id)}
|
||||||
|
it "renders neuigkeit title" do
|
||||||
|
expect(mail.body.to_s).to match(/#{@neuigkeit.title}/)
|
||||||
|
end
|
||||||
|
it "renders neuigkeit expect" do
|
||||||
|
expect(mail.body.to_s).to match(/#{@neuigkeit.text}/)
|
||||||
|
end
|
||||||
|
it "is sent to current user" do
|
||||||
|
expect(mail.to).to eq([user.email])
|
||||||
|
end
|
||||||
|
it "links to web page" do
|
||||||
|
expect(mail.body.to_s).to match(/#{neuigkeit_url(@neuigkeit, locale: nil, theme: nil, host:"localhost", port: 3000)}/)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,4 +2,15 @@ require 'spec_helper'
|
|||||||
|
|
||||||
describe Attachment do
|
describe Attachment do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
let(:attachment) {FactoryGirl.build_stubbed(:attachment)}
|
||||||
|
it "responds to image" do
|
||||||
|
expect(attachment.respond_to?(:image?)).to be true
|
||||||
|
end
|
||||||
|
it "is an image" do
|
||||||
|
expect(attachment.image?).to be true
|
||||||
|
end
|
||||||
|
it "is valid" do
|
||||||
|
expect(attachment).to be_valid
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,59 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Beispiel do
|
describe Beispiel, :type=>:model do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
let_studium_lva
|
||||||
|
# before(:each) do
|
||||||
|
# s=FactoryGirl.create(:studium)
|
||||||
|
# mg=FactoryGirl.create(:modulgruppe, studium_id: s.id)#
|
||||||
|
|
||||||
|
# m=FactoryGirl.build(:other_modul)
|
||||||
|
# m.modulgruppen << mg
|
||||||
|
# m.save!
|
||||||
|
|
||||||
|
# @l=FactoryGirl.build(:lva)
|
||||||
|
# @l.modul << m
|
||||||
|
# @l.save!
|
||||||
|
# end
|
||||||
|
let(:lva){FactoryGirl.build_stubbed(:lva)}
|
||||||
|
let(:beispiel){FactoryGirl.build(:beispiel, lva: lva)}
|
||||||
|
|
||||||
|
it "should be created" do
|
||||||
|
expect{beispiel.save!; Sunspot.commit}.to change{Beispiel.count}.by(1)
|
||||||
|
end
|
||||||
|
it "is not valid without lva" do
|
||||||
|
b=FactoryGirl.build(:beispiel)
|
||||||
|
expect(b.valid?).to be false
|
||||||
|
end
|
||||||
|
it "responds to comments" do
|
||||||
|
expect(beispiel.respond_to?(:comments)).to be true
|
||||||
|
end
|
||||||
|
it "responds to get_flag" do
|
||||||
|
expect(beispiel.respond_to?(:get_flag)).to be true
|
||||||
|
end
|
||||||
|
[:delete, :goodquality, :badquality].each do |flg|
|
||||||
|
it " has default false for flag #{flg}" do
|
||||||
|
b=beispiel
|
||||||
|
expect(b.respond_to?(:get_flag)).to be true
|
||||||
|
expect(b.get_flag(flg)).to be false
|
||||||
|
end
|
||||||
|
|
||||||
|
it "responds to flag setter #{flg}" do
|
||||||
|
expect(beispiel.respond_to?("flag_#{flg.to_s}".to_sym)).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should be in not_flag beispiele" do
|
||||||
|
beispiel.save!
|
||||||
|
bsp= Beispiel.not_flag_delete
|
||||||
|
expect(bsp).to include beispiel
|
||||||
|
end
|
||||||
|
it "should not be in not_flag" do
|
||||||
|
beispiel.save!
|
||||||
|
bsp= Beispiel.not_flag_delete
|
||||||
|
expect{beispiel.flag_delete=true; beispiel.save!}.to change{ Beispiel.not_flag_delete.count }.by(-1)
|
||||||
|
expect{beispiel.flag_delete=nil; beispiel.save!}.to change{ Beispiel.not_flag_delete.count }.by(1)
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,20 +1,57 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Calentry do
|
describe Calentry do
|
||||||
it "should be valid with full data" do
|
|
||||||
e = FactoryGirl.build(:calentry)
|
let(:rubrik) {FactoryGirl.create(:rubrik)}
|
||||||
c = FactoryGirl.create(:calendar)
|
let(:user) {FactoryGirl.create(:user)}
|
||||||
e.calendars<<c
|
let(:calendar) {FactoryGirl.create(:calendar,updated_at: 1.hour.ago)}
|
||||||
e.should be_valid
|
let(:neuigkeit) {FactoryGirl.create(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id, updated_at: 1.hour.ago)}
|
||||||
|
subject(:calentry) {FactoryGirl.build(:calentry, calendar_id: calendar.id, object_type: "Neuigkeit",object_id: neuigkeit.id)}
|
||||||
|
|
||||||
|
it "is valid with full data" do
|
||||||
|
expect(calentry).to be_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
[:ende,:start,:typ].each do |attr|
|
[:ende,:start,:typ].each do |attr|
|
||||||
it "should not be valid without #{attr}" do
|
it "is not valid without #{attr}" do
|
||||||
e= FactoryGirl.build(:calentry, attr => nil)
|
e= FactoryGirl.build(:calentry, calendar_id: calendar.id, object_type: "Neuigkeit",object_id: neuigkeit.id, attr => nil)
|
||||||
c=FactoryGirl.create(:calendar)
|
expect(e).not_to be_valid
|
||||||
e.calendars<<c
|
expect(e).to have_at_least(1).errors_on(attr)
|
||||||
e.should_not be_valid
|
|
||||||
e.should have_at_least(1).errors_on(attr)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
it "updates updated_at of neuigekit" do
|
||||||
|
expect {calentry.dauer+=1.hour;calentry.save}.to change{calentry.object.updated_at}
|
||||||
|
end
|
||||||
|
it "updates updated_at of calendar" do
|
||||||
|
expect {calentry.dauer+=1.hour;calentry.save}.to change{calentry.calendar.updated_at}
|
||||||
|
end
|
||||||
|
it "changes ende with dauer" do
|
||||||
|
expect {calentry.dauer=7}.to change(calentry,:ende).to(calentry.start+7.hours)
|
||||||
|
end
|
||||||
|
it "changes dauer with ende" do
|
||||||
|
expect {calentry.ende=calentry.start+7.hours}.to change(calentry,:dauer).to(7)
|
||||||
|
end
|
||||||
|
it "sets is upcomming" do
|
||||||
|
calentry.start=1.hour.from_now
|
||||||
|
calentry.dauer=2
|
||||||
|
expect(calentry.is_upcomming?).to be true
|
||||||
|
expect(calentry.is_past?).to be false
|
||||||
|
expect(calentry.is_ongoing?).to be false
|
||||||
|
|
||||||
|
calentry.start=1.hour.ago
|
||||||
|
calentry.dauer=2
|
||||||
|
|
||||||
|
expect(calentry.is_upcomming?).to be false
|
||||||
|
expect(calentry.is_past?).to be false
|
||||||
|
expect(calentry.is_ongoing?).to be true
|
||||||
|
|
||||||
|
calentry.start=4.hour.ago
|
||||||
|
calentry.dauer=2
|
||||||
|
|
||||||
|
expect(calentry.is_upcomming?).to be false
|
||||||
|
expect(calentry.is_past?).to be true
|
||||||
|
expect(calentry.is_ongoing?).to be false
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
require 'rails_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
RSpec.describe Crawlobject, :type => :model do
|
RSpec.describe Crawlobject do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
require 'rails_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
RSpec.describe Document, :type => :model do
|
RSpec.describe Document, :type => :model do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
|||||||
@@ -1,5 +1,30 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Fetprofile do
|
describe Fetprofile do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
[:vorname,:nachname].each do |attr|
|
||||||
|
it "should not be valid without #{attr}" do
|
||||||
|
fp = FactoryGirl.build(:fetprofile)
|
||||||
|
fp.send("#{attr}=".to_sym,nil)
|
||||||
|
fp.should_not be_valid
|
||||||
|
end
|
||||||
|
end
|
||||||
|
it "should be created" do
|
||||||
|
fp=Fetprofile.new(FactoryGirl.attributes_for(:fetprofile))
|
||||||
|
expect(fp.save).to be true
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should be valid" do
|
||||||
|
fp = FactoryGirl.build(:fetprofile)
|
||||||
|
fp.should be_valid
|
||||||
|
end
|
||||||
|
it "should not be valid with short name" do
|
||||||
|
fp = FactoryGirl.build(:fetprofile)
|
||||||
|
fp.nachname ="S"
|
||||||
|
fp.should_not be_valid
|
||||||
|
fp.vorname ="d"
|
||||||
|
fp.should_not be_valid
|
||||||
|
end
|
||||||
|
pending "have memberships"
|
||||||
|
pending "be associated to gremien"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,42 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Gremium do
|
describe Gremium do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
it "can be created" do
|
||||||
|
g=FactoryGirl.build(:gremium)
|
||||||
|
expect(g.save).to be true
|
||||||
|
end
|
||||||
|
it "is valid with all attributes" do
|
||||||
|
g = FactoryGirl.build(:gremium)
|
||||||
|
g.should be_valid
|
||||||
|
end
|
||||||
|
[:name,:typ].each do |attr|
|
||||||
|
it "should not be valid without #{attr}" do
|
||||||
|
g = FactoryGirl.build(:gremium)
|
||||||
|
g.send("#{attr}=".to_sym,nil)
|
||||||
|
expect(g).not_to be_valid
|
||||||
|
expect(g.errors[attr]).to have_at_least(1).items
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
it "is in tabs if typ is 1 or 3" do
|
||||||
|
g = FactoryGirl.create(:gremium, typ: 1)
|
||||||
|
expect(Gremium.tabs).to eq([g])
|
||||||
|
end
|
||||||
|
it "is not in tabs if typ is not 1 or 3" do
|
||||||
|
g = FactoryGirl.create(:gremium, typ: 2)
|
||||||
|
expect(Gremium.tabs).to eq([])
|
||||||
|
end
|
||||||
|
it "destroys memberships if its destroyed" do
|
||||||
|
g=FactoryGirl.create(:gremium)
|
||||||
|
fp=FactoryGirl.create(:fetprofile)
|
||||||
|
m=FactoryGirl.create(:membership, gremium_id: g.id, fetprofile_id: fp.id)
|
||||||
|
expect{g.destroy}.to change {Membership.count}.by(-1)
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
it "responds to title" do
|
||||||
|
g=FactoryGirl.build(:gremium)
|
||||||
|
expect(g.respond_to?(:title)).to be true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
require 'rails_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
RSpec.describe Key, :type => :model do
|
RSpec.describe Key, :type => :model do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
|||||||
@@ -1,5 +1,28 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Lva do
|
describe Lva, :type=>:model do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
let_studium_lva
|
||||||
|
before(:each) do
|
||||||
|
@l = FactoryGirl.build(:lva)
|
||||||
|
end
|
||||||
|
describe "if bare" do
|
||||||
|
let(:lva) {FactoryGirl.build(:lva)}
|
||||||
|
it "should be created" do
|
||||||
|
l=lva
|
||||||
|
l.modul << modul
|
||||||
|
expect{l.save!; Sunspot.commit}.to change{Lva.count}.by(1)
|
||||||
|
end
|
||||||
|
it "should not be valid without module" do
|
||||||
|
l=lva
|
||||||
|
expect(l.valid?).to be false
|
||||||
|
expect(l.errors[:modul].size).to be(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
it "should respond to semesters" do
|
||||||
|
expect(lva.respond_to?(:semester)).to be true
|
||||||
|
end
|
||||||
|
pending "should not be valid without modul"
|
||||||
|
pending "should have beispiele"
|
||||||
|
pending "should be flagable"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
require 'rails_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
RSpec.describe Meeting, :type => :model do
|
RSpec.describe Meeting, :type => :model do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
require 'rails_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
RSpec.describe Meetingtyp, :type => :model do
|
RSpec.describe Meetingtyp, :type => :model do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Modul do
|
describe Modul do
|
||||||
it "should not be valid without name" do
|
[:name].each do |attr|
|
||||||
m = FactoryGirl.build(:modul)
|
it "should not be valid without #{attr}" do
|
||||||
m.should_not be_valid
|
modul = FactoryGirl.build(:modul)
|
||||||
m.should have(1).errors_on(:name)
|
modul.send("#{attr}=".to_sym,nil)
|
||||||
|
expect(modul).not_to be_valid
|
||||||
|
expect(modul).to have_at_least(1).errors_on(attr)
|
||||||
end
|
end
|
||||||
it "should be valid with name" do
|
end
|
||||||
|
it "is valid with everything" do
|
||||||
m = FactoryGirl.build(:modul)
|
m = FactoryGirl.build(:modul)
|
||||||
m.name = "Grundlagen"
|
expect(m).to be_valid
|
||||||
m.should be_valid
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Modulgruppe do
|
describe Modulgruppe, :type =>:model do
|
||||||
it "should not be valid without studium" do
|
it "should not be valid without studium" do
|
||||||
mg=FactoryGirl.build(:modulgruppe)
|
mg=FactoryGirl.build(:modulgruppe)
|
||||||
mg.should_not be_valid
|
mg.should_not be_valid
|
||||||
@@ -42,5 +42,7 @@ describe Modulgruppe do
|
|||||||
mg.should be_valid
|
mg.should be_valid
|
||||||
|
|
||||||
end
|
end
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
pending "DRY #{__FILE__}"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
45
spec/models/neuigkeit_spec.rb
Normal file
45
spec/models/neuigkeit_spec.rb
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Neuigkeit do
|
||||||
|
let(:rubrik) {FactoryGirl.create(:rubrik)}
|
||||||
|
let(:user) {FactoryGirl.create(:user)}
|
||||||
|
let(:neuigkeit) {(FactoryGirl.build(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id))}
|
||||||
|
let(:attachment) {FactoryGirl.build_stubbed(:attachment)}
|
||||||
|
|
||||||
|
[:title,:text, :rubrik, :author].each do |attr|
|
||||||
|
it "should not be valid without #{attr}" do
|
||||||
|
neuigkeit.send("#{attr}=".to_sym,nil)
|
||||||
|
expect(neuigkeit).not_to be_valid
|
||||||
|
expect(neuigkeit.errors[attr]).to have_at_least(1).items
|
||||||
|
end
|
||||||
|
end
|
||||||
|
it "should be created" do
|
||||||
|
expect(neuigkeit).to be_valid
|
||||||
|
expect(neuigkeit.save).to be true
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should be valid" do
|
||||||
|
fp = FactoryGirl.build(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id)
|
||||||
|
expect(fp).to be_valid
|
||||||
|
end
|
||||||
|
it "responds to attachments" do
|
||||||
|
expect(neuigkeit.respond_to?(:attachments)).to be true
|
||||||
|
end
|
||||||
|
it "uses titlepic attachments as picture" do
|
||||||
|
expect(neuigkeit.respond_to?(:picture_robust)).to be true
|
||||||
|
attachment.flag_titlepic = true
|
||||||
|
expect { neuigkeit.attachments << attachment }.to change {neuigkeit.picture_robust}
|
||||||
|
end
|
||||||
|
it "is an event if it has a calentry" do
|
||||||
|
expect(neuigkeit.event?).to be false
|
||||||
|
expect{neuigkeit.calentries << calentry}.to change(neuigkeit, :event?)
|
||||||
|
end
|
||||||
|
|
||||||
|
pending "has questions"
|
||||||
|
pending "has nlinks"
|
||||||
|
pending "has calentries"
|
||||||
|
pending "can be an event"
|
||||||
|
pending "is published by date"
|
||||||
|
pending "has meeting"
|
||||||
|
pending "is shareable"
|
||||||
|
end
|
||||||
6
spec/models/news.rb
Normal file
6
spec/models/news.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
require 'models/neuigkeit_spec.rb'
|
||||||
|
require 'models/rubrik_spec.rb'
|
||||||
|
require 'models/attachment_spec.rb'
|
||||||
|
require 'models/calentry_spec.rb'
|
||||||
|
require 'models/calendar_spec.rb'
|
||||||
|
require 'models/nlink_spec.rb'
|
||||||
6
spec/models/rubrik_spec.rb
Normal file
6
spec/models/rubrik_spec.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Rubrik do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Studium do
|
describe Studium do
|
||||||
|
# test if it is invalid if certain attributes are missing
|
||||||
[:name, :zahl].each do |attr|
|
[:name, :zahl].each do |attr|
|
||||||
it "should not be valid without #{attr}" do
|
it "should not be valid without #{attr}" do
|
||||||
s = FactoryGirl.build(:studium, attr=>nil)
|
s = FactoryGirl.build(:studium, attr=>nil)
|
||||||
@@ -10,18 +11,20 @@ describe Studium do
|
|||||||
it "should create studium with valid data" do
|
it "should create studium with valid data" do
|
||||||
s=FactoryGirl.build(:studium)
|
s=FactoryGirl.build(:studium)
|
||||||
lambda {
|
lambda {
|
||||||
s.save!}.should change {Studium.count()}.by(1)
|
s.save!; Sunspot.commit}.should change {Studium.count()}.by(1)
|
||||||
end
|
end
|
||||||
it "should not accept double entrys" do
|
it "should not accept double entrys" do
|
||||||
FactoryGirl.create(:studium)
|
FactoryGirl.create(:studium)
|
||||||
|
Sunspot.commit
|
||||||
s=FactoryGirl.build(:studium)
|
s=FactoryGirl.build(:studium)
|
||||||
s.should_not be_valid
|
s.should_not be_valid
|
||||||
s.should have_at_least(1).error_on(:name)
|
s.should have_at_least(1).error_on(:name)
|
||||||
s.should have_at_least(1).error_on(:zahl)
|
s.should have_at_least(1).error_on(:zahl)
|
||||||
end
|
end
|
||||||
it "should expect zahl to be 000.000" do
|
it "should expect zahl to be 000.000" do
|
||||||
s=FactoryGirl.build(:studium, :zahl=>"000000")
|
s=FactoryGirl.build(:studium, :zahl=>"000.000")
|
||||||
|
Sunspot.commit
|
||||||
s.should_not be_valid
|
s.should_not be_valid
|
||||||
s.should have_at_least(1).error_on(:zahl)
|
expect(s.errors.size).to be > 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
require 'rails_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
RSpec.describe Survey::Answer, :type => :model do
|
RSpec.describe Survey::Answer, :type => :model do
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
require 'rails_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
RSpec.describe Survey::Choice, :type => :model do
|
RSpec.describe Survey::Choice, :type => :model do
|
||||||
|
pending "picture"
|
||||||
|
pending "icon"
|
||||||
|
pending "depended answer"
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
require 'rails_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
RSpec.describe Survey::Question, :type => :model do
|
RSpec.describe Survey::Question, :type => :model do
|
||||||
|
pending "have choices"
|
||||||
|
pending "be lockable"
|
||||||
|
pending "be flagable"
|
||||||
|
pending "copy from template"
|
||||||
|
pending "attributes for copy"
|
||||||
|
pending "have do answer"
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
end
|
end
|
||||||
|
|||||||
6
spec/models/user_spec.rb
Normal file
6
spec/models/user_spec.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe User do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,12 +1,33 @@
|
|||||||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||||
ENV["RAILS_ENV"] ||= 'test'
|
ENV["RAILS_ENV"] ||= 'test'
|
||||||
require File.expand_path("../../config/environment", __FILE__)
|
require 'rbconfig'
|
||||||
require 'rspec/rails'
|
|
||||||
require 'rspec/autorun'
|
|
||||||
|
|
||||||
|
require File.expand_path("../../config/environment", __FILE__)
|
||||||
|
#require 'rspec/autorun'
|
||||||
|
require 'rspec/rails'
|
||||||
|
|
||||||
|
|
||||||
|
#require 'minitest/autorun'
|
||||||
|
require 'sunspot_test/rspec'
|
||||||
|
require 'devise'
|
||||||
# Requires supporting ruby files with custom matchers and macros, etc,
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||||
# in spec/support/ and its subdirectories.
|
# in spec/support/ and its subdirectories.
|
||||||
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
||||||
|
Dir[Rails.root.join("spec/models/shared_examples/**/*.rb")].each {|f| require f}
|
||||||
|
Dir[Rails.root.join("spec/controllers/shared_examples/**/*.rb")].each {|f| require f}
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.include Devise::TestHelpers, :type => :controller
|
||||||
|
config.extend ControllerMacros, :type => :controller
|
||||||
|
config.extend ModelMacros, :type => :model
|
||||||
|
|
||||||
|
config.include Devise::TestHelpers, :type => :view
|
||||||
|
config.include RSpecHtmlMatchers, :type => :view
|
||||||
|
config.extend ViewMacros, :type => :view
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
# ## Mock Framework
|
# ## Mock Framework
|
||||||
@@ -18,7 +39,7 @@ RSpec.configure do |config|
|
|||||||
# config.mock_with :rr
|
# config.mock_with :rr
|
||||||
|
|
||||||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
# config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||||
|
|
||||||
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||||
# examples within a transaction, remove the following line or assign false
|
# examples within a transaction, remove the following line or assign false
|
||||||
@@ -29,10 +50,15 @@ RSpec.configure do |config|
|
|||||||
# automatically. This will be the default behavior in future versions of
|
# automatically. This will be the default behavior in future versions of
|
||||||
# rspec-rails.
|
# rspec-rails.
|
||||||
config.infer_base_class_for_anonymous_controllers = false
|
config.infer_base_class_for_anonymous_controllers = false
|
||||||
|
config.add_setting :themes
|
||||||
|
config.themes =[:blue2, :blue1]
|
||||||
# Run specs in random order to surface order dependencies. If you find an
|
# Run specs in random order to surface order dependencies. If you find an
|
||||||
# order dependency and want to debug it, you can fix the order by providing
|
# order dependency and want to debug it, you can fix the order by providing
|
||||||
# the seed, which is printed after each run.
|
# the seed, which is printed after each run.
|
||||||
# --seed 1234
|
# --seed 1234
|
||||||
config.order = "random"
|
config.order = "random"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
38
spec/support/controller_macros.rb
Normal file
38
spec/support/controller_macros.rb
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
module ControllerMacros
|
||||||
|
# include Devise::TestHelpers, :type=>:controller
|
||||||
|
def login_fet_user
|
||||||
|
before(:each) do
|
||||||
|
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
|
user = FactoryGirl.build(:user)
|
||||||
|
user = User.find_by_email(user.email) || user
|
||||||
|
user.save
|
||||||
|
user.add_role(:fetuser)
|
||||||
|
# user.confirm!
|
||||||
|
sign_in user
|
||||||
|
end
|
||||||
|
end
|
||||||
|
def login_user
|
||||||
|
before(:each) do
|
||||||
|
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
|
user = FactoryGirl.build(:other_user)
|
||||||
|
user = User.find_by_email(user.email) || user
|
||||||
|
user.save
|
||||||
|
# user.confirm!
|
||||||
|
sign_in user
|
||||||
|
end
|
||||||
|
end
|
||||||
|
def logout_user
|
||||||
|
before(:each) do
|
||||||
|
sign_out :user
|
||||||
|
end
|
||||||
|
end
|
||||||
|
def has_invalid_params
|
||||||
|
before(:each) do
|
||||||
|
object_class.any_instance.stub(:save).and_return(false)
|
||||||
|
object_class.any_instance.stub(:update_attributes).and_return(false)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user